comments
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good

This commit is contained in:
2023-02-22 19:14:35 +01:00
parent 29179bde0c
commit 0fa1bab94d
5 changed files with 29 additions and 10 deletions

View File

@@ -1373,19 +1373,23 @@ void ThermalController::ctrlHeater(heater::Switchers switchNr, heater::Switchers
struct TempLimits& tempLimit) {
componentAboveCutOffLimit = false;
// Heater off
if (not heaterHandler.checkSwitchState(switchNr)) {
if (not heaterHandler.checkSwitchState(switchNr) and not thermalStates[thermalComponent].heating) {
if (sensorTemp < tempLimit.opLowerLimit) {
heaterHandler.switchHeater(switchNr, HeaterHandler::SwitchState::ON);
sif::info << "ThermalController::ctrlHeater: Heater" << switchNr << " ON" << std::endl;
thermalStates[thermalComponent].heating = true;
//TODO: EVENT
//TODO: merken wenn an oder ausgeschaltet und erst nach drei zyklen wieder checken? wenn in transition dann paar mal skippen mit transitionboolean; bool switchOnTransition und bool switchOffTasnition, counter 3 zyklen dabei checken ob tansition erfolgreich, bool clearen, falls drei erreicht heaterControlErrorCounter global zählen
}
// Heater on
} else if (heaterHandler.checkSwitchState(switchNr)) {
} else if (heaterHandler.checkSwitchState(switchNr) and thermalStates[thermalComponent].heating) {
if (sensorTemp >= tempLimit.opLowerLimit + TEMP_OFFSET) {
heaterHandler.switchHeater(switchNr, HeaterHandler::SwitchState::OFF);
sif::info << "ThermalController::ctrlHeater: Heater" << switchNr << " OFF" << std::endl;
sif::info << "ThermalController::ctrlHeater: Heater" << switchNr << " OFF" << std::endl; //TODO: array mit struct enthält infos
thermalStates[thermalComponent].heating = false;
}
} else if (not redSwitchNrInUse) {
} else if (redSwitchNrInUse) {
if (heaterHandler.checkSwitchState(redSwitchNr)) {
if (sensorTemp >= tempLimit.cutOffLimit) {
componentAboveCutOffLimit = true;
@@ -1417,18 +1421,18 @@ bool ThermalController::selectAndReadSensorTemp() {
for (unsigned i = 0; i < numSensors; i++) {
if (sensors[i].first and sensors[i].second != INVALID_TEMPERATURE) {
sensorTemp = sensors[i].second;
errorCounters[thermalComponent] = 0;
thermalStates[thermalComponent].errorCounter = 0;
return true;
}
}
errorCounters[thermalComponent] ++;
thermalStates[thermalComponent].errorCounter ++;
if(thermalComponent != rw and thermalComponent != acsBoard){
if (errorCounters[thermalComponent] <= 3){
if (thermalStates[thermalComponent].errorCounter <= 3){
triggerEvent(NO_VALID_SENSOR_TEMPERATURE, thermalComponent);
}
}else{
if (errorCounters[thermalComponent] <= 8){
if (thermalStates[thermalComponent].errorCounter <= 8){
triggerEvent(NO_VALID_SENSOR_TEMPERATURE, thermalComponent);
}
}