Public Access
Add a web UI to the clock firmware
- Web UI on port 80: live view of the display, choose the page (clock or a bitmap), bitmaps (list, show, live, edit, delete), draw / image upload with conversion in the browser, live mode, settings, Home Assistant - Live view from a shadow buffer in the BROSE9323 driver (shownPixel) - Settings in NVS with the original behaviour as defaults: schedule times, quarter hours, yawning Pikachu, No WiFi screen, flip time, status LED, Home Assistant broker (restart on change) - Bitmaps on LittleFS; new 320 KB partition, ota slots now 1.31 MB - DisplayController: pages, live mode, settings; app.cpp holds the objects - README for the recovery app; docs for the web UI - Tests: settings, time parsing, bitmap format and names, schedule with settings, pages and live mode (95 total) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c9e0800e36
commit
2b1ac12ed7
34 files changed
+1989
-117
No files matched your search
@@ -0,0 +1,40 @@
|
||||
#include "system/settings_store.h"
|
||||
|
||||
#include <Preferences.h>
|
||||
|
||||
static const char *NAMESPACE = "flipdot";
|
||||
static const char *KEY = "settings";
|
||||
// Increase when the Settings struct changes; old records are then ignored (defaults)
|
||||
static const uint16_t VERSION = 1;
|
||||
|
||||
struct StoredSettings
|
||||
{
|
||||
uint16_t version;
|
||||
uint16_t size;
|
||||
Settings settings;
|
||||
};
|
||||
|
||||
void loadSettings(Settings &settings)
|
||||
{
|
||||
settings = Settings();
|
||||
StoredSettings stored;
|
||||
Preferences prefs;
|
||||
prefs.begin(NAMESPACE, true);
|
||||
size_t read = prefs.getBytes(KEY, &stored, sizeof(stored));
|
||||
prefs.end();
|
||||
if (read == sizeof(stored) && stored.version == VERSION && stored.size == sizeof(Settings) &&
|
||||
validateSettings(stored.settings) == nullptr)
|
||||
settings = stored.settings;
|
||||
}
|
||||
|
||||
void saveSettings(const Settings &settings)
|
||||
{
|
||||
StoredSettings stored;
|
||||
stored.version = VERSION;
|
||||
stored.size = sizeof(Settings);
|
||||
stored.settings = settings;
|
||||
Preferences prefs;
|
||||
prefs.begin(NAMESPACE, false);
|
||||
prefs.putBytes(KEY, &stored, sizeof(stored));
|
||||
prefs.end();
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "logic/settings.h"
|
||||
|
||||
// The web UI settings in NVS. A missing or outdated record gives the defaults.
|
||||
void loadSettings(Settings &settings);
|
||||
void saveSettings(const Settings &settings);
|
||||
Reference in new issue
Block a user