diff --git a/src/devices/inc/referee_system.h b/src/devices/inc/referee_system.h index 3fbba1e..e61b0aa 100644 --- a/src/devices/inc/referee_system.h +++ b/src/devices/inc/referee_system.h @@ -291,7 +291,7 @@ typedef struct { uint32_t State; }RFID; - + uint16_t Info_Update_Frame; uint8_t Offline_Flag; } Referee_System_t; diff --git a/src/devices/src/referee_system.c b/src/devices/src/referee_system.c index 577cf5e..ff325fc 100644 --- a/src/devices/src/referee_system.c +++ b/src/devices/src/referee_system.c @@ -192,6 +192,51 @@ void Referee_Get_Data(void) memcpy(&Referee_System.RFID, &Referee_System.Buffer[n + 7], sizeof(uint8_t[REFEREE_ROBOT_RFID_LEN-9])); n += REFEREE_ROBOT_RFID_LEN; } + else + n++; + break; + case REFEREE_DART_CLIENT: + if (Verify_CRC16_Check_Sum(Referee_System.Buffer + n, REFEREE_DART_CLIENT_LEN)) + { + memcpy(&Referee_System.Dart_Client, &Referee_System.Buffer[n + 7], sizeof(uint8_t[REFEREE_DART_CLIENT_LEN-9])); + n += REFEREE_DART_CLIENT_LEN; + } + else + n++; + break; + case REFEREE_GROUND_POS: + if (Verify_CRC16_Check_Sum(Referee_System.Buffer + n, REFEREE_GROUND_POS_LEN)) + { + memcpy(&Referee_System.Ground_Pos, &Referee_System.Buffer[n + 7], sizeof(uint8_t[REFEREE_GROUND_POS_LEN-9])); + n += REFEREE_GROUND_POS_LEN; + } + else + n++; + break; + case REFEREE_RADAR_PROGRESS: + if (Verify_CRC16_Check_Sum(Referee_System.Buffer + n, REFEREE_RADAR_PROGRESS_LEN)) + { + memcpy(&Referee_System.Radar_Progress, &Referee_System.Buffer[n + 7], sizeof(uint8_t[REFEREE_RADAR_PROGRESS_LEN-9])); + n += REFEREE_RADAR_PROGRESS_LEN; + } + else + n++; + break; + case REFEREE_SENTRY_DECISION: + if (Verify_CRC16_Check_Sum(Referee_System.Buffer + n, REFEREE_SENTRY_DECISION_LEN)) + { + memcpy(&Referee_System.Sentry_Decision, &Referee_System.Buffer[n + 7], sizeof(uint8_t[REFEREE_SENTRY_DECISION_LEN-9])); + n += REFEREE_SENTRY_DECISION_LEN; + } + else + n++; + break; + case REFEREE_RADAR_DECISION: + if (Verify_CRC16_Check_Sum(Referee_System.Buffer + n, REFEREE_RADAR_DECISION_LEN)) + { + memcpy(&Referee_System.Radar_Decision, &Referee_System.Buffer[n + 7], sizeof(uint8_t[REFEREE_RADAR_DECISION_LEN-9])); + n += REFEREE_RADAR_DECISION_LEN; + } else n++; break; diff --git a/src/ui/src/ui_interface.c b/src/ui/src/ui_interface.c index a5d5b38..1167a8f 100644 --- a/src/ui/src/ui_interface.c +++ b/src/ui/src/ui_interface.c @@ -101,12 +101,12 @@ void ui_proc_ ## num##_frame(ui_ ## num##_frame_t *msg) { \ msg->header.SOF = 0xA5; \ msg->header.length = 6 + 15 * num; \ msg->header.seq = seq++; \ - msg->header.crc8 = calc_crc8((uint8_t*)msg, 4); \ + msg->header.crc8 = Verify_CRC8_Check_Sum((uint8_t*)msg, 4); \ msg->header.cmd_id = 0x0301; \ msg->header.sub_id = id; \ msg->header.send_id = ui_self_id; \ msg->header.recv_id = ui_self_id + 256; \ - msg->crc16 = calc_crc16((uint8_t*)msg, 13 + 15 * num); \ + msg->crc16 = Verify_CRC16_Check_Sum((uint8_t*)msg, 13 + 15 * num); \ } DEFINE_FRAME_PROC(1, 0x0101) @@ -118,11 +118,11 @@ void ui_proc_string_frame(ui_string_frame_t *msg) { msg->header.SOF = 0xA5; msg->header.length = 51; msg->header.seq = seq++; - msg->header.crc8 = calc_crc8((uint8_t *) msg, 4); + msg->header.crc8 = Verify_CRC8_Check_Sum((uint8_t *) msg, 4); msg->header.cmd_id = 0x0301; msg->header.sub_id = 0x0110; msg->header.send_id = ui_self_id; msg->header.recv_id = ui_self_id + 256; msg->option.str_length = strlen(msg->option.string); - msg->crc16 = calc_crc16((uint8_t *) msg, 58); + msg->crc16 = Verify_CRC16_Check_Sum((uint8_t *) msg, 58); }