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

+13 -14
View File
@@ -11,7 +11,7 @@ void DisplayController::setSettings(const ScheduleSettings &schedule, const Cloc
{
_schedule = schedule;
_clock = clock;
_content_revision++; // e.g. evening time changed: redraw
_content_revision++; // e.g. the No WiFi setting changed: redraw
}
void DisplayController::setEffectTime(uint32_t ms)
@@ -58,7 +58,7 @@ bool DisplayController::powerEnabled() const
return _power_enabled;
}
void DisplayController::update(uint32_t now, bool time_valid, int hour, int minute, bool wifi_connected)
void DisplayController::update(uint32_t now, bool time_valid, const LocalTime &time, bool wifi_connected)
{
if (wifi_connected)
_wifi_lost = false;
@@ -106,7 +106,7 @@ void DisplayController::update(uint32_t now, bool time_valid, int hour, int minu
if (!time_valid)
return;
switch (scheduleFor(hour, minute, _schedule))
switch (scheduleFor(time.hour, time.minute, _schedule))
{
case ScheduleMode::Night:
if (_power.isOn())
@@ -118,8 +118,8 @@ void DisplayController::update(uint32_t now, bool time_valid, int hour, int minu
case ScheduleMode::Clock:
_off_timer.cancel();
_ensureOn();
if (_page == Page::Clock)
_showClock(hour, minute, show_no_wifi);
if (_page == Page::Dynamic)
_showDynamic(time, show_no_wifi);
else
_showOnce(Screen::Page);
break;
@@ -139,21 +139,20 @@ void DisplayController::_ensureOn()
_screen = Screen::Unknown;
}
void DisplayController::_showClock(int hour, int minute, bool no_wifi)
// Drawn again each minute (time, date and background can change) and when the content changed
void DisplayController::_showDynamic(const LocalTime &time, bool no_wifi)
{
Screen screen = no_wifi ? Screen::NoWifi : Screen::Clock;
bool evening = isEvening(hour, minute, _clock);
if (_screen == screen && _shown_hour == hour && _shown_minute == minute && _shown_evening == evening &&
Screen screen = no_wifi ? Screen::NoWifi : Screen::Dynamic;
if (_screen == screen && _shown_hour == time.hour && _shown_minute == time.minute &&
_shown_revision == _content_revision)
return;
if (no_wifi)
_frames.noWifi(hour, minute);
_frames.noWifi(time.hour, time.minute);
else
_frames.clock(hour, minute, evening);
_frames.dynamicPage(time);
_screen = screen;
_shown_hour = hour;
_shown_minute = minute;
_shown_evening = evening;
_shown_hour = time.hour;
_shown_minute = time.minute;
_shown_revision = _content_revision;
}