comparison Discovery/Src/data_central.c @ 683:6f5a18bb25be Betatest

Bugfix: Set actual gas after basic dive settings were created: Previous version showed unexpected warnings (ppo2 low) and deco data in simulator mode in case the dive mode had been changed before (e.g. from CCR to OC). Root cause was the update of the gas list before basic settings were set in the divesettings. To solve this the gas selection function has been moved behind the section initializing the gas variables.
author Ideenmodellierer
date Mon, 16 May 2022 20:50:26 +0200
parents 8775d3dc6325
children 8a2337c7af52
comparison
equal deleted inserted replaced
682:8775d3dc6325 683:6f5a18bb25be
318 void createDiveSettings(void) 318 void createDiveSettings(void)
319 { 319 {
320 int i; 320 int i;
321 SSettings* pSettings = settingsGetPointer(); 321 SSettings* pSettings = settingsGetPointer();
322 322
323 setActualGasFirst(&stateReal.lifeData);
324
325 stateReal.diveSettings.compassHeading = pSettings->compassBearing; 323 stateReal.diveSettings.compassHeading = pSettings->compassBearing;
326 stateReal.diveSettings.ascentRate_meterperminute = 10; 324 stateReal.diveSettings.ascentRate_meterperminute = 10;
327 325
328 stateReal.diveSettings.diveMode = pSettings->dive_mode; 326 stateReal.diveSettings.diveMode = pSettings->dive_mode;
329 stateReal.diveSettings.CCR_Mode = pSettings->CCR_Mode; 327 stateReal.diveSettings.CCR_Mode = pSettings->CCR_Mode;
337 stateReal.diveSettings.ccrOption = 1; 335 stateReal.diveSettings.ccrOption = 1;
338 else 336 else
339 stateReal.diveSettings.ccrOption = 0; 337 stateReal.diveSettings.ccrOption = 0;
340 memcpy(stateReal.diveSettings.gas, pSettings->gas,sizeof(pSettings->gas)); 338 memcpy(stateReal.diveSettings.gas, pSettings->gas,sizeof(pSettings->gas));
341 memcpy(stateReal.diveSettings.setpoint, pSettings->setpoint,sizeof(pSettings->setpoint)); 339 memcpy(stateReal.diveSettings.setpoint, pSettings->setpoint,sizeof(pSettings->setpoint));
340
341 setActualGasFirst(&stateReal.lifeData);
342
342 stateReal.diveSettings.gf_high = pSettings->GF_high; 343 stateReal.diveSettings.gf_high = pSettings->GF_high;
343 stateReal.diveSettings.gf_low = pSettings->GF_low; 344 stateReal.diveSettings.gf_low = pSettings->GF_low;
344 stateReal.diveSettings.input_next_stop_increment_depth_bar = ((float)pSettings->stop_increment_depth_meter) / 10.0f; 345 stateReal.diveSettings.input_next_stop_increment_depth_bar = ((float)pSettings->stop_increment_depth_meter) / 10.0f;
345 stateReal.diveSettings.last_stop_depth_bar = ((float)pSettings->last_stop_depth_meter) / 10.0f; 346 stateReal.diveSettings.last_stop_depth_bar = ((float)pSettings->last_stop_depth_meter) / 10.0f;
346 stateReal.diveSettings.vpm_conservatism = pSettings->VPM_conservatism.ub.standard; 347 stateReal.diveSettings.vpm_conservatism = pSettings->VPM_conservatism.ub.standard;