Mercurial > public > ostc4
changeset 816:c4ee952b9425
Fix a bug that disables arbitrary menu lines in dive mode if lines are disabled / inactive in surface mode. (mikeller)
author | heinrichsweikamp |
---|---|
date | Sun, 10 Sep 2023 11:46:45 +0200 |
parents | ce8f71217f45 |
children | d55ed6b7b14a |
files | Discovery/Inc/tMenu.h Discovery/Src/tHome.c Discovery/Src/tMenu.c Discovery/Src/tMenuEditXtra.c Discovery/Src/tMenuSetpoint.c Discovery/Src/tMenuXtra.c |
diffstat | 6 files changed, 51 insertions(+), 48 deletions(-) [+] |
line wrap: on
line diff
--- a/Discovery/Inc/tMenu.h Sun Sep 03 18:03:49 2023 +0200 +++ b/Discovery/Inc/tMenu.h Sun Sep 10 11:46:45 2023 +0200 @@ -90,6 +90,7 @@ void resetLineMask(uint32_t lineId); void disableLine(uint32_t lineId); void enableLine(uint32_t lineId); +void clearDisabledMenuLines(void); char *makeGrey(bool isGrey); #endif /* TMENU_H */
--- a/Discovery/Src/tHome.c Sun Sep 03 18:03:49 2023 +0200 +++ b/Discovery/Src/tHome.c Sun Sep 10 11:46:45 2023 +0200 @@ -86,6 +86,8 @@ } else set_globalState(StS); + + clearDisabledMenuLines(); }
--- a/Discovery/Src/tMenu.c Sun Sep 03 18:03:49 2023 +0200 +++ b/Discovery/Src/tMenu.c Sun Sep 10 11:46:45 2023 +0200 @@ -129,6 +129,14 @@ } +void clearDisabledMenuLines(void) +{ + for(unsigned i = 0; i <= MAXPAGES; i++) { + menu.disableLineMask[i] = 0; + } +} + + void tM_init(void) { uint8_t i; @@ -154,9 +162,10 @@ menu.StartAddressForPage[i] = 0; menu.linesAvailableForPage[i] = 0; menu.shadowPage[i] = 0; - menu.disableLineMask[i] = 0; } + clearDisabledMenuLines(); + tMscreen.FBStartAdress = 0; tMscreen.ImageHeight = 480; tMscreen.ImageWidth = 800;
--- a/Discovery/Src/tMenuEditXtra.c Sun Sep 03 18:03:49 2023 +0200 +++ b/Discovery/Src/tMenuEditXtra.c Sun Sep 10 11:46:45 2023 +0200 @@ -179,15 +179,10 @@ { SSettings *pSettings = settingsGetPointer(); - if(pSettings->CCR_Mode == CCRMODE_Sensors) - { + if(pSettings->CCR_Mode == CCRMODE_Sensors) { pSettings->CCR_Mode = CCRMODE_FixedSetpoint; - disableLine(StMXTRA_O2_Fallback); - } - else - { + } else { pSettings->CCR_Mode = CCRMODE_Sensors; - enableLine(StMXTRA_O2_Fallback); } exitEditWithUpdate();
--- a/Discovery/Src/tMenuSetpoint.c Sun Sep 03 18:03:49 2023 +0200 +++ b/Discovery/Src/tMenuSetpoint.c Sun Sep 10 11:46:45 2023 +0200 @@ -55,16 +55,15 @@ if((actual_menu_content == MENU_SURFACE) || (stateUsed->diveSettings.diveMode != DIVEMODE_PSCR)) /* do not show setpoints in PSCR mode */ { - if (settings->autoSetpoint) { - disableLine(StMSP_Blank); - } - else { - enableLine(StMSP_Blank); + if (settings->autoSetpoint) { + disableLine(StMSP_Blank); + } else { + enableLine(StMSP_Blank); } + for(int spId=1;spId<=NUM_GASES;spId++) { if (settings->autoSetpoint) { - disableLine(StMSP_Blank); if (spId == 5) { if (actual_menu_content == MENU_SURFACE) { textPointer += snprintf(&text[textPointer], 40, "\020%c%c\016\016%c%c\017 %c%c\002%c\n\r", TXT_2BYTE, TXT2BYTE_SetpointShort, TXT_2BYTE, TXT2BYTE_SetpointLow, TXT_2BYTE, TXT2BYTE_SetpointDelayed, settings->delaySetpointLow ? '\005' : '\006');
--- a/Discovery/Src/tMenuXtra.c Sun Sep 03 18:03:49 2023 +0200 +++ b/Discovery/Src/tMenuXtra.c Sun Sep 10 11:46:45 2023 +0200 @@ -152,45 +152,42 @@ } if((line == 0) || (line == 2)) - { - bool canDoFallback = pSettings->CCR_Mode == CCRMODE_Sensors; - if (!canDoFallback) { - text[textPointer++] = '\031'; - } - textPointer += snprintf(&text[textPointer], 60,\ - "%c" - ,TXT_Fallback - ); + { + bool canDoFallback = pSettings->CCR_Mode == CCRMODE_Sensors; + if (!canDoFallback) { + text[textPointer++] = '\031'; + } + textPointer += snprintf(&text[textPointer], 60,\ + "%c" + ,TXT_Fallback + ); - text[textPointer++] = '\t'; - if(settingsGetPointer()->fallbackToFixedSetpoint && canDoFallback) - text[textPointer++] = '\005'; - else - text[textPointer++] = '\006'; + text[textPointer++] = '\t'; + if(settingsGetPointer()->fallbackToFixedSetpoint && canDoFallback) + text[textPointer++] = '\005'; + else + text[textPointer++] = '\006'; - if (!canDoFallback) { - text[textPointer++] = '\020'; - disableLine(StMXTRA_O2_Fallback); - } - else { - enableLine(StMXTRA_O2_Fallback); - } - strcpy(&text[textPointer],"\n\r"); - textPointer += 2; - } + if (!canDoFallback) { + text[textPointer++] = '\020'; + disableLine(StMXTRA_O2_Fallback); + } else { + enableLine(StMXTRA_O2_Fallback); + } + strcpy(&text[textPointer],"\n\r"); + textPointer += 2; + } if((line == 0) || (line == 3)) - { - textPointer += snprintf(&text[textPointer], 60,\ - "%c" - ,TXT_ScrubTime - ); - strcpy(&text[textPointer],"\n\r"); - textPointer += 2; - } - - + { + textPointer += snprintf(&text[textPointer], 60,\ + "%c" + ,TXT_ScrubTime + ); + strcpy(&text[textPointer],"\n\r"); + textPointer += 2; + } #ifdef ENABLE_PSCR_MODE if(pSettings->dive_mode == DIVEMODE_PSCR)