Skip to content

Commit

Permalink
Quick fix to error sound during connection
Browse files Browse the repository at this point in the history
  • Loading branch information
albireox committed May 3, 2024
1 parent 84d9da0 commit 28d32a1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Binary file modified .yarn/install-state.gz
Binary file not shown.
14 changes: 11 additions & 3 deletions src/main/tron/tron.ts
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,7 @@ export class TronConnection {

// Parse messages and play sounds.
if (/\S+\s\d+\s\S+\s[f!]/.test(reply.rawLine)) {
console.log(reply.rawLine);
playSound('error');
} else if (/alert=\S+/.test(reply.rawLine)) {
playSound('error_serious');
Expand Down Expand Up @@ -388,9 +389,7 @@ export class TronConnection {
(reply.sender === 'apogee' &&
/\S+\s\d+\s\S+\s\S\sexposureState=done/.test(reply.rawLine)) ||
(reply.sender === 'boss' &&
/\S+\s\d+\s\S+\s\S\stext="Readout complete/.test(
reply.rawLine
)) ||
/\S+\s\d+\s\S+\s\S\stext="Readout complete/.test(reply.rawLine)) ||
(reply.sender === 'yao' &&
/\S+\s\d+\s\S+\s\S\sfilenames=/.test(reply.rawLine))
) {
Expand Down Expand Up @@ -490,6 +489,7 @@ export class TronConnection {
this.keywordListeners.set(sender, current);

const untracked: string[] = [];
const observatory: string = store.get('connection.observatory') ?? 'APO';

keywords.forEach((key, idx) => {
const trackedKeyword = this.trackedKeywords.get(key);
Expand All @@ -509,6 +509,14 @@ export class TronConnection {
.filter((kw) => kw.startsWith(actor))
.map((kw) => kw.split('.')[1]);

// HACK: quick fix to avoid error sound when connecting to an
// observatory without the specific actor.
if (actor === 'yao' && observatory === 'APO') {
return true;
} else if (actor === 'boss' && observatory === 'LCO') {
return true;
}

this.sendCommand(`keys getFor=${actor} ${actorKeys.join(' ')}`, true)
.awaitUntilDone()
.then(({ replies }) => {
Expand Down

0 comments on commit 28d32a1

Please sign in to comment.