Skip to content

Commit c207f1f

Browse files
committed
New OLED dashboards
1 parent 26e24e1 commit c207f1f

7 files changed

Lines changed: 142 additions & 5 deletions

File tree

doc/hardware/ui/MonochromeOLED/MonochromeOLED_en.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@ It will show the following information thanks to SimHub:
3434

3535
![OLED battery dashboard](./OLED_dash_battery.jpg)
3636

37+
- Tire/brake temperature:
38+
39+
![OLED temperature dashboard](./OLED_temperature_dash.jpg)
40+
41+
- Tire pressure and wear:
42+
43+
![OLED temperature dashboard](./OLED_pressure_dash.jpg)
44+
3745
Dashboard selection requires a *routed* input number.
3846

3947
> 🙏
45.6 KB
Loading
38.5 KB
Loading

doc/hardware/ui/TelemetryData_en.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ Follow the links for an in-depth explanation:
1515
- [Monochrome OLED 128x64 telemetry display](./MonochromeOLED/MonochromeOLED_en.md)
1616

1717
A monochrome OLED with 128x64 pixels showing RPM bar,
18-
gear, TC, ABS, brake bias, fuel and pit limiter alerts.
18+
gear, TC, ABS, brake bias, fuel and pit limiter alerts,
19+
tire and brake temperature, and tire wear.
1920

2021
Any telemetry display is potentially able to display notifications
2122
(such as connection or low battery),

src/common/SimWheelUI_gfx.cpp

Lines changed: 118 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,13 @@ void OledTelemetry128x64::init(
102102
_display.clear();
103103
requiresPowertrainTelemetry = true;
104104
requiresECUTelemetry = true;
105-
requiresGaugeTelemetry = (nextDash != UNSPECIFIED::VALUE);
105+
requiresGaugeTelemetry =
106+
(nextDash != UNSPECIFIED::VALUE) ||
107+
(initialDashboard == OledDashboard::ALTERNATE);
108+
requiresWheelTelemetry =
109+
(nextDash != UNSPECIFIED::VALUE) ||
110+
(initialDashboard == OledDashboard::TIRE_TEMP) ||
111+
(initialDashboard == OledDashboard::TIRE_PRESSURE);
106112
}
107113

108114
void OledTelemetry128x64::draw_battery_level()
@@ -362,6 +368,104 @@ void OledTelemetry128x64::draw_alt_dashboard(
362368
}
363369
} // void OledTelemetry128x64::draw_alt_dashboard()
364370

371+
void OledTelemetry128x64::draw_tire_temp_dashboard(
372+
const TelemetryData *pTelemetryData)
373+
{
374+
stopFlashing();
375+
if (pTelemetryData)
376+
{
377+
_impl->frame.fillScreen(0);
378+
// Draw frame
379+
_impl->frame.drawFastVLine(63, 0, 64, 0xFFFF);
380+
_impl->frame.drawFastHLine(0, 36, 128, 0xFFFF);
381+
_impl->frame.fillRect(0, 0, 128, 8, 0xFFFF);
382+
_impl->frame.setTextSize(1);
383+
_impl->frame.setTextColor(0);
384+
_impl->frame.setCursor(1, 0);
385+
_impl->frame.print("Temperature");
386+
_impl->frame.setTextColor(0xFFFF);
387+
388+
// Draw tire temps
389+
_impl->frame.setTextSize(2);
390+
_impl->frame.setCursor(0, 11);
391+
_impl->frame.printf("%3hu", pTelemetryData->wheels.tireTemp[0]);
392+
_impl->frame.setCursor(65, 11);
393+
_impl->frame.printf("%3hu", pTelemetryData->wheels.tireTemp[1]);
394+
_impl->frame.setCursor(0, 39);
395+
_impl->frame.printf("%3hu", pTelemetryData->wheels.tireTemp[2]);
396+
_impl->frame.setCursor(65, 39);
397+
_impl->frame.printf("%3hu", pTelemetryData->wheels.tireTemp[3]);
398+
399+
// Draw brake temps
400+
_impl->frame.setTextSize(1);
401+
_impl->frame.setCursor(32, 28);
402+
_impl->frame.printf("B:%hu", pTelemetryData->wheels.brakeTemp[0]);
403+
_impl->frame.setCursor(65 + 32, 28);
404+
_impl->frame.printf("B:%hu", pTelemetryData->wheels.brakeTemp[1]);
405+
_impl->frame.setCursor(32, 56);
406+
_impl->frame.printf("B:%hu", pTelemetryData->wheels.brakeTemp[2]);
407+
_impl->frame.setCursor(65 + 32, 56);
408+
_impl->frame.printf("B:%hu", pTelemetryData->wheels.brakeTemp[3]);
409+
}
410+
else if (_impl->connected) // && !pTelemetryData
411+
{
412+
_impl->frame.fillScreen(0);
413+
}
414+
} // void OledTelemetry128x64::draw_tire_temp_dashboard()
415+
416+
void OledTelemetry128x64::draw_tire_pressure_dashboard(
417+
const TelemetryData *pTelemetryData)
418+
{
419+
stopFlashing();
420+
if (pTelemetryData)
421+
{
422+
_impl->frame.fillScreen(0);
423+
// Draw frame
424+
_impl->frame.drawFastVLine(63, 0, 64, 0xFFFF);
425+
_impl->frame.drawFastHLine(0, 36, 128, 0xFFFF);
426+
_impl->frame.fillRect(0, 0, 128, 8, 0xFFFF);
427+
_impl->frame.setTextSize(1);
428+
_impl->frame.setTextColor(0);
429+
_impl->frame.setCursor(1, 0);
430+
_impl->frame.print("Pressure/wear");
431+
_impl->frame.setTextColor(0xFFFF);
432+
433+
// Draw tire pressure
434+
_impl->frame.setTextSize(2);
435+
_impl->frame.setCursor(0, 11);
436+
_impl->frame.printf("%-2.1f", pTelemetryData->wheels.tirePressure[0]);
437+
_impl->frame.setCursor(65, 11);
438+
_impl->frame.printf("%-2.1f", pTelemetryData->wheels.tirePressure[1]);
439+
_impl->frame.setCursor(0, 39);
440+
_impl->frame.printf("%-2.1f", pTelemetryData->wheels.tirePressure[2]);
441+
_impl->frame.setCursor(65, 39);
442+
_impl->frame.printf("%-2.1f", pTelemetryData->wheels.tirePressure[3]);
443+
444+
// Draw tire wear
445+
_impl->frame.setTextSize(1);
446+
_impl->frame.setCursor(40, 28);
447+
_impl->frame.printf(
448+
"%3hhu%%",
449+
pTelemetryData->wheels.wearPercentage[0]);
450+
_impl->frame.setCursor(65 + 39, 28);
451+
_impl->frame.printf(
452+
"%3hhu%%",
453+
pTelemetryData->wheels.wearPercentage[1]);
454+
_impl->frame.setCursor(32, 56);
455+
_impl->frame.printf(
456+
"%3hhu%%",
457+
pTelemetryData->wheels.wearPercentage[2]);
458+
_impl->frame.setCursor(65 + 39, 56);
459+
_impl->frame.printf(
460+
"%3hhu%%",
461+
pTelemetryData->wheels.wearPercentage[3]);
462+
}
463+
else if (_impl->connected) // && !pTelemetryData
464+
{
465+
_impl->frame.fillScreen(0);
466+
}
467+
} // void OledTelemetry128x64::draw_tire_pressure_dashboard()
468+
365469
void OledTelemetry128x64::stopFlashing()
366470
{
367471
if (_impl->flash)
@@ -438,9 +542,15 @@ void OledTelemetry128x64::onUserInput(uint8_t inputNumber)
438542
if (BatteryService::call().hasBattery())
439543
_impl->currentDash = OledDashboard::BATTERY;
440544
else
441-
_impl->currentDash = OledDashboard::STANDARD;
545+
_impl->currentDash = OledDashboard::TIRE_TEMP;
442546
break;
443547
case OledDashboard::BATTERY:
548+
_impl->currentDash = OledDashboard::TIRE_TEMP;
549+
break;
550+
case OledDashboard::TIRE_TEMP:
551+
_impl->currentDash = OledDashboard::TIRE_PRESSURE;
552+
break;
553+
case OledDashboard::TIRE_PRESSURE:
444554
_impl->currentDash = OledDashboard::STANDARD;
445555
break;
446556
default:
@@ -465,6 +575,12 @@ void OledTelemetry128x64::onTelemetryData(const TelemetryData *pTelemetryData)
465575
case OledDashboard::ALTERNATE:
466576
draw_alt_dashboard(pTelemetryData);
467577
break;
578+
case OledDashboard::TIRE_TEMP:
579+
draw_tire_temp_dashboard(pTelemetryData);
580+
break;
581+
case OledDashboard::TIRE_PRESSURE:
582+
draw_tire_pressure_dashboard(pTelemetryData);
583+
break;
468584
default:
469585
return;
470586
}

src/include/SimWheelTypes.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1613,7 +1613,7 @@ class AbstractUserInterface
16131613
/// @brief Set to true to receive and use telemetry data for gauges
16141614
bool requiresGaugeTelemetry = false;
16151615
/// @brief Set to true to receive and use wheel telemetry data
1616-
bool requiresWheelsTelemetry = false;
1616+
bool requiresWheelTelemetry = false;
16171617

16181618
// Non copyable
16191619

src/include/SimWheelUI.hpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,15 @@ enum class OledDashboard : uint8_t
133133
{
134134
/// @brief RPM bar, gear, TC, ABS, Low fuel, Pit limiter
135135
STANDARD = 0,
136-
/// @brief Dashboard not available yet
136+
/// @brief RPM, speed, gear, ABS, TC, brake balance, fuel, pit limiter
137137
ALTERNATE,
138138
/// @brief Current battery level
139139
/// (available only in battery-operated firmwares)
140140
BATTERY,
141+
/// @brief Tire/brake temperature dashboard
142+
TIRE_TEMP,
143+
/// @brief Tire pressure/wear dashboard
144+
TIRE_PRESSURE,
141145
/// @brief Default dashboard
142146
_DEFAULT = STANDARD
143147
};
@@ -176,6 +180,14 @@ class OledTelemetry128x64 : public AbstractUserInterface
176180
/// @param pTelemetryData Pointer to telemetry data (maybe null)
177181
void draw_alt_dashboard(const TelemetryData *pTelemetryData);
178182

183+
/// @brief Draw the tire/brake temperature dashboard
184+
/// @param pTelemetryData Pointer to telemetry data (maybe null)
185+
void draw_tire_temp_dashboard(const TelemetryData *pTelemetryData);
186+
187+
/// @brief Draw the tire pressure/wear dashboard
188+
/// @param pTelemetryData Pointer to telemetry data (maybe null)
189+
void draw_tire_pressure_dashboard(const TelemetryData *pTelemetryData);
190+
179191
/// @brief Stop flashing
180192
void stopFlashing();
181193

0 commit comments

Comments
 (0)