consolidate sketches
This commit is contained in:
54
boards/esp32-32e/esp32-32e.ino
Normal file
54
boards/esp32-32e/esp32-32e.ino
Normal file
@@ -0,0 +1,54 @@
|
||||
//
|
||||
// Klubhaus Doorbell — ESP32-32E target
|
||||
//
|
||||
|
||||
#include <KlubhausCore.h>
|
||||
#include "board_config.h"
|
||||
#include "secrets.h"
|
||||
#include "DisplayDriverTFT.h"
|
||||
|
||||
DisplayDriverTFT tftDriver;
|
||||
DisplayManager display(&tftDriver);
|
||||
DoorbellLogic logic(&display);
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
delay(500);
|
||||
|
||||
logic.begin(FW_VERSION, BOARD_NAME, wifiNetworks, wifiNetworkCount);
|
||||
logic.finishBoot();
|
||||
}
|
||||
|
||||
void loop() {
|
||||
// ── State machine tick ──
|
||||
logic.update();
|
||||
|
||||
// ── Render current screen ──
|
||||
display.render(logic.getScreenState());
|
||||
|
||||
// ── Touch handling ──
|
||||
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 {
|
||||
TouchEvent evt = display.readTouch();
|
||||
if (evt.pressed && st.screen == ScreenID::DASHBOARD) {
|
||||
int tile = display.dashboardTouch(evt.x, evt.y);
|
||||
if (tile >= 0) Serial.printf("[DASH] Tile %d tapped\n", tile);
|
||||
}
|
||||
}
|
||||
|
||||
// ── Serial console ──
|
||||
if (Serial.available()) {
|
||||
String cmd = Serial.readStringUntil('\n');
|
||||
cmd.trim();
|
||||
if (cmd.length() > 0) logic.onSerialCommand(cmd);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user