Skip to content

Commit 13ed2f9

Browse files
committed
V3.2.005
- Adds support for optional leading 0 on the speedo. Defaults to off.
1 parent 9012e82 commit 13ed2f9

File tree

7 files changed

+22
-4
lines changed

7 files changed

+22
-4
lines changed

Software/src/speeddisplay.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ void speedDisplay::setSpeed(int8_t speedNum)
616616
}
617617
#endif
618618

619-
_displayBuffer[_speed_pos10] |= (b1 << _dig10_shift);
619+
if(dispL0Spd || speedNum > 9 /*|| b1 == 37*/) _displayBuffer[_speed_pos10] |= (b1 << _dig10_shift);
620620
_displayBuffer[_speed_pos01] |= (b2 << _dig01_shift);
621621

622622
if(_dot01) _displayBuffer[_dot_pos01] |= (*(_fontXSeg + 36) << _dot01_shift);

Software/src/speeddisplay.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,8 @@ class speedDisplay {
134134
bool getDot();
135135
bool getColon();
136136

137+
bool dispL0Spd = true;
138+
137139
private:
138140

139141
void handleColon();

Software/src/tc_global.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@
2525

2626
// These must not contain any characters other than
2727
// '0'-'9', 'A'-'Z', '(', ')', '.', '_', '-' or space
28-
#define TC_VERSION "V3.2.004" // 13 chars max
28+
#define TC_VERSION "V3.2.005" // 13 chars max
2929
#ifndef IS_ACAR_DISPLAY
30-
#define TC_VERSION_EXTRA "JAN172025" // 13 chars max
30+
#define TC_VERSION_EXTRA "AUG302025" // 13 chars max
3131
#else // A-Car
32-
#define TC_VERSION_EXTRA "01172025" // 12 chars max
32+
#define TC_VERSION_EXTRA "08302025" // 12 chars max
3333
#endif
3434

3535
//#define TC_DBG // debug output on Serial

Software/src/tc_settings.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,7 @@ static bool read_settings(File configFile)
542542
wd |= CopyCheckValidNumParm(json["speedoBright"], settings.speedoBright, sizeof(settings.speedoBright), 0, 15, DEF_BRIGHT_SPEEDO);
543543
wd |= CopyCheckValidNumParm(json["speedoAF"], settings.speedoAF, sizeof(settings.speedoAF), 0, 1, DEF_SPEEDO_ACCELFIG);
544544
wd |= CopyCheckValidNumParmF(json["speedoFact"], settings.speedoFact, sizeof(settings.speedoFact), 0.5, 5.0, DEF_SPEEDO_FACT);
545+
wd |= CopyCheckValidNumParm(json["speedoL0Spd"], settings.speedoL0Spd, sizeof(settings.speedoL0Spd), 0, 1, DEF_SPEEDO_L0SPD);
545546
#ifdef TC_HAVEGPS
546547
wd |= CopyCheckValidNumParm(json["useGPSSpeed"], settings.useGPSSpeed, sizeof(settings.useGPSSpeed), 0, 1, DEF_USE_GPS_SPEED);
547548
wd |= CopyCheckValidNumParm(json["spdUpdRate"], settings.spdUpdRate, sizeof(settings.spdUpdRate), 0, 3, DEF_SPD_UPD_RATE);
@@ -662,6 +663,7 @@ void write_settings()
662663
json["speedoBright"] = (const char *)settings.speedoBright;
663664
json["speedoAF"] = (const char *)settings.speedoAF;
664665
json["speedoFact"] = (const char *)settings.speedoFact;
666+
json["speedoL0Spd"] = (const char *)settings.speedoL0Spd;
665667
#ifdef TC_HAVEGPS
666668
json["useGPSSpeed"] = (const char *)settings.useGPSSpeed;
667669
json["spdUpdRate"] = (const char *)settings.spdUpdRate;

Software/src/tc_settings.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ extern uint8_t musFolderNum;
9393
#define DEF_SPEEDO_TYPE 99 // Default display type: None
9494
#define DEF_SPEEDO_ACCELFIG 0 // Accel figures: 0: Movie (approximated), 1: Real-life
9595
#define DEF_SPEEDO_FACT 2.0 // Real-life acceleration factor (1.0 actual DeLorean figures; >1.0 faster, <1.0 slower)
96+
#define DEF_SPEEDO_L0SPD 0 // Speedo: Display leading 0 for speeds < 10 (1: yes, 0: no)
9697
#define DEF_BRIGHT_SPEEDO 15 // Default: Max. brightness for speed
9798
#define DEF_USE_GPS_SPEED 0 // 0: Do not show GPS speed on speedo display; 1: Do
9899
#define DEF_SPD_UPD_RATE 1 // 0: 1Hz, 1: 2Hz (default), 2: 4Hz, 3: 5Hz
@@ -162,6 +163,7 @@ struct Settings {
162163
char speedoBright[4] = MS(DEF_BRIGHT_SPEEDO);
163164
char speedoAF[4] = MS(DEF_SPEEDO_ACCELFIG);
164165
char speedoFact[6] = MS(DEF_SPEEDO_FACT);
166+
char speedoL0Spd[6] = MS(DEF_SPEEDO_L0SPD);
165167
#ifdef TC_HAVEGPS
166168
char useGPSSpeed[4] = MS(DEF_USE_GPS_SPEED);
167169
char spdUpdRate[4] = MS(DEF_SPD_UPD_RATE);

Software/src/tc_time.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1612,6 +1612,8 @@ void time_setup()
16121612
speedo.setBrightness(atoi(settings.speedoBright), true);
16131613
speedo.setDot(true);
16141614

1615+
speedo.dispL0Spd = (atoi(settings.speedoL0Spd) > 0);
1616+
16151617
// No TT sounds to play -> no user-provided sound.
16161618
if(!playTTsounds) havePreTTSound = false;
16171619

Software/src/tc_wifi.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,11 @@ WiFiManagerParameter custom_sAF("sAF", "Acceleration times (0=real, 1=movie)", s
268268
WiFiManagerParameter custom_sAF("sAF", "Real-life acceleration figures", settings.speedoAF, 1, "autocomplete='off' title='If unchecked, movie-like times are used' type='checkbox' style='margin-top:12px'", WFM_LABEL_AFTER);
269269
#endif // -------------------------------------------------
270270
WiFiManagerParameter custom_speedoFact("speFac", "<br>Factor for real-life figures (0.5-5.0)", settings.speedoFact, 3, "type='number' min='0.5' max='5.0' step='0.5' title='1.0 means real-world DMC-12 acceleration time.' autocomplete='off'");
271+
#ifdef TC_NOCHECKBOXES // --- Standard text boxes: -------
272+
WiFiManagerParameter custom_sL0("sL0", "Display speed with leading 0 (0=no, 1=yes)", settings.speedoL0Spd, 1, "autocomplete='off'");
273+
#else // -------------------- Checkbox hack: --------------
274+
WiFiManagerParameter custom_sL0("sL0", "Display speed with leading 0", settings.speedoL0Spd, 1, "autocomplete='off' type='checkbox' style='margin-top:12px'", WFM_LABEL_AFTER);
275+
#endif // -------------------------------------------------
271276
#ifdef TC_HAVEGPS
272277
#ifdef TC_NOCHECKBOXES // --- Standard text boxes: -------
273278
WiFiManagerParameter custom_useGPSS("uGPSS", "Display GPS speed (0=no, 1=yes)", settings.useGPSSpeed, 1, "autocomplete='off' title='Enable to display actual GPS speed on speedo'");
@@ -545,6 +550,7 @@ void wifi_setup()
545550
&custom_speedoBright,
546551
&custom_sAF,
547552
&custom_speedoFact,
553+
&custom_sL0,
548554
#ifdef TC_HAVEGPS
549555
&custom_useGPSS,
550556
&custom_updrt,
@@ -964,6 +970,7 @@ void wifi_loop()
964970

965971
#ifdef TC_HAVESPEEDO
966972
mystrcpy(settings.speedoAF, &custom_sAF);
973+
mystrcpy(settings.speedoL0Spd, &custom_sL0);
967974
#ifdef TC_HAVEGPS
968975
mystrcpy(settings.useGPSSpeed, &custom_useGPSS);
969976
#endif
@@ -1025,6 +1032,7 @@ void wifi_loop()
10251032

10261033
#ifdef TC_HAVESPEEDO
10271034
strcpyCB(settings.speedoAF, &custom_sAF);
1035+
strcpyCB(settings.speedoL0Spd, &custom_sL0);
10281036
#ifdef TC_HAVEGPS
10291037
strcpyCB(settings.useGPSSpeed, &custom_useGPSS);
10301038
#endif
@@ -1671,6 +1679,7 @@ void updateConfigPortalValues()
16711679
#endif
16721680
#ifdef TC_HAVESPEEDO
16731681
custom_sAF.setValue(settings.speedoAF, 1);
1682+
custom_sL0.setValue(settings.speedoL0Spd, 1);
16741683
#ifdef TC_HAVEGPS
16751684
custom_useGPSS.setValue(settings.useGPSSpeed, 1);
16761685
#endif
@@ -1721,6 +1730,7 @@ void updateConfigPortalValues()
17211730
#endif
17221731
#ifdef TC_HAVESPEEDO
17231732
setCBVal(&custom_sAF, settings.speedoAF);
1733+
setCBVal(&custom_sL0, settings.speedoL0Spd);
17241734
#ifdef TC_HAVEGPS
17251735
setCBVal(&custom_useGPSS, settings.useGPSSpeed);
17261736
#endif

0 commit comments

Comments
 (0)