diff --git a/include/can/Rocket.h b/include/can/Rocket.h index 133babd..a42842d 100644 --- a/include/can/Rocket.h +++ b/include/can/Rocket.h @@ -45,6 +45,15 @@ class Rocket : public Channel, public NonNodeChannel void SetMinimumOxPressure(std::vector ¶ms, bool testOnly); void GetMinimumOxPressure(std::vector ¶ms, bool testOnly); + void SetMaximumTankPressure(std::vector ¶ms, bool testOnly); + + void SetGSEConnectionAbortEnable(std::vector ¶ms, bool testOnly); + void GetGSEConnectionAbortTimer(std::vector ¶ms, bool testOnly); + + void GetGSEConnectionAbortEnable(std::vector ¶ms, bool testOnly); + + void GetMaximumTankPressure(std::vector ¶ms, bool testOnly); + void SetHolddownTimeout(std::vector ¶ms, bool testOnly); void GetHolddownTimeout(std::vector ¶ms, bool testOnly); @@ -62,6 +71,8 @@ class Rocket : public Channel, public NonNodeChannel void RequestStatus(std::vector ¶ms, bool testOnly) override; void RequestResetSettings(std::vector ¶ms, bool testOnly) override; + + //-------------------------------Utility Functions-------------------------------// void RequestCurrentState() override; diff --git a/include/can_houbolt b/include/can_houbolt index 1e5a2ef..84dbef3 160000 --- a/include/can_houbolt +++ b/include/can_houbolt @@ -1 +1 @@ -Subproject commit 1e5a2ef28e63694ed6ec2c6c5626a4745c90b262 +Subproject commit 84dbef3502accd1edc08ac19e258f0f81f856418 diff --git a/src/can/CANManager.cpp b/src/can/CANManager.cpp index dbb863d..8161422 100644 --- a/src/can/CANManager.cpp +++ b/src/can/CANManager.cpp @@ -393,7 +393,7 @@ void CANManager::OnCANRecv(uint8_t canBusChannelID, uint32_t canID, uint8_t *pay { if (canIDStruct->info.direction == 0) { - Debug::print("Direction bit master to node %d on bus %d, delegating msg...", nodeID, canBusChannelID); + Debug::info("Direction bit master to node %d on bus %d, delegating msg...", nodeID, canBusChannelID); std::string msg; msg += "\nNode ID: " + std::to_string(nodeID) + "\n"; msg += "Channel ID: " + std::to_string(canMsg->bit.info.channel_id) + "\n"; @@ -403,7 +403,7 @@ void CANManager::OnCANRecv(uint8_t canBusChannelID, uint32_t canID, uint8_t *pay msg += std::to_string(canMsg->bit.data.uint8[i]) + " "; } msg += "\n"; - Debug::print(msg); + Debug::info(msg); //TODO: DIRTY HOTFIX, remove it std::vector channels = {0,1,2,3}; channels.erase(channels.begin()+canBusChannelID); diff --git a/src/can/Rocket.cpp b/src/can/Rocket.cpp index 4029306..c1b9e66 100644 --- a/src/can/Rocket.cpp +++ b/src/can/Rocket.cpp @@ -11,6 +11,7 @@ const std::vector Rocket::states = "MinimumChamberPressure", "MinimumFuelPressure", "MinimumOxPressure", + "MaximumTankPressure", "HolddownTimeout", "InternalControl", "Abort", @@ -26,8 +27,11 @@ const std::map> Rocket::scalingMap = {"MinimumChamberPressure", {0.0037, 0.0}}, {"MinimumFuelPressure", {0.00367, 0.0}}, {"MinimumOxPressure", {0.003735, 0.0}}, + {"MaximumTankPressure", {0.001, 0.0}}, {"HolddownTimeout", {1.0, 0.0}}, {"StateRefreshDivider", {1.0, 0.0}}, + {"GSEConnectionAbortEnable", {1.0, 0.0}}, + {"GSEConnectionAbortTimer", {1.0, 0.0}}, }; const std::map Rocket::variableMap = @@ -35,8 +39,12 @@ const std::map Rocket::variableMap = {ROCKET_MINIMUM_CHAMBER_PRESSURE, "MinimumChamberPressure"}, {ROCKET_MINIMUM_FUEL_PRESSURE, "MinimumFuelPressure"}, {ROCKET_MINIMUM_OX_PRESSURE, "MinimumOxPressure"}, + {ROCKET_MAXIMUM_TANK_PRESSURE, "MaximumTankPressure"}, {ROCKET_HOLDDOWN_TIMEOUT, "HolddownTimeout"}, {ROCKET_STATE_REFRESH_DIVIDER, "StateRefreshDivider"}, + {ROCKET_GSE_CONNECTION_ABORT_ENABLED,"GSEConnectionAbortEnable"}, + {ROCKET_GSE_CONNECTION_ABORT_TIMER,"GSEConnectionAbortTimer"} + }; Rocket::Rocket(uint8_t channelID, std::string channelName, std::vector sensorScaling, Node *parent) @@ -49,18 +57,24 @@ Rocket::Rocket(uint8_t channelID, std::string channelName, std::vector s {"GetMinimumFuelPressure", {std::bind(&Rocket::GetMinimumFuelPressure, this, std::placeholders::_1, std::placeholders::_2), {}}}, {"SetMinimumOxPressure", {std::bind(&Rocket::SetMinimumOxPressure, this, std::placeholders::_1, std::placeholders::_2), {"Value"}}}, {"GetMinimumOxPressure", {std::bind(&Rocket::GetMinimumOxPressure, this, std::placeholders::_1, std::placeholders::_2), {}}}, + {"SetMaximumTankPressure", {std::bind(&Rocket::SetMaximumTankPressure, this, std::placeholders::_1, std::placeholders::_2), {"Value"}}}, + {"GetMaximumTankPressure", {std::bind(&Rocket::GetMaximumTankPressure, this, std::placeholders::_1, std::placeholders::_2), {}}}, {"SetHolddownTimeout", {std::bind(&Rocket::SetHolddownTimeout, this, std::placeholders::_1, std::placeholders::_2), {"Value"}}}, {"GetHolddownTimeout", {std::bind(&Rocket::GetHolddownTimeout, this, std::placeholders::_1, std::placeholders::_2), {}}}, {"SetStateRefreshDivider", {std::bind(&Rocket::SetStateRefreshDivider, this, std::placeholders::_1, std::placeholders::_2), {"Value"}}}, {"GetStateRefreshDivider", {std::bind(&Rocket::GetStateRefreshDivider, this, std::placeholders::_1, std::placeholders::_2), {}}}, {"SetRocketState", {std::bind(&Rocket::SetRocketState, this, std::placeholders::_1, std::placeholders::_2), {"State"}}}, {"GetRocketState", {std::bind(&Rocket::GetRocketState, this, std::placeholders::_1, std::placeholders::_2), {}}}, + {"GetGSEConnectionAbortTimer", {std::bind(&Rocket::GetGSEConnectionAbortTimer, this, std::placeholders::_1, std::placeholders::_2), {}}}, + {"GetGSEConnectionAbortEnable", {std::bind(&Rocket::GetGSEConnectionAbortEnable, this, std::placeholders::_1, std::placeholders::_2), {}}}, + {"SetGSEConnectionAbortEnable", {std::bind(&Rocket::SetGSEConnectionAbortEnable, this, std::placeholders::_1, std::placeholders::_2), {"Value"}}}, {"ActivateInternalControl", {std::bind(&Rocket::RequestInternalControl, this, std::placeholders::_1, std::placeholders::_2), {}}}, {"Abort", {std::bind(&Rocket::RequestAbort, this, std::placeholders::_1, std::placeholders::_2), {}}}, {"EndOfFlight", {std::bind(&Rocket::RequestEndOfFlight, this, std::placeholders::_1, std::placeholders::_2), {}}}, {"AutoCheck", {std::bind(&Rocket::RequestAutoCheck, this, std::placeholders::_1, std::placeholders::_2), {}}}, {"RequestStatus", {std::bind(&Rocket::RequestStatus, this, std::placeholders::_1, std::placeholders::_2), {}}}, {"RequestResetSettings", {std::bind(&Rocket::RequestResetSettings, this, std::placeholders::_1, std::placeholders::_2), {}}}, + {"RequestResetSettings", {std::bind(&Rocket::RequestResetSettings, this, std::placeholders::_1, std::placeholders::_2), {}}}, }; } @@ -252,6 +266,50 @@ void Rocket::GetMinimumOxPressure(std::vector ¶ms, bool testOnly) } } +void Rocket::SetMaximumTankPressure(std::vector ¶ms, bool testOnly) +{ + std::vector scalingParams = scalingMap.at("MaximumTankPressure"); + + try + { + SetVariable(ROCKET_REQ_SET_VARIABLE, parent->GetNodeID(), ROCKET_MAXIMUM_TANK_PRESSURE, + scalingParams, params, parent->GetCANBusChannelID(), parent->GetCANDriver(), testOnly); + } + catch (std::exception &e) + { + throw std::runtime_error("Rocket - SetMaximumTankPressure: " + std::string(e.what())); + } +} + +void Rocket::SetGSEConnectionAbortEnable(std::vector ¶ms, bool testOnly) +{ + std::vector scalingParams = scalingMap.at("MinimumChamberPressure"); + + try + { + SetVariable(ROCKET_REQ_SET_VARIABLE, parent->GetNodeID(), ROCKET_GSE_CONNECTION_ABORT_ENABLED, + scalingParams, params, parent->GetCANBusChannelID(), parent->GetCANDriver(), testOnly); + } + catch (std::exception &e) + { + throw std::runtime_error("Rocket - SetGSEConnectionAbortEnable: " + std::string(e.what())); + } +} + + +void Rocket::GetMaximumTankPressure(std::vector ¶ms, bool testOnly) +{ + try + { + GetVariable(ROCKET_REQ_GET_VARIABLE, parent->GetNodeID(), ROCKET_MAXIMUM_TANK_PRESSURE, + params, parent->GetCANBusChannelID(), parent->GetCANDriver(), testOnly); + } + catch (std::exception &e) + { + throw std::runtime_error("Rocket - GetMaximumTankPressure: " + std::string(e.what())); + } +} + void Rocket::SetHolddownTimeout(std::vector ¶ms, bool testOnly) { std::vector scalingParams = scalingMap.at("HolddownTimeout"); @@ -416,6 +474,32 @@ void Rocket::RequestResetSettings(std::vector ¶ms, bool testOnly) } } +void Rocket::GetGSEConnectionAbortEnable(std::vector ¶ms, bool testOnly) +{ + try + { + GetVariable(ROCKET_REQ_GET_VARIABLE, parent->GetNodeID(),ROCKET_GSE_CONNECTION_ABORT_ENABLED, + params, parent->GetCANBusChannelID(), parent->GetCANDriver(), testOnly); + } + catch (std::exception &e) + { + throw std::runtime_error("Rocket - GetGSEConnectionAbortEnable: " + std::string(e.what())); + } +} +void Rocket::GetGSEConnectionAbortTimer(std::vector ¶ms, bool testOnly) +{ + try + { + GetVariable(ROCKET_REQ_GET_VARIABLE, parent->GetNodeID(),ROCKET_GSE_CONNECTION_ABORT_TIMER, + params, parent->GetCANBusChannelID(), parent->GetCANDriver(), testOnly); + } + catch (std::exception &e) + { + throw std::runtime_error("Rocket - GetGSEConnectionAbortTimer: " + std::string(e.what())); + } +} + + void Rocket::RequestCurrentState() { std::vector params; @@ -423,7 +507,10 @@ void Rocket::RequestCurrentState() GetMinimumChamberPressure(params, false); GetMinimumFuelPressure(params, false); GetMinimumOxPressure(params, false); + GetMaximumTankPressure(params, false); GetHolddownTimeout(params, false); GetStateRefreshDivider(params, false); GetRocketState(params, false); + GetGSEConnectionAbortEnable(params,false); + GetGSEConnectionAbortTimer(params, false); } \ No newline at end of file