Skip to content

Commit

Permalink
OriginalMfd.ino: fix bug in trip computer cycling sequence when start…
Browse files Browse the repository at this point in the history
…ing from "GPS info" screen
  • Loading branch information
0xCAFEDECAF committed Dec 12, 2024
1 parent 4ffba33 commit 09d6f6a
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions VanLiveConnect/OriginalMfd.ino
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

// Functions, types and variables involved in keeping track of what the original multi-function display (MFD) is
// Functions, types and variables involved in keeping track of what the original multi-function display (MFD) is
// showing (the small left side panel, the larger right side panel, and any popup).
//
// The original MFD has pretty weird logic for showing its various screens.
Expand Down Expand Up @@ -301,6 +301,17 @@ void ResetTripInfo(uint16_t mfdStatus)
if (mustWrite) WriteEeprom(SMALL_SCREEN_EEPROM_POS, smallScreen, PSTR("Small screen"));
} // ResetTripInfo

// Select the next tab in the trip computer screen (large screen) or trip computer popup.
// Thereyby, skip the "GPS info" screen.
//
// Updates global variable 'smallScreen'.
void NextSmallScreenSkipGpsInfo()
{
if (smallScreen == SMALL_SCREEN_GPS_INFO) smallScreen = SMALL_SCREEN_FUEL_CONSUMPTION;
smallScreen = (smallScreen + 1) % N_SMALL_SCREENS;
if (smallScreen == SMALL_SCREEN_GPS_INFO) smallScreen = SMALL_SCREEN_FUEL_CONSUMPTION;
} // NextSmallScreenSkipGpsInfo

// Keep track of the cycling through the trip computer tabs (either in the small screen, the large screen or the
// popup) in the original MFD. Called after a short-press of the right hand stalk button.
//
Expand Down Expand Up @@ -330,9 +341,7 @@ void CycleTripInfo()
{
// A trip computer tab is showing on the large screen

// Select the next tab, but skip the "GPS info" screen
smallScreen = (smallScreen + 1) % N_SMALL_SCREENS;
if (smallScreen == SMALL_SCREEN_GPS_INFO) smallScreen = SMALL_SCREEN_FUEL_CONSUMPTION;
NextSmallScreenSkipGpsInfo(); // Select the next tab, but skip the "GPS info" screen

#ifdef DEBUG_ORIGINAL_MFD
Serial.printf_P(
Expand Down Expand Up @@ -371,9 +380,7 @@ void CycleTripInfo()
{
// The trip computer popup is visible

// Select the next tab, but skip the "GPS info" screen
smallScreen = (smallScreen + 1) % N_SMALL_SCREENS;
if (smallScreen == SMALL_SCREEN_GPS_INFO) smallScreen = SMALL_SCREEN_FUEL_CONSUMPTION;
NextSmallScreenSkipGpsInfo(); // Select the next tab, but skip the "GPS info" screen

#ifdef DEBUG_ORIGINAL_MFD
Serial.printf_P(
Expand Down

0 comments on commit 09d6f6a

Please sign in to comment.