Xteink-X4-crosspoint-reader/src/CrossPointState.h
Chris Korhonen 50b2a37fb7 feat: Add Calendar Mode for automated e-ink calendar display
- Add CALENDAR sleep mode that bypasses /sleep/ directory to ensure calendar image displays
- Implement CalendarActivity state machine: WiFi→NTP→HTTP fetch→save to /sleep.bmp→deep sleep
- Add NTP time sync and fetch timestamp persistence in CrossPointState
- Show visual status feedback during calendar fetch ("Connecting...", "Fetching...")
- Add calendar settings UI: toggle, refresh hours (1-24h), "Test Calendar Now" action
- Fix hardware button sleep to display calendar when calendar mode enabled
- Graceful fallback: if fetch fails but cached image exists, use cached; otherwise use default screen

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-01-17 19:14:58 -05:00

25 lines
539 B
C++

#pragma once
#include <iosfwd>
#include <string>
class CrossPointState {
// Static instance
static CrossPointState instance;
public:
std::string openEpubPath;
uint8_t lastSleepImage;
uint32_t lastCalendarFetch = 0; // Unix epoch of last successful calendar fetch
~CrossPointState() = default;
// Get singleton instance
static CrossPointState& getInstance() { return instance; }
bool saveToFile() const;
bool loadFromFile();
};
// Helper macro to access settings
#define APP_STATE CrossPointState::getInstance()