comparison Discovery/Src/data_exchange_main.c @ 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
comparison
equal deleted inserted replaced
306:2f43419102c8 307:b6436edfb2c0
858 settingsGetPointer()->bluetoothActive = 0; 858 settingsGetPointer()->bluetoothActive = 0;
859 MX_Bluetooth_PowerOff(); 859 MX_Bluetooth_PowerOff();
860 //Init dive Mode 860 //Init dive Mode
861 decoLock = DECO_CALC_init_as_is_start_of_dive; 861 decoLock = DECO_CALC_init_as_is_start_of_dive;
862 pStateReal->lifeData.boolResetAverageDepth = 1; 862 pStateReal->lifeData.boolResetAverageDepth = 1;
863 pStateReal->lifeData.boolResetStopwatch = 1;
864 } 863 }
865 864
866 pStateReal->lifeData.cns = dataIn.data[dataIn.boolToxicData].cns; 865 pStateReal->lifeData.cns = dataIn.data[dataIn.boolToxicData].cns;
867 pStateReal->lifeData.otu = dataIn.data[dataIn.boolToxicData].otu; 866 pStateReal->lifeData.otu = dataIn.data[dataIn.boolToxicData].otu;
868 pStateReal->lifeData.no_fly_time_minutes = dataIn.data[dataIn.boolToxicData].no_fly_time_minutes; 867 pStateReal->lifeData.no_fly_time_minutes = dataIn.data[dataIn.boolToxicData].no_fly_time_minutes;
990 pStateReal->lifeData.apnea_last_max_depth_meter = pStateReal->lifeData.max_depth_meter; 989 pStateReal->lifeData.apnea_last_max_depth_meter = pStateReal->lifeData.max_depth_meter;
991 } 990 }
992 // reset max_depth_meter, average_depth_meter and internal values 991 // reset max_depth_meter, average_depth_meter and internal values
993 pStateReal->lifeData.max_depth_meter = 0; 992 pStateReal->lifeData.max_depth_meter = 0;
994 pStateReal->lifeData.boolResetAverageDepth = 1; 993 pStateReal->lifeData.boolResetAverageDepth = 1;
995 pStateReal->lifeData.boolResetStopwatch = 1;
996 } 994 }
997 } 995 }
998 996
999 /* average depth 997 /* average depth
1000 */ 998 */
1022 } 1020 }
1023 *AvgDepthTimer = DiveTime; 1021 *AvgDepthTimer = DiveTime;
1024 } 1022 }
1025 if(*AvgDepthCount == 0) 1023 if(*AvgDepthCount == 0)
1026 *AvgDepthValue = 0; 1024 *AvgDepthValue = 0;
1027
1028
1029 /* stop watch
1030 */
1031 if(pStateReal->lifeData.boolResetStopwatch)
1032 {
1033 pStateReal->lifeData.internal.stopwatch_start_at_this_dive_time_seconds = pStateReal->lifeData.dive_time_seconds;
1034 pStateReal->lifeData.boolResetStopwatch = 0;
1035 }
1036 pStateReal->lifeData.stopwatch_seconds = pStateReal->lifeData.dive_time_seconds - pStateReal->lifeData.internal.stopwatch_start_at_this_dive_time_seconds;
1037 } 1025 }
1038 1026
1039 1027
1040 uint8_t DataEX_check_RTE_version__needs_update(void) 1028 uint8_t DataEX_check_RTE_version__needs_update(void)
1041 { 1029 {