Mercurial > public > ostc4
comparison Discovery/Src/tCCR.c @ 655:980b4aa60a0e
Added count down timer for scrubber time:
The countdown is performed in case CCR mode and scrubber timer are active
author | Ideenmodellierer |
---|---|
date | Sun, 25 Apr 2021 20:42:56 +0200 |
parents | 66c8a4ff9fc4 |
children | 1b995079c045 |
comparison
equal
deleted
inserted
replaced
654:890440ab993a | 655:980b4aa60a0e |
---|---|
73 | 73 |
74 static uint8_t receiveHUDraw[16]; | 74 static uint8_t receiveHUDraw[16]; |
75 | 75 |
76 static uint8_t StartListeningToUART_HUD = 0; | 76 static uint8_t StartListeningToUART_HUD = 0; |
77 static uint16_t HUDTimeoutCount = 0; | 77 static uint16_t HUDTimeoutCount = 0; |
78 static uint16_t ScrubberTimeoutCount = 0; | |
78 | 79 |
79 static __IO ITStatus UartReadyHUD = RESET; | 80 static __IO ITStatus UartReadyHUD = RESET; |
80 static uint32_t LastReceivedTick_HUD = 0; | 81 static uint32_t LastReceivedTick_HUD = 0; |
81 | 82 |
82 /* Private variables with external access via get_xxx() function -------------*/ | 83 /* Private variables with external access via get_xxx() function -------------*/ |
310 /* after 3 seconds without update from HUD | 311 /* after 3 seconds without update from HUD |
311 * data is considered old | 312 * data is considered old |
312 */ | 313 */ |
313 void tCCR_tick(void) | 314 void tCCR_tick(void) |
314 { | 315 { |
315 if(settingsGetPointer()->ppo2sensors_source == O2_SENSOR_SOURCE_OPTIC) | 316 SSettings* pSettings = settingsGetPointer(); |
317 | |
318 if(pSettings->ppo2sensors_source == O2_SENSOR_SOURCE_OPTIC) | |
316 { | 319 { |
317 if(HUDTimeoutCount < 3 * 10) | 320 if(HUDTimeoutCount < 3 * 10) |
318 HUDTimeoutCount++; | 321 HUDTimeoutCount++; |
319 else | 322 else |
320 { | 323 { |
323 HUDTimeoutCount++; | 326 HUDTimeoutCount++; |
324 else | 327 else |
325 tCCR_fallbackToFixedSetpoint(); | 328 tCCR_fallbackToFixedSetpoint(); |
326 } | 329 } |
327 } | 330 } |
331 | |
332 /* decrease scrubber timer only in real dive mode */ | |
333 if((pSettings->scrubTimerMode != SCRUB_TIMER_OFF) && (pSettings->dive_mode == DIVEMODE_CCR) && (stateUsed->mode == MODE_DIVE) && (stateUsed == stateRealGetPointer())) | |
334 { | |
335 ScrubberTimeoutCount++; | |
336 if(ScrubberTimeoutCount >= 600) /* resolution is minutes */ | |
337 { | |
338 ScrubberTimeoutCount = 0; | |
339 if(pSettings->scrubTimerCur > 0) | |
340 { | |
341 pSettings->scrubTimerCur--; | |
342 } | |
343 } | |
344 } | |
328 } | 345 } |
329 | 346 |
330 void tCCR_SetRXIndication(void) | 347 void tCCR_SetRXIndication(void) |
331 { | 348 { |
332 static uint8_t floatingRXCount = 0; | 349 static uint8_t floatingRXCount = 0; |