changeset 1061:f501d7c35c8f Icon_Integration

Show/ edit bottle size and pressure: The function to visualize bottle data was already present in an earlier implementation. The functions have be reactivated and may now be added using the compile switch "ENABLE_ADVANCED_GAS". The size of a bottle may be selected and pressure information will be displayed if it is available.
author Ideenmodellierer
date Sat, 07 Feb 2026 21:39:40 +0100
parents 3d9994033ae6
children 785772303f9c
files Discovery/Src/tMenuEditGasOC.c Discovery/Src/tMenuGas.c
diffstat 2 files changed, 72 insertions(+), 66 deletions(-) [+]
line wrap: on
line diff
--- a/Discovery/Src/tMenuEditGasOC.c	Sat Feb 07 21:36:50 2026 +0100
+++ b/Discovery/Src/tMenuEditGasOC.c	Sat Feb 07 21:39:40 2026 +0100
@@ -382,7 +382,10 @@
 /* surface mode */
 void openEdit_Gas(uint8_t line, uint8_t ccr)
 {
-    uint8_t gasID, oxygen, helium, depthDeco, active, first, depthMOD, deco, travel, inactive, off ;//, bottleSizeLiter;
+    uint8_t gasID, oxygen, helium, depthDeco, active, first, depthMOD, deco, travel, inactive, off ;
+#ifdef ENABLE_ADVANCED_GAS
+    uint8_t bottleSizeLiter;
+#endif
 
     char text[32];
     char textMOD[32];
@@ -422,7 +425,9 @@
     travel = editGasPage.pGasLine[gasID].note.ub.travel;
     off = editGasPage.pGasLine[gasID].note.ub.off;
 
-    //bottleSizeLiter = editGasPage.pGasLine[gasID].bottle_size_liter;
+#ifdef ENABLE_ADVANCED_GAS
+    bottleSizeLiter = editGasPage.pGasLine[gasID].bottle_size_liter;
+#endif
 
     if(active)
         inactive = 0;
@@ -525,15 +530,14 @@
             text[txtptr++] = 0;
             write_label_var(  20 ,800, ME_Y_LINE4, &FontT48, text);
         }
-/*
+#ifdef ENABLE_ADVANCED_GAS
         txtptr = 0;
         text[txtptr++] = TXT_2BYTE;
         text[txtptr++] = TXT2BYTE_Bottle;
         text[txtptr++] = 0;
         write_label_var(  20 ,800, ME_Y_LINE5, &FontT48, text);
         write_field_2digit(StMOG_Bottle,		600, 710, ME_Y_LINE5, &FontT48,"## ltr", (uint32_t)bottleSizeLiter, 0, 0, 0);
-
-*/
+#endif
         stop_cursor_fields();
 
         textMOD[0] = '#';
@@ -558,9 +562,9 @@
             setEvent(StMOG_ChangeDepth,		(uint32_t)OnAction_ChangeDepth);
             setEvent(StMOG_SetToMOD,		(uint32_t)OnAction_SetToMOD);
         }
-/*
+#ifdef ENABLE_ADVANCED_GAS
         setEvent(StMOG_Bottle, 				(uint32_t)OnAction_BottleSize);
-*/
+#endif
         write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext);
     }
 }
--- a/Discovery/Src/tMenuGas.c	Sat Feb 07 21:36:50 2026 +0100
+++ b/Discovery/Src/tMenuGas.c	Sat Feb 07 21:39:40 2026 +0100
@@ -79,8 +79,10 @@
     float fPpO2limitHigh = 0;
     float fPpO2ofGasAtThisDepth = 0;
     //uint8_t senderCode, depthDown,;
-    //uint16_t bar;
-    uint16_t textPointer, mod, ltr;
+#ifdef ENABLE_ADVANCED_GAS
+    uint16_t bar, ltr;
+#endif
+    uint16_t textPointer, mod;
 
     if(actual_menu_content == MENU_SURFACE)
     {
@@ -142,8 +144,10 @@
             first = pGasLine[gasId].note.ub.first;
             typeDeco = pGasLine[gasId].note.ub.deco;
             mod = calc_MOD(gasId);
+#ifdef ENABLE_ADVANCED_GAS
             ltr = pGasLine[gasId].bottle_size_liter;
-            //bar = stateUsed->lifeData.bottle_bar[gasId];
+            bar = stateUsed->lifeData.bottle_bar[gasId];
+#endif
 
 #ifdef ENABLE_UNUSED_GAS_HIDING
             if(pGasLine[gasId].note.ub.off)
@@ -176,43 +180,32 @@
             if(gasMode == OCGAS_BAILOUT_INACTIVE)
             {
                 textPointer += snprintf(&text[textPointer], 59,\
-                    "\024"
-                    " Bailout"
-                    "\031"
-                    "\034"
-                    " %3u"
-                    "\016\016"
-                    " %c%c"
-                    "\017"
-                    "\035"
+                    "\024 Bailout\031\034 %3u\016\016%c%c\017"
+#ifdef ENABLE_ADVANCED_GAS
+
+#endif
+                	"\035"
                     "\n\r",
                     unit_depth_integer(mod),
                     unit_depth_char1(),
-                    unit_depth_char2()
-                );
-/*
-                textPointer += snprintf(&text[textPointer], 57,\
-                    "\024"
-                    " Bailout"
-                    "\031"
-                    "\034"
-                    " %3u"
-                    "\016\016"
-                    "m"
-                    "\017"
-                    "  %2u"
-                    "\016\016"
-                    "ltr"
-                    "\017"
-                    " %3u"
-                    "\016\016"
-                    "bar"
-                    "\017"
-                    "\035"
-                    "\n\r",
-                    mod, ltr, bar
-                );
-*/
+                    unit_depth_char2());
+#ifdef ENABLE_ADVANCED_GAS
+					if( ltr != 0)
+					{
+						textPointer += snprintf(&text[textPointer], 20,"\007 %2u\016\016ltr\017",ltr);
+					}
+					else
+					{
+						text[textPointer++] = '\007';
+						text[textPointer++] = '\007';
+						text[textPointer++] = '\007';
+					}
+                	if( bar != 0)
+                	{
+                		textPointer += snprintf(&text[textPointer], 20,"\007 %2u\016\016bar\017",bar);
+                	}
+
+#endif
             }
             else
             {
@@ -253,7 +246,7 @@
                     "%c"
                     "%3u"
                     "\016\016"
-                    " %c%c"
+                    "%c%c"
                     "\017",
                     color[0],
                     unit_depth_integer(mod),
@@ -268,7 +261,7 @@
                         "%c"
                         "%3u"
                         "\016\016"
-                        " %c%c"
+                        "%c%c"
                         "\017",
                         color[1],
                         unit_depth_integer(depthUp),
@@ -283,27 +276,36 @@
                     text[textPointer++] = 3*25 + 20;
                 }
                 /* liter */
-/*
-                textPointer += snprintf(&text[textPointer], 12,\
-                    "%c"
-                    "  %2u"
-                    "\016\016"
-                    "ltr"
-                    "\017"
-                    , color[2],ltr
-                );
-*/
+#ifdef ENABLE_ADVANCED_GAS
+                if(ltr != 0)
+                {
+					textPointer += snprintf(&text[textPointer], 12,\
+						"%c"
+						"\007\007%2u"
+						"\016\016"
+						"ltr"
+						"\017"
+						, color[2],ltr
+					);
+                }
+                else
+                {
+                	text[textPointer++] = '\007';
+                	text[textPointer++] = '\007';
+                	text[textPointer++] = '\007';
+                }
                 /* bar */
-/*
-                textPointer += snprintf(&text[textPointer], 12,\
-                    "%c"
-                    " %3u"
-                    "\016\016"
-                    "bar"
-                    "\017",
-                    color[3], bar
-                );
-*/
+                if(bar != 0)
+                {
+					textPointer += snprintf(&text[textPointer], 12,\
+						"%c"
+						"\007%3u"
+						"\016\016"
+						"bar"
+						"\017",
+						color[3], bar);
+                }
+#endif
                 text[textPointer++] = '\035';
                 text[textPointer++] = '\n';
                 text[textPointer++] = '\r';