progmem chars

This commit is contained in:
Stephan Mühl
2023-03-29 15:13:21 +02:00
parent 2fb15efcb1
commit 9381b2a33b
8 changed files with 372 additions and 114 deletions

View File

@@ -260,6 +260,11 @@ void DisplayManager_::generateCustomPage(String name, String payload)
CustomApp customApp;
if (customApps.find(name) != customApps.end())
{
customApp = customApps[name];
}
if (doc.containsKey("sound"))
{
customApp.sound = ("/" + doc["sound"].as<String>() + ".txt");
@@ -308,21 +313,27 @@ void DisplayManager_::generateCustomPage(String name, String payload)
if (doc.containsKey("icon"))
{
String iconFileName = String(doc["icon"].as<String>());
if (LittleFS.exists("/ICONS/" + iconFileName + ".jpg"))
if (customApp.icon && String(customApp.icon.name()).startsWith(iconFileName))
{
customApp.isGif = false;
customApp.icon = LittleFS.open("/ICONS/" + iconFileName + ".jpg");
}
else if (LittleFS.exists("/ICONS/" + iconFileName + ".gif"))
{
customApp.isGif = true;
customApp.icon = LittleFS.open("/ICONS/" + iconFileName + ".gif");
}
else
{
fs::File nullPointer;
customApp.icon = nullPointer;
if (LittleFS.exists("/ICONS/" + iconFileName + ".jpg"))
{
customApp.isGif = false;
customApp.icon = LittleFS.open("/ICONS/" + iconFileName + ".jpg");
}
else if (LittleFS.exists("/ICONS/" + iconFileName + ".gif"))
{
customApp.isGif = true;
customApp.icon = LittleFS.open("/ICONS/" + iconFileName + ".gif");
}
else
{
fs::File nullPointer;
customApp.icon = nullPointer;
}
}
}
else