style: fix indentation and formatting in doorbell code

This commit is contained in:
2026-02-17 03:19:12 -08:00
parent d61c9c60bf
commit 23712a152b
2 changed files with 123 additions and 119 deletions

View File

@@ -20,52 +20,45 @@ void setup() {
logic.finishBoot();
}
// void loop() {
TouchEvent evt = display.readTouch();
void loop() {
TouchEvent evt = display.readTouch();
logic.update();
display.render(logic.getScreenState());
logic.update();
display.render(logic.getScreenState());
const ScreenState& st = logic.getScreenState();
const ScreenState& st = logic.getScreenState();
if(st.deviceState == DeviceState::ALERTING) {
HoldState h = display.updateHold(HOLD_TO_SILENCE_MS);
if(h.completed) {
logic.silenceAlert();
}
if(!h.active) {
display.updateHint();
}
} else if(evt.pressed) {
if(st.screen == ScreenID::OFF) {
// Tap in OFF mode → wake to DASHBOARD
Serial.println("[TOUCH] OFF → DASHBOARD");
logic.setScreen(ScreenID::DASHBOARD);
display.setBacklight(true);
} else if(st.screen == ScreenID::DASHBOARD) {
int tile = display.dashboardTouch(evt.x, evt.y);
if(tile >= 0) {
Serial.printf("[DASH] Tile %d tapped\n", tile);
// TODO: Handle tile actions
if(st.deviceState == DeviceState::ALERTING) {
HoldState h = display.updateHold(HOLD_TO_SILENCE_MS);
if(h.completed) {
logic.silenceAlert();
}
} else if(st.screen == ScreenID::ALERT) {
// Tap in ALERT mode → could dismiss or show more info
Serial.println("[TOUCH] ALERT tap");
// For now, let's make tap do nothing (hold to silence only)
// Or: logic.dismissAlert();
if(!h.active) {
display.updateHint();
}
} else if(evt.pressed) {
if(st.screen == ScreenID::OFF) {
// Tap in OFF mode → wake to DASHBOARD
Serial.println("[TOUCH] OFF → DASHBOARD");
logic.setScreen(ScreenID::DASHBOARD);
display.setBacklight(true);
} else if(st.screen == ScreenID::DASHBOARD) {
int tile = display.dashboardTouch(evt.x, evt.y);
if(tile >= 0) {
Serial.printf("[DASH] Tile %d tapped\n", tile);
// TODO: Handle tile actions
}
} else if(st.screen == ScreenID::ALERT) {
// Tap in ALERT mode → could dismiss or show more info
Serial.println("[TOUCH] ALERT tap");
// For now, let's make tap do nothing (hold to silence only)
// Or: logic.dismissAlert();
}
}
if(Serial.available()) {
String cmd = Serial.readStringUntil('\n');
cmd.trim();
if(cmd.length() > 0)
logic.onSerialCommand(cmd);
}
}
// Serial console (unchanged)
if(Serial.available()) {
// ...
}
}
// ── Serial console ──
if(Serial.available()) {
String cmd = Serial.readStringUntil('\n');
cmd.trim();
if(cmd.length() > 0)
logic.onSerialCommand(cmd);
}
}