Skip to content

Commit

Permalink
Merge branch 'main' into Referee_UI_Update
Browse files Browse the repository at this point in the history
  • Loading branch information
CuboiLeo authored May 23, 2024
2 parents 80cbc56 + f0edead commit 3c6a2cd
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/devices/inc/referee_system.h
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ typedef struct
{
uint32_t State;
}RFID;

uint16_t Info_Update_Frame;
uint8_t Offline_Flag;
} Referee_System_t;
Expand Down
45 changes: 45 additions & 0 deletions src/devices/src/referee_system.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions src/ui/src/ui_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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);
}

0 comments on commit 3c6a2cd

Please sign in to comment.