Fixed CRC problem
This commit is contained in:
@@ -35,8 +35,10 @@ uint8_t command_calculate_crc(struct command_message_t *msg) {
|
|||||||
uint8_t crc = 0;
|
uint8_t crc = 0;
|
||||||
|
|
||||||
uint8_t *byte_ptr = (uint8_t *)msg;
|
uint8_t *byte_ptr = (uint8_t *)msg;
|
||||||
|
int loop_length = (sizeof(struct command_message_t) - sizeof(msg->data) + msg->length);
|
||||||
|
|
||||||
for (int i = 0; i < (sizeof(struct command_message_t) - sizeof(msg->data) + msg->length) - 1; i++) {
|
for (int i = 0; i < loop_length; i++) {
|
||||||
|
if (i == 4) { continue; }
|
||||||
sum += byte_ptr[i];
|
sum += byte_ptr[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user