style: apply consistent code formatting and spacing
This commit is contained in:
@@ -2,14 +2,15 @@
|
||||
// Klubhaus Doorbell — ESP32-32E target
|
||||
//
|
||||
|
||||
#include <KlubhausCore.h>
|
||||
#include "DisplayDriverTFT.h"
|
||||
#include "board_config.h"
|
||||
#include "secrets.h"
|
||||
#include "DisplayDriverTFT.h"
|
||||
|
||||
#include <KlubhausCore.h>
|
||||
|
||||
DisplayDriverTFT tftDriver;
|
||||
DisplayManager display(&tftDriver);
|
||||
DoorbellLogic logic(&display);
|
||||
DisplayManager display(&tftDriver);
|
||||
DoorbellLogic logic(&display);
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
@@ -31,19 +32,19 @@ void loop() {
|
||||
static int holdStartX = -1;
|
||||
static int holdStartY = -1;
|
||||
|
||||
if (st.deviceState == DeviceState::ALERTING) {
|
||||
if(st.deviceState == DeviceState::ALERTING) {
|
||||
HoldState h = display.updateHold(HOLD_TO_SILENCE_MS);
|
||||
if (h.completed) {
|
||||
if(h.completed) {
|
||||
logic.silenceAlert();
|
||||
holdStartX = -1;
|
||||
holdStartY = -1;
|
||||
}
|
||||
if (h.started) {
|
||||
if(h.started) {
|
||||
TouchEvent t = display.readTouch();
|
||||
holdStartX = t.x;
|
||||
holdStartY = t.y;
|
||||
}
|
||||
if (!h.active && holdStartX >= 0) {
|
||||
if(!h.active && holdStartX >= 0) {
|
||||
display.updateHint(holdStartX, holdStartY);
|
||||
}
|
||||
} else {
|
||||
@@ -51,18 +52,20 @@ void loop() {
|
||||
holdStartY = -1;
|
||||
}
|
||||
|
||||
if (st.screen == ScreenID::DASHBOARD) {
|
||||
if(st.screen == ScreenID::DASHBOARD) {
|
||||
TouchEvent evt = display.readTouch();
|
||||
if (evt.pressed) {
|
||||
if(evt.pressed) {
|
||||
int tile = display.dashboardTouch(evt.x, evt.y);
|
||||
if (tile >= 0) Serial.printf("[DASH] Tile %d tapped\n", tile);
|
||||
if(tile >= 0)
|
||||
Serial.printf("[DASH] Tile %d tapped\n", tile);
|
||||
}
|
||||
}
|
||||
|
||||
// ── Serial console ──
|
||||
if (Serial.available()) {
|
||||
if(Serial.available()) {
|
||||
String cmd = Serial.readStringUntil('\n');
|
||||
cmd.trim();
|
||||
if (cmd.length() > 0) logic.onSerialCommand(cmd);
|
||||
if(cmd.length() > 0)
|
||||
logic.onSerialCommand(cmd);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user