Merge branch 'develop' into fancy_gps_fdir
Some checks are pending
EIVE/eive-obsw/pipeline/pr-develop Build queued...

This commit is contained in:
Robin Müller 2023-04-04 18:00:36 +02:00
commit 94c736d143
3 changed files with 35 additions and 21 deletions

View File

@ -16,6 +16,11 @@ will consitute of a breaking change warranting a new major release:
# [unreleased]
## Changed
- TCS controller now does a sanity check on the temperature values: Values below -80 C or above
160 C are ignored.
# [v1.43.0] 2023-04-04
- q7s-package: v2.4.0

View File

@ -172,7 +172,7 @@ void ThermalController::performControlOperation() {
transitionToOffCycles++;
// if heater still ON after 10 cycles, switch OFF again
if (transitionToOffCycles == 10) {
for (uint8_t i; i < heater::Switchers::NUMBER_OF_SWITCHES; i++) {
for (uint8_t i = 0; i < heater::Switchers::NUMBER_OF_SWITCHES; i++) {
heaterHandler.switchHeater(static_cast<heater::Switchers>(i),
HeaterHandler::SwitchState::OFF);
}
@ -988,13 +988,15 @@ void ThermalController::ctrlAcsBoard() {
sensors[4].first = sensorTemperatures.tcsBoard.isValid();
sensors[4].second = sensorTemperatures.tcsBoard.value;
numSensors = 5;
if (selectAndReadSensorTemp()) {
if (chooseHeater(switchNr, redSwitchNr)) {
HeaterContext htrCtx(switchNr, redSwitchNr, acsBoardLimits);
checkLimitsAndCtrlHeater(htrCtx);
{
HeaterContext htrCtx(switchNr, redSwitchNr, acsBoardLimits);
if (selectAndReadSensorTemp(htrCtx)) {
if (chooseHeater(switchNr, redSwitchNr)) {
checkLimitsAndCtrlHeater(htrCtx);
}
resetSensorsArray();
return;
}
resetSensorsArray();
return;
}
resetSensorsArray();
// B side
@ -1007,15 +1009,18 @@ void ThermalController::ctrlAcsBoard() {
sensors[3].first = sensorTemperatures.tcsBoard.isValid();
sensors[3].second = sensorTemperatures.tcsBoard.value;
numSensors = 4;
if (selectAndReadSensorTemp()) {
if (chooseHeater(switchNr, redSwitchNr)) {
HeaterContext htrCtx(switchNr, redSwitchNr, acsBoardLimits);
checkLimitsAndCtrlHeater(htrCtx);
}
} else {
if (chooseHeater(switchNr, redSwitchNr)) {
if (heaterHandler.getSwitchState(switchNr)) {
heaterHandler.switchHeater(switchNr, HeaterHandler::SwitchState::OFF);
{
HeaterContext htrCtx(switchNr, redSwitchNr, acsBoardLimits);
if (selectAndReadSensorTemp(htrCtx)) {
if (chooseHeater(switchNr, redSwitchNr)) {
checkLimitsAndCtrlHeater(htrCtx);
}
} else {
if (chooseHeater(switchNr, redSwitchNr)) {
if (heaterHandler.getSwitchState(switchNr)) {
heaterHandler.switchHeater(switchNr, HeaterHandler::SwitchState::OFF);
}
}
}
}
@ -1546,7 +1551,7 @@ void ThermalController::performThermalModuleCtrl(const HeaterSwitchStates& heate
heaterTransitionControl(heaterSwitchStates);
}
void ThermalController::ctrlComponentTemperature(HeaterContext& htrCtx) {
if (selectAndReadSensorTemp()) {
if (selectAndReadSensorTemp(htrCtx)) {
if (chooseHeater(htrCtx.switchNr, htrCtx.redSwitchNr)) {
checkLimitsAndCtrlHeater(htrCtx);
}
@ -1560,9 +1565,11 @@ void ThermalController::ctrlComponentTemperature(HeaterContext& htrCtx) {
}
resetSensorsArray();
}
bool ThermalController::selectAndReadSensorTemp() {
bool ThermalController::selectAndReadSensorTemp(HeaterContext& htrCtx) {
for (unsigned i = 0; i < numSensors; i++) {
if (sensors[i].first and sensors[i].second != INVALID_TEMPERATURE) {
if (sensors[i].first and sensors[i].second != INVALID_TEMPERATURE and
sensors[i].second > SANITY_LIMIT_LOWER_TEMP and
sensors[i].second < SANITY_LIMIT_UPPER_TEMP) {
sensorTemp = sensors[i].second;
thermalStates[thermalComponent].errorCounter = 0;
return true;
@ -1745,7 +1752,7 @@ void ThermalController::tooHotHandlerWhichClearsOneShotFlag(object_id_t object,
void ThermalController::startTransition(Mode_t mode_, Submode_t submode_) {
triggerEvent(CHANGING_MODE, mode_, submode_);
if (mode_ == MODE_OFF) {
for (uint8_t i; i < heater::Switchers::NUMBER_OF_SWITCHES; i++) {
for (uint8_t i = 0; i < heater::Switchers::NUMBER_OF_SWITCHES; i++) {
heaterHandler.switchHeater(static_cast<heater::Switchers>(i),
HeaterHandler::SwitchState::OFF);
}

View File

@ -91,6 +91,8 @@ class ThermalController : public ExtendedControllerBase {
public:
static const uint16_t INVALID_TEMPERATURE = 999;
static const uint8_t NUMBER_OF_SENSORS = 16;
static constexpr int16_t SANITY_LIMIT_LOWER_TEMP = -80;
static constexpr int16_t SANITY_LIMIT_UPPER_TEMP = 160;
ThermalController(object_id_t objectId, HeaterHandler& heater);
@ -299,7 +301,7 @@ class ThermalController : public ExtendedControllerBase {
void heaterCtrlTempTooHighHandler(HeaterContext& heaterContext, const char* whatLimit);
bool chooseHeater(heater::Switchers& switchNr, heater::Switchers redSwitchNr);
bool selectAndReadSensorTemp();
bool selectAndReadSensorTemp(HeaterContext& htrCtx);
void ctrlAcsBoard();
void ctrlMgt();