Files
Flipdot-display/src/esp32/app.h
T

52 lines
2.0 KiB
C
Raw Normal View History

2026-10-13 01:52:34 +02:00
#pragma once
// The objects of the clock firmware and the actions the web UI and Home Assistant use.
// main.cpp only decides the order of things at boot and in loop().
#include "BROSE9323.h"
#include "display/frames.h"
#include "display/status_screen.h"
#include "logic/display_controller.h"
#include "logic/local_time.h"
#include "logic/page.h"
2026-10-13 01:52:34 +02:00
#include "logic/settings.h"
#include "nano_link/nano_link.h"
extern NanoLink nano;
extern BROSE9323 display;
extern FlipdotFrames frames;
extern StatusScreen status;
extern DisplayController controller;
// Settings: loaded at boot, changed in the web UI
const Settings &appSettings();
void appLoadSettings();
// Validates, stores and applies. Returns nullptr or an error message. Sets
// restart_needed when the change only works after a restart (Home Assistant MQTT).
2026-10-13 01:52:34 +02:00
const char *appSaveSettings(const Settings &settings, bool &restart_needed);
// The page shown during the day: a dynamic page or a bitmap (stored in the settings)
2026-10-13 01:52:34 +02:00
const char *appSelectPage(const char *name);
// Left on the dots when the display switches off: OFF_PAGE_BLANK or a bitmap name
const char *appSelectOffPage(const char *name);
// Bitmaps, dynamic pages and fonts: stored, and the display redrawn when it shows them.
// Bitmaps and pages share one namespace; what a page uses can't be deleted. All return
// nullptr or an error message.
const char *appSaveBitmap(const char *name, const uint8_t *bitmap);
const char *appDeleteBitmap(const char *name);
const char *appSavePage(const char *name, const DynamicPage &page);
const char *appDeletePage(const char *name);
const char *appSaveFont(const char *name, const uint8_t *data, size_t size);
const char *appDeleteFont(const char *name);
2026-10-13 01:52:34 +02:00
// Live mode of the web UI
void appShowLive(const uint8_t *bitmap);
void appStopLive();
// The local time; false until it is synced over NTP
bool appLocalTime(LocalTime &time);
2026-10-13 01:52:34 +02:00
// Restart the ESP32 after `delay_ms` (so a web response can still be sent)
void appRestartLater(uint32_t delay_ms);
void appLoop();