Skip to content

Commit

Permalink
Only give bad-read feedback ifdef both SERIALERRORS and FEEDBACK
Browse files Browse the repository at this point in the history
  • Loading branch information
philwmcdonald committed Aug 15, 2021
1 parent 859a175 commit 30984f7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Code/include/megadesk.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const char txMarker = '>'; // default start marker from desk (Tx)
const char lateMarker = '!'; // when reporting delayUntil was late
const char bootfailMarker = '*'; // when linInit fails to communicate
const char badPID8Marker = '8'; // when pid8 fails to respond
const char badPID9Marker = '9'; // when pid8 fails to respond
const char badPID9Marker = '9'; // when pid9 fails to respond
const char DriftMarker = 'D'; // when pid8 and pid9 report different positions
const char response_idle = 'i'; // indicates the type of idle packet
const char response_error = 'E'; // indicates an error
Expand Down
12 changes: 8 additions & 4 deletions Code/src/megadesk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -779,23 +779,27 @@ uint8_t linBurst()
// Recv from PID 09
uint8_t chars = lin.recv(9, node_b, sizeof(node_b));
if (chars != sizeof(node_b)+1) {
#if (defined SERIALCOMMS && defined SERIALERRORS)
#ifdef SERIALERRORS
#ifdef SERIALCOMMS
writeSerial(response_error, node_b[0] | (node_b[1] << 8), chars, badPID9Marker);
#endif
#ifdef FEEDBACK
playTone(NOTE_A4, PIP_DURATION);
if (feedback) playTone(NOTE_A4, PIP_DURATION);
#endif
#endif
return 0;
}
delayUntil(5);
// Recv from PID 08
chars = lin.recv(8, node_a, sizeof(node_a));
if (chars != sizeof(node_a)+1) {
#if (defined SERIALCOMMS && defined SERIALERRORS)
#ifdef SERIALERRORS
#ifdef SERIALCOMMS
writeSerial(response_error, node_a[0] | (node_a[1] << 8), chars, badPID8Marker);
#endif
#ifdef FEEDBACK
playTone(NOTE_A4, PIP_DURATION);
if (feedback) playTone(NOTE_A4, PIP_DURATION);
#endif
#endif
return 0;
}
Expand Down

0 comments on commit 30984f7

Please sign in to comment.