changeset 149:e1d66bc78f9a FlipDisplay

Eliminate warnings
author Ideenmodellierer
date Sat, 02 Mar 2019 17:42:06 +0100
parents ee744c7160ce
children 097d7146b779
files Discovery/Src/base.c Discovery/Src/data_central.c Discovery/Src/data_exchange_main.c Discovery/Src/logbook.c Discovery/Src/t7.c Discovery/Src/tMenuEditGasOC.c Discovery/Src/vpm.c
diffstat 7 files changed, 52 insertions(+), 46 deletions(-) [+]
line wrap: on
line diff
--- a/Discovery/Src/base.c	Sat Mar 02 17:01:06 2019 +0100
+++ b/Discovery/Src/base.c	Sat Mar 02 17:42:06 2019 +0100
@@ -1630,9 +1630,10 @@
         CALC_VPM_FUTURE,
         CALC_BUEHLMANN,
         CALC_BUEHLMANN_FUTURE,
+		CALC_INVALID
     } CALC_WHAT;
 
-    static int what = -1;
+    static CALC_WHAT what = CALC_INVALID;
     int counter = 0;
     if((stateUsed->mode != MODE_DIVE) || (stateUsed->diveSettings.diveMode == DIVEMODE_Apnea) || (decoLock != DECO_CALC_ready ))
         return;
@@ -1677,27 +1678,28 @@
 
     switch(what)
     {
-    case CALC_VPM:
-            vpm_calc(&stateDeco.lifeData,&stateDeco.diveSettings,&stateDeco.vpm,&stateDeco.decolistVPM, DECOSTOPS);
-            decoLock = DECO_CALC_FINSHED_vpm;
-            return;
-     case CALC_VPM_FUTURE:
-            decom_tissues_exposure(stateDeco.diveSettings.future_TTS_minutes * 60,&stateDeco.lifeData);
-            vpm_calc(&stateDeco.lifeData,&stateDeco.diveSettings,&stateDeco.vpm,&stateDeco.decolistFutureVPM, FUTURESTOPS);
-            decoLock = DECO_CALC_FINSHED_Futurevpm;
-            return;
-    case CALC_BUEHLMANN:
-            buehlmann_calc_deco(&stateDeco.lifeData,&stateDeco.diveSettings,&stateDeco.decolistBuehlmann);
-            buehlmann_ceiling_calculator(&stateDeco.lifeData,&stateDeco.diveSettings,&stateDeco.decolistBuehlmann);
-            buehlmann_relative_gradient_calculator(&stateDeco.lifeData,&stateDeco.diveSettings,&stateDeco.decolistBuehlmann);
-            decoLock = DECO_CALC_FINSHED_Buehlmann;
-            return;
-     case CALC_BUEHLMANN_FUTURE:
-            decom_tissues_exposure(stateDeco.diveSettings.future_TTS_minutes * 60,&stateDeco.lifeData);
-            buehlmann_calc_deco(&stateDeco.lifeData,&stateDeco.diveSettings,&stateDeco.decolistFutureBuehlmann);
-            //buehlmann_ceiling_calculator(&stateDeco.lifeData,&stateDeco.diveSettings,&stateDeco.decolistBuehlmann);
-            decoLock = DECO_CALC_FINSHED_FutureBuehlmann;
-            return;
+		case CALC_VPM:
+				vpm_calc(&stateDeco.lifeData,&stateDeco.diveSettings,&stateDeco.vpm,&stateDeco.decolistVPM, DECOSTOPS);
+				decoLock = DECO_CALC_FINSHED_vpm;
+				return;
+		 case CALC_VPM_FUTURE:
+				decom_tissues_exposure(stateDeco.diveSettings.future_TTS_minutes * 60,&stateDeco.lifeData);
+				vpm_calc(&stateDeco.lifeData,&stateDeco.diveSettings,&stateDeco.vpm,&stateDeco.decolistFutureVPM, FUTURESTOPS);
+				decoLock = DECO_CALC_FINSHED_Futurevpm;
+				return;
+		case CALC_BUEHLMANN:
+				buehlmann_calc_deco(&stateDeco.lifeData,&stateDeco.diveSettings,&stateDeco.decolistBuehlmann);
+				buehlmann_ceiling_calculator(&stateDeco.lifeData,&stateDeco.diveSettings,&stateDeco.decolistBuehlmann);
+				buehlmann_relative_gradient_calculator(&stateDeco.lifeData,&stateDeco.diveSettings,&stateDeco.decolistBuehlmann);
+				decoLock = DECO_CALC_FINSHED_Buehlmann;
+				return;
+		 case CALC_BUEHLMANN_FUTURE:
+				decom_tissues_exposure(stateDeco.diveSettings.future_TTS_minutes * 60,&stateDeco.lifeData);
+				buehlmann_calc_deco(&stateDeco.lifeData,&stateDeco.diveSettings,&stateDeco.decolistFutureBuehlmann);
+				//buehlmann_ceiling_calculator(&stateDeco.lifeData,&stateDeco.diveSettings,&stateDeco.decolistBuehlmann);
+				decoLock = DECO_CALC_FINSHED_FutureBuehlmann;
+				return;
+		 default: break;
     }
     counter++;
 }
--- a/Discovery/Src/data_central.c	Sat Mar 02 17:01:06 2019 +0100
+++ b/Discovery/Src/data_central.c	Sat Mar 02 17:42:06 2019 +0100
@@ -529,7 +529,6 @@
 
 void setActualGasAir(SLifeData *lifeData)
 {
-	SSettings* pSettings = settingsGetPointer();
 	uint8_t nitrogen;
 	nitrogen = 79;
 	lifeData->actualGas.GasIdInSettings = 0;
@@ -784,13 +783,16 @@
 
 void resetEvents(void)
 {
-  SDiveState * pStateUsed;
+    SDiveState * pStateUsed;
 	if(stateUsed == stateRealGetPointer())
+	{
 		pStateUsed = stateRealGetPointerWrite();
+	}
 	else
+	{
 		pStateUsed = stateSimGetPointerWrite();
-
-		memset(&pStateUsed->events,0, sizeof(SEvents));
+	}
+	memset(&pStateUsed->events,0, sizeof(SEvents));
 }
 
 
--- a/Discovery/Src/data_exchange_main.c	Sat Mar 02 17:01:06 2019 +0100
+++ b/Discovery/Src/data_exchange_main.c	Sat Mar 02 17:42:06 2019 +0100
@@ -302,8 +302,6 @@
 	HAL_GPIO_WritePin(SMALLCPU_CSB_GPIO_PORT,SMALLCPU_CSB_PIN,GPIO_PIN_SET);
 	delayMicros(10); //~exchange time(+20% reserve)
 	HAL_GPIO_WritePin(SMALLCPU_CSB_GPIO_PORT,SMALLCPU_CSB_PIN,GPIO_PIN_RESET);
-	/* one cycle with NotChipSelect true to clear slave spi buffer */
-
 
 	if(data_old__lost_connection_to_slave_counter_temp >= 3)
 	{
@@ -312,14 +310,20 @@
 		{
 			HAL_SPI_Abort_IT(&cpu2DmaSpi);
 		}
-
 		/* reset of own DMA does not work ==> request reset of slave dma */
-		if((DataEX_check_header_and_footer_shifted()) && (data_old__lost_connection_to_slave_counter_retry >= 2))
+		if((DataEX_check_header_and_footer_shifted()) && (data_old__lost_connection_to_slave_counter_retry == 2))
 		{
 			dataOut.header.checkCode[SPI_HEADER_INDEX_SLAVE] = 0xA5;
 		}
 		data_old__lost_connection_to_slave_counter_retry++;
 	}
+#if USE_OLD_SYNC_METHOD
+	/* one cycle with NotChipSelect true to clear slave spi buffer */
+	else
+	{
+		HAL_GPIO_WritePin(SMALLCPU_CSB_GPIO_PORT,SMALLCPU_CSB_PIN,GPIO_PIN_RESET);
+	}
+#endif
 
 	DataEx_call_helper_requests();
 
@@ -327,10 +331,10 @@
 
 
 	SPI_DMA_answer = HAL_SPI_TransmitReceive_DMA(&cpu2DmaSpi, (uint8_t *)&dataOut, (uint8_t *)&dataIn, EXCHANGE_BUFFERSIZE);
-//	HAL_Delay(3);
 	if(SPI_DMA_answer != HAL_OK)
+	{
 		DataEX_Error_Handler(SPI_DMA_answer);
-
+	}		
 //	HAL_GPIO_WritePin(SMALLCPU_CSB_GPIO_PORT,SMALLCPU_CSB_PIN,GPIO_PIN_SET);
 //HAL_Delay(3);
 //HAL_GPIO_WritePin(OSCILLOSCOPE2_GPIO_PORT,OSCILLOSCOPE2_PIN,GPIO_PIN_SET); /* only for testing with Oscilloscope */
@@ -851,6 +855,10 @@
 	float ambient, surface, density, meter;
 	SSettings *pSettings;
 	
+	ambient = 0;
+	surface = 0;
+	meter = 0;
+
 	/*	uint8_t IAmStolenPleaseKillMe;
 	 */
 	pSettings = settingsGetPointer();
--- a/Discovery/Src/logbook.c	Sat Mar 02 17:01:06 2019 +0100
+++ b/Discovery/Src/logbook.c	Sat Mar 02 17:42:06 2019 +0100
@@ -1257,7 +1257,7 @@
 void logbook_UpdateHeader(void)
 {
 	const SDiveState * pStateReal = stateRealGetPointer();
-	SSettings *pSettings = settingsGetPointer();
+
 //	uint16_t secondsAtShallow = 0;
 	RTC_DateTypeDef Sdate;
 	RTC_TimeTypeDef Stime;
--- a/Discovery/Src/t7.c	Sat Mar 02 17:01:06 2019 +0100
+++ b/Discovery/Src/t7.c	Sat Mar 02 17:42:06 2019 +0100
@@ -3342,7 +3342,6 @@
     point_t start, stop, center;
     static int32_t LastHeading = 0;
     int32_t newHeading = 0;
-    int32_t FlipHeading = 0;
     int32_t diff = 0;
     int32_t diff2 = 0;
 
--- a/Discovery/Src/tMenuEditGasOC.c	Sat Mar 02 17:01:06 2019 +0100
+++ b/Discovery/Src/tMenuEditGasOC.c	Sat Mar 02 17:42:06 2019 +0100
@@ -1030,9 +1030,6 @@
 {
     uint8_t first, i, gasOne;
 
-
-    SDiveState * pStateReal = stateRealGetPointerWrite();
-
     if(editGasPage.ccr)
         gasOne = 1 + NUM_OFFSET_DILUENT;
     else
@@ -1074,7 +1071,6 @@
 uint8_t OnAction_Deco(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
 {
     uint8_t  first, deco, gasOne;
-    SDiveState * pStateReal = stateRealGetPointerWrite();
 
     if(editGasPage.ccr)
         gasOne = 1 + NUM_OFFSET_DILUENT;
@@ -1130,7 +1126,6 @@
 uint8_t OnAction_Travel(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
 {
     uint8_t first, travel, gasOne;
-    SDiveState * pStateReal = stateRealGetPointerWrite();
 
     if(editGasPage.ccr)
         gasOne = 1 + NUM_OFFSET_DILUENT;
@@ -1177,7 +1172,6 @@
 uint8_t OnAction_Inactive(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
 {
     uint8_t first, inactive, gasOne;
-    SDiveState * pStateReal = stateRealGetPointerWrite();
 
     if(editGasPage.ccr)
         gasOne = 1 + NUM_OFFSET_DILUENT;
--- a/Discovery/Src/vpm.c	Sat Mar 02 17:01:06 2019 +0100
+++ b/Discovery/Src/vpm.c	Sat Mar 02 17:42:06 2019 +0100
@@ -1097,9 +1097,6 @@
     static int dp_max;
     static float surfacetime;
     _Bool first_stop = false;
-// hw 1601209 float tissue_He_saturation[16];
-// hw 1601209	float tissue_N2_saturation[16];
-    float vpm_buehlmann_safety_gradient = 1.0f - (((float)pDiveSettings->vpm_conservatism) / 40);
     max_first_stop_depth = fmaxf(first_stop_depth,max_first_stop_depth);
     if(begin)
     {
@@ -2110,10 +2107,13 @@
 
     //deco_ceiling_depth = next_stop +1;	//deco_ceiling_depth = next_stop + 1;
     if(!vpm_violates_buehlmann)
+    {
         calc_deco_ceiling(&deco_ceiling_depth, false); //weg, weil auf jeden Fall schleife für safety und so konservativer
+    }
     else
+    {
         deco_ceiling_depth = next_stop + 1;
-
+    }
         if(deco_ceiling_depth > next_stop)
         {
             while (deco_ceiling_depth > next_stop)
@@ -2222,9 +2222,10 @@
                 }
             }
             if(buehlmann_wait)
+            {
                 vpm_violates_buehlmann = true;
-
-                if(!buehlmann_wait)
+            }
+            if(!buehlmann_wait)
             {
                 if(deco_ceiling_depth < next_stop)
                 {