diff 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
line wrap: on
line diff
--- a/Discovery/Src/tCCR.c	Fri Apr 26 10:36:11 2019 +0000
+++ b/Discovery/Src/tCCR.c	Sun Apr 28 07:05:23 2019 +0000
@@ -59,7 +59,7 @@
 /* Private variables with external access via get_xxx() function -------------*/
 
 /* Private function prototypes -----------------------------------------------*/
-void tCCR_fallbackToFixedSetpoint(void);
+static void tCCR_fallbackToFixedSetpoint(void);
 
 #ifndef USART_IR_HUD
 
@@ -343,23 +343,17 @@
 #endif
 /* Private functions ---------------------------------------------------------*/
 
-void tCCR_fallbackToFixedSetpoint(void)
+static void tCCR_fallbackToFixedSetpoint(void)
 {
     if((stateUsed->mode == MODE_DIVE) && (stateUsed->diveSettings.diveMode == DIVEMODE_CCR) && (stateUsed->diveSettings.CCR_Mode == CCRMODE_Sensors) && (stateUsed->diveSettings.fallbackOption))
     {
         uint8_t setpointCbar, actualGasID;
-        SDiveState *pState;
 
-        if(stateUsed == stateRealGetPointer())
-            pState = stateRealGetPointerWrite();
-        else
-            pState = stateSimGetPointerWrite();
+        setpointCbar = stateUsed->diveSettings.setpoint[1].setpoint_cbar;
+        stateUsedWrite->diveSettings.CCR_Mode = CCRMODE_FixedSetpoint;
 
-        setpointCbar = pState->diveSettings.setpoint[1].setpoint_cbar;
-        pState->diveSettings.CCR_Mode = CCRMODE_FixedSetpoint;
-
-        actualGasID = pState->lifeData.actualGas.GasIdInSettings;
-        setActualGas_DM(&pState->lifeData,actualGasID,setpointCbar);
+        actualGasID = stateUsed->lifeData.actualGas.GasIdInSettings;
+        setActualGas_DM(&stateUsedWrite->lifeData,actualGasID,setpointCbar);
 
         set_warning_fallback();
     }