changeset 337:38367bb982b8 PressureMeasure_Improvment

Set Max value for pressure offset to 50mBar (20mBar before) Some OSTC4 might have a higher delta and need a bigger offset
author ideenmodellierer
date Sat, 17 Aug 2019 18:47:08 +0200
parents 449e9e9632e4
children b6a59e93cc91
files Common/Inc/settings.h Discovery/Src/settings.c
diffstat 2 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/Common/Inc/settings.h	Sat Aug 17 18:44:43 2019 +0200
+++ b/Common/Inc/settings.h	Sat Aug 17 18:47:08 2019 +0200
@@ -66,6 +66,8 @@
 #define DDMMYY 1
 #define YYMMDD 2
 
+#define PRESSURE_OFFSET_LIMIT_MBAR	50
+
 /*	2015 Jan 30, hw, deco and travel added for MenuEditGas
 	* can be used for buehlmann, vpm, etc. later but be carefull
 	*	with current implemenation */
--- a/Discovery/Src/settings.c	Sat Aug 17 18:44:43 2019 +0200
+++ b/Discovery/Src/settings.c	Sat Aug 17 18:47:08 2019 +0200
@@ -1219,8 +1219,8 @@
 
 /*	int8_t offsetPressure_mbar;
  */
-    if((Settings.offsetPressure_mbar > 20) ||
-         (Settings.offsetPressure_mbar < -20))
+    if((Settings.offsetPressure_mbar > PRESSURE_OFFSET_LIMIT_MBAR) ||
+         (Settings.offsetPressure_mbar < -1 * PRESSURE_OFFSET_LIMIT_MBAR))
     {
         Settings.offsetPressure_mbar = 0;
         corrections++;
@@ -1730,13 +1730,13 @@
                 if(data[1] & 0x80)
                 {
                     data[1] = ~(data[1]);
-                    if(!checkValue(data[1],0,20))
+                    if(!checkValue(data[1],0,PRESSURE_OFFSET_LIMIT_MBAR))
                             return ERROR_;
                     Settings.offsetPressure_mbar = 0 - data[1];
                 }
                 else
                 {
-                    if(!checkValue(data[1],0,20))
+                    if(!checkValue(data[1],0,PRESSURE_OFFSET_LIMIT_MBAR))
                             return ERROR_;
                     Settings.offsetPressure_mbar = data[1];
                 }
@@ -2094,12 +2094,12 @@
 
     case 0x35:
         data[datacounter++] =  PARAM_SINT;
-        data[datacounter++] = (uint8_t)(256 - 20); // == -20
+        data[datacounter++] = (uint8_t)(256 - PRESSURE_OFFSET_LIMIT_MBAR); // == -20
         if(settingsGetPointerStandard()->offsetPressure_mbar < 0)
             data[datacounter++] = (uint8_t)(127 - settingsGetPointerStandard()->offsetPressure_mbar);
         else
             data[datacounter++] = settingsGetPointerStandard()->offsetPressure_mbar;
-        data[datacounter++] = 20;
+        data[datacounter++] = PRESSURE_OFFSET_LIMIT_MBAR;
         break;
 
     case 0x36: