Correctly unmarshal slave error kinds

This commit is contained in:
Jasper Blanckenburg 2023-07-03 14:20:24 +02:00
parent 12422071a5
commit 410597c0f3
1 changed files with 3 additions and 2 deletions

View File

@ -91,9 +91,10 @@ void slaves_check() {
}
void slaves_handle_panic(const uint8_t *data) {
uint8_t slave_id = ftcan_unmarshal_unsigned(&data, 1);
const uint8_t **ptr = &data;
uint8_t slave_id = ftcan_unmarshal_unsigned(ptr, 1);
uint8_t idx = get_slave_index(slave_id);
uint8_t error_kind = ftcan_unmarshal_unsigned(&data, 1);
uint8_t error_kind = ftcan_unmarshal_unsigned(ptr, 1);
switch (error_kind) {
case SLAVE_PANIC_OT:
slaves[idx].error.kind = SLAVE_ERR_OT;