consolidate sketches
This commit is contained in:
54
libraries/KlubhausCore/src/ScreenState.h
Normal file
54
libraries/KlubhausCore/src/ScreenState.h
Normal file
@@ -0,0 +1,54 @@
|
||||
#pragma once
|
||||
#include <Arduino.h>
|
||||
|
||||
enum class DeviceState {
|
||||
BOOTED,
|
||||
SILENT,
|
||||
ALERTING,
|
||||
SILENCED
|
||||
};
|
||||
|
||||
enum class ScreenID {
|
||||
BOOT,
|
||||
OFF,
|
||||
ALERT,
|
||||
DASHBOARD
|
||||
};
|
||||
|
||||
struct ScreenState {
|
||||
DeviceState deviceState = DeviceState::BOOTED;
|
||||
ScreenID screen = ScreenID::BOOT;
|
||||
|
||||
String alertTitle;
|
||||
String alertBody;
|
||||
uint32_t alertStartMs = 0;
|
||||
uint32_t silenceStartMs = 0;
|
||||
|
||||
bool backlightOn = false;
|
||||
int wifiRssi = 0;
|
||||
String wifiSsid;
|
||||
String ipAddr;
|
||||
uint32_t uptimeMs = 0;
|
||||
uint32_t lastPollMs = 0;
|
||||
uint32_t lastHeartbeatMs= 0;
|
||||
};
|
||||
|
||||
inline const char* deviceStateStr(DeviceState s) {
|
||||
switch (s) {
|
||||
case DeviceState::BOOTED: return "BOOTED";
|
||||
case DeviceState::SILENT: return "SILENT";
|
||||
case DeviceState::ALERTING: return "ALERTING";
|
||||
case DeviceState::SILENCED: return "SILENCED";
|
||||
}
|
||||
return "?";
|
||||
}
|
||||
|
||||
inline const char* screenIdStr(ScreenID s) {
|
||||
switch (s) {
|
||||
case ScreenID::BOOT: return "BOOT";
|
||||
case ScreenID::OFF: return "OFF";
|
||||
case ScreenID::ALERT: return "ALERT";
|
||||
case ScreenID::DASHBOARD: return "DASHBOARD";
|
||||
}
|
||||
return "?";
|
||||
}
|
||||
Reference in New Issue
Block a user