Public Access
Icons: small images of their own size for pages
Bitmaps that only pages use (backgrounds, images by state) are now icons: own width and height, stored in /icons, not in the page lists or the Home Assistant dropdowns. Page backgrounds and image elements use icons or bitmaps; the renderer gets icons expanded at the top left, so pages look the same. Web UI: Icons tab with an editor, Make icon / Make bitmap, Save as icon on the Draw tab, icons in the backup. A one-time migration in time-boxed steps moves the uploaded bitmaps that only pages use, after the new firmware is marked good. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1704cbf17b
commit
ab001e5d18
37 files changed
+955
-78
No files matched your search
@@ -5,6 +5,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
|
||||
static const uint16_t MINUTES_PER_DAY = 24 * 60;
|
||||
static const uint32_t MAX_TARGET = 36525UL * MINUTES_PER_DAY; // 2100-01-01
|
||||
@@ -70,6 +71,31 @@ bool elementUsesHa(const PageElement &element)
|
||||
}
|
||||
}
|
||||
|
||||
bool pageUsesImage(const DynamicPage &page, const char *name, bool by_state)
|
||||
{
|
||||
for (int i = 0; i < page.slot_count; i++)
|
||||
if (sameName(page.slots[i].bitmap, name))
|
||||
return true;
|
||||
for (int i = 0; i < page.element_count; i++)
|
||||
{
|
||||
const PageElement &e = page.elements[i];
|
||||
if (e.type != ElementType::Image)
|
||||
continue;
|
||||
if (!e.entity[0])
|
||||
{
|
||||
if (sameName(e.text, name))
|
||||
return true;
|
||||
continue;
|
||||
}
|
||||
size_t start = strlen(e.text);
|
||||
if (strncasecmp(name, e.text, start) != 0)
|
||||
continue;
|
||||
if (by_state ? name[start] != '\0' : strcasecmp(name + start, "default") == 0)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool validEntityId(const char *entity)
|
||||
{
|
||||
if (entity == nullptr)
|
||||
|
||||
Reference in new issue
Block a user