diff Discovery/Src/tMenuGas.c @ 647:15f6f0b5786c

Integrated selection of bailout in the diluent selection page: To be able to introduce a new menu page for future development, the selection of bailout cases is now combined with the selection of the diluent at one page. To enable this the concept of a "shadow page" has been introduced. With that the original functionality may be reused without need to a a standalone page. The bailout /diluen page is now switched (surface mode) using the last menu line of the gas selection page
author Ideenmodellierer
date Tue, 13 Apr 2021 19:25:41 +0200
parents a9c195be907e
children 1b995079c045
line wrap: on
line diff
--- a/Discovery/Src/tMenuGas.c	Tue Apr 13 19:21:14 2021 +0200
+++ b/Discovery/Src/tMenuGas.c	Tue Apr 13 19:25:41 2021 +0200
@@ -37,7 +37,7 @@
 #define OCGAS_STANDARD (0)
 #define OCGAS_BAILOUT_INACTIVE (1)
 #define OCGAS_BAILOUT_ACTIVE (2)
-#define CCGAS_STANDARD (0)
+#define CCGAS_STANDARD (3)
 
 /* Private function prototypes -----------------------------------------------*/
 uint8_t write_gas(char *text, uint8_t oxygen, uint8_t helium);
@@ -313,17 +313,33 @@
     }
 
     /* special gas number #6 in dive mode*/
-    if(((line == 0) || (line == 6)) && (actual_menu_content != MENU_SURFACE))
+    if(((line == 0) || (line == 6)))
     {
-        text[textPointer++] = '\020';
-        text[textPointer++] = TXT_2BYTE;
-        if(start == NUM_OFFSET_DILUENT)
-            text[textPointer++] = TXT2BYTE_SpecialDiveGasMenuCCR;
-        else
-            text[textPointer++] = TXT2BYTE_SpecialDiveGasMenu;
-        text[textPointer++] = '\n';
-        text[textPointer++] = '\r';
-        text[textPointer++] = 0;
+    	if(actual_menu_content != MENU_SURFACE)
+    	{
+			text[textPointer++] = '\020';
+			text[textPointer++] = TXT_2BYTE;
+			if(start == NUM_OFFSET_DILUENT)
+				text[textPointer++] = TXT2BYTE_SpecialDiveGasMenuCCR;
+			else
+				text[textPointer++] = TXT2BYTE_SpecialDiveGasMenu;
+			text[textPointer++] = '\n';
+			text[textPointer++] = '\r';
+			text[textPointer++] = 0;
+    	}
+    	else	/* switch to bailout selection in surface mode */
+    	if((settingsGetPointer()->dive_mode == DIVEMODE_CCR) || (stateUsed->diveSettings.ccrOption == 1))
+    	{
+			text[textPointer++] = '\024';
+			if(gasMode == CCGAS_STANDARD)
+			{
+				textPointer += snprintf(&text[textPointer], 14,"Bailout\n");
+			}
+			else
+			{
+				textPointer += snprintf(&text[textPointer], 14,"Diluent\n");
+			}
+    	}
     }
 }