C
Release 1.6.0 with Mono dashboard theme
YU CHIH CHANG0591e61c86ac
diff --git a/README.md b/README.mdindex 9a83923..9b55639 100644--- a/README.md+++ b/README.md@@ -73,12 +73,13 @@ Currently supported:## Dashboard Themes-One firmware includes four dashboard themes with the same live GT7 telemetry features:+One firmware includes five dashboard themes with the same live GT7 telemetry features:- **GT3** (default) — centered gear, curved shift-light bar and a dark motorsport layout.- **Classic** — the original engineering-style five-column dashboard.- **Retro** — a warm paper-colored instrument panel with dark text and restrained accents.- **Radar** — a circular tachometer-focused dark layout with side telemetry panels.+- **Mono** — a minimal black-and-white digital dashboard with a segmented shift-light bar.<p align="center"><img src="photos/theme_all.jpg" width="900" alt="Classic, GT3, Radar and Retro dashboard theme previews">@@ -155,13 +156,13 @@ No IP address configuration is required.- Open Settings while the display is active.- Wake the display when it is asleep; the first tap does not also open Settings.-- Select and save the Classic, GT3, Retro, or Radar dashboard theme.+- Select and save the Classic, GT3, Retro, Radar, or Mono dashboard theme.- Open **DEVICE SETTINGS** to adjust brightness from 20% to 100% in 10% steps.- Reset saved Wi-Fi from Device Settings through a separate confirmation screen.Brightness defaults to 80%, is saved after adjustment, and is restored after reboot or wake. Automatic sleep still turns the backlight fully off.-GT3 is used when no theme has been saved. Classic, GT3, Retro and Radar expose the same supported telemetry; only their presentation differs.+GT3 is used when no theme has been saved. Classic, GT3, Retro, Radar and Mono expose the same supported telemetry; only their presentation differs.<p align="center"><img src="photos/003.jpg" width="900" alt="ESP32 GT7 Dashboard">diff --git a/README.zh-TW.md b/README.zh-TW.mdindex 5e9c94c..6e36738 100644--- a/README.zh-TW.md+++ b/README.zh-TW.md@@ -74,12 +74,13 @@## 儀表主題-同一份韌體內建四種儀表主題,並提供相同的即時 GT7 遙測功能:+同一份韌體內建五種儀表主題,並提供相同的即時 GT7 遙測功能:- **GT3**(預設)— 置中檔位、弧形換檔燈與深色賽車風格版面。- **Classic** — 原本偏工程風格的五欄儀表板。- **Retro** — 暖色紙張底、深色文字與低調提示色的復古儀表板。- **Radar** — 以圓形轉速環為核心、兩側配置遙測資訊的深色儀表板。+- **Mono** — 黑底白字的簡約數位儀表,搭配分段式換檔燈。<p align="center"><img src="photos/theme_all.jpg" width="900" alt="Classic、GT3、Radar 與 Retro 四種儀表主題預覽">@@ -151,13 +152,13 @@ http://192.168.4.1- 螢幕亮起時開啟設定選單。- 螢幕休眠時只喚醒顯示,第一次點擊不會同時進入設定。-- 選擇並儲存 Classic、GT3、Retro 或 Radar 儀表主題。+- 選擇並儲存 Classic、GT3、Retro、Radar 或 Mono 儀表主題。- 進入 **DEVICE SETTINGS**,以 10% 級距調整 20%~100% 的亮度。- 從 Device Settings 透過獨立確認畫面重設已儲存的 Wi-Fi。亮度預設為 80%,調整後會儲存,重新開機或喚醒時會恢復;自動休眠仍會完全關閉背光。-沒有儲存過主題時會使用 GT3。Classic、GT3、Retro 與 Radar 顯示相同的支援遙測資料,只有呈現方式不同。+沒有儲存過主題時會使用 GT3。Classic、GT3、Retro、Radar 與 Mono 顯示相同的支援遙測資料,只有呈現方式不同。<p align="center"><img src="photos/003.jpg" width="900" alt="ESP32 GT7 Dashboard">diff --git a/VERSION b/VERSIONindex bc80560..dc1e644 100644--- a/VERSION+++ b/VERSION@@ -1 +1 @@-1.5.0+1.6.0diff --git a/docs/THEME_DEVELOPMENT.md b/docs/THEME_DEVELOPMENT.mdindex ea47d76..37e3424 100644--- a/docs/THEME_DEVELOPMENT.md+++ b/docs/THEME_DEVELOPMENT.md@@ -20,6 +20,7 @@ The included themes are:| `GT3` | 1 | `drawPage1()` | Default dark motorsport UI || `Retro` | 2 | `drawRetroDashboard()` | Warm paper-and-ink instrument UI || `Radar` | 3 | `drawRadarDashboard()` | Circular tachometer-focused dark UI |+| `Mono` | 4 | `drawMonoDashboard()` | Monochrome retro-digital instrument UI |Persisted values are part of the device settings format. Never reorder or reuse an existing enum value.diff --git a/include/version.h b/include/version.hindex ed91463..94dc51f 100644--- a/include/version.h+++ b/include/version.h@@ -1,3 +1,3 @@#pragma once-inline constexpr char GT7_DASH_VERSION[] = "1.5.0";+inline constexpr char GT7_DASH_VERSION[] = "1.6.0";diff --git a/installer/firmware/firmware-ili9341.bin b/installer/firmware/firmware-ili9341.binindex 0d56546..0518917 100644Binary files a/installer/firmware/firmware-ili9341.bin and b/installer/firmware/firmware-ili9341.bin differdiff --git a/installer/firmware/firmware-st7789.bin b/installer/firmware/firmware-st7789.binindex 801937c..6e0ac59 100644Binary files a/installer/firmware/firmware-st7789.bin and b/installer/firmware/firmware-st7789.bin differdiff --git a/installer/manifest-st7789.json b/installer/manifest-st7789.jsonindex ae89d9b..5312acb 100644--- a/installer/manifest-st7789.json+++ b/installer/manifest-st7789.json@@ -1,6 +1,6 @@{"name": "ESP32 GT7 Dashboard (ST7789)",- "version": "1.5.0",+ "version": "1.6.0","new_install_prompt_erase": true,"builds": [{diff --git a/installer/manifest.json b/installer/manifest.jsonindex 407784f..37ca266 100644--- a/installer/manifest.json+++ b/installer/manifest.json@@ -1,6 +1,6 @@{"name": "ESP32 GT7 Dashboard (ILI9341)",- "version": "1.5.0",+ "version": "1.6.0","new_install_prompt_erase": true,"builds": [{diff --git a/installer/release-notes.json b/installer/release-notes.jsonindex 90cd297..1d3e206 100644--- a/installer/release-notes.json+++ b/installer/release-notes.json@@ -1,4 +1,10 @@{+ "1.6.0": [+ "Added the Mono dashboard theme with a minimalist black-and-white digital instrument layout.",+ "Added a segmented monochrome shift-light, dynamic GT7 alert marker and shift-warning pulse.",+ "Refined Mono timing, position, lap, delta, fuel, remaining-lap, tyre, pedal and driving-aid presentation for 320 x 240 displays.",+ "Improved Classic dashboard recovery when a temporary sprite allocation fails after switching themes."+ ],"1.5.0": ["Redesigned Theme Selection with live renderer previews and fixed mock telemetry data.","Added looping theme navigation, compact applied/preview indicators, and persistent Apply or non-destructive Cancel actions.",diff --git a/installer/releases.json b/installer/releases.jsonindex b4009ba..fb3a60b 100644--- a/installer/releases.json+++ b/installer/releases.json@@ -1,5 +1,18 @@{"versions": [+ {+ "version": "1.6.0",+ "notes": [+ "Added the Mono dashboard theme with a minimalist black-and-white digital instrument layout.",+ "Added a segmented monochrome shift-light, dynamic GT7 alert marker and shift-warning pulse.",+ "Refined Mono timing, position, lap, delta, fuel, remaining-lap, tyre, pedal and driving-aid presentation for 320 x 240 displays.",+ "Improved Classic dashboard recovery when a temporary sprite allocation fails after switching themes."+ ],+ "manifests": {+ "ili9341": "versions/1.6.0/manifest-ili9341.json",+ "st7789": "versions/1.6.0/manifest-st7789.json"+ }+ },{"version": "1.5.0","notes": [diff --git a/installer/versions/1.6.0/boot_app0.bin b/installer/versions/1.6.0/boot_app0.binnew file mode 100644index 0000000..13562caBinary files /dev/null and b/installer/versions/1.6.0/boot_app0.bin differdiff --git a/installer/versions/1.6.0/bootloader.bin b/installer/versions/1.6.0/bootloader.binnew file mode 100644index 0000000..d592359Binary files /dev/null and b/installer/versions/1.6.0/bootloader.bin differdiff --git a/installer/versions/1.6.0/firmware-ili9341.bin b/installer/versions/1.6.0/firmware-ili9341.binnew file mode 100644index 0000000..0518917Binary files /dev/null and b/installer/versions/1.6.0/firmware-ili9341.bin differdiff --git a/installer/versions/1.6.0/firmware-st7789.bin b/installer/versions/1.6.0/firmware-st7789.binnew file mode 100644index 0000000..6e0ac59Binary files /dev/null and b/installer/versions/1.6.0/firmware-st7789.bin differdiff --git a/installer/versions/1.6.0/manifest-ili9341.json b/installer/versions/1.6.0/manifest-ili9341.jsonnew file mode 100644index 0000000..d381eb6--- /dev/null+++ b/installer/versions/1.6.0/manifest-ili9341.json@@ -0,0 +1,28 @@+{+ "name": "ESP32 GT7 Dashboard (ILI9341)",+ "version": "1.6.0",+ "new_install_prompt_erase": true,+ "builds": [+ {+ "chipFamily": "ESP32",+ "parts": [+ {+ "path": "bootloader.bin",+ "offset": 4096+ },+ {+ "path": "partitions.bin",+ "offset": 32768+ },+ {+ "path": "boot_app0.bin",+ "offset": 57344+ },+ {+ "path": "firmware-ili9341.bin",+ "offset": 65536+ }+ ]+ }+ ]+}diff --git a/installer/versions/1.6.0/manifest-st7789.json b/installer/versions/1.6.0/manifest-st7789.jsonnew file mode 100644index 0000000..6f58618--- /dev/null+++ b/installer/versions/1.6.0/manifest-st7789.json@@ -0,0 +1,28 @@+{+ "name": "ESP32 GT7 Dashboard (ST7789)",+ "version": "1.6.0",+ "new_install_prompt_erase": true,+ "builds": [+ {+ "chipFamily": "ESP32",+ "parts": [+ {+ "path": "bootloader.bin",+ "offset": 4096+ },+ {+ "path": "partitions.bin",+ "offset": 32768+ },+ {+ "path": "boot_app0.bin",+ "offset": 57344+ },+ {+ "path": "firmware-st7789.bin",+ "offset": 65536+ }+ ]+ }+ ]+}diff --git a/installer/versions/1.6.0/partitions.bin b/installer/versions/1.6.0/partitions.binnew file mode 100644index 0000000..1954582Binary files /dev/null and b/installer/versions/1.6.0/partitions.bin differdiff --git a/src/SHCustomProtocol.h b/src/SHCustomProtocol.hindex 04e7298..816c7ef 100644--- a/src/SHCustomProtocol.h+++ b/src/SHCustomProtocol.h@@ -132,6 +132,7 @@ enum class DashboardTheme : uint8_tGT3 = 1,Retro = 2,Radar = 3,+ Mono = 4,};struct DashboardThemeDescriptor@@ -145,12 +146,13 @@ static constexpr DashboardThemeDescriptor DASHBOARD_THEMES[] = {{DashboardTheme::GT3, "GT3"},{DashboardTheme::Retro, "RETRO"},{DashboardTheme::Radar, "RADAR"},+ {DashboardTheme::Mono, "MONO"},};static constexpr size_t DASHBOARD_THEME_COUNT =sizeof(DASHBOARD_THEMES) / sizeof(DASHBOARD_THEMES[0]);// Phase 1 renderer preview hook. Normal firmware loads the persisted theme;-// development builds can set 0 through 3 without modifying source or storage.+// development builds can select a valid enum value without modifying storage.#ifndef GT7_DASHBOARD_THEME_PREVIEW#define GT7_DASHBOARD_THEME_PREVIEW -1#endif@@ -438,7 +440,7 @@ private:? static_cast<DashboardTheme>(storedTheme): DashboardTheme::GT3;-#if GT7_DASHBOARD_THEME_PREVIEW >= 0 && GT7_DASHBOARD_THEME_PREVIEW <= 3+#if GT7_DASHBOARD_THEME_PREVIEW >= 0 && GT7_DASHBOARD_THEME_PREVIEW <= 4activeDashboardTheme =static_cast<DashboardTheme>(GT7_DASHBOARD_THEME_PREVIEW);#endif@@ -1123,6 +1125,9 @@ public:case DashboardTheme::Radar:drawRadarDashboard(state, forceUpdate);break;+ case DashboardTheme::Mono:+ drawMonoDashboard(state, forceUpdate);+ break;case DashboardTheme::GT3:default:#if GT7_DASHBOARD_LEGACY_UI@@ -1886,6 +1891,383 @@ public:prevData["radarLayoutState"] = layoutState;}+ void drawMonoValue(int32_t x, int32_t y, int32_t width, int32_t height,+ const String &value, const String &id, uint16_t color, uint8_t font,+ textdatum_t datum, bool forceUpdate, float scaleX = 1.0f,+ float scaleY = 1.0f)+ {+ const String cacheState = value + ":" + String(color);+ if (!forceUpdate && prevData[id] == cacheState) return;+ tft.fillRect(x, y, width, height, TFT_BLACK);+ tft.setTextColor(color, TFT_BLACK);+ tft.setTextDatum(datum);+ tft.setTextSize(scaleX, scaleY);+ const int32_t textX = datum == MR_DATUM ? x + width - 2+ : (datum == MC_DATUM ? x + width / 2 : x + 2);+ tft.drawString(value, textX, y + height / 2, font);+ tft.setTextSize(1.0f);+ tft.setTextDatum(TL_DATUM);+ prevData[id] = cacheState;+ }++ void drawMonoValueBuffered(int32_t x, int32_t y, int32_t width,+ int32_t height, const String &value, const String &id, uint16_t color,+ uint8_t font, textdatum_t datum, bool forceUpdate, LGFX_Sprite &sprite,+ bool &spriteCreated, float scaleX = 1.0f, float scaleY = 1.0f)+ {+ const String cacheState = value + ":" + String(color);+ if (!forceUpdate && prevData[id] == cacheState) return;+ if (!spriteCreated)+ {+ sprite.setColorDepth(16);+ spriteCreated = sprite.createSprite(width, height) != nullptr;+ }+ if (!spriteCreated)+ {+ drawMonoValue(x, y, width, height, value, id, color, font,+ datum, true, scaleX, scaleY);+ return;+ }+ sprite.fillSprite(TFT_BLACK);+ sprite.setTextColor(color, TFT_BLACK);+ sprite.setTextDatum(datum);+ sprite.setTextSize(scaleX, scaleY);+ const int32_t textX = datum == MR_DATUM ? width - 2+ : (datum == MC_DATUM ? width / 2 : 2);+ sprite.drawString(value, textX, height / 2, font);+ sprite.setTextSize(1.0f);+ sprite.pushSprite(x, y);+ prevData[id] = cacheState;+ }++ void drawMonoSpeed(const String &speed, bool forceUpdate)+ {+ if (!forceUpdate && prevData["monoSpeed"] == speed) return;+ static LGFX_Sprite sprite(&tft);+ static bool spriteCreated = false;+ if (!spriteCreated)+ {+ sprite.setColorDepth(16);+ spriteCreated = sprite.createSprite(108, 48) != nullptr;+ }+ if (!spriteCreated) return;+ const uint16_t white = tft.color565(235, 235, 231);+ const uint16_t muted = tft.color565(154, 156, 158);+ sprite.fillSprite(TFT_BLACK);+ sprite.setTextDatum(MC_DATUM);+ sprite.setTextColor(white, TFT_BLACK);+ sprite.setTextSize(1.20f, 1.08f);+ sprite.drawString(speed, 54, 20, 4);+ sprite.setTextSize(1.0f);+ sprite.setTextColor(muted, TFT_BLACK);+ sprite.drawString("km/h", 54, 39, 1);+ sprite.pushSprite(106, 137);+ prevData["monoSpeed"] = speed;+ }++ void drawMonoRpm(const DashboardState &state, bool forceUpdate)+ {+ static constexpr int SEGMENT_COUNT = 30;+ static constexpr int SEGMENT_X = 11;+ static constexpr int SEGMENT_Y = 17;+ static constexpr int SEGMENT_PITCH = 10;+ static constexpr int SEGMENT_W = 8;+ static constexpr int SEGMENT_H = 17;+ static constexpr float PULSE_HZ = 3.0f;+ static constexpr uint32_t FRAME_MS = 24;+ static int previousActive = -1;+ static bool previousPulse = false;+ static uint32_t pulseStart = 0;+ static uint32_t lastFrame = 0;+ static uint8_t previousMix = 0;++ const uint16_t activeBase = tft.color565(228, 228, 224);+ const uint16_t inactive = tft.color565(68, 70, 72);+ const uint16_t tick = tft.color565(150, 152, 154);+ const int active = constrain(+ (state.rpmPercent * SEGMENT_COUNT + 99) / 100, 0, SEGMENT_COUNT);+ const bool warning = state.rpmAlertRangeValid &&+ state.rpmPercent >= state.rpmRedLineSetting;+ const bool pulse = warning || state.revLimitAlertActive;+ const uint32_t now = millis();+ const bool pulseStarted = pulse && !previousPulse;+ if (pulseStarted) pulseStart = now;++ uint8_t whiteMix = 0;+ bool pulseFrame = false;+ if (pulse && (pulseStarted || now - lastFrame >= FRAME_MS))+ {+ float peak = 0.32f;+ if (warning)+ {+ const float span = max(1, 100 - state.rpmRedLineSetting);+ const float progress = constrain(+ (state.rpmPercent - state.rpmRedLineSetting) / span,+ 0.0f, 1.0f);+ peak += 0.24f * progress;+ }+ if (state.revLimitAlertActive) peak = 0.72f;+ const float elapsed = (now - pulseStart) / 1000.0f;+ const float wave = 0.5f + 0.5f * cosf(TWO_PI * PULSE_HZ * elapsed);+ whiteMix = static_cast<uint8_t>(lroundf(255.0f * peak * wave));+ pulseFrame = pulseStarted || whiteMix != previousMix;+ lastFrame = now;+ }+ else if (pulse)+ {+ whiteMix = previousMix;+ }++ const String markerState = String(state.rpmRedLineSetting) + ":" ++ String(state.rpmAlertRangeValid ? 1 : 0);+ const bool markerChanged = prevData["monoRpmMarker"] != markerState;+ const bool pulseEnded = !pulse && previousPulse;+ if (forceUpdate || active != previousActive || markerChanged ||+ pulseFrame || pulseEnded)+ {+ for (int i = 0; i < SEGMENT_COUNT; ++i)+ {+ const bool fillChanged = previousActive < 0 ||+ (i >= min(active, previousActive) &&+ i < max(active, previousActive));+ const bool pulseChanged = i < active && (pulseFrame || pulseEnded);+ if (!forceUpdate && !fillChanged && !pulseChanged) continue;+ const uint16_t color = i < active+ ? (pulse ? blendRgb565(activeBase, TFT_WHITE, whiteMix)+ : activeBase)+ : inactive;+ tft.fillRect(SEGMENT_X + i * SEGMENT_PITCH, SEGMENT_Y,+ SEGMENT_W, SEGMENT_H, color);+ }++ if (forceUpdate)+ {+ for (int i = 0; i < 5; ++i)+ {+ const int x = SEGMENT_X + SEGMENT_W / 2 ++ lroundf(i * (SEGMENT_COUNT - 1) * SEGMENT_PITCH / 4.0f);+ tft.drawFastVLine(x, 6, 6, tick);+ }+ }++ if (forceUpdate || markerChanged)+ {+ tft.fillRect(SEGMENT_X - 4, 35,+ (SEGMENT_COUNT - 1) * SEGMENT_PITCH + SEGMENT_W + 8,+ 9, TFT_BLACK);+ if (state.rpmAlertRangeValid)+ {+ const int markerX = SEGMENT_X + SEGMENT_W / 2 + lroundf(+ constrain(state.rpmRedLineSetting / 100.0f, 0.0f, 1.0f) *+ (SEGMENT_COUNT - 1) * SEGMENT_PITCH);+ tft.fillTriangle(markerX, 35, markerX - 4, 42,+ markerX + 4, 42, activeBase);+ }+ }+ }++ previousActive = active;+ previousPulse = pulse;+ previousMix = pulse ? whiteMix : 0;+ prevData["monoRpmMarker"] = markerState;+ }++ void drawMonoPedals(const DashboardState &state, bool forceUpdate)+ {+ const int brakeInput = constrain(state.absLevel.toInt(), 0, 100);+ const int brakeApplied = constrain(state.absFilteredLevel.toInt(), 0, 100);+ const int throttleInput = constrain(state.tcLevel.toInt(), 0, 100);+ const int throttleApplied = constrain(state.tcFilteredLevel.toInt(), 0, 100);+ const String cacheState = String(brakeInput) + ":" + String(brakeApplied) ++ ":" + String(throttleInput) + ":" + String(throttleApplied);+ if (!forceUpdate && prevData["monoPedals"] == cacheState) return;++ static LGFX_Sprite sprite(&tft);+ static bool spriteCreated = false;+ if (!spriteCreated)+ {+ sprite.setColorDepth(16);+ spriteCreated = sprite.createSprite(138, 20) != nullptr;+ }+ if (!spriteCreated) return;+ const uint16_t frame = tft.color565(104, 106, 108);+ const uint16_t input = tft.color565(94, 96, 98);+ const uint16_t applied = tft.color565(225, 225, 221);+ sprite.fillSprite(TFT_BLACK);+ sprite.setTextColor(TFT_LIGHTGREY, TFT_BLACK);+ sprite.setTextDatum(TL_DATUM);+ sprite.drawString("B", 0, 1, 1);+ sprite.drawString("T", 0, 11, 1);+ const int values[2][2] = {+ {brakeInput, brakeApplied}, {throttleInput, throttleApplied}};+ for (int row = 0; row < 2; ++row)+ {+ const int y = 2 + row * 10;+ sprite.drawRect(12, y, 124, 7, frame);+ const int inputW = 122 * values[row][0] / 100;+ const int appliedW = 122 * values[row][1] / 100;+ if (inputW > 0) sprite.fillRect(13, y + 1, inputW, 5, input);+ if (appliedW > 0) sprite.fillRect(13, y + 1, appliedW, 5, applied);+ }+ sprite.pushSprite(180, 218);+ prevData["monoPedals"] = cacheState;+ }++ void drawMonoTyres(const DashboardState &state, bool forceUpdate,+ LGFX_Sprite &sprite, bool &spriteCreated)+ {+ String cacheState;+ for (int i = 0; i < 4; ++i)+ {+ if (i > 0) cacheState += ":";+ cacheState += isnan(state.tyreTemperatures[i])+ ? "--" : String(lroundf(state.tyreTemperatures[i]));+ }+ if (!forceUpdate && prevData["monoTyres"] == cacheState) return;+ if (!spriteCreated)+ {+ sprite.setColorDepth(16);+ spriteCreated = sprite.createSprite(176, 20) != nullptr;+ }+ if (!spriteCreated) return;+ sprite.fillSprite(TFT_BLACK);+ sprite.setTextColor(TFT_LIGHTGREY, TFT_BLACK);+ sprite.setTextDatum(ML_DATUM);+ sprite.drawString("TYRE", 2, 10, 1);+ const char *labels[] = {"FL", "FR", "RL", "RR"};+ for (int i = 0; i < 4; ++i)+ {+ const String value = String(labels[i]) ++ (isnan(state.tyreTemperatures[i])+ ? String("--") : String(lroundf(state.tyreTemperatures[i])));+ sprite.setTextDatum(MC_DATUM);+ sprite.drawString(value, 54 + i * 33, 10, 1);+ }+ sprite.pushSprite(2, 218);+ prevData["monoTyres"] = cacheState;+ }++ void drawMonoStatusDot(int centerX, int centerY, bool active,+ const String &id, uint16_t color, bool forceUpdate)+ {+ const String cacheState = active ? "1" : "0";+ if (!forceUpdate && prevData[id] == cacheState) return;+ tft.fillRect(centerX - 7, centerY - 5, 14, 10, TFT_BLACK);+ if (active)+ tft.fillRoundRect(centerX - 6, centerY - 4, 12, 8, 2, color);+ else+ tft.drawRoundRect(centerX - 6, centerY - 4, 12, 8, 2, color);+ prevData[id] = cacheState;+ }++ void drawMonoFuelGauge(const String &fuelValue, bool forceUpdate)+ {+ static constexpr int SEGMENTS = 10;+ const bool valid = fuelValue != "--" && fuelValue.length() > 0;+ const int percent = valid ? constrain(fuelValue.toInt(), 0, 100) : 100;+ const int active = constrain((percent * SEGMENTS + 99) / 100, 0, SEGMENTS);+ const String cacheState = String(active);+ if (!forceUpdate && prevData["monoFuelGauge"] == cacheState) return;+ const uint16_t filled = tft.color565(225, 225, 221);+ const uint16_t empty = tft.color565(68, 70, 72);+ const int x = 131;+ const int y = 199;+ for (int i = 0; i < SEGMENTS; ++i)+ tft.fillRect(x + i * 7, y, 5, 8, i < active ? filled : empty);+ prevData["monoFuelGauge"] = cacheState;+ }++ void drawMonoDashboard(const DashboardState &state, bool forceUpdate)+ {+ static LGFX_Sprite currentSprite(&tft);+ static LGFX_Sprite deltaSprite(&tft);+ static LGFX_Sprite tyreSprite(&tft);+ static bool currentSpriteCreated = false;+ static bool deltaSpriteCreated = false;+ static bool tyreSpriteCreated = false;+ const uint16_t white = tft.color565(235, 235, 231);+ const uint16_t muted = tft.color565(154, 156, 158);+ const uint16_t frame = tft.color565(76, 78, 80);++ if (forceUpdate)+ {+ tft.fillScreen(TFT_BLACK);+ tft.setTextPadding(0);+ tft.setTextSize(1.0f);+ tft.setTextDatum(TL_DATUM);+ tft.setTextColor(muted, TFT_BLACK);+ tft.drawFastVLine(102, 46, 141, frame);+ tft.drawFastVLine(218, 46, 141, frame);+ tft.drawFastHLine(5, 94, 91, frame);+ tft.drawFastHLine(224, 94, 91, frame);+ tft.drawFastHLine(5, 141, 91, frame);+ tft.drawFastHLine(224, 141, 91, frame);+ tft.drawFastHLine(0, 190, 320, frame);+ tft.drawFastHLine(0, 215, 320, frame);++ tft.drawString("LAP", 6, 50, 1);+ tft.drawString("BEST", 6, 98, 1);+ tft.drawString("DELTA", 6, 145, 1);+ tft.drawString("POSITION", 225, 50, 1);+ tft.drawString("CURRENT", 225, 98, 1);+ tft.drawString("LAST", 225, 145, 1);++ // Balanced status row: driving aids, centred fuel gauge, fuel and REM.+ tft.drawRect(110, 197, 9, 13, muted);+ tft.drawRect(112, 199, 5, 4, muted);+ tft.drawFastHLine(109, 212, 12, muted);+ tft.drawFastVLine(120, 201, 8, muted);+ tft.drawLine(118, 199, 121, 202, muted);+ tft.setTextDatum(ML_DATUM);+ tft.drawString("ABS", 6, 203, 1);+ tft.drawString("TCS", 51, 203, 1);+ tft.drawString("FUEL", 220, 203, 1);+ tft.drawString("REM", 273, 203, 1);+ tft.setTextDatum(TL_DATUM);+ }++ drawMonoRpm(state, forceUpdate);+ drawMonoValue(4, 63, 93, 27, state.tyrePressureRearLeft,+ "monoLap", white, 2, MC_DATUM, forceUpdate, 1.34f, 1.22f);+ drawMonoValue(4, 111, 93, 27, state.bestLapTime,+ "monoBest", white, 1, MC_DATUM, forceUpdate, 1.52f, 1.38f);+ uint16_t deltaColor = white;+ if (state.sessionBestLiveDeltaSeconds.startsWith("-")) deltaColor = white;+ else if (state.sessionBestLiveDeltaSeconds.startsWith("+") &&+ state.sessionBestLiveDeltaSeconds != "+0.000") deltaColor = muted;+ String delta = state.sessionBestLiveDeltaSeconds;+ if (delta.startsWith("+") || delta.startsWith("-"))+ delta = delta.substring(0, 1) + " " + delta.substring(1);+ drawMonoValueBuffered(4, 158, 93, 25, delta, "monoDelta", deltaColor,+ 1, MC_DATUM, forceUpdate, deltaSprite, deltaSpriteCreated,+ 1.52f, 1.38f);++ drawMonoValue(106, 56, 108, 80, state.gear, "monoGear", white,+ 7, MC_DATUM, forceUpdate, 1.62f, 1.52f);+ drawMonoSpeed(state.speed, forceUpdate);++ drawMonoValue(223, 63, 94, 27, state.tyrePressureFrontRight,+ "monoPos", white, 2, MC_DATUM, forceUpdate, 1.42f, 1.24f);+ drawMonoValueBuffered(223, 111, 94, 27, state.currentLapTime,+ "monoCurrent", state.lapInvalidated == "True" ? muted : white,+ 1, MC_DATUM, forceUpdate, currentSprite, currentSpriteCreated,+ 1.52f, 1.38f);+ drawMonoValue(223, 158, 94, 25, state.lastLapTime,+ "monoLast", white, 1, MC_DATUM, forceUpdate, 1.52f, 1.38f);++ drawMonoFuelGauge(state.brakeBias, forceUpdate);+ drawMonoValue(244, 196, 25, 15, state.brakeBias,+ "monoFuelValue", white, 1, ML_DATUM, forceUpdate);+ drawMonoValue(291, 196, 27, 15, state.tyrePressureFrontLeft,+ "monoRem", white, 1, ML_DATUM, forceUpdate);+ drawMonoStatusDot(35, 203, isActiveValue(state.absActive),+ "monoAbs", white, forceUpdate);+ drawMonoStatusDot(80, 203, isActiveValue(state.tcActive),+ "monoTcs", white, forceUpdate);+ drawMonoTyres(state, forceUpdate, tyreSprite, tyreSpriteCreated);+ drawMonoPedals(state, forceUpdate);+ }+void drawThemePlaceholder(const DashboardState &state,DashboardTheme theme,@@ -3465,8 +3847,21 @@ public:if (!spriteCreated){sprite.setColorDepth(16);- sprite.createSprite(cellWidth, cellHeight);- spriteCreated = true;+ spriteCreated = sprite.createSprite(cellWidth, cellHeight) != nullptr;+ }++ if (!spriteCreated)+ {+ // A failed heap allocation previously left all three Classic lap cells+ // permanently blank. Draw directly for this frame and retry allocation+ // on a later update instead of caching an invisible result.+ tft.fillRect(x, y, cellWidth, cellHeight, TFT_BLACK);+ tft.drawRoundRect(x, y, cellWidth, cellHeight, 5, color);+ tft.setTextColor(color, TFT_BLACK);+ tft.setTextDatum(TL_DATUM);+ tft.drawString(name, x + 5, y + 1, 2);+ tft.drawString(data, x + 5, y + 19, 4);+ return;}// 所有內容先在記憶體裡畫好