diff --git a/ESP32_AP-Flasher/src/contentmanager.cpp b/ESP32_AP-Flasher/src/contentmanager.cpp index a4434648..e3ea135a 100644 --- a/ESP32_AP-Flasher/src/contentmanager.cpp +++ b/ESP32_AP-Flasher/src/contentmanager.cpp @@ -616,7 +616,7 @@ void drawString(TFT_eSprite &spr, String content, int16_t posx, int16_t posy, St if (font.startsWith("fonts/calibrib")) { String numericValueStr = font.substring(14); int calibriSize = numericValueStr.toInt(); - if (calibriSize > 30) { + if (calibriSize != 30 && calibriSize != 16) { font = "Signika-SB.ttf"; size = calibriSize; } @@ -1429,10 +1429,15 @@ bool getCalFeed(String &filename, JsonObject &cfgobj, tagRecord *&taginfo, imgPa #endif #ifdef CONTENT_DAYAHEAD -uint16_t getPercentileColor(const double *prices, int numPrices, double price) { +uint16_t getPercentileColor(const double *prices, int numPrices, double price, HwType hwdata) { double percentile = 100.0; int colorIndex = 3; const char *colors[] = {"black", "darkgray", "pink", "red"}; + if (hwdata.highlightColor == 3) { + // yellow + colors[2] = "brown"; + colors[3] = "yellow"; + } const int numColors = sizeof(colors) / sizeof(colors[0]); const double boundaries[] = {40.0, 80.0, 90.0}; @@ -1568,7 +1573,7 @@ bool getDayAheadFeed(String &filename, JsonObject &cfgobj, tagRecord *&taginfo, const double price = (obj["price"].as() / 10 + tarifkwh) * (1 + tariftax / 100) / units; - uint16_t barcolor = getPercentileColor(prices, n, price); + uint16_t barcolor = getPercentileColor(prices, n, price, imageParams.hwdata); uint16_t thisbarh = mapDouble(price, minPrice, maxPrice, 0, loc["bars"][2].as()); spr.fillRect(barX + i * barwidth, spr.height() - barBottom - thisbarh, barwidth - 1, thisbarh, barcolor); if (i % 2 == 0) { @@ -2167,6 +2172,7 @@ uint16_t getColor(const String &color) { if (color == "4" || color == "lightgray") return 0xBDF7; if (color == "5" || color == "darkgray") return TFT_DARKGREY; if (color == "6" || color == "pink") return 0xFBCF; + if (color == "7" || color == "brown") return 0x8400; uint16_t r, g, b; if (color.length() == 7 && color[0] == '#' && sscanf(color.c_str(), "#%2hx%2hx%2hx", &r, &g, &b) == 3) { diff --git a/ESP32_AP-Flasher/src/web.cpp b/ESP32_AP-Flasher/src/web.cpp index 9cd0a20e..66cc754b 100644 --- a/ESP32_AP-Flasher/src/web.cpp +++ b/ESP32_AP-Flasher/src/web.cpp @@ -250,7 +250,7 @@ void init_web() { }); server.serveStatic("/current", *contentFS, "/current/").setCacheControl("max-age=604800"); - server.serveStatic("/tagtypes", *contentFS, "/tagtypes/").setCacheControl("max-age=600"); + server.serveStatic("/tagtypes", *contentFS, "/tagtypes/").setCacheControl("max-age=300"); server.on( "/imgupload", HTTP_POST, [](AsyncWebServerRequest *request) { diff --git a/resources/tagtypes/26.json b/resources/tagtypes/26.json index ece9cbc6..99189b8f 100644 --- a/resources/tagtypes/26.json +++ b/resources/tagtypes/26.json @@ -14,44 +14,5 @@ "highlight_color": 5, "options": [ ], "contentids": [ 22, 23, 1, 4, 5, 7, 8, 9, 10, 11, 17, 18, 19, 20 ], - "template": { - "1": { - "weekday": [ 320, -5, "Signika-SB.ttf", 100 ], - "month": [ 320, 265, "Signika-SB.ttf", 100 ], - "day": [ 320, 60, "Signika-SB.ttf", 220 ] - }, - "4": { - "location": [ 20, 20, "fonts/calibrib30" ], - "wind": [ 90, 83, "fonts/calibrib30" ], - "temp": [ 20, 170, "fonts/calibrib30" ], - "icon": [ 385, 0, 100, 2 ], - "dir": [ 40, 50, 80 ], - "umbrella": [ 325, 155, 78 ] - }, - "8": { - "location": [ 10, 10, "fonts/calibrib30" ], - "column": [ 6, 66 ], - "day": [ 33, 60, "fonts/bahnschrift20", 104, 230 ], - "rain": [ 34, 260 ], - "icon": [ 32, 145, 30 ], - "wind": [ 17, 90 ], - "line": [ 50, 300 ] - }, - "9": { - "title": [ 6, 0, "Signika-SB.ttf", 32 ], - "items": 5, - "line": [ 9, 40, "calibrib16.vlw" ], - "desc": [ 2, 8, "REFSAN12.vlw", 1.2 ] - }, - "10": { - "title": [ 320, 10, "fonts/bahnschrift20" ], - "pos": [ 320, 40 ] - }, - "11": { - "rotate": 0, - "mode": 1, - "days": 7, - "gridparam": [ 3, 17, 30, "calibrib16.vlw", "BellCent10.vlw", 14 ] - } - } + "usetemplate" : 5 } diff --git a/resources/tagtypes/30.json b/resources/tagtypes/30.json index 993f0b5b..98b47d80 100644 --- a/resources/tagtypes/30.json +++ b/resources/tagtypes/30.json @@ -5,6 +5,7 @@ "height": 200, "rotatebuffer": 0, "bpp": 2, + "colors": 3, "colortable": { "white": [ 255, 255, 255 ], "black": [ 0, 0, 0 ], @@ -13,6 +14,38 @@ "shortlut": 0, "zlib_compression": "27", "options": [ "button" ], - "contentids": [ 22, 23, 1, 2, 3, 4, 8, 7, 19, 10, 21 ], - "usetemplate": 0 -} \ No newline at end of file + "contentids": [ 22, 23, 1, 2, 3, 4, 5, 7, 10, 14, 15, 17, 18, 19, 20, 21 ], + "template": { + "1": { + "weekday": [ 100, 5, "fonts/calibrib40" ], + "month": [ 100, 150, "fonts/calibrib40" ], + "day": [ 100, 28, "Signika-SB.ttf", 120 ] + }, + "2": { + "fonts": [ "Signika-SB.ttf", 180, 140, 110, 80, 60, 45 ], + "xy": [ 100, 85 ] + }, + "4": { + "location": [ 10, 180, "fonts/calibrib16" ], + "wind": [ 190, 5, "fonts/bahnschrift30" ], + "temp": [ 10, -8, "fonts/calibrib50" ], + "icon": [ 100, 30, 100, 1 ], + "dir": [ 160, -12, 40 ], + "umbrella": [ 155, 160, 30 ] + }, + "10": { + "title": [ 100, 15, "t0_14b_tf" ], + "pos": [ 100, 30 ] + }, + "21": [ + { "text": [ 12, 5, "OpenEpaperLink", "fonts/calibrib16", 1, 0, 0 ] }, + { "text": [ 12, 25, "Access Point", "fonts/calibrib16", 1, 0, 0 ] }, + { "text": [ 13, 65, "IP address:", "glasstown_nbp_tf", 1, 0, 0 ] }, + { "text": [ 20, 80, "{ap_ip}", "t0_14b_tf", 1, 0, 0 ] }, + { "text": [ 13, 105, "Channel:", "glasstown_nbp_tf", 1, 0, 0 ] }, + { "text": [ 20, 120, "{ap_ch}", "t0_14b_tf", 1, 0, 0 ] }, + { "text": [ 13, 145, "Tag count:", "glasstown_nbp_tf", 1, 0, 0 ] }, + { "text": [ 20, 160, "{ap_tagcount}", "t0_14b_tf", 1, 0, 0 ] } + ] + } +} diff --git a/resources/tagtypes/36.json b/resources/tagtypes/36.json index 376eff7d..7b68b36e 100644 --- a/resources/tagtypes/36.json +++ b/resources/tagtypes/36.json @@ -14,5 +14,44 @@ "zlib_compression": "27", "options": [ "button", "led" ], "contentids": [ 22, 23, 1, 4, 5, 7, 8, 9, 10, 11, 17, 18, 19, 20 ], - "usetemplate": 46 + "template": { + "1": { + "weekday": [ 400, -5, "Signika-SB.ttf", 130 ], + "month": [ 400, 330, "Signika-SB.ttf", 130 ], + "day": [ 400, 70, "Signika-SB.ttf", 280 ] + }, + "4": { + "location": [ 20, 20, "fonts/calibrib30" ], + "wind": [ 90, 83, "fonts/calibrib30" ], + "temp": [ 20, 170, "fonts/calibrib30" ], + "icon": [ 385, 0, 100, 2 ], + "dir": [ 40, 50, 80 ], + "umbrella": [ 325, 155, 78 ] + }, + "8": { + "location": [ 10, 10, "fonts/calibrib30" ], + "column": [ 6, 66 ], + "day": [ 33, 60, "fonts/bahnschrift20", 104, 230 ], + "rain": [ 34, 260 ], + "icon": [ 32, 145, 30 ], + "wind": [ 17, 90 ], + "line": [ 50, 300 ] + }, + "9": { + "title": [ 6, 0, "Signika-SB.ttf", 32 ], + "items": 10, + "line": [ 9, 40, "calibrib16.vlw" ], + "desc": [ 2, 8, "REFSAN12.vlw", 1.2 ] + }, + "10": { + "title": [ 400, 10, "fonts/bahnschrift20" ], + "pos": [ 400, 40 ] + }, + "11": { + "rotate": 0, + "mode": 1, + "days": 7, + "gridparam": [ 3, 17, 30, "calibrib16.vlw", "BellCent10.vlw", 14 ] + } + } } diff --git a/resources/tagtypes/43.json b/resources/tagtypes/43.json index 9068c611..05f67080 100644 --- a/resources/tagtypes/43.json +++ b/resources/tagtypes/43.json @@ -1,9 +1,9 @@ { "version": 1, "name": "M3 1.3\" Peghook", - "width": 200, - "height": 144, - "rotatebuffer": 3, + "width": 144, + "height": 200, + "rotatebuffer": 0, "bpp": 2, "colors": 3, "colortable": { @@ -14,6 +14,38 @@ "shortlut": 0, "zlib_compression": "27", "options": [ "button" ], - "contentids": [ 22, 23, 1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 14, 15, 16, 17, 18, 19, 20, 21, 27 ], - "usetemplate": 0 -} \ No newline at end of file + "contentids": [ 22, 23, 1, 2, 3, 4, 5, 7, 10, 14, 15, 17, 18, 19, 20, 21 ], + "template": { + "1": { + "weekday": [ 72, 12, "fonts/calibrib28" ], + "month": [ 72, 145, "fonts/calibrib28" ], + "day": [ 72, 29, "Signika-SB.ttf", 110 ] + }, + "2": { + "fonts": [ "Signika-SB.ttf", 150, 110, 80, 60, 50, 40 ], + "xy": [ 72, 83 ] + }, + "4": { + "location": [ 10, 180, "fonts/calibrib16" ], + "wind": [ 140, 5, "fonts/bahnschrift30" ], + "temp": [ 15, 15, "fonts/calibrib60" ], + "icon": [ 72, 60, 90, 1 ], + "dir": [ 115, -12, 40 ], + "umbrella": [ 115, 160, 30 ] + }, + "10": { + "title": [ 72, 15, "t0_14b_tf" ], + "pos": [ 72, 60 ] + }, + "21": [ + { "text": [ 2, 5, "OpenEpaperLink", "fonts/calibrib16", 1, 0, 0 ] }, + { "text": [ 2, 25, "Access Point", "fonts/calibrib16", 1, 0, 0 ] }, + { "text": [ 3, 65, "IP address:", "glasstown_nbp_tf", 1, 0, 0 ] }, + { "text": [ 10, 80, "{ap_ip}", "t0_14b_tf", 1, 0, 0 ] }, + { "text": [ 3, 105, "Channel:", "glasstown_nbp_tf", 1, 0, 0 ] }, + { "text": [ 10, 120, "{ap_ch}", "t0_14b_tf", 1, 0, 0 ] }, + { "text": [ 3, 145, "Tag count:", "glasstown_nbp_tf", 1, 0, 0 ] }, + { "text": [ 10, 160, "{ap_tagcount}", "t0_14b_tf", 1, 0, 0 ] } + ] + } +} diff --git a/resources/tagtypes/60.json b/resources/tagtypes/60.json index 46f5bdab..7a451085 100644 --- a/resources/tagtypes/60.json +++ b/resources/tagtypes/60.json @@ -10,7 +10,7 @@ "black": [ 0, 0, 0 ], "yellow": [ 255, 255, 0 ] }, - "highlight_color": 2, + "highlight_color": 3, "shortlut": 0, "options": [ "led" ], "contentids": [ 22, 23, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 17, 18, 19, 20, 27 ],