Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 17 additions & 40 deletions src/comms/data/comms_ref_data.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once
#pragma once

#include "comms/data/comms_data.hpp" // for CommsData
#include <stdint.h> // uintN_t
#include "comms/data/comms_data.hpp" // for CommsData
#include <stdint.h> // uintN_t

/// @copydoc GameStatus
struct GameStatusData {
Expand All @@ -24,31 +24,16 @@ struct GameResultData {

/// @copydoc GameRobotHP
struct RobotHealthData {
/// @brief health of the red hero robot
uint32_t red_hero_health = 0;
/// @brief health of the red engineer robot
uint32_t red_engineer_health = 0;
/// @brief health of the red standard 3 robot
uint32_t red_standard_3_health = 0;
/// @brief health of the red standard 4 robot
uint32_t red_standard_4_health = 0;
/// @brief health of the red standard 5 robot
uint32_t red_standard_5_health = 0;
/// @brief health of the red sentry robot
uint32_t red_sentry_health = 0;

/// @brief health of the blue hero robot
uint32_t blue_hero_health = 0;
/// @brief health of the blue engineer robot
uint32_t blue_engineer_health = 0;
/// @brief health of the blue standard 3 robot
uint32_t blue_standard_3_health = 0;
/// @brief health of the blue standard 4 robot
uint32_t blue_standard_4_health = 0;
/// @brief health of the blue standard 5 robot
uint32_t blue_standard_5_health = 0;
/// @brief health of the blue sentry robot
uint32_t blue_sentry_health = 0;
/// @copydoc GameRobotHP::hero_health
uint32_t hero_health = 0;
/// @copydoc GameRobotHP::engineer_health
uint32_t engineer_health = 0;
/// @copydoc GameRobotHP::standard_3_health
uint32_t standard_3_health = 0;
/// @copydoc GameRobotHP::standard_4_health
uint32_t standard_4_health = 0;
/// @copydoc GameRobotHP::sentry_health
uint32_t sentry_health = 0;
};
/// @copydoc EventData
struct GameEventData {
Expand Down Expand Up @@ -82,18 +67,10 @@ struct RobotPerformanceData {
};
/// @copydoc RobotPowerHeat
struct RobotPowerHeatData {
/// @copydoc RobotPowerHeat::chassis_voltage_output
uint32_t chassis_voltage_output = 0;
/// @copydoc RobotPowerHeat::chassis_current_output
uint32_t chassis_current_output = 0;
/// @copydoc RobotPowerHeat::chassis_power
float chassis_power = 0.f;
/// @copydoc RobotPowerHeat::buffer_energy
uint32_t buffer_energy = 0;
/// @copydoc RobotPowerHeat::barrel_heat_1_17mm
uint32_t barrel_heat_1_17mm = 0;
/// @copydoc RobotPowerHeat::barrel_heat_2_17mm
uint32_t barrel_heat_2_17mm = 0;
/// @copydoc RobotPowerHeat::barrel_heat_17mm
uint32_t barrel_heat_17mm = 0;
/// @copydoc RobotPowerHeat::barrel_heat_42mm
uint32_t barrel_heat_42mm = 0;
};
Expand Down Expand Up @@ -130,7 +107,7 @@ struct ProjectileAllowanceData {
/// @brief Mega struct fo al of the ref data we want to send over comms
struct CommsRefData : Comms::CommsData {
/// @brief default constructor that initializes the CommsData base class with the appropriate type label, physical medium, priority, and size for this struct
CommsRefData() : CommsData(Comms::TypeLabel::CommsRefData, Comms::PhysicalMedium::Ethernet, Comms::Priority::High, sizeof(CommsRefData)) { }
CommsRefData() : CommsData(Comms::TypeLabel::CommsRefData, Comms::PhysicalMedium::Ethernet, Comms::Priority::High, sizeof(CommsRefData)) {}
/// @brief status of the current game
GameStatusData game_status_data;
/// @brief result of the current game
Expand All @@ -151,4 +128,4 @@ struct CommsRefData : Comms::CommsData {
ProjectileAllowanceData projectile_allowance_data;
/// @brief padding to ensure proper alignment
uint32_t _padding = 0;
};
};
19 changes: 10 additions & 9 deletions src/sensors/RefSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,6 @@ void RefSystem::set_ref_data(Frame& frame, uint8_t raw_buffer[REF_MAX_PACKET_SIZ
case FrameType::EVENT_DATA:
ref_data.event_data.set_data(frame.data);
break;
case FrameType::PROJECTILE_SUPPLIER_STATUS:
ref_data.projectile_supplier_status.set_data(frame.data);
break;
case FrameType::REFEREE_WARNING:
ref_data.referee_warning.set_data(frame.data);
break;
Expand All @@ -269,9 +266,6 @@ void RefSystem::set_ref_data(Frame& frame, uint8_t raw_buffer[REF_MAX_PACKET_SIZ
case FrameType::ROBOT_BUFF:
ref_data.robot_buff.set_data(frame.data);
break;
case FrameType::AIR_SUPPORT_STATUS:
ref_data.air_support_status.set_data(frame.data);
break;
case FrameType::DAMAGE_STATUS:
ref_data.damage_status.set_data(frame.data);
damage_status_changed = true;
Expand Down Expand Up @@ -310,9 +304,6 @@ void RefSystem::set_ref_data(Frame& frame, uint8_t raw_buffer[REF_MAX_PACKET_SIZ
case FrameType::SMALL_MAP_COMMAND:
ref_data.small_map_command.set_data(frame.data);
break;
case FrameType::KBM_INTERACTION:
ref_data.kbm_interaction.set_data(frame.data);
break;
case FrameType::SMALL_MAP_RADAR_POSITION:
ref_data.small_map_radar_position.set_data(frame.data);
break;
Expand All @@ -325,6 +316,16 @@ void RefSystem::set_ref_data(Frame& frame, uint8_t raw_buffer[REF_MAX_PACKET_SIZ
case FrameType::SMALL_MAP_ROBOT_DATA:
ref_data.small_map_robot_data.set_data(frame.data);
break;
case FrameType::ROBOT_CUSTOM_CONTROLLER_DATA:
ref_data.robot_custom_controller_data.set_data(frame.data);
break;
case FrameType::ROBOT_CUSTOM_CLIENT_DATA:
ref_data.robot_custom_client_data.set_data(frame.data);
break;
case FrameType::CUSTOM_CLIENT_ROBOT_COMMAND:
ref_data.custom_client_robot_command.set_data(frame.data);
ref_data.keyboard_mouse_control.set_data(frame.data, frame.header.data_length);
break;
default:
Serial.println("Ref System::set_ref_data: Unknown Frame Type");
break;
Expand Down
Loading
Loading