comparison Discovery/Src/tCCR.c @ 273:5fe136480a47

Merged in janlmulder/ostc4/write-from-sim (pull request #20) Cleanup and debug capabilty to write logbook from simulator
author heinrichsweikamp <bitbucket@heinrichsweikamp.com>
date Sun, 28 Apr 2019 07:05:23 +0000
parents 74a8296a2318
children 31e471d60797
comparison
equal deleted inserted replaced
267:cf6ad20380fb 273:5fe136480a47
57 uint16_t count = 0; 57 uint16_t count = 0;
58 58
59 /* Private variables with external access via get_xxx() function -------------*/ 59 /* Private variables with external access via get_xxx() function -------------*/
60 60
61 /* Private function prototypes -----------------------------------------------*/ 61 /* Private function prototypes -----------------------------------------------*/
62 void tCCR_fallbackToFixedSetpoint(void); 62 static void tCCR_fallbackToFixedSetpoint(void);
63 63
64 #ifndef USART_IR_HUD 64 #ifndef USART_IR_HUD
65 65
66 void tCCR_init(void) 66 void tCCR_init(void)
67 { 67 {
341 } 341 }
342 342
343 #endif 343 #endif
344 /* Private functions ---------------------------------------------------------*/ 344 /* Private functions ---------------------------------------------------------*/
345 345
346 void tCCR_fallbackToFixedSetpoint(void) 346 static void tCCR_fallbackToFixedSetpoint(void)
347 { 347 {
348 if((stateUsed->mode == MODE_DIVE) && (stateUsed->diveSettings.diveMode == DIVEMODE_CCR) && (stateUsed->diveSettings.CCR_Mode == CCRMODE_Sensors) && (stateUsed->diveSettings.fallbackOption)) 348 if((stateUsed->mode == MODE_DIVE) && (stateUsed->diveSettings.diveMode == DIVEMODE_CCR) && (stateUsed->diveSettings.CCR_Mode == CCRMODE_Sensors) && (stateUsed->diveSettings.fallbackOption))
349 { 349 {
350 uint8_t setpointCbar, actualGasID; 350 uint8_t setpointCbar, actualGasID;
351 SDiveState *pState; 351
352 352 setpointCbar = stateUsed->diveSettings.setpoint[1].setpoint_cbar;
353 if(stateUsed == stateRealGetPointer()) 353 stateUsedWrite->diveSettings.CCR_Mode = CCRMODE_FixedSetpoint;
354 pState = stateRealGetPointerWrite(); 354
355 else 355 actualGasID = stateUsed->lifeData.actualGas.GasIdInSettings;
356 pState = stateSimGetPointerWrite(); 356 setActualGas_DM(&stateUsedWrite->lifeData,actualGasID,setpointCbar);
357
358 setpointCbar = pState->diveSettings.setpoint[1].setpoint_cbar;
359 pState->diveSettings.CCR_Mode = CCRMODE_FixedSetpoint;
360
361 actualGasID = pState->lifeData.actualGas.GasIdInSettings;
362 setActualGas_DM(&pState->lifeData,actualGasID,setpointCbar);
363 357
364 set_warning_fallback(); 358 set_warning_fallback();
365 } 359 }
366 } 360 }