changeset 845:17d9d6eddd8d Evo_2_23

Added new PreDiveCheck info page: In case a DiveO2 sensor is connected to the OSTC than the values of the DiveO2 internal pressure and temperature sensors may be used for predive checks. The pressure sensors is used for over / under pressure test and the values are visualized using a graph to make it easier to check if the pressure keeps stable. The temperature measurement gives an indication if the scrubber is getting active. This view is highly dependend on the surface temperature but may be useful e.g. for diving in european area. In addition the values ofthe connected sensors are shown.
author Ideenmodellierer
date Sun, 21 Jan 2024 22:24:36 +0100
parents e04d7dd199fb
children 2ace67231c49
files Discovery/Inc/tInfo.h Discovery/Inc/tInfoPreDive.h Discovery/Inc/tMenuEdit.h Discovery/Inc/tMenuEditXtra.h Discovery/Inc/tStructure.h Discovery/Inc/text_multilanguage.h Discovery/Src/base.c Discovery/Src/tInfo.c Discovery/Src/tInfoPreDive.c Discovery/Src/tInfoSensor.c Discovery/Src/tMenuEdit.c Discovery/Src/tMenuEditXtra.c Discovery/Src/tMenuXtra.c Discovery/Src/text_multilanguage.c
diffstat 14 files changed, 393 insertions(+), 74 deletions(-) [+]
line wrap: on
line diff
--- a/Discovery/Inc/tInfo.h	Sun Jan 21 22:18:51 2024 +0100
+++ b/Discovery/Inc/tInfo.h	Sun Jan 21 22:24:36 2024 +0100
@@ -58,6 +58,7 @@
 void tInfo_write_field_on_off(uint32_t editID, uint16_t XleftGimpStyle, uint16_t XrightGimpStyle, uint16_t YtopGimpStyle, const tFont *Font, const char *text, uint8_t int1);
 
 void tInfo_write_buttonTextline(GFX_DrawCfgScreen *screenPtr, uint8_t left2ByteCode, char middle2ByteCode, char right2ByteCode);
+void tInfo_write_buttonTextline_simple(uint8_t left2ByteCode, char middle2ByteCode, char right2ByteCode);
 
 void tInfo_setEvent(uint32_t inputEventID, uint32_t inputFunctionCall);
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Discovery/Inc/tInfoPreDive.h	Sun Jan 21 22:24:36 2024 +0100
@@ -0,0 +1,37 @@
+///////////////////////////////////////////////////////////////////////////////
+/// -*- coding: UTF-8 -*-
+///
+/// \file   Discovery/Inc/tInfoSensor.h
+/// \brief  Infopage content for connected smart sensors
+/// \author heinrichs weikamp gmbh
+/// \date   17-11-2022
+///
+/// $Id$
+///////////////////////////////////////////////////////////////////////////////
+/// \par Copyright (c) 2014-2022 Heinrichs Weikamp gmbh
+///
+///     This program is free software: you can redistribute it and/or modify
+///     it under the terms of the GNU General Public License as published by
+///     the Free Software Foundation, either version 3 of the License, or
+///     (at your option) any later version.
+///
+///     This program is distributed in the hope that it will be useful,
+///     but WITHOUT ANY WARRANTY; without even the implied warranty of
+///     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+///     GNU General Public License for more details.
+///
+///     You should have received a copy of the GNU General Public License
+///     along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//////////////////////////////////////////////////////////////////////////////
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef TINFO_PREDIVE_H
+#define TINFO_PREDIVE_H
+
+/* Exported functions --------------------------------------------------------*/
+void openInfo_PreDive();
+void refreshInfo_PreDive(GFX_DrawCfgScreen s);
+void sendActionToInfoPreDive(uint8_t sendAction);
+
+
+#endif /* TINFO_COMPASS_H */
--- a/Discovery/Inc/tMenuEdit.h	Sun Jan 21 22:18:51 2024 +0100
+++ b/Discovery/Inc/tMenuEdit.h	Sun Jan 21 22:24:36 2024 +0100
@@ -40,6 +40,7 @@
 #define ME_Y_LINE5					(ME_Y_LINE1 + (4 * ME_Y_LINE_STEP))
 #define ME_Y_LINE6					(ME_Y_LINE1 + (5 * ME_Y_LINE_STEP))
 
+#define EXIT_TO_INFO_PREDIVE 		(245)
 #define EXIT_TO_NEXT_MENU   		(246)
 #define EXIT_TO_INFO_SENSOR 		(247)
 #define EXIT_TO_INFO_COMPASS 		(248)
--- a/Discovery/Inc/tMenuEditXtra.h	Sun Jan 21 22:18:51 2024 +0100
+++ b/Discovery/Inc/tMenuEditXtra.h	Sun Jan 21 22:24:36 2024 +0100
@@ -33,6 +33,5 @@
 
 void openEdit_Xtra(uint8_t line);
 void refresh_CompassHeading(void);
-void refresh_CO2Data(void);
 
 #endif /* TMENU_EDIT_XTRA_H */
--- a/Discovery/Inc/tStructure.h	Sun Jan 21 22:18:51 2024 +0100
+++ b/Discovery/Inc/tStructure.h	Sun Jan 21 22:24:36 2024 +0100
@@ -65,6 +65,7 @@
 #define InfoPageLogShow 3
 #define InfoPageCompass 6
 #define InfoPageSensor  8
+#define InfoPagePreDive 9
 
 #define StI 			_MB(0,1,0,0,0)
 #define StILOGLIST		_MB(0,2,0,0,0)
@@ -74,6 +75,7 @@
 #define StICOMPASS		_MB(0,6,0,0,0)
 #define StIDEBUG		_MB(0,7,0,0,0)
 #define StISENINFO		_MB(0,8,0,0,0)
+#define StIPREDIVE		_MB(0,9,0,0,0)
 
 #define StI_GoToLogbook			_MB(0,1,1,0,0)
 #define StI_GoToPlanner			_MB(0,1,2,0,0)
@@ -213,11 +215,10 @@
 #define StMXTRA_ScrubTimer_Max			_MB(2,4,3,2,0)
 #define StMXTRA_ScrubTimer_Reset		_MB(2,4,3,3,0)
 #define StMXTRA_ScrubTimer_OP_Mode		_MB(2,4,3,5,0)
-
 #define StMXTRA_PSCR_O2_Drop			_MB(2,4,4,1,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)
+#define StMXTRA_Predive_Check			_MB(2,4,5,1,0)
+
 
 
 
@@ -340,6 +341,7 @@
 #define StMSYS5_SetFactoryBC	_MB(2,8,6,11,0)
 #define StMSYS5_ResetBluetooth	_MB(2,8,6,12,0)
 #define StMSYS5_SetSampleIndx   _MB(2,8,6,13,0)
+#define StMSYS5_AdjustSurfPres  _MB(2,8,6,14,0)
 
 #define StMSYS_Custom0			_MB(2,8,1,0,0)
 #define StMSYS_Custom1			_MB(2,8,2,0,0)
--- a/Discovery/Inc/text_multilanguage.h	Sun Jan 21 22:18:51 2024 +0100
+++ b/Discovery/Inc/text_multilanguage.h	Sun Jan 21 22:24:36 2024 +0100
@@ -121,6 +121,7 @@
 		TXT_Apnoe,
 		TXT_Gauge,
 		TXT_PSClosedCircuit,
+		TXT_PreDive,
 		TXT_Sensor,
 		TXT_FixedSP,
 		TXT_Decoparameters,
@@ -320,6 +321,7 @@
 		TXT2BYTE_Sensor,
 		TXT2BYTE_Maintenance,
 		TXT2BYTE_SetBatteryCharge,
+		TXT2BYTE_AdjustAmbPressure,
 		TXT2BYTE_SetFactoryDefaults,
 		TXT2BYTE_ResetBluetooth,
 		TXT2BYTE_SetSampleIndex,
@@ -371,6 +373,9 @@
         TXT2BYTE_Clear,
         TXT2BYTE_Reset,
 
+		TXT2BYTE_CounterLung,
+		TXT2BYTE_Pressure,
+
         TXT2BYTE_Timer,
         TXT2BYTE_Starting,
         TXT2BYTE_Finished,
--- a/Discovery/Src/base.c	Sun Jan 21 22:18:51 2024 +0100
+++ b/Discovery/Src/base.c	Sun Jan 21 22:24:36 2024 +0100
@@ -213,6 +213,7 @@
 #include "tInfo.h"
 #include "tInfoLog.h"
 #include "tInfoSensor.h"
+#include "tInfoPreDive.h"
 #include "tMenu.h"
 #include "tMenuEdit.h"
 #include "tMenuEditGasOC.h"
@@ -898,6 +899,8 @@
 								break;
 							case InfoPageSensor: 	sendActionToInfoSensor(action);
 								break;
+							case InfoPagePreDive: 	sendActionToInfoPreDive(action);
+								break;
 							default:				sendActionToInfo(action);
 								break;
 						}
--- a/Discovery/Src/tInfo.c	Sun Jan 21 22:18:51 2024 +0100
+++ b/Discovery/Src/tInfo.c	Sun Jan 21 22:24:36 2024 +0100
@@ -37,6 +37,7 @@
 //#include "tInfoSurface.h"
 #include "tInfoCompass.h"
 #include "tInfoSensor.h"
+#include "tInfoPreDive.h"
 #include "tMenu.h"
 #include "tMenuEdit.h"
 
@@ -222,6 +223,11 @@
     							infoColor = CLUT_MenuPageHardware;
     							refreshInfo_Sensor(tIscreen);
     				break;
+    		case StIPREDIVE: 	tIscreen.FBStartAdress = getFrame(14);
+    							infoColor = CLUT_MenuPageGasCC;
+    							refreshInfo_PreDive(tIscreen);
+    				break;
+
     		default:
     				break;
     	}
@@ -819,3 +825,33 @@
         write_content_simple(screenPtr, 0, 800, 480-24, &FontT24,localtext,CLUT_ButtonSurfaceScreen);
     }
 }
+void tInfo_write_buttonTextline_simple(uint8_t left2ByteCode, char middle2ByteCode, char right2ByteCode)
+{
+    char localtext[32];
+
+    if(left2ByteCode)
+    {
+        localtext[0] = TXT_2BYTE;
+        localtext[1] = left2ByteCode;
+        localtext[2] = 0;
+        tInfo_write_content_simple(0, 800, 480-24, &FontT24,localtext,CLUT_ButtonSurfaceScreen);
+    }
+
+    if(middle2ByteCode)
+    {
+        localtext[0] = '\001';
+        localtext[1] = TXT_2BYTE;
+        localtext[2] = middle2ByteCode;
+        localtext[3] = 0;
+        tInfo_write_content_simple(0, 800, 480-24, &FontT24,localtext,CLUT_ButtonSurfaceScreen);
+    }
+
+    if(right2ByteCode)
+    {
+        localtext[0] = '\002';
+        localtext[1] = TXT_2BYTE;
+        localtext[2] = right2ByteCode;
+        localtext[3] = 0;
+        tInfo_write_content_simple(0, 800, 480-24, &FontT24,localtext,CLUT_ButtonSurfaceScreen);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Discovery/Src/tInfoPreDive.c	Sun Jan 21 22:24:36 2024 +0100
@@ -0,0 +1,245 @@
+///////////////////////////////////////////////////////////////////////////////
+/// -*- coding: UTF-8 -*-
+///
+/// \file   Discovery/Src/tInfoPredive.c
+/// \brief  Show information which might be of interest during predive checks
+/// \author heinrichs weikamp gmbh
+/// \date   23-Feb-2015
+///
+/// \details
+///
+/// $Id$
+///////////////////////////////////////////////////////////////////////////////
+/// \par Copyright (c) 2014-2018 Heinrichs Weikamp gmbh
+///
+///     This program is free software: you can redistribute it and/or modify
+///     it under the terms of the GNU General Public License as published by
+///     the Free Software Foundation, either version 3 of the License, or
+///     (at your option) any later version.
+///
+///     This program is distributed in the hope that it will be useful,
+///     but WITHOUT ANY WARRANTY; without even the implied warranty of
+///     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+///     GNU General Public License for more details.
+///
+///     You should have received a copy of the GNU General Public License
+///     along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//////////////////////////////////////////////////////////////////////////////
+
+/* Includes ------------------------------------------------------------------*/
+
+#include "gfx_engine.h"
+#include "gfx_fonts.h"
+#include "tHome.h"
+#include "tInfo.h"
+#include "tInfoPreDive.h"
+#include "tMenuEdit.h"
+#include "data_exchange_main.h"
+
+#include <string.h>
+#include <inttypes.h>
+
+#define MEASURE_INTERVALL		(10u)	/* refresh function should be called every 100ms => one second interval */
+#define HISTORY_BUF_SIZE 		(240u)	/* store 240 entries a one second */
+#define INVALID_PRESSURE_VALUE	(0xFFFF)
+#define DELTA_SHIFT				(50)	/* the graph printers do not support negative values => shift data into positiv area (assumes pressure range +- 300mBar) */
+
+/* Private variables ---------------------------------------------------------*/
+static uint16_t surfacePressureStart = INVALID_PRESSURE_VALUE;
+static uint16_t surfaceTemperatureStart = 0;
+static uint16_t pressureHistory[HISTORY_BUF_SIZE];
+static uint8_t pressureHistoryIndex = 0;
+static uint16_t temperatureHistory[HISTORY_BUF_SIZE];
+static uint8_t temperatureHistoryIndex = 0;
+static uint8_t measureCnt = MEASURE_INTERVALL;
+static uint8_t referenceSensor = 0xff;
+
+/* Exported functions --------------------------------------------------------*/
+
+
+
+static void storePressureValue(int16_t deltapressure_mBar)
+{
+	uint16_t newValue = DELTA_SHIFT - deltapressure_mBar;	/* invert value because graph is drawing larger values to bottom direction */
+	if(pressureHistoryIndex + 2 < HISTORY_BUF_SIZE)
+	{
+		pressureHistoryIndex++;
+		pressureHistory[pressureHistoryIndex] = newValue;
+		pressureHistoryIndex++;
+		pressureHistory[pressureHistoryIndex] = newValue;
+	}
+	else
+	{
+		memcpy (&pressureHistory[0],&pressureHistory[2],sizeof(pressureHistory) - 2);
+		pressureHistory[pressureHistoryIndex] = newValue;
+	}
+}
+
+static void storeTemperatureValue(uint16_t temperature)
+{
+	uint16_t newValue =  temperature;		/* todo: consider negativ temperature */
+	if(temperatureHistoryIndex + 2 < HISTORY_BUF_SIZE)
+	{
+		temperatureHistoryIndex++;
+		temperatureHistory[temperatureHistoryIndex] = newValue;
+		temperatureHistoryIndex++;
+		temperatureHistory[temperatureHistoryIndex] = newValue;
+	}
+	else
+	{
+		memcpy (&temperatureHistory[0],&temperatureHistory[2],sizeof(temperatureHistory) - 2);
+		temperatureHistory[temperatureHistoryIndex] = newValue;
+	}
+}
+
+void openInfo_PreDive()
+{
+	const SDiveState *pStateReal = stateRealGetPointer();
+	uint8_t index = 0;
+	SSensorDataDiveO2* pDiveO2Data = NULL;
+	SSettings *pSettings = settingsGetPointer();
+    set_globalState(StIPREDIVE);
+
+    surfacePressureStart = 0;
+    pressureHistoryIndex = 0;
+    referenceSensor = 0xff;
+
+	for(index = 0; index < EXT_INTERFACE_MUX_OFFSET; index++)
+	{
+		if((pSettings->ext_sensor_map[index] == SENSOR_DIGO2M) &&  pStateReal->lifeData.ppO2Sensor_bar[index] != 0)
+		{
+			referenceSensor = index;
+			pDiveO2Data = (SSensorDataDiveO2*)stateRealGetPointer()->lifeData.extIf_sensor_data[index];
+			if(pDiveO2Data->pressure != 0)
+			{
+				surfacePressureStart = pDiveO2Data->pressure / 1000;
+				surfaceTemperatureStart = pDiveO2Data->temperature;
+			}
+			break;
+		}
+	}
+    for(index = 0; index < HISTORY_BUF_SIZE; index++)
+    {
+    	pressureHistory[index] = DELTA_SHIFT;
+    	temperatureHistory[index] = 0;
+    }
+}
+
+void refreshInfo_PreDive(GFX_DrawCfgScreen s)
+{
+	const SDiveState *pStateReal = stateRealGetPointer();
+	static int16_t deltaPressure = 0;
+	static uint16_t temperature = 0;
+	SSettings *pSettings = settingsGetPointer();
+	uint8_t index = 0;
+    char text[31];
+    SSensorDataDiveO2* pDiveO2Data = NULL;
+    point_t start, stop;
+
+    SWindowGimpStyle wintempppO2;
+    SWindowGimpStyle wintemptemp;
+
+    if(--measureCnt == 0)
+    {
+    	measureCnt = MEASURE_INTERVALL;
+    	pDiveO2Data = (SSensorDataDiveO2*)stateRealGetPointer()->lifeData.extIf_sensor_data[referenceSensor];
+    	if(pDiveO2Data->pressure != 0)
+    	{
+    		if(surfacePressureStart == 0)
+    		{
+    			surfacePressureStart = pDiveO2Data->pressure / 1000;
+    			surfaceTemperatureStart = pDiveO2Data->temperature;
+    		}
+    		deltaPressure = (pDiveO2Data->pressure / 1000) - surfacePressureStart;
+    		storePressureValue(deltaPressure);
+    		temperature = pDiveO2Data->temperature;
+    		storeTemperatureValue(temperature);
+    	}
+    }
+
+    text[0] = '\001';
+	text[1] = TXT_PreDive;
+	text[2] = 0;
+	tInfo_write_content_simple(  30, 770, ME_Y_LINE_BASE, &FontT48, text, CLUT_MenuPageHardware);
+
+	for(index = 0; index < EXT_INTERFACE_MUX_OFFSET; index++)
+	{
+		if(pSettings->ext_sensor_map[index] == SENSOR_DIGO2M)
+		{
+			snprintf(text,32,"%c%c%d: %01.2f", TXT_2BYTE, TXT2BYTE_Sensor, index, pStateReal->lifeData.ppO2Sensor_bar[index]);
+			tInfo_write_content_simple(  30, 200, ME_Y_LINE1 + (index * ME_Y_LINE_STEP), &FontT48, text, CLUT_Font020);
+		}
+		else if(pSettings->ext_sensor_map[index] == SENSOR_CO2M)
+		{
+			snprintf(text,32,"CO2: %4ld", pStateReal->lifeData.CO2_data.CO2_ppm);
+			tInfo_write_content_simple(  30, 200, ME_Y_LINE5, &FontT48, text, CLUT_Font020);
+		}
+	}
+
+    wintempppO2.left = 350;
+    wintempppO2.right = 590;
+
+    wintemptemp.left = 350;
+    wintemptemp.right = 590;
+
+    if(!pSettings->FlipDisplay)
+    {
+    	wintempppO2.top = ME_Y_LINE3;
+    	wintempppO2.bottom = wintempppO2.top + DELTA_SHIFT * 2;
+    	wintemptemp.top = ME_Y_LINE5;
+    	wintemptemp.bottom = wintemptemp.top + DELTA_SHIFT * 2;
+    }
+    else
+    {
+    	wintempppO2.top = 470;		/* TODO: consider flip display */
+    	wintempppO2.bottom = wintempppO2.top + 100;
+    }
+    GFX_graph_print(&s, &wintempppO2, 1,1,0, DELTA_SHIFT * 2, pressureHistory, HISTORY_BUF_SIZE, CLUT_Font030, NULL);
+
+    GFX_graph_print(&s, &wintemptemp, 1,1, surfaceTemperatureStart - 2000, surfaceTemperatureStart + 10000, temperatureHistory, HISTORY_BUF_SIZE, CLUT_Font030, NULL);
+
+    start.x =  wintempppO2.left - 5;
+    start.y =  480 - wintemptemp.bottom - 5;
+    stop.x = wintempppO2.right- start.x + 5;
+    stop.y = DELTA_SHIFT * 2 + 10;
+    GFX_draw_box(&s, start, stop,1, CLUT_Font020);
+
+    start.y =  480 - wintempppO2.bottom - 5;
+    GFX_draw_box(&s, start, stop,1, CLUT_Font020);
+
+/* Graph labeling */
+    snprintf(text,32,"%c%c", TXT_2BYTE, TXT2BYTE_CounterLung);
+   	tInfo_write_content_simple(  350, 780, ME_Y_LINE2, &FontT48, text, CLUT_Font020);
+
+   	snprintf(text,32,"\002\016\016%c%c", TXT_2BYTE, TXT2BYTE_Pressure);
+   	tInfo_write_content_simple(  600, 780, ME_Y_LINE3, &FontT48, text, CLUT_Font020);
+    snprintf(text,32,"\002%d",deltaPressure);
+	tInfo_write_content_simple(  600, 780, ME_Y_LINE4, &FontT48, text, CLUT_Font020);
+	snprintf(text,32,"\002\016\016%c",TXT_Temperature);
+	tInfo_write_content_simple(  600, 780, ME_Y_LINE5, &FontT48, text, CLUT_Font020);
+    snprintf(text,32,"\002%2.2f",(temperature / 1000.0));
+	tInfo_write_content_simple(  600, 780, ME_Y_LINE6, &FontT48, text, CLUT_Font020);
+}
+
+void sendActionToInfoPreDive(uint8_t sendAction)
+{
+    switch(sendAction)
+    {
+    	case ACTION_BUTTON_BACK:
+    	//	exitInfo();
+    		exitMenuEdit_to_Menu_with_Menu_Update();
+    			break;
+
+    	case ACTION_BUTTON_ENTER:
+    		break;
+		case ACTION_BUTTON_NEXT:
+			break;
+		case ACTION_TIMEOUT:
+		case ACTION_MODE_CHANGE:
+	    case ACTION_IDLE_TICK:
+	    case ACTION_IDLE_SECOND:
+		default:
+	        break;
+    }
+}
+
--- a/Discovery/Src/tInfoSensor.c	Sun Jan 21 22:18:51 2024 +0100
+++ b/Discovery/Src/tInfoSensor.c	Sun Jan 21 22:24:36 2024 +0100
@@ -109,36 +109,6 @@
 	strcpy(pbuf,&tmpBuf[index+1]);
 }
 
-void tInfo_write_buttonTextline_simple(uint8_t left2ByteCode, char middle2ByteCode, char right2ByteCode)
-{
-    char localtext[32];
-
-    if(left2ByteCode)
-    {
-        localtext[0] = TXT_2BYTE;
-        localtext[1] = left2ByteCode;
-        localtext[2] = 0;
-        tInfo_write_content_simple(0, 800, 480-24, &FontT24,localtext,CLUT_ButtonSurfaceScreen);
-    }
-
-    if(middle2ByteCode)
-    {
-        localtext[0] = '\001';
-        localtext[1] = TXT_2BYTE;
-        localtext[2] = middle2ByteCode;
-        localtext[3] = 0;
-        tInfo_write_content_simple(0, 800, 480-24, &FontT24,localtext,CLUT_ButtonSurfaceScreen);
-    }
-
-    if(right2ByteCode)
-    {
-        localtext[0] = '\002';
-        localtext[1] = TXT_2BYTE;
-        localtext[2] = right2ByteCode;
-        localtext[3] = 0;
-        tInfo_write_content_simple(0, 800, 480-24, &FontT24,localtext,CLUT_ButtonSurfaceScreen);
-    }
-}
 
 static void refreshInfo_SensorO2(GFX_DrawCfgScreen s)
 {
--- a/Discovery/Src/tMenuEdit.c	Sun Jan 21 22:18:51 2024 +0100
+++ b/Discovery/Src/tMenuEdit.c	Sun Jan 21 22:24:36 2024 +0100
@@ -36,6 +36,7 @@
 #include "tHome.h"
 #include "tInfoCompass.h"
 #include "tInfoSensor.h"
+#include "tInfoPreDive.h"
 #include "tMenuEditHardware.h"
 #include "tMenuEditPlanner.h"
 #include "tMenuEditSystem.h"
@@ -216,20 +217,10 @@
 	 	 	 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;
-            }
-
-			break;
-	 	 case (StMXTRA_CO2_Sensor & MaskFieldDigit):  refreshFct = refresh_CO2Data;
-	 	 	 break;
 	 	 case (StMSYS4_Info & MaskFieldDigit): refreshFct = &refresh_InformationPage;
 	 	 	 break;
 	 	 case (StMPLAN5_ExitResult & MaskFieldDigit): refreshFct = refresh_PlanResult;
--- a/Discovery/Src/tMenuEditXtra.c	Sun Jan 21 22:18:51 2024 +0100
+++ b/Discovery/Src/tMenuEditXtra.c	Sun Jan 21 22:24:36 2024 +0100
@@ -38,6 +38,7 @@
 #include "data_exchange_main.h"
 #include "motion.h"
 #include "configuration.h"
+#include "tInfoPreDive.h"
 
 
 /* Private function prototypes -----------------------------------------------*/
@@ -107,11 +108,6 @@
     }
     else /* surface mode */
     {
-        if((settingsGetPointer()->dive_mode != DIVEMODE_PSCR) && (line > 3))		/* PSCR items are only optional */
-		{
-			line = 6;
-		}
-
 		switch(line)
 		{
 			case 1: openEdit_CCRModeSensorOrFixedSP();
@@ -124,6 +120,8 @@
 			case 4: openEdit_PSCR();
 				break;
 #endif
+			case 5:	openInfo_PreDive();
+				break;
 			default:
 				break;
 		}
@@ -395,23 +393,6 @@
 }
 
 
-void refresh_CO2Data(void)
-{
-    char text[32];
-
-    snprintf(text,32,"\001%c",TXT_CO2Sensor);
-    write_topline(text);
-
-    snprintf(text,32,"CO2: %ld ppm",stateUsed->lifeData.CO2_data.CO2_ppm);
-    write_label_var(   30, 800, ME_Y_LINE1, &FontT48, text);
-
-    snprintf(text,32,"Signal: %d",stateUsed->lifeData.CO2_data.signalStrength);
-    write_label_var(   30, 800, ME_Y_LINE2, &FontT48, text);
-
-    tMenuEdit_refresh_field(StMXTRA_CO2_Sensor);
-    tMenuEdit_refresh_field(StMXTRA_CO2_Sensor_Calib);
-}
-
 void openEdit_CompassHeading(void)
 {
     drawCompassHeadingMenu(false);
--- a/Discovery/Src/tMenuXtra.c	Sun Jan 21 22:18:51 2024 +0100
+++ b/Discovery/Src/tMenuXtra.c	Sun Jan 21 22:24:36 2024 +0100
@@ -190,16 +190,33 @@
         }
 
 #ifdef ENABLE_PSCR_MODE
-        if(pSettings->dive_mode == DIVEMODE_PSCR)
+        if((line == 0) || (line == 4))
+         {
+			if(pSettings->dive_mode == DIVEMODE_PSCR)
+			{
+				textPointer += snprintf(&text[textPointer], 60, "%c",TXT_PSClosedCircuit);
+				enableLine(StMXTRA_PSCR_O2_Drop);
+			}
+			else
+			{
+				text[textPointer++] = '\031';		/* change text color */
+				textPointer += snprintf(&text[textPointer], 60,"%c",TXT_PSClosedCircuit);
+				text[textPointer++] = '\020';		/* restore text color */
+				disableLine(StMXTRA_PSCR_O2_Drop);
+			}
+            strcpy(&text[textPointer],"\n\r");
+            textPointer += 2;
+         }
+#endif
+        if((pSettings->ppo2sensors_source == O2_SENSOR_SOURCE_ANADIG) || (pSettings->ppo2sensors_source == O2_SENSOR_SOURCE_DIGITAL))
         {
-            if((line == 0) || (line == 4))
-             {
-                 textPointer += snprintf(&text[textPointer], 60,\
-                             "%c"
-                             ,TXT_PSClosedCircuit);
-             }
+        	if((line == 0) || (line == 5))
+        	{
+        	                 textPointer += snprintf(&text[textPointer], 60,\
+        	                             "%c"
+        	                             ,TXT_PreDive);
+        	}
         }
-#endif
     }
     return StMXTRA;
 }
--- a/Discovery/Src/text_multilanguage.c	Sun Jan 21 22:18:51 2024 +0100
+++ b/Discovery/Src/text_multilanguage.c	Sun Jan 21 22:24:36 2024 +0100
@@ -470,6 +470,12 @@
 static uint8_t text_IT_PSClosedCircuit[] = "PSC circuit";
 static uint8_t text_ES_PSClosedCircuit[] = "PSC circuit";
 
+static uint8_t text_EN_PreDive[] = "PreDive Check";
+static uint8_t text_DE_PreDive[] = "";
+static uint8_t text_FR_PreDive[] = "";
+static uint8_t text_IT_PreDive[] = "";
+static uint8_t text_ES_PreDive[] = "";
+
 static uint8_t text_EN_ChargeHour[] = "Hour(s) till 100%";
 static uint8_t text_DE_ChargeHour[] = "Stunde(n) bis 100%";
 static uint8_t text_FR_ChargeHour[] = "";
@@ -642,6 +648,13 @@
 static uint8_t text_ES_SetBatteryCharge[] = "Recalibrar nivel carga";
 
 // Menu SYS2 sub
+static uint8_t text_EN_AdjustAmbPressure[] = "Adjust pressure";
+static uint8_t text_DE_AdjustAmbPressure[] = "Druckanpassung";
+static uint8_t text_FR_AdjustAmbPressure[] = "";
+static uint8_t text_IT_AdjustAmbPressure[] = "";
+static uint8_t text_ES_AdjustAmbPressure[] = "";
+
+// Menu SYS2 sub
 static uint8_t text_EN_SetFactoryDefaults[] = "Store button factory defaults";
 static uint8_t text_DE_SetFactoryDefaults[] = "Taster zurücksetzen";
 static uint8_t text_FR_SetFactoryDefaults[] = "";
@@ -808,6 +821,19 @@
 static uint8_t text_IT_Reset[] = "Ripristina";
 static uint8_t text_ES_Reset[] = "Restaurar";
 
+static uint8_t text_EN_CounterLung[] = "Counterlung";
+static uint8_t text_DE_CounterLung[] = "Gegenlunge";
+static uint8_t text_FR_CounterLung[] = "";
+static uint8_t text_IT_CounterLung[] = "";
+static uint8_t text_ES_CounterLung[] = "";
+
+static uint8_t text_EN_Pressure[] = "Pressure";
+static uint8_t text_DE_Pressure[] = "Druck";
+static uint8_t text_FR_Pressure[] = "";
+static uint8_t text_IT_Pressure[] = "";
+static uint8_t text_ES_Pressure[] = "";
+
+
 // Menu SIM
 static uint8_t text_EN_Simulator[] = "Simulator";
 static uint8_t text_DE_Simulator[] = "";
@@ -1974,6 +2000,7 @@
     {(uint8_t)TXT_Apnoe,	 		{text_EN_Apnoe, text_DE_Apnoe, text_FR_Apnoe, text_IT_Apnoe, text_ES_Apnoe}},
     {(uint8_t)TXT_Gauge,	 		{text_EN_Gauge, text_DE_Gauge, text_FR_Gauge, text_IT_Gauge, text_ES_Gauge}},
     {(uint8_t)TXT_PSClosedCircuit,  {text_EN_PSClosedCircuit, text_DE_PSClosedCircuit, text_FR_PSClosedCircuit, text_IT_PSClosedCircuit, text_ES_PSClosedCircuit}},
+	{(uint8_t)TXT_PreDive,  		{text_EN_PreDive, text_DE_PreDive, text_FR_PreDive, text_IT_PreDive, text_ES_PreDive}},
 	{(uint8_t)TXT_Sensor,			{text_EN_Sensor, text_DE_Sensor, text_FR_Sensor, text_IT_Sensor, text_ES_Sensor}},
     {(uint8_t)TXT_FixedSP,			{text_EN_FixedSP, text_DE_FixedSP, text_FR_FixedSP, text_IT_FixedSP, text_ES_FixedSP}},
     {(uint8_t)TXT_Decoparameters,	{text_EN_Decoparameters, text_DE_Decoparameters, text_FR_Decoparameters, text_IT_Decoparameters, text_ES_Decoparameters}},
@@ -2141,6 +2168,7 @@
     {(uint8_t)TXT2BYTE_Sensor,			{text_EN_SensorList, text_DE_SensorList, text_FR_SensorList, text_IT_SensorList, text_ES_SensorList}},
     {(uint8_t)TXT2BYTE_Maintenance,		{text_EN_Maintenance, text_DE_Maintenance, text_FR_Maintenance, text_IT_Maintenance, text_ES_Maintenance}},
     {(uint8_t)TXT2BYTE_SetBatteryCharge,{text_EN_SetBatteryCharge, text_DE_SetBatteryCharge, text_FR_SetBatteryCharge, text_IT_SetBatteryCharge, text_ES_SetBatteryCharge}},
+	{(uint8_t)TXT2BYTE_AdjustAmbPressure,{text_EN_AdjustAmbPressure, text_DE_AdjustAmbPressure, text_FR_AdjustAmbPressure, text_IT_AdjustAmbPressure, text_ES_AdjustAmbPressure}},
     {(uint8_t)TXT2BYTE_SetFactoryDefaults,{text_EN_SetFactoryDefaults, text_DE_SetFactoryDefaults, text_FR_SetFactoryDefaults, text_IT_SetFactoryDefaults, text_ES_SetFactoryDefaults}},
 	{(uint8_t)TXT2BYTE_SetSampleIndex,  {text_EN_SetSampleIndex, text_DE_SetSampleIndex, text_FR_SetSampleIndex, text_IT_SetSampleIndex, text_ES_SetSampleIndex}},
 
@@ -2192,6 +2220,9 @@
 	{(uint8_t)TXT2BYTE_Clear, 	{text_EN_Clear, text_DE_Clear, text_FR_Clear, text_IT_Clear, text_ES_Clear}},
 	{(uint8_t)TXT2BYTE_Reset, 	{text_EN_Reset, text_DE_Reset, text_FR_Reset, text_IT_Reset, text_ES_Reset}},
 
+	{(uint8_t)TXT2BYTE_CounterLung, 	{text_EN_CounterLung, text_DE_CounterLung, text_FR_CounterLung, text_IT_CounterLung, text_ES_CounterLung}},
+	{(uint8_t)TXT2BYTE_Pressure, 	{text_EN_Pressure, text_DE_Pressure, text_FR_Pressure, text_IT_Pressure, text_ES_Pressure}},
+
 	{(uint8_t)TXT2BYTE_Timer, 	{text_EN_Timer, text_DE_Timer, text_FR_Timer, text_IT_Timer, text_ES_Timer}},
 	{(uint8_t)TXT2BYTE_Starting, 	{text_EN_Starting, text_DE_Starting, text_FR_Starting, text_IT_Starting, text_ES_Starting}},
 	{(uint8_t)TXT2BYTE_Finished, 	{text_EN_Finished, text_DE_Finished, text_FR_Finished, text_IT_Finished, text_ES_Finished}},