v6.1.0-branch #750
@ -1603,8 +1603,9 @@ void ThermalController::ctrlComponentTemperature(HeaterContext& htrCtx) {
|
|||||||
if (chooseHeater(htrCtx.switchNr, htrCtx.redSwitchNr)) {
|
if (chooseHeater(htrCtx.switchNr, htrCtx.redSwitchNr)) {
|
||||||
// Also track the counter to prevent heater handler message spam. The heater handle can only
|
// Also track the counter to prevent heater handler message spam. The heater handle can only
|
||||||
// process 2 messages per cycle.
|
// process 2 messages per cycle.
|
||||||
if (heaterCtrlAllowed() and (thermalStates[currThermalComponent].noSensorAvailableCounter < 3)) {
|
if (heaterCtrlAllowed() and
|
||||||
heaterSwitchHelper(htrCtx.switchNr, heater::SwitchState::OFF, currThermalComponent);
|
(thermalStates[ctrlCtx.thermalComponent].noSensorAvailableCounter < 3)) {
|
||||||
|
heaterSwitchHelper(htrCtx.switchNr, heater::SwitchState::OFF, ctrlCtx.thermalComponent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1622,8 +1623,8 @@ bool ThermalController::selectAndReadSensorTemp(HeaterContext& htrCtx) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
thermalStates[currThermalComponent].noSensorAvailableCounter++;
|
thermalStates[ctrlCtx.thermalComponent].noSensorAvailableCounter++;
|
||||||
if (currThermalComponent != RW and currThermalComponent != ACS_BOARD) {
|
if (ctrlCtx.thermalComponent != tcsCtrl::RW and ctrlCtx.thermalComponent != tcsCtrl::ACS_BOARD) {
|
||||||
if (thermalStates[ctrlCtx.thermalComponent].noSensorAvailableCounter <= 3) {
|
if (thermalStates[ctrlCtx.thermalComponent].noSensorAvailableCounter <= 3) {
|
||||||
triggerEvent(tcsCtrl::NO_VALID_SENSOR_TEMPERATURE, ctrlCtx.thermalComponent);
|
triggerEvent(tcsCtrl::NO_VALID_SENSOR_TEMPERATURE, ctrlCtx.thermalComponent);
|
||||||
}
|
}
|
||||||
|
@ -26,80 +26,6 @@
|
|||||||
#include <list>
|
#include <list>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
|
||||||
/**
|
|
||||||
* 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<HeaterHandler::SwitchState, heater::NUMBER_OF_SWITCHES>;
|
|
||||||
|
|
||||||
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 {
|
class ThermalController : public ExtendedControllerBase {
|
||||||
public:
|
public:
|
||||||
static constexpr uint8_t SUBMODE_NO_HEATER_CTRL = 1;
|
static constexpr uint8_t SUBMODE_NO_HEATER_CTRL = 1;
|
||||||
|
@ -34,7 +34,7 @@ struct TempLimits {
|
|||||||
* Abstraction for the state of a single thermal component
|
* Abstraction for the state of a single thermal component
|
||||||
*/
|
*/
|
||||||
struct ThermalState {
|
struct ThermalState {
|
||||||
uint8_t errorCounter;
|
uint8_t noSensorAvailableCounter;
|
||||||
// Which sensor is used for this component?
|
// Which sensor is used for this component?
|
||||||
uint8_t sensorIndex = 0;
|
uint8_t sensorIndex = 0;
|
||||||
// Is heating on for that thermal module?
|
// Is heating on for that thermal module?
|
||||||
@ -69,7 +69,7 @@ enum ThermalComponents : uint8_t {
|
|||||||
IF_BOARD = 5,
|
IF_BOARD = 5,
|
||||||
TCS_BOARD = 6,
|
TCS_BOARD = 6,
|
||||||
OBC = 7,
|
OBC = 7,
|
||||||
OBCIF_BOARD = 8,
|
LEGACY_OBCIF_BOARD = 8,
|
||||||
SBAND_TRANSCEIVER = 9,
|
SBAND_TRANSCEIVER = 9,
|
||||||
PCDUP60_BOARD = 10,
|
PCDUP60_BOARD = 10,
|
||||||
PCDUACU = 11,
|
PCDUACU = 11,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user