# HG changeset patch # User Ideenmodellierer # Date 1619376079 -7200 # Node ID 890440ab993a012906d9bc6f138a7c9ddc7dd445 # Parent 269e57ac4e567269176ca16aa7abae60d0167004 Introduced new menu tab for addition CCR options: The Xtra menu tab was only used in dive mode before. The tab is now enabled in surface mode and provide access to scrubber timer functionality. To enables this infrastructure (structure, multilanguage strings etc.) have been added to the sourcecode. diff -r 269e57ac4e56 -r 890440ab993a Common/Inc/settings.h --- a/Common/Inc/settings.h Sun Apr 25 20:36:18 2021 +0200 +++ b/Common/Inc/settings.h Sun Apr 25 20:41:19 2021 +0200 @@ -82,6 +82,14 @@ } SensorSource; #define MAX_O2_SENSOR_SOURCE (2u) +typedef enum +{ + SCRUB_TIMER_OFF = 0, + SCRUB_TIMER_MINUTES, + SCRUB_TIMER_PERCENT, + SCRUB_TIMER_END +} ScrubTimerMode_e; + /* 2015 Jan 30, hw, deco and travel added for MenuEditGas * can be used for buehlmann, vpm, etc. later but be carefull * with current implemenation */ @@ -133,6 +141,8 @@ gasbit8_Type note; } SSetpointLine; + + /* SSettings * gas[0] and setpoint[0] are the special ones configurable during the dive */ @@ -253,6 +263,7 @@ uint8_t autoSetpoint; uint16_t scrubTimerMax; uint16_t scrubTimerCur; + uint8_t scrubTimerMode; } SSettings; typedef struct diff -r 269e57ac4e56 -r 890440ab993a Discovery/Inc/tStructure.h --- a/Discovery/Inc/tStructure.h Sun Apr 25 20:36:18 2021 +0200 +++ b/Discovery/Inc/tStructure.h Sun Apr 25 20:41:19 2021 +0200 @@ -190,9 +190,16 @@ #define StMXTRA _MB(2,4,0,0,0) /* PAGE 4 MENU EDIT */ +/* DIVE MODE */ #define StMXTRA_ResetStopwatch _MB(2,4,1,1,0) #define StMXTRA_CompassHeading _MB(2,4,2,1,0) + /* SURFACE MODE */ + #define StMXTRA_ScrubTimer_Max_Minutes _MB(2,4,1,1,0) + #define StMXTRA_ScrubTimer_Reset _MB(2,4,2,1,0) + #define StMXTRA_ScrubTimer_OP_Mode _MB(2,4,3,1,0) + + /* PAGE 5 */ #define StMDECO _MB(2,5,0,0,0) diff -r 269e57ac4e56 -r 890440ab993a Discovery/Inc/text_multilanguage.h --- a/Discovery/Inc/text_multilanguage.h Sun Apr 25 20:36:18 2021 +0200 +++ b/Discovery/Inc/text_multilanguage.h Sun Apr 25 20:41:19 2021 +0200 @@ -137,6 +137,11 @@ /* */ TXT_Information, /* */ + TXT_ScrubTime, + TXT_ScrubTimeReset, + TXT_ScrubTimeMode, + TXT_Percent, + /* */ TXT_END, TXT_MINIMAL = '\xFE', diff -r 269e57ac4e56 -r 890440ab993a Discovery/Src/settings.c --- a/Discovery/Src/settings.c Sun Apr 25 20:36:18 2021 +0200 +++ b/Discovery/Src/settings.c Sun Apr 25 20:41:19 2021 +0200 @@ -326,6 +326,7 @@ .autoSetpoint = 0, .scrubTimerMax = 0, .scrubTimerCur = 0, + .scrubTimerMode = SCRUB_TIMER_OFF, }; /* Private function prototypes -----------------------------------------------*/ @@ -1455,7 +1456,11 @@ Settings.scrubTimerCur = 0; corrections++; } - + if(Settings.scrubTimerMode > SCRUB_TIMER_END) + { + Settings.scrubTimerMode = SCRUB_TIMER_OFF; + corrections++; + } if(corrections > 255) return 255; else diff -r 269e57ac4e56 -r 890440ab993a Discovery/Src/tMenuEditXtra.c --- a/Discovery/Src/tMenuEditXtra.c Sun Apr 25 20:36:18 2021 +0200 +++ b/Discovery/Src/tMenuEditXtra.c Sun Apr 25 20:41:19 2021 +0200 @@ -44,9 +44,13 @@ void openEdit_SetManualMarker(void); void openEdit_SetEndDive(void); void openEdit_CalibViewport(void); +static void openEdit_ScrubberTimer(uint8_t line); +static void openEdit_ScrubberReset(void); +static void openEdit_ScrubberTimerMode(void); /* Announced function prototypes -----------------------------------------------*/ uint8_t OnAction_CompassHeading (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); +static uint8_t OnAction_ScrubberTimer(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); /* Exported functions --------------------------------------------------------*/ @@ -55,31 +59,49 @@ set_globalState_Menu_Line(line); resetMenuEdit(CLUT_MenuPageXtra); - switch(line) + /* DIVE MODE */ + if(actual_menu_content != MENU_SURFACE) { - case 1: - default: - openEdit_ResetStopwatch(); - break; - case 2: - openEdit_CompassHeading(); - break; - case 3: - openEdit_SetManualMarker(); - break; - case 4: - openEdit_CalibViewport(); - break; - case 5: - if(is_stateUsedSetToSim()) - { - openEdit_SimFollowDecostops(); - } - else - { - openEdit_SetEndDive(); - } - break; + switch(line) + { + case 1: + default: + openEdit_ResetStopwatch(); + break; + case 2: + openEdit_CompassHeading(); + break; + case 3: + openEdit_SetManualMarker(); + break; + case 4: + openEdit_CalibViewport(); + break; + case 5: + if(is_stateUsedSetToSim()) + { + openEdit_SimFollowDecostops(); + } + else + { + openEdit_SetEndDive(); + } + break; + } + } + else /* surface mode */ + { + switch(line) + { + case 1: openEdit_ScrubberTimer(line); + break; + case 2: openEdit_ScrubberReset(); + break; + case 3: openEdit_ScrubberTimerMode(); + break; + default: + break; + } } } @@ -115,6 +137,60 @@ exitMenuEdit_to_Home(); } + + +static void openEdit_ScrubberTimer(uint8_t line) +{ + uint16_t localScrubTimer; + uint16_t y_line; + + char text[32]; + SSettings *pSettings = settingsGetPointer(); + localScrubTimer = pSettings->scrubTimerMax; + + y_line = ME_Y_LINE_BASE + (line * ME_Y_LINE_STEP); + + text[0] = '\001'; + text[1] = TXT_ScrubTime; + text[2] = 0; + write_topline(text); + + text[0] = '\002'; + strcpy(&text[1],"\016\016"); + text[3] = TXT_Minutes; + text[4] = 0; + write_label_fix( 20, 800, y_line, &FontT48, TXT_ScrubTime); + write_label_var( 435, 780, y_line, &FontT48, text); + write_field_udigit(StMXTRA_ScrubTimer_Max_Minutes, 600, 779, y_line, &FontT48, "###", (uint32_t)localScrubTimer, 0, 0, 0); + + write_buttonTextline(TXT2BYTE_ButtonMinus,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonPlus); + + setEvent(StMXTRA_ScrubTimer_Max_Minutes, (uint32_t)OnAction_ScrubberTimer); + startEdit(); +} + +static void openEdit_ScrubberReset(void) +{ + SSettings *pSettings; + pSettings = settingsGetPointer(); + pSettings->scrubTimerCur = pSettings->scrubTimerMax; + exitMenuEdit_to_Menu_with_Menu_Update(); +} + +static void openEdit_ScrubberTimerMode(void) +{ + uint8_t newMode; + SSettings *pSettings; + pSettings = settingsGetPointer(); + newMode = pSettings->scrubTimerMode + 1; + if(newMode >= SCRUB_TIMER_END) + { + newMode = SCRUB_TIMER_OFF; + } + pSettings->scrubTimerMode = newMode; + exitMenuEdit_to_Menu_with_Menu_Update(); +} + void refresh_CompassHeading(void) { uint16_t heading; @@ -149,3 +225,46 @@ exitMenuEdit_to_Home_with_Menu_Update(); return EXIT_TO_HOME; } + +static uint8_t OnAction_ScrubberTimer(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) +{ + SSettings *pSettings; + uint8_t digitContentNew = EXIT_TO_MENU; + uint32_t newScrubberTime; + + if(action == ACTION_BUTTON_ENTER) + { + return digitContent; + } + if(action == ACTION_BUTTON_ENTER_FINAL) + { + evaluateNewString(editId, &newScrubberTime, 0, 0, 0); + + if(newScrubberTime > MAX_SCRUBBER_TIME) + newScrubberTime = MAX_SCRUBBER_TIME; + + pSettings = settingsGetPointer(); + pSettings->scrubTimerMax = newScrubberTime; + if(pSettings->scrubTimerCur > newScrubberTime) + { + pSettings->scrubTimerCur = newScrubberTime; + } + + tMenuEdit_newInput(editId, newScrubberTime, 0, 0, 0); + digitContentNew = UPDATE_AND_EXIT_TO_MENU; + } + if(action == ACTION_BUTTON_NEXT) + { + digitContentNew = digitContent + 1; + if(digitContentNew > '9') + digitContentNew = '0'; + } + if(action == ACTION_BUTTON_BACK) + { + digitContentNew = digitContent - 1; + if(digitContentNew < '0') + digitContentNew = '9'; + } + return digitContentNew; +} + diff -r 269e57ac4e56 -r 890440ab993a Discovery/Src/tMenuXtra.c --- a/Discovery/Src/tMenuXtra.c Sun Apr 25 20:36:18 2021 +0200 +++ b/Discovery/Src/tMenuXtra.c Sun Apr 25 20:41:19 2021 +0200 @@ -47,75 +47,125 @@ *tab = 500; *subtext = 0; - if((line == 0) || (line == 1)) - { - text[textPointer++] = TXT_2BYTE; - text[textPointer++] = TXT2BYTE_ResetStopwatch; - } - strcpy(&text[textPointer],"\n\r"); - textPointer += 2; -/* - if((line == 0) || (line == 2)) + /* DIVE MODE */ + if(actual_menu_content != MENU_SURFACE) { - text[textPointer++] = TXT_2BYTE; - text[textPointer++] = TXT2BYTE_ResetAvgDepth; - } - strcpy(&text[textPointer],"\n\r"); - textPointer += 2; -*/ - if((line == 0) || (line == 2)) - { - text[textPointer++] = TXT_2BYTE; - text[textPointer++] = TXT2BYTE_CompassHeading; - } - strcpy(&text[textPointer],"\n\r"); - textPointer += 2; + if((line == 0) || (line == 1)) + { + text[textPointer++] = TXT_2BYTE; + text[textPointer++] = TXT2BYTE_ResetStopwatch; + } + strcpy(&text[textPointer],"\n\r"); + textPointer += 2; + /* + if((line == 0) || (line == 2)) + { + text[textPointer++] = TXT_2BYTE; + text[textPointer++] = TXT2BYTE_ResetAvgDepth; + } + strcpy(&text[textPointer],"\n\r"); + textPointer += 2; + */ + if((line == 0) || (line == 2)) + { + text[textPointer++] = TXT_2BYTE; + text[textPointer++] = TXT2BYTE_CompassHeading; + } + strcpy(&text[textPointer],"\n\r"); + textPointer += 2; - if((line == 0) || (line == 3)) - { - text[textPointer++] = TXT_2BYTE; - text[textPointer++] = TXT2BYTE_SetMarker; - } - strcpy(&text[textPointer],"\n\r"); - textPointer += 2; + if((line == 0) || (line == 3)) + { + text[textPointer++] = TXT_2BYTE; + text[textPointer++] = TXT2BYTE_SetMarker; + } + strcpy(&text[textPointer],"\n\r"); + textPointer += 2; #ifdef ENABLE_MOTION_CONTROL - if((line == 0) || (line == 4)) - { - text[textPointer++] = TXT_2BYTE; - text[textPointer++] = TXT2BYTE_CalibView; - } - strcpy(&text[textPointer],"\n\r"); - textPointer += 2; + if((line == 0) || (line == 4)) + { + text[textPointer++] = TXT_2BYTE; + text[textPointer++] = TXT2BYTE_CalibView; + } + strcpy(&text[textPointer],"\n\r"); + textPointer += 2; #endif - if(is_stateUsedSetToSim()) + if(is_stateUsedSetToSim()) + { + if((line == 0) || (line == 5)) + { + text[textPointer++] = TXT_2BYTE; + text[textPointer++] = TXT2BYTE_SimFollowDecoStops; + text[textPointer++] = ' '; + text[textPointer++] = ' '; + if(simulation_get_heed_decostops()) + text[textPointer++] = '\005'; + else + text[textPointer++] = '\006'; + } + strcpy(&text[textPointer],"\n\r"); + textPointer += 2; + } + else + { + if((line == 0) || (line == 5)) /* end dive mode only used during real dives */ + { + text[textPointer++] = TXT_2BYTE; + text[textPointer++] = TXT2BYTE_EndDiveMode; + } + strcpy(&text[textPointer],"\n\r"); + textPointer += 2; + } + } + else /* Surface MODE */ { - if((line == 0) || (line == 5)) + if((line == 0) || (line == 1)) { - text[textPointer++] = TXT_2BYTE; - text[textPointer++] = TXT2BYTE_SimFollowDecoStops; - text[textPointer++] = ' '; - text[textPointer++] = ' '; - if(simulation_get_heed_decostops()) - text[textPointer++] = '\005'; - else - text[textPointer++] = '\006'; + textPointer += snprintf(&text[textPointer], 60,\ + "%c" + "\016\016(%c)\17" + "\002" + "%u" + "\016\016" + " %c" + "\017" + ,TXT_ScrubTime + ,TXT_Maximum + ,settingsGetPointer()->scrubTimerMax + ,TXT_Minutes + ); } strcpy(&text[textPointer],"\n\r"); textPointer += 2; + if((line == 0) || (line == 2)) + { + textPointer += snprintf(&text[textPointer], 60,\ + "%c\002%03u\016\016 %c\017" + ,TXT_ScrubTimeReset + ,settingsGetPointer()->scrubTimerCur + ,TXT_Minutes); + } + strcpy(&text[textPointer],"\n\r"); + textPointer += 2; + if((line == 0) || (line == 3)) + { + switch(settingsGetPointer()->scrubTimerMode) + { + case SCRUB_TIMER_OFF: + default: textPointer += snprintf(&text[textPointer], 60,"%c\002%c%c",TXT_ScrubTimeMode, TXT_2BYTE, TXT2BYTE_MoCtrlNone ); + break; + case SCRUB_TIMER_MINUTES: textPointer += snprintf(&text[textPointer], 60,"%c\002%c",TXT_ScrubTimeMode, TXT_Minutes ); + break; + case SCRUB_TIMER_PERCENT: textPointer += snprintf(&text[textPointer], 60,"%c\002%c",TXT_ScrubTimeMode, TXT_Percent ); + break; + } + } + strcpy(&text[textPointer],"\n\r"); + textPointer += 2; + } - else - { - if((line == 0) || (line == 5)) /* end dive mode only used during real dives */ - { - text[textPointer++] = TXT_2BYTE; - text[textPointer++] = TXT2BYTE_EndDiveMode; - } - strcpy(&text[textPointer],"\n\r"); - textPointer += 2; - } - return StMXTRA; } diff -r 269e57ac4e56 -r 890440ab993a Discovery/Src/text_multilanguage.c --- a/Discovery/Src/text_multilanguage.c Sun Apr 25 20:36:18 2021 +0200 +++ b/Discovery/Src/text_multilanguage.c Sun Apr 25 20:41:19 2021 +0200 @@ -1680,6 +1680,30 @@ static uint8_t text_IT_DecoTTS[] = ""; static uint8_t text_ES_DecoTTS[] = ""; +static uint8_t text_EN_ScrubTime[] = "Scrubber time"; +static uint8_t text_DE_ScrubTime[] = "Kalkstandzeit"; +static uint8_t text_FR_ScrubTime[] = "Scrubber time"; +static uint8_t text_IT_ScrubTime[] = "Scrubber time"; +static uint8_t text_ES_ScrubTime[] = "Scrubber time"; + +static uint8_t text_EN_ScrubTimeReset[] = "Reset scrubber timer"; +static uint8_t text_DE_ScrubTimeReset[] = "Kalkstandzeit zurücksetzen"; +static uint8_t text_FR_ScrubTimeReset[] = "Reset scrubber timer"; +static uint8_t text_IT_ScrubTimeReset[] = "Reset scrubber timer"; +static uint8_t text_ES_ScrubTimeReset[] = "Reset scrubber timer"; + +static uint8_t text_EN_ScrubTimeMode[] = "Scrubber timer display"; +static uint8_t text_DE_ScrubTimeMode[] = "Anzeige Modus"; +static uint8_t text_FR_ScrubTimeMode[] = "Scrubber timer display"; +static uint8_t text_IT_ScrubTimeMode[] = "Scrubber timer display"; +static uint8_t text_ES_ScrubTimeMode[] = "Scrubber timer display"; + +static uint8_t text_EN_Percent[] = "Percent"; +static uint8_t text_DE_Percent[] = "Prozent"; +static uint8_t text_FR_Percent[] = "Percent"; +static uint8_t text_IT_Percent[] = "Percent"; +static uint8_t text_ES_Percent[] = "Percent"; + /* Lookup Table -------------------------------------------------------------*/ const tText text_array[] = @@ -1759,6 +1783,11 @@ {(uint8_t)TXT_LogbookEmpty, {text_EN_LogbookEmpty, text_DE_LogbookEmpty, text_FR_LogbookEmpty, text_IT_LogbookEmpty, text_ES_LogbookEmpty}}, {(uint8_t)TXT_Start_Calculation,{text_EN_Start_Calculation, text_DE_Start_Calculation, text_FR_Start_Calculation, text_IT_Start_Calculation, text_ES_Start_Calculation}}, {(uint8_t)TXT_Information, {text_EN_Information, text_DE_Information, text_FR_Information, text_IT_Information, text_ES_Information}}, + {(uint8_t)TXT_ScrubTime, {text_EN_ScrubTime, text_DE_ScrubTime, text_FR_ScrubTime, text_IT_ScrubTime, text_ES_ScrubTime}}, + {(uint8_t)TXT_ScrubTimeReset, {text_EN_ScrubTimeReset, text_DE_ScrubTimeReset, text_FR_ScrubTimeReset, text_IT_ScrubTimeReset, text_ES_ScrubTimeReset}}, + {(uint8_t)TXT_ScrubTimeMode, {text_EN_ScrubTimeMode, text_DE_ScrubTimeMode, text_FR_ScrubTimeMode, text_IT_ScrubTimeMode, text_ES_ScrubTimeMode}}, + {(uint8_t)TXT_Percent, {text_EN_Percent, text_DE_Percent, text_FR_Percent, text_IT_Percent, text_ES_Percent}}, + }; const tText text_array2[] =