Fixed checksum
Fixed a bug when requesting negative speed in the checksum calculation due to data type.
This commit is contained in:
parent
1841257078
commit
9fdb6d75f5
|
@ -322,7 +322,7 @@ int main(void) {
|
||||||
#if defined CONTROL_SERIAL_USART2 || defined CONTROL_SERIAL_USART3
|
#if defined CONTROL_SERIAL_USART2 || defined CONTROL_SERIAL_USART3
|
||||||
|
|
||||||
// Handle received data validity, timeout and fix out-of-sync if necessary
|
// Handle received data validity, timeout and fix out-of-sync if necessary
|
||||||
if (command.start == START_FRAME && command.checksum == (command.start ^ command.steer ^ command.speed)) {
|
if (command.start == START_FRAME && command.checksum == (uint16_t)(command.start ^ command.steer ^ command.speed)) {
|
||||||
if (timeoutFlag) { // Check for previous timeout flag
|
if (timeoutFlag) { // Check for previous timeout flag
|
||||||
if (timeoutCnt-- <= 0) // Timeout de-qualification
|
if (timeoutCnt-- <= 0) // Timeout de-qualification
|
||||||
timeoutFlag = 0; // Timeout flag cleared
|
timeoutFlag = 0; // Timeout flag cleared
|
||||||
|
|
Loading…
Reference in New Issue