changeset 977:f0622dd93fdf Evo_2_23

Bugfix ppo2 display in simulator mode: In the previous version a wrong ppo2 value was display if a digital O2 sensor was used. Rootcause was that the calibration data of the analog sensors was used. To fix this a default calibration coefficient is used (calibration is done within the sensor => no need to store it in OSTC) if the sensor is identified as digital O2 sensor.
author Ideenmodellierer
date Thu, 30 Jan 2025 21:24:46 +0100 (6 weeks ago)
parents 0b81ac558e89
children 57b82ae99969
files Discovery/Src/simulation.c
diffstat 1 files changed, 23 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/Discovery/Src/simulation.c	Wed Jan 29 17:21:20 2025 +0100
+++ b/Discovery/Src/simulation.c	Thu Jan 30 21:24:46 2025 +0100
@@ -183,21 +183,28 @@
 
         for(index = 0; index < 3; index++)
         {
-        	localCalibCoeff[index] = pSettings->ppo2sensors_calibCoeff[index];
-        	if(localCalibCoeff[index] < 0.01)
+        	if(pDiveState->lifeData.extIf_sensor_map[index] == SENSOR_DIGO2M)
+        	{
+        		localCalibCoeff[index] = 0.01;
+        	}
+        	else
         	{
-        		for(index2 = 0; index2 < 3; index2++)		/* no valid coeff => check other entries */
-        		{
-        			if(pSettings->ppo2sensors_calibCoeff[index2] > 0.01)
-        			{
-        				localCalibCoeff[index] = pSettings->ppo2sensors_calibCoeff[index2];
-        				break;
-        			}
-        			if(index2 == 3)		/* no coeff at all => use default */
-        			{
-        				localCalibCoeff[index] = 0.02;
-        			}
-        		}
+				localCalibCoeff[index] = pSettings->ppo2sensors_calibCoeff[index];
+				if(localCalibCoeff[index] < 0.01)
+				{
+					for(index2 = 0; index2 < 3; index2++)		/* no valid coeff => check other entries */
+					{
+						if(pSettings->ppo2sensors_calibCoeff[index2] > 0.01)
+						{
+							localCalibCoeff[index] = pSettings->ppo2sensors_calibCoeff[index2];
+							break;
+						}
+						if(index2 == 3)		/* no coeff at all => use default */
+						{
+							localCalibCoeff[index] = 0.02;
+						}
+					}
+				}
         	}
         }
 
@@ -495,7 +502,9 @@
 SDecoinfo* simulation_decoplaner(uint16_t depth_meter, uint16_t intervall_time_minutes, uint16_t dive_time_minutes, uint8_t *gasChangeListDepthGas20x2)
 {
     uint8_t ptrGasChangeList = 0; // new hw 160704
+#ifdef ENABLE_DECOCALC_OPTION
     uint8_t index = 0;
+#endif
     for (int i = 0; i < 40; i++)
     	gasChangeListDepthGas20x2[i] = 0;