Add dynamic pages with clock, date, Home Assistant values and fonts

The hardcoded clock is now the built-in dynamic page "Clock". A dynamic page
has a background bitmap per time of day and up to 8 elements (clock, date,
Home Assistant value, text), each with position, alignment, font and overlay.
Pages are drawn on the ESP32, also for the web previews.

- Pages tab in the web UI: page editor with drag and drop, font upload
  (TTF/OTF converted in the browser to the FDF1 dot font format)
- Built-in fonts Small, Normal, Large and Full height (generated by
  tools/make_builtin_fonts.py), built-in bitmaps Pikachu and Pikachu yawning
- Home Assistant values over the REST API (URL and token in the HA tab)
- Settings version 4: evening settings removed (now time slots of the Clock
  page), old records are converted
- HA Mode dropdown lists the dynamic pages and bitmaps

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mangavalkandClaude Opus 5.5 committed 2026-10-15 19:43:59 +02:00
1 parent 1d3b084de1
commit 0411804a2f
49 files changed
+3058 -331

No files matched your search

+14 -13
View File
@@ -2,6 +2,7 @@
#include <stdint.h>
#include "logic/local_time.h"
#include "logic/power_timer.h"
#include "logic/settings.h"
@@ -19,8 +20,9 @@ public:
class Frames
{
public:
virtual void clock(int hour, int minute, bool evening) = 0;
// Shown instead of the clock while WiFi is down (the time keeps running without it)
// The dynamic page selected as page, drawn for this time
virtual void dynamicPage(const LocalTime &time) = 0;
// Shown instead of a dynamic page while WiFi is down (the time keeps running without it)
virtual void noWifi(int hour, int minute) = 0;
// The bitmap selected as page
virtual void page() = 0;
@@ -32,8 +34,8 @@ public:
enum class Page : uint8_t
{
Clock, // Pikachu with the time
Bitmap, // a bitmap (FlipdotFrames holds which one)
Dynamic, // a dynamic page, redrawn every minute (FlipdotFrames holds which one)
Bitmap, // a bitmap (FlipdotFrames holds which one)
};
// Decides what the display shows and when it is powered, based on the time, the settings,
@@ -49,8 +51,8 @@ public:
// The power stays on that much longer after the last frame.
void setEffectTime(uint32_t ms);
// What is shown during the day. Call pageChanged() when the page or off bitmap
// itself changed.
// What is shown during the day. Call pageChanged() when the page, its content (e.g. a
// Home Assistant value) or the off bitmap changed.
void setPage(Page page);
void pageChanged();
@@ -66,14 +68,14 @@ public:
bool powerEnabled() const;
// Call often (every loop). time_valid is false until the time is synced over NTP.
// While WiFi is down for NO_WIFI_SHOW_TIME, "No WiFi" is shown instead of the clock.
void update(uint32_t now, bool time_valid, int hour, int minute, bool wifi_connected);
// While WiFi is down for NO_WIFI_SHOW_TIME, "No WiFi" is shown instead of a dynamic page.
void update(uint32_t now, bool time_valid, const LocalTime &time, bool wifi_connected);
private:
enum class Screen
{
Unknown, // nothing sent since the last power on
Clock,
Dynamic,
NoWifi,
Page,
Live,
@@ -86,7 +88,7 @@ private:
ScheduleSettings _schedule;
ClockSettings _clock;
Page _page = Page::Clock;
Page _page = Page::Dynamic;
uint32_t _effect_time = 0;
bool _power_enabled = true;
@@ -94,8 +96,7 @@ private:
Screen _screen = Screen::Unknown;
int _shown_hour = -1;
int _shown_minute = -1;
bool _shown_evening = false;
uint32_t _content_revision = 0; // changed page, bitmap or live image
uint32_t _content_revision = 0; // changed page, its content, bitmap or live image
uint32_t _shown_revision = 0;
bool _live = false;
@@ -105,6 +106,6 @@ private:
uint32_t _wifi_lost_since = 0;
void _ensureOn();
void _showClock(int hour, int minute, bool no_wifi);
void _showDynamic(const LocalTime &time, bool no_wifi);
void _showOnce(Screen screen);
};