Heater Handling #325
@ -105,23 +105,25 @@ void ThermalController::performControlOperation() {
|
||||
}
|
||||
|
||||
// TODO: Heater control
|
||||
//TODO: Hysterese offset
|
||||
if(heaterHandler.heaterVec[heater::HEATER_4_CAMERA].switchState == HeaterHandler::SwitchState::OFF){
|
||||
if(sensorTemperatures.sensor_4k_camera.value < cameraLimits.opLowerLimit) {
|
||||
// TODO: Hysterese offset
|
||||
if (heaterHandler.heaterVec[heater::HEATER_4_CAMERA].switchState ==
|
||||
HeaterHandler::SwitchState::OFF) {
|
||||
if (sensorTemperatures.sensor_4k_camera.value < cameraLimits.opLowerLimit) {
|
||||
heaterHandler.heaterVec[heater::HEATER_4_CAMERA].cmdActive = true;
|
||||
heaterHandler.heaterVec[heater::HEATER_4_CAMERA].action = HeaterHandler::SET_SWITCH_ON;
|
||||
heaterHandler.handleSwitchOnCommand(heater::HEATER_4_CAMERA);
|
||||
heater4Countdown.resetTimer();
|
||||
}
|
||||
}else if(heaterHandler.heaterVec[heater::HEATER_4_CAMERA].switchState == HeaterHandler::SwitchState::ON){
|
||||
if(sensorTemperatures.sensor_4k_camera.value < cameraLimits.opLowerLimit){
|
||||
if(heater4Countdown.hasTimedOut()){
|
||||
} else if (heaterHandler.heaterVec[heater::HEATER_4_CAMERA].switchState ==
|
||||
HeaterHandler::SwitchState::ON) {
|
||||
if (sensorTemperatures.sensor_4k_camera.value < cameraLimits.opLowerLimit) {
|
||||
if (heater4Countdown.hasTimedOut()) {
|
||||
heaterHandler.heaterVec[heater::HEATER_4_CAMERA].cmdActive = true;
|
||||
heaterHandler.heaterVec[heater::HEATER_4_CAMERA].action = HeaterHandler::SET_SWITCH_OFF;
|
||||
//triggerEvent(HEATER_TIMEOUT, heater::HEATER_4_CAMERA);
|
||||
// triggerEvent(HEATER_TIMEOUT, heater::HEATER_4_CAMERA);
|
||||
heaterHandler.handleSwitchOffCommand(heater::HEATER_4_CAMERA);
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
heaterHandler.heaterVec[heater::HEATER_4_CAMERA].cmdActive = true;
|
||||
heaterHandler.heaterVec[heater::HEATER_4_CAMERA].action = HeaterHandler::SET_SWITCH_OFF;
|
||||
heaterHandler.handleSwitchOffCommand(heater::HEATER_4_CAMERA);
|
||||
|
@ -53,11 +53,10 @@ class ThermalController : public ExtendedControllerBase {
|
||||
|
||||
private:
|
||||
static const uint32_t DELAY = 500;
|
||||
static const uint32_t OP_TIME = 1000; //TODO to be changed
|
||||
static const uint32_t OP_TIME = 1000; // TODO to be changed
|
||||
|
||||
enum class InternalState { STARTUP, INITIAL_DELAY, READY };
|
||||
|
||||
|
||||
InternalState internalState = InternalState::STARTUP;
|
||||
|
||||
HeaterHandler& heaterHandler;
|
||||
|
@ -321,8 +321,13 @@ HeaterHandler::SwitchState HeaterHandler::checkSwitchState(heater::Switchers swi
|
||||
return heaterVec.at(switchNr).switchState;
|
||||
}
|
||||
|
||||
ReturnValue_t HeaterHandler::switchHeater(heater::Switchers heater, ReturnValue_t onOff) {
|
||||
return sendSwitchCommand(heater, onOff);
|
||||
ReturnValue_t HeaterHandler::switchHeater(heater::Switchers heater, SwitchState switchState) {
|
||||
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() {
|
||||
|
@ -64,7 +64,10 @@ class HeaterHandler : public ExecutableObjectIF,
|
||||
virtual ~HeaterHandler();
|
||||
|
||||
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 sendSwitchCommand(uint8_t switchNr, ReturnValue_t onOff) override;
|
||||
@ -96,9 +99,6 @@ class HeaterHandler : public ExecutableObjectIF,
|
||||
|
||||
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.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user