Add scrolling, countdown, stopwatch, images, seconds, multiplier and degree sign

- Text elements can scroll in a window at a set speed; clock, countdown and
  stopwatch can show seconds. Moving pages are sent as instant frames (new
  Nano command D1) and paced by the estimated flip time.
- Countdown to a date and time (smart, days, days + time, with seconds),
  stopwatch (web UI, HA switch and reset button), image element (fixed or
  by Home Assistant state), multiplier for HA values, degree sign (char 127)
  in all fonts and the font converter.
- Page format version 2; version 1 pages are converted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mangavalkandClaude Opus 5.5 committed 2026-10-15 21:01:14 +02:00
1 parent ca8d78ea8a
commit fc6fa1a180
38 files changed
+1370 -277

No files matched your search

+13 -6
View File
@@ -9,19 +9,22 @@
// Draws a dynamic page into a full screen bitmap (logic/bitmap_format.h). Used for the
// display and for the previews in the web UI. Pure logic, tested in test/test_esp32.
// Where the page gets its bitmaps, fonts and Home Assistant values
// Where the page gets its bitmaps, fonts, Home Assistant values and the stopwatch
class PageResources
{
public:
// Loads a background bitmap; false when it is gone (the background is blank then)
// Loads a bitmap (background or image); false when it is gone
virtual bool background(const char *name, uint8_t *bitmap) = 0;
// A font by name; a font without data when it is gone ("Normal" is used then)
virtual Font font(const char *name) = 0;
// The current value of a Home Assistant element; nullptr when not known
virtual const char *haValue(const PageElement &element) = 0;
virtual uint32_t stopwatchMs() { return 0; }
virtual bool stopwatchRunning() { return false; }
};
// The area an element covers on the screen (for the editor), may be partly off screen
// The area an element covers on the screen (for the editor), may be partly off screen.
// For scrolling texts, the window.
struct ElementBox
{
int16_t x = 0;
@@ -30,6 +33,10 @@ struct ElementBox
int16_t height = 0;
};
// boxes: nullptr, or room for page.element_count boxes
void renderPage(const DynamicPage &page, const LocalTime &time, PageResources &resources, uint8_t *bitmap,
ElementBox *boxes = nullptr);
// now_ms: a running millisecond counter (millis()), for scrolling. boxes: nullptr, or room
// for page.element_count boxes.
// Returns the ms until the page looks different again (scrolling, seconds, a running
// stopwatch), or 0 when it only changes with the minute or its content (Home Assistant
// values, the stopwatch being started or stopped).
uint32_t renderPage(const DynamicPage &page, const LocalTime &time, uint32_t now_ms, PageResources &resources,
uint8_t *bitmap, ElementBox *boxes = nullptr);