Mercurial > public > ostc4
changeset 760:21949c88da90
Quit simualted dives after the dive time set in the SIM tab.
author | heinrichsweikamp |
---|---|
date | Tue, 21 Mar 2023 12:56:54 +0100 |
parents | 9825dcf50675 |
children | 31883eacf1fa |
files | Discovery/Inc/simulation.h Discovery/Src/simulation.c Discovery/Src/tMenuEditPlanner.c |
diffstat | 3 files changed, 10 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/Discovery/Inc/simulation.h Fri Mar 17 09:35:25 2023 +0100 +++ b/Discovery/Inc/simulation.h Tue Mar 21 12:56:54 2023 +0100 @@ -42,7 +42,7 @@ float ppO2AtBottom; } SSimDataSummary; -void simulation_start(int aim_depth); +void simulation_start(int aim_depth, uint16_t aim_time_minutes); void simulation_exit(void); void simulation_set_heed_decostops(_Bool heed_decostops_while_ascending);
--- a/Discovery/Src/simulation.c Fri Mar 17 09:35:25 2023 +0100 +++ b/Discovery/Src/simulation.c Tue Mar 21 12:56:54 2023 +0100 @@ -48,6 +48,7 @@ //Private state variables static float sim_aim_depth_meter; +static float sim_aim_time_minutes; static _Bool sim_heed_decostops = 1; static const float sim_descent_rate_meter_per_min = 20; @@ -80,7 +81,7 @@ ****************************************************************************** * @return void */ -void simulation_start(int aim_depth) +void simulation_start(int aim_depth, uint16_t aim_time_minutes) { copyDiveSettingsToSim(); copyVpmRepetetiveDataToSim(); @@ -90,6 +91,7 @@ if(aim_depth <= 0) aim_depth = 20; simulation_set_aim_depth(aim_depth); + sim_aim_time_minutes = aim_time_minutes; timer_init(); set_stateUsedToSim(); stateSim.lifeData.boolResetAverageDepth = 1; @@ -131,6 +133,10 @@ static _Bool two_second = 0; static float lastPressure_bar = 0; + if (sim_aim_time_minutes * 60 <= pDiveState->lifeData.dive_time_seconds) { + simulation_set_aim_depth(0); + } + float localCalibCoeff[3] = { 0.0, 0.0, 0.0 }; uint8_t index, index2; @@ -912,6 +918,7 @@ } } } + void Sim_IncreasePPO(uint8_t sensorIdx) { if((sensorIdx < NUM_OF_SENSORS) && (simSensmVOffset[sensorIdx] + SIM_PPO2_STEP < 100.0) && ((stateUsed->diveSettings.ppo2sensors_deactivated & (1 << sensorIdx)) == 0))
--- a/Discovery/Src/tMenuEditPlanner.c Fri Mar 17 09:35:25 2023 +0100 +++ b/Discovery/Src/tMenuEditPlanner.c Tue Mar 21 12:56:54 2023 +0100 @@ -86,7 +86,7 @@ settingsGetPointer()->bluetoothActive = 0; MX_Bluetooth_PowerOff(); } - simulation_start(tMplan_depth_meter); + simulation_start(tMplan_depth_meter, tMplan_dive_time_minutes); exitMenuEdit_to_Home(); break; case 2: