comparison Discovery/Src/data_exchange_main.c @ 197:c853f5d23bb7 div-fixes-cleaup-2

cleanup: fix (harmless) use before assign While looking around for possible wrong CNS values in the logbook header, I see this "interesting" thing. Simply assign the current CNS data to the global state, before using it to issue a warning. In practice, this does not fix any real bug, as the code is run very often, so the global state data is always (very) recent. It simply does not look right. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
author Jan Mulder <jlmulder@xs4all.nl>
date Thu, 21 Mar 2019 11:41:59 +0100
parents 8b8074080d7b
children 878dc9e0dbc5
comparison
equal deleted inserted replaced
196:2885628ab3ba 197:c853f5d23bb7
918 decoLock = DECO_CALC_init_as_is_start_of_dive; 918 decoLock = DECO_CALC_init_as_is_start_of_dive;
919 pStateReal->lifeData.boolResetAverageDepth = 1; 919 pStateReal->lifeData.boolResetAverageDepth = 1;
920 pStateReal->lifeData.boolResetStopwatch = 1; 920 pStateReal->lifeData.boolResetStopwatch = 1;
921 } 921 }
922 922
923 pStateReal->lifeData.cns = dataIn.data[dataIn.boolToxicData].cns;
924 pStateReal->lifeData.otu = dataIn.data[dataIn.boolToxicData].otu;
925 pStateReal->lifeData.no_fly_time_minutes = dataIn.data[dataIn.boolToxicData].no_fly_time_minutes;
926 pStateReal->lifeData.desaturation_time_minutes = dataIn.data[dataIn.boolToxicData].desaturation_time_minutes;
927
923 //End of diveMode? 928 //End of diveMode?
924 if(pStateReal->mode == MODE_DIVE && dataIn.mode != MODE_DIVE) 929 if(pStateReal->mode == MODE_DIVE && dataIn.mode != MODE_DIVE)
925 { 930 {
926 if(modeChangeFlag) 931 if(modeChangeFlag)
927 { 932 {
987 pStateReal->lifeData.compass_DZ_f = dataIn.data[dataIn.boolCompassData].compass_DZ_f; 992 pStateReal->lifeData.compass_DZ_f = dataIn.data[dataIn.boolCompassData].compass_DZ_f;
988 993
989 pStateReal->compass_uTick_old = pStateReal->compass_uTick_new; 994 pStateReal->compass_uTick_old = pStateReal->compass_uTick_new;
990 pStateReal->compass_uTick_new = dataIn.data[dataIn.boolCompassData].compass_uTick; 995 pStateReal->compass_uTick_new = dataIn.data[dataIn.boolCompassData].compass_uTick;
991 pStateReal->compass_uTick_local_new = HAL_GetTick(); 996 pStateReal->compass_uTick_local_new = HAL_GetTick();
992
993 pStateReal->lifeData.cns = dataIn.data[dataIn.boolToxicData].cns;
994 pStateReal->lifeData.otu = dataIn.data[dataIn.boolToxicData].otu;
995 pStateReal->lifeData.no_fly_time_minutes = dataIn.data[dataIn.boolToxicData].no_fly_time_minutes;
996 pStateReal->lifeData.desaturation_time_minutes = dataIn.data[dataIn.boolToxicData].desaturation_time_minutes;
997 997
998 memcpy(pStateReal->lifeData.tissue_nitrogen_bar, dataIn.data[dataIn.boolTisssueData].tissue_nitrogen_bar,sizeof(pStateReal->lifeData.tissue_nitrogen_bar)); 998 memcpy(pStateReal->lifeData.tissue_nitrogen_bar, dataIn.data[dataIn.boolTisssueData].tissue_nitrogen_bar,sizeof(pStateReal->lifeData.tissue_nitrogen_bar));
999 memcpy(pStateReal->lifeData.tissue_helium_bar, dataIn.data[dataIn.boolTisssueData].tissue_helium_bar,sizeof(pStateReal->lifeData.tissue_helium_bar)); 999 memcpy(pStateReal->lifeData.tissue_helium_bar, dataIn.data[dataIn.boolTisssueData].tissue_helium_bar,sizeof(pStateReal->lifeData.tissue_helium_bar));
1000 1000
1001 if(pStateReal->mode == MODE_DIVE) 1001 if(pStateReal->mode == MODE_DIVE)