changeset 281:54d14bc2083c

Fix typos (There are still many...) Limit stored NDL within 0 to 240 mins (Since it's 8bit UINT only) - I asume this is was a bug causing bad NDL readings in the logbook when downloaded with libdivecomputer
author heinrichsweikamp
date Wed, 01 May 2019 14:39:46 +0200
parents ae27d6185d51
children c7e665e0b08f
files Common/Inc/data_central.h Current build/OSTC4update_190429.bin Current build/OSTC4update_190501.bin Discovery/Src/data_central.c Discovery/Src/logbook.c Discovery/Src/test_vpm.c
diffstat 6 files changed, 27 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/Common/Inc/data_central.h	Mon Apr 29 19:25:24 2019 +0200
+++ b/Common/Inc/data_central.h	Wed May 01 14:39:46 2019 +0200
@@ -272,9 +272,9 @@
 	int16_t info_GasChange;
 	int16_t setpointChange;
 	int16_t info_SetpointChange;
-	int16_t manuelGasSet;
-	int16_t info_manuelGasSetHe;
-	int16_t info_manuelGasSetO2;
+	int16_t manualGasSet;
+	int16_t info_manualGasSetHe;
+	int16_t info_manualGasSetO2;
 	int16_t bailout;
 	int16_t info_bailoutHe;
 	int16_t info_bailoutO2;
Binary file Current build/OSTC4update_190429.bin has changed
Binary file Current build/OSTC4update_190501.bin has changed
--- a/Discovery/Src/data_central.c	Mon Apr 29 19:25:24 2019 +0200
+++ b/Discovery/Src/data_central.c	Wed May 01 14:39:46 2019 +0200
@@ -578,9 +578,9 @@
 
     if((lifeData->actualGas.nitrogen_percentage != nitrogen) || (lifeData->actualGas.helium_percentage != helium))
     {
-    	stateUsedWrite->events.manuelGasSet = 1;
-    	stateUsedWrite->events.info_manuelGasSetHe = helium;
-    	stateUsedWrite->events.info_manuelGasSetO2 = oxygen;
+    	stateUsedWrite->events.manualGasSet = 1;
+    	stateUsedWrite->events.info_manualGasSetHe = helium;
+    	stateUsedWrite->events.info_manualGasSetO2 = oxygen;
     }
     if(	lifeData->actualGas.setPoint_cbar != setpoint_cbar)
     {
--- a/Discovery/Src/logbook.c	Mon Apr 29 19:25:24 2019 +0200
+++ b/Discovery/Src/logbook.c	Wed May 01 14:39:46 2019 +0200
@@ -127,7 +127,7 @@
 /**
   ******************************************************************************
   * @brief   logbook_getCurrentHeader. /
-  * @author  Peter Ryser
+  * @author  heinrichs weikamp
   * @version V0.0.1
   * @date    22-April-2014
   ******************************************************************************
@@ -158,7 +158,7 @@
 /**
   ******************************************************************************
   * @brief   logbook_getHeader. /
-  * @author  Peter Ryser
+  * @author  heinrichs weikamp
   * @version V0.0.1
   * @date    22-April-2014
   ******************************************************************************
@@ -182,7 +182,7 @@
   *           creates header and smallHeader from diveState and global Settings
   *           and writes new lookboock entry on flash device
   *           diveState
-  * @author  Peter Ryser
+  * @author  heinrichs weikamp
   * @version V0.0.1
   * @date    22-April-2014
   ******************************************************************************
@@ -317,7 +317,7 @@
 /**
   ******************************************************************************
   * @brief   clear_divisor /  clears divisor struct
-  * @author  Peter Ryser
+  * @author  heinrichs weikamp
   * @version V0.0.1
   * @date    22-April-2014
   ******************************************************************************
@@ -338,7 +338,7 @@
 /**
   ******************************************************************************
   * @brief   add16. /  adds 16 bit variable to 8 bit array
-  * @author  Peter Ryser
+  * @author  heinrichs weikamp
   * @version V0.0.1
   * @date    22-April-2014
   ******************************************************************************
@@ -359,7 +359,7 @@
 /**
   ******************************************************************************
   * @brief   logbook_writeSample. /  Writes one logbook sampl
-  * @author  Peter Ryser
+  * @author  heinrichs weikamp
   * @date    22-April-2014
   * @version V0.0.2
   * @since   20-June-2016
@@ -426,7 +426,7 @@
         eventByte1.uw = 1;
     }
 		// sub bit 4 to 7
-    if(state->events.manuelGasSet)
+    if(state->events.manualGasSet)
     {
         eventByte1.ub.bit4 = 1;
     }
@@ -456,12 +456,12 @@
         length++;
     }
     //Add EventInfos
-    if(state->events.manuelGasSet)
+    if(state->events.manualGasSet)
     {
         //manual gas in %O2 & %He
-        sample[length] = state->events.info_manuelGasSetO2;
+        sample[length] = state->events.info_manualGasSetO2;
         length += 1;
-        sample[length] = state->events.info_manuelGasSetHe;
+        sample[length] = state->events.info_manualGasSetHe;
         length += 1;
     }
     if(state->events.gasChange)
@@ -521,6 +521,11 @@
 					sample[length] = 0;
 					length += 1;
 					sample[length] = (uint8_t)pDecoinfo->output_ndl_seconds / 60;
+
+					// Limit stored sample within 0 to 240 mins (Since it's 8bit UINT only)
+					if ((pDecoinfo->output_ndl_seconds / 60) > 240) sample[length] = 240;
+					if ((pDecoinfo->output_ndl_seconds / 60) < 0) sample[length] = 0;
+
 					length += 1;
 				}
 				else if(pDecoinfo->output_time_to_surface_seconds)
@@ -630,7 +635,7 @@
 /**
   ******************************************************************************
   * @brief   readSample. /  Reads data of one logbook sample
-  * @author  Peter Ryser
+  * @author  heinrichs weikamp
   * @version V0.0.1
   * @date    22-April-2014
   ******************************************************************************
@@ -869,7 +874,7 @@
 /**
   ******************************************************************************
   * @brief   logbook_readSampleData. /  Reads sample data of whole logbook entry
-  * @author  Peter Ryser
+  * @author  heinrichs weikamp
   * @version V0.0.1
   * @date    22-April-2014
   ******************************************************************************
@@ -1538,7 +1543,7 @@
 /**
   ******************************************************************************
   * @brief   logbook_readSampleData. /  Reads sample data of whole logbook entry
-  * @author  Peter Ryser
+  * @author  heinrichs weikamp
   * @version V0.0.1
   * @date    22-April-2014
   ******************************************************************************
--- a/Discovery/Src/test_vpm.c	Mon Apr 29 19:25:24 2019 +0200
+++ b/Discovery/Src/test_vpm.c	Wed May 01 14:39:46 2019 +0200
@@ -161,9 +161,9 @@
     pInput->warnings.decoMissed = 0;
     pInput->events.gasChange = 0;
     pInput->events.info_GasChange = 0;
-    pInput->events.info_manuelGasSetO2 = 0;
-    pInput->events.info_manuelGasSetHe = 0;
-    pInput->events.manuelGasSet = 0;
+    pInput->events.info_manualGasSetO2 = 0;
+    pInput->events.info_manualGasSetHe = 0;
+    pInput->events.manualGasSet = 0;
     pInput->warnings.ppO2High = 0;
     pInput->warnings.ppO2Low = 0;
     pInput->warnings.slowWarning = 0;