Skip to content

Commit

Permalink
extra logging for hdlc failures
Browse files Browse the repository at this point in the history
  • Loading branch information
W3AXL committed Aug 21, 2024
1 parent 0aff299 commit 9b230fa
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions fw/v24/src/sync.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,8 @@ void RxMessageCallback()
// If we fail to parse the message, drop sync
if (HDLCParseMsg(rxCurMsg, rxCurPos)) // minus 1 to remove the trailing flag (TODO: make it smarter)
{
log_error("Failed to parse RX HDLC message");
VCPWriteDebug1("Failed to parse RX HDLC message");
SyncReset();
}
}
Expand Down Expand Up @@ -340,7 +342,8 @@ void RxBits()
// If we've received 6 1s and the next bit is also a 1, that can't happen normally and we should drop sync
else if (rxOnesCounter == 6 && rxd == 1)
{
log_error("Received 7 consecutive 1s, this is bad, dropping sync!");
log_error("Received 7 consecutive 1s, this is bad.");
VCPWriteDebug1("Received 7 consecutive 1s, this is bad.");
SyncReset();
}
else
Expand Down Expand Up @@ -421,7 +424,8 @@ void RxBits()
}
else if (rxBitCounter > 8)
{
log_error("RX bit counter exceeded, dropping sync");
log_error("RX bit counter exceeded");
VCPWriteDebug1("RX bit counter exceeded");
SyncReset();
}
}
Expand All @@ -430,6 +434,7 @@ void RxBits()

default:
log_error("RX sync state machine got invalid state %d", SyncRxState);
VCPWriteDebug2("RX sync state machine got invalid state", SyncRxState);
SyncReset();
break;
}
Expand Down

0 comments on commit 9b230fa

Please sign in to comment.