This commit breaks the doorbell functionality completely
1. **Removed entire `loop()` implementation** - The main program loop is now completely empty
2. **Deleted duplicate `silenceAlerts()` functions** - Three identical copies were consolidated into one
3. **Stripped all functionality**:
- Touch handling for different screens (ALERT, DASHBOARD, OFF)
- Hold-to-silence gesture detection
- Display rendering and backlight control
- Serial command processing
⚠️ **This commit breaks the doorbell functionality completely**:
- The device will boot but do nothing (empty loop)
- Touch input won't be processed
- Screen won't update or display anything
- Serial commands won't work
- Alert silencing is defined but never called
This appears to be an incomplete snapshot/refactoring in progress, leaving the application non-functional.
1. **Gutted the main loop** - Reduced from ~80 lines to completely empty
2. **Removed duplicate code** - Eliminated 2 of 3 identical `silenceAlerts()` function definitions that were accidentally created
**Device is now completely non-functional:**
- No display updates or rendering
- Touch input completely ignored
- Alert silencing impossible (function defined but never called)
- Serial commands won't be processed
- Screen stays on/off in whatever state it was in
This is clearly an accidental commit or work-in-progress snapshot. The doorbell will compile and run but do absolutely nothing except the initial setup.
This commit is contained in:
@@ -61,85 +61,14 @@ void setup() {
|
||||
Serial.println("[BOOT] Ready — monitoring ntfy.sh\n");
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ── Silence handler (delegates to DoorbellLogic) ────────────────
|
||||
void silenceAlerts() {
|
||||
Serial.println("[SILENCE] User completed hold-to-silence gesture");
|
||||
logic.onTouch(TouchEvent{true, 0, 0});
|
||||
}
|
||||
|
||||
// ── Silence handler (delegates to DoorbellLogic) ────────────────
|
||||
void silenceAlerts() {
|
||||
Serial.println("[SILENCE] User completed hold-to-silence gesture");
|
||||
logic.onTouch(TouchEvent{true, 0, 0});
|
||||
}
|
||||
|
||||
void loop() {
|
||||
// ── Silence handler (delegates to DoorbellLogic) ────────────────
|
||||
void silenceAlerts() {
|
||||
Serial.println("[SILENCE] User completed hold-to-silence gesture");
|
||||
logic.onTouch(TouchEvent{true, 0, 0});
|
||||
} logic.update();
|
||||
|
||||
const ScreenState& state = logic.getScreenState();
|
||||
|
||||
// ---- Touch handling varies by screen ----
|
||||
|
||||
if (state.screen == ScreenID::ALERT) {
|
||||
// Hold-and-release to silence
|
||||
HoldState hold = display.updateHold(HOLD_TO_SILENCE_MS);
|
||||
|
||||
if (hold.completed) {
|
||||
// Finger lifted after full charge → silence now
|
||||
display.stopHint();
|
||||
delay(80);
|
||||
silenceAlerts();
|
||||
} else if (hold.active || hold.charged) {
|
||||
// Real interaction in progress — suppress hint
|
||||
display.stopHint();
|
||||
} else {
|
||||
// No touch — run coaching hint
|
||||
display.updateHint();
|
||||
}
|
||||
} else if (state.screen == ScreenID::DASHBOARD) {
|
||||
TouchEvent evt = display.readTouch();
|
||||
if (evt.pressed) {
|
||||
int tile = display.dashboardTouch(evt.x, evt.y);
|
||||
if (tile >= 0) {
|
||||
Serial.printf("[DASH] Tile %d tapped\n", tile);
|
||||
// Tile-specific actions go here
|
||||
} else {
|
||||
logic.onTouch(evt);
|
||||
}
|
||||
delay(300); // debounce
|
||||
}
|
||||
|
||||
} else if (state.screen == ScreenID::OFF) {
|
||||
// Any touch wakes
|
||||
TouchEvent evt = display.readTouch();
|
||||
if (evt.pressed) {
|
||||
logic.onTouch(evt);
|
||||
delay(300);
|
||||
}
|
||||
|
||||
} else {
|
||||
// Boot/WiFi screens: simple touch passthrough
|
||||
TouchEvent evt = display.readTouch();
|
||||
if (evt.pressed) {
|
||||
logic.onTouch(evt);
|
||||
delay(300);
|
||||
}
|
||||
}
|
||||
|
||||
// ---- Render ----
|
||||
display.setBacklight(state.screen != ScreenID::OFF);
|
||||
display.render(logic.getScreenState());
|
||||
|
||||
// ---- Serial commands ----
|
||||
if (Serial.available()) {
|
||||
String cmd = Serial.readStringUntil('\n');
|
||||
cmd.trim();
|
||||
if (cmd.length() > 0) logic.onSerialCommand(cmd);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user