changeset 707:e81afd727993

Menu cleanup rebreather specific settings: In the previous version the selection for Fix setpoint or sensor was in the deco menu and the Fallback option in the hardware menu. As they have a dependency and are only relevant for rebreather operation, they have been moved into the extra menu which is containing rebreather related data and which is only visible in rebreather mode.
author Ideenmodellierer
date Thu, 03 Nov 2022 20:44:21 +0100
parents 10b7d271b9c4
children 7e3bf2c0cd40
files Discovery/Inc/tStructure.h Discovery/Src/tMenuDeco.c Discovery/Src/tMenuEdit.c Discovery/Src/tMenuEditDeco.c Discovery/Src/tMenuEditXtra.c Discovery/Src/tMenuXtra.c
diffstat 6 files changed, 249 insertions(+), 232 deletions(-) [+]
line wrap: on
line diff
--- a/Discovery/Inc/tStructure.h	Thu Nov 03 20:37:06 2022 +0100
+++ b/Discovery/Inc/tStructure.h	Thu Nov 03 20:44:21 2022 +0100
@@ -195,13 +195,20 @@
 #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)
+
+#define StMXTRA_CCRmode					_MB(2,4,1,1,0)
+#define StMXTRA_O2_Fallback				_MB(2,4,2,1,0)
+#define StMXTRA_ScrubTimer				_MB(2,4,3,1,0)
+#define StMXTRA_ScrubTimer_Reset		_MB(2,4,3,2,0)
+#define StMXTRA_ScrubTimer_OP_Mode		_MB(2,4,3,3,0)
+
 #define StMXTRA_PSCR_O2_Drop			_MB(2,4,4,1,0)
-#define StMXTRA_PSCR_LUNG_RATIO			_MB(2,4,5,1,0)
-#define StMXTRA_CO2_Sensor				_MB(2,4,6,1,0)
-#define StMXTRA_CO2_Sensor_Calib		_MB(2,4,6,2,0)
+#define StMXTRA_PSCR_LUNG_RATIO			_MB(2,4,4,2,0)
+#define StMXTRA_CO2_Sensor				_MB(2,4,5,1,0)
+#define StMXTRA_CO2_Sensor_Calib		_MB(2,4,5,2,0)
+
+
+
 
 /* PAGE 5 */
 #define StMDECO		_MB(2,5,0,0,0)
@@ -223,11 +230,10 @@
 #define StMDECO1_Gauge					_MB(2,5,1,4,0)
 #define StMDECO1_PSCR					_MB(2,5,1,5,0)
 
-#define StMDECO2_CCRmode			_MB(2,5,2,1,0)
-#define StMDECO3_PPO2Max			_MB(2,5,3,1,0)
-#define StMDECO4_SafetyStop			_MB(2,5,4,1,0)
-#define StMDECO5_FUTURE				_MB(2,5,5,1,0)
-#define StMDECO6_SALINITY			_MB(2,5,6,1,0)
+#define StMDECO3_PPO2Max			_MB(2,5,2,1,0)
+#define StMDECO4_SafetyStop			_MB(2,5,3,1,0)
+#define StMDECO5_FUTURE				_MB(2,5,4,1,0)
+#define StMDECO6_SALINITY			_MB(2,5,5,1,0)
 
 /* PAGE 6 */
 #define StMDECOP	_MB(2,6,0,0,0)
@@ -260,9 +266,8 @@
 #define StMHARD3_O2_Sensor1			_MB(2,7,3,1,0)
 #define StMHARD3_O2_Sensor2			_MB(2,7,3,2,0)
 #define StMHARD3_O2_Sensor3			_MB(2,7,3,3,0)
-#define StMHARD3_O2_Fallback		_MB(2,7,3,4,0)
-#define StMHARD3_O2_Calibrate		_MB(2,7,3,5,0)
-#define StMHARD3_O2_Source			_MB(2,7,3,6,0)
+#define StMHARD3_O2_Calibrate		_MB(2,7,3,4,0)
+#define StMHARD3_O2_Source			_MB(2,7,3,5,0)
 
 #define StMHARD4_BrightnessEco	_MB(2,7,4,1,0)
 #define StMHARD4_BrightnessStd	_MB(2,7,4,2,0)
--- a/Discovery/Src/tMenuDeco.c	Thu Nov 03 20:37:06 2022 +0100
+++ b/Discovery/Src/tMenuDeco.c	Thu Nov 03 20:44:21 2022 +0100
@@ -38,7 +38,7 @@
     uint8_t textPointer;
     uint8_t	futureTTS;
     double ppO2max_deco, ppO2max_std;
-    char divemode, CcrModusTxtId;
+    char divemode;
     textPointer = 0;
     *tab = 370;
     *subtext = 0;
@@ -84,39 +84,7 @@
     strcpy(&text[textPointer],"\n\r");
     textPointer += 2;
 
-    if(isLoopMode(data->dive_mode))
-    {
-        if((line == 0) || (line == 2))
-        {
-        	switch(data->CCR_Mode)
-        	{
-        		case CCRMODE_Sensors: CcrModusTxtId = TXT_Sensor;
-        			break;
-        		case CCRMODE_FixedSetpoint: CcrModusTxtId = TXT_FixedSP;
-        			break;
-        		case CCRMODE_Simulation: CcrModusTxtId = TXT_SimPpo2;
-        			break;
-        		default:	CcrModusTxtId = 'X';
-        			break;
-        	}
-
-
-            textPointer += snprintf(&text[textPointer], 60,\
-                "%c"
-                "\t"
-                "%c"
-                , TXT_CCRmode
-                , CcrModusTxtId
-            );
-        }
-        strcpy(&text[textPointer],"\n\r");
-        textPointer += 2;
-    }
-    else
-        if(line != 0)
-            line++;
-
-    if((line == 0) || (line == 3))
+    if((line == 0) || (line == 2))
     {
         textPointer += snprintf(&text[textPointer], 60,\
             "ppO2"
@@ -139,7 +107,7 @@
     strcpy(&text[textPointer],"\n\r");
     textPointer += 2;
 
-    if((line == 0) || (line == 4))
+    if((line == 0) || (line == 3))
     {
         textPointer += snprintf(&text[textPointer], 60,\
             "%c"
@@ -164,7 +132,7 @@
     strcpy(&text[textPointer],"\n\r");
     textPointer += 2;
 
-    if((line == 0) || (line == 5))
+    if((line == 0) || (line == 4))
     {
         textPointer += snprintf(&text[textPointer], 60,\
             "%c"
@@ -181,7 +149,7 @@
     strcpy(&text[textPointer],"\n\r");
     textPointer += 2;
 
-    if((line == 0) || (line == 6))
+    if((line == 0) || (line == 5))
     {
         textPointer += snprintf(&text[textPointer], 60,\
             "%c"
--- a/Discovery/Src/tMenuEdit.c	Thu Nov 03 20:37:06 2022 +0100
+++ b/Discovery/Src/tMenuEdit.c	Thu Nov 03 20:44:21 2022 +0100
@@ -211,12 +211,19 @@
 	 	 	 break;
 	 	 case (StMHARD2_Compass_SetCourse & MaskFieldDigit): refreshFct = refresh_CompassEdit;
 	 	 	 break;
-	 	 case (StMXTRA_CompassHeading & MaskFieldDigit):  refreshFct = refresh_CompassHeading;
-	 	 	 break;
-	 	 case (StMXTRA_PSCR_O2_Drop & MaskFieldDigit): if(settingsGetPointer()->dive_mode != DIVEMODE_PSCR)	/* workaround because PSCR mode is set dynamic */
-	 	 	 	 	 	 	 	 	 	 	 	 	 	 {
-	 		 	 	 	 	 	 	 	 	 	 	 	 	 refreshFct = refresh_CO2Data;
-	 	 	 	 	 	 	 	 	 	 	 	 	 	 }
+	 	/* case (StMXTRA_CompassHeading & MaskFieldDigit):   StMXTRA_CompassHeading and  StMXTRA_PSCR_O2_Drop share the same menu ID => select function based on divemode */
+	 	 case (StMXTRA_PSCR_O2_Drop & MaskFieldDigit):
+														 if(actual_menu_content == MENU_SURFACE)
+														 {
+															 if(settingsGetPointer()->dive_mode != DIVEMODE_PSCR)	/* workaround because PSCR mode is set dynamic */
+															 {
+																 refreshFct = refresh_CO2Data;
+															 }
+														 }
+														 else
+														 {
+															 refreshFct = refresh_CompassHeading;
+														 }
 	 	 	 break;
 	 	 case (StMXTRA_CO2_Sensor & MaskFieldDigit):  refreshFct = refresh_CO2Data;
 	 	 	 break;
--- a/Discovery/Src/tMenuEditDeco.c	Thu Nov 03 20:37:06 2022 +0100
+++ b/Discovery/Src/tMenuEditDeco.c	Thu Nov 03 20:44:21 2022 +0100
@@ -40,7 +40,6 @@
 /* Private function prototypes -----------------------------------------------*/
 
 static void openEdit_DiveMode(void);
-static void openEdit_CCRModeSensorOrFixedSP(void);
 static void openEdit_ppO2max(void);
 static void openEdit_SafetyStop(void);
 static void openEdit_FutureTTS(void);
@@ -59,13 +58,8 @@
     set_globalState_Menu_Line(line);
     resetMenuEdit(CLUT_MenuPageDeco);
 
-    SSettings *data = settingsGetPointer();
-
     lineSelected = line;
 
-    if((!isLoopMode(data->dive_mode)) &&  (line > 1))
-        line += 1;
-
     switch(line)
     {
     case 1:
@@ -73,18 +67,15 @@
         openEdit_DiveMode();
         break;
     case 2:
-        openEdit_CCRModeSensorOrFixedSP();
+        openEdit_ppO2max();
         break;
     case 3:
-        openEdit_ppO2max();
+        openEdit_SafetyStop();
         break;
     case 4:
-        openEdit_SafetyStop();
+        openEdit_FutureTTS();
         break;
     case 5:
-        openEdit_FutureTTS();
-        break;
-    case 6:
         openEdit_Salinity();
         break;
     }
@@ -207,17 +198,7 @@
 }
 
 
-static void openEdit_CCRModeSensorOrFixedSP(void)
-{
-    SSettings *pSettings = settingsGetPointer();
 
-    if(pSettings->CCR_Mode == CCRMODE_Sensors)
-        pSettings->CCR_Mode = CCRMODE_FixedSetpoint;
-    else
-        pSettings->CCR_Mode = CCRMODE_Sensors;
-
-    exitEditWithUpdate();
-}
 
 
 static void openEdit_SafetyStop(void)
--- a/Discovery/Src/tMenuEditXtra.c	Thu Nov 03 20:37:06 2022 +0100
+++ b/Discovery/Src/tMenuEditXtra.c	Thu Nov 03 20:44:21 2022 +0100
@@ -45,12 +45,12 @@
 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);
+
+static void openEdit_CCRModeSensorOrFixedSP(void);
+static void openEdit_Fallback(void);
+static void openEdit_Scrubber(void);
 #ifdef ENABLE_PSCR_MODE
-static void openEdit_PSCRO2Drop(uint8_t line);
-static void openEdit_PSCRLungRatio(uint8_t line);
+static void openEdit_PSCR(void);
 #endif
 #ifdef ENABLE_CO2_SUPPORT
 static void openEdit_CO2Sensor(void);
@@ -59,6 +59,8 @@
 /* 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);
+static uint8_t OnAction_ScrubberReset(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
+static uint8_t OnAction_ScrubberMode(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
 #ifdef ENABLE_PSCR_MODE
 static uint8_t OnAction_PSCRO2Drop(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
 static uint8_t OnAction_PSCRLungRation(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
@@ -74,11 +76,13 @@
 void openEdit_Xtra(uint8_t line)
 {
     set_globalState_Menu_Line(line);
-    resetMenuEdit(CLUT_MenuPageXtra);
+
 
     /* DIVE MODE */
     if(actual_menu_content != MENU_SURFACE)
     {
+    	resetMenuEdit(CLUT_MenuPageXtra);
+
 		switch(line)
 		{
 			case 1:
@@ -115,17 +119,15 @@
 
 		switch(line)
 		{
-			case 1:	openEdit_ScrubberTimer(line);
+			case 1: openEdit_CCRModeSensorOrFixedSP();
 				break;
-			case 2: openEdit_ScrubberReset();
+			case 2: openEdit_Fallback();
 				break;
-			case 3:	openEdit_ScrubberTimerMode();
+			case 3: openEdit_Scrubber();
 				break;
 #ifdef ENABLE_PSCR_MODE
-			case 4: openEdit_PSCRO2Drop(line);
+			case 4: openEdit_PSCR();
 				break;
-			case 5: openEdit_PSCRLungRatio(line);
-							break;
 #endif
 #ifdef ENABLE_CO2_SUPPORT
 			case 6: openEdit_CO2Sensor();
@@ -170,74 +172,103 @@
 }
 
 
-
-static void openEdit_ScrubberTimer(uint8_t line)
+static void openEdit_CCRModeSensorOrFixedSP(void)
 {
-    uint16_t localScrubTimer;
-    uint16_t y_line;
+    SSettings *pSettings = settingsGetPointer();
+
+    if(pSettings->CCR_Mode == CCRMODE_Sensors)
+        pSettings->CCR_Mode = CCRMODE_FixedSetpoint;
+    else
+        pSettings->CCR_Mode = CCRMODE_Sensors;
 
-    char text[32];
+    exitEditWithUpdate();
+}
+
+static void openEdit_Fallback(void)
+{
+/* does not work like this	resetEnterPressedToStateBeforeButtonAction(); */
+
     SSettings *pSettings = settingsGetPointer();
-    localScrubTimer = pSettings->scrubTimerMax;
 
-    y_line = ME_Y_LINE_BASE + (line * ME_Y_LINE_STEP);
+    if(pSettings->fallbackToFixedSetpoint == 0)
+    {
+    	pSettings->fallbackToFixedSetpoint = 1;
+    }
+    else
+    {
+    	pSettings->fallbackToFixedSetpoint = 0;
+    }
+    exitMenuEdit_to_Menu_with_Menu_Update_do_not_write_settings_for_this_only();
+}
+
 
-    text[0] = '\001';
-    text[1] = TXT_ScrubTime;
-    text[2] = 0;
+static void openEdit_Scrubber(void)
+{
+	char text[32];
+	uint8_t textIndex = 0;
+    uint16_t localScrubTimer;
+
+    SSettings *pSettings = settingsGetPointer();
+
+    localScrubTimer =  pSettings->scrubTimerMax;
+
+	resetMenuEdit(CLUT_MenuPageXtra);
+
+
+	snprintf(&text[textIndex], 32,"\001%c",TXT_ScrubTime);
     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);
+
+    snprintf(&text[textIndex], 32,\
+        "%c"
+    	"\016\016(%c)\017"
+        ,TXT_ScrubTime
+		,TXT_Maximum);
+
+    write_label_var(  20, 340, ME_Y_LINE1, &FontT48, text);
+    snprintf(&text[textIndex], 32, "\002###\016\016 %c\017",TXT_Minutes);
+
+    write_field_udigit(StMXTRA_ScrubTimer,	 610, 780, ME_Y_LINE1,  &FontT48, text,localScrubTimer, 0, 0, 0);
+
+    snprintf(&text[0], 32,\
+                     "%c\002%03u\016\016 %c\017"
+                     ,TXT_ScrubTimeReset
+                     ,pSettings->scrubTimerCur
+                     ,TXT_Minutes);
 
-    write_buttonTextline(TXT2BYTE_ButtonMinus,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonPlus);
+    write_field_button(StMXTRA_ScrubTimer_Reset, 20, 780, ME_Y_LINE2,  &FontT48, text);
 
-    setEvent(StMXTRA_ScrubTimer_Max_Minutes,	(uint32_t)OnAction_ScrubberTimer);
-    startEdit();
+   	switch(pSettings->scrubTimerMode)
+    	{
+    		case SCRUB_TIMER_OFF:
+    		default: 	snprintf(&text[0], 32,"%c\002%c%c",TXT_ScrubTimeMode, TXT_2BYTE, TXT2BYTE_MoCtrlNone );
+    			break;
+    		case SCRUB_TIMER_MINUTES: snprintf(&text[0], 32,"%c\002%c",TXT_ScrubTimeMode, TXT_Minutes );
+    			break;
+    		case SCRUB_TIMER_PERCENT: snprintf(&text[0], 32,"%c\002%c",TXT_ScrubTimeMode, TXT_Percent );
+    			break;
+    	}
+    write_field_button(StMXTRA_ScrubTimer_OP_Mode,	 30, 780, ME_Y_LINE3,  &FontT48, text);
+
+    setEvent(StMXTRA_ScrubTimer, (uint32_t)OnAction_ScrubberTimer);
+    setEvent(StMXTRA_ScrubTimer_Reset, (uint32_t)OnAction_ScrubberReset);
+    setEvent(StMXTRA_ScrubTimer_OP_Mode, (uint32_t)OnAction_ScrubberMode);
+
+    write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext);
+
 }
 
-static void openEdit_ScrubberReset(void)
-{
-	 SSettings *pSettings;
-     pSettings = settingsGetPointer();
-     pSettings->scrubTimerCur = pSettings->scrubTimerMax;
-     exitMenuEdit_to_Menu_with_Menu_Update();
-}
-
-static void openEdit_ScrubberTimerMode(void)
+static void openEdit_PSCR(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();
-}
-
-#ifdef ENABLE_PSCR_MODE
-static void openEdit_PSCRO2Drop(uint8_t line)
-{
-    uint8_t localO2Drop;
-    uint16_t y_line;
-
+	uint8_t localO2Drop,localLungRatio;
     char text[32];
     SSettings *pSettings = settingsGetPointer();
     localO2Drop = pSettings->pscr_o2_drop;
-
-    y_line = ME_Y_LINE_BASE + (line * ME_Y_LINE_STEP);
+    localLungRatio = pSettings->pscr_lung_ratio;
 
-    text[0] = '\001';
-    text[1] = TXT_PSCRO2Drop;
-    text[2] = 0;
+    resetMenuEdit(CLUT_MenuPageXtra);
+
+    snprintf(text, 32, "\001%c",TXT_PSClosedCircuit);
     write_topline(text);
 
     text[0] = '\002';
@@ -245,47 +276,26 @@
     text[2] = '\016';
     text[3] = '%';
     text[4] = 0;
-    write_label_fix(   20, 800, y_line, &FontT48, TXT_PSCRO2Drop);
-    write_label_var(  435, 780, y_line, &FontT48, text);
-    write_field_udigit(StMXTRA_PSCR_O2_Drop, 710, 779, y_line, &FontT48, "##", (uint32_t)localO2Drop, 0, 0, 0);
-
-    write_buttonTextline(TXT2BYTE_ButtonMinus,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonPlus);
-
-    setEvent(StMXTRA_PSCR_O2_Drop,	(uint32_t)OnAction_PSCRO2Drop);
-    startEdit();
-}
+    write_label_fix(   20, 800, ME_Y_LINE1, &FontT48, TXT_PSCRO2Drop);
+    write_label_var(  435, 780, ME_Y_LINE1, &FontT48, text);
+    write_field_udigit(StMXTRA_PSCR_O2_Drop, 710, 779, ME_Y_LINE1, &FontT48, "##", (uint32_t)localO2Drop, 0, 0, 0);
 
-static void openEdit_PSCRLungRatio(uint8_t line)
-{
-    uint8_t localLungRatio;
-    uint16_t y_line;
-
-    char text[32];
-    SSettings *pSettings = settingsGetPointer();
-    localLungRatio = pSettings->pscr_lung_ratio;
-
-    y_line = ME_Y_LINE_BASE + (line * ME_Y_LINE_STEP);
-
-    text[0] = '\001';
-    text[1] = TXT_PSCRO2Drop;
-    text[2] = 0;
-    write_topline(text);
 
     text[0] = '\002';
     text[1] = '1';
     text[2] = '/';
     text[3] = 0;
 
-    write_label_fix(   20, 800, y_line, &FontT48, TXT_PSCRLungRatio);
-    write_label_var(  435, 710, y_line, &FontT48, text);
-    write_field_udigit(StMXTRA_PSCR_LUNG_RATIO, 710, 779, y_line, &FontT48, "##", (uint32_t)localLungRatio, 0, 0, 0);
+    write_label_fix(   20, 800, ME_Y_LINE2, &FontT48, TXT_PSCRLungRatio);
+    write_label_var(  435, 710, ME_Y_LINE2, &FontT48, text);
+    write_field_udigit(StMXTRA_PSCR_LUNG_RATIO, 710, 779, ME_Y_LINE2, &FontT48, "##", (uint32_t)localLungRatio, 0, 0, 0);
 
     write_buttonTextline(TXT2BYTE_ButtonMinus,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonPlus);
 
+    setEvent(StMXTRA_PSCR_O2_Drop,	(uint32_t)OnAction_PSCRO2Drop);
     setEvent(StMXTRA_PSCR_LUNG_RATIO,	(uint32_t)OnAction_PSCRLungRation);
-    startEdit();
 }
-#endif
+
 
 #ifdef ENABLE_CO2_SUPPORT
 static void openEdit_CO2Sensor()
@@ -357,11 +367,8 @@
 
 void openEdit_CompassHeading(void)
 {
-
     write_field_button(StMXTRA_CompassHeading,20, 800, ME_Y_LINE4, &FontT48, "Set");
-
     setEvent(StMXTRA_CompassHeading,  (uint32_t)OnAction_CompassHeading);
-//	startEdit();
 }
 
 
@@ -397,7 +404,7 @@
         }
 
         tMenuEdit_newInput(editId, newScrubberTime, 0, 0, 0);
-        digitContentNew = UPDATE_AND_EXIT_TO_MENU;
+        digitContentNew = UNSPECIFIC_RETURN;
     }
     if(action == ACTION_BUTTON_NEXT)
     {
@@ -413,6 +420,54 @@
     }
     return digitContentNew;
 }
+
+uint8_t OnAction_ScrubberReset(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
+{
+	char text[32];
+	SSettings *pSettings;
+    pSettings = settingsGetPointer();
+    pSettings->scrubTimerCur = pSettings->scrubTimerMax;
+
+
+    snprintf(&text[0], 32,\
+                     "%c\002%03u\016\016 %c\017"
+                     ,TXT_ScrubTimeReset
+                     ,pSettings->scrubTimerCur
+                     ,TXT_Minutes);
+
+    tMenuEdit_refresh_field(StMXTRA_ScrubTimer_Reset);
+
+    return UNSPECIFIC_RETURN;
+}
+
+uint8_t OnAction_ScrubberMode(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
+{
+	char text[32];
+	uint8_t newMode;
+	SSettings *pSettings;
+    pSettings = settingsGetPointer();
+    newMode = pSettings->scrubTimerMode + 1;
+    if(newMode >= SCRUB_TIMER_END)
+    {
+   	 newMode = SCRUB_TIMER_OFF;
+    }
+    pSettings->scrubTimerMode = newMode;
+
+   	switch(pSettings->scrubTimerMode)
+    	{
+    		case SCRUB_TIMER_OFF:
+    		default: 	snprintf(&text[0], 32,"%c\002%c%c",TXT_ScrubTimeMode, TXT_2BYTE, TXT2BYTE_MoCtrlNone );
+    			break;
+    		case SCRUB_TIMER_MINUTES: snprintf(&text[0], 32,"%c\002%c",TXT_ScrubTimeMode, TXT_Minutes );
+    			break;
+    		case SCRUB_TIMER_PERCENT: snprintf(&text[0], 32,"%c\002%c",TXT_ScrubTimeMode, TXT_Percent );
+    			break;
+    	}
+    tMenuEdit_newButtonText(StMXTRA_ScrubTimer_OP_Mode, text);
+
+    return UNSPECIFIC_RETURN;
+}
+
 #ifdef ENABLE_PSCR_MODE
 static uint8_t OnAction_PSCRO2Drop(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
 {
@@ -435,7 +490,7 @@
         pSettings->pscr_o2_drop = newO2Drop;
 
         tMenuEdit_newInput(editId, newO2Drop, 0, 0, 0);
-        digitContentNew = UPDATE_AND_EXIT_TO_MENU;
+        digitContentNew = UNSPECIFIC_RETURN;
     }
     if(action == ACTION_BUTTON_NEXT)
     {
@@ -476,7 +531,7 @@
         pSettings->pscr_lung_ratio = newLungRatio;
 
         tMenuEdit_newInput(editId, newLungRatio, 0, 0, 0);
-        digitContentNew = UPDATE_AND_EXIT_TO_MENU;
+        digitContentNew = UNSPECIFIC_RETURN;
     }
     if(action == ACTION_BUTTON_NEXT)
     {
--- a/Discovery/Src/tMenuXtra.c	Thu Nov 03 20:37:06 2022 +0100
+++ b/Discovery/Src/tMenuXtra.c	Thu Nov 03 20:44:21 2022 +0100
@@ -41,7 +41,8 @@
 
 uint32_t tMXtra_refresh(uint8_t line, char *text, uint16_t *tab, char *subtext)
 {
-    uint8_t textPointer;
+    uint8_t textPointer = 0;
+    uint8_t CcrModusTxtId = 0;
 
     textPointer = 0;
     *tab = 500;
@@ -123,49 +124,61 @@
     }
     else	/* Surface MODE */
     {
+
         if((line == 0) || (line == 1))
         {
-            textPointer += snprintf(&text[textPointer], 60,\
-                "%c"
-            	"\016\016(%c)\17"
-                "\002"
-                "%u"
-                "\016\016"
-                " %c"
-                "\017"
-                ,TXT_ScrubTime
-				,TXT_Maximum
-                ,pSettings->scrubTimerMax
-                ,TXT_Minutes
-            );
-        }
-        strcpy(&text[textPointer],"\n\r");
-        textPointer += 2;
-        if((line == 0) || (line == 2))
-        {
+           	switch(pSettings->CCR_Mode)
+           	{
+            		case CCRMODE_Sensors: CcrModusTxtId = TXT_Sensor;
+            			break;
+            		case CCRMODE_FixedSetpoint: CcrModusTxtId = TXT_FixedSP;
+            			break;
+            		case CCRMODE_Simulation: CcrModusTxtId = TXT_SimPpo2;
+            			break;
+            		default:	CcrModusTxtId = 'X';
+            			break;
+           	}
             textPointer += snprintf(&text[textPointer], 60,\
-                        "%c\002%03u\016\016 %c\017"
-                        ,TXT_ScrubTimeReset
-                        ,pSettings->scrubTimerCur
-                        ,TXT_Minutes);
+                    "%c"
+                    "\t"
+                    "%c"
+                    , TXT_CCRmode
+                    , CcrModusTxtId
+                );
+
+            strcpy(&text[textPointer],"\n\r");
+            textPointer += 2;
         }
-        strcpy(&text[textPointer],"\n\r");
-        textPointer += 2;
+
+        if((line == 0) || (line == 2))
+         {
+             textPointer += snprintf(&text[textPointer], 60,\
+                 "%c"
+                 ,TXT_Fallback
+             );
+
+             text[textPointer++] = '\t';
+             if(settingsGetPointer()->fallbackToFixedSetpoint)
+                 text[textPointer++] = '\005';
+             else
+                 text[textPointer++] = '\006';
+
+             strcpy(&text[textPointer],"\n\r");
+             textPointer += 2;
+         }
+
+
         if((line == 0) || (line == 3))
-        {
-        	switch(pSettings->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;
+         {
+             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)
@@ -173,25 +186,13 @@
             if((line == 0) || (line == 4))
              {
                  textPointer += snprintf(&text[textPointer], 60,\
-                             "%c\002%02u\016\016%%\017"
-                             ,TXT_PSCRO2Drop
-                             ,pSettings->pscr_o2_drop);
+                             "%c"
+                             ,TXT_PSClosedCircuit);
              }
-             strcpy(&text[textPointer],"\n\r");
-             textPointer += 2;
-             if((line == 0) || (line == 5))
-              {
-                  textPointer += snprintf(&text[textPointer], 60,\
-                              "%c\002 1/%02u"
-                              ,TXT_PSCRLungRatio
-                              ,pSettings->pscr_lung_ratio);
-              }
-              strcpy(&text[textPointer],"\n\r");
-              textPointer += 2;
         }
 #endif
 #ifdef ENABLE_CO2_SUPPORT
-        if((line == 0) || (line == 6))
+        if((line == 0) || (line == 4))
          {
              textPointer += snprintf(&text[textPointer], 60, "%c", TXT_CO2Sensor);
          }