Skip to content

Commit

Permalink
Merge branch 'main' into referee_update
Browse files Browse the repository at this point in the history
  • Loading branch information
CuboiLeo authored May 24, 2024
2 parents 60d6eb0 + 77c1951 commit 985a8f7
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/app/src/debug_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ extern Daemon_Instance_t *g_remote_daemon;
#ifdef PRINT_RUNTIME_STATS
char g_debug_buffer[1024*2] = {0};
#endif
//#define DEBUG_ENABLED

const char* top_border = "\r\n\r\n\r\n/***** System Info *****/\r\n";
const char* bottom_border = "/***** End of Info *****/\r\n";
Expand Down
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
2 changes: 1 addition & 1 deletion src/devices/src/jetson_orin.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,5 +104,5 @@ void Jetson_Orin_Send_Data(void)
g_orin_data.tx_buffer[1] = g_orin_data.sending.enemy_color_flag << 1 | g_orin_data.sending.game_start_flag;
memcpy(&g_orin_data.tx_buffer[2],&g_orin_data.sending.float_byte.data_bytes[0], 32*sizeof(uint8_t));

UART_Transmit(g_orin_uart_instance_ptr, g_orin_data.tx_buffer, sizeof(g_orin_data.tx_buffer), UART_DMA);
//UART_Transmit(g_orin_uart_instance_ptr, g_orin_data.tx_buffer, sizeof(g_orin_data.tx_buffer), UART_DMA);
}
46 changes: 46 additions & 0 deletions src/devices/src/referee_system.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,13 +192,59 @@ 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;
default:
n++;
break;
}

}
else
n++;
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 @@ -104,12 +104,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 @@ -121,11 +121,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 985a8f7

Please sign in to comment.