Custom icon per tile: 150 MDI icons in firmware and editor

- screen_manager/app/tile_icons.py is the single icon list (12 groups, 20 media
  and music icons); tools/generate_icons.py writes it into the three icon fonts
  of both boards and builds the editor's subset font.
- Firmware 0.2.18 shows o.icon when its fonts carry the glyph, else the domain
  icon. The app sends the chosen icon, or Home Assistant's own mdi icon on auto.
- Tile sheet gets an icon picker with search; the mockup shows the icon the
  screen actually draws.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Max Gramser
2026-09-13 11:16:57 +02:00
parent efe82c9b09
commit ef0ca8b350
23 changed files with 1371 additions and 498 deletions
+12
View File
@@ -0,0 +1,12 @@
#include "components/smart_display/tile_icon.h"
#include <cassert>
int main() {
assert(tile_icon::codepoint("F06B5")==0xF06B5);
assert(tile_icon::codepoint("f1d17")==0xF1D17);
// Names, short or long hex, non-MDI ranges and junk keep the domain icon.
for (const char *bad : {"", "lamp", "auto", "F06B", "F06B50", "006B5", "F06G5", " F06B", "-F06B"})
assert(tile_icon::codepoint(bad)==0);
assert(tile_icon::utf8(0xF06B5)=="\U000F06B5");
assert(tile_icon::utf8(0xF0335)=="\U000F0335");
assert(tile_icon::utf8(0).empty() && tile_icon::utf8(0x41).empty());
}