Files
klubhaus-doorbell/sketches/doorbell-touch-esp32-32e/ScreenData.h

71 lines
1.5 KiB
C

#pragma once
#include <Arduino.h>
// =====================================================================
// Shared enums and structs — NO library dependencies
// =====================================================================
enum class DeviceState : uint8_t {
SILENT,
ALERTING,
WAKE
};
enum class ScreenID : uint8_t {
BOOT_SPLASH,
WIFI_CONNECTING,
WIFI_CONNECTED,
WIFI_FAILED,
ALERT,
STATUS,
DASHBOARD, // <-- NEW
OFF // backlight off, nothing to draw
};
#define ALERT_HISTORY_SIZE 3
struct AlertRecord {
char message[64] = "";
char timestamp[12] = ""; // "HH:MM:SS"
};
// Everything the display needs to render any screen
struct ScreenState {
ScreenID screen = ScreenID::BOOT_SPLASH;
DeviceState deviceState = DeviceState::SILENT;
bool blinkPhase = false;
// Alert
char alertMessage[64] = "";
// WiFi
bool wifiConnected = false;
char wifiSSID[33] = "";
int wifiRSSI = 0;
char wifiIP[16] = "";
// NTP
bool ntpSynced = false;
char timeString[12] = "";
// System
uint32_t uptimeMinutes = 0;
uint32_t freeHeapKB = 0;
bool networkOK = false;
// Debug
bool debugMode = false;
// Alert history (newest first)
AlertRecord alertHistory[ALERT_HISTORY_SIZE] = {};
int alertHistoryCount = 0;
};
// Touch event passed from display to logic
struct TouchEvent {
bool pressed = false;
uint16_t x = 0;
uint16_t y = 0;
};