comparison Discovery/Src/simulation.c @ 998:5a690195b6b7 GasConsumption

Added dual operation of scrubber timers: In the previous version only one scrubber timer could be selected for operation. In the new version the activation of both timers is possible. In that case both timers will be displayed as well. To enable this a new activation item has been added to the scrubber menu.
author Ideenmodellierer
date Wed, 23 Apr 2025 14:52:03 +0200
parents 7891160acde3
children 8c0134a287da
comparison
equal deleted inserted replaced
997:2f7531a8e922 998:5a690195b6b7
149 void simulation_UpdateLifeData( _Bool checkOncePerSecond) 149 void simulation_UpdateLifeData( _Bool checkOncePerSecond)
150 { 150 {
151 SDiveState * pDiveState = &stateSim; 151 SDiveState * pDiveState = &stateSim;
152 const SDiveState * pRealState = stateRealGetPointer(); 152 const SDiveState * pRealState = stateRealGetPointer();
153 SSettings *pSettings; 153 SSettings *pSettings;
154 uint8_t timerId = 0;
154 155
155 static int last_second = -1; 156 static int last_second = -1;
156 static _Bool two_second = 0; 157 static _Bool two_second = 0;
157 static float lastPressure_bar = 0; 158 static float lastPressure_bar = 0;
158 159
248 { 249 {
249 simScrubberTimeoutCount++; 250 simScrubberTimeoutCount++;
250 if(simScrubberTimeoutCount >= 60) /* resolution is minutes */ 251 if(simScrubberTimeoutCount >= 60) /* resolution is minutes */
251 { 252 {
252 simScrubberTimeoutCount = 0; 253 simScrubberTimeoutCount = 0;
253 if(pDiveState->scrubberDataDive[pSettings->scubberActiveId].TimerCur > MIN_SCRUBBER_TIME) 254 for(timerId = 0; timerId < 2; timerId++)
254 { 255 {
255 pDiveState->scrubberDataDive[pSettings->scubberActiveId].TimerCur--; 256 if(pSettings->scubberActiveId & (1 << timerId))
257 {
258 if(pDiveState->scrubberDataDive[timerId].TimerCur > MIN_SCRUBBER_TIME)
259 {
260 pDiveState->scrubberDataDive[timerId].TimerCur--;
261 }
262 translateDate(stateUsed->lifeData.dateBinaryFormat, &pDiveState->scrubberDataDive[timerId].lastDive);
263 }
256 } 264 }
257 translateDate(stateUsed->lifeData.dateBinaryFormat, &pDiveState->scrubberDataDive[pSettings->scubberActiveId].lastDive);
258 } 265 }
259 } 266 }
260 267
261 268
262 if(lastPressure_bar > 0) 269 if(lastPressure_bar > 0)