add mode helper usage
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good

This commit is contained in:
Robin Müller 2023-02-17 13:11:16 +01:00
parent 378120416a
commit c1598f8808
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC

View File

@ -52,6 +52,7 @@ ReturnValue_t HeaterHandler::performOperation(uint8_t operationCode) {
if (mainLineSwitcher->getSwitchState(mainLineSwitch) == SWITCH_OFF) {
waitForSwitchOff = false;
mode = MODE_OFF;
modeHelper.modeChanged(mode, submode);
}
}
} catch (const std::out_of_range& e) {
@ -112,6 +113,10 @@ void HeaterHandler::readCommandQueue() {
if (result == returnvalue::OK) {
continue;
}
result = modeHelper.handleModeCommand(&command);
if(result == returnvalue::OK) {
continue;
}
} while (result == returnvalue::OK);
}
@ -250,7 +255,6 @@ void HeaterHandler::handleSwitchOnCommand(heater::Switchers heaterIdx) {
// Check state of main line switch
ReturnValue_t mainSwitchState = mainLineSwitcher->getSwitchState(mainLineSwitch);
if (mainSwitchState == PowerSwitchIF::SWITCH_ON) {
mode = HasModesIF::MODE_ON;
if (checkSwitchState(heaterIdx) == SwitchState::OFF) {
gpioId_t gpioId = heater.gpioId;
result = gpioInterface->pullHigh(gpioId);
@ -265,6 +269,8 @@ void HeaterHandler::handleSwitchOnCommand(heater::Switchers heaterIdx) {
} else {
triggerEvent(SWITCH_ALREADY_ON, heaterIdx);
}
mode = HasModesIF::MODE_ON;
modeHelper.modeChanged(mode, submode);
// There is no need to send action finish replies if the sender was the
// HeaterHandler itself
if (heater.replyQueue != commandQueue->getId()) {