diff --git a/bsp_q7s/xadc/Xadc.cpp b/bsp_q7s/xadc/Xadc.cpp index 43fc7b75..da3fbf7f 100644 --- a/bsp_q7s/xadc/Xadc.cpp +++ b/bsp_q7s/xadc/Xadc.cpp @@ -139,7 +139,7 @@ ReturnValue_t Xadc::readValFromFile(const char* filename, T& val) { } std::istringstream valSstream(valstring); valSstream >> val; - if(valSstream.bad()) { + if (valSstream.bad()) { sif::warning << "Xadc: Conversion of value to target type failed" << std::endl; fclose(fp); return returnvalue::FAILED; diff --git a/mission/controller/ThermalController.cpp b/mission/controller/ThermalController.cpp index b87540ec..553dd9c2 100644 --- a/mission/controller/ThermalController.cpp +++ b/mission/controller/ThermalController.cpp @@ -1603,9 +1603,10 @@ void ThermalController::ctrlComponentTemperature(HeaterContext& htrCtx) { if (chooseHeater(htrCtx.switchNr, htrCtx.redSwitchNr)) { // Also track the counter to prevent heater handler message spam. The heater handle can only // process 2 messages per cycle. - if (heaterCtrlAllowed() and (thermalStates[currThermalComponent].noSensorAvailableCounter < 3)) { - heaterSwitchHelper(htrCtx.switchNr, heater::SwitchState::OFF, currThermalComponent); - } + if (heaterCtrlAllowed() and + (thermalStates[ctrlCtx.thermalComponent].noSensorAvailableCounter < 3)) { + heaterSwitchHelper(htrCtx.switchNr, heater::SwitchState::OFF, ctrlCtx.thermalComponent); + } } } resetSensorsArray(); @@ -1622,8 +1623,8 @@ bool ThermalController::selectAndReadSensorTemp(HeaterContext& htrCtx) { } } - thermalStates[currThermalComponent].noSensorAvailableCounter++; - if (currThermalComponent != RW and currThermalComponent != ACS_BOARD) { + thermalStates[ctrlCtx.thermalComponent].noSensorAvailableCounter++; + if (ctrlCtx.thermalComponent != tcsCtrl::RW and ctrlCtx.thermalComponent != tcsCtrl::ACS_BOARD) { if (thermalStates[ctrlCtx.thermalComponent].noSensorAvailableCounter <= 3) { triggerEvent(tcsCtrl::NO_VALID_SENSOR_TEMPERATURE, ctrlCtx.thermalComponent); } diff --git a/mission/controller/ThermalController.h b/mission/controller/ThermalController.h index 508b49cd..1062fe97 100644 --- a/mission/controller/ThermalController.h +++ b/mission/controller/ThermalController.h @@ -26,80 +26,6 @@ #include #include -/** - * NOP Limit: Hard limit for device, usually from datasheet. Device damage is possible lif NOP limit - * is exceeded. - * OP Limit: Soft limit. Device should be switched off or TCS controller should take action if the - * limit is exceeded to avoid reaching NOP limit - */ -struct TempLimits { - TempLimits(float nopLowerLimit, float opLowerLimit, float cutOffLimit, float opUpperLimit, - float nopUpperLimit) - : opLowerLimit(opLowerLimit), - opUpperLimit(opUpperLimit), - cutOffLimit(cutOffLimit), - nopLowerLimit(nopLowerLimit), - nopUpperLimit(nopUpperLimit) {} - float opLowerLimit; - float opUpperLimit; - float cutOffLimit; - float nopLowerLimit; - float nopUpperLimit; -}; - -struct ThermalState { - uint8_t noSensorAvailableCounter; - // Which sensor is used for this component? - uint8_t sensorIndex = 0; - // Is heating on for that thermal module? - bool heating = false; - // Which switch is being used for heating the component - heater::Switch heaterSwitch = heater::Switch::NUMBER_OF_SWITCHES; - // Heater start time and end times as UNIX seconds. Please note that these times will be updated - // when a switch command is sent, with no guarantess that the heater actually went on. - uint32_t heaterStartTime = 0; - uint32_t heaterEndTime = 0; -}; - -struct HeaterState { - bool switchTransition = false; - HeaterHandler::SwitchState target = HeaterHandler::SwitchState::OFF; - uint8_t heaterSwitchControlCycles = 0; - bool trackHeaterMaxPeriod = false; - Countdown heaterOnPeriod; -}; - -using HeaterSwitchStates = std::array; - -enum ThermalComponents : uint8_t { - NONE = 0, - ACS_BOARD = 1, - MGT = 2, - RW = 3, - STR = 4, - IF_BOARD = 5, - TCS_BOARD = 6, - OBC = 7, - // Not used anymore, was identical to OBC module. - LEGACY_OBCIF_BOARD = 8, - SBAND_TRANSCEIVER = 9, - PCDUP60_BOARD = 10, - PCDUACU = 11, - PCDUPDU = 12, - PLPCDU_BOARD = 13, - PLOCMISSION_BOARD = 14, - PLOCPROCESSING_BOARD = 15, - DAC = 16, - CAMERA = 17, - DRO = 18, - X8 = 19, - HPA = 20, - TX = 21, - MPA = 22, - SCEX_BOARD = 23, - NUM_ENTRIES -}; - class ThermalController : public ExtendedControllerBase { public: static constexpr uint8_t SUBMODE_NO_HEATER_CTRL = 1; diff --git a/mission/controller/tcsDefs.h b/mission/controller/tcsDefs.h index af03f146..f5d9d180 100644 --- a/mission/controller/tcsDefs.h +++ b/mission/controller/tcsDefs.h @@ -34,7 +34,7 @@ struct TempLimits { * Abstraction for the state of a single thermal component */ struct ThermalState { - uint8_t errorCounter; + uint8_t noSensorAvailableCounter; // Which sensor is used for this component? uint8_t sensorIndex = 0; // Is heating on for that thermal module? @@ -69,7 +69,7 @@ enum ThermalComponents : uint8_t { IF_BOARD = 5, TCS_BOARD = 6, OBC = 7, - OBCIF_BOARD = 8, + LEGACY_OBCIF_BOARD = 8, SBAND_TRANSCEIVER = 9, PCDUP60_BOARD = 10, PCDUACU = 11,