changeset 186:f11f0bf6ef2d cleanup-2

cleanup: remove obsolete code, make static, etc. Some rather trivial cleanup things like putting demo code into ifdefs, making functions static where possible, and against my normal policy of hard removing unused code, commenting it out at this point in time. Somehow, I think that this commented code might be useful in the near future as a new pressure sensor is coming. And finally, fixed some typo's in comment. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
author Jan Mulder <jlmulder@xs4all.nl>
date Fri, 15 Mar 2019 12:39:28 +0100
parents 1bb24fd3fc92
children 485c5135cf7f
files Discovery/Src/show_logbook.c Discovery/Src/tInfoLog.c Discovery/Src/timer.c Small_CPU/Src/pressure.c Small_CPU/Src/scheduler.c
diffstat 5 files changed, 62 insertions(+), 292 deletions(-) [+]
line wrap: on
line diff
--- a/Discovery/Src/show_logbook.c	Fri Mar 15 08:22:16 2019 +0000
+++ b/Discovery/Src/show_logbook.c	Fri Mar 15 12:39:28 2019 +0100
@@ -40,58 +40,27 @@
 
 /* Private variables ---------------------------------------------------------*/
 
-GFX_DrawCfgScreen	tLOGscreen;
-GFX_DrawCfgScreen	tLOGbackground;
+static GFX_DrawCfgScreen	tLOGscreen;
+static GFX_DrawCfgScreen	tLOGbackground;
 
 
-void print_gas_name(char* output,uint8_t lengh,uint8_t oxygen,uint8_t helium);
-int16_t get_colour(int16_t color);
+static void print_gas_name(char* output,uint8_t lengh,uint8_t oxygen,uint8_t helium);
+static int16_t get_colour(int16_t color);
 
 /* Overview */
-void show_logbook_logbook_show_log_page1(GFX_DrawCfgScreen *hgfx, uint8_t StepBackwards);
+static void show_logbook_logbook_show_log_page1(GFX_DrawCfgScreen *hgfx, uint8_t StepBackwards);
 /* Temperature */
-void show_logbook_logbook_show_log_page2(GFX_DrawCfgScreen *hgfx, uint8_t StepBackwards);
+static void show_logbook_logbook_show_log_page2(GFX_DrawCfgScreen *hgfx, uint8_t StepBackwards);
 /* Gas List */
-void show_logbook_logbook_show_log_page3(GFX_DrawCfgScreen *hgfx, uint8_t StepBackwards);
+static void show_logbook_logbook_show_log_page3(GFX_DrawCfgScreen *hgfx, uint8_t StepBackwards);
 /* ppO2 */
-void show_logbook_logbook_show_log_page4(GFX_DrawCfgScreen *hgfx, uint8_t StepBackwards);
+static void show_logbook_logbook_show_log_page4(GFX_DrawCfgScreen *hgfx, uint8_t StepBackwards);
 
-
-inline uint32_t MinU32LOG(uint32_t a, uint32_t b)
-{
-    return ((a<b)?a:b);
-}
-
-uint32_t MaxU32LOG(uint32_t a, uint32_t b)
+static inline uint32_t MaxU32LOG(uint32_t a, uint32_t b)
 {
     return((a>b)?a:b);
 }
 
-void write_label_(GFX_DrawCfgScreen *screenInput, SWindowGimpStyle win, const tFont *Font, uint8_t color, const char *text)
-{
-    GFX_DrawCfgWindow	hgfx;
-
-    if( win.right > 799)
-         win.right = 799;
-
-    if(win.top > 479)
-        win.top = 479;
-    hgfx.Image = screenInput;
-    hgfx.WindowNumberOfTextLines = 1;
-    hgfx.WindowLineSpacing = 0;
-    hgfx.WindowTab = 0;
-    hgfx.WindowX0 = win.left;
-    hgfx.WindowX1 = win.right;
-    hgfx.WindowY1 = 479 - win.top;
-    if(hgfx.WindowY1 < Font->height)
-        hgfx.WindowY0 = 0;
-    else
-        hgfx.WindowY0 = hgfx.WindowY1 - Font->height;
-
-    GFX_write_label(Font, &hgfx, text, color);
-}
-
-
 /**
   ******************************************************************************
   * @brief   GFX write label. /  print coordinate system & depth graph
@@ -108,7 +77,7 @@
   * @param  colordata: 			1
   * @retval None
   */
-void show_logbook_draw_depth_graph(GFX_DrawCfgScreen *hgfx, uint8_t StepBackwards, SWindowGimpStyle* window, short mode, uint16_t dataLength, uint16_t* depthdata, uint8_t * colordata, uint16_t * decostopdata)
+static void show_logbook_draw_depth_graph(GFX_DrawCfgScreen *hgfx, uint8_t StepBackwards, SWindowGimpStyle* window, short mode, uint16_t dataLength, uint16_t* depthdata, uint8_t * colordata, uint16_t * decostopdata)
 {
     SLogbookHeader logbookHeader;
     SWindowGimpStyle wintemp = *window;
@@ -285,7 +254,7 @@
     * fit to multiples of 1�C (data format is 1/10�C)
     */
 
-void scaleAdapt(	int InputTop, int InputBottom,
+static void scaleAdapt(	int InputTop, int InputBottom,
                                     int16_t *OutputMinValue, int16_t *OutputMaxValue, int *OutputTop, int *OutputBottom,
                                     uint16_t *OutputStepOfScale, int16_t *OutputMaxValueOnScale)
 {
@@ -387,7 +356,7 @@
     * for temperature, input is �C * 10
     */
 
-void scaleHelper(	uint16_t InputDataLength, int16_t *InputDataArray, int InputTop, int InputBottom,
+static void scaleHelper(	uint16_t InputDataLength, int16_t *InputDataArray, int InputTop, int InputBottom,
                                     int16_t *OutputMinValue, int16_t *OutputMaxValue, int *OutputTop, int *OutputBottom,
                                     uint16_t *OutputStepOfScale, int16_t *OutputMaxValueOnScale)
 {
@@ -441,7 +410,7 @@
   * @param  hgfx:
   * @retval None
   */
-void show_logbook_logbook_show_log_page1(GFX_DrawCfgScreen *hgfx,uint8_t StepBackwards)
+static void show_logbook_logbook_show_log_page1(GFX_DrawCfgScreen *hgfx,uint8_t StepBackwards)
 {
     SWindowGimpStyle wintemp;
     SWindowGimpStyle winsmal;
@@ -661,7 +630,7 @@
 }
 
 
-void show_logbook_logbook_show_log_page2(GFX_DrawCfgScreen *hgfx, uint8_t StepBackwards)
+static void show_logbook_logbook_show_log_page2(GFX_DrawCfgScreen *hgfx, uint8_t StepBackwards)
 {
     //*** Page2: Depth and Temperature ****
 
@@ -751,189 +720,7 @@
 }
 
 
-void show_logbook_logbook_show_log_page2_original(GFX_DrawCfgScreen *hgfx, uint8_t StepBackwards)
-{
-    //*** Page2: Depth and Temperature ****
-
-    SWindowGimpStyle wintemp;
-    SWindowGimpStyle winsmal;
-    wintemp.left = 50;
-    wintemp.right = 799 - wintemp.left;
-    wintemp.top = 50;
-    wintemp.bottom = 479 - 40;
-
-    SLogbookHeader logbookHeader;
-
-    logbook_getHeader(StepBackwards,&logbookHeader);
-    uint16_t dataLength = 0;
-    uint16_t depthdata[1000];
-    uint8_t  gasdata[1000];
-    int16_t  tempdata[1000];
-    uint16_t decoDepthdata[1000];
-    uint16_t *pDecoDepthData = 0;
-
-    dataLength = logbook_readSampleData(StepBackwards, 1000, depthdata,gasdata, tempdata, NULL, NULL, NULL, NULL, NULL, NULL, NULL, decoDepthdata);
-
-/* test
-    for(int i = 0; i<dataLength/2; i++)
-        decoDepthdata[i] = 300;
-
-    for(int i = dataLength/2; i<dataLength; i++)
-        decoDepthdata[i] = 1200;
-*/
-    for(int i = 0; i<dataLength; i++)
-    {
-        if(decoDepthdata[i] >= 300)
-        {
-            pDecoDepthData = decoDepthdata;
-            break;
-        }
-    }
-    //--- print coordinate system & depth graph ---
-    show_logbook_draw_depth_graph(hgfx, StepBackwards, &wintemp, 0, dataLength, depthdata, gasdata, pDecoDepthData);
-
-    //*** Temperature *************************************************
-
-
-    int16_t datamax = -1000; // �C * 10
-    int16_t datamin = +1000;
-    for(int i = 0; i < dataLength;i++)
-    {
-        if(tempdata[i]>datamax)
-            datamax = tempdata[i];
-        if(tempdata[i]< datamin)
-            datamin = tempdata[i];
-    }
-    float maxTmp = ((float)datamax) /10.f;
-    float minTmp = ((float)datamin) /10.f;
-    int deltaTmp = maxTmp - minTmp;
-    int tmpstep = 2;
-
-    // 5 different scales: 1�C, 2�C, 4�C, 5�C, 10�C
-    // with 6 lines == 5 steps
-    if((deltaTmp) <=5)
-    {
-        tmpstep = 1;
-    }
-    else
-    if(deltaTmp <= (5*2))
-    {
-        tmpstep = 2;
-    }
-    else
-    if(deltaTmp <= (5 * 4))
-    {
-        tmpstep = 4;
-    }
-    else
-    if(deltaTmp <= (5 * 5))
-    {
-        tmpstep = 5;
-    }
-    else
-    {
-        tmpstep = 10;
-    }
-//	int steps = deltaTmp/tmpstep;
-
-
-//	int steps = deltaTmp/5;
-//	int tmpstep = 5;
-//	if(steps > 4)
-//		tmpstep = 10;
-
-    int maxtmpline = 0;
-    int mintmpline = 0;
-    if(minTmp < 0)
-    {
-        if(minTmp >= -5)
-        {
-            mintmpline = -5;
-
-        }
-        else if(minTmp >= -10)
-        {
-            mintmpline = -10;
-        }
-        else
-            mintmpline = -15;
-    }
-
-    if(maxTmp > 0)
-    {
-        while(maxtmpline < maxTmp)
-            maxtmpline += tmpstep;
-    }
-
-    if(tmpstep < 5)
-        maxtmpline = MaxU32LOG(maxtmpline, 10);
-    else if(tmpstep == 5)
-        maxtmpline = MaxU32LOG(maxtmpline, 25);
-    else
-        maxtmpline = 50;
-
-    maxtmpline += mintmpline;
-
-    //--- print temperature labels ---
-    // input maxtmpline, tmpstep, deltaline
-
-    winsmal.left = wintemp.right +6;
-    winsmal.top	= wintemp.top - 3;
-    winsmal.right =  wintemp.right + 30;
-    winsmal.bottom = winsmal.top + 16;
-
-    write_label_(hgfx, winsmal,&FontT24,CLUT_LogbookTemperature,"[C]");
-
-    int deltaline = (wintemp.bottom - wintemp.top)/5;
-    char msg[3];
-    int tmp = maxtmpline;
-    for(int i = 1; i<=5; i++)
-    {
-        tmp -= 	tmpstep;
-        //if(tmp < 0)
-            //break;
-        winsmal.top	= wintemp.top + deltaline * i - 14;
-        winsmal.bottom = winsmal.top + 16;
-        snprintf(msg,3,"%2i",tmp);
-        write_label_(hgfx, winsmal,&FontT24,CLUT_LogbookTemperature,msg);
-    }
-
-
-    //--- print temperature graph ---
-    // input tempdata[i], maxtmpline, mintmpline, maxTmp, minTmp, deltaline, wintemp.top, dataLength, datamax,
-
-    //adapt window
-    float ftmp =((maxtmpline - minTmp) * deltaline) /tmpstep +  wintemp.top;
-    wintemp.bottom = ftmp;
-    if((ftmp - (int)ftmp) >= 0.5f)
-        wintemp.bottom++;
-
-    ftmp = ((maxtmpline - maxTmp) * deltaline) /tmpstep + wintemp.top;
-    wintemp.top = ftmp;
-    if((ftmp - (int)ftmp) >= 0.5f)
-        wintemp.top++;
-
-    if(wintemp.top <= wintemp.bottom)
-    {
-        for(int i = 0; i < dataLength;i++)
-        {
-            tempdata[i] -= mintmpline;
-        }
-        datamax -= mintmpline;
-        // hw 160518
-        // es wird nur das Fenster (wintemp.top, wintemp.bottom) verwendet in dem Daten sind
-        // daher muss datamin angegeben werden
-        // der Gesamtbereich ist uninteressant
-        // Bsp Temperatur von 8�C bis 5�C
-        // Y-Achse ist 10�C (oben) bis 0�C (unten)
-        // aber wintemp.top ist 127
-        // und wintemp.bottom ist 243
-        GFX_graph_print(hgfx,&wintemp,0,1,datamax,datamin, (uint16_t *)tempdata,dataLength,CLUT_LogbookTemperature, NULL);
-    }
-}
-
-
-void build_logbook_test(uint8_t page, uint8_t StepBackwards)
+static void build_logbook_test(uint8_t page, uint8_t StepBackwards)
 {
     uint32_t lastScreen,lastBackground;
 
@@ -1000,7 +787,7 @@
 }
 
 
-void show_logbook_logbook_show_log_page3(GFX_DrawCfgScreen *hgfx, uint8_t StepBackwards)
+static void show_logbook_logbook_show_log_page3(GFX_DrawCfgScreen *hgfx, uint8_t StepBackwards)
 {
     SWindowGimpStyle wintemp;
     SWindowGimpStyle winsmal;
@@ -1051,7 +838,7 @@
         */
 }
 
-void show_logbook_logbook_show_log_page4(GFX_DrawCfgScreen *hgfx, uint8_t StepBackwards)
+static void show_logbook_logbook_show_log_page4(GFX_DrawCfgScreen *hgfx, uint8_t StepBackwards)
 { SWindowGimpStyle wintemp;
     SWindowGimpStyle winsmal;
     wintemp.left = 50;
@@ -1217,7 +1004,7 @@
     //button_start_single_action(surf1_menu_logbook_current_page, surf1_menu_logbook_show_log_page1, surf1_menu_logbook_show_log_next);
 }
 
-void print_gas_name(char* output,uint8_t length,uint8_t oxygen,uint8_t helium)
+static void print_gas_name(char* output,uint8_t length,uint8_t oxygen,uint8_t helium)
 {
     if(helium == 0)
     {
@@ -1238,7 +1025,7 @@
 
 }
 
-int16_t get_colour(int16_t color)
+static int16_t get_colour(int16_t color)
 {
      return CLUT_GasSensor1 + color;
 }
--- a/Discovery/Src/tInfoLog.c	Fri Mar 15 08:22:16 2019 +0000
+++ b/Discovery/Src/tInfoLog.c	Fri Mar 15 12:39:28 2019 +0100
@@ -57,7 +57,6 @@
 SInfoLogMemory infolog;
 
 /* Private function prototypes -----------------------------------------------*/
-void nextLineInfoLog(void);
 void tInfoLog_BuildAndShowNextPage(void);
 void tInfoLog_nextLine(void);
 void showLog(void);
@@ -162,6 +161,7 @@
     case ACTION_MODE_CHANGE:
     case ACTION_BUTTON_BACK:
         stepBackInfo();
+        break;
     default:
         break;
     case ACTION_IDLE_TICK:
@@ -192,6 +192,7 @@
             showLogExit();
         }
         show_logbook_exit();
+        break;
     default:
         break;
     case ACTION_IDLE_TICK:
--- a/Discovery/Src/timer.c	Fri Mar 15 08:22:16 2019 +0000
+++ b/Discovery/Src/timer.c	Fri Mar 15 12:39:28 2019 +0100
@@ -28,11 +28,10 @@
 
 #include "data_central.h"
 
-long stopWatchTime_Second = 0;
-_Bool bStopWatch = false;
-float stopWatchAverageDepth_Meter = 0.0f;
-long safetyStopCountDown_Second = 0;
-_Bool bSafetyStop = false;
+static long stopWatchTime_Second = 0;
+static _Bool bStopWatch = false;
+static float stopWatchAverageDepth_Meter = 0.0f;
+static long safetyStopCountDown_Second = 0;
 
 void timer_init(void)
 {
@@ -48,7 +47,7 @@
     static int last_second = -1;
     static _Bool bSafetyStop = false;
     static float last_depth_meter = 0;
-    //static _Bool CountDownStarted = false;
+
     if(checkOncePerSecond)
     {
         int now =  current_second();
--- a/Small_CPU/Src/pressure.c	Fri Mar 15 08:22:16 2019 +0000
+++ b/Small_CPU/Src/pressure.c	Fri Mar 15 12:39:28 2019 +0100
@@ -46,30 +46,24 @@
 #define CMD_ADC_4096 0x08 // ADC OSR=4096
 #define CMD_PROM_RD 0xA0 // Prom read command
 
+static uint16_t get_ci_by_coef_num(uint8_t coef_num);
+//void pressure_calculation_new(void);
+//void pressure_calculation_old(void);
+static void pressure_calculation_AN520_004_mod_MS5803_30BA__09_2015(void);
+static uint8_t crc4(uint16_t n_prom[]);
 
-//uint16_t  get_ci(uint8_t cmd);
-//uint8_t  get_ci_crc(void);
-uint16_t  get_ci_by_coef_num(uint8_t coef_num);
-void pressure_calculation_new(void);
-void pressure_calculation_old(void);
-void pressure_calculation_AN520_004_mod_MS5803_30BA__09_2015(void);
-
-uint8_t crc4(uint16_t n_prom[]);
-
-HAL_StatusTypeDef pressure_sensor_get_data(void);
-uint32_t get_adc(void);
+static HAL_StatusTypeDef pressure_sensor_get_data(void);
+static uint32_t get_adc(void);
 uint8_t pressureSensorInitSuccess = 0;
 
-//void test_calculation(void);
+static uint16_t C[8] = { 1 };
+static uint32_t D1 = 1;
+static uint32_t D2 = 1;
+static uint8_t n_crc;
 
-uint16_t C[8] = { 1 };
-uint32_t D1 = 1;
-uint32_t D2 = 1;
-uint8_t n_crc;
-
-int64_t C5_x_2p8 = 1;
-int64_t C2_x_2p16 = 1;
-int64_t C1_x_2p15 = 1;
+static int64_t C5_x_2p8 = 1;
+static int64_t C2_x_2p16 = 1;
+static int64_t C1_x_2p15 = 1;
 
 /*
 short C2plus10000 = -1;
@@ -79,10 +73,10 @@
 short C6plus100 = -1;
 */
 
-float ambient_temperature = 0;
-float ambient_pressure_mbar = 0;
-float surface_pressure_mbar = 1000;
-float surface_ring_mbar[31] = { 0 };
+static float ambient_temperature = 0;
+static float ambient_pressure_mbar = 0;
+static float surface_pressure_mbar = 1000;
+static float surface_ring_mbar[31] = { 0 };
 
 uint8_t secondCounterSurfaceRing = 0;
 
@@ -91,15 +85,11 @@
 	return ambient_temperature;
 }
 
-//float test = 1000;
-
 float get_pressure_mbar(void)
 {
-//	return test;
 	return ambient_pressure_mbar;
 }
 
-
 float get_surface_mbar(void)
 {
 	return surface_pressure_mbar;
@@ -142,7 +132,7 @@
 	surface_ring_mbar[hole] = 0;
 }
 
-
+#ifdef DEMOMODE
 float demo_modify_temperature_helper(float bottom_mbar_diff_to_surface)
 {
 	const float temperature_surface = 31.0;
@@ -217,9 +207,11 @@
 		return 0;
 	}
 }
+#endif
 
 
 /* called just once on power on */
+/* TBD old DR5 code? */
 void init_pressure_DRx(void)
 {
 	uint8_t resetCommand[1] = {0x1E};
@@ -277,12 +269,12 @@
 }
 
 
-uint32_t get_adc(void)
+static uint32_t get_adc(void)
 {
 	uint8_t buffer[1];
 	uint8_t resivebuf[4];
 	uint32_t answer = 0;
-	//
+
 	buffer[0] = 0x00; // Get ADC
 	I2C_Master_Transmit( DEVICE_PRESSURE, buffer, 1);
 	I2C_Master_Receive(  DEVICE_PRESSURE, resivebuf, 4);
@@ -293,7 +285,7 @@
 }
 
 
-uint16_t  get_ci_by_coef_num(uint8_t coef_num)
+static uint16_t get_ci_by_coef_num(uint8_t coef_num)
 {
 	uint8_t resivebuf[2];
 
@@ -315,7 +307,7 @@
 }
 
 
-uint32_t pressure_sensor_get_one_value(uint8_t cmd, HAL_StatusTypeDef *statusReturn)
+static uint32_t pressure_sensor_get_one_value(uint8_t cmd, HAL_StatusTypeDef *statusReturn)
 {
 	uint8_t command = CMD_ADC_CONV + cmd;
 	HAL_StatusTypeDef statusReturnTemp = HAL_TIMEOUT;
@@ -339,7 +331,7 @@
 }
 
 
-HAL_StatusTypeDef pressure_sensor_get_data(void)
+static HAL_StatusTypeDef pressure_sensor_get_data(void)
 {
 	HAL_StatusTypeDef statusReturn1 = HAL_TIMEOUT;
 	HAL_StatusTypeDef statusReturn2 = HAL_TIMEOUT;
@@ -372,14 +364,9 @@
 		return;
 	
 	pressure_calculation_AN520_004_mod_MS5803_30BA__09_2015();
-	return;
-
-	// before October 2016:	pressure_calculation_old();
-	
-//	pressure_calculation_new();
 }
 
-void pressure_calculation_AN520_004_mod_MS5803_30BA__09_2015(void)
+static void pressure_calculation_AN520_004_mod_MS5803_30BA__09_2015(void)
 {
 	uint32_t local_D1; // ADC value of the pressure conversion
 	uint32_t local_D2; // ADC value of the temperature conversion
@@ -446,6 +433,7 @@
 }
 
 
+/*
 void pressure_calculation_new(void)
 {
 #define POW2_8	(256)
@@ -511,8 +499,9 @@
 	ambient_temperature 	= ((float)T) / 100;
 	ambient_pressure_mbar	= ((float)P) / 10;
 }
+*/
 
-
+/*
 void pressure_calculation_old(void) {
 	//
 	double ambient_temperature_centigrad = 0;
@@ -528,12 +517,6 @@
 	static int64_t sens2 = 0;
 	static int64_t t2 = 0;
 
-/* info
-uint16_t C[8] = { 1 };
-uint32_t D1 = 1;
-uint32_t D2 = 1;
-uint8_t n_crc;
-*/
 	if((D2 == 0) || (D1 == 0))
 		return;
 	//
@@ -597,12 +580,13 @@
 	ambient_pressure_decimbar = temp; // to float/double
 	ambient_pressure_mbar = ambient_pressure_decimbar / 10;
 }
+*/
 
 
 /* taken from AN520 by meas-spec.com dated 9. Aug. 2011
  * short and int are both 16bit according to AVR/GCC google results
  */
-uint8_t crc4(uint16_t n_prom[])
+static uint8_t crc4(uint16_t n_prom[])
 {
 uint16_t cnt; // simple counter
 uint16_t n_rem; // crc reminder
--- a/Small_CPU/Src/scheduler.c	Fri Mar 15 08:22:16 2019 +0000
+++ b/Small_CPU/Src/scheduler.c	Fri Mar 15 12:39:28 2019 +0100
@@ -458,11 +458,9 @@
   */
 void scheduleDiveMode(void)
 {
-//	uint32_t tickstart = 0;
 	uint32_t ticksdiff = 0; 
 	uint32_t lasttick = 0;
 
-	uint32_t turbo_seconds = 0;
 	uint8_t counterAscentRate = 0;
 	float lastPressure_bar = 0.0f;
 	global.dataSendToMaster.mode = MODE_DIVE;
@@ -498,9 +496,10 @@
 				global.check_sync_not_running++;
 				pressure_update();
 				scheduleUpdateDeviceData();
+#ifdef DEMOMODE
 				if(global.demo_mode)
 				{
-					turbo_seconds = demo_modify_temperature_and_pressure(global.lifeData.dive_time_seconds, Scheduler.counterPressure100msec, global.ceiling_from_main_CPU_mbar);
+					int turbo_seconds = demo_modify_temperature_and_pressure(global.lifeData.dive_time_seconds, Scheduler.counterPressure100msec, global.ceiling_from_main_CPU_mbar);
 					if(turbo_seconds)
 					{
 						global.lifeData.dive_time_seconds += turbo_seconds;
@@ -510,7 +509,7 @@
 					if((global.lifeData.counterSecondsShallowDepth > 1) && (global.lifeData.counterSecondsShallowDepth < (global.settings.timeoutDiveReachedZeroDepth - 10)))
 						global.lifeData.counterSecondsShallowDepth = (global.settings.timeoutDiveReachedZeroDepth - 10);
 				}
-				
+#endif
 				
 				//Calc ascentrate every two second (20 * 100 ms)
 				counterAscentRate++;
@@ -1543,7 +1542,7 @@
 }
 
 
-//save time diffenrence
+//save time difference
 uint32_t time_elapsed_ms(uint32_t ticksstart,uint32_t ticksnow)
 {
 	if(ticksstart <= ticksnow)