Files
Flipdot-display/src/esp32/logic/builtin_pages.cpp
T
mangavalkandClaude Opus 5.5 0411804a2f 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>
2026-10-15 19:43:59 +02:00

46 lines
965 B
C++

#include "logic/builtin_pages.h"
#include <string.h>
#include "logic/builtin_fonts.h"
static const char *const NAMES[] = {BUILTIN_PAGE_CLOCK};
int builtinPageCount()
{
return sizeof(NAMES) / sizeof(NAMES[0]);
}
const char *builtinPageName(int index)
{
return index >= 0 && index < builtinPageCount() ? NAMES[index] : nullptr;
}
static void clockPage(DynamicPage &page)
{
page = DynamicPage();
page.slot_count = 2;
page.slots[0].start = 0;
strcpy(page.slots[0].bitmap, "Pikachu");
page.slots[1].start = 17 * 60;
strcpy(page.slots[1].bitmap, "Pikachu yawning");
// The same spot as the old clock: in the thought bubble
page.element_count = 1;
PageElement &clock = page.elements[0];
clock.type = ElementType::Clock;
clock.x = 46;
clock.y = 4;
strcpy(clock.font, FONT_NORMAL_NAME);
}
bool builtinPage(const char *name, DynamicPage &page)
{
if (name && sameName(name, BUILTIN_PAGE_CLOCK))
{
clockPage(page);
return true;
}
return false;
}