C
release: add EV telemetry support in 1.8.0
YU CHIH CHANG4f48fde1796e
diff --git a/README.md b/README.mdindex 728b05e..1460a1a 100644--- a/README.md+++ b/README.md@@ -47,6 +47,7 @@ Simply connect your ESP32 to the same Wi-Fi network as your PS5 and enjoy real-t- 🏁 Current, Last and Best lap times- ⏱ Live Delta- ⛽ Fuel consumption and remaining fuel estimation+- 🔋 Automatic EV detection with compact remaining-energy display- 🔄 Estimated laps remaining- 🚦 RPM bar with configurable shift lights- 🚨 ABS indicatordiff --git a/README.zh-TW.md b/README.zh-TW.mdindex 7c4ef90..1b89951 100644--- a/README.zh-TW.md+++ b/README.zh-TW.md@@ -48,6 +48,7 @@- 🏁 目前圈速、上一圈、最佳圈- ⏱ 即時 Delta(圈速差)- ⛽ 油耗與剩餘油量預估+- 🔋 自動辨識 EV,並以精簡數字顯示剩餘電量- 🔄 預估剩餘可行駛圈數- 🚦 RPM 轉速條與換檔提示燈- 🚨 ABS 指示燈diff --git a/VERSION b/VERSIONindex 661e7ae..27f9cd3 100644--- a/VERSION+++ b/VERSION@@ -1 +1 @@-1.7.3+1.8.0diff --git a/docs/EV_TELEMETRY_SUPPORT.md b/docs/EV_TELEMETRY_SUPPORT.mdnew file mode 100644index 0000000..5f0bb11--- /dev/null+++ b/docs/EV_TELEMETRY_SUPPORT.md@@ -0,0 +1,170 @@+# EV Telemetry Support Plan++Status: implemented on the EV feature branch; awaiting in-game validation.++## Scope and expected change size++This is a small-to-medium change rather than a dashboard redesign. The GT7 UDP parser+already exposes `fuelLevel` and `fuelCapacity`, and every theme already has a fuel value+or fuel progress presentation. The implementation should mainly add one normalized fuel+display model in the dashboard data layer and make the existing theme renderers consume+that model.++Expected touch points:++- one GT7 telemetry-to-dashboard mapping function;+- the dashboard state and fixed Theme Preview mock data;+- the existing fuel label/value/progress paths in all six themes;+- the remaining-laps (`REM`/`LEFT`) output;+- focused ICE, EV, invalid-data and vehicle-transition tests.++No new image assets, framebuffer, vehicle database or telemetry packet format is needed.+The main implementation risk is stale text when a running session changes between `FUEL`+and `EV`, because several themes currently draw static labels only during a full redraw.+The EV flag must therefore participate in the relevant redraw cache or request a safe full+theme redraw when the powertrain classification changes.++## Telemetry interpretation++Use the following GT7-specific interpretation:++- `fuelCapacity >= 0.1f`: combustion or hybrid vehicle with normal fuel data;+- `fuelCapacity < 0.1f`: EV candidate;+- for an EV candidate, `fuelLevel` is treated as remaining energy in kWh.++The kWh interpretation is a project assumption that must be verified against the GT7 HUD+on multiple EVs before release. `energyRecovery` is an instantaneous recovery value and+must not be used as battery state of charge.++Powertrain classification uses only the capacity field at packet offset `0x48`. Keep+energy validity separate so an invalid energy sample cannot make an EV label flicker back+to `FUEL`:++```cpp+const bool validCapacity = isfinite(fuelCapacity) && fuelCapacity >= 0.0f;+const bool isEV = validCapacity && fuelCapacity < 0.1f;+const bool validEvEnergy = isfinite(fuelLevel) && fuelLevel > 0.0f && fuelLevel < 500.0f;+```++Kart capacity is expected to be around 5 and therefore remains on the normal fuel path.+Hybrids with a non-zero fuel capacity also remain on the normal fuel path.++## Normalized dashboard data++Compute the EV behavior once below the theme renderers. Themes must not independently+interpret raw `fuelLevel` or `fuelCapacity`.++The normalized state should expose equivalent fields to:++```cpp+bool fuelIsEV;+bool fuelValueValid;+String fuelLabel; // "FUEL" or "EV"+String fuelDisplayValue; // ICE: percentage, EV: remaining kWh without suffix+int fuelProgressPercent; // clamped 0..100 visual progress+String remainingLaps; // EV always "--"+```++Existing legacy protocol field names may remain internally for compatibility, but theme+code should receive distinct display value and progress semantics. A single string must+not simultaneously represent raw EV energy and a percentage.++## Display rules++### Combustion and hybrid vehicles++- Label: `FUEL`+- Value: existing fuel percentage behavior, including `%` where the theme currently uses it+- Progress: `fuelLevel / fuelCapacity`+- Remaining laps: retain the existing fuel-per-lap estimator+- Low-fuel status: retain existing percentage thresholds++### Electric vehicles++- Label: `EV`+- Value: rounded whole-number `fuelLevel`, with no `%` or `kWh` suffix+- Icon: retain the theme's existing fuel-pump icon and layout+- Remaining laps (`REM` or `LEFT`): always `--`+- The fuel-per-lap estimator must not consume EV energy data+- Reset or invalidate the estimator when classification changes between EV and non-EV++Example:++```text+EV 42+REM --+```++### Invalid or transitional data++- Value: `--`+- Remaining laps: `--`+- Do not update the normal fuel estimator+- Preserve the theme's current safe progress fallback unless testing identifies a clearer+ common fallback++An EV `fuelLevel` of zero is treated as transitional/invalid while this behavior is being+validated, preventing the initialization packet from briefly displaying `0.0` before the+car's energy value becomes available.++## EV visual progress++GT7 does not currently provide a confirmed battery capacity or battery SOC field. Use a+fixed visual reference only:++```cpp+constexpr float EV_VISUAL_FULL_KWH = 60.0f;++const int progressPercent = constrain(+ lroundf(fuelLevel / EV_VISUAL_FULL_KWH * 100.0f),+ 0,+ 100+);+```++Examples:++| Remaining EV energy | Visual progress |+| ---: | ---: |+| 80 kWh | 100% |+| 60 kWh | 100% |+| 45 kWh | 75% |+| 30 kWh | 50% |+| 15 kWh | 25% |++This progress is a relative energy indication, not true battery SOC. Documentation must+not describe it as an exact percentage. Values above 60 kWh are intentionally clamped to+full.++In Model 3 testing, GT7 updated EV energy at a visibly lower cadence than the main+telemetry stream, producing stepwise changes separated by tens of seconds. This cadence+is an observed game behavior, not an official fixed interval. The dashboard presents the+latest raw value without interpolation or an artificial consumption estimate.++## Theme integration++All six themes should preserve their current geometry, fonts, icon shapes and colors.+Only the following content becomes dynamic:++- `FUEL` changes to `EV` for an EV;+- the displayed value uses `fuelDisplayValue`;+- segmented or filled gauges use `fuelProgressPercent`;+- `REM`/`LEFT` displays `--` for an EV.++Theme Preview should include an explicit EV mock-data option during development, but the+normal default preview may remain an ICE vehicle. Label redraws must be tested without+requiring a theme switch or reboot.++## Acceptance checks++1. ICE with valid fuel capacity behaves exactly as before.+2. Hybrid with valid fuel capacity remains `FUEL`, not `EV`.+3. Kart with capacity near 5 remains `FUEL`.+4. EV shows `EV`, a suffix-free rounded energy value and visual progress based on 60 kWh.+5. EV always shows `REM --` or `LEFT --` and does not update the fuel estimator.+6. Invalid values show `--` without NaN, overflow or a misleading low-fuel warning.+7. Switching ICE -> EV -> ICE refreshes labels, values, progress and remaining laps without+ stale pixels or a full-screen flicker.+8. All six themes preserve their existing layout at one-, two- and three-digit EV values.+9. At least two GT7 EVs are compared with the native HUD to validate that `fuelLevel`+ behaves like remaining kWh before the feature is released.diff --git a/include/version.h b/include/version.hindex bb4e3fb..7e392c3 100644--- a/include/version.h+++ b/include/version.h@@ -1,3 +1,3 @@#pragma once-inline constexpr char GT7_DASH_VERSION[] = "1.7.3";+inline constexpr char GT7_DASH_VERSION[] = "1.8.0";diff --git a/installer/firmware/firmware-ili9341.bin b/installer/firmware/firmware-ili9341.binindex 307d64d..3ed772a 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 f5285b2..d8796fe 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 08b4238..74b5372 100644--- a/installer/manifest-st7789.json+++ b/installer/manifest-st7789.json@@ -1,6 +1,6 @@{"name": "ESP32 GT7 Dashboard (ST7789)",- "version": "1.7.3",+ "version": "1.8.0","new_install_prompt_erase": true,"builds": [{diff --git a/installer/manifest.json b/installer/manifest.jsonindex 15dde49..a6d4d42 100644--- a/installer/manifest.json+++ b/installer/manifest.json@@ -1,6 +1,6 @@{"name": "ESP32 GT7 Dashboard (ILI9341)",- "version": "1.7.3",+ "version": "1.8.0","new_install_prompt_erase": true,"builds": [{diff --git a/installer/release-notes.json b/installer/release-notes.jsonindex fafe39c..00522f8 100644--- a/installer/release-notes.json+++ b/installer/release-notes.json@@ -1,4 +1,10 @@{+ "1.8.0": [+ "Added EV detection from GT7 fuel-capacity telemetry across all six dashboard themes.",+ "Added compact whole-number EV energy display and vehicle-aware FUEL or EV labels.",+ "Added EV visual energy gauges while keeping remaining-lap estimates disabled for electric vehicles.",+ "Separated EV classification from energy-value validation to prevent transient telemetry from showing the wrong powertrain label."+ ],"1.7.3": ["Added the Pocket dashboard theme with a Game Boy-inspired pixel interface optimized for 320 x 240 displays.","Added telemetry-driven pixel RPM, timing, fuel-level, ABS and TCS indicators, with isolated redraws for stable updates.",diff --git a/installer/releases.json b/installer/releases.jsonindex f0d89d3..ead6643 100644--- a/installer/releases.json+++ b/installer/releases.json@@ -1,5 +1,18 @@{"versions": [+ {+ "version": "1.8.0",+ "notes": [+ "Added EV detection from GT7 fuel-capacity telemetry across all six dashboard themes.",+ "Added compact whole-number EV energy display and vehicle-aware FUEL or EV labels.",+ "Added EV visual energy gauges while keeping remaining-lap estimates disabled for electric vehicles.",+ "Separated EV classification from energy-value validation to prevent transient telemetry from showing the wrong powertrain label."+ ],+ "manifests": {+ "ili9341": "versions/1.8.0/manifest-ili9341.json",+ "st7789": "versions/1.8.0/manifest-st7789.json"+ }+ },{"version": "1.7.3","notes": [diff --git a/installer/versions/1.8.0/boot_app0.bin b/installer/versions/1.8.0/boot_app0.binnew file mode 100644index 0000000..13562caBinary files /dev/null and b/installer/versions/1.8.0/boot_app0.bin differdiff --git a/installer/versions/1.8.0/bootloader.bin b/installer/versions/1.8.0/bootloader.binnew file mode 100644index 0000000..d592359Binary files /dev/null and b/installer/versions/1.8.0/bootloader.bin differdiff --git a/installer/versions/1.8.0/firmware-ili9341.bin b/installer/versions/1.8.0/firmware-ili9341.binnew file mode 100644index 0000000..3ed772aBinary files /dev/null and b/installer/versions/1.8.0/firmware-ili9341.bin differdiff --git a/installer/versions/1.8.0/firmware-st7789.bin b/installer/versions/1.8.0/firmware-st7789.binnew file mode 100644index 0000000..d8796feBinary files /dev/null and b/installer/versions/1.8.0/firmware-st7789.bin differdiff --git a/installer/versions/1.8.0/manifest-ili9341.json b/installer/versions/1.8.0/manifest-ili9341.jsonnew file mode 100644index 0000000..4568df4--- /dev/null+++ b/installer/versions/1.8.0/manifest-ili9341.json@@ -0,0 +1,28 @@+{+ "name": "ESP32 GT7 Dashboard (ILI9341)",+ "version": "1.8.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.8.0/manifest-st7789.json b/installer/versions/1.8.0/manifest-st7789.jsonnew file mode 100644index 0000000..7e00e6e--- /dev/null+++ b/installer/versions/1.8.0/manifest-st7789.json@@ -0,0 +1,28 @@+{+ "name": "ESP32 GT7 Dashboard (ST7789)",+ "version": "1.8.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.8.0/partitions.bin b/installer/versions/1.8.0/partitions.binnew file mode 100644index 0000000..1954582Binary files /dev/null and b/installer/versions/1.8.0/partitions.bin differdiff --git a/src/SHCustomProtocol.h b/src/SHCustomProtocol.hindex f182a59..899bd16 100644--- a/src/SHCustomProtocol.h+++ b/src/SHCustomProtocol.h@@ -195,6 +195,11 @@ struct DashboardStateString isTCCutNull = "True";String tcTcCut = "0 0";String brakeBias = "0";+ bool fuelIsEV = false;+ bool fuelValueValid = false;+ String fuelLabel = "FUEL";+ String fuelDisplayValue = "--";+ int fuelProgressPercent = 100;String brake = "0";String lapInvalidated = "False";float tyreTemperatures[4] = {NAN, NAN, NAN, NAN};@@ -458,6 +463,11 @@ private:themePreviewData.tyrePressureRearLeft = "3/10";themePreviewData.brakeBias = "80";themePreviewData.fuelAlertActive = "60";+ themePreviewData.fuelIsEV = false;+ themePreviewData.fuelValueValid = true;+ themePreviewData.fuelLabel = "FUEL";+ themePreviewData.fuelDisplayValue = "80";+ themePreviewData.fuelProgressPercent = 80;themePreviewData.tcLevel = "68";themePreviewData.tcFilteredLevel = "62";themePreviewData.absLevel = "36";@@ -816,19 +826,69 @@ public:}// 油量百分比- float fuelPercent = 0.0f;- if (data.fuelCapacity > 0.0f)+ // Normalize ICE and EV energy into separate display and progress values.+ // For EVs, fuelLevel is treated as remaining kWh. The fixed 60 kWh+ // reference is only a visual scale because GT7 does not expose capacity.+ static constexpr float EV_CAPACITY_THRESHOLD = 0.1f;+ static constexpr float EV_VISUAL_FULL_KWH = 60.0f;+ static constexpr float MAX_REASONABLE_EV_KWH = 500.0f;+ const bool validCapacity = isfinite(data.fuelCapacity) &&+ data.fuelCapacity >= 0.0f;+ const bool validFuelLevel = isfinite(data.fuelLevel) &&+ data.fuelLevel >= 0.0f && data.fuelLevel < MAX_REASONABLE_EV_KWH;+ // Powertrain classification comes only from the capacity field (0x48).+ // Keep it independent from fuelLevel so a transient/invalid energy value+ // cannot make an EV label flicker back to FUEL.+ const bool detectedEV = validCapacity &&+ data.fuelCapacity < EV_CAPACITY_THRESHOLD;+ const bool validEvFuel = detectedEV && validFuelLevel &&+ data.fuelLevel > 0.0f;+ const bool validIceFuel = validCapacity && validFuelLevel &&+ data.fuelCapacity >= EV_CAPACITY_THRESHOLD;+ const bool nextFuelValueValid = validEvFuel || validIceFuel;+ const String nextFuelLabel = detectedEV ? "EV" : "FUEL";++ if (fuelIsEV != detectedEV || fuelValueValid != nextFuelValueValid)+ {+ derivedMetrics.fuel.reset();+ if (fuelLabel != nextFuelLabel)+ forceUpdate = true;+ }++ fuelIsEV = detectedEV;+ fuelValueValid = nextFuelValueValid;+ fuelLabel = nextFuelLabel;++ if (validEvFuel){- fuelPercent = constrain(+ // GT7 updates EV energy in coarse steps. A whole-number display keeps+ // every theme compact and avoids implying unavailable precision.+ fuelDisplayValue = String(data.fuelLevel, 0);+ fuelProgressPercent = constrain(+ static_cast<int>(lroundf(+ data.fuelLevel / EV_VISUAL_FULL_KWH * 100.0f)),+ 0,+ 100);+ }+ else if (validIceFuel)+ {+ const float fuelPercent = constrain((data.fuelLevel / data.fuelCapacity) * 100.0f,0.0f,100.0f);+ fuelDisplayValue = String(fuelPercent, 0);+ fuelProgressPercent = constrain(+ static_cast<int>(lroundf(fuelPercent)), 0, 100);+ }+ else+ {+ fuelDisplayValue = "--";+ fuelProgressPercent = 100;}- brakeBias = data.fuelCapacity > 0.0f- ? String(fuelPercent, 0)- : "--";- fuelAlertActive = String(fuelPercent, 1);+ // Keep legacy fields synchronized for existing protocol helpers.+ brakeBias = fuelDisplayValue;+ fuelAlertActive = String(fuelProgressPercent);for (int tyreIndex = 0; tyreIndex < 4; tyreIndex++){@@ -837,14 +897,14 @@ public:// 由獨立 library 估算剩餘油量圈數。// 注意:GT7FuelEstimator 接收的是公升,不是百分比。- derivedMetrics.fuel.update(- data.fuelLevel,- currentLap);+ if (validIceFuel)+ derivedMetrics.fuel.update(data.fuelLevel, currentLap);- const float estimatedFuelLaps =- derivedMetrics.fuel.remainingLaps();+ const float estimatedFuelLaps = validIceFuel+ ? derivedMetrics.fuel.remainingLaps()+ : -1.0f;- if (estimatedFuelLaps >= 0.0f)+ if (!fuelIsEV && estimatedFuelLaps >= 0.0f){tyrePressureFrontLeft = String(estimatedFuelLaps, 1);}@@ -975,6 +1035,13 @@ public:// 20:剩餘油量百分比brakeBias =FlowSerialReadStringUntil(';');+ fuelIsEV = false;+ fuelValueValid = brakeBias != "--" && brakeBias.length() > 0;+ fuelLabel = "FUEL";+ fuelDisplayValue = brakeBias;+ fuelProgressPercent = fuelValueValid+ ? constrain(static_cast<int>(lroundf(fuelAlertActive.toFloat())), 0, 100)+ : 100;// 21:保留欄位,固定為 0brake =diff --git a/src/dashboard/themes/ClassicTheme.inc b/src/dashboard/themes/ClassicTheme.incindex 463e4f2..487566d 100644--- a/src/dashboard/themes/ClassicTheme.inc+++ b/src/dashboard/themes/ClassicTheme.inc@@ -81,13 +81,18 @@const bool absOn = isActiveValue(state.absActive);const uint16_t tcsColor = tcsOn ? TFT_YELLOW : TFT_DARKGREY;const uint16_t absColor = absOn ? TFT_RED : TFT_DARKGREY;- float fuelPercentValue = state.fuelAlertActive.toFloat();+ float fuelPercentValue = state.fuelProgressPercent;// FuelString fuelStatus;uint16_t fuelStatusColor;- if (fuelPercentValue > 50.0f)+ if (!state.fuelValueValid || state.fuelIsEV)+ {+ fuelStatus = "--";+ fuelStatusColor = TFT_DARKGREY;+ }+ else if (fuelPercentValue > 50.0f){fuelStatus = "HI";fuelStatusColor = TFT_CYAN;@@ -135,7 +140,7 @@tcsOn,TFT_RED,forceUpdate);- drawCell(COL[2], ROW[4], state.brakeBias, "brakeBias", "FUEL", "center", TFT_MAGENTA, 4, forceUpdate);+ drawCell(COL[2], ROW[4], state.fuelDisplayValue, "brakeBias", state.fuelLabel, "center", TFT_MAGENTA, 4, forceUpdate);// 剩餘圈數、位置、圈數、低油量警示drawCell(COL[3], ROW[3], state.tyrePressureFrontLeft, "tyrePressureFrontLeft", "REM", "center", TFT_CYAN, 4, forceUpdate);diff --git a/src/dashboard/themes/GT3Theme.inc b/src/dashboard/themes/GT3Theme.incindex b38f60a..9883ff1 100644--- a/src/dashboard/themes/GT3Theme.inc+++ b/src/dashboard/themes/GT3Theme.inc@@ -43,7 +43,7 @@DashboardLayout::LAP_LABEL_Y[i], DashboardLayout::SIDE_WIDTH, 18,&fonts::FreeSans9pt7b, labelColor, ML_DATUM, 0.72f, 0.74f);- const char *bottomLabels[] = {"FUEL", "LEFT", "LAP", "POS", "ABS", "TCS"};+ const char *bottomLabels[] = {state.fuelLabel.c_str(), "LEFT", "LAP", "POS", "ABS", "TCS"};for (int i = 0; i < 6; ++i){if (i > 0) tft.drawFastVLine(DashboardLayout::BOTTOM_X[i],@@ -106,7 +106,9 @@String lapCounterDisplay = state.tyrePressureRearLeft;lapCounterDisplay.replace("/", " / ");drawFuelIndicator(DashboardLayout::BOTTOM_X[0] + 4, DashboardLayout::BOTTOM_VALUE_Y,- DashboardLayout::BOTTOM_W[0] - 8, DashboardLayout::BOTTOM_VALUE_H, state.brakeBias, forceUpdate);+ DashboardLayout::BOTTOM_W[0] - 8, DashboardLayout::BOTTOM_VALUE_H,+ state.fuelDisplayValue, state.fuelProgressPercent,+ state.fuelValueValid, state.fuelIsEV, forceUpdate);drawDashboardValue(DashboardLayout::BOTTOM_X[1] + 2, DashboardLayout::BOTTOM_VALUE_Y,DashboardLayout::BOTTOM_W[1] - 4, DashboardLayout::BOTTOM_VALUE_H,state.tyrePressureFrontLeft, "gt3Left", leftColor, &fonts::FreeSans12pt7b,@@ -389,17 +391,19 @@}void drawFuelIndicator(int32_t x, int32_t y, int32_t width, int32_t height,- const String &value, bool forceUpdate)+ const String &value, int progressPercent, bool valueValid, bool isEV,+ bool forceUpdate){const String id = "gt3Fuel";uint16_t color = TFT_WHITE;- if (value != "--")+ if (valueValid && !isEV){- const float fuelPercent = value.toFloat();+ const float fuelPercent = progressPercent;if (fuelPercent <= 9.0f) color = TFT_RED;else if (fuelPercent <= 24.0f) color = TFT_YELLOW;}- const String state = value + ":" + String(color);+ const String state = value + ":" + String(progressPercent) + ":" ++ String(valueValid ? 1 : 0) + ":" + String(isEV ? 1 : 0) + ":" + String(color);if (!forceUpdate && prevData[id] == state) return;tft.fillRect(x, y, width, height, TFT_BLACK);diff --git a/src/dashboard/themes/MonoTheme.inc b/src/dashboard/themes/MonoTheme.incindex ef2f5cc..ce24473 100644--- a/src/dashboard/themes/MonoTheme.inc+++ b/src/dashboard/themes/MonoTheme.inc@@ -312,11 +312,10 @@prevData[id] = cacheState;}- void drawMonoFuelGauge(const String &fuelValue, bool forceUpdate)+ void drawMonoFuelGauge(int fuelProgressPercent, bool fuelValueValid, 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 percent = fuelValueValid ? constrain(fuelProgressPercent, 0, 100) : 100;const int active = constrain((percent * SEGMENTS + 99) / 100, 0, SEGMENTS);const String cacheState = String(active);if (!forceUpdate && prevData["monoFuelGauge"] == cacheState) return;@@ -340,6 +339,11 @@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);+ static constexpr int32_t fuelLabelX = 220;+ static constexpr int32_t remLabelX = 274;+ const int32_t fuelValueX = fuelLabelX ++ static_cast<int32_t>(state.fuelLabel.length()) * 6 + 2;+ const int32_t remValueX = remLabelX + 3 * 6 + 2;if (forceUpdate){@@ -373,8 +377,8 @@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.drawString(state.fuelLabel, fuelLabelX, 203, 1);+ tft.drawString("REM", remLabelX, 203, 1);tft.setTextDatum(TL_DATUM);}@@ -406,10 +410,10 @@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,+ drawMonoFuelGauge(state.fuelProgressPercent, state.fuelValueValid, forceUpdate);+ drawMonoValue(fuelValueX, 196, 23, 15, state.fuelDisplayValue,"monoFuelValue", white, 1, ML_DATUM, forceUpdate);- drawMonoValue(291, 196, 27, 15, state.tyrePressureFrontLeft,+ drawMonoValue(remValueX, 196, 24, 15, state.tyrePressureFrontLeft,"monoRem", white, 1, ML_DATUM, forceUpdate);drawMonoStatusDot(35, 203, isActiveValue(state.absActive),"monoAbs", white, forceUpdate);diff --git a/src/dashboard/themes/PocketTheme.inc b/src/dashboard/themes/PocketTheme.incindex 7ed59c8..b780dc3 100644--- a/src/dashboard/themes/PocketTheme.inc+++ b/src/dashboard/themes/PocketTheme.inc@@ -205,8 +205,11 @@{const bool absOn = isActiveValue(state.absActive);const bool tcsOn = isActiveValue(state.tcActive);+ const String fuelRenderState = state.fuelDisplayValue + ":" ++ String(state.fuelProgressPercent) + ":" + state.fuelLabel + ":" ++ String(state.fuelValueValid ? 1 : 0);const bool fuelChanged = forceUpdate ||- prevData["pocketFuel"] != state.brakeBias;+ prevData["pocketFuel"] != fuelRenderState;const bool absChanged = forceUpdate ||prevData["pocketAbs"] != state.absActive;const bool tcsChanged = forceUpdate ||@@ -218,7 +221,7 @@const uint16_t light = tft.color565(132, 146, 80);tft.setTextColor(darkest, pale);tft.setTextDatum(MC_DATUM);- const bool validFuel = state.brakeBias != "--" && state.brakeBias.length();+ const bool validFuel = state.fuelValueValid;if (fuelChanged){if (forceUpdate)@@ -226,17 +229,19 @@elsetft.fillRect(176, 165, 44, 18, pale);tft.setTextSize(1.0f);- tft.drawString(validFuel ? state.brakeBias + "%" : "--", 198, 174, 2);+ String displayedFuel = state.fuelDisplayValue;+ if (validFuel && !state.fuelIsEV) displayedFuel += "%";+ tft.drawString(validFuel ? displayedFuel : "--", 198, 174, 2);// The pump doubles as a coarse pixel fuel gauge. Its color boundary// always advances by complete horizontal rows: dark fuel below,// lighter empty space above. Missing telemetry is treated as full.const int fuelPercent = validFuel- ? constrain(state.brakeBias.toInt(), 0, 100)+ ? constrain(state.fuelProgressPercent, 0, 100): 100;drawDashboardFuelPumpIcon(191, 184, fuelPercent,darkest, light, pale);if (forceUpdate)- tft.drawString("FUEL", 198, 220, 1);+ tft.drawString(state.fuelLabel, 198, 220, 1);}// Match the RPM bar: inactive is pale, active is the solid dark tone.@@ -277,7 +282,7 @@tft.setTextDatum(TL_DATUM);// Dynamic clearing must never leave the outer folded corners incomplete.drawPocketPixelFrame(10, 162, 300, 69, dark);- prevData["pocketFuel"] = state.brakeBias;+ prevData["pocketFuel"] = fuelRenderState;prevData["pocketAbs"] = state.absActive;prevData["pocketTcs"] = state.tcActive;}diff --git a/src/dashboard/themes/RadarTheme.inc b/src/dashboard/themes/RadarTheme.incindex 5a32a1b..91a1b61 100644--- a/src/dashboard/themes/RadarTheme.inc+++ b/src/dashboard/themes/RadarTheme.inc@@ -332,7 +332,7 @@const uint16_t blue = tft.color565(30, 155, 255);const uint16_t red = tft.color565(255, 70, 52);const String layoutState = String(state.rpmRedLineSetting) + ":" +- String(state.rpmAlertRangeValid ? 1 : 0);+ String(state.rpmAlertRangeValid ? 1 : 0) + ":" + state.fuelLabel;const bool redraw = forceUpdate || prevData["radarLayoutState"] != layoutState;if (redraw)@@ -375,7 +375,7 @@tft.drawString("POS", 8, 69, 1);tft.drawString("BEST", 8, 113, 1);tft.drawString("LAST", 8, 157, 1);- tft.drawString("FUEL", 260, 25, 1);+ tft.drawString(state.fuelLabel, 260, 25, 1);tft.drawString("REM", 260, 69, 1);tft.drawString("CURRENT", 258, 113, 1);tft.drawString("PEDALS", 258, 155, 1);@@ -396,7 +396,7 @@"radarBest", TFT_WHITE, 1, ML_DATUM, redraw);drawRadarValue(7, 168, 56, 24, state.lastLapTime,"radarLast", TFT_WHITE, 1, ML_DATUM, redraw);- drawRadarValue(257, 36, 57, 24, state.brakeBias,+ drawRadarValue(257, 36, 57, 24, state.fuelDisplayValue,"radarFuel", TFT_WHITE, 2, MR_DATUM, redraw, 1.0f, 1.0f);drawRadarValue(257, 80, 57, 24, state.tyrePressureFrontLeft,"radarRem", TFT_WHITE, 2, MR_DATUM, redraw, 1.0f, 1.0f);diff --git a/src/dashboard/themes/RetroTheme.inc b/src/dashboard/themes/RetroTheme.incindex 293ec6c..94c0373 100644--- a/src/dashboard/themes/RetroTheme.inc+++ b/src/dashboard/themes/RetroTheme.inc@@ -264,7 +264,7 @@tft.drawString("BEST", 192, 57, 1);tft.drawString("LAST", 192, 92, 1);tft.drawString("CURRENT", 192, 124, 1);- tft.drawString("FUEL", 8, 166, 1);+ tft.drawString(state.fuelLabel, 8, 166, 1);tft.drawString("REM", 86, 166, 1);tft.drawString("LAP", 163, 166, 1);tft.drawString("POS", 243, 166, 1);@@ -297,7 +297,7 @@drawRetroTextValue(190, 148, 124, 8, state.sessionBestLiveDeltaSeconds,"retroDelta", deltaColor, 1, MR_DATUM, forceUpdate);- drawRetroTextValue(7, 177, 68, 18, state.brakeBias, "retroFuel", ink,+ drawRetroTextValue(7, 177, 68, 18, state.fuelDisplayValue, "retroFuel", ink,2, MC_DATUM, forceUpdate);drawRetroTextValue(85, 177, 67, 18, state.tyrePressureFrontLeft, "retroRem", ink,2, MC_DATUM, forceUpdate);