Skip to content

Commit

Permalink
better treatment of invalid commands
Browse files Browse the repository at this point in the history
  • Loading branch information
NightHawk32 authored and tridge committed Dec 30, 2024
1 parent d4931ac commit 167d5b4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion bootloader/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -333,20 +333,23 @@ static void send_ACK()
setTransmit();
serialwriteChar(0x30); // good ack!
setReceive();
invalid_command = 0;
}

static void send_BAD_ACK()
{
setTransmit();
serialwriteChar(0xC1); // bad command message.
setReceive();
invalid_command++;
}

static void send_BAD_CRC_ACK()
{
setTransmit();
serialwriteChar(0xC2); // bad command message.
setReceive();
invalid_command++;
}

static void sendDeviceInfo()
Expand Down Expand Up @@ -453,7 +456,6 @@ static void decodeInput()
len = 4; // package without 2 byte crc
if (!checkCrc((uint8_t*)rxBuffer, len)) {
send_BAD_CRC_ACK();

return;
}

Expand Down

0 comments on commit 167d5b4

Please sign in to comment.