| 379 | _display.Init(shouldFullResetDisplay, &globalState.currentHeader); |
| 380 | |
| 381 | if(wasHibernating){ |
| 382 | if(alarmWasSet){ |
| 383 | logl("woke up due to alarm"); |
| 384 | |
| 385 | if(power::USBConnected() == false){ |
| 386 | // we woke up from our regular scheduled minute alarm. Do the normal routine and go back to sleep. |
| 387 | globalState.lastDeepWakeupCause = DeepWakeupCause::Alarm; |
| 388 | globalState.sleepIndicator = true; |
| 389 | |
| 390 | if(!displayingColdWarningScreen) |
| 391 | loadClimateDate(); |
| 392 | |
| 393 | // if temperature dropped while night mode was active, clear the night mode flag |
| 394 | if(displayCold && globalState.currentHeader.displayingNightMode) |
| 395 | globalState.currentHeader.displayingNightMode = false; |
| 396 | |
| 397 | // night screen: suppress display updates during configured night hours |
| 398 | if(!displayCold && globalState.currentSettings.nightScreen && isNightHours(globalState.currentTime)){ |
| 399 | if(globalState.currentHeader.displayingNightMode){ |
| 400 | // night screen already showing — skip display update, just record data and sleep |
| 401 | doAlarmRoutine(false); |
| 402 | } else { |
| 403 | // first entry into night mode — show night screen and persist the flag |
| 404 | app.setState(State::NightMode); |
| 405 | globalState.currentHeader.displayingNightMode = true; |
| 406 | doAlarmRoutine(true); |
| 407 | } |
| 408 | // unreachable: doAlarmRoutine calls HibernateSystem |
| 409 | } |
| 410 | |
| 411 | bool shouldUpdateDisplay = !displayingColdWarningScreen; |
| 412 | if(shouldUpdateDisplay){ |
| 413 | uint8_t intervalMinutes = 1; |
| 414 | switch(globalState.currentSettings.refreshInterval){ |
| 415 | case RefreshInterval::_5Minutes: intervalMinutes = 5; break; |
| 416 | case RefreshInterval::_10Minutes: intervalMinutes = 10; break; |
| 417 | default: break; |
| 418 | } |
| 419 | shouldUpdateDisplay = (globalState.currentTime.Minute % intervalMinutes == 0); |
| 420 | } |
| 421 | doAlarmRoutine(shouldUpdateDisplay); |
| 422 | |
| 423 | // unreachable code due to deep sleep |
| 424 | return; |
| 425 | } |
| 426 | else if ( |
| 427 | globalState.currentHeader.shutDownReason != ShutDownReason::FirmwareUpdate && |
no test coverage detected