Skip to content
C

Add Radar dashboard theme

YU CHIH CHANGb05263b5819c
diff --git a/README.md b/README.md
index 27d305f..2dec8cf 100644
--- a/README.md
+++ b/README.md
@@ -73,11 +73,12 @@ Currently supported:
## Dashboard Themes
-One firmware includes three dashboard themes with the same live GT7 telemetry features:
+One firmware includes four 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.
While the display is active, tap it once, choose **SELECT THEME**, then select a theme. The selection is saved by enum value and restored after reboot. Resetting Wi-Fi does not reset the selected theme or brightness.
@@ -154,13 +155,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, or Retro dashboard theme.
+- Select and save the Classic, GT3, Retro, or Radar 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 and Retro expose the same supported telemetry; only their presentation differs.
+GT3 is used when no theme has been saved. Classic, GT3, Retro and Radar 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.md
index ded7ac4..1036977 100644
--- a/README.zh-TW.md
+++ b/README.zh-TW.md
@@ -74,11 +74,12 @@
## 儀表主題
-同一份韌體內建三種儀表主題,並提供相同的即時 GT7 遙測功能:
+同一份韌體內建四種儀表主題,並提供相同的即時 GT7 遙測功能:
- **GT3**(預設)— 置中檔位、弧形換檔燈與深色賽車風格版面。
- **Classic** — 原本偏工程風格的五欄儀表板。
- **Retro** — 暖色紙張底、深色文字與低調提示色的復古儀表板。
+- **Radar** — 以圓形轉速環為核心、兩側配置遙測資訊的深色儀表板。
螢幕亮起時點一下,選擇 **SELECT THEME**,再選取需要的主題。主題會以固定 enum 值儲存並在重新開機後恢復;重設 Wi-Fi 不會清除主題或亮度設定。
@@ -150,13 +151,13 @@ http://192.168.4.1
- 螢幕亮起時開啟設定選單。
- 螢幕休眠時只喚醒顯示,第一次點擊不會同時進入設定。
-- 選擇並儲存 Classic、GT3 或 Retro 儀表主題。
+- 選擇並儲存 Classic、GT3、Retro 或 Radar 儀表主題。
- 進入 **DEVICE SETTINGS**,以 10% 級距調整 20%~100% 的亮度。
- 從 Device Settings 透過獨立確認畫面重設已儲存的 Wi-Fi。
亮度預設為 80%,調整後會儲存,重新開機或喚醒時會恢復;自動休眠仍會完全關閉背光。
-沒有儲存過主題時會使用 GT3。Classic、GT3 與 Retro 顯示相同的支援遙測資料,只有呈現方式不同。
+沒有儲存過主題時會使用 GT3。Classic、GT3、Retro 與 Radar 顯示相同的支援遙測資料,只有呈現方式不同。
<p align="center">
<img src="photos/003.jpg" width="900" alt="ESP32 GT7 Dashboard">
diff --git a/docs/THEME_DEVELOPMENT.md b/docs/THEME_DEVELOPMENT.md
index d8181e1..4ebccc2 100644
--- a/docs/THEME_DEVELOPMENT.md
+++ b/docs/THEME_DEVELOPMENT.md
@@ -19,6 +19,7 @@ The included themes are:
| `Classic` | 0 | `drawPage1Legacy()` | Original five-column engineering UI |
| `GT3` | 1 | `drawPage1()` | Default dark motorsport UI |
| `Retro` | 2 | `drawRetroDashboard()` | Warm paper-and-ink instrument UI |
+| `Radar` | 3 | `drawRadarDashboard()` | Circular tachometer-focused dark UI |
Persisted values are part of the device settings format. Never reorder or reuse an existing enum value.
@@ -50,7 +51,7 @@ If a new telemetry field is genuinely required by every theme, add it to the sha
7. Document the theme in both root README files.
8. Build and test both `esp32` (ILI9341) and `esp32-st7789` targets.
-The current 320 x 240 Settings screen intentionally fits three large theme buttons plus Back. Three is not a firmware limit, but it is the recommended usability limit for the current menu. A fourth theme should introduce pagination or Previous/Next controls instead of smaller touch targets.
+The current 320 x 240 Theme Selection screen uses a 2 x 2 grid for four large theme buttons plus Back. Four is not a firmware limit, but it is the recommended usability limit for this menu. A fifth theme should introduce pagination or Previous/Next controls instead of shrinking the touch targets.
## Renderer rules
diff --git a/docs/THEME_SWITCH_PLAN.md b/docs/THEME_SWITCH_PLAN.md
index 284955b..938fad5 100644
--- a/docs/THEME_SWITCH_PLAN.md
+++ b/docs/THEME_SWITCH_PLAN.md
@@ -2,6 +2,19 @@
See also: [Theme Development Guide](THEME_DEVELOPMENT.md).
+## Radar Theme Extension
+
+The post-1.3.0 Radar extension adds a fourth presentation-only renderer while preserving the existing shared telemetry, persistence, touch, brightness, Wi-Fi and sleep layers.
+
+- [x] Append stable enum value `Radar = 3` without changing existing saved values.
+- [x] Add a 2 x 2 Theme Selection grid with full-size touch targets and a consistent Back button.
+- [x] Add a circular, segmented RPM renderer with vehicle-relative fill, alert marker and non-blocking shift pulse.
+- [x] Present the same supported lap, position, timing, fuel, tyre, pedal, delta, ABS, TCS, gear and speed data.
+- [x] Build both ILI9341 and ST7789 targets within existing memory limits.
+- [x] Flash the ST7789 development build to COM3 for physical review.
+- [ ] Complete live-GT7 typography, flicker and long-session acceptance on the physical display.
+- [ ] Choose a release number and publish installer binaries after acceptance.
+
## Project Status
This is a major UI architecture renovation. Work proceeds one phase at a time, and every phase must pass its physical-device acceptance gate before the next phase begins.
diff --git a/src/SHCustomProtocol.h b/src/SHCustomProtocol.h
index 2d7b3b1..a80bac6 100644
--- a/src/SHCustomProtocol.h
+++ b/src/SHCustomProtocol.h
@@ -131,10 +131,11 @@ enum class DashboardTheme : uint8_t
Classic = 0,
GT3 = 1,
Retro = 2,
+ Radar = 3,
};
// Phase 1 renderer preview hook. Normal firmware loads the persisted theme;
-// development builds can set 0, 1 or 2 without modifying source or storage.
+// development builds can set 0 through 3 without modifying source or storage.
#ifndef GT7_DASHBOARD_THEME_PREVIEW
#define GT7_DASHBOARD_THEME_PREVIEW -1
#endif
@@ -305,7 +306,7 @@ private:
static bool isValidDashboardTheme(uint8_t value)
{
- return value <= static_cast<uint8_t>(DashboardTheme::Retro);
+ return value <= static_cast<uint8_t>(DashboardTheme::Radar);
}
static const char *dashboardThemeName(DashboardTheme theme)
@@ -316,6 +317,8 @@ private:
return "CLASSIC";
case DashboardTheme::Retro:
return "RETRO";
+ case DashboardTheme::Radar:
+ return "RADAR";
case DashboardTheme::GT3:
default:
return "GT3";
@@ -382,7 +385,7 @@ private:
? static_cast<DashboardTheme>(storedTheme)
: DashboardTheme::GT3;
-#if GT7_DASHBOARD_THEME_PREVIEW >= 0 && GT7_DASHBOARD_THEME_PREVIEW <= 2
+#if GT7_DASHBOARD_THEME_PREVIEW >= 0 && GT7_DASHBOARD_THEME_PREVIEW <= 3
activeDashboardTheme =
static_cast<DashboardTheme>(GT7_DASHBOARD_THEME_PREVIEW);
#endif
@@ -1061,6 +1064,9 @@ public:
case DashboardTheme::Retro:
drawRetroDashboard(state, forceUpdate);
break;
+ case DashboardTheme::Radar:
+ drawRadarDashboard(state, forceUpdate);
+ break;
case DashboardTheme::GT3:
default:
#if GT7_DASHBOARD_LEGACY_UI
@@ -1392,6 +1398,353 @@ public:
isActiveValue(state.tcActive) ? red : faint, 1, MC_DATUM, forceUpdate);
}
+ void drawRadarValue(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 - 1
+ : (datum == MC_DATUM ? x + width / 2 : x + 1);
+ tft.drawString(value, textX, y + height / 2, font);
+ tft.setTextSize(1.0f);
+ tft.setTextDatum(TL_DATUM);
+ prevData[id] = cacheState;
+ }
+
+ void drawRadarValueBuffered(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)
+ {
+ drawRadarValue(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 - 1
+ : (datum == MC_DATUM ? width / 2 : 1);
+ sprite.drawString(value, textX, height / 2, font);
+ sprite.setTextSize(1.0f);
+ sprite.pushSprite(x, y);
+ prevData[id] = cacheState;
+ }
+
+ void drawRadarPedals(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["radarPedals"] == cacheState) return;
+
+ static LGFX_Sprite pedalSprite(&tft);
+ static bool spriteCreated = false;
+ if (!spriteCreated)
+ {
+ pedalSprite.setColorDepth(16);
+ spriteCreated = pedalSprite.createSprite(58, 30) != nullptr;
+ }
+ if (!spriteCreated) return;
+ const uint16_t frame = tft.color565(70, 74, 78);
+ const uint16_t input = tft.color565(112, 116, 120);
+ const uint16_t applied = tft.color565(190, 195, 200);
+ pedalSprite.fillSprite(TFT_BLACK);
+ pedalSprite.setTextColor(TFT_LIGHTGREY, TFT_BLACK);
+ pedalSprite.setTextDatum(TL_DATUM);
+ pedalSprite.drawString("B", 0, 2, 1);
+ pedalSprite.drawString("T", 0, 17, 1);
+ const int values[2][2] = {
+ {brakeInput, brakeApplied}, {throttleInput, throttleApplied}};
+ for (int row = 0; row < 2; ++row)
+ {
+ const int y = 3 + row * 15;
+ pedalSprite.drawRect(10, y, 47, 8, frame);
+ const int inputWidth = 45 * values[row][0] / 100;
+ const int appliedWidth = 45 * values[row][1] / 100;
+ if (inputWidth > 0)
+ pedalSprite.fillRect(11, y + 1, inputWidth, 6, input);
+ if (appliedWidth > 0)
+ pedalSprite.fillRect(11, y + 1, appliedWidth, 6, applied);
+ }
+ pedalSprite.pushSprite(256, 168);
+ prevData["radarPedals"] = cacheState;
+ }
+
+ void drawRadarRpm(const DashboardState &state, bool forceUpdate)
+ {
+ static constexpr int CENTER_X = 160;
+ static constexpr int CENTER_Y = 108;
+ static constexpr int INNER_RADIUS = 87;
+ static constexpr int OUTER_RADIUS = 101;
+ static constexpr int SEGMENT_COUNT = 36;
+ static constexpr float START_DEGREES = 140.0f;
+ static constexpr float SWEEP_DEGREES = 260.0f;
+ 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 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.30f;
+ 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.20f * progress;
+ }
+ if (state.revLimitAlertActive) peak = 0.62f;
+ 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 bool pulseEnded = !pulse && previousPulse;
+ if (!forceUpdate && active == previousActive && !pulseFrame && !pulseEnded)
+ return;
+
+ const float minAlertPosition = state.rpmAlertRangeValid
+ ? constrain(state.rpmRedLineSetting / 100.0f, 0.45f, 0.95f)
+ : 0.80f;
+ const float stops[] = {0.0f, minAlertPosition * 0.45f,
+ minAlertPosition * 0.72f, minAlertPosition, 1.0f};
+ const uint8_t colors[][3] = {
+ {72, 205, 55}, {130, 225, 45}, {250, 224, 35},
+ {255, 126, 22}, {255, 24, 28}};
+ const uint16_t inactive = tft.color565(34, 38, 40);
+
+ auto pointAt = [&](float degrees, int radius, int &px, int &py)
+ {
+ const float radians = degrees * DEG_TO_RAD;
+ px = CENTER_X + lroundf(cosf(radians) * radius);
+ py = CENTER_Y + lroundf(sinf(radians) * radius);
+ };
+
+ 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;
+
+ uint16_t color = inactive;
+ if (i < active)
+ {
+ const float position = i / static_cast<float>(SEGMENT_COUNT - 1);
+ int stop = 0;
+ while (stop < 3 && position > stops[stop + 1]) ++stop;
+ const float span = max(0.001f, stops[stop + 1] - stops[stop]);
+ const float blend = constrain(
+ (position - stops[stop]) / span, 0.0f, 1.0f);
+ int red = lroundf(colors[stop][0] +
+ (colors[stop + 1][0] - colors[stop][0]) * blend);
+ int green = lroundf(colors[stop][1] +
+ (colors[stop + 1][1] - colors[stop][1]) * blend);
+ int blue = lroundf(colors[stop][2] +
+ (colors[stop + 1][2] - colors[stop][2]) * blend);
+ if (pulse)
+ {
+ red += (255 - red) * whiteMix / 255;
+ green += (255 - green) * whiteMix / 255;
+ blue += (255 - blue) * whiteMix / 255;
+ }
+ color = tft.color565(red, green, blue);
+ }
+
+ const float centerAngle = START_DEGREES +
+ SWEEP_DEGREES * i / (SEGMENT_COUNT - 1);
+ const float halfAngle = SWEEP_DEGREES /
+ (SEGMENT_COUNT - 1) * 0.36f;
+ int x1, y1, x2, y2, x3, y3, x4, y4;
+ pointAt(centerAngle - halfAngle, INNER_RADIUS, x1, y1);
+ pointAt(centerAngle - halfAngle, OUTER_RADIUS, x2, y2);
+ pointAt(centerAngle + halfAngle, INNER_RADIUS, x3, y3);
+ pointAt(centerAngle + halfAngle, OUTER_RADIUS, x4, y4);
+ tft.fillTriangle(x1, y1, x2, y2, x3, y3, color);
+ tft.fillTriangle(x2, y2, x4, y4, x3, y3, color);
+ }
+
+ if (state.rpmAlertRangeValid)
+ {
+ const float markerAngle = START_DEGREES +
+ SWEEP_DEGREES * constrain(
+ state.rpmRedLineSetting / 100.0f, 0.0f, 1.0f);
+ int x1, y1, x2, y2;
+ pointAt(markerAngle, INNER_RADIUS - 5, x1, y1);
+ pointAt(markerAngle, OUTER_RADIUS + 3, x2, y2);
+ tft.drawLine(x1, y1, x2, y2, tft.color565(255, 80, 42));
+ }
+
+ previousActive = active;
+ previousPulse = pulse;
+ previousMix = pulse ? whiteMix : 0;
+ }
+
+ void drawRadarDashboard(const DashboardState &state, bool forceUpdate)
+ {
+ static LGFX_Sprite speedSprite(&tft);
+ static LGFX_Sprite currentSprite(&tft);
+ static LGFX_Sprite tyreSprite(&tft);
+ static bool speedSpriteCreated = false;
+ static bool currentSpriteCreated = false;
+ static bool tyreSpriteCreated = false;
+ const uint16_t frame = tft.color565(55, 59, 62);
+ const uint16_t muted = tft.color565(150, 154, 158);
+ const uint16_t green = tft.color565(92, 220, 56);
+ const uint16_t yellow = tft.color565(255, 218, 24);
+ 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);
+ const bool redraw = forceUpdate || prevData["radarLayoutState"] != layoutState;
+
+ if (redraw)
+ {
+ tft.fillScreen(TFT_BLACK);
+ tft.setTextPadding(0);
+ tft.setTextDatum(TL_DATUM);
+ tft.setTextSize(1.0f);
+
+ tft.drawRoundRect(2, 20, 69, 179, 4, frame);
+ tft.drawRoundRect(249, 20, 69, 179, 4, frame);
+ for (int y : {64, 108, 152})
+ {
+ tft.drawFastHLine(3, y, 67, frame);
+ tft.drawFastHLine(250, y, 67, frame);
+ }
+ tft.drawRoundRect(2, 203, 316, 35, 4, frame);
+ tft.drawFastVLine(108, 204, 33, frame);
+ tft.drawFastVLine(211, 204, 33, frame);
+
+ tft.fillCircle(160, 108, 106, TFT_BLACK);
+ tft.drawCircle(160, 108, 105, tft.color565(62, 65, 68));
+ tft.drawCircle(160, 108, 103, tft.color565(35, 38, 40));
+ for (int i = 0; i <= 12; ++i)
+ {
+ const float angle = (140.0f + 260.0f * i / 12.0f) * DEG_TO_RAD;
+ const int inner = i % 3 == 0 ? 76 : 79;
+ const int x1 = 160 + lroundf(cosf(angle) * inner);
+ const int y1 = 108 + lroundf(sinf(angle) * inner);
+ const int x2 = 160 + lroundf(cosf(angle) * 84);
+ const int y2 = 108 + lroundf(sinf(angle) * 84);
+ tft.drawLine(x1, y1, x2, y2,
+ i % 3 == 0 ? TFT_WHITE : tft.color565(85, 88, 92));
+ }
+
+ tft.setTextColor(muted, TFT_BLACK);
+ tft.drawString("LAP", 8, 25, 1);
+ tft.drawString("POS", 8, 69, 1);
+ tft.drawString("BEST", 8, 113, 1);
+ tft.drawString("LAST", 8, 157, 1);
+ tft.drawString("FUEL", 267, 25, 1);
+ tft.drawString("REM", 267, 69, 1);
+ tft.drawString("CURRENT", 255, 113, 1);
+ tft.drawString("TYRES", 267, 157, 1);
+ tft.drawCentreString("GEAR", 160, 48, 1);
+ tft.drawCentreString("km/h", 160, 163, 1);
+ tft.drawCentreString("RPM", 160, 184, 1);
+ tft.drawString("DELTA", 8, 208, 1);
+ tft.drawString("ABS", 116, 208, 1);
+ tft.drawString("TCS", 219, 208, 1);
+ }
+
+ drawRadarRpm(state, redraw);
+ drawRadarValue(7, 36, 59, 24, state.tyrePressureRearLeft,
+ "radarLap", TFT_WHITE, 2, ML_DATUM, redraw, 0.78f, 0.9f);
+ drawRadarValue(7, 80, 59, 24, state.tyrePressureFrontRight,
+ "radarPos", TFT_WHITE, 2, ML_DATUM, redraw, 0.9f, 0.95f);
+ drawRadarValue(7, 124, 59, 24, state.bestLapTime,
+ "radarBest", TFT_WHITE, 1, ML_DATUM, redraw);
+ drawRadarValue(7, 168, 59, 24, state.lastLapTime,
+ "radarLast", TFT_WHITE, 1, ML_DATUM, redraw);
+ drawRadarValue(254, 36, 59, 24, state.brakeBias,
+ "radarFuel", TFT_WHITE, 2, MR_DATUM, redraw, 0.85f, 0.95f);
+ drawRadarValue(254, 80, 59, 24, state.tyrePressureFrontLeft,
+ "radarRem", TFT_WHITE, 2, MR_DATUM, redraw, 0.85f, 0.95f);
+ drawRadarValueBuffered(253, 124, 62, 22, state.currentLapTime,
+ "radarCurrent", state.lapInvalidated == "True" ? red : TFT_WHITE,
+ 1, MR_DATUM, redraw, currentSprite, currentSpriteCreated);
+
+ String tyres;
+ for (int i = 0; i < 4; ++i)
+ {
+ if (i > 0) tyres += " ";
+ tyres += isnan(state.tyreTemperatures[i])
+ ? "--" : String(lroundf(state.tyreTemperatures[i]));
+ }
+ drawRadarValueBuffered(253, 140, 62, 15, tyres, "radarTyres",
+ TFT_WHITE, 1, MC_DATUM, redraw, tyreSprite, tyreSpriteCreated,
+ 0.72f, 0.85f);
+ drawRadarPedals(state, redraw);
+
+ uint16_t deltaColor = TFT_WHITE;
+ if (state.sessionBestLiveDeltaSeconds.startsWith("-")) deltaColor = green;
+ else if (state.sessionBestLiveDeltaSeconds.startsWith("+") &&
+ state.sessionBestLiveDeltaSeconds != "+0.000") deltaColor = red;
+ drawRadarValue(7, 218, 96, 17, state.sessionBestLiveDeltaSeconds,
+ "radarDelta", deltaColor, 2, MR_DATUM, redraw, 0.82f, 0.92f);
+ drawRadarValue(116, 218, 87, 17,
+ isActiveValue(state.absActive) ? "ON" : "--", "radarAbs",
+ isActiveValue(state.absActive) ? yellow : muted,
+ 2, MC_DATUM, redraw, 0.85f, 0.92f);
+ drawRadarValue(219, 218, 91, 17,
+ isActiveValue(state.tcActive) ? "ON" : "--", "radarTcs",
+ isActiveValue(state.tcActive) ? blue : muted,
+ 2, MC_DATUM, redraw, 0.85f, 0.92f);
+
+ drawRadarValue(116, 58, 88, 59, state.gear, "radarGear",
+ TFT_WHITE, 7, MC_DATUM, redraw, 0.95f, 1.0f);
+ drawRadarValueBuffered(100, 119, 120, 42, state.speed, "radarSpeed",
+ TFT_WHITE, 7, MC_DATUM, redraw, speedSprite, speedSpriteCreated,
+ 0.76f, 0.82f);
+ const int displayedRpm = ((state.engineRpm + 25) / 50) * 50;
+ drawRadarValue(127, 190, 66, 12, String(displayedRpm), "radarRpm",
+ state.revLimitAlertActive ? red : tft.color565(255, 118, 25),
+ 1, MC_DATUM, redraw);
+ prevData["radarLayoutState"] = layoutState;
+ }
+
void drawThemePlaceholder(
const DashboardState &state,
DashboardTheme theme,
@@ -3464,16 +3817,18 @@ public:
const DashboardTheme themes[] = {
DashboardTheme::Classic,
DashboardTheme::GT3,
- DashboardTheme::Retro};
- for (int i = 0; i < 3; ++i)
+ DashboardTheme::Retro,
+ DashboardTheme::Radar};
+ for (int i = 0; i < 4; ++i)
{
const bool active = activeDashboardTheme == themes[i];
- String label = dashboardThemeName(themes[i]);
- if (active) label += " [ACTIVE]";
- drawSettingsButton(30, 42 + i * 46, 260, 38, label,
+ const int buttonX = i % 2 == 0 ? 20 : 165;
+ const int buttonY = i < 2 ? 50 : 112;
+ drawSettingsButton(buttonX, buttonY, 135, 50,
+ dashboardThemeName(themes[i]),
pressedButton == i, active);
}
- drawSettingsButton(30, 180, 260, 38, "BACK", pressedButton == 3);
+ drawSettingsButton(30, 180, 260, 38, "BACK", pressedButton == 4);
}
else if (settingsScreen == SettingsScreen::DeviceSettings)
{
@@ -3515,19 +3870,21 @@ public:
}
else if (settingsScreen == SettingsScreen::ThemeSelection)
{
- if (button >= 0 && button <= 2)
+ if (button >= 0 && button <= 3)
{
const DashboardTheme themes[] = {
DashboardTheme::Classic,
DashboardTheme::GT3,
- DashboardTheme::Retro};
+ DashboardTheme::Retro,
+ DashboardTheme::Radar};
const bool active = activeDashboardTheme == themes[button];
- String label = dashboardThemeName(themes[button]);
- if (active) label += " [ACTIVE]";
- drawSettingsButton(30, 42 + button * 46, 260, 38, label,
+ const int buttonX = button % 2 == 0 ? 20 : 165;
+ const int buttonY = button < 2 ? 50 : 112;
+ drawSettingsButton(buttonX, buttonY, 135, 50,
+ dashboardThemeName(themes[button]),
pressed, active);
}
- else if (button == 3)
+ else if (button == 4)
{
drawSettingsButton(30, 180, 260, 38, "BACK", pressed);
}
@@ -3657,11 +4014,13 @@ public:
}
else if (settingsScreen == SettingsScreen::ThemeSelection)
{
- for (int i = 0; i < 3; ++i)
+ for (int i = 0; i < 4; ++i)
{
- if (touchInside(30, 42 + i * 46, 260, 38)) return i;
+ const int buttonX = i % 2 == 0 ? 20 : 165;
+ const int buttonY = i < 2 ? 50 : 112;
+ if (touchInside(buttonX, buttonY, 135, 50)) return i;
}
- if (touchInside(30, 180, 260, 38)) return 3;
+ if (touchInside(30, 180, 260, 38)) return 4;
}
else if (settingsScreen == SettingsScreen::DeviceSettings)
{
@@ -3691,12 +4050,13 @@ public:
}
else if (settingsScreen == SettingsScreen::ThemeSelection)
{
- if (button >= 0 && button <= 2)
+ if (button >= 0 && button <= 3)
{
const DashboardTheme themes[] = {
DashboardTheme::Classic,
DashboardTheme::GT3,
- DashboardTheme::Retro};
+ DashboardTheme::Retro,
+ DashboardTheme::Radar};
const DashboardTheme selectedTheme = themes[button];
const bool changed = selectedTheme != activeDashboardTheme;
settingsScreen = SettingsScreen::Closed;
@@ -3705,7 +4065,7 @@ public:
selectDashboardTheme(selectedTheme, true);
if (!changed) redrawAfterWifiResetDialog();
}
- else if (button == 3)
+ else if (button == 4)
{
showSettingsScreen(SettingsScreen::Main);
}