Heater Handling #325

Merged
muellerr merged 78 commits from heater_handling into develop 2023-02-08 21:35:05 +01:00
4 changed files with 22 additions and 16 deletions
Showing only changes of commit 868ba0cd03 - Show all commits

View File

@ -106,14 +106,16 @@ void ThermalController::performControlOperation() {
// TODO: Heater control // TODO: Heater control
// TODO: Hysterese offset // TODO: Hysterese offset
if(heaterHandler.heaterVec[heater::HEATER_4_CAMERA].switchState == HeaterHandler::SwitchState::OFF){ if (heaterHandler.heaterVec[heater::HEATER_4_CAMERA].switchState ==
HeaterHandler::SwitchState::OFF) {
if (sensorTemperatures.sensor_4k_camera.value < cameraLimits.opLowerLimit) { if (sensorTemperatures.sensor_4k_camera.value < cameraLimits.opLowerLimit) {
heaterHandler.heaterVec[heater::HEATER_4_CAMERA].cmdActive = true; heaterHandler.heaterVec[heater::HEATER_4_CAMERA].cmdActive = true;
heaterHandler.heaterVec[heater::HEATER_4_CAMERA].action = HeaterHandler::SET_SWITCH_ON; heaterHandler.heaterVec[heater::HEATER_4_CAMERA].action = HeaterHandler::SET_SWITCH_ON;
heaterHandler.handleSwitchOnCommand(heater::HEATER_4_CAMERA); heaterHandler.handleSwitchOnCommand(heater::HEATER_4_CAMERA);
heater4Countdown.resetTimer(); heater4Countdown.resetTimer();
} }
}else if(heaterHandler.heaterVec[heater::HEATER_4_CAMERA].switchState == HeaterHandler::SwitchState::ON){ } else if (heaterHandler.heaterVec[heater::HEATER_4_CAMERA].switchState ==
HeaterHandler::SwitchState::ON) {
if (sensorTemperatures.sensor_4k_camera.value < cameraLimits.opLowerLimit) { if (sensorTemperatures.sensor_4k_camera.value < cameraLimits.opLowerLimit) {
if (heater4Countdown.hasTimedOut()) { if (heater4Countdown.hasTimedOut()) {
heaterHandler.heaterVec[heater::HEATER_4_CAMERA].cmdActive = true; heaterHandler.heaterVec[heater::HEATER_4_CAMERA].cmdActive = true;

View File

@ -57,7 +57,6 @@ class ThermalController : public ExtendedControllerBase {
enum class InternalState { STARTUP, INITIAL_DELAY, READY }; enum class InternalState { STARTUP, INITIAL_DELAY, READY };
InternalState internalState = InternalState::STARTUP; InternalState internalState = InternalState::STARTUP;
HeaterHandler& heaterHandler; HeaterHandler& heaterHandler;

View File

@ -321,8 +321,13 @@ HeaterHandler::SwitchState HeaterHandler::checkSwitchState(heater::Switchers swi
return heaterVec.at(switchNr).switchState; return heaterVec.at(switchNr).switchState;
} }
ReturnValue_t HeaterHandler::switchHeater(heater::Switchers heater, ReturnValue_t onOff) { ReturnValue_t HeaterHandler::switchHeater(heater::Switchers heater, SwitchState switchState) {
return sendSwitchCommand(heater, onOff); if (switchState == SwitchState::ON) {
return sendSwitchCommand(heater, PowerSwitchIF::SWITCH_ON);
} else if (switchState == SwitchState::OFF) {
return sendSwitchCommand(heater, PowerSwitchIF::SWITCH_OFF);
}
return returnvalue::FAILED;
} }
bool HeaterHandler::allSwitchesOff() { bool HeaterHandler::allSwitchesOff() {

View File

@ -64,7 +64,10 @@ class HeaterHandler : public ExecutableObjectIF,
virtual ~HeaterHandler(); virtual ~HeaterHandler();
protected: protected:
ReturnValue_t switchHeater(heater::Switchers heater, ReturnValue_t onOff); enum SwitchState : bool { ON = true, OFF = false };
enum SwitchAction : uint8_t { SET_SWITCH_OFF, SET_SWITCH_ON, NONE };
ReturnValue_t switchHeater(heater::Switchers heater, SwitchState switchState);
ReturnValue_t performOperation(uint8_t operationCode = 0) override; ReturnValue_t performOperation(uint8_t operationCode = 0) override;
ReturnValue_t sendSwitchCommand(uint8_t switchNr, ReturnValue_t onOff) override; ReturnValue_t sendSwitchCommand(uint8_t switchNr, ReturnValue_t onOff) override;
@ -96,9 +99,6 @@ class HeaterHandler : public ExecutableObjectIF,
static const MessageQueueId_t NO_COMMANDER = 0; static const MessageQueueId_t NO_COMMANDER = 0;
enum SwitchState : bool { ON = true, OFF = false };
enum SwitchAction : uint8_t { SET_SWITCH_OFF, SET_SWITCH_ON, NONE };
/** /**
* @brief Struct holding information about a heater command to execute. * @brief Struct holding information about a heater command to execute.
* *