# HG changeset patch # User Jan Mulder # Date 1558556535 -7200 # Node ID b6436edfb2c0224b61afb150da277fc45bd1a427 # Parent 2f43419102c8e43a64d21dcc9b2d3a6ff5db7a1b 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 diff -r 2f43419102c8 -r b6436edfb2c0 Common/Inc/data_central.h --- 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; diff -r 2f43419102c8 -r b6436edfb2c0 Discovery/Src/data_exchange_main.c --- 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; } diff -r 2f43419102c8 -r b6436edfb2c0 Discovery/Src/simulation.c --- 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; } }