comparison Discovery/Src/tCCR.c @ 449:91a939915bfa minor_improvments

Added initialization of bottle sensor data age counter
author ideenmodellierer
date Mon, 23 Mar 2020 21:14:54 +0100
parents f1257a32f2d4
children 4bd01f48c285
comparison
equal deleted inserted replaced
448:f7c66593ab82 449:91a939915bfa
50 #define HUD_BABBLING_IDIOT (30u) /* 30 Bytes received without break */ 50 #define HUD_BABBLING_IDIOT (30u) /* 30 Bytes received without break */
51 #define HUD_RX_FRAME_LENGTH (15u) /* Length of a HUD data frame */ 51 #define HUD_RX_FRAME_LENGTH (15u) /* Length of a HUD data frame */
52 #define HUD_RX_FRAME_BREAK_MS (100u) /* Time used to detect a gap between two byte receptions => frame start */ 52 #define HUD_RX_FRAME_BREAK_MS (100u) /* Time used to detect a gap between two byte receptions => frame start */
53 #define HUD_RX_START_DELAY_MS (500u) /* Delay for start of RX function to avoid start of reception while a transmission is ongoing. */ 53 #define HUD_RX_START_DELAY_MS (500u) /* Delay for start of RX function to avoid start of reception while a transmission is ongoing. */
54 /* Based on an assumed cycle time by the sensor of 1 second. Started at time of last RX */ 54 /* Based on an assumed cycle time by the sensor of 1 second. Started at time of last RX */
55
56 #define BOTTLE_SENSOR_TIMEOUT (6000u) /* signal pressure budget as not received after 10 minutes (6000 * 100ms) */
55 57
56 /* Private variables ---------------------------------------------------------*/ 58 /* Private variables ---------------------------------------------------------*/
57 static SIrLink receiveHUD[2]; 59 static SIrLink receiveHUD[2];
58 static uint8_t boolHUDdata = 0; 60 static uint8_t boolHUDdata = 0;
59 static uint8_t data_old__lost_connection_to_HUD = 1; 61 static uint8_t data_old__lost_connection_to_HUD = 1;
288 } 290 }
289 291
290 292
291 void tCCR_init(void) 293 void tCCR_init(void)
292 { 294 {
295 uint8_t loop;
296
293 StartListeningToUART_HUD = 1; 297 StartListeningToUART_HUD = 1;
298
299 SDiveState* pDiveData = stateRealGetPointerWrite();
300 for(loop=0;loop<(2*NUM_GASES+1);loop++)
301 {
302 pDiveData->lifeData.bottle_bar_age_MilliSeconds[loop] = BOTTLE_SENSOR_TIMEOUT;
303 }
294 } 304 }
295 305
296 306
297 /* after 3 seconds without update from HUD 307 /* after 3 seconds without update from HUD
298 * data is considered old 308 * data is considered old