changeset 307:b6436edfb2c0 cleanup-4

cleanup: factor out unused stopwatch code Visually, this looks a bit of a dangerous cleanup, but its not :-) To explain this cleanup: stopwatch_seconds is never used, so assign to it is useless, and the variable can be removed. Now, stopwatch_start_at_this_dive_time_seconds is not used any more, so remove it as well. Now, look at the boolResetStopwatch code. It is used but only to reset itself. This makes the whole stopwatch block in data_exchange_main.c a useless thing. All the other cleanup is trivial. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
author Jan Mulder <jlmulder@xs4all.nl>
date Wed, 22 May 2019 22:22:15 +0200
parents 2f43419102c8
children 1203255481e4
files Common/Inc/data_central.h Discovery/Src/data_exchange_main.c Discovery/Src/simulation.c
diffstat 3 files changed, 0 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/Common/Inc/data_central.h	Wed May 22 14:39:04 2019 +0200
+++ b/Common/Inc/data_central.h	Wed May 22 22:22:15 2019 +0200
@@ -156,7 +156,6 @@
 {
 	uint32_t average_depth_meter_Count;
 	uint32_t average_depth_last_update_dive_time_seconds_without_surface_time;
-	int32_t stopwatch_start_at_this_dive_time_seconds;
 } 	SHelper;
 
 /* struct SLifeData
@@ -213,7 +212,6 @@
 	float			apnea_total_max_depth_meter;
 	float			apnea_last_max_depth_meter;
 	int32_t 	apnea_last_dive_time_seconds;
-	int32_t		stopwatch_seconds;
 	uint16_t	bottle_bar[2 * NUM_GASES +1];
 	uint16_t	bottle_bar_age_MilliSeconds[2 * NUM_GASES + 1];
 	uint16_t	apnea_total_counter;
@@ -221,7 +219,6 @@
 	/* control of DataEX_copy_to_LifeData()
 	 */
 	uint8_t boolResetAverageDepth;
-	uint8_t boolResetStopwatch;
 	uint8_t bool_temp1;
 	uint8_t bool_temp2;
 
--- a/Discovery/Src/data_exchange_main.c	Wed May 22 14:39:04 2019 +0200
+++ b/Discovery/Src/data_exchange_main.c	Wed May 22 22:22:15 2019 +0200
@@ -860,7 +860,6 @@
 			//Init dive Mode
 			decoLock = DECO_CALC_init_as_is_start_of_dive;
 			pStateReal->lifeData.boolResetAverageDepth = 1;
-			pStateReal->lifeData.boolResetStopwatch = 1;
 		}
 
 		pStateReal->lifeData.cns = dataIn.data[dataIn.boolToxicData].cns;
@@ -992,7 +991,6 @@
 		// reset max_depth_meter, average_depth_meter and internal values
 			pStateReal->lifeData.max_depth_meter = 0;
 			pStateReal->lifeData.boolResetAverageDepth = 1;
-			pStateReal->lifeData.boolResetStopwatch = 1;
 		}
 	}
 
@@ -1024,16 +1022,6 @@
 	}
 	if(*AvgDepthCount == 0)
 		*AvgDepthValue = 0;
-
-
-	/* stop watch
-	 */
-	if(pStateReal->lifeData.boolResetStopwatch)
-	{
-		pStateReal->lifeData.internal.stopwatch_start_at_this_dive_time_seconds = pStateReal->lifeData.dive_time_seconds;
-		pStateReal->lifeData.boolResetStopwatch = 0;
-	}
-	pStateReal->lifeData.stopwatch_seconds = pStateReal->lifeData.dive_time_seconds - pStateReal->lifeData.internal.stopwatch_start_at_this_dive_time_seconds;
 }
 
 
--- a/Discovery/Src/simulation.c	Wed May 22 14:39:04 2019 +0200
+++ b/Discovery/Src/simulation.c	Wed May 22 22:22:15 2019 +0200
@@ -201,7 +201,6 @@
             pDiveState->lifeData.dive_time_seconds = 0;
             pDiveState->lifeData.max_depth_meter = 0;
             pDiveState->lifeData.boolResetAverageDepth = 1;
-            pDiveState->lifeData.boolResetStopwatch = 1;
         }
     }