get current uptime correctly

This commit is contained in:
Robin Müller 2022-08-12 12:29:10 +02:00
parent 8970a7379a
commit 03fa77e2b3
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC

View File

@ -377,6 +377,8 @@ void DeviceHandlerBase::doStateMachine() {
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);