From 37ba9e4a44628e9b6f496f54d3c082e6f849c398 Mon Sep 17 00:00:00 2001 From: walkermburns Date: Mon, 5 Feb 2024 20:24:22 -0500 Subject: [PATCH] Fixed name conflicts for CAN messages in DashboardInterface --- lib/interfaces/include/DashboardInterface.h | 2 +- lib/interfaces/src/DashboardInterface.cpp | 41 +++++++++++---------- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/lib/interfaces/include/DashboardInterface.h b/lib/interfaces/include/DashboardInterface.h index e2c0965a8..5769f4015 100644 --- a/lib/interfaces/include/DashboardInterface.h +++ b/lib/interfaces/include/DashboardInterface.h @@ -65,7 +65,7 @@ struct DashComponentInterface_s bool buzzer_cmd; //making it an array of ints to support enumerated LEDs as well as //gradient/value based LEDs - LEDColors_e LED[12]; + uint8_t LED[12]; }; diff --git a/lib/interfaces/src/DashboardInterface.cpp b/lib/interfaces/src/DashboardInterface.cpp index 5cba1cdd2..f7d73162b 100644 --- a/lib/interfaces/src/DashboardInterface.cpp +++ b/lib/interfaces/src/DashboardInterface.cpp @@ -11,13 +11,13 @@ void DashboardInterface::read(const CAN_message_t &can_msg) _data.ssok = msg.ssok_above_threshold; _data.shutdown = msg.shutdown_h_above_threshold; - // _data.button.start = msg.start_btn; - // _data.button.mark = msg.mark_btn; - // _data.button.mode = msg.mode_btn; - // _data.button.mc_cycle = msg.mc_cycle_btn; - // _data.button.launch_ctrl = msg.launch_ctrl_btn; - // _data.button.torque_mode = msg.torque_mode_btn; - // _data.button.led_dimmer = msg.led_dimmer_btn; + _data.button.start = msg.start_button; + _data.button.mark = msg.mark_button; + _data.button.mode = msg.mode_button; + _data.button.mc_cycle = msg.motor_controller_cycle_button; + _data.button.launch_ctrl = msg.launch_ctrl_button; + _data.button.torque_mode = msg.torque_mode_button; + _data.button.led_dimmer = msg.led_dimmer_button; _data.buzzer_state = msg.drive_buzzer; @@ -30,19 +30,20 @@ void DashboardInterface::write() msg.drive_buzzer = _data.buzzer_cmd; // TODO: use logic as to not write data for LEDs that have not changed - // msg.bots_led = _data.LED[DashLED_e::BOTS_LED]; - // msg.launch_control_led = _data.LED[DashLED_e::LAUNCH_CONTROL_LED]; - // msg.mode_led = _data.LED[DashLED_e::MODE_LED]; - // msg.mech_brake_led = _data.LED[DashLED_e::MECH_BRAKE_LED]; - // msg.cockpit_brb_led = _data.LED[DashLED_e::COCKPIT_BRB_LED]; - // msg.inertia_led = _data.LED[DashLED_e::INERTIA_LED]; - // msg.glv_led = _data.LED[DashLED_e::GLV_LED]; - // msg.crit_charge_led = _data.LED[DashLED_e::CRIT_CHARGE_LED]; - // msg.start_led = _data.LED[DashLED_e::START_LED]; - // msg.mc_error_led = _data.LED[DashLED_e::MC_ERROR_LED]; - // msg.imd_led = _data.LED[DashLED_e::IMD_LED]; - // msg.ams_led = _data.LED[DashLED_e::AMS_LED]; - + msg.bots_led = _data.LED[DashLED_e::BOTS_LED]; + msg.launch_control_led = _data.LED[DashLED_e::LAUNCH_CONTROL_LED]; + msg.mode_led = _data.LED[DashLED_e::MODE_LED]; + msg.mechanical_brake_led = _data.LED[DashLED_e::MECH_BRAKE_LED]; + msg.cockpit_brb_led = _data.LED[DashLED_e::COCKPIT_BRB_LED]; + msg.inertia_status_led = _data.LED[DashLED_e::INERTIA_LED]; + msg.start_status_led = _data.LED[DashLED_e::START_LED]; + msg.motor_controller_error_led = _data.LED[DashLED_e::MC_ERROR_LED]; + msg.imd_led = _data.LED[DashLED_e::IMD_LED]; + msg.ams_led = _data.LED[DashLED_e::AMS_LED]; + + msg.glv_led = _data.LED[DashLED_e::GLV_LED]; + msg.pack_charge_led = _data.LED[DashLED_e::CRIT_CHARGE_LED]; + CAN_message_t can_msg; can_msg.id = Pack_DASHBOARD_MCU_STATE_hytech(&msg, can_msg.buf, &can_msg.len, NULL);