small order change in DHB

This commit is contained in:
Robin Müller 2022-03-28 12:21:25 +02:00
parent e6130263ef
commit 6ea1eabb2d
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
1 changed files with 2 additions and 4 deletions

View File

@ -361,14 +361,12 @@ void DeviceHandlerBase::doStateMachine() {
}
} break;
case _MODE_WAIT_OFF: {
uint32_t currentUptime;
Clock::getUptime(&currentUptime);
if (powerSwitcher == nullptr) {
setMode(MODE_OFF);
break;
}
uint32_t currentUptime;
Clock::getUptime(&currentUptime);
if (currentUptime - timeoutStart >= powerSwitcher->getSwitchDelayMs()) {
triggerEvent(MODE_TRANSITION_FAILED, PowerSwitchIF::SWITCH_TIMEOUT, 0);
setMode(MODE_ERROR_ON);