diff --git a/src/ConRIG/Buttons/Buttons.cpp b/src/ConRIG/Buttons/Buttons.cpp index dd7314edd0c9fb1aa95dbc0f217d1bc84e80bef1..f4214f4b624a45b6179f9ff3b5f024aa68c80b59 100644 --- a/src/ConRIG/Buttons/Buttons.cpp +++ b/src/ConRIG/Buttons/Buttons.cpp @@ -50,12 +50,18 @@ mavlink_conrig_state_tc_t Buttons::getState() { return state; } void Buttons::resetState() { - state.ignition_btn = false; - state.filling_valve_btn = false; - state.venting_valve_btn = false; - state.release_pressure_btn = false; - state.quick_connector_btn = false; - state.start_tars_btn = false; + state.n2o_filling_btn = false; + state.n2o_release_btn = false; + state.n2_filling_btn = false; + state.n2_release_btn = false; + state.n2_detach_btn = false; + state.n2o_venting_btn = false; + state.nitrogen_btn = false; + state.n2o_detach_btn = false; + state.n2_quenching_btn = false; + state.n2_3way_btn = false; + state.tars_btn = false; + state.ignition_btn = false; } void Buttons::periodicStatusCheck() @@ -68,6 +74,7 @@ void Buttons::periodicStatusCheck() { guard = 0; state.ignition_btn = true; + LOG_DEBUG(logger, "Ignition button pressed"); } else { @@ -78,8 +85,35 @@ void Buttons::periodicStatusCheck() { if (guard > Config::Buttons::GUARD_THRESHOLD) { - guard = 0; - state.filling_valve_btn = true; + guard = 0; + state.n2o_filling_btn = true; + LOG_DEBUG(logger, "n2o filling button pressed"); + } + else + { + guard++; + } + } + else if (btns::n2o_release::value()) + { + if (guard > Config::Buttons::GUARD_THRESHOLD) + { + guard = 0; + state.n2o_release_btn = true; + LOG_DEBUG(logger, "n2o release button pressed"); + } + else + { + guard++; + } + } + else if (btns::n2_release::value()) + { + if (guard > Config::Buttons::GUARD_THRESHOLD) + { + guard = 0; + state.n2_release_btn = true; + LOG_DEBUG(logger, "n2 release button pressed"); } else { @@ -90,27 +124,54 @@ void Buttons::periodicStatusCheck() { if (guard > Config::Buttons::GUARD_THRESHOLD) { - guard = 0; - state.venting_valve_btn = true; + guard = 0; + state.n2o_venting_btn = true; + LOG_DEBUG(logger, "n2o venting button pressed"); } else { guard++; } } - else if (btns::n2o_release::value()) + else if (btns::n2_detach::value()) { if (guard > Config::Buttons::GUARD_THRESHOLD) { - guard = 0; - state.release_pressure_btn = true; + guard = 0; + state.n2_detach_btn = true; + LOG_DEBUG(logger, "n2 detach button pressed"); + } + else + { + guard++; + } + } + else if (btns::n2_filling::value()) + { + if (guard > Config::Buttons::GUARD_THRESHOLD) + { + guard = 0; + state.n2_filling_btn = true; + LOG_DEBUG(logger, "n2 filling button pressed"); + } + else + { + guard++; + } + } + else if (btns::nitrogen::value()) + { + if (guard > Config::Buttons::GUARD_THRESHOLD) + { + guard = 0; + state.nitrogen_btn = true; + LOG_DEBUG(logger, "nitrogen button pressed"); } else { guard++; } } - // TODO: implement missing buttons else { // Reset all the states and guard diff --git a/src/ConRIG/Buttons/Buttons.h b/src/ConRIG/Buttons/Buttons.h index 362207778c9bc720eadaef34b2f8f8557b7aea29..efe691daafffbe226b3674f9b2e17d6b1d57fc74 100644 --- a/src/ConRIG/Buttons/Buttons.h +++ b/src/ConRIG/Buttons/Buttons.h @@ -23,7 +23,7 @@ #pragma once #include <ConRIG/BoardScheduler.h> -#include <common/MavlinkLyra.h> +#include <common/MavlinkOrion.h> #include <diagnostic/PrintLogger.h> #include <scheduler/TaskScheduler.h> #include <utils/DependencyManager/DependencyManager.h> diff --git a/src/ConRIG/Configs/RadioConfig.h b/src/ConRIG/Configs/RadioConfig.h index 712e4466caf8329af70784fe95a23bffdd043d2d..735ae3f51db71ad76c0ebe6a8ce151bdc35a39b9 100644 --- a/src/ConRIG/Configs/RadioConfig.h +++ b/src/ConRIG/Configs/RadioConfig.h @@ -22,7 +22,7 @@ #pragma once -#include <common/MavlinkLyra.h> +#include <common/MavlinkOrion.h> #include <units/Frequency.h> namespace ConRIG diff --git a/src/ConRIG/Radio/Radio.cpp b/src/ConRIG/Radio/Radio.cpp index a1092628fa25d9a3ddfd867c76b59853feaa93fd..b433375176840500ab44a8dc0d59a0134195391e 100644 --- a/src/ConRIG/Radio/Radio.cpp +++ b/src/ConRIG/Radio/Radio.cpp @@ -22,7 +22,7 @@ #include "Radio.h" -#include <common/MavlinkLyra.h> +#include <common/MavlinkOrion.h> #include <common/Radio.h> #include <diagnostic/SkywardStack.h> #include <drivers/interrupt/external_interrupts.h> @@ -88,13 +88,19 @@ void Radio::handleMessage(const mavlink_message_t& msg) { Lock<FastMutex> lock{buttonsMutex}; // Reset the internal button state - buttonState.ignition_btn = false; - buttonState.filling_valve_btn = false; - buttonState.venting_valve_btn = false; - buttonState.release_pressure_btn = false; - buttonState.quick_connector_btn = false; - buttonState.start_tars_btn = false; - buttonState.arm_switch = false; + buttonState.n2o_filling_btn = false; + buttonState.n2o_release_btn = false; + buttonState.n2_filling_btn = false; + buttonState.n2_release_btn = false; + buttonState.n2_detach_btn = false; + buttonState.n2o_venting_btn = false; + buttonState.nitrogen_btn = false; + buttonState.n2o_detach_btn = false; + buttonState.n2_quenching_btn = false; + buttonState.n2_3way_btn = false; + buttonState.tars_btn = false; + buttonState.arm_switch = false; + buttonState.ignition_btn = false; } break; @@ -173,13 +179,19 @@ void Radio::setButtonsState(mavlink_conrig_state_tc_t state) Lock<FastMutex> lock{buttonsMutex}; // The OR operator is introduced to make sure that the receiver // understood the command - buttonState.ignition_btn |= state.ignition_btn; - buttonState.filling_valve_btn |= state.filling_valve_btn; - buttonState.venting_valve_btn |= state.venting_valve_btn; - buttonState.release_pressure_btn |= state.release_pressure_btn; - buttonState.quick_connector_btn |= state.quick_connector_btn; - buttonState.start_tars_btn |= state.start_tars_btn; + buttonState.n2o_filling_btn |= state.n2o_filling_btn; + buttonState.n2o_release_btn |= state.n2o_release_btn; + buttonState.n2_filling_btn |= state.n2_filling_btn; + buttonState.n2_release_btn |= state.n2_release_btn; + buttonState.n2_detach_btn |= state.n2_detach_btn; + buttonState.n2o_venting_btn |= state.n2o_venting_btn; + buttonState.nitrogen_btn |= state.nitrogen_btn; + buttonState.n2o_detach_btn |= state.n2o_detach_btn; + buttonState.n2_quenching_btn |= state.n2_quenching_btn; + buttonState.n2_3way_btn |= state.n2_3way_btn; + buttonState.tars_btn |= state.tars_btn; buttonState.arm_switch |= state.arm_switch; + buttonState.ignition_btn |= state.ignition_btn; } bool Radio::start() @@ -239,11 +251,17 @@ MavlinkStatus Radio::getMavlinkStatus() { return mavDriver->getStatus(); } Radio::Radio() { - buttonState.ignition_btn = false; - buttonState.filling_valve_btn = false; - buttonState.venting_valve_btn = false; - buttonState.release_pressure_btn = false; - buttonState.quick_connector_btn = false; - buttonState.start_tars_btn = false; - buttonState.arm_switch = false; + buttonState.n2o_filling_btn = false; + buttonState.n2o_release_btn = false; + buttonState.n2_filling_btn = false; + buttonState.n2_release_btn = false; + buttonState.n2_detach_btn = false; + buttonState.n2o_venting_btn = false; + buttonState.nitrogen_btn = false; + buttonState.n2o_detach_btn = false; + buttonState.n2_quenching_btn = false; + buttonState.n2_3way_btn = false; + buttonState.tars_btn = false; + buttonState.arm_switch = false; + buttonState.ignition_btn = false; } \ No newline at end of file diff --git a/src/ConRIG/Radio/Radio.h b/src/ConRIG/Radio/Radio.h index 6c0508892b13e47e8fefdf7fa1bea670578656fe..f9d5edb293ce01516b11dfd26ea984318950b110 100644 --- a/src/ConRIG/Radio/Radio.h +++ b/src/ConRIG/Radio/Radio.h @@ -27,7 +27,7 @@ #include <ConRIG/Buttons/Buttons.h> #include <ConRIG/Configs/RadioConfig.h> #include <ConRIG/Serial/Serial.h> -#include <common/MavlinkLyra.h> +#include <common/MavlinkOrion.h> #include <diagnostic/PrintLogger.h> #include <radio/MavlinkDriver/MavlinkDriver.h> #include <radio/SX1278/SX1278Lora.h> diff --git a/src/ConRIG/Serial/Serial.h b/src/ConRIG/Serial/Serial.h index 6d53219d13522ab729166e190e18b06a234dcb14..a7a52c3555cae7adf78895a9d9e871a7b1cc9666 100644 --- a/src/ConRIG/Serial/Serial.h +++ b/src/ConRIG/Serial/Serial.h @@ -22,7 +22,7 @@ #pragma once -#include <common/MavlinkLyra.h> +#include <common/MavlinkOrion.h> #include <radio/MavlinkDriver/MavlinkDriver.h> #include <utils/DependencyManager/DependencyManager.h>