feat(doorbell): add staged boot sequence and refactor main loop

This commit is contained in:
2026-02-18 00:35:48 -08:00
parent 46289b9d40
commit bfba3b02fd
15 changed files with 255 additions and 134 deletions

View File

@@ -129,19 +129,16 @@ void DisplayDriverGFX::render(const ScreenState& state) {
return;
// Check if we need full redraw
if(state.screen != _lastScreen) {
if(state.screen != _lastScreen || (state.screen == ScreenID::BOOT && state.bootStage != _lastBootStage)) {
_needsRedraw = true;
_lastScreen = state.screen;
_lastBootStage = state.bootStage;
}
switch(state.screen) {
case ScreenID::BOOT:
if(_needsRedraw) {
_gfx->fillScreen(0x000000);
_gfx->setTextColor(0xFFFF);
_gfx->setTextSize(2);
_gfx->setCursor(10, 10);
_gfx->print("KLUBHAUS BOOT");
drawBoot(state);
_needsRedraw = false;
}
break;
@@ -170,6 +167,43 @@ void DisplayDriverGFX::render(const ScreenState& state) {
}
}
void DisplayDriverGFX::drawBoot(const ScreenState& state) {
BootStage stage = state.bootStage;
_gfx->fillScreen(0x000000);
_gfx->setTextColor(0xFFFF);
_gfx->setTextSize(2);
_gfx->setCursor(10, 10);
_gfx->print("KLUBHAUS");
_gfx->setTextSize(1);
_gfx->setCursor(10, 50);
_gfx->print(BOARD_NAME);
// Show boot stage status
_gfx->setCursor(10, 80);
switch(stage) {
case BootStage::SPLASH:
_gfx->print("Initializing...");
break;
case BootStage::INIT_DISPLAY:
_gfx->print("Display OK");
break;
case BootStage::INIT_NETWORK:
_gfx->print("Network init...");
break;
case BootStage::CONNECTING_WIFI:
_gfx->print("Connecting WiFi...");
break;
case BootStage::READY:
_gfx->print("All systems go!");
break;
case BootStage::DONE:
_gfx->print("Ready!");
break;
}
}
void DisplayDriverGFX::drawAlert(const ScreenState& state) {
uint32_t elapsed = millis() - state.alertStartMs;
uint8_t pulse = static_cast<uint8_t>(180.0f + 75.0f * sinf(elapsed / 300.0f));