changeset 115:3834b6272ee5 FlipDisplay

Merge with 68181cd61f2069d061621c2cd2a6afddb7486f5e
author Ideenmodellierer
date Thu, 03 Jan 2019 19:59:36 +0100
parents 79b19d56ab08 (current diff) 68181cd61f20 (diff)
children b848056057ce
files Common/Inc/settings.h Discovery/Src/base.c Discovery/Src/data_exchange_main.c Discovery/Src/settings.c Discovery/Src/show_logbook.c Discovery/Src/t7.c Discovery/Src/tMenuEditHardware.c Discovery/Src/text_multilanguage.c ostc4pack/OSTC4_Firmware.bin ostc4pack/OSTC4_RTE.bin ostc4pack/OSTC4_RTE_upload.bin ostc4pack/OSTC4_firmware_upload.bin
diffstat 24 files changed, 1379 insertions(+), 1263 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Common/Inc/global_constants.h	Thu Jan 03 19:59:36 2019 +0100
@@ -0,0 +1,46 @@
+///////////////////////////////////////////////////////////////////////////////
+/// -*- coding: UTF-8 -*-
+///
+/// \file   Common/Inc/global_constants.h
+/// \brief
+/// \author Dmitry Romanov<kitt@bk.ru>
+/// \date   11.2018
+///
+/// $Id$
+///////////////////////////////////////////////////////////////////////////////
+/// \par Copyright (c) 2014-2018 Heinrichs Weikamp gmbh
+///
+///     This program is free software: you can redistribute it and/or modify
+///     it under the terms of the GNU General Public License as published by
+///     the Free Software Foundation, either version 3 of the License, or
+///     (at your option) any later version.
+///
+///     This program is distributed in the hope that it will be useful,
+///     but WITHOUT ANY WARRANTY; without even the implied warranty of
+///     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+///     GNU General Public License for more details.
+///
+///     You should have received a copy of the GNU General Public License
+///     along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef GLOBAL_CONSTANTS_H
+#define GLOBAL_CONSTANTS_H
+//Rename it ahead.
+//Buttons section
+#define DEFAULT_BUTTONRESPONSIVENESS_GUI 30
+#define MIN_BUTTONRESPONSIVENESS_GUI 30 //50 (-10correction)
+#define MAX_BUTTONRESPONSIVENESS_GUI 110//100 (+10correction)
+#define MIN_BUTTONRESPONSIVENESS MIN_BUTTONRESPONSIVENESS_GUI-20 //MIN_BUTTONRESPONSIVENESS_GUI-20 correction
+#define MAX_BUTTONRESPONSIVENESS MAX_BUTTONRESPONSIVENESS_GUI+20//MIN_BUTTONRESPONSIVENESS_GUI+20correction
+#define BUTTON_DEBOUNCE_DELAY 50 //Delay for debounce filter for piezo buttons
+
+
+//Spi sync data debug
+#define SPI_SHOW_SYNC_STATS 1
+#define SPI_MIN_ERROR_SHOW 10
+
+
+//Text data
+#define TEXT_PRESSURE_UNIT "hPa"
+#endif
--- a/Common/Inc/settings.h	Thu Jan 03 18:35:11 2019 +0100
+++ b/Common/Inc/settings.h	Thu Jan 03 19:59:36 2019 +0100
@@ -32,11 +32,13 @@
 
 //#include "data_central.h"
 
+#include "global_constants.h"
 // From Common/Drivers/
 #include "stm32f4xx_hal.h"
 
 #include <stdint.h>
 
+
 #define NUM_GASES 5
 #define NUM_OFFSET_DILUENT 5
 #define SPECIAL_GAS_ID 0
--- a/Discovery/Inc/data_exchange_main.h	Thu Jan 03 18:35:11 2019 +0100
+++ b/Discovery/Inc/data_exchange_main.h	Thu Jan 03 19:59:36 2019 +0100
@@ -39,6 +39,9 @@
 void DataEX_init(void);
 uint8_t DataEX_call(void);
 uint32_t DataEX_time_elapsed_ms(uint32_t ticksstart,uint32_t ticksnow);
+
+uint32_t get_num_SPI_CALLBACKS(void);
+SDataExchangeSlaveToMaster* get_dataInPointer(void);
 void DataEX_copy_to_LifeData(_Bool *modeChangeFlag);
 void DataEX_copy_to_deco(void);
 void DateEx_copy_to_dataOut(void);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Discovery/Inc/global_constants.h	Thu Jan 03 19:59:36 2019 +0100
@@ -0,0 +1,42 @@
+///////////////////////////////////////////////////////////////////////////////
+/// -*- coding: UTF-8 -*-
+///
+/// \file   Common/Inc/global_constants.h
+/// \brief
+/// \author Dmitry Romanov<kitt@bk.ru>
+/// \date   11.2018
+///
+/// $Id$
+///////////////////////////////////////////////////////////////////////////////
+/// \par Copyright (c) 2014-2018 Heinrichs Weikamp gmbh
+///
+///     This program is free software: you can redistribute it and/or modify
+///     it under the terms of the GNU General Public License as published by
+///     the Free Software Foundation, either version 3 of the License, or
+///     (at your option) any later version.
+///
+///     This program is distributed in the hope that it will be useful,
+///     but WITHOUT ANY WARRANTY; without even the implied warranty of
+///     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+///     GNU General Public License for more details.
+///
+///     You should have received a copy of the GNU General Public License
+///     along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef GLOBAL_CONSTANTS_H
+#define GLOBAL_CONSTANTS_H
+//Rename it ahead.
+//Buttons section
+#define DEFAULT_BUTTONRESPONSIVENESS_GUI 90
+#define MIN_BUTTONRESPONSIVENESS_GUI 50 //50 (-10correction)
+#define MAX_BUTTONRESPONSIVENESS_GUI 110//100 (+10correction)
+#define MIN_BUTTONRESPONSIVENESS MIN_BUTTONRESPONSIVENESS_GUI-20 //MIN_BUTTONRESPONSIVENESS_GUI-20 correction
+#define MAX_BUTTONRESPONSIVENESS MAX_BUTTONRESPONSIVENESS_GUI+20//MIN_BUTTONRESPONSIVENESS_GUI+20correction
+#define BUTTON_DEBOUNCE_DELAY 7 //Delay for debounce filter for piezo buttons
+
+
+//Spi sync data debug
+#define SPI_SHOW_SYNC_STATS 1
+#define SPI_MIN_ERROR_SHOW 2
+#endif
--- a/Discovery/Inc/tMenuEditHardware.h	Thu Jan 03 18:35:11 2019 +0100
+++ b/Discovery/Inc/tMenuEditHardware.h	Thu Jan 03 19:59:36 2019 +0100
@@ -31,6 +31,7 @@
 /* Includes ------------------------------------------------------------------*/
 #include "stm32f4xx_hal.h"
 #include "gfx_engine.h"
+#include "global_constants.h"
 #include "settings.h"
 #include "data_central.h"
 
--- a/Discovery/Src/base.c	Thu Jan 03 18:35:11 2019 +0100
+++ b/Discovery/Src/base.c	Thu Jan 03 19:59:36 2019 +0100
@@ -774,48 +774,87 @@
 /// see GFX_change_LTDC()
 ///
 //  ===============================================================================
-void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
-{
-    if(!GPIO_Pin)
-        return;
+void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) {
+	if (!GPIO_Pin)
+		return;
+
+	uint8_t action = 0;
+	SStateList status;
 
-    uint8_t action = 0;
-    SStateList status;
+	if (GPIO_Pin == VSYNC_IRQ_PIN) // rechts, unten
+	{
+		GFX_change_LTDC();
+		housekeepingFrame();
+		/*
+		 #ifdef DEMOMODE
+		 static uint8_t countCall = 0;
+		 if(countCall++ < 10)
+		 return;
+		 countCall = 0;
+		 uint8_t buttonAction = demoGetCommand();
+		 if(buttonAction)
+		 GPIO_Pin = buttonAction;
+		 else
+		 #endif
+		 */
+		return;
+	}
+	
 	SSettings* pSettings;
 	pSettings = settingsGetPointer();
-
-    if(GPIO_Pin == VSYNC_IRQ_PIN) // rechts, unten
-    {
-        GFX_change_LTDC();
-        housekeepingFrame();
-/*
-#ifdef DEMOMODE
-    static uint8_t countCall = 0;
-    if(countCall++ < 10)
-        return;
-    countCall = 0;
-    uint8_t buttonAction = demoGetCommand();
-    if(buttonAction)
-        GPIO_Pin = buttonAction;
-    else
-#endif
-*/
-        return;
-    }
+	if (GPIO_Pin == VSYNC_IRQ_PIN) // rechts, unten
+	{
+		GFX_change_LTDC();
+		housekeepingFrame();
+		/*
+		 #ifdef DEMOMODE
+		 static uint8_t countCall = 0;
+		 if(countCall++ < 10)
+		 return;
+		 countCall = 0;
+		 uint8_t buttonAction = demoGetCommand();
+		 if(buttonAction)
+		 GPIO_Pin = buttonAction;
+		 else
+		 #endif
+		 */
+		return;
+	}
 
 #ifdef DEMOMODE
-    uint8_t demoMachineCall = 0;
-    if(GPIO_Pin & 0x80)
-    {
-        demoMachineCall = 1;
-        GPIO_Pin &= 0x7F;
-    }
+	uint8_t demoMachineCall = 0;
+	if(GPIO_Pin & 0x80)
+	{
+		demoMachineCall = 1;
+		GPIO_Pin &= 0x7F;
+	}
 #endif
 
-    time_without_button_pressed_deciseconds	= 0;
+	time_without_button_pressed_deciseconds = 0;
+
+	if (GFX_logoStatus() != 0)
+		return;
+
+	if (GPIO_Pin == BUTTON_BACK_PIN) { // links
+		HAL_Delay(BUTTON_DEBOUNCE_DELAY);
+		if (HAL_GPIO_ReadPin(BUTTON_BACK_GPIO_PORT, BUTTON_BACK_PIN) == 1) {
+			action = ACTION_BUTTON_BACK;
+		}
+	}
 
-    if(GFX_logoStatus() != 0)
-        return;
+	else if (GPIO_Pin == BUTTON_ENTER_PIN) { // mitte
+		HAL_Delay(BUTTON_DEBOUNCE_DELAY);
+		if (HAL_GPIO_ReadPin(BUTTON_ENTER_GPIO_PORT, BUTTON_ENTER_PIN) == 1) {
+			action = ACTION_BUTTON_ENTER;
+		}
+	}
+
+	else if (GPIO_Pin == BUTTON_NEXT_PIN) { // rechts
+		HAL_Delay(BUTTON_DEBOUNCE_DELAY);
+		if (HAL_GPIO_ReadPin(BUTTON_NEXT_GPIO_PORT, BUTTON_NEXT_PIN) == 1) {
+			action = ACTION_BUTTON_NEXT;
+		}
+	}
 
     if(GPIO_Pin == BUTTON_BACK_PIN) // links
     {
@@ -848,99 +887,82 @@
 	#endif
 
 #ifdef DEMOMODE // user pressed button ?
-    if((!demoMachineCall) && demoModeActive())
-    {
-        demoSendCommand(action);
-        return;
-    }
+	if((!demoMachineCall) && demoModeActive())
+	{
+		demoSendCommand(action);
+		return;
+	}
 #endif
 
-    get_globalStateList(&status);
+	get_globalStateList(&status);
 
-    if(action == ACTION_BUTTON_CUSTOM)
-    {
-        GFX_screenshot();
-    }
+	if (action == ACTION_BUTTON_CUSTOM) {
+		GFX_screenshot();
+	}
 
-    switch(status.base)
-    {
-    case BaseStop:
-        if(action == ACTION_BUTTON_BACK)
-            resetToFirmwareUpdate();
-        break;
-    case BaseComm:
-        if(action == ACTION_BUTTON_BACK)
-        {
-            settingsGetPointer()->bluetoothActive = 0;
-            MX_Bluetooth_PowerOff();
-            tComm_exit();
-        }
-        break;
-    case BaseHome:
-        if(action == ACTION_BUTTON_NEXT)
-        {
-            if(status.page == PageSurface)
-                openMenu(1);
-            else
-                tHomeDiveMenuControl(action);
-        }
-        else
-        if(action == ACTION_BUTTON_BACK)
-        {
-            if(get_globalState() == StS)
-                openInfo(StILOGLIST);
-            else
-            if((status.page == PageDive) && (settingsGetPointer()->design < 7))
-            {
-                settingsGetPointer()->design = 7; // auto switch to 9 if necessary
-            }
-            else
-            if((status.page == PageDive) && (status.line != 0))
-            {
-                if(settingsGetPointer()->extraDisplay == EXTRADISPLAY_BIGFONT)
-                    settingsGetPointer()->design = 3;
-                else
-                if(settingsGetPointer()->extraDisplay == EXTRADISPLAY_DECOGAME)
-                    settingsGetPointer()->design = 4;
+	switch (status.base) {
+	case BaseStop:
+		if (action == ACTION_BUTTON_BACK)
+			resetToFirmwareUpdate();
+		break;
+	case BaseComm:
+		if (action == ACTION_BUTTON_BACK) {
+			settingsGetPointer()->bluetoothActive = 0;
+			MX_Bluetooth_PowerOff();
+			tComm_exit();
+		}
+		break;
+	case BaseHome:
+		if (action == ACTION_BUTTON_NEXT) {
+			if (status.page == PageSurface)
+				openMenu(1);
+			else
+				tHomeDiveMenuControl(action);
+		} else if (action == ACTION_BUTTON_BACK) {
+			if (get_globalState() == StS)
+				openInfo(StILOGLIST);
+			else if ((status.page == PageDive)
+					&& (settingsGetPointer()->design < 7)) {
+				settingsGetPointer()->design = 7; // auto switch to 9 if necessary
+			} else if ((status.page == PageDive) && (status.line != 0)) {
+				if (settingsGetPointer()->extraDisplay == EXTRADISPLAY_BIGFONT)
+					settingsGetPointer()->design = 3;
+				else if (settingsGetPointer()->extraDisplay
+						== EXTRADISPLAY_DECOGAME)
+					settingsGetPointer()->design = 4;
 
-                set_globalState(StD);
-            }
-            else
-                tHome_change_field_button_pressed();
-        }
-        else
-        if(action == ACTION_BUTTON_ENTER)
-        {
-            if((status.page == PageDive) && (status.line == 0))
-                tHome_change_customview_button_pressed();
-            else
-            if(status.page == PageSurface)
-                tHome_change_customview_button_pressed();
-            else
-                tHomeDiveMenuControl(action);
-        }
-        break;
+				set_globalState(StD);
+			} else
+				tHome_change_field_button_pressed();
+		} else if (action == ACTION_BUTTON_ENTER) {
+			if ((status.page == PageDive) && (status.line == 0))
+				tHome_change_customview_button_pressed();
+			else if (status.page == PageSurface)
+				tHome_change_customview_button_pressed();
+			else
+				tHomeDiveMenuControl(action);
+		}
+		break;
 
-    case BaseMenu:
-        if(status.line == 0)
-            sendActionToMenu(action);
-        else
-            sendActionToMenuEdit(action);
-        break;
+	case BaseMenu:
+		if (status.line == 0)
+			sendActionToMenu(action);
+		else
+			sendActionToMenuEdit(action);
+		break;
 
-    case BaseInfo:
-        if(status.page == InfoPageLogList)
-            sendActionToInfoLogList(action);
-        else
-        if(status.page == InfoPageLogShow)
-            sendActionToInfoLogShow(action);
-        else
-            sendActionToInfo(action);
-        break;
+	case BaseInfo:
+		if (status.page == InfoPageLogList)
+			sendActionToInfoLogList(action);
+		else if (status.page == InfoPageLogShow)
+			sendActionToInfoLogShow(action);
+		else
+			sendActionToInfo(action);
+		break;
 
-    default:
-        break;
-    }
+	default:
+		break;
+	}
 }
 
 
--- a/Discovery/Src/data_exchange_main.c	Thu Jan 03 18:35:11 2019 +0100
+++ b/Discovery/Src/data_exchange_main.c	Thu Jan 03 19:59:36 2019 +0100
@@ -167,7 +167,7 @@
 void DataEX_init(void)
 {
 	SDiveState * pStateReal = stateRealGetPointerWrite();
-	pStateReal->data_old__lost_connection_to_slave = 1;
+	pStateReal->data_old__lost_connection_to_slave = 0; //initial value
 	data_old__lost_connection_to_slave_counter_temp = 0;
 	data_old__lost_connection_to_slave_counter_total = 0;
 
@@ -306,8 +306,8 @@
 	uint8_t SPI_DMA_answer = 0;
 	
 	HAL_GPIO_WritePin(SMALLCPU_CSB_GPIO_PORT,SMALLCPU_CSB_PIN,GPIO_PIN_SET);
-	delayMicros(10);
-
+	delayMicros(20); //~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)
@@ -315,10 +315,10 @@
 		data_old__lost_connection_to_slave_counter_temp = 0;
 		data_old__lost_connection_to_slave_counter_retry++;
 	}
-	else
-	{
-		HAL_GPIO_WritePin(SMALLCPU_CSB_GPIO_PORT,SMALLCPU_CSB_PIN,GPIO_PIN_RESET);
-	}
+//	else
+//	{
+//		HAL_GPIO_WritePin(SMALLCPU_CSB_GPIO_PORT,SMALLCPU_CSB_PIN,GPIO_PIN_RESET);
+//	}
 
 	DataEx_call_helper_requests();
 
@@ -326,15 +326,42 @@
 
 //HAL_GPIO_WritePin(OSCILLOSCOPE2_GPIO_PORT,OSCILLOSCOPE2_PIN,GPIO_PIN_RESET); /* only for testing with Oscilloscope */
 
-	SPI_DMA_answer = HAL_SPI_TransmitReceive_DMA(&cpu2DmaSpi, (uint8_t *)&dataOut, (uint8_t *)&dataIn, EXCHANGE_BUFFERSIZE+1);
+	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 */
 
 	return 1;
 }
 
+
+uint32_t SPI_CALLBACKS;
+uint32_t get_num_SPI_CALLBACKS(void){
+	return SPI_CALLBACKS;
+}
+
+SDataExchangeSlaveToMaster* get_dataInPointer(void){
+	return &dataIn;
+}
+
+
+void HAL_SPI_TxRxCpltCallback(SPI_HandleTypeDef *hspi)
+{
+
+
+	if(hspi == &cpu2DmaSpi)
+	{
+		SPI_CALLBACKS+=1;
+	}
+}
+
+
+
+
+
 void DateEx_copy_to_dataOut(void)
 {
 	const SDiveState * pStateReal = stateRealGetPointer();
@@ -431,9 +458,9 @@
         return;
 	if(stateUsed == stateRealGetPointer())
 		pStateUsed = stateRealGetPointerWrite();
-	else
+	else{
 		pStateUsed = stateSimGetPointerWrite();
-
+	}
 
 		if(decoLock == DECO_CALC_init_as_is_start_of_dive)
 		{
--- a/Discovery/Src/ostc.c	Thu Jan 03 18:35:11 2019 +0100
+++ b/Discovery/Src/ostc.c	Thu Jan 03 19:59:36 2019 +0100
@@ -81,7 +81,7 @@
     cpu2DmaSpi.Init.CLKPolarity         = SPI_POLARITY_LOW;
     cpu2DmaSpi.Init.CLKPhase            = SPI_PHASE_1EDGE;
     cpu2DmaSpi.Init.NSS                 = SPI_NSS_SOFT;//SPI_NSS_HARD_OUTPUT;//SPI_NSS_SOFT;
-    cpu2DmaSpi.Init.BaudRatePrescaler   = SPI_BAUDRATEPRESCALER_128;
+    cpu2DmaSpi.Init.BaudRatePrescaler   = SPI_BAUDRATEPRESCALER_8;
     cpu2DmaSpi.Init.FirstBit            = SPI_FIRSTBIT_MSB;
     cpu2DmaSpi.Init.TIMode              = SPI_TIMODE_DISABLED;
     cpu2DmaSpi.Init.CRCCalculation 		= SPI_CRCCALCULATION_DISABLED;
--- a/Discovery/Src/settings.c	Thu Jan 03 18:35:11 2019 +0100
+++ b/Discovery/Src/settings.c	Thu Jan 03 19:59:36 2019 +0100
@@ -55,8 +55,8 @@
 {
     .versionFirst   = 1,
     .versionSecond 	= 4,
-    .versionThird   = 3,
-    .versionBeta    = 0,
+    .versionThird   = 4,
+    .versionBeta    = 1,
 
     /* 4 bytes with trailing 0 */
     .signature = "mh",
@@ -256,10 +256,10 @@
     .totalDiveCounter = 0,
     .personalDiveCount = 0,
     .showDebugInfo = 0,
-    .ButtonResponsiveness[0] = 90, // new hw 170306
-    .ButtonResponsiveness[1] = 90, // new hw 170306
-    .ButtonResponsiveness[2] = 90, // new hw 170306
-    .ButtonResponsiveness[3] = 90, // new hw 170306
+    .ButtonResponsiveness[0] = DEFAULT_BUTTONRESPONSIVENESS_GUI, // new hw 170306
+    .ButtonResponsiveness[1] = DEFAULT_BUTTONRESPONSIVENESS_GUI, // new hw 170306
+    .ButtonResponsiveness[2] = DEFAULT_BUTTONRESPONSIVENESS_GUI, // new hw 170306
+    .ButtonResponsiveness[3] = DEFAULT_BUTTONRESPONSIVENESS_GUI, // new hw 170306
     .nonMetricalSystem = 0,
     .fallbackToFixedSetpoint = 1,
     .bluetoothActive = 0,
@@ -301,7 +301,7 @@
     .timeoutSurfacemodeWithSensors = 600,
     .VPM_model = 0,
     .GF_model = 0,
-    .FactoryButtonBase = 90,
+    .FactoryButtonBase = DEFAULT_BUTTONRESPONSIVENESS_GUI,
     .FactoryButtonBalance[0] = 3,
     .FactoryButtonBalance[1] = 3,
     .FactoryButtonBalance[2] = 3,
@@ -1049,29 +1049,29 @@
 /*	uint8_t ButtonResponsiveness[4];
  */
     // Base value, index 3
-    if(Settings.ButtonResponsiveness[3] < 70)
+    if(Settings.ButtonResponsiveness[3] < MIN_BUTTONRESPONSIVENESS_GUI)
     {
-        Settings.ButtonResponsiveness[3] = 70;
+        Settings.ButtonResponsiveness[3] = MIN_BUTTONRESPONSIVENESS_GUI;
         corrections++;
     }
     else
-    if(Settings.ButtonResponsiveness[3] > 110)
+    if(Settings.ButtonResponsiveness[3] > MIN_BUTTONRESPONSIVENESS_GUI)
     {
-        Settings.ButtonResponsiveness[3] = 130;
+        Settings.ButtonResponsiveness[3] = MIN_BUTTONRESPONSIVENESS;
         corrections++;
     }
     // flex values 0, 1, 2
     for(int i=0; i<3;i++)
     {
-        if(Settings.ButtonResponsiveness[i] < 60) // 70-10
+        if(Settings.ButtonResponsiveness[i] < MIN_BUTTONRESPONSIVENESS) // 50-10  //Fix for broken buttons. :)
         {
-            Settings.ButtonResponsiveness[i] = 70;
+            Settings.ButtonResponsiveness[i] = MIN_BUTTONRESPONSIVENESS;
             corrections++;
         }
         else
-        if(Settings.ButtonResponsiveness[i] > 130) // 110+20
+        if(Settings.ButtonResponsiveness[i] > MAX_BUTTONRESPONSIVENESS) // 110+20
         {
-            Settings.ButtonResponsiveness[i] = 130;
+            Settings.ButtonResponsiveness[i] = MAX_BUTTONRESPONSIVENESS;
             corrections++;
         }
     }
@@ -2664,14 +2664,14 @@
 {
     uint32_t newSensitivity;
 
-    if(inputValueRaw > 110)
+    if(inputValueRaw > MAX_BUTTONRESPONSIVENESS)
     {
-            inputValueRaw = 110;
+            inputValueRaw = MAX_BUTTONRESPONSIVENESS;
     }
     else
-    if(inputValueRaw < 70)
+    if(inputValueRaw < MIN_BUTTONRESPONSIVENESS)
     {
-            inputValueRaw = 70;
+            inputValueRaw = MIN_BUTTONRESPONSIVENESS;
     }
 
     // the unbalanced value
@@ -2699,9 +2699,9 @@
             break;
         }
 
-        if(newSensitivity > 110)
+        if(newSensitivity > MAX_BUTTONRESPONSIVENESS)
         {
-                newSensitivity = 110;
+                newSensitivity = MAX_BUTTONRESPONSIVENESS;
         }
         outArray4Values[i] = newSensitivity;
     }
--- a/Discovery/Src/show_logbook.c	Thu Jan 03 18:35:11 2019 +0100
+++ b/Discovery/Src/show_logbook.c	Thu Jan 03 19:59:36 2019 +0100
@@ -648,7 +648,7 @@
 //		snprintf(text,20,"\001%i\016\016 mbar",logbookHeader.surfacePressure_mbar);
 //		Gfx_write_label_var(hgfx,300,500,750, &FontT42,CLUT_GasSensor1,text);
 //		snprintf(text,40,"%i\016\016 mbar\017  (%i\016\016 m\017)",logbookHeader.surfacePressure_mbar, unit_SeaLevelRelation_integer(logbookHeader.surfacePressure_mbar));
-    snprintf(text,40,"%i\016\016 mbar\017",logbookHeader.surfacePressure_mbar);
+    snprintf(text,40,"%i\016\016 hPa\017",logbookHeader.surfacePressure_mbar);
     Gfx_write_label_var(hgfx,320,600,750, &FontT42,CLUT_GasSensor1,text);
 
 
--- a/Discovery/Src/t7.c	Thu Jan 03 18:35:11 2019 +0100
+++ b/Discovery/Src/t7.c	Thu Jan 03 19:59:36 2019 +0100
@@ -970,7 +970,7 @@
     /* surface pressure  and temperature */
     if(stateUsed->sensorErrorsRTE == 0)
     {
-        snprintf(text,30,"%01.0f\022\016\016 mbar", stateUsed->lifeData.pressure_surface_bar * 1000.0f);
+        snprintf(text,30,"%01.0f\022\016\016 %s", stateUsed->lifeData.pressure_surface_bar * 1000.0f,TEXT_PRESSURE_UNIT);
         GFX_write_string(&FontT48,&t7surfaceL,text,3);
 
         if(settingsGetPointer()->nonMetricalSystem)
@@ -981,7 +981,7 @@
     }
     else
     {
-        snprintf(text,30,"ERR\022\016\016 mbar");
+        snprintf(text,30,"ERR\022\016\016 %s",TEXT_PRESSURE_UNIT);
         GFX_write_string(&FontT48,&t7surfaceL,text,3);
 
         if(settingsGetPointer()->nonMetricalSystem)
@@ -1295,7 +1295,7 @@
         Gfx_write_label_var(&t7screen,  0,400,255,&FontT48,CLUT_Font020,TextL1);
         return;
     }
-    snprintf(TextL1,TEXTSIZE,"%01.0f mbar",stateUsed->lifeData.pressure_ambient_bar * 1000.0f);
+    snprintf(TextL1,TEXTSIZE,"%01.0f %s",stateUsed->lifeData.pressure_ambient_bar * 1000.0f,TEXT_PRESSURE_UNIT);
     Gfx_write_label_var(&t7screen,  0,400,  0,&FontT42,CLUT_DiveMainLabel,"Ambient Pressure");
     Gfx_write_label_var(&t7screen,  0,400, 45,&FontT48,CLUT_Font020,TextL1);
 
@@ -1307,7 +1307,7 @@
     Gfx_write_label_var(&t7screen,  0,400,200,&FontT42,CLUT_DiveMainLabel,"Heading Roll Pitch");
     Gfx_write_label_var(&t7screen,  0,400,255,&FontT48,CLUT_Font020,TextL1);
 
-    snprintf(TextL1,TEXTSIZE,"%01.0f mbar",stateUsed->lifeData.pressure_surface_bar * 1000.0f);
+    snprintf(TextL1,TEXTSIZE,"%01.0f %s",stateUsed->lifeData.pressure_surface_bar * 1000.0f,TEXT_PRESSURE_UNIT);
     Gfx_write_label_var(&t7screen,  0,400,310,&FontT42,CLUT_DiveMainLabel,"Surface Pressure");
     Gfx_write_label_var(&t7screen,  0,400,355,&FontT48,CLUT_Font020,TextL1);
 
--- a/Discovery/Src/t9.c	Thu Jan 03 18:35:11 2019 +0100
+++ b/Discovery/Src/t9.c	Thu Jan 03 19:59:36 2019 +0100
@@ -678,7 +678,7 @@
             // Wechseltiefe
             if(pGasLine[gasId].depth_meter)
             {
-                textpointer += snprintf(&text[textpointer],6,"\t%u m",pGasLine[gasId].depth_meter);
+
             }
             GFX_write_string(&FontT42, &t9cY0free, text, gasId);
         }
--- a/Discovery/Src/tHome.c	Thu Jan 03 18:35:11 2019 +0100
+++ b/Discovery/Src/tHome.c	Thu Jan 03 19:59:36 2019 +0100
@@ -436,15 +436,30 @@
 
 uint8_t tHome_show_lost_connection_count(GFX_DrawCfgScreen *ScreenToWriteOn)
 {
-    return 0;
+	if(!SPI_MIN_ERROR_SHOW) return 0;
+	if(DataEX_lost_connection_count()>=SPI_MIN_ERROR_SHOW){
+
+    char text[64];
 
-    if(!DataEX_lost_connection_count())
-        return 0;
+    SDataExchangeSlaveToMaster* dataIn=get_dataInPointer();
+
+    snprintf(text,32,"spi err:\002 %i/%i",DataEX_lost_connection_count(),get_num_SPI_CALLBACKS());
+    Gfx_write_label_var(ScreenToWriteOn,  100,300, 0,&FontT24,CLUT_ButtonSymbols,text);
 
-    char text[10];
+//    snprintf(text,32,"header:\002%X%X%X%X",dataIn->header.checkCode[0],dataIn->header.checkCode[1],dataIn->header.checkCode[2],dataIn->header.checkCode[3]);
+//    Gfx_write_label_var(ScreenToWriteOn,  350,550, 0,&FontT24,CLUT_ButtonSymbols,text);
+
+    snprintf(text,32,"footer:\002%X%X%X%X",dataIn->footer.checkCode[0],dataIn->footer.checkCode[1],dataIn->footer.checkCode[2],dataIn->footer.checkCode[3]);
+    Gfx_write_label_var(ScreenToWriteOn,  600,800, 0,&FontT24,CLUT_ButtonSymbols,text);
+    }
 
-    snprintf(text,10,"\002   %i",DataEX_lost_connection_count());
-    Gfx_write_label_var(ScreenToWriteOn,  600,800, 0,&FontT48,CLUT_ButtonSymbols,text);
+
+
+//    snprintf(text,32,"cpt:\002%i",get_num_SPI_CALLBACKS());
+//    Gfx_write_label_var(ScreenToWriteOn,  600,800, 90,&FontT24,CLUT_ButtonSymbols,text);
+
+//    snprintf(text,10,"i2c:\002%i",get_DataEX_Error_place());
+//    Gfx_write_label_var(ScreenToWriteOn,  600,800, 90,&FontT24,CLUT_ButtonSymbols,text);
 
     return DataEX_lost_connection_count();
 }
--- a/Discovery/Src/tMenuEditHardware.c	Thu Jan 03 18:35:11 2019 +0100
+++ b/Discovery/Src/tMenuEditHardware.c	Thu Jan 03 19:59:36 2019 +0100
@@ -36,6 +36,7 @@
 #include "tCCR.h"
 #include "tMenuEdit.h"
 
+
 /* Private function prototypes -----------------------------------------------*/
 void openEdit_Bluetooth(void);
 void openEdit_Compass(void);
@@ -792,16 +793,16 @@
     if(action == ACTION_BUTTON_NEXT)
     {
         digitContentNew = digitContent - '0';
-        if(digitContentNew >= 110)
+        if(digitContentNew >= MAX_BUTTONRESPONSIVENESS_GUI)
         {
-            digitContentNew = 70;
+            digitContentNew = MIN_BUTTONRESPONSIVENESS_GUI;
         }
         else
         {
             remainder = digitContentNew%5;
             digitContentNew += 5 - remainder;
-            if(digitContentNew >= 110)
-                digitContentNew = 110;
+            if(digitContentNew >= MAX_BUTTONRESPONSIVENESS_GUI)
+                digitContentNew = MAX_BUTTONRESPONSIVENESS_GUI;
         }
         return '0' + digitContentNew;
     }
@@ -809,8 +810,8 @@
     if(action == ACTION_BUTTON_BACK)
     {
         digitContentNew = digitContent - '0';
-        if(digitContentNew <= 70)
-            digitContentNew = 110;
+        if(digitContentNew <= MIN_BUTTONRESPONSIVENESS_GUI)
+            digitContentNew = MAX_BUTTONRESPONSIVENESS_GUI;
         else
         {
             remainder = digitContentNew%5;
--- a/Discovery/Src/tMenuEditSystem.c	Thu Jan 03 18:35:11 2019 +0100
+++ b/Discovery/Src/tMenuEditSystem.c	Thu Jan 03 19:59:36 2019 +0100
@@ -506,14 +506,14 @@
         active = 0;
     write_field_on_off(StMSYS2_Italian,			 30, 800, ME_Y_LINE4,  &FontT48, text, active);
 
-/*
+
     pSettings->selected_language = LANGUAGE_Espanol;
     if(	actualLanguage == pSettings->selected_language)
         active = 1;
     else
         active = 0;
     write_field_on_off(StMSYS2_Espanol,			 30, 800, ME_Y_LINE5,  &FontT48, text, active);
-*/
+
     pSettings->selected_language = actualLanguage;
 
     write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext);
@@ -522,7 +522,7 @@
     setEvent(StMSYS2_German, 	(uint32_t)OnAction_German);
     setEvent(StMSYS2_French,	(uint32_t)OnAction_French);
     setEvent(StMSYS2_Italian,	(uint32_t)OnAction_Italian);
-    //setEvent(StMSYS2_Espanol,	(uint32_t)OnAction_Espanol);
+    setEvent(StMSYS2_Espanol,	(uint32_t)OnAction_Espanol);
 }
 
 
@@ -1237,7 +1237,7 @@
         write_label_var(  20, 800, ME_Y_LINE4, &FontT42, text_content);
 
         offsetTemperature = ((float)settingsGetPointer()->offsetTemperature_centigrad) / 10;
-        snprintf(text_content,80,"%i mbar  /  %0.2f\140C",settingsGetPointer()->offsetPressure_mbar, offsetTemperature);
+        snprintf(text_content,80,"%i %s  /  %0.2f\140C",settingsGetPointer()->offsetPressure_mbar, TEXT_PRESSURE_UNIT, offsetTemperature);
         write_label_var(  20, 800, ME_Y_LINE5, &FontT42, text_content);
 
         text_button[0] = TXT_2BYTE;
--- a/Discovery/Src/text_multilanguage.c	Thu Jan 03 18:35:11 2019 +0100
+++ b/Discovery/Src/text_multilanguage.c	Thu Jan 03 19:59:36 2019 +0100
@@ -41,559 +41,559 @@
 static uint8_t text_DE_Language[] = "Sprache";
 static uint8_t text_FR_Language[] = "Langue";
 static uint8_t text_IT_Language[] = "Lingua";
-static uint8_t text_ES_Language[] = "";
+static uint8_t text_ES_Language[] = "Idioma";
 
 // Menu
 static uint8_t text_EN_LanguageName[] = "English";
 static uint8_t text_DE_LanguageName[] = "Deutsch";
 static uint8_t text_FR_LanguageName[] = "Français";
 static uint8_t text_IT_LanguageName[] = "Italiano";
-static uint8_t text_ES_LanguageName[] = "";
+static uint8_t text_ES_LanguageName[] = "Spanish";  
 
 // dive mode
 static uint8_t text_EN_Depth[] = "Depth";
 static uint8_t text_DE_Depth[] = "Tiefe";
 static uint8_t text_FR_Depth[] = "Profondeur";
 static uint8_t text_IT_Depth[] = "Profondita";
-static uint8_t text_ES_Depth[] = "";
+static uint8_t text_ES_Depth[] = "Profundidad";
 
 // dive mode
 static uint8_t text_EN_Divetime[] = "Divetime";
 static uint8_t text_DE_Divetime[] = "Tauchzeit";
 static uint8_t text_FR_Divetime[] = "Durée";
 static uint8_t text_IT_Divetime[] = "Tempo";
-static uint8_t text_ES_Divetime[] = "";
+static uint8_t text_ES_Divetime[] = "Tiempo";
 
 // dive mode
 static uint8_t text_EN_MaxDepth[] = "Max depth";
 static uint8_t text_DE_MaxDepth[] = "Max Tiefe";
 static uint8_t text_FR_MaxDepth[] = "Prof. max";    // Profondeur
 static uint8_t text_IT_MaxDepth[] = "Prof. max";
-static uint8_t text_ES_MaxDepth[] = "";
+static uint8_t text_ES_MaxDepth[] = "Prof. max";    
 
 // dive mode
 static uint8_t text_EN_AvgDepth[] = "Avg depth";
 static uint8_t text_DE_AvgDepth[] = "(/) Tiefe";
 static uint8_t text_FR_AvgDepth[] = "Prof. moy";
 static uint8_t text_IT_AvgDepth[] = "Prof. media";
-static uint8_t text_ES_AvgDepth[] = "";
+static uint8_t text_ES_AvgDepth[] = "Prof. media";
 
 // dive mode
 static uint8_t text_EN_Decostop[] = "Decostop";
 static uint8_t text_DE_Decostop[] = "Dekostopp";
 static uint8_t text_FR_Decostop[] = "Palier"; // Déco
 static uint8_t text_IT_Decostop[] = "Decostop";
-static uint8_t text_ES_Decostop[] = "";
+static uint8_t text_ES_Decostop[] = "Parada Deco";    
 
 // dive mode
 static uint8_t text_EN_Nullzeit[] = "NDL";
 static uint8_t text_DE_Nullzeit[] = "Nullzeit";
 static uint8_t text_FR_Nullzeit[] = "No Déco";       // Sans palier
 static uint8_t text_IT_Nullzeit[] = "No Deco";
-static uint8_t text_ES_Nullzeit[] = "";
+static uint8_t text_ES_Nullzeit[] = "No Deco";       
 
 // dive mode
 static uint8_t text_EN_ppO2[] = "ppO2";
 static uint8_t text_DE_ppO2[] = "ppO2";
 static uint8_t text_FR_ppO2[] = "ppO2";
 static uint8_t text_IT_ppO2[] = "ppO2";
-static uint8_t text_ES_ppO2[] = "";
+static uint8_t text_ES_ppO2[] = "ppO2";
 
 // dive mode
 static uint8_t text_EN_TTS[] = "TTS";
 static uint8_t text_DE_TTS[] = "TTS";
 static uint8_t text_FR_TTS[] = "DTR";
 static uint8_t text_IT_TTS[] = "TTS";
-static uint8_t text_ES_TTS[] = "";
+static uint8_t text_ES_TTS[] = "TTS";
 
 // dive mode
 static uint8_t text_EN_CNSshort[] = "CNS";
 static uint8_t text_DE_CNSshort[] = "ZNS";
 static uint8_t text_FR_CNSshort[] = "SNC";
 static uint8_t text_IT_CNSshort[] = "CNS";
-static uint8_t text_ES_CNSshort[] = "";
+static uint8_t text_ES_CNSshort[] = "CNS";
 
 // dive mode
 static uint8_t text_EN_Temperature[] = "Temp.";
 static uint8_t text_DE_Temperature[] = "Temperatur";
 static uint8_t text_FR_Temperature[] = "Temp."; // Température (ist zu lang)
 static uint8_t text_IT_Temperature[] = "Temp.";
-static uint8_t text_ES_Temperature[] = "";
+static uint8_t text_ES_Temperature[] = "Temp."; 
 
 // dive mode
 static uint8_t text_EN_FutureTTS[] = "FutureTTS";
 static uint8_t text_DE_FutureTTS[] = "FutureTTS";
 static uint8_t text_FR_FutureTTS[] = "FutureDTR";
 static uint8_t text_IT_FutureTTS[] = "TTS Futuro";
-static uint8_t text_ES_FutureTTS[] = "";
+static uint8_t text_ES_FutureTTS[] = "TTS Futuro";
 
 // Menu (as small text)
 static uint8_t text_EN_Minutes[] = "Minutes";
 static uint8_t text_DE_Minutes[] = "Minuten";
 static uint8_t text_FR_Minutes[] = "Minutes";
 static uint8_t text_IT_Minutes[] = "Minuti";
-static uint8_t text_ES_Minutes[] = "";
+static uint8_t text_ES_Minutes[] = "Minutos";
 
 // Menu SYS2 sub (as small text in custom views)
 static uint8_t text_EN_Seconds[] = "Seconds";
 static uint8_t text_DE_Seconds[] = "Sekunden";
 static uint8_t text_FR_Seconds[] = "Secondes";
 static uint8_t text_IT_Seconds[] = "Secondi";
-static uint8_t text_ES_Seconds[] = "";
+static uint8_t text_ES_Seconds[] = "Segundos";
 
 // Menu OC sub and Menu CC sub
 static uint8_t text_EN_Gas[] = "Gas";
 static uint8_t text_DE_Gas[] = "Gas";
 static uint8_t text_FR_Gas[] = "Gaz";
 static uint8_t text_IT_Gas[] = "Gas";
-static uint8_t text_ES_Gas[] = "";
+static uint8_t text_ES_Gas[] = "Gas";
 
 // dive mode
 static uint8_t text_EN_Ceiling[] = "Ceiling";
 static uint8_t text_DE_Ceiling[] = "Ceiling";
 static uint8_t text_FR_Ceiling[] = "Plafond";
 static uint8_t text_IT_Ceiling[] = "Ceiling";
-static uint8_t text_ES_Ceiling[] = "";
+static uint8_t text_ES_Ceiling[] = "Techo";
 
 // dive mode
 static uint8_t text_EN_ActualGradient[] = "Relative GF";
 static uint8_t text_DE_ActualGradient[] = "Relativ GF";
 static uint8_t text_FR_ActualGradient[] = "GF relatif";
 static uint8_t text_IT_ActualGradient[] = "GF relativo";
-static uint8_t text_ES_ActualGradient[] = "";
+static uint8_t text_ES_ActualGradient[] = "GF relativo";
 
 // dive mode
 static uint8_t text_EN_Stopwatch[] = "Stopwatch";
 static uint8_t text_DE_Stopwatch[] = "Stoppuhr";
 static uint8_t text_FR_Stopwatch[] = "Chrono";
 static uint8_t text_IT_Stopwatch[] = "Stop Cronometro";
-static uint8_t text_ES_Stopwatch[] = "";
+static uint8_t text_ES_Stopwatch[] = "Parar Cronómetro";
 
 // Menu SYS1 sub
 static uint8_t text_EN_CompassCalib[] = "Calibrate compass";
 static uint8_t text_DE_CompassCalib[] = "Kompass kalibrieren";
 static uint8_t text_FR_CompassCalib[] = "Calibration boussole";
 static uint8_t text_IT_CompassCalib[] = "Calibrazione bussola";
-static uint8_t text_ES_CompassCalib[] = "";
+static uint8_t text_ES_CompassCalib[] = "Calibrar brújula";
 
 // Menu SYS1 and Customview header
 static uint8_t text_EN_Compass[] = "Compass";
 static uint8_t text_DE_Compass[] = "Kompass";
 static uint8_t text_FR_Compass[] = "Boussole";
 static uint8_t text_IT_Compass[] = "Bussola";
-static uint8_t text_ES_Compass[] = "";
+static uint8_t text_ES_Compass[] = "Brújula";
 
 // Menu SYS1
 static uint8_t text_EN_o2Sensors[] = "Oxygen sensors";
 static uint8_t text_DE_o2Sensors[] = "O2-Sensoren";
 static uint8_t text_FR_o2Sensors[] = "Cellules O2";
 static uint8_t text_IT_o2Sensors[] = "Sensore O2";
-static uint8_t text_ES_o2Sensors[] = "";
+static uint8_t text_ES_o2Sensors[] = "Sensores de O2";
 
 // Menu SYS1
 static uint8_t text_EN_Brightness[] = "Brightness";
 static uint8_t text_DE_Brightness[] = "Display-Helligkeit";
 static uint8_t text_FR_Brightness[] = "Luminosité";
 static uint8_t text_IT_Brightness[] = "Luminosite";
-static uint8_t text_ES_Brightness[] = "";
+static uint8_t text_ES_Brightness[] = "Brillo";
 
 // Menu SYS1
 static uint8_t text_EN_Cave[] = "Cave";
 static uint8_t text_DE_Cave[] = "Höhle";
 static uint8_t text_FR_Cave[] = "Grotte";
 static uint8_t text_IT_Cave[] = "Grotta";
-static uint8_t text_ES_Cave[] = "";
+static uint8_t text_ES_Cave[] = "Cueva";
 
 // Menu SYS1
 static uint8_t text_EN_Eco[] = "Eco";
 static uint8_t text_DE_Eco[] = "Eco";
 static uint8_t text_FR_Eco[] = "Eco";
 static uint8_t text_IT_Eco[] = "Eco";
-static uint8_t text_ES_Eco[] = "";
+static uint8_t text_ES_Eco[] = "Eco";
 
 // Menu SYS1
 static uint8_t text_EN_Normal[] = "Medium";
 static uint8_t text_DE_Normal[] = "Standard";
 static uint8_t text_FR_Normal[] = "Moyenne";
 static uint8_t text_IT_Normal[] = "Medio";
-static uint8_t text_ES_Normal[] = "";
+static uint8_t text_ES_Normal[] = "Medio";
 
 // Menu SYS1
 static uint8_t text_EN_Bright[] = "High";
 static uint8_t text_DE_Bright[] = "Hoch";
 static uint8_t text_FR_Bright[] = "Haute";
 static uint8_t text_IT_Bright[] = "Alto";
-static uint8_t text_ES_Bright[] = "";
+static uint8_t text_ES_Bright[] = "Alto";
 
 // Menu SYS1
 static uint8_t text_EN_Ultrabright[] = "Max";
 static uint8_t text_DE_Ultrabright[] = "Max";
 static uint8_t text_FR_Ultrabright[] = "Max";
 static uint8_t text_IT_Ultrabright[] = "Max";
-static uint8_t text_ES_Ultrabright[] = "";
+static uint8_t text_ES_Ultrabright[] = "Max";
 
 // Menu OC (Header)
 static uint8_t text_EN_OC_Gas_Edit[] = "Open circuit";
 static uint8_t text_DE_OC_Gas_Edit[] = "Open circuit";
 static uint8_t text_FR_OC_Gas_Edit[] = "Circuit ouvert";
 static uint8_t text_IT_OC_Gas_Edit[] = "Circuito aperto";
-static uint8_t text_ES_OC_Gas_Edit[] = "";
+static uint8_t text_ES_OC_Gas_Edit[] = "Circuito Abierto";
 
 // Menu CC (Header)
 static uint8_t text_EN_Diluent_Gas_Edit[] = "Diluent";
 static uint8_t text_DE_Diluent_Gas_Edit[] = "Diluent";
 static uint8_t text_FR_Diluent_Gas_Edit[] = "Diluant";
 static uint8_t text_IT_Diluent_Gas_Edit[] = "Diluente";
-static uint8_t text_ES_Diluent_Gas_Edit[] = "";
+static uint8_t text_ES_Diluent_Gas_Edit[] = "Diluyente";
 
 // Menu Gas
 static uint8_t text_EN_Mix[] = "Mix";
 static uint8_t text_DE_Mix[] = "Mix";
 static uint8_t text_FR_Mix[] = "Gaz";  // Or Mélange
 static uint8_t text_IT_Mix[] = "Gas mix";
-static uint8_t text_ES_Mix[] = "";
+static uint8_t text_ES_Mix[] = "Mezcla";
 
 // Menu Gas
 static uint8_t text_EN_Active[] = "Active";
 static uint8_t text_DE_Active[] = "Aktiv";
 static uint8_t text_FR_Active[] = "Activé";
 static uint8_t text_IT_Active[] = "Attivo";
-static uint8_t text_ES_Active[] = "";
+static uint8_t text_ES_Active[] = "Activo";
 
 // Menu Gas
 static uint8_t text_EN_First[] = "First";
 static uint8_t text_DE_First[] = "Start";
 static uint8_t text_FR_First[] = "Premier";
 static uint8_t text_IT_First[] = "Primo";
-static uint8_t text_ES_First[] = "";
+static uint8_t text_ES_First[] = "Inicial";
 
 // Menu Gas
 static uint8_t text_EN_Deco[] = "Deco";
 static uint8_t text_DE_Deco[] = "Deko";
 static uint8_t text_FR_Deco[] = "Déco";
 static uint8_t text_IT_Deco[] = "Deco";
-static uint8_t text_ES_Deco[] = "";
+static uint8_t text_ES_Deco[] = "Deco";
 
 // Menu Gas
 static uint8_t text_EN_Travel[] = "Travel";
 static uint8_t text_DE_Travel[] = "Reise";
 static uint8_t text_FR_Travel[] = "Travel";
 static uint8_t text_IT_Travel[] = "Viaggio";
-static uint8_t text_ES_Travel[] = "";
+static uint8_t text_ES_Travel[] = "Viaje";
 
 // Menu Gas
 static uint8_t text_EN_Inactive[] = "Inactive";
 static uint8_t text_DE_Inactive[] = "Deaktiviert";
 static uint8_t text_FR_Inactive[] = "Desactivé";
 static uint8_t text_IT_Inactive[] = "Disattivato";
-static uint8_t text_ES_Inactive[] = "";
+static uint8_t text_ES_Inactive[] = "Inactivo";     
 
 // Menu Gas
 static uint8_t text_EN_ChangeDepth[] = "Change depth";
 static uint8_t text_DE_ChangeDepth[] = "Wechseltiefe";
 static uint8_t text_FR_ChangeDepth[] = "Prof.Changmt";
 static uint8_t text_IT_ChangeDepth[] = "Cambio Prof.";
-static uint8_t text_ES_ChangeDepth[] = "";
+static uint8_t text_ES_ChangeDepth[] = "Prof. cambio";
 
 // Menu Gas
 static uint8_t text_EN_Type[] = "Type";
 static uint8_t text_DE_Type[] = "Typ";
 static uint8_t text_FR_Type[] = "Type";
 static uint8_t text_IT_Type[] = "Tipo";
-static uint8_t text_ES_Type[] = "";
+static uint8_t text_ES_Type[] = "Tipo";
 
 // Menu SP (Part of Header)
 static uint8_t text_EN_Setpoint_Edit[] = "Setup";
 static uint8_t text_DE_Setpoint_Edit[] = "Einstellung";
 static uint8_t text_FR_Setpoint_Edit[] = "Configuration";
 static uint8_t text_IT_Setpoint_Edit[] = "Configurazione";
-static uint8_t text_ES_Setpoint_Edit[] = "";
+static uint8_t text_ES_Setpoint_Edit[] = "Configuración";
 
 // Menu SYS1 (O2 Sensors)
 static uint8_t text_EN_Fallback[] = "Fallback";
 static uint8_t text_DE_Fallback[] = "Fallback";
 static uint8_t text_FR_Fallback[] = "Fallback";
 static uint8_t text_IT_Fallback[] = "Fallback";
-static uint8_t text_ES_Fallback[] = "";
+static uint8_t text_ES_Fallback[] = "Fallback";
 
 // Menu DECO2
 static uint8_t text_EN_Algorithm[] = "Algorithm";
 static uint8_t text_DE_Algorithm[] = "Rechenmodell";
 static uint8_t text_FR_Algorithm[] = "Algorithm";
 static uint8_t text_IT_Algorithm[] = "Algoritmo";
-static uint8_t text_ES_Algorithm[] = "";
+static uint8_t text_ES_Algorithm[] = "Algoritmo";
 
 // Menu DECO1
 static uint8_t text_EN_SafetyStop[] = "Safety stop";
 static uint8_t text_DE_SafetyStop[] = "Sicherheitsstop";
 static uint8_t text_FR_SafetyStop[] = "Palier sécurité";
 static uint8_t text_IT_SafetyStop[] = "Sicurezza";
-static uint8_t text_ES_SafetyStop[] = "";
+static uint8_t text_ES_SafetyStop[] = "Parada de seguridad";
 
 // Menu DECO1 (CCR mode only)
 static uint8_t text_EN_CCRmode[] = "CCR mode";
 static uint8_t text_DE_CCRmode[] = "CCR-Modus";
 static uint8_t text_FR_CCRmode[] = "Mode CCR";
 static uint8_t text_IT_CCRmode[] = "CCR mode";
-static uint8_t text_ES_CCRmode[] = "";
+static uint8_t text_ES_CCRmode[] = "Modo CCR";
 
 // Menu DECO1 (CCR mode only)
 static uint8_t text_EN_Sensor[] = "Sensor";
 static uint8_t text_DE_Sensor[] = "Sensor";
 static uint8_t text_FR_Sensor[] = "Cellule";
 static uint8_t text_IT_Sensor[] = "Sensore";
-static uint8_t text_ES_Sensor[] = "";
+static uint8_t text_ES_Sensor[] = "Sensor";
 
 // Menu DECO1 (CCR mode only)
 static uint8_t text_EN_FixedSP[] = "Fixed SP";
 static uint8_t text_DE_FixedSP[] = "Fester SP";
 static uint8_t text_FR_FixedSP[] = "SP fixe";
 static uint8_t text_IT_FixedSP[] = "Setpoint fisso";
-static uint8_t text_ES_FixedSP[] = "";
+static uint8_t text_ES_FixedSP[] = "SP fijo";
 
 // Menu DECO2 (VPM and Buehlmann Sub Menu)
 static uint8_t text_EN_Decoparameters[] = "Deco parameters";
 static uint8_t text_DE_Decoparameters[] = "Deko-Parameter";
 static uint8_t text_FR_Decoparameters[] = "Paramètres déco";
 static uint8_t text_IT_Decoparameters[] = "Parametri deco";
-static uint8_t text_ES_Decoparameters[] = "";
+static uint8_t text_ES_Decoparameters[] = "Parámetros deco";
 
 // Menu DECO2
 static uint8_t text_EN_LastDecostop[] = "Last deco";
 static uint8_t text_DE_LastDecostop[] = "Letzter Stopp";
 static uint8_t text_FR_LastDecostop[] = "Dern. palier";
 static uint8_t text_IT_LastDecostop[] = "Ultima deco";
-static uint8_t text_ES_LastDecostop[] = "";
+static uint8_t text_ES_LastDecostop[] = "Última parada";
 
 // Menu DECO2 and Dive Menu
 static uint8_t text_EN_ZHL16GF[] = "ZH-L16+GF";
 static uint8_t text_DE_ZHL16GF[] = "ZH-L16+GF";
 static uint8_t text_FR_ZHL16GF[] = "ZH-L16+GF";
 static uint8_t text_IT_ZHL16GF[] = "ZH-L16+GF";
-static uint8_t text_ES_ZHL16GF[] = "";
+static uint8_t text_ES_ZHL16GF[] = "ZH-L16+GF";
 
 // Menu DECO2 and Dive Menu
 static uint8_t text_EN_aGF[] = "aGF";
 static uint8_t text_DE_aGF[] = "aGF";
 static uint8_t text_FR_aGF[] = "aGF";
 static uint8_t text_IT_aGF[] = "aGF";
-static uint8_t text_ES_aGF[] = "";
+static uint8_t text_ES_aGF[] = "aGF";
 
 // Menu DECO2 and Dive Menu
 static uint8_t text_EN_VPM[] = "VPM";
 static uint8_t text_DE_VPM[] = "VPM";
 static uint8_t text_FR_VPM[] = "VPM";
 static uint8_t text_IT_VPM[] = "VPM";
-static uint8_t text_ES_VPM[] = "";
+static uint8_t text_ES_VPM[] = "VPM";
 
 // Dive Menu
 static uint8_t text_EN_LowHigh[] = "low         high";
 static uint8_t text_DE_LowHigh[] = "low         high";
 static uint8_t text_FR_LowHigh[] = "Bas         Haut";
 static uint8_t text_IT_LowHigh[] = "Basso       Alto";
-static uint8_t text_ES_LowHigh[] = "";
+static uint8_t text_ES_LowHigh[] = "Bajo        Alto";
 
 // Menu DECO1 Sub
 static uint8_t text_EN_ppO2Name[] = "Partial pressure oxygen";
 static uint8_t text_DE_ppO2Name[] = "Sauerstoff-Partialdruck";
 static uint8_t text_FR_ppO2Name[] = "Pression partl. oxygène";
 static uint8_t text_IT_ppO2Name[] = "Pressione parziale ossigeno";
-static uint8_t text_ES_ppO2Name[] = "";
+static uint8_t text_ES_ppO2Name[] = "Presión parcial de O2";  
 
 static uint8_t text_EN_Maximum[] = "Maximum";
 static uint8_t text_DE_Maximum[] = "Maximum";
 static uint8_t text_FR_Maximum[] = "Maximum";
 static uint8_t text_IT_Maximum[] = "Massimo";
-static uint8_t text_ES_Maximum[] = "";
+static uint8_t text_ES_Maximum[] = "Max";
 
 static uint8_t text_EN_Minimum[] = "Minimum";
 static uint8_t text_DE_Minimum[] = "Minimum";
 static uint8_t text_FR_Minimum[] = "Minimum";
 static uint8_t text_IT_Minimum[] = "Minimo";
-static uint8_t text_ES_Minimum[] = "";
+static uint8_t text_ES_Minimum[] = "Min";
 
 static uint8_t text_EN_Salinity[] = "Salinity";
 static uint8_t text_DE_Salinity[] = "Salzgehalt";
 static uint8_t text_FR_Salinity[] = "Salinité";
 static uint8_t text_IT_Salinity[] = "Salinita";
-static uint8_t text_ES_Salinity[] = "";
+static uint8_t text_ES_Salinity[] = "Salinidad";
 
 // Menu DECO1
 static uint8_t text_EN_DiveMode[] = "Dive mode";
 static uint8_t text_DE_DiveMode[] = "Tauchmodus";
 static uint8_t text_FR_DiveMode[] = "Mode plongée";
 static uint8_t text_IT_DiveMode[] = "Dive mode";
-static uint8_t text_ES_DiveMode[] = "";
+static uint8_t text_ES_DiveMode[] = "Modo buceo";    
 
 // Menu DECO1
 static uint8_t text_EN_OpenCircuit[] = "Open circuit";
 static uint8_t text_DE_OpenCircuit[] = "Offener Kreislauf";
 static uint8_t text_FR_OpenCircuit[] = "Circuit ouvert";
 static uint8_t text_IT_OpenCircuit[] = "Circuito aperto";
-static uint8_t text_ES_OpenCircuit[] = "";
+static uint8_t text_ES_OpenCircuit[] = "Circuito abierto";
 
 // Menu DECO1
 static uint8_t text_EN_ClosedCircuit[] = "Closed circuit";
 static uint8_t text_DE_ClosedCircuit[] = "Geschlossen/CCR";
 static uint8_t text_FR_ClosedCircuit[] = "Recycleur";
 static uint8_t text_IT_ClosedCircuit[] = "Ciurcuito chiuso";
-static uint8_t text_ES_ClosedCircuit[] = "";
+static uint8_t text_ES_ClosedCircuit[] = "Circuito cerrado";
 
 static uint8_t text_EN_Time[] = "Time";
 static uint8_t text_DE_Time[] = "Uhrzeit";
 static uint8_t text_FR_Time[] = "Heure";
 static uint8_t text_IT_Time[] = "Ora";
-static uint8_t text_ES_Time[] = "";
+static uint8_t text_ES_Time[] = "Hora";
 
 static uint8_t text_EN_Date[] = "Date";
 static uint8_t text_DE_Date[] = "Datum";
 static uint8_t text_FR_Date[] = "Date";
 static uint8_t text_IT_Date[] = "Data";
-static uint8_t text_ES_Date[] = "";
+static uint8_t text_ES_Date[] = "Fecha";
 
 static uint8_t text_EN_Format[] = "Format";
 static uint8_t text_DE_Format[] = "Format";
 static uint8_t text_FR_Format[] = "Format";
 static uint8_t text_IT_Format[] = "Formato";
-static uint8_t text_ES_Format[] = "";
+static uint8_t text_ES_Format[] = "Formato";
 
 // Menu SYS2 sub
 static uint8_t text_EN_DateTime[] = "Date and time";
 static uint8_t text_DE_DateTime[] = "Datum und Uhrzeit";
 static uint8_t text_FR_DateTime[] = "Date et heure";
 static uint8_t text_IT_DateTime[] = "Data e ora";
-static uint8_t text_ES_DateTime[] = "";
+static uint8_t text_ES_DateTime[] = "Fecha y hora";
 
 static uint8_t text_EN_DayMonthYear[] = "Date";
 static uint8_t text_DE_DayMonthYear[] = "Datum";
 static uint8_t text_FR_DayMonthYear[] = "Date";
 static uint8_t text_IT_DayMonthYear[] = "Data";
-static uint8_t text_ES_DayMonthYear[] = "";
+static uint8_t text_ES_DayMonthYear[] = "Fecha";
 
 static uint8_t text_EN_StundeMinute[] = "Time";
 static uint8_t text_DE_StundeMinute[] = "Uhrzeit";
 static uint8_t text_FR_StundeMinute[] = "Heure";
 static uint8_t text_IT_StundeMinute[] = "Ora";
-static uint8_t text_ES_StundeMinute[] = "";
+static uint8_t text_ES_StundeMinute[] = "Hora";
 
 // Logbook
 static uint8_t text_EN_Logbook[] = "Logbook";
 static uint8_t text_DE_Logbook[] = "Logbuch";
 static uint8_t text_FR_Logbook[] = "Carnet";
 static uint8_t text_IT_Logbook[] = "Logbook";
-static uint8_t text_ES_Logbook[] = "";
+static uint8_t text_ES_Logbook[] = "Diario";
 
 // Logbook
 static uint8_t text_EN_LogbookEmpty[] = "Logbook empty.";
 static uint8_t text_DE_LogbookEmpty[] = "Logbuch leer.";
 static uint8_t text_FR_LogbookEmpty[] = "Carnet vide";
 static uint8_t text_IT_LogbookEmpty[] = "Logbook vuoto";
-static uint8_t text_ES_LogbookEmpty[] = "";
+static uint8_t text_ES_LogbookEmpty[] = "Diario sin entradas";
 
 // Menu SIM
 static uint8_t text_EN_Start_Calculation[] = "Start calculation";
 static uint8_t text_DE_Start_Calculation[] = "Berechnung starten";
 static uint8_t text_FR_Start_Calculation[] = "Calculer";
 static uint8_t text_IT_Start_Calculation[] = "Calcola";
-static uint8_t text_ES_Start_Calculation[] = "";
+static uint8_t text_ES_Start_Calculation[] = "Calcular";
 
 // Menu SYS2
 static uint8_t text_EN_Design[] = "Layout";
 static uint8_t text_DE_Design[] = "Design";
 static uint8_t text_FR_Design[] = "Affichage";
 static uint8_t text_IT_Design[] = "Layout";
-static uint8_t text_ES_Design[] = "";
+static uint8_t text_ES_Design[] = "Apariencia";
 
 // Menu SYS2
 static uint8_t text_EN_Farbschema[] = "Color scheme";
 static uint8_t text_DE_Farbschema[] = "Farbschema";
 static uint8_t text_FR_Farbschema[] = "Jeu de couleurs";
 static uint8_t text_IT_Farbschema[] = "Colore schermo";
-static uint8_t text_ES_Farbschema[] = "";
+static uint8_t text_ES_Farbschema[] = "Colores";
 
 // Menu SYS2
 static uint8_t text_EN_Customviews[] = "Custom views";
 static uint8_t text_DE_Customviews[] = "Variable Anzeigen";
 static uint8_t text_FR_Customviews[] = "Affichage personnel";//"Affich. perso.";
 static uint8_t text_IT_Customviews[] = "Personalizza schermo";
-static uint8_t text_ES_Customviews[] = "";
+static uint8_t text_ES_Customviews[] = "Vista personalizada";
 
 // Menu SYS2 sub
 static uint8_t text_EN_CViewTimeout[] = "Center auto return after";
 static uint8_t text_DE_CViewTimeout[] = "Mitte automat. zurück";
 static uint8_t text_FR_CViewTimeout[] = "Retour affich. central";
 static uint8_t text_IT_CViewTimeout[] = "Centro auto ritorno";
-static uint8_t text_ES_CViewTimeout[] = "";
+static uint8_t text_ES_CViewTimeout[] = "Campo central auto-retorno";
 
 // Menu SYS2 sub
 static uint8_t text_EN_CViewStandard[] = "Center primary";
 static uint8_t text_DE_CViewStandard[] = "Mitte primär";
 static uint8_t text_FR_CViewStandard[] = "Affichage central";
 static uint8_t text_IT_CViewStandard[] = "Display centrale";
-static uint8_t text_ES_CViewStandard[] = "";
+static uint8_t text_ES_CViewStandard[] = "Campo central";
 
 // Menu SYS2 sub
 static uint8_t text_EN_CornerTimeout[] = "Field auto return after";
 static uint8_t text_DE_CornerTimeout[] = "Feld automat. zurück";
 static uint8_t text_FR_CornerTimeout[] = "Retour affich. gauche";     // This is the LEFT corner.
 static uint8_t text_IT_CornerTimeout[] = "Campo auto ritorno";
-static uint8_t text_ES_CornerTimeout[] = "";
+static uint8_t text_ES_CornerTimeout[] = "Campo Izquierdo auto-retorno";
 
 // Menu SYS2 sub
 static uint8_t text_EN_CornerStandard[] = "Field primary";
 static uint8_t text_DE_CornerStandard[] = "Feld primär";
 static uint8_t text_FR_CornerStandard[] = "Affichage gauche";
 static uint8_t text_IT_CornerStandard[] = "Campo primario";
-static uint8_t text_ES_CornerStandard[] = "";
+static uint8_t text_ES_CornerStandard[] = "Campo izquierdo inicial";
 
 // Menu GAS sub
 static uint8_t text_EN_SetToMOD[] = "Set change depth to MOD";
 static uint8_t text_DE_SetToMOD[] = "Setze Wechseltiefe auf MOD";
 static uint8_t text_FR_SetToMOD[] = "Régler prof. chgmt. a PMU";
 static uint8_t text_IT_SetToMOD[] = "Cambia profondita MOD";
-static uint8_t text_ES_SetToMOD[] = "";
+static uint8_t text_ES_SetToMOD[] = "Cambiar profundidad a MOD";
 
 // Menu SYS2 sub
 static uint8_t text_EN_Units[] = "Units";
 static uint8_t text_DE_Units[] = "Einheit";
 static uint8_t text_FR_Units[] = "Unités";
 static uint8_t text_IT_Units[] = "Unita";
-static uint8_t text_ES_Units[] = "";
+static uint8_t text_ES_Units[] = "Unidades";
 
 // Menu SYS2 sub
 static uint8_t text_EN_Design_t7_feet[] = "Feet/Fahrenheit";
 static uint8_t text_DE_Design_t7_feet[] = "Fuss/Fahrenheit";
 static uint8_t text_FR_Design_t7_feet[] = "Pied/Fahrenheit";
 static uint8_t text_IT_Design_t7_feet[] = "Piedi/Fahrenheit";
-static uint8_t text_ES_Design_t7_feet[] = "";
+static uint8_t text_ES_Design_t7_feet[] = "Pies/Fahrenheit";
 
 // Menu SYS2 sub
 static uint8_t text_EN_Design_t7_metric[] = "Meter/Celsius";
 static uint8_t text_DE_Design_t7_metric[] = "Meter/Celsius";
 static uint8_t text_FR_Design_t7_metric[] = "Mètre/Celsius";
 static uint8_t text_IT_Design_t7_metric[] = "Metro/Celsius";
-static uint8_t text_ES_Design_t7_metric[] = "";
+static uint8_t text_ES_Design_t7_metric[] = "Metro/Celsius";
 
 // Menu SYS2
 static uint8_t text_EN_Information[] = "Information";
 static uint8_t text_DE_Information[] = "";
 static uint8_t text_FR_Information[] = ""; // Information
 static uint8_t text_IT_Information[] = "Info";
-static uint8_t text_ES_Information[] = "";
+static uint8_t text_ES_Information[] = "Información";
 
 // Menu SYS2
 static uint8_t text_EN_ResetMenu[] = "Reset menu";
 static uint8_t text_DE_ResetMenu[] = "Reset-Menü";
 static uint8_t text_FR_ResetMenu[] = "Menu RaZ"; // RaZ
 static uint8_t text_IT_ResetMenu[] = "Reset";
-static uint8_t text_ES_ResetMenu[] = "";
+static uint8_t text_ES_ResetMenu[] = "Restaurar";
 
 // Menu SYS2 sub
 static uint8_t text_EN_LogbookOffset[] = "Logbook offset";
 static uint8_t text_DE_LogbookOffset[] = "Logbuch-Versatz";
 static uint8_t text_FR_LogbookOffset[] = "Num. 1er plongée";
 static uint8_t text_IT_LogbookOffset[] = "Logbook offset";
-static uint8_t text_ES_LogbookOffset[] = "";
+static uint8_t text_ES_LogbookOffset[] = "Diario: iniciar numeración en";
 
 
 // Menu SYS2 sub
@@ -601,413 +601,413 @@
 static uint8_t text_DE_Maintenance[] = "Wartung";
 static uint8_t text_FR_Maintenance[] = "Maintenance";
 static uint8_t text_IT_Maintenance[] = "Manutenzione";
-static uint8_t text_ES_Maintenance[] = "";
+static uint8_t text_ES_Maintenance[] = "Mantenimiento";
 
 // Menu SYS2 sub
 static uint8_t text_EN_SetBatteryCharge[] = "Restore Battery Charge";
 static uint8_t text_DE_SetBatteryCharge[] = "Batterie zurücksetzen";
 static uint8_t text_FR_SetBatteryCharge[] = "";
 static uint8_t text_IT_SetBatteryCharge[] = "Ricaricare batteria";
-static uint8_t text_ES_SetBatteryCharge[] = "";
+static uint8_t text_ES_SetBatteryCharge[] = "Recalibrar nivel carga";
 
 // Menu SYS2 sub
 static uint8_t text_EN_SetFactoryDefaults[] = "Store button factory defaults";
 static uint8_t text_DE_SetFactoryDefaults[] = "Taster zurücksetzen";
 static uint8_t text_FR_SetFactoryDefaults[] = "";
 static uint8_t text_IT_SetFactoryDefaults[] = "Impostazioni pulsante";
-static uint8_t text_ES_SetFactoryDefaults[] = "";
+static uint8_t text_ES_SetFactoryDefaults[] = "Restablecer ajustes de fábrica";
 
 // Menu SYS2 sub
 static uint8_t text_EN_Reboot[] = "Reboot";
 static uint8_t text_DE_Reboot[] = "Neustart";
 static uint8_t text_FR_Reboot[] = "Redémarrage";
 static uint8_t text_IT_Reboot[] = "Riavvio";
-static uint8_t text_ES_Reboot[] = "";
+static uint8_t text_ES_Reboot[] = "Reiniciar";
 
 // Menu SYS2 sub
 static uint8_t text_EN__RebootRTE[] = "Reboot RTE";
 static uint8_t text_DE__RebootRTE[] = "RTE neu starten";
 static uint8_t text_FR__RebootRTE[] = "Redémarrage RTE";
 static uint8_t text_IT__RebootRTE[] = "Riavvio RTE";
-static uint8_t text_ES__RebootRTE[] = "";
+static uint8_t text_ES__RebootRTE[] = "Reiniciar RTE";
 
 // Menu SYS2 sub
 static uint8_t text_EN_AreYouSure[] = "Are you sure?";
 static uint8_t text_DE_AreYouSure[] = "Sind Sie sicher?";
 static uint8_t text_FR_AreYouSure[] = "Confirmer?";
 static uint8_t text_IT_AreYouSure[] = "Sei sicuro?";
-static uint8_t text_ES_AreYouSure[] = "";
+static uint8_t text_ES_AreYouSure[] = "Estás seguro?";
 
 // Menu SYS2 sub
 static uint8_t text_EN_Abort[] = "Abort";
 static uint8_t text_DE_Abort[] = "Abbrechen";
 static uint8_t text_FR_Abort[] = "Quitter";
 static uint8_t text_IT_Abort[] = "Uscita";
-static uint8_t text_ES_Abort[] = "";
+static uint8_t text_ES_Abort[] = "Cancelar";
 
 // Menu SYS2 sub
 static uint8_t text_EN_ResetAll[] = "Reset settings";
 static uint8_t text_DE_ResetAll[] = "Einstellung zurücksetzen";
 static uint8_t text_FR_ResetAll[] = "RaZ paramètres";
 static uint8_t text_IT_ResetAll[] = "Ripristina impostazioni";
-static uint8_t text_ES_ResetAll[] = "";
+static uint8_t text_ES_ResetAll[] = "Restaurar parámetros";
 
 // Menu SYS2 sub
 static uint8_t text_EN_ResetDeco[] = "Reset deco";
 static uint8_t text_DE_ResetDeco[] = "Deko zurücksetzen";
 static uint8_t text_FR_ResetDeco[] = "RaZ deco";
 static uint8_t text_IT_ResetDeco[] = "Ripristina deco";
-static uint8_t text_ES_ResetDeco[] = "";
+static uint8_t text_ES_ResetDeco[] = "Restaurar Deco";
 
 // Menu SYS2 sub
 static uint8_t text_EN_Exit[] = "Exit";
 static uint8_t text_DE_Exit[] = "Ende";
 static uint8_t text_FR_Exit[] = "Sortir";
 static uint8_t text_IT_Exit[] = "Esci";
-static uint8_t text_ES_Exit[] = "";
+static uint8_t text_ES_Exit[] = "Salir";
 
 // Menu SYS2 sub
 static uint8_t text_EN_StartBootloader[] = "Reboot firmware";
 static uint8_t text_DE_StartBootloader[] = "Neustart Firmware";
 static uint8_t text_FR_StartBootloader[] = "Redémarrer";
 static uint8_t text_IT_StartBootloader[] = "Ripristina firmware";
-static uint8_t text_ES_StartBootloader[] = "";
+static uint8_t text_ES_StartBootloader[] = "Reiniciar firmware";
 
 // Menu SYS2 sub
 static uint8_t text_EN_ResetLogbook[] = "Reset logbook";
 static uint8_t text_DE_ResetLogbook[] = "Logbuch zurücksetzen";
 static uint8_t text_FR_ResetLogbook[] = "RaZ carnet"; // RaZ
 static uint8_t text_IT_ResetLogbook[] = "Ripristina logbook";
-static uint8_t text_ES_ResetLogbook[] = "";
+static uint8_t text_ES_ResetLogbook[] = "Borrar diario";
 
 // Surface warning
 static uint8_t text_EN_PleaseUpdate[] = "Please update";
 static uint8_t text_DE_PleaseUpdate[] = "Bitte updaten:";
 static uint8_t text_FR_PleaseUpdate[] = "Mettre a jours svp.";
 static uint8_t text_IT_PleaseUpdate[] = "Aggiornamento";
-static uint8_t text_ES_PleaseUpdate[] = "";
+static uint8_t text_ES_PleaseUpdate[] = "Por favor, actualice";
 
 // Surface warning
 static uint8_t text_EN_RTE[] = "RTE";
 static uint8_t text_DE_RTE[] = "";
 static uint8_t text_FR_RTE[] = "";
 static uint8_t text_IT_RTE[] = "RTE";
-static uint8_t text_ES_RTE[] = "";
+static uint8_t text_ES_RTE[] = "RTE";
 
 // Surface warning
 static uint8_t text_EN_Fonts[] = "fonts"; // Character fonts!!
 static uint8_t text_DE_Fonts[] = "";
 static uint8_t text_FR_Fonts[] = "polices";
 static uint8_t text_IT_Fonts[] = "Carattere";
-static uint8_t text_ES_Fonts[] = "";
+static uint8_t text_ES_Fonts[] = "Tipos de letra";
 
 // Dive Menu
 static uint8_t text_EN_ResetStopwatch[] = "Reset stopwatch";
 static uint8_t text_DE_ResetStopwatch[] = "Stoppuhr zurückstellen";
 static uint8_t text_FR_ResetStopwatch[] = "RaZ chrono"; // RaZ
 static uint8_t text_IT_ResetStopwatch[] = "Riavvia cronometro";
-static uint8_t text_ES_ResetStopwatch[] = "";
+static uint8_t text_ES_ResetStopwatch[] = "Reiniciar cronómetro";
 
 // Dive Menu
 static uint8_t text_EN_SetMarker[] = "Set marker";
 static uint8_t text_DE_SetMarker[] = "Markierung";
 static uint8_t text_FR_SetMarker[] = "Repère";
 static uint8_t text_IT_SetMarker[] = "Marcatura";
-static uint8_t text_ES_SetMarker[] = "";
+static uint8_t text_ES_SetMarker[] = "Poner Marcador";
 
 // Dive Menu
 static uint8_t text_EN_CompassHeading[] = "Compass heading";
 static uint8_t text_DE_CompassHeading[] = "Kompasskurs";
 static uint8_t text_FR_CompassHeading[] = "Cap";
 static uint8_t text_IT_CompassHeading[] = "Direzione bussola";
-static uint8_t text_ES_CompassHeading[] = "";
+static uint8_t text_ES_CompassHeading[] = "Rumbo brújula";
 
 // Menu SIM
 static uint8_t text_EN_Simulator[] = "Simulator";
 static uint8_t text_DE_Simulator[] = "";
 static uint8_t text_FR_Simulator[] = "Simulateur";
 static uint8_t text_IT_Simulator[] = "Simulazione";
-static uint8_t text_ES_Simulator[] = "";
+static uint8_t text_ES_Simulator[] = "Simulador";
 
 // Menu SIM
 static uint8_t text_EN_StartSimulator[] = "Start simulator";
 static uint8_t text_DE_StartSimulator[] = "Simulator starten";
 static uint8_t text_FR_StartSimulator[] = "Démarrage simulateur";
 static uint8_t text_IT_StartSimulator[] = "Inizia simulazione";
-static uint8_t text_ES_StartSimulator[] = "";
+static uint8_t text_ES_StartSimulator[] = "Iniciar simulador";
 
 // Menu SIM
 static uint8_t text_EN_Intervall[] = "Interval";
 static uint8_t text_DE_Intervall[] = "Intervall";
 static uint8_t text_FR_Intervall[] = "Intervalle";
 static uint8_t text_IT_Intervall[] = "Intervallo";
-static uint8_t text_ES_Intervall[] = "";
+static uint8_t text_ES_Intervall[] = "Intervalo";
 
 // Menu SIM
 static uint8_t text_EN_SimDiveTime[] = "Dive time";
 static uint8_t text_DE_SimDiveTime[] = "Tauchzeit";
 static uint8_t text_FR_SimDiveTime[] = "Temps fond";
 static uint8_t text_IT_SimDiveTime[] = "Tempo";
-static uint8_t text_ES_SimDiveTime[] = "";
+static uint8_t text_ES_SimDiveTime[] = "Tiempo";
 
 // Menu SIM
 static uint8_t text_EN_SimMaxDepth[] = "Max. depth";
 static uint8_t text_DE_SimMaxDepth[] = "Max. Tiefe";
 static uint8_t text_FR_SimMaxDepth[] = "Prof. max";
 static uint8_t text_IT_SimMaxDepth[] = "Profondita max.";
-static uint8_t text_ES_SimMaxDepth[] = "";
+static uint8_t text_ES_SimMaxDepth[] = "Prof. max.";
 
 // Menu SIM sub
 static uint8_t text_EN_SimConsumption[] = "Gas consumption";
 static uint8_t text_DE_SimConsumption[] = "Gas-Verbrauch";
 static uint8_t text_FR_SimConsumption[] = "Conso gaz";
 static uint8_t text_IT_SimConsumption[] = "Consumo gas";
-static uint8_t text_ES_SimConsumption[] = "";
+static uint8_t text_ES_SimConsumption[] = "Consumo de gas";
 
 // Menu SIM sub
 static uint8_t text_EN_SimSummary[] = "Summary";
 static uint8_t text_DE_SimSummary[] = "Zusammenfassung";
 static uint8_t text_FR_SimSummary[] = "Résumé";
 static uint8_t text_IT_SimSummary[] = "Leggenda";
-static uint8_t text_ES_SimSummary[] = "";
+static uint8_t text_ES_SimSummary[] = "Resumen";
 
 // Menu SIM sub
 static uint8_t text_EN_SimDecTo[] = "Dec to";
 static uint8_t text_DE_SimDecTo[] = "Abst.";
 static uint8_t text_FR_SimDecTo[] = "Desc a";
 static uint8_t text_IT_SimDecTo[] = "";
-static uint8_t text_ES_SimDecTo[] = "";
+static uint8_t text_ES_SimDecTo[] = "Desc a";
 
 // Menu SIM sub
 static uint8_t text_EN_SimLevel[] = "Level";
 static uint8_t text_DE_SimLevel[] = "Tiefe";
 static uint8_t text_FR_SimLevel[] = "Niveau";
 static uint8_t text_IT_SimLevel[] = "Livello";
-static uint8_t text_ES_SimLevel[] = "";
+static uint8_t text_ES_SimLevel[] = "Nivel";
 
 // Menu SIM sub
 static uint8_t text_EN_SimAscTo[] = "Asc to";
 static uint8_t text_DE_SimAscTo[] = "Aufst.";
 static uint8_t text_FR_SimAscTo[] = "Rem. a";
 static uint8_t text_IT_SimAscTo[] = "";
-static uint8_t text_ES_SimAscTo[] = "";
+static uint8_t text_ES_SimAscTo[] = "Asc a";
 
 // Menu SIM sub
 static uint8_t text_EN_SimSurface[] = "Surface";
 static uint8_t text_DE_SimSurface[] = "Oberfl.";
 static uint8_t text_FR_SimSurface[] = ""; // Surface
 static uint8_t text_IT_SimSurface[] = "Superficie";
-static uint8_t text_ES_SimSurface[] = "";
+static uint8_t text_ES_SimSurface[] = "Superficie";
 
 // Menu SIM sub
 static uint8_t text_EN_Calculating[] = "Calculating ...";
 static uint8_t text_DE_Calculating[] = "Auswertung ...";
 static uint8_t text_FR_Calculating[] = "Calcul...";
 static uint8_t text_IT_Calculating[] = "Elaborazione...";
-static uint8_t text_ES_Calculating[] = "";
+static uint8_t text_ES_Calculating[] = "Calculando...";
 
 // Menu SIM sub
 static uint8_t text_EN_PleaseWait[] = "Please wait!";
 static uint8_t text_DE_PleaseWait[] = "Bitte warten!";
 static uint8_t text_FR_PleaseWait[] = "Attendre svp.";
 static uint8_t text_IT_PleaseWait[] = "Attendere...";
-static uint8_t text_ES_PleaseWait[] = "";
+static uint8_t text_ES_PleaseWait[] = "Por favor, espere";
 
 // Menu SIM
 static uint8_t text_EN_CalculateDeco[] = "Calculate deco";
 static uint8_t text_DE_CalculateDeco[] = "Deko berechnen";
 static uint8_t text_FR_CalculateDeco[] = "Calcul déco";
 static uint8_t text_IT_CalculateDeco[] = "Calcolo deco";
-static uint8_t text_ES_CalculateDeco[] = "";
+static uint8_t text_ES_CalculateDeco[] = "Calcular deco";
 
 // Menu SIM sub
 static uint8_t text_EN_Decolist[] = "Decoplan";
 static uint8_t text_DE_Decolist[] = "Dekoplan";
 static uint8_t text_FR_Decolist[] = "Plan déco";
 static uint8_t text_IT_Decolist[] = "Pianifica deco";
-static uint8_t text_ES_Decolist[] = "";
+static uint8_t text_ES_Decolist[] = "Plan deco";
 
 // Menu SYS1
 static uint8_t text_EN_ButtonSensitivity[] = "Button sensitivity";
 static uint8_t text_DE_ButtonSensitivity[] = "Taster ansprechen";
 static uint8_t text_FR_ButtonSensitivity[] = "Bouton sensibilité";
 static uint8_t text_IT_ButtonSensitivity[] = "Pulsante";
-static uint8_t text_ES_ButtonSensitivity[] = "";
+static uint8_t text_ES_ButtonSensitivity[] = "Sensiblidad botones";
 
 //
 static uint8_t text_EN_SpecialDiveGas[] = "Free configurable";
 static uint8_t text_DE_SpecialDiveGas[] = "Frei einstellbar";
 static uint8_t text_FR_SpecialDiveGas[] = "";
 static uint8_t text_IT_SpecialDiveGas[] = "Configurazione libera";
-static uint8_t text_ES_SpecialDiveGas[] = "";
+static uint8_t text_ES_SpecialDiveGas[] = "Configuración libre";
 
 // Dive Menu
 static uint8_t text_EN_SpecialDiveGasMenu[] = "Lost gas and extra gas";
 static uint8_t text_DE_SpecialDiveGasMenu[] = "Verlorene Gase und Extra-Gas";
 static uint8_t text_FR_SpecialDiveGasMenu[] = "";
 static uint8_t text_IT_SpecialDiveGasMenu[] = "Gas perso e extra gas";
-static uint8_t text_ES_SpecialDiveGasMenu[] = "";
+static uint8_t text_ES_SpecialDiveGasMenu[] = "Gas perdido y gas extra";
 
 // Dive Menu (CCR mode)
 static uint8_t text_EN_SpecialDiveGasMenuCCR[] = "Lost Gas";
 static uint8_t text_DE_SpecialDiveGasMenuCCR[] = "Verlorene Gase";
 static uint8_t text_FR_SpecialDiveGasMenuCCR[] = "";
 static uint8_t text_IT_SpecialDiveGasMenuCCR[] = "Gas perso";
-static uint8_t text_ES_SpecialDiveGasMenuCCR[] = "";
+static uint8_t text_ES_SpecialDiveGasMenuCCR[] = "Gas perdido";
 
 // Dive Menu (CCR mode)
 static uint8_t text_EN_UseSensor[] = "Use sensor";
 static uint8_t text_DE_UseSensor[] = "Benutze Sensor";
 static uint8_t text_FR_UseSensor[] = "Cellules";
 static uint8_t text_IT_UseSensor[] = "Sensore";
-static uint8_t text_ES_UseSensor[] = "";
+static uint8_t text_ES_UseSensor[] = "Usar sensor";
 
 // Warning
 static uint8_t text_EN_WarnDecoMissed[] = "Deco stop";
 static uint8_t text_DE_WarnDecoMissed[] = "Deco Stopp";
 static uint8_t text_FR_WarnDecoMissed[] = "";
 static uint8_t text_IT_WarnDecoMissed[] = "Deco stop";
-static uint8_t text_ES_WarnDecoMissed[] = "";
+static uint8_t text_ES_WarnDecoMissed[] = "Deco stop";
 
 // Warning
 static uint8_t text_EN_WarnFallback[] = "Fallback";
 static uint8_t text_DE_WarnFallback[] = "";
 static uint8_t text_FR_WarnFallback[] = "Fallback"; // NEED to more specific here I guess...
 static uint8_t text_IT_WarnFallback[] = "Fallback";
-static uint8_t text_ES_WarnFallback[] = "";
+static uint8_t text_ES_WarnFallback[] = "Fallback";
 
 // Warning
 static uint8_t text_EN_WarnPPO2Low[] = "ppO2 low";
 static uint8_t text_DE_WarnPPO2Low[] = "ppO2 niedrig";
 static uint8_t text_FR_WarnPPO2Low[] = "ppO2 basse";
 static uint8_t text_IT_WarnPPO2Low[] = "ppO2 basso";
-static uint8_t text_ES_WarnPPO2Low[] = "";
+static uint8_t text_ES_WarnPPO2Low[] = "ppO2 bajo";
 
 // Warning
 static uint8_t text_EN_WarnPPO2High[] = "ppO2 high";
 static uint8_t text_DE_WarnPPO2High[] = "ppO2 hoch";
 static uint8_t text_FR_WarnPPO2High[] = "ppO2 haut";
 static uint8_t text_IT_WarnPPO2High[] = "ppO2 alto";
-static uint8_t text_ES_WarnPPO2High[] = "";
+static uint8_t text_ES_WarnPPO2High[] = "ppO2 alto";
 
 // Warning
 static uint8_t text_EN_WarnBatteryLow[] = "Battery";
 static uint8_t text_DE_WarnBatteryLow[] = "Batterie";
 static uint8_t text_FR_WarnBatteryLow[] = "Batterie";
 static uint8_t text_IT_WarnBatteryLow[] = "Batteria";
-static uint8_t text_ES_WarnBatteryLow[] = "";
+static uint8_t text_ES_WarnBatteryLow[] = "Carga baja";
 
 // Warning
 static uint8_t text_EN_WarnSensorLinkLost[] = "Sensors";
 static uint8_t text_DE_WarnSensorLinkLost[] = "Sensoren";
 static uint8_t text_FR_WarnSensorLinkLost[] = "Cellules";
 static uint8_t text_IT_WarnSensorLinkLost[] = "Sensori";
-static uint8_t text_ES_WarnSensorLinkLost[] = "";
+static uint8_t text_ES_WarnSensorLinkLost[] = "Sensores";
 
 // Warning
 static uint8_t text_EN_WarnCnsHigh[] = "CNS high";
 static uint8_t text_DE_WarnCnsHigh[] = "CNS hoch";
 static uint8_t text_FR_WarnCnsHigh[] = "SNC haut";
 static uint8_t text_IT_WarnCnsHigh[] = "CNS alto";
-static uint8_t text_ES_WarnCnsHigh[] = "";
+static uint8_t text_ES_WarnCnsHigh[] = "CNS alto";
 
 // Tissue Graph
 static uint8_t text_EN_Nitrogen[] = "Nitrogen";
 static uint8_t text_DE_Nitrogen[] = "Stickstoff";
 static uint8_t text_FR_Nitrogen[] = "Azote";
 static uint8_t text_IT_Nitrogen[] = "Azoto";
-static uint8_t text_ES_Nitrogen[] = "";
+static uint8_t text_ES_Nitrogen[] = "Nitrógeno";
 
 // Tissue Graph
 static uint8_t text_EN_Helium[] = "Helium";
 static uint8_t text_DE_Helium[] = "";
 static uint8_t text_FR_Helium[] = "Hélium";
 static uint8_t text_IT_Helium[] = "Helio";
-static uint8_t text_ES_Helium[] = "";
+static uint8_t text_ES_Helium[] = "Helio";
 
 // Tissue Graph
 static uint8_t text_EN_CNS[] = "Oxygen";
 static uint8_t text_DE_CNS[] = "Sauerstoff";
 static uint8_t text_FR_CNS[] = "Oxygène";
 static uint8_t text_IT_CNS[] = "Ossigeno";
-static uint8_t text_ES_CNS[] = "";
+static uint8_t text_ES_CNS[] = "O2";
 
 // Profile Graph
 static uint8_t text_EN_Profile[] = "Profile";
 static uint8_t text_DE_Profile[] = "Profil";
 static uint8_t text_FR_Profile[] = "Profil";
 static uint8_t text_IT_Profile[] = "Profilo";
-static uint8_t text_ES_Profile[] = "";
+static uint8_t text_ES_Profile[] = "Perfil";
 
 // Dive mode (header @ deco stop place)
 static uint8_t text_EN_SafetyStop2[] = "Safety stop";
 static uint8_t text_DE_SafetyStop2[] = "Sicherheit";
 static uint8_t text_FR_SafetyStop2[] = "Palier sécurité";
 static uint8_t text_IT_SafetyStop2[] = "Sicurezza";
-static uint8_t text_ES_SafetyStop2[] = "";
+static uint8_t text_ES_SafetyStop2[] = "Parada de seguridad";
 
 // Surface mode
 static uint8_t text_EN_noFly[] = "noFly";
 static uint8_t text_DE_noFly[] = "";
 static uint8_t text_FR_noFly[] = "";  // Or Avion
 static uint8_t text_IT_noFly[] = "No volo";
-static uint8_t text_ES_noFly[] = "";
+static uint8_t text_ES_noFly[] = "No volar";
 
 // Surface mode
 static uint8_t text_EN_Desaturation[] = "Desaturation";
 static uint8_t text_DE_Desaturation[] = "Entsättigung";
 static uint8_t text_FR_Desaturation[] = "Désaturation";
 static uint8_t text_IT_Desaturation[] = "Desaturazione";
-static uint8_t text_ES_Desaturation[] = "";
+static uint8_t text_ES_Desaturation[] = "Desaturación";
 
 // Surface mode
 static uint8_t text_EN_TimeSinceLastDive[] = "Last dive";
 static uint8_t text_DE_TimeSinceLastDive[] = "Tauchpause";
 static uint8_t text_FR_TimeSinceLastDive[] = "Intervalle";
 static uint8_t text_IT_TimeSinceLastDive[] = "Ultima immersione";
-static uint8_t text_ES_TimeSinceLastDive[] = "";
+static uint8_t text_ES_TimeSinceLastDive[] = "Última inmersión";
 
 // Button label (tiny line)
 static uint8_t text_EN_ButtonLogbook[] = "Logbook";
 static uint8_t text_DE_ButtonLogbook[] = "Logbuch";
 static uint8_t text_FR_ButtonLogbook[] = "Carnet";
 static uint8_t text_IT_ButtonLogbook[] = "Loogbook";
-static uint8_t text_ES_ButtonLogbook[] = "";
+static uint8_t text_ES_ButtonLogbook[] = "Diario";
 
 // Button label (tiny line)
 static uint8_t text_EN_ButtonView[] = "View";
 static uint8_t text_DE_ButtonView[] = "Ansicht";
 static uint8_t text_FR_ButtonView[] = "Vue";
 static uint8_t text_IT_ButtonView[] = "Visuale";
-static uint8_t text_ES_ButtonView[] = "";
+static uint8_t text_ES_ButtonView[] = "Vista";
 
 // Button label (tiny line)
 static uint8_t text_EN_ButtonMenu[] = "Menu";
 static uint8_t text_DE_ButtonMenu[] = "Menü";
 static uint8_t text_FR_ButtonMenu[] = "Menu";
 static uint8_t text_IT_ButtonMenu[] = "Menu";
-static uint8_t text_ES_ButtonMenu[] = "";
+static uint8_t text_ES_ButtonMenu[] = "Menú";
 
 // Button label (tiny line)
 static uint8_t text_EN_ButtonBack[] = "Back";
 static uint8_t text_DE_ButtonBack[] = "Zurück";
 static uint8_t text_FR_ButtonBack[] = "Retour";
 static uint8_t text_IT_ButtonBack[] = "Indietro";
-static uint8_t text_ES_ButtonBack[] = "";
+static uint8_t text_ES_ButtonBack[] = "Atrás";
 
 // Button label (tiny line)
 static uint8_t text_EN_ButtonEnter[] = "Enter";
 static uint8_t text_DE_ButtonEnter[] = "Bestätigen";
 static uint8_t text_FR_ButtonEnter[] = "Entrer";
 static uint8_t text_IT_ButtonEnter[] = "Conferma";
-static uint8_t text_ES_ButtonEnter[] = "";
+static uint8_t text_ES_ButtonEnter[] = "Entrar";
 
 // Button label (tiny line)
 static uint8_t text_EN_ButtonNext[] = "Next";
 static uint8_t text_DE_ButtonNext[] = "Weiter";
 static uint8_t text_FR_ButtonNext[] = "Suivant"; //"Suiv.";
 static uint8_t text_IT_ButtonNext[] = "Prossimo";
-static uint8_t text_ES_ButtonNext[] = "";
+static uint8_t text_ES_ButtonNext[] = "Siguiente";
 
 // Button label (tiny line)
 static uint8_t text_EN_ButtonMinus[] = "-";
@@ -1028,288 +1028,288 @@
 static uint8_t text_DE_SimFollowDecoStops[] = "Sim-Aufstieg folgt Stopps";
 static uint8_t text_FR_SimFollowDecoStops[] = "Remonté selon paliers";
 static uint8_t text_IT_SimFollowDecoStops[] = "";
-static uint8_t text_ES_SimFollowDecoStops[] = "";
+static uint8_t text_ES_SimFollowDecoStops[] = "Ascenso según paradas deco";
 
 // Menu SYS1
 static uint8_t text_EN_Bluetooth[] = "Bluetooth";
 static uint8_t text_DE_Bluetooth[] = "";
 static uint8_t text_FR_Bluetooth[] = "";
 static uint8_t text_IT_Bluetooth[] = "";
-static uint8_t text_ES_Bluetooth[] = "";
+static uint8_t text_ES_Bluetooth[] = "Bluetooth";
 
 // Customview Header
 static uint8_t text_EN_Tissues[] = "Tissue load";
 static uint8_t text_DE_Tissues[] = "Sättigung";
 static uint8_t text_FR_Tissues[] = "Saturation";
 static uint8_t text_IT_Tissues[] = "Saturazione";
-static uint8_t text_ES_Tissues[] = "";
+static uint8_t text_ES_Tissues[] = "Saturación tejidos";
 
 // Customview Header
 static uint8_t text_EN_O2monitor[] = "O2 monitor";
 static uint8_t text_DE_O2monitor[] = "O2-Monitor";
 static uint8_t text_FR_O2monitor[] = "Moniteur O2";  // "O2 (bar)" ?
 static uint8_t text_IT_O2monitor[] = "Monitor O2";
-static uint8_t text_ES_O2monitor[] = "";
+static uint8_t text_ES_O2monitor[] = "Monitor O2";
 
 // Customview Header
 static uint8_t text_EN_O2voltage[] = "O2 voltage";
 static uint8_t text_DE_O2voltage[] = "O2 voltage";
 static uint8_t text_FR_O2voltage[] = "Voltage O2";
 static uint8_t text_IT_O2voltage[] = "Voltaggio O2";
-static uint8_t text_ES_O2voltage[] = "";
+static uint8_t text_ES_O2voltage[] = "Voltaje O2";
 
 // Customview Header
 static uint8_t text_EN_Gaslist[] = "Gaslist OC";
 static uint8_t text_DE_Gaslist[] = "";
 static uint8_t text_FR_Gaslist[] = "Liste gaz OC";
 static uint8_t text_IT_Gaslist[] = "Lista gas OC";
-static uint8_t text_ES_Gaslist[] = "";
+static uint8_t text_ES_Gaslist[] = "lista de gases OC";
 
 // Customview Header
 static uint8_t text_EN_Info[] = "Info";
 static uint8_t text_DE_Info[] = "";
 static uint8_t text_FR_Info[] = ""; // Info
 static uint8_t text_IT_Info[] = "Info";
-static uint8_t text_ES_Info[] = "";
+static uint8_t text_ES_Info[] = "Info";
 
 // Customview Header
 static uint8_t text_EN_Warning[] = "Warning";
 static uint8_t text_DE_Warning[] = "Warnung";
 static uint8_t text_FR_Warning[] = "Alerte";
 static uint8_t text_IT_Warning[] = "Pericolo";
-static uint8_t text_ES_Warning[] = "";
+static uint8_t text_ES_Warning[] = "Peligro";
 
 // Customview Header (Bonex Computer)
 static uint8_t text_EN_ScooterMonitor[] = "bonex";
 static uint8_t text_DE_ScooterMonitor[] = "";
 static uint8_t text_FR_ScooterMonitor[] = "";
 static uint8_t text_IT_ScooterMonitor[] = "Bonex DPV";
-static uint8_t text_ES_ScooterMonitor[] = "";
+static uint8_t text_ES_ScooterMonitor[] = "bonex";
 
 // Menu SYS2 sub Information
 static uint8_t text_EN_Usage_Battery[] = "Battery life";
 static uint8_t text_DE_Usage_Battery[] = "Batterie-Nutzung";
 static uint8_t text_FR_Usage_Battery[] = "Durée batterie";
 static uint8_t text_IT_Usage_Battery[] = "Durata batteria";
-static uint8_t text_ES_Usage_Battery[] = "";
+static uint8_t text_ES_Usage_Battery[] = "Duración carga";
 
 // Menu SYS2 sub Information
 static uint8_t text_EN_Usage_Dives[] = "Dive records";
 static uint8_t text_DE_Usage_Dives[] = "Tauch-Historie";
 static uint8_t text_FR_Usage_Dives[] = "Historique plongées";
 static uint8_t text_IT_Usage_Dives[] = "Totale immersioni";
-static uint8_t text_ES_Usage_Dives[] = "";
+static uint8_t text_ES_Usage_Dives[] = "Registro de inmersiones";
 
 // Menu SYS2 sub Information
 static uint8_t text_EN_Usage_Environment[] = "Environmental conditions";
 static uint8_t text_DE_Usage_Environment[] = "Umgebungsbedingungen";
 static uint8_t text_FR_Usage_Environment[] = "Conditions environ.";
 static uint8_t text_IT_Usage_Environment[] = "Condizioni ambientali";
-static uint8_t text_ES_Usage_Environment[] = "";
+static uint8_t text_ES_Usage_Environment[] = "Condiciones ambientales";
 
 // Menu SYS2 sub Information
 static uint8_t text_EN_ChargeCycles[] = "Charge cycles (complete)";
 static uint8_t text_DE_ChargeCycles[] = "Ladezyklen (vollständig)";
 static uint8_t text_FR_ChargeCycles[] = "Cycles de charge (complets)";
 static uint8_t text_IT_ChargeCycles[] = "Ricarica completata";
-static uint8_t text_ES_ChargeCycles[] = "";
+static uint8_t text_ES_ChargeCycles[] = "Carga completada";
 
 // Menu SYS2 sub Information
 static uint8_t text_EN_LowestVoltage[] = "Lowest battery voltage";
 static uint8_t text_DE_LowestVoltage[] = "Niedrigste Batteriespannung";
 static uint8_t text_FR_LowestVoltage[] = "Voltage min batterie";
 static uint8_t text_IT_LowestVoltage[] = "Batteria scarica";
-static uint8_t text_ES_LowestVoltage[] = "";
+static uint8_t text_ES_LowestVoltage[] = "Carga muy baja ";
 
 // Menu SYS2 sub Information
 static uint8_t text_EN_HoursOfOperation[] = "Hours of operation";
 static uint8_t text_DE_HoursOfOperation[] = "Betriebsstunden";
 static uint8_t text_FR_HoursOfOperation[] = "Heures d'utilisations";
 static uint8_t text_IT_HoursOfOperation[] = "Ore di utilizzo";
-static uint8_t text_ES_HoursOfOperation[] = "";
+static uint8_t text_ES_HoursOfOperation[] = "Horas de uso";
 
 // Menu SYS2 sub Information
 static uint8_t text_EN_NumberOfDives[] = "Total number of dives (max. depth)";
 static uint8_t text_DE_NumberOfDives[] = "Anzahl Tauchgänge (max. Tiefe)";
 static uint8_t text_FR_NumberOfDives[] = "Nombre total de plongées (prof. max)";
 static uint8_t text_IT_NumberOfDives[] = "Numero totale di immersioni (prof. max)";
-static uint8_t text_ES_NumberOfDives[] = "";
+static uint8_t text_ES_NumberOfDives[] = "Número total de inmersiones (prof. max)";
 
 // Menu SYS2 sub Information
 static uint8_t text_EN_AmbientTemperature[] = "Ambient temperature range";
 static uint8_t text_DE_AmbientTemperature[] = "Umgebungstemperaturbereich";
 static uint8_t text_FR_AmbientTemperature[] = "Temperature ambiante";   // Range --> Temperatures ?
 static uint8_t text_IT_AmbientTemperature[] = "Temperatura ambiente";
-static uint8_t text_ES_AmbientTemperature[] = "";
+static uint8_t text_ES_AmbientTemperature[] = "Temperatura ambiente";
 
 // Menu SYS2 sub Information
 static uint8_t text_EN_Korrekturwerte[] = "Correction values";
 static uint8_t text_DE_Korrekturwerte[] = "Korrekturwerte";
 static uint8_t text_FR_Korrekturwerte[] = "Corrections";
 static uint8_t text_IT_Korrekturwerte[] = "Correzione valore";
-static uint8_t text_ES_Korrekturwerte[] = "";
+static uint8_t text_ES_Korrekturwerte[] = "Corregir valores";
 
 // Customview Content
 static uint8_t text_EN_Clock[] = "Clock";
 static uint8_t text_DE_Clock[] = "Uhr";
 static uint8_t text_FR_Clock[] = "Heure";
 static uint8_t text_IT_Clock[] = "Orologio";
-static uint8_t text_ES_Clock[] = "";
+static uint8_t text_ES_Clock[] = "Reloj";
 
 // Surface mode (all weekdays)
 static uint8_t text_EN_Sunday[] = "Sunday";
 static uint8_t text_DE_Sunday[] = "Sonntag";
 static uint8_t text_FR_Sunday[] = "Dimanche";
 static uint8_t text_IT_Sunday[] = "Domenica";
-static uint8_t text_ES_Sunday[] = "";
+static uint8_t text_ES_Sunday[] = "Domingo";
 
 static uint8_t text_EN_Monday[] = "Monday";
 static uint8_t text_DE_Monday[] = "Montag";
 static uint8_t text_FR_Monday[] = "Lundi";
 static uint8_t text_IT_Monday[] = "Lunedi";
-static uint8_t text_ES_Monday[] = "";
+static uint8_t text_ES_Monday[] = "Lunes";
 
 static uint8_t text_EN_Tuesday[] = "Tuesday";
 static uint8_t text_DE_Tuesday[] = "Dienstag";
 static uint8_t text_FR_Tuesday[] = "Mardi";
 static uint8_t text_IT_Tuesday[] = "Martedi";
-static uint8_t text_ES_Tuesday[] = "";
+static uint8_t text_ES_Tuesday[] = "Martes";
 
 static uint8_t text_EN_Wednesday[] = "Wednesday";
 static uint8_t text_DE_Wednesday[] = "Mittwoch";
 static uint8_t text_FR_Wednesday[] = "Mercredi";
 static uint8_t text_IT_Wednesday[] = "Mercoledi";
-static uint8_t text_ES_Wednesday[] = "";
+static uint8_t text_ES_Wednesday[] = "Miércoles";
 
 static uint8_t text_EN_Thursday[] = "Thursday";
 static uint8_t text_DE_Thursday[] = "Donnerstag";
 static uint8_t text_FR_Thursday[] = "Jeudi";
 static uint8_t text_IT_Thursday[] = "Giovedi";
-static uint8_t text_ES_Thursday[] = "";
+static uint8_t text_ES_Thursday[] = "Jueves";
 
 static uint8_t text_EN_Friday[] = "Friday";
 static uint8_t text_DE_Friday[] = "Freitag";
 static uint8_t text_FR_Friday[] = "Vendredi";
 static uint8_t text_IT_Friday[] = "Venerdi";
-static uint8_t text_ES_Friday[] = "";
+static uint8_t text_ES_Friday[] = "Viernes";
 
 static uint8_t text_EN_Saturday[] = "Saturday";
 static uint8_t text_DE_Saturday[] = "Samstag";
 static uint8_t text_FR_Saturday[] = "Samedi";
 static uint8_t text_IT_Saturday[] = "Sabato";
-static uint8_t text_ES_Saturday[] = "";
+static uint8_t text_ES_Saturday[] = "Sábado";
 
 // Dive Mode und Customview Content (Bonex Computer)
 static uint8_t text_EN_ScooterRestkapazitaet[] = "Battery Capacity";
 static uint8_t text_DE_ScooterRestkapazitaet[] = "Batterie Kapazität";
 static uint8_t text_FR_ScooterRestkapazitaet[] = "Charge Batterie";     // Ok for "...  = 35%"
 static uint8_t text_IT_ScooterRestkapazitaet[] = "Carica Batteria";
-static uint8_t text_ES_ScooterRestkapazitaet[] = "";
+static uint8_t text_ES_ScooterRestkapazitaet[] = "Capacidad carga";
 
 // Dive Mode und Customview Content (Bonex Computer)
 static uint8_t text_EN_ScooterTemperature[] = "Motor Temp.";
 static uint8_t text_DE_ScooterTemperature[] = "";
 static uint8_t text_FR_ScooterTemperature[] = "Temp. moteur"; // "Température moteur";
 static uint8_t text_IT_ScooterTemperature[] = "Temp. Motore";
-static uint8_t text_ES_ScooterTemperature[] = "";
+static uint8_t text_ES_ScooterTemperature[] = "Temp. del motor";
 
 // Dive Mode und Customview Content (Bonex Computer)
 static uint8_t text_EN_ScooterSpeed[] = "Speed";
 static uint8_t text_DE_ScooterSpeed[] = "Geschwindigkeit";
 static uint8_t text_FR_ScooterSpeed[] = "Vitesse";
 static uint8_t text_IT_ScooterSpeed[] = "Velocita";
-static uint8_t text_ES_ScooterSpeed[] = "";
+static uint8_t text_ES_ScooterSpeed[] = "Velocidad";
 
 // Menu SYS1 (Bonex Computer)
 static uint8_t text_EN_ScooterSetup[] = "Bonex Setup";
 static uint8_t text_DE_ScooterSetup[] = "";
 static uint8_t text_FR_ScooterSetup[] = "Config. Bonex"; // "Configuration Bonex";
 static uint8_t text_IT_ScooterSetup[] = "Settaggio DPV";
-static uint8_t text_ES_ScooterSetup[] = "";
+static uint8_t text_ES_ScooterSetup[] = "Configuración Bonex";
 
 // Menu SYS1 (Bonex Computer)
 static uint8_t text_EN_ScooterDrag[] = "Drag";
 static uint8_t text_DE_ScooterDrag[] = "";
 static uint8_t text_FR_ScooterDrag[] = "";// "Traction";  // ?? No!! The traction force ? inhibition hw
 static uint8_t text_IT_ScooterDrag[] = "Spinta";
-static uint8_t text_ES_ScooterDrag[] = "";
+static uint8_t text_ES_ScooterDrag[] = "Arrastre";
 
 // Menu SYS1 (Bonex Computer)
 static uint8_t text_EN_ScooterLoad[] = "Load";
 static uint8_t text_DE_ScooterLoad[] = "";
 static uint8_t text_FR_ScooterLoad[] = ""; // "Charge";    // ?? Kg
 static uint8_t text_IT_ScooterLoad[] = "Caricamento";
-static uint8_t text_ES_ScooterLoad[] = "";
+static uint8_t text_ES_ScooterLoad[] = "Carga";
 
 // Menu SYS1 (Bonex Computer)
 static uint8_t text_EN_ScooterVolt[] = "Voltage";
 static uint8_t text_DE_ScooterVolt[] = "Spannung";
 static uint8_t text_FR_ScooterVolt[] = "";
 static uint8_t text_IT_ScooterVolt[] = "Voltaggio";
-static uint8_t text_ES_ScooterVolt[] = "";
+static uint8_t text_ES_ScooterVolt[] = "Voltaje";
 
 // Menu SYS1 (Bonex Computer)
 static uint8_t text_EN_ScooterD0Apnoe[] = "Apnea";
 static uint8_t text_DE_ScooterD0Apnoe[] = "Apnoe";
 static uint8_t text_FR_ScooterD0Apnoe[] = "Apnée";
 static uint8_t text_IT_ScooterD0Apnoe[] = "Apnea";
-static uint8_t text_ES_ScooterD0Apnoe[] = "";
+static uint8_t text_ES_ScooterD0Apnoe[] = "Apnea";
 
 // Menu SYS1 (Bonex Computer)
 static uint8_t text_EN_ScooterD1Scuba[] = "Scuba";
 static uint8_t text_DE_ScooterD1Scuba[] = "";
 static uint8_t text_FR_ScooterD1Scuba[] = "Plongée";
 static uint8_t text_IT_ScooterD1Scuba[] = "Immersione";
-static uint8_t text_ES_ScooterD1Scuba[] = "";
+static uint8_t text_ES_ScooterD1Scuba[] = "Buceo";
 
 // Menu SYS1 (Bonex Computer)
 static uint8_t text_EN_ScooterD2Tech[] = "Tech";
 static uint8_t text_DE_ScooterD2Tech[] = "";
 static uint8_t text_FR_ScooterD2Tech[] = ""; // Technique
 static uint8_t text_IT_ScooterD2Tech[] = "Immersione tecnica";
-static uint8_t text_ES_ScooterD2Tech[] = "";
+static uint8_t text_ES_ScooterD2Tech[] = "Técnico";
 
 // Menu SYS1 (Bonex Computer)
 static uint8_t text_EN_ScooterD3Heavy[] = "Heavy Tech";
 static uint8_t text_DE_ScooterD3Heavy[] = "";
 static uint8_t text_FR_ScooterD3Heavy[] = "";// Technique engagée
 static uint8_t text_IT_ScooterD3Heavy[] = "Immersione profonda";
-static uint8_t text_ES_ScooterD3Heavy[] = "";
+static uint8_t text_ES_ScooterD3Heavy[] = "Técnico intenso";
 
 // Menu SYS1 (Bonex Computer)
 static uint8_t text_EN_ScooterL0None[] = "none gear";
 static uint8_t text_DE_ScooterL0None[] = "";
 static uint8_t text_FR_ScooterL0None[] = "sans";
 static uint8_t text_IT_ScooterL0None[] = "in Folle";
-static uint8_t text_ES_ScooterL0None[] = "";
+static uint8_t text_ES_ScooterL0None[] = "Punto muerto";
 
 // Menu SYS1 (Bonex Computer)
 static uint8_t text_EN_ScooterL1Small[] = "Monotank / small double";
 static uint8_t text_DE_ScooterL1Small[] = "";
 static uint8_t text_FR_ScooterL1Small[] = "Mono / petit bi";
 static uint8_t text_IT_ScooterL1Small[] = "Mono / Bibo";
-static uint8_t text_ES_ScooterL1Small[] = "";
+static uint8_t text_ES_ScooterL1Small[] = "Monobotella / Bibotella";
 
 // Menu SYS1 (Bonex Computer)
 static uint8_t text_EN_ScooterL2Stages[] = "Rebreather & Stages";
 static uint8_t text_DE_ScooterL2Stages[] = "";
 static uint8_t text_FR_ScooterL2Stages[] = "Recycleur";
 static uint8_t text_IT_ScooterL2Stages[] = "Rebreather & Stage";
-static uint8_t text_ES_ScooterL2Stages[] = "";
+static uint8_t text_ES_ScooterL2Stages[] = "Rebreather y estapa";
 
 // Menu SYS1 (Bonex Computer)
 static uint8_t text_EN_ScooterL3Full[] = "Multistage & Backup";
 static uint8_t text_DE_ScooterL3Full[] = "";
 static uint8_t text_FR_ScooterL3Full[] = "Multi-blocs & backup";
 static uint8_t text_IT_ScooterL3Full[] = "Immersione multigas";
-static uint8_t text_ES_ScooterL3Full[] = "";
+static uint8_t text_ES_ScooterL3Full[] = "Multi etapa";
 
 // Menu SYS1 (Bonex Computer)
 static uint8_t text_EN_ScooterL4Towing[] = "Towing";
 static uint8_t text_DE_ScooterL4Towing[] = "";
 static uint8_t text_FR_ScooterL4Towing[] = "Remorquage";
 static uint8_t text_IT_ScooterL4Towing[] = "Traino";
-static uint8_t text_ES_ScooterL4Towing[] = "";
+static uint8_t text_ES_ScooterL4Towing[] = "Remolque";
 
 // Menu SYS1 (Bonex Computer)
 static uint8_t text_EN_ScooterBattTyp[] = "Accu";
@@ -1323,141 +1323,141 @@
 static uint8_t text_DE_HUDBattery[] = "HUD-Batterie";
 static uint8_t text_FR_HUDBattery[] = "Batterie HUD";
 static uint8_t text_IT_HUDBattery[] = "Batteria HUD";
-static uint8_t text_ES_HUDBattery[] = "";
+static uint8_t text_ES_HUDBattery[] = "Carga del HUD";
 
 // Menu SYS1 sub (buttons)
 static uint8_t text_EN_LowerIsLess[] = "Lower is less sensitive";
 static uint8_t text_DE_LowerIsLess[] = "Niedriger ist schwergängiger";
 static uint8_t text_FR_LowerIsLess[] = "Diminuer moins sensible";
 static uint8_t text_IT_LowerIsLess[] = "Più basso è più rigido";
-static uint8_t text_ES_LowerIsLess[] = "";
+static uint8_t text_ES_LowerIsLess[] = "A menor valor, menos sensibilidad";
 
 // Dive Mode YELLOW TEXT under Customview
 static uint8_t text_EN_DiveMenuQ[] = " Menu? ";
 static uint8_t text_DE_DiveMenuQ[] = " Menü? ";
 static uint8_t text_FR_DiveMenuQ[] = "";
 static uint8_t text_IT_DiveMenuQ[] = "Menu?";
-static uint8_t text_ES_DiveMenuQ[] = "";
+static uint8_t text_ES_DiveMenuQ[] = "Menú";
 
 // Dive Mode YELLOW TEXT under Customview
 static uint8_t text_EN_DiveQuitQ[] = " Quit? ";
 static uint8_t text_DE_DiveQuitQ[] = " Ende? ";
 static uint8_t text_FR_DiveQuitQ[] = "Quitter";
 static uint8_t text_IT_DiveQuitQ[] = "Uscita?";
-static uint8_t text_ES_DiveQuitQ[] = "";
+static uint8_t text_ES_DiveQuitQ[] = "¿Salir?";
 
 // Dive Mode YELLOW TEXT under Customview
 static uint8_t text_EN_DiveBearingQ[] = "Bearing";
 static uint8_t text_DE_DiveBearingQ[] = "Peilung";
 static uint8_t text_FR_DiveBearingQ[] = "";
 static uint8_t text_IT_DiveBearingQ[] = "";
-static uint8_t text_ES_DiveBearingQ[] = "";
+static uint8_t text_ES_DiveBearingQ[] = "Rumbo";
 
 // Dive Mode YELLOW TEXT under Customview
 static uint8_t text_EN_DiveResetAvgQ[] = "ResetAvr.";
 static uint8_t text_DE_DiveResetAvgQ[] = "Stoppuhr";
 static uint8_t text_FR_DiveResetAvgQ[] = "";
 static uint8_t text_IT_DiveResetAvgQ[] = "Reset AVR";
-static uint8_t text_ES_DiveResetAvgQ[] = "";
+static uint8_t text_ES_DiveResetAvgQ[] = "Reiniciar AVR";
 
 // Menu SYS2
 static uint8_t text_EN_ExtraDisplay[] = "Big font";
 static uint8_t text_DE_ExtraDisplay[] = "Grosse Schrift";
 static uint8_t text_FR_ExtraDisplay[] = "Grand police";
 static uint8_t text_IT_ExtraDisplay[] = "Caratteri grandi";
-static uint8_t text_ES_ExtraDisplay[] = "";
+static uint8_t text_ES_ExtraDisplay[] = "Letras grandes";
 
 // Menu SYS2
 static uint8_t text_EN_ExtraBigFont[] = "yes";
 static uint8_t text_DE_ExtraBigFont[] = "ja";
 static uint8_t text_FR_ExtraBigFont[] = "si";
 static uint8_t text_IT_ExtraBigFont[] = "si";
-static uint8_t text_ES_ExtraBigFont[] = "";
+static uint8_t text_ES_ExtraBigFont[] = "si";
 
 // Menu SYS2 (future feature)
 static uint8_t text_EN_ExtraDecoGame[] = "Deco game";
 static uint8_t text_DE_ExtraDecoGame[] = "Deko-Spiel";
 static uint8_t text_FR_ExtraDecoGame[] = "Jeu déco";
 static uint8_t text_IT_ExtraDecoGame[] = "Giochi deco";
-static uint8_t text_ES_ExtraDecoGame[] = "";
+static uint8_t text_ES_ExtraDecoGame[] = "Juego deco";
 
 // Menu SYS2
 static uint8_t text_EN_ExtraNone[] = "none";
 static uint8_t text_DE_ExtraNone[] = "nein";
 static uint8_t text_FR_ExtraNone[] = "non";
 static uint8_t text_IT_ExtraNone[] = "no";
-static uint8_t text_ES_ExtraNone[] = "";
+static uint8_t text_ES_ExtraNone[] = "ninguno";
 
 // Menu SYS2 Reset RTE and Firmware Update During Bluetooth Connection
 static uint8_t text_EN_DecoDataLost[] = "Decompression data will be lost";
 static uint8_t text_DE_DecoDataLost[] = "Dekompressionsdaten verloren!";
 static uint8_t text_FR_DecoDataLost[] = "RaZ de la décompression"; // RaZ
 static uint8_t text_IT_DecoDataLost[] = "";
-static uint8_t text_ES_DecoDataLost[] = "";
+static uint8_t text_ES_DecoDataLost[] = "Se perderá la información de descompresión";
 
 // Menu SYS1 sub and Dive Menu
 static uint8_t text_EN_SetBearing[] = "Set bearing";
 static uint8_t text_DE_SetBearing[] = "Kurs setzen";
 static uint8_t text_FR_SetBearing[] = "Réglage cap";
 static uint8_t text_IT_SetBearing[] = "Direzione bussola";
-static uint8_t text_ES_SetBearing[] = "";
+static uint8_t text_ES_SetBearing[] = "Ajustar rumbo";
 
 static uint8_t text_EN_ResetBearing[] = "Clear bearing";
 static uint8_t text_DE_ResetBearing[] = "Kurs löschen";
 static uint8_t text_FR_ResetBearing[] = "Annulation cap";
 static uint8_t text_IT_ResetBearing[] = "Cancellare rotta";
-static uint8_t text_ES_ResetBearing[] = "";
+static uint8_t text_ES_ResetBearing[] = "Borrar rumbo";
 
 // Menu SYS1, sub
 static uint8_t text_EN_SensorList[] = "Sensor";
 static uint8_t text_DE_SensorList[] = "";
 static uint8_t text_FR_SensorList[] = "Cellule";
 static uint8_t text_IT_SensorList[] = "";
-static uint8_t text_ES_SensorList[] = "";
+static uint8_t text_ES_SensorList[] = "Sensor";
 
 // Menu SYS1, sub
 static uint8_t text_EN_ButtonLeft[] = "Left";
 static uint8_t text_DE_ButtonLeft[] = "Links";
 static uint8_t text_FR_ButtonLeft[] = "Gauche";
 static uint8_t text_IT_ButtonLeft[] = "Sinistra";
-static uint8_t text_ES_ButtonLeft[] = "";
+static uint8_t text_ES_ButtonLeft[] = "Izquierda";
 
 static uint8_t text_EN_ButtonMitte[] = "Center";
 static uint8_t text_DE_ButtonMitte[] = "Mitte";
 static uint8_t text_FR_ButtonMitte[] = "Centre";
 static uint8_t text_IT_ButtonMitte[] = "Centro";
-static uint8_t text_ES_ButtonMitte[] = "";
+static uint8_t text_ES_ButtonMitte[] = "Centro";
 
 static uint8_t text_EN_ButtonRight[] = "Right";
 static uint8_t text_DE_ButtonRight[] = "Rechts";
 static uint8_t text_FR_ButtonRight[] = "Droite";
 static uint8_t text_IT_ButtonRight[] = "Destra";
-static uint8_t text_ES_ButtonRight[] = "";
+static uint8_t text_ES_ButtonRight[] = "Derecha";
 
 // Customview in Divemode
 static uint8_t text_EN_Summary[] = "Overview";
 static uint8_t text_DE_Summary[] = "Uebersicht"; // T42 hat keine großen Umlaute hw 170103
 static uint8_t text_FR_Summary[] = "Exposé";
 static uint8_t text_IT_Summary[] = "Tutto schermo";
-static uint8_t text_ES_Summary[] = "";
+static uint8_t text_ES_Summary[] = "Visión general";
 
 static uint8_t text_EN_ApneaTotal[] = "total";
 static uint8_t text_DE_ApneaTotal[] = "gesamt";
 static uint8_t text_FR_ApneaTotal[] = "";
 static uint8_t text_IT_ApneaTotal[] = "Completo";
-static uint8_t text_ES_ApneaTotal[] = "";
+static uint8_t text_ES_ApneaTotal[] = "Total";
 
 static uint8_t text_EN_ApneaLast[] = "last";
 static uint8_t text_DE_ApneaLast[] = "letzter";
 static uint8_t text_FR_ApneaLast[] = "dernier";
 static uint8_t text_IT_ApneaLast[] = "";
-static uint8_t text_ES_ApneaLast[] = "";
+static uint8_t text_ES_ApneaLast[] = "último";
 
 static uint8_t text_EN_ApneaSurface[] = "Surface time";
 static uint8_t text_DE_ApneaSurface[] = "Oberflächenzeit";
 static uint8_t text_FR_ApneaSurface[] = "Tps.surface";
 static uint8_t text_IT_ApneaSurface[] = "Tempo di superficie";
-static uint8_t text_ES_ApneaSurface[] = "";
+static uint8_t text_ES_ApneaSurface[] = "Tiempo de superficie";
 
 /*
 static uint8_t text_EN_ApneaCount[] = "";
@@ -1477,142 +1477,142 @@
 static uint8_t text_DE_Apnoe[] = "Apnoe";
 static uint8_t text_FR_Apnoe[] = "Apnée";
 static uint8_t text_IT_Apnoe[] = "Apnea";
-static uint8_t text_ES_Apnoe[] = "";
+static uint8_t text_ES_Apnoe[] = "Apnea";
 
 // Menu DECO1 (future)
 static uint8_t text_EN_Gauge[] = "Gauge";
 static uint8_t text_DE_Gauge[] = "Tiefenmesser";
 static uint8_t text_FR_Gauge[] = "Profondimétre";
 static uint8_t text_IT_Gauge[] = "Profondimetro";
-static uint8_t text_ES_Gauge[] = "";
+static uint8_t text_ES_Gauge[] = "Profundimetro";
 
 
 static uint8_t text_EN_Default[] = "Default";
 static uint8_t text_DE_Default[] = "";
 static uint8_t text_FR_Default[] = "Défaut";
 static uint8_t text_IT_Default[] = "Standard";
-static uint8_t text_ES_Default[] = "";
+static uint8_t text_ES_Default[] = "Por defecto";
 
 static uint8_t text_EN_LiterproMinute[] = "Liter/Minute";
 static uint8_t text_DE_LiterproMinute[] = "Liter/Minute";
 static uint8_t text_FR_LiterproMinute[] = "Litre/minute";
 static uint8_t text_IT_LiterproMinute[] = "Litri/Minuti";
-static uint8_t text_ES_LiterproMinute[] = "";
+static uint8_t text_ES_LiterproMinute[] = "Litros/Minuto";
 
 static uint8_t text_EN_Reserve[] = "Reserve";
 static uint8_t text_DE_Reserve[] = "";
 static uint8_t text_FR_Reserve[] = "Réserve";
 static uint8_t text_IT_Reserve[] = "Riserva";
-static uint8_t text_ES_Reserve[] = "";
+static uint8_t text_ES_Reserve[] = "Reserva";
 
 static uint8_t text_EN_Daylightsaving[] = "Daylight sav.";
 static uint8_t text_DE_Daylightsaving[] = "Sommerzeit";
 static uint8_t text_FR_Daylightsaving[] = "Heure d'été";
 static uint8_t text_IT_Daylightsaving[] = "";
-static uint8_t text_ES_Daylightsaving[] = "";
+static uint8_t text_ES_Daylightsaving[] = "Horario de verano";
 
 static uint8_t text_EN_ShowDebug[] = "Debug info";
 static uint8_t text_DE_ShowDebug[] = "Fehlersuche";
 static uint8_t text_FR_ShowDebug[] = "Info de déboguage";
 static uint8_t text_IT_ShowDebug[] = "Informazioni Debug";
-static uint8_t text_ES_ShowDebug[] = "";
+static uint8_t text_ES_ShowDebug[] = "Información de depuración";
 
 static uint8_t text_EN_SimTravelGas[] = "Travel Gas";
 static uint8_t text_DE_SimTravelGas[] = "Reise Gas";
 static uint8_t text_FR_SimTravelGas[] = "Gaz Travel";
 static uint8_t text_IT_SimTravelGas[] = "Gas da viaggio";
-static uint8_t text_ES_SimTravelGas[] = "";
+static uint8_t text_ES_SimTravelGas[] = "Gas de viaje";
 
 static uint8_t text_EN_SimDecoGas[] = "Deco Gas";
 static uint8_t text_DE_SimDecoGas[] = "Deko Gas";
 static uint8_t text_FR_SimDecoGas[] = "Gaz déco";
 static uint8_t text_IT_SimDecoGas[] = "Gas decompressivo";
-static uint8_t text_ES_SimDecoGas[] = "";
+static uint8_t text_ES_SimDecoGas[] = "Gas deco";
 
 static uint8_t text_EN_OTU[] = "OTU";
 static uint8_t text_DE_OTU[] = "";
 static uint8_t text_FR_OTU[] = "";     // UTO ?? I think we do use OTU too.
 static uint8_t text_IT_OTU[] = "OTU";
-static uint8_t text_ES_OTU[] = "";
+static uint8_t text_ES_OTU[] = "OTUs";
 
 /*
 static uint8_t text_EN_Button1[] = "Button 1";
 static uint8_t text_DE_Button1[] = "Taster 1";
 static uint8_t text_FR_Button1[] = "Bouton 1";
 static uint8_t text_IT_Button1[] = "Pulsante1";
-static uint8_t text_ES_Button1[] = "";
+static uint8_t text_ES_Button1[] = "Botón 1";
 
 static uint8_t text_EN_Button2[] = "Button 2";
 static uint8_t text_DE_Button2[] = "Taster 2";
 static uint8_t text_FR_Button2[] = "";
 static uint8_t text_IT_Button2[] = "Pulsante2";
-static uint8_t text_ES_Button2[] = "";
+static uint8_t text_ES_Button2[] = "Botón 2";
 
 static uint8_t text_EN_Button3[] = "Button 3";
 static uint8_t text_DE_Button3[] = "Taster 3";
 static uint8_t text_FR_Button3[] = "";
 static uint8_t text_IT_Button3[] = "Pulsante3";
-static uint8_t text_ES_Button3[] = "";
+static uint8_t text_ES_Button3[] = "Botón 3";
 
 static uint8_t text_EN_Button4[] = "Button 4";
 static uint8_t text_DE_Button4[] = "Taster 4";
 static uint8_t text_FR_Button4[] = "";
 static uint8_t text_IT_Button4[] = "Pulsante4";
-static uint8_t text_ES_Button4[] = "";
+static uint8_t text_ES_Button4[] = "Botón 4";
 
 static uint8_t text_EN_Yes[] = "Yes";
 static uint8_t text_DE_Yes[] = "Ja";
 static uint8_t text_FR_Yes[] = "Oui";
 static uint8_t text_IT_Yes[] = "Si";
-static uint8_t text_ES_Yes[] = "";
+static uint8_t text_ES_Yes[] = "Si";
 
 static uint8_t text_EN_No[] = "No";
 static uint8_t text_DE_No[] = "Nein";
 static uint8_t text_FR_No[] = "Non";
 static uint8_t text_IT_No[] = "No";
-static uint8_t text_ES_No[] = "";
+static uint8_t text_ES_No[] = "No";
 
 static uint8_t text_EN_Conservatism[] = "Conservatism";
 static uint8_t text_DE_Conservatism[] = "Konservatismus";
 static uint8_t text_FR_Conservatism[] = "Conservatisme";
 static uint8_t text_IT_Conservatism[] = "Conservativismo";
-static uint8_t text_ES_Conservatism[] = "";
+static uint8_t text_ES_Conservatism[] = "Conservadurismo";
 
 static uint8_t text_EN_Conservatism[] = "Setting"; // was Dive Menu
 static uint8_t text_DE_Conservatism[] = "Level";
 static uint8_t text_FR_Conservatism[] = "Conservatisme";    // Or "Durcis."
 static uint8_t text_IT_Conservatism[] = "Livello conservativismo";
-static uint8_t text_ES_Conservatism[] = "";
+static uint8_t text_ES_Conservatism[] = "Grado de conservadurismo";
 
 static uint8_t text_EN_FirmwareUpdate[] = "Firmware update";
 static uint8_t text_DE_FirmwareUpdate[] = "Firmware aktualisieren";
 static uint8_t text_FR_FirmwareUpdate[] = "";
 static uint8_t text_IT_FirmwareUpdate[] = "Firmware";
-static uint8_t text_ES_FirmwareUpdate[] = "";
+static uint8_t text_ES_FirmwareUpdate[] = "Actualizar firmware";
 
 static uint8_t text_EN_ppo2_setting[] = "ppO2 bar";
 static uint8_t text_DE_ppo2_setting[] = "";
 static uint8_t text_FR_ppo2_setting[] = "ppO2 bar";
 static uint8_t text_IT_ppo2_setting[] = "ppO2 Bar";
-static uint8_t text_ES_ppo2_setting[] = "";
+static uint8_t text_ES_ppo2_setting[] = "ppO2 Bar";
 
 static uint8_t text_EN_down[] = "Down";
 static uint8_t text_DE_down[] = "Hinunter";
 static uint8_t text_FR_down[] = "";
 static uint8_t text_IT_down[] = "Sotto";
-static uint8_t text_ES_down[] = "";
+static uint8_t text_ES_down[] = "Abajo";
 
 static uint8_t text_EN_enter[] = "Enter";
 static uint8_t text_DE_enter[] = "";
 static uint8_t text_FR_enter[] = "Entrer";
 static uint8_t text_IT_enter[] = "Conferma";
-static uint8_t text_ES_enter[] = "";
+static uint8_t text_ES_enter[] = "Entrar";
 
 static uint8_t text_EN_Change[] = "Change";
 static uint8_t text_DE_Change[] = "";
 static uint8_t text_FR_Change[] = "";
 static uint8_t text_IT_Change[] = "Cambio";
-static uint8_t text_ES_Change[] = "";
+static uint8_t text_ES_Change[] = "Cambiar";
 */
 
 
@@ -1622,11 +1622,11 @@
 static uint8_t text_DE_Bottle[] = "Flasche";
 static uint8_t text_FR_Bottle[] = "";
 static uint8_t text_IT_Bottle[] = "Litraggio bombola";
-static uint8_t text_ES_Bottle[] = "";
+static uint8_t text_ES_Bottle[] = "Volumen botella";
 
 
-static uint8_t text_EN_GasVorrat[] = "Atem-Gas-Vorrat";
-static uint8_t text_DE_GasVorrat[] = "Atem-Gas-Vorrat";
+static uint8_t text_EN_GasVorrat[] = "Pressure Budget";
+static uint8_t text_DE_GasVorrat[] = "Gasvorrat";
 static uint8_t text_FR_GasVorrat[] = "";
 static uint8_t text_IT_GasVorrat[] = "";
 static uint8_t text_ES_GasVorrat[] = "";
@@ -1635,20 +1635,20 @@
 static uint8_t text_DE_WirelessSender[] = "Sender ID";
 static uint8_t text_FR_WirelessSender[] = "";
 static uint8_t text_IT_WirelessSender[] = "Numero di serie";
-static uint8_t text_ES_WirelessSender[] = "";
+static uint8_t text_ES_WirelessSender[] = "wireless id";
 
 static uint8_t text_EN_WirelessDisconnect[] = "Disconnect";
 static uint8_t text_DE_WirelessDisconnect[] = "Nicht verbunden";
 static uint8_t text_FR_WirelessDisconnect[] = "";
 static uint8_t text_IT_WirelessDisconnect[] = "Disconnesso";
-static uint8_t text_ES_WirelessDisconnect[] = "";
+static uint8_t text_ES_WirelessDisconnect[] = "Desconectado";
 
 /*
 static uint8_t text_EN_Luftintegration[] = "air integration";
 static uint8_t text_DE_Luftintegration[] = "Luftintegration";
 static uint8_t text_FR_Luftintegration[] = "";
 static uint8_t text_IT_Luftintegration[] = "ARIA";
-static uint8_t text_ES_Luftintegration[] = "";
+static uint8_t text_ES_Luftintegration[] = "aire integrado";
 */
 
 static uint8_t text_EN_FlipDisplay[] = "Flip display";
--- a/Small_CPU/Inc/spi.h	Thu Jan 03 18:35:11 2019 +0100
+++ b/Small_CPU/Inc/spi.h	Thu Jan 03 19:59:36 2019 +0100
@@ -36,7 +36,9 @@
 void MX_SPI3_Init(void);
 void MX_SPI3_DeInit(void);
 uint8_t SPI3_ButtonAdjust(uint8_t *arrayInput, uint8_t *arrayOutput);
-	 
+void MX_SPI_DeInit(void);
+
+
 #ifdef __cplusplus
 }
 #endif
--- a/Small_CPU/Src/baseCPU2.c	Thu Jan 03 18:35:11 2019 +0100
+++ b/Small_CPU/Src/baseCPU2.c	Thu Jan 03 19:59:36 2019 +0100
@@ -153,51 +153,44 @@
 #include "stm32f4xx_hal.h"
 #include <stdio.h>
 
-uint8_t hasExternalClock(void)
-{
-    if( (TM_OTP_Read( 0, 0 ) > 0) && (TM_OTP_Read( 0, 0 ) < 0xFF) )
-        return 1;
-    else
-        return 0;
+uint8_t hasExternalClock(void) {
+	if ((TM_OTP_Read(0, 0) > 0) && (TM_OTP_Read(0, 0) < 0xFF))
+		return 1;
+	else
+		return 0;
 }
 
 // SHALL LOAD AT 0x08000000 + 0x00005000 = 0x08005000.
 // See CPU2-RTE.ld
-const SFirmwareData cpu2_FirmwareData __attribute__(( section(".firmware_data") ))
-    =
-    {
-      .versionFirst = 1,
-      .versionSecond = 6,
-      .versionThird = 0,
-      .versionBeta = 0,
+const SFirmwareData cpu2_FirmwareData __attribute__(( section(".firmware_data") ))= {
+		.versionFirst = 1,
+		.versionSecond = 5,
+		.versionThird = 1,
+		.versionBeta = 0,
 
-      /* 4 bytes with trailing 0 */
-      .signature = "mh",
+/* 4 bytes with trailing 0 */
+		.signature = "mh",
 
-      .release_year = 18,
-      .release_month = 7,
-      .release_day = 29,
-      .release_sub = 0,
-
-      /* max 48 with trailing 0 */
-      //release_info ="12345678901234567890123456789012345678901"
-      .release_info = "compass stuff",
+		.release_year = 18,
+		.release_month = 7,
+		.release_day = 29,
+		.release_sub = 0,
 
-      /* for safety reasons and coming functions */
-      .magic[0] = FIRMWARE_MAGIC_FIRST,
-      .magic[1] = FIRMWARE_MAGIC_SECOND,
-      .magic[2] = FIRMWARE_MAGIC_CPU2_RTE, /* the magic byte for RTE */
-      .magic[3] = FIRMWARE_MAGIC_END
-    };
+		/* max 48 with trailing 0 */
+		//release_info ="12345678901234567890123456789012345678901"
+		.release_info = "compass stuff",
 
-uint8_t firmwareVersionHigh(void)
-{
-    return cpu2_FirmwareData.versionFirst;
+		/* for safety reasons and coming functions */
+		.magic[0] = FIRMWARE_MAGIC_FIRST, .magic[1] = FIRMWARE_MAGIC_SECOND,
+		.magic[2] = FIRMWARE_MAGIC_CPU2_RTE, /* the magic byte for RTE */
+		.magic[3] = FIRMWARE_MAGIC_END };
+
+uint8_t firmwareVersionHigh(void) {
+	return cpu2_FirmwareData.versionFirst;
 }
 
-uint8_t firmwareVersionLow(void)
-{
-    return cpu2_FirmwareData.versionSecond;
+uint8_t firmwareVersionLow(void) {
+	return cpu2_FirmwareData.versionSecond;
 }
 
 /** @addtogroup OSTC4
@@ -273,10 +266,9 @@
 
 #define REGULAR_RUN
 
-int __io_putchar(int ch)
-{
-    ITM_SendChar( ch );
-    return ch;
+int __io_putchar(int ch) {
+	ITM_SendChar(ch);
+	return ch;
 }
 
 /* Private functions ---------------------------------------------------------*/
@@ -287,140 +279,122 @@
  * @retval None
  */
 
-int main(void)
-{
-    HAL_Init();
-    SystemClock_Config();
+int main(void) {
+	HAL_Init();
+	SystemClock_Config();
 
-    HAL_SYSTICK_Config( HAL_RCC_GetHCLKFreq() / 1000 );
-    HAL_SYSTICK_CLKSourceConfig( SYSTICK_CLKSOURCE_HCLK );
-    HAL_NVIC_SetPriority( SysTick_IRQn, 0, 0 );
+	HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq() / 1000);
+	HAL_SYSTICK_CLKSourceConfig( SYSTICK_CLKSOURCE_HCLK);
+	HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
 
-    MX_RTC_init();
-    GPIO_LED_Init();
-    GPIO_new_DEBUG_Init(); // added 170322 hw
-    initGlobals();
+	MX_RTC_init();
+	GPIO_LED_Init();
+	GPIO_new_DEBUG_Init(); // added 170322 hw
+	initGlobals();
 
-    printf("CPU2-RTE running...\n");
+	printf("CPU2-RTE running...\n");
 
-    MX_I2C1_Init();
-    if( global.I2C_SystemStatus != HAL_OK )
-    {
-        if( MX_I2C1_TestAndClear() == GPIO_PIN_RESET )
-        {
-            MX_I2C1_TestAndClear(); // do it a second time
-        }
-        MX_I2C1_Init();
-    }
+	MX_I2C1_Init();
+	if (global.I2C_SystemStatus != HAL_OK) {
+		if (MX_I2C1_TestAndClear() == GPIO_PIN_RESET) {
+			MX_I2C1_TestAndClear(); // do it a second time
+		}
+		MX_I2C1_Init();
+	}
 
-    //dangerous:	TM_OTP_Write(0,0, 0x01);
+	//dangerous:	TM_OTP_Write(0,0, 0x01);
 #ifdef REGULAR_RUN
-    global.sensorError[SENSOR_PRESSURE_ID] = init_pressure();
-    global.I2C_SystemStatus = global.sensorError[SENSOR_PRESSURE_ID];
-    if( global.I2C_SystemStatus != HAL_OK )
-    {
-        if( MX_I2C1_TestAndClear() == GPIO_PIN_RESET )
-        {
-            MX_I2C1_TestAndClear(); // do it a second time
-        }
-        MX_I2C1_Init();
-        global.sensorError[SENSOR_PRESSURE_ID] = init_pressure();
-        global.I2C_SystemStatus = global.sensorError[SENSOR_PRESSURE_ID];
-    }
+	global.sensorError[SENSOR_PRESSURE_ID] = init_pressure();
+	global.I2C_SystemStatus = global.sensorError[SENSOR_PRESSURE_ID];
+	if (global.I2C_SystemStatus != HAL_OK) {
+		if (MX_I2C1_TestAndClear() == GPIO_PIN_RESET) {
+			MX_I2C1_TestAndClear(); // do it a second time
+		}
+		MX_I2C1_Init();
+		global.sensorError[SENSOR_PRESSURE_ID] = init_pressure();
+		global.I2C_SystemStatus = global.sensorError[SENSOR_PRESSURE_ID];
+	}
 
-    global.dataSendToMaster.sensorErrors =
-        global.sensorError[SENSOR_PRESSURE_ID];
-    init_surface_ring();
-    init_battery_gas_gauge();
-    HAL_Delay( 10 );
-    battery_gas_gauge_get_data();
+	global.dataSendToMaster.sensorErrors =
+			global.sensorError[SENSOR_PRESSURE_ID];
+	init_surface_ring();
+	init_battery_gas_gauge();
+	HAL_Delay(10);
+	battery_gas_gauge_get_data();
 //	battery_gas_gauge_set(0);
 
-    global.lifeData.battery_voltage = get_voltage();
-    global.lifeData.battery_charge = get_charge();
-    copyBatteryData();
+	global.lifeData.battery_voltage = get_voltage();
+	global.lifeData.battery_charge = get_charge();
+	copyBatteryData();
 
-    MX_SPI3_Init();
-    if( !scheduleSetButtonResponsiveness() )
-    {
-        HAL_Delay( 1 );
-        scheduleSetButtonResponsiveness(); // init
-        HAL_Delay( 1 );
-        if( !scheduleSetButtonResponsiveness() ) // send again, if problem it's not my problem here.
-        {
-            HAL_Delay( 1 );
-            scheduleSetButtonResponsiveness(); // init
-            HAL_Delay( 1 );
-        }
-    }
+	MX_SPI3_Init();
+	if (!scheduleSetButtonResponsiveness()) {
+		HAL_Delay(1);
+		scheduleSetButtonResponsiveness(); // init
+		HAL_Delay(1);
+		if (!scheduleSetButtonResponsiveness()) // send again, if problem it's not my problem here.
+		{
+			HAL_Delay(1);
+			scheduleSetButtonResponsiveness(); // init
+			HAL_Delay(1);
+		}
+	}
 
-    ADCx_Init();
-    GPIO_Power_MainCPU_Init();
-    global.mode = MODE_POWERUP;
+	ADCx_Init();
+	GPIO_Power_MainCPU_Init();
+	global.mode = MODE_POWERUP;
 #else
-    init_pressure();
-    init_surface_ring();
+	init_pressure();
+	init_surface_ring();
 
-    ADCx_Init();
-    GPIO_Power_MainCPU_Init();
-    global.mode = MODE_TEST;
+	ADCx_Init();
+	GPIO_Power_MainCPU_Init();
+	global.mode = MODE_TEST;
 #endif
-    while( 1 )
-    {
-        printf("Global mode = %d\n", global.mode);
+	while (1) {
+		printf("Global mode = %d\n", global.mode);
 
-        switch( global.mode )
-        {
-        case MODE_POWERUP:
-        case MODE_BOOT:
-            //				ReInit_battery_charger_status_pins();
-            compass_init( 0, 7 );
-            accelerator_init();
-            wireless_init();
-            if( global.mode == MODE_BOOT )
-            {
-                GPIO_Power_MainCPU_OFF();
-                HAL_Delay( 100 ); // for GPIO_Power_MainCPU_ON();
-                GPIO_Power_MainCPU_ON();
-            }
-            SPI_synchronize_with_Master();
-            MX_DMA_Init();
-            MX_SPI1_Init();
-            MX_EXTI_wireless_Init();
-            SPI_Start_single_TxRx_with_Master();
-            EXTI_Test_Button_Init();
+		switch (global.mode) {
+		case MODE_POWERUP:
+		case MODE_BOOT:
+			//				ReInit_battery_charger_status_pins();
+			compass_init(0, 7);
+			accelerator_init();
+			wireless_init();
+			if (global.mode == MODE_BOOT) {
+				GPIO_Power_MainCPU_OFF();
+				HAL_Delay(100); // for GPIO_Power_MainCPU_ON();
+				GPIO_Power_MainCPU_ON();
+			}
+			SPI_synchronize_with_Master();
+			MX_DMA_Init();
+			MX_SPI1_Init();
+			MX_EXTI_wireless_Init();
+//			SPI_Start_single_TxRx_with_Master();
+			EXTI_Test_Button_Init();
 
-            /*
-             uint8_t dataWireless[64];
-             while(1)
-             {
-             wireless_evaluate_and_debug(dataWireless,64);
-             }
-             */
-            global.mode = MODE_SURFACE;
-            break;
-
-        case MODE_CALIB:
-            scheduleCompassCalibrationMode();
-            break;
+			/*
+			 uint8_t dataWireless[64];
+			 while(1)
+			 {
+			 wireless_evaluate_and_debug(dataWireless,64);
+			 }
+			 */
+			global.mode = MODE_SURFACE;
+			break;
 
-        case MODE_SURFACE:
-            scheduleSurfaceMode();
-            break;
+		case MODE_CALIB:
+            scheduleCompassCalibrationMode();
+			break;
 
-        case MODE_TEST:
-            GPIO_Power_MainCPU_ON();
-            SPI_synchronize_with_Master();
-            MX_DMA_Init();
-            MX_SPI1_Init();
-//				MX_EXTI_wireless_Init();
-            SPI_Start_single_TxRx_with_Master();
-//				EXTI_Test_Button_Init();
+		case MODE_SURFACE:
+			scheduleSurfaceMode();
+			break;
 
-            scheduleTestMode();
-            break;
+		case MODE_TEST:
+			break;
 
-        case MODE_DIVE:
+		case MODE_DIVE:
             backup.no_fly_time_minutes = global.no_fly_time_minutes;
             backup.seconds_since_last_dive = global.seconds_since_last_dive;
 
@@ -454,102 +428,93 @@
 
             backup.no_fly_time_minutes = 0;
             backup.seconds_since_last_dive = 0;
-            break;
+			break;
 
-        case MODE_SHUTDOWN:
-            HAL_Delay( 200 );
-            global.mode = MODE_SLEEP;
-            MX_SPI3_Init();
-            break;
+		case MODE_SHUTDOWN:
+			HAL_Delay(200);
+			global.mode = MODE_SLEEP;
+			MX_SPI3_Init();
+			break;
 
-        case MODE_SLEEP:
-            /*
-             sleep_prepare();
-             scheduleSleepMode_test();
-             */
-            /*
-             GPIO_Power_MainCPU_OFF();
-             EXTI_Test_Button_DeInit();
-             EXTI_Wakeup_Button_Init();
-             NOT_USED_AT_THE_MOMENT_scheduleSleepMode();
-             */
-            EXTI_Test_Button_DeInit();
-            MX_EXTI_wireless_DeInit();
-            if( hasExternalClock() )
-                SystemClock_Config_HSI();
-            sleep_prepare();
+		case MODE_SLEEP:
+			/*
+			 sleep_prepare();
+			 scheduleSleepMode_test();
+			 */
+			/*
+			 GPIO_Power_MainCPU_OFF();
+			 EXTI_Test_Button_DeInit();
+			 EXTI_Wakeup_Button_Init();
+			 NOT_USED_AT_THE_MOMENT_scheduleSleepMode();
+			 */
+			EXTI_Test_Button_DeInit();
+			MX_EXTI_wireless_DeInit();
+			if (hasExternalClock())
+				SystemClock_Config_HSI();
+			sleep_prepare();
 
-            GPIO_LED_Init();
+			GPIO_LED_Init();
 
-            scheduleSleepMode();
-            if( hasExternalClock() )
-                SystemClock_Config_HSE();
-            GPIO_LED_Init();
-            EXTI_Wakeup_Button_DeInit();
-            ADCx_Init();
-            GPIO_Power_MainCPU_Init();
-            GPIO_Power_MainCPU_ON();
-            compass_init( 0, 7 );
-            accelerator_init();
-            wireless_init();
-            SPI_synchronize_with_Master();
-            MX_DMA_Init();
-            MX_SPI1_Init();
-            MX_EXTI_wireless_Init();
-            SPI_Start_single_TxRx_with_Master();
+			scheduleSleepMode();
+			if (hasExternalClock())
+				SystemClock_Config_HSE();
+			GPIO_LED_Init();
+			EXTI_Wakeup_Button_DeInit();
+			ADCx_Init();
+			GPIO_Power_MainCPU_Init();
+			GPIO_Power_MainCPU_ON();
+			compass_init(0, 7);
+			accelerator_init();
+			wireless_init();
+//			SPI_synchronize_with_Master(); TODO: REMOVE
+			MX_DMA_Init();
+			MX_SPI1_Init();
+			MX_EXTI_wireless_Init();
+//			SPI_Start_single_TxRx_with_Master();
 
-            // EXTILine0_Button_DeInit(); not now, later after testing
-            break;
-        }
-    }
+			// EXTILine0_Button_DeInit(); not now, later after testing
+			break;
+		}
+	}
 }
 
 /** @brief Button feedback - EXTI line detection callbacks
  * @param GPIO_Pin: Specifies the pins connected EXTI line
  * @retval None
  */
-void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
-{
+void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) {
 
-    if( GPIO_Pin == WIRELSS_RISING_GPIO_PIN )
-    {
-        wireless_trigger_RisingEdgeSilence();
-    }
+	if (GPIO_Pin == WIRELSS_RISING_GPIO_PIN) {
+		wireless_trigger_RisingEdgeSilence();
+	}
 
-    else
+	else
 
-    if( GPIO_Pin == WIRELSS_FALLING_GPIO_PIN )
-    {
-        wireless_trigger_FallingEdgeSignalHigh();
-    }
+	if (GPIO_Pin == WIRELSS_FALLING_GPIO_PIN) {
+		wireless_trigger_FallingEdgeSignalHigh();
+	}
 
-    else
+	else
 
-    if( GPIO_Pin == BUTTON_OSTC_GPIO_PIN )
-    {
-        if( global.mode == MODE_SLEEP )
-        {
-            global.mode = MODE_BOOT;
-        }
-    }
+	if (GPIO_Pin == BUTTON_OSTC_GPIO_PIN) {
+		if (global.mode == MODE_SLEEP) {
+			global.mode = MODE_BOOT;
+		}
+	}
 
-    else
+	else
 
-    if( GPIO_Pin == BUTTON_TEST_GPIO_PIN )
-    {
-        if( !global.demo_mode && (global.mode == MODE_SURFACE) )
-        {
-            global.demo_mode = 1;
-            global.mode = MODE_DIVE;
-        }
-        else if( global.demo_mode && (global.mode == MODE_DIVE)
-            && (global.lifeData.dive_time_seconds > 10) )
-        {
-            global.demo_mode = 0;
-            global.dataSendToMaster.mode = MODE_ENDDIVE;
-            global.deviceDataSendToMaster.mode = MODE_ENDDIVE;
-        }
-    }
+	if (GPIO_Pin == BUTTON_TEST_GPIO_PIN) {
+		if (!global.demo_mode && (global.mode == MODE_SURFACE)) {
+			global.demo_mode = 1;
+			global.mode = MODE_DIVE;
+		} else if (global.demo_mode && (global.mode == MODE_DIVE)
+				&& (global.lifeData.dive_time_seconds > 10)) {
+			global.demo_mode = 0;
+			global.dataSendToMaster.mode = MODE_ENDDIVE;
+			global.deviceDataSendToMaster.mode = MODE_ENDDIVE;
+		}
+	}
 }
 
 /**
@@ -573,47 +538,44 @@
  * @retval None
  */
 
-void SystemClock_Config(void)
-{
-    if( hasExternalClock() )
-        SystemClock_Config_HSE();
-    else
-        SystemClock_Config_HSI();
+void SystemClock_Config(void) {
+	if (hasExternalClock())
+		SystemClock_Config_HSE();
+	else
+		SystemClock_Config_HSI();
 }
 
-void SYSCLKConfig_STOP(void)
-{
-    SYSCLKConfig_STOP_HSI();
+void SYSCLKConfig_STOP(void) {
+	SYSCLKConfig_STOP_HSI();
 }
 
-void SystemClock_Config_HSE(void)
-{
-    RCC_OscInitTypeDef RCC_OscInitStruct;
-    RCC_ClkInitTypeDef RCC_ClkInitStruct;
+void SystemClock_Config_HSE(void) {
+	RCC_OscInitTypeDef RCC_OscInitStruct;
+	RCC_ClkInitTypeDef RCC_ClkInitStruct;
 //  RCC_PeriphCLKInitTypeDef PeriphClkInitStruct;
 
-    __PWR_CLK_ENABLE(); // is identical to __HAL_RCC_PWR_CLK_ENABLE();
+	__PWR_CLK_ENABLE(); // is identical to __HAL_RCC_PWR_CLK_ENABLE();
 
-    __HAL_PWR_VOLTAGESCALING_CONFIG( PWR_REGULATOR_VOLTAGE_SCALE2 );
+	__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE2);
 
-    RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; //|RCC_OSCILLATORTYPE_LSE;
-    RCC_OscInitStruct.HSEState = RCC_HSE_ON;
-    //RCC_OscInitStruct.LSEState = RCC_LSE_ON;
-    RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
-    RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
-    RCC_OscInitStruct.PLL.PLLM = 8;
-    RCC_OscInitStruct.PLL.PLLN = 320;
-    RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV4;
-    RCC_OscInitStruct.PLL.PLLQ = 4;
-    HAL_RCC_OscConfig( &RCC_OscInitStruct );
+	RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; //|RCC_OSCILLATORTYPE_LSE;
+	RCC_OscInitStruct.HSEState = RCC_HSE_ON;
+	//RCC_OscInitStruct.LSEState = RCC_LSE_ON;
+	RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
+	RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
+	RCC_OscInitStruct.PLL.PLLM = 8;
+	RCC_OscInitStruct.PLL.PLLN = 320;
+	RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV4;
+	RCC_OscInitStruct.PLL.PLLQ = 4;
+	HAL_RCC_OscConfig(&RCC_OscInitStruct);
 
-    RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK
-        | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2;
-    RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
-    RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
-    RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2;
-    RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
-    HAL_RCC_ClockConfig( &RCC_ClkInitStruct, FLASH_LATENCY_2 );
+	RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK
+			| RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2;
+	RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
+	RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
+	RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2;
+	RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
+	HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2);
 
 //  PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_RTC;
 //  PeriphClkInitStruct.RTCClockSelection = RCC_RTCCLKSOURCE_LSE;
@@ -623,44 +585,43 @@
 
 //  HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);
 
-    /* SysTick_IRQn interrupt configuration */
+	/* SysTick_IRQn interrupt configuration */
 //  HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
 }
 
-void SystemClock_Config_HSI(void)
-{
-    RCC_ClkInitTypeDef RCC_ClkInitStruct;
-    RCC_OscInitTypeDef RCC_OscInitStruct;
+void SystemClock_Config_HSI(void) {
+	RCC_ClkInitTypeDef RCC_ClkInitStruct;
+	RCC_OscInitTypeDef RCC_OscInitStruct;
 
-    /* Enable Power Control clock */
-    __HAL_RCC_PWR_CLK_ENABLE();
+	/* Enable Power Control clock */
+	__HAL_RCC_PWR_CLK_ENABLE();
 
-    /* The voltage scaling allows optimizing the power consumption when the device is
-     clocked below the maximum system frequency, to update the voltage scaling value 
-     regarding system frequency refer to product datasheet.  */
-    __HAL_PWR_VOLTAGESCALING_CONFIG( PWR_REGULATOR_VOLTAGE_SCALE2 );
+	/* The voltage scaling allows optimizing the power consumption when the device is
+	 clocked below the maximum system frequency, to update the voltage scaling value
+	 regarding system frequency refer to product datasheet.  */
+	__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE2);
 
-    /* Enable HSI Oscillator and activate PLL with HSI as source */
-    RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
-    RCC_OscInitStruct.HSIState = RCC_HSI_ON;
-    RCC_OscInitStruct.HSICalibrationValue = 0x10;
-    RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
-    RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;
-    RCC_OscInitStruct.PLL.PLLM = 16;
-    RCC_OscInitStruct.PLL.PLLN = 320;
-    RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV4;
-    RCC_OscInitStruct.PLL.PLLQ = 4;
-    HAL_RCC_OscConfig( &RCC_OscInitStruct );
+	/* Enable HSI Oscillator and activate PLL with HSI as source */
+	RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
+	RCC_OscInitStruct.HSIState = RCC_HSI_ON;
+	RCC_OscInitStruct.HSICalibrationValue = 0x10;
+	RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
+	RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;
+	RCC_OscInitStruct.PLL.PLLM = 16;
+	RCC_OscInitStruct.PLL.PLLN = 320;
+	RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV4;
+	RCC_OscInitStruct.PLL.PLLQ = 4;
+	HAL_RCC_OscConfig(&RCC_OscInitStruct);
 
-    /* Select PLL as system clock source and configure the HCLK, PCLK1 and PCLK2
-     clocks dividers */
-    RCC_ClkInitStruct.ClockType = (RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK
-        | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2);
-    RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
-    RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
-    RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2;
-    RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
-    HAL_RCC_ClockConfig( &RCC_ClkInitStruct, FLASH_LATENCY_2 );
+	/* Select PLL as system clock source and configure the HCLK, PCLK1 and PCLK2
+	 clocks dividers */
+	RCC_ClkInitStruct.ClockType = (RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK
+			| RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2);
+	RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
+	RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
+	RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2;
+	RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
+	HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2);
 }
 /*	
  RCC_OscInitTypeDef RCC_OscInitStruct;
@@ -707,55 +668,53 @@
  * @param  None
  * @retval None
  */
-void SYSCLKConfig_STOP_HSE(void)
-{
-    RCC_ClkInitTypeDef RCC_ClkInitStruct;
-    RCC_OscInitTypeDef RCC_OscInitStruct;
-    uint32_t pFLatency = 0;
+void SYSCLKConfig_STOP_HSE(void) {
+	RCC_ClkInitTypeDef RCC_ClkInitStruct;
+	RCC_OscInitTypeDef RCC_OscInitStruct;
+	uint32_t pFLatency = 0;
 
-    /* Get the Oscillators configuration according to the internal RCC registers */
-    HAL_RCC_GetOscConfig( &RCC_OscInitStruct );
+	/* Get the Oscillators configuration according to the internal RCC registers */
+	HAL_RCC_GetOscConfig(&RCC_OscInitStruct);
 
-    /* After wake-up from STOP reconfigure the system clock: Enable HSI and PLL */
-    RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
-    RCC_OscInitStruct.HSIState = RCC_HSE_ON;
-    RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
-    HAL_RCC_OscConfig( &RCC_OscInitStruct );
+	/* After wake-up from STOP reconfigure the system clock: Enable HSI and PLL */
+	RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
+	RCC_OscInitStruct.HSIState = RCC_HSE_ON;
+	RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
+	HAL_RCC_OscConfig(&RCC_OscInitStruct);
 
-    /* Get the Clocks configuration according to the internal RCC registers */
-    HAL_RCC_GetClockConfig( &RCC_ClkInitStruct, &pFLatency );
+	/* Get the Clocks configuration according to the internal RCC registers */
+	HAL_RCC_GetClockConfig(&RCC_ClkInitStruct, &pFLatency);
 
-    /* Select PLL as system clock source and configure the HCLK, PCLK1 and PCLK2
-     clocks dividers */
-    RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK;
-    RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
-    HAL_RCC_ClockConfig( &RCC_ClkInitStruct, pFLatency );
+	/* Select PLL as system clock source and configure the HCLK, PCLK1 and PCLK2
+	 clocks dividers */
+	RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK;
+	RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
+	HAL_RCC_ClockConfig(&RCC_ClkInitStruct, pFLatency);
 }
 
-void SYSCLKConfig_STOP_HSI(void)
-{
-    RCC_ClkInitTypeDef RCC_ClkInitStruct;
-    RCC_OscInitTypeDef RCC_OscInitStruct;
-    uint32_t pFLatency = 0;
+void SYSCLKConfig_STOP_HSI(void) {
+	RCC_ClkInitTypeDef RCC_ClkInitStruct;
+	RCC_OscInitTypeDef RCC_OscInitStruct;
+	uint32_t pFLatency = 0;
 
-    /* Get the Oscillators configuration according to the internal RCC registers */
-    HAL_RCC_GetOscConfig( &RCC_OscInitStruct );
+	/* Get the Oscillators configuration according to the internal RCC registers */
+	HAL_RCC_GetOscConfig(&RCC_OscInitStruct);
 
-    /* After wake-up from STOP reconfigure the system clock: Enable HSI and PLL */
-    RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
-    RCC_OscInitStruct.HSIState = RCC_HSI_ON;
-    RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
-    RCC_OscInitStruct.HSICalibrationValue = 0x10;
-    HAL_RCC_OscConfig( &RCC_OscInitStruct );
+	/* After wake-up from STOP reconfigure the system clock: Enable HSI and PLL */
+	RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
+	RCC_OscInitStruct.HSIState = RCC_HSI_ON;
+	RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
+	RCC_OscInitStruct.HSICalibrationValue = 0x10;
+	HAL_RCC_OscConfig(&RCC_OscInitStruct);
 
-    /* Get the Clocks configuration according to the internal RCC registers */
-    HAL_RCC_GetClockConfig( &RCC_ClkInitStruct, &pFLatency );
+	/* Get the Clocks configuration according to the internal RCC registers */
+	HAL_RCC_GetClockConfig(&RCC_ClkInitStruct, &pFLatency);
 
-    /* Select PLL as system clock source and configure the HCLK, PCLK1 and PCLK2
-     clocks dividers */
-    RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK;
-    RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
-    HAL_RCC_ClockConfig( &RCC_ClkInitStruct, pFLatency );
+	/* Select PLL as system clock source and configure the HCLK, PCLK1 and PCLK2
+	 clocks dividers */
+	RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK;
+	RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
+	HAL_RCC_ClockConfig(&RCC_ClkInitStruct, pFLatency);
 }
 
 /**
@@ -763,9 +722,8 @@
  * @param None
  * @retval None
  */
-void HAL_SYSTICK_Callback(void)
-{
-    HAL_IncTick();
+void HAL_SYSTICK_Callback(void) {
+	HAL_IncTick();
 }
 
 /**
@@ -796,66 +754,59 @@
  }
  */
 
-static void GPIO_LED_Init(void)
-{
-    GPIO_InitTypeDef GPIO_InitStructure;
+static void GPIO_LED_Init(void) {
+	GPIO_InitTypeDef GPIO_InitStructure;
 
-    __GPIOC_CLK_ENABLE();
-    GPIO_InitStructure.Pin = GPIO_PIN_3;
-    GPIO_InitStructure.Mode = GPIO_MODE_OUTPUT_PP;
-    GPIO_InitStructure.Pull = GPIO_PULLUP;
-    GPIO_InitStructure.Speed = GPIO_SPEED_FAST;
-    HAL_GPIO_Init( GPIOC, &GPIO_InitStructure );
+	__GPIOC_CLK_ENABLE();
+	GPIO_InitStructure.Pin = GPIO_PIN_3;
+	GPIO_InitStructure.Mode = GPIO_MODE_OUTPUT_PP;
+	GPIO_InitStructure.Pull = GPIO_PULLUP;
+	GPIO_InitStructure.Speed = GPIO_SPEED_FAST;
+	HAL_GPIO_Init( GPIOC, &GPIO_InitStructure);
 }
 
-void GPIO_new_DEBUG_Init(void)
-{
+void GPIO_new_DEBUG_Init(void) {
 #ifdef DEBUG_PIN_ACTIVE
-    GPIO_InitTypeDef GPIO_InitStructure;
+	GPIO_InitTypeDef GPIO_InitStructure;
 
-    __GPIOC_CLK_ENABLE();
-    GPIO_InitStructure.Pin = GPIO_PIN_3;
-    GPIO_InitStructure.Mode = GPIO_MODE_OUTPUT_PP;
-    GPIO_InitStructure.Pull = GPIO_PULLUP;
-    GPIO_InitStructure.Speed = GPIO_SPEED_FAST;
-    HAL_GPIO_Init(GPIOA, &GPIO_InitStructure);
+	__GPIOC_CLK_ENABLE();
+	GPIO_InitStructure.Pin = GPIO_PIN_3;
+	GPIO_InitStructure.Mode = GPIO_MODE_OUTPUT_PP;
+	GPIO_InitStructure.Pull = GPIO_PULLUP;
+	GPIO_InitStructure.Speed = GPIO_SPEED_FAST;
+	HAL_GPIO_Init(GPIOA, &GPIO_InitStructure);
 #endif
 }
 
-void GPIO_new_DEBUG_LOW(void)
-{
+void GPIO_new_DEBUG_LOW(void) {
 #ifdef DEBUG_PIN_ACTIVE
-    HAL_GPIO_WritePin(GPIOC,GPIO_PIN_3,GPIO_PIN_RESET);
+	HAL_GPIO_WritePin(GPIOC,GPIO_PIN_3,GPIO_PIN_RESET);
 #endif
 }
 
-void GPIO_new_DEBUG_HIGH(void)
-{
+void GPIO_new_DEBUG_HIGH(void) {
 #ifdef DEBUG_PIN_ACTIVE
-    HAL_GPIO_WritePin(GPIOC,GPIO_PIN_3,GPIO_PIN_SET);
+	HAL_GPIO_WritePin(GPIOC,GPIO_PIN_3,GPIO_PIN_SET);
 #endif
 }
 
-static void GPIO_Power_MainCPU_Init(void)
-{
-    GPIO_InitTypeDef GPIO_InitStructure;
-    __GPIOC_CLK_ENABLE();
-    GPIO_InitStructure.Pin = GPIO_PIN_0;
-    GPIO_InitStructure.Mode = GPIO_MODE_OUTPUT_PP;
-    GPIO_InitStructure.Pull = GPIO_PULLUP;
-    GPIO_InitStructure.Speed = GPIO_SPEED_LOW;
-    HAL_GPIO_Init( GPIOC, &GPIO_InitStructure );
-    HAL_GPIO_WritePin( GPIOC, GPIO_PIN_0, GPIO_PIN_RESET );
+static void GPIO_Power_MainCPU_Init(void) {
+	GPIO_InitTypeDef GPIO_InitStructure;
+	__GPIOC_CLK_ENABLE();
+	GPIO_InitStructure.Pin = GPIO_PIN_0;
+	GPIO_InitStructure.Mode = GPIO_MODE_OUTPUT_PP;
+	GPIO_InitStructure.Pull = GPIO_PULLUP;
+	GPIO_InitStructure.Speed = GPIO_SPEED_LOW;
+	HAL_GPIO_Init( GPIOC, &GPIO_InitStructure);
+	HAL_GPIO_WritePin( GPIOC, GPIO_PIN_0, GPIO_PIN_RESET);
 }
 
-static void GPIO_Power_MainCPU_ON(void)
-{
-    HAL_GPIO_WritePin( GPIOC, GPIO_PIN_0, GPIO_PIN_RESET );
+static void GPIO_Power_MainCPU_ON(void) {
+	HAL_GPIO_WritePin( GPIOC, GPIO_PIN_0, GPIO_PIN_RESET);
 }
 
-static void GPIO_Power_MainCPU_OFF(void)
-{
-    HAL_GPIO_WritePin( GPIOC, GPIO_PIN_0, GPIO_PIN_SET );
+static void GPIO_Power_MainCPU_OFF(void) {
+	HAL_GPIO_WritePin( GPIOC, GPIO_PIN_0, GPIO_PIN_SET);
 }
 
 /**
@@ -864,111 +815,105 @@
  * @retval None
  */
 
-static void EXTI_Wakeup_Button_Init(void)
-{
-    GPIO_InitTypeDef GPIO_InitStructure;
+static void EXTI_Wakeup_Button_Init(void) {
+	GPIO_InitTypeDef GPIO_InitStructure;
 
-    __HAL_RCC_GPIOA_CLK_ENABLE();
-    BUTTON_OSTC_HAL_RCC_GPIO_CLK_ENABLE();
-    GPIO_InitStructure.Pin = BUTTON_OSTC_GPIO_PIN;
-    GPIO_InitStructure.Mode = GPIO_MODE_IT_FALLING;
-    GPIO_InitStructure.Pull = GPIO_NOPULL;
-    HAL_GPIO_Init( BUTTON_OSTC_GPIO_PORT, &GPIO_InitStructure );
+	__HAL_RCC_GPIOA_CLK_ENABLE();
+	BUTTON_OSTC_HAL_RCC_GPIO_CLK_ENABLE();
+	GPIO_InitStructure.Pin = BUTTON_OSTC_GPIO_PIN;
+	GPIO_InitStructure.Mode = GPIO_MODE_IT_FALLING;
+	GPIO_InitStructure.Pull = GPIO_NOPULL;
+	HAL_GPIO_Init( BUTTON_OSTC_GPIO_PORT, &GPIO_InitStructure);
 
-    HAL_NVIC_SetPriority( BUTTON_OSTC_IRQn, 0x0F, 0 );
-    HAL_NVIC_EnableIRQ( BUTTON_OSTC_IRQn );
+	HAL_NVIC_SetPriority( BUTTON_OSTC_IRQn, 0x0F, 0);
+	HAL_NVIC_EnableIRQ( BUTTON_OSTC_IRQn);
 }
 
-static void EXTI_Wakeup_Button_DeInit(void)
-{
-    GPIO_InitTypeDef GPIO_InitStructure;
+static void EXTI_Wakeup_Button_DeInit(void) {
+	GPIO_InitTypeDef GPIO_InitStructure;
 
-    GPIO_InitStructure.Mode = GPIO_MODE_ANALOG;
-    GPIO_InitStructure.Speed = GPIO_SPEED_LOW;
-    GPIO_InitStructure.Pull = GPIO_NOPULL;
+	GPIO_InitStructure.Mode = GPIO_MODE_ANALOG;
+	GPIO_InitStructure.Speed = GPIO_SPEED_LOW;
+	GPIO_InitStructure.Pull = GPIO_NOPULL;
 
-    GPIO_InitStructure.Pin = BUTTON_OSTC_GPIO_PIN;
-    HAL_GPIO_Init( BUTTON_OSTC_GPIO_PORT, &GPIO_InitStructure );
-    HAL_NVIC_DisableIRQ( BUTTON_OSTC_IRQn );
+	GPIO_InitStructure.Pin = BUTTON_OSTC_GPIO_PIN;
+	HAL_GPIO_Init( BUTTON_OSTC_GPIO_PORT, &GPIO_InitStructure);
+	HAL_NVIC_DisableIRQ( BUTTON_OSTC_IRQn);
 }
 
-static void EXTI_Test_Button_Init(void)
-{
-    GPIO_InitTypeDef GPIO_InitStructure;
+static void EXTI_Test_Button_Init(void) {
+	GPIO_InitTypeDef GPIO_InitStructure;
 
-    BUTTON_TEST_GPIO_CLK_ENABLE();
-    GPIO_InitStructure.Pin = BUTTON_TEST_GPIO_PIN;
-    GPIO_InitStructure.Mode = GPIO_MODE_IT_FALLING;
-    GPIO_InitStructure.Pull = GPIO_PULLUP;
-    HAL_GPIO_Init( BUTTON_TEST_GPIO_PORT, &GPIO_InitStructure );
-    HAL_NVIC_SetPriority( BUTTON_TEST_IRQn, 0x0F, 0 );
-    HAL_NVIC_EnableIRQ( BUTTON_TEST_IRQn );
+	BUTTON_TEST_GPIO_CLK_ENABLE();
+	GPIO_InitStructure.Pin = BUTTON_TEST_GPIO_PIN;
+	GPIO_InitStructure.Mode = GPIO_MODE_IT_FALLING;
+	GPIO_InitStructure.Pull = GPIO_PULLUP;
+	HAL_GPIO_Init( BUTTON_TEST_GPIO_PORT, &GPIO_InitStructure);
+	HAL_NVIC_SetPriority( BUTTON_TEST_IRQn, 0x0F, 0);
+	HAL_NVIC_EnableIRQ( BUTTON_TEST_IRQn);
 }
 
-static void EXTI_Test_Button_DeInit(void)
-{
-    GPIO_InitTypeDef GPIO_InitStructure;
+static void EXTI_Test_Button_DeInit(void) {
+	GPIO_InitTypeDef GPIO_InitStructure;
 
-    GPIO_InitStructure.Mode = GPIO_MODE_ANALOG;
-    GPIO_InitStructure.Speed = GPIO_SPEED_LOW;
-    GPIO_InitStructure.Pull = GPIO_NOPULL;
+	GPIO_InitStructure.Mode = GPIO_MODE_ANALOG;
+	GPIO_InitStructure.Speed = GPIO_SPEED_LOW;
+	GPIO_InitStructure.Pull = GPIO_NOPULL;
 
-    GPIO_InitStructure.Pin = BUTTON_TEST_GPIO_PIN;
-    HAL_GPIO_Init( BUTTON_TEST_GPIO_PORT, &GPIO_InitStructure );
-    HAL_NVIC_DisableIRQ( BUTTON_TEST_IRQn );
+	GPIO_InitStructure.Pin = BUTTON_TEST_GPIO_PIN;
+	HAL_GPIO_Init( BUTTON_TEST_GPIO_PORT, &GPIO_InitStructure);
+	HAL_NVIC_DisableIRQ( BUTTON_TEST_IRQn);
 }
 
-static void MX_EXTI_wireless_Init(void)
-{
-    GPIO_InitTypeDef GPIO_InitStructure;
+static void MX_EXTI_wireless_Init(void) {
+	GPIO_InitTypeDef GPIO_InitStructure;
 
-    WIRELSS_POWER_HAL_RCC_GPIO_CLK_ENABLE();
-    GPIO_InitStructure.Pin = WIRELSS_POWER_GPIO_PIN;
-    GPIO_InitStructure.Mode = GPIO_MODE_OUTPUT_PP;
-    GPIO_InitStructure.Pull = GPIO_NOPULL;
-    HAL_GPIO_Init( WIRELSS_POWER_GPIO_PORT, &GPIO_InitStructure );
-    HAL_GPIO_WritePin( WIRELSS_POWER_GPIO_PORT, WIRELSS_POWER_GPIO_PIN,
-                       GPIO_PIN_SET );
+	WIRELSS_POWER_HAL_RCC_GPIO_CLK_ENABLE();
+	GPIO_InitStructure.Pin = WIRELSS_POWER_GPIO_PIN;
+	GPIO_InitStructure.Mode = GPIO_MODE_OUTPUT_PP;
+	GPIO_InitStructure.Pull = GPIO_NOPULL;
+	HAL_GPIO_Init( WIRELSS_POWER_GPIO_PORT, &GPIO_InitStructure);
+	HAL_GPIO_WritePin( WIRELSS_POWER_GPIO_PORT, WIRELSS_POWER_GPIO_PIN,
+			GPIO_PIN_SET);
 
-    WIRELSS_RISING_HAL_RCC_GPIO_CLK_ENABLE();
-    GPIO_InitStructure.Pin = WIRELSS_RISING_GPIO_PIN;
-    GPIO_InitStructure.Mode = GPIO_MODE_IT_RISING;
-    GPIO_InitStructure.Pull = GPIO_NOPULL;
-    HAL_GPIO_Init( WIRELSS_RISING_GPIO_PORT, &GPIO_InitStructure );
+	WIRELSS_RISING_HAL_RCC_GPIO_CLK_ENABLE();
+	GPIO_InitStructure.Pin = WIRELSS_RISING_GPIO_PIN;
+	GPIO_InitStructure.Mode = GPIO_MODE_IT_RISING;
+	GPIO_InitStructure.Pull = GPIO_NOPULL;
+	HAL_GPIO_Init( WIRELSS_RISING_GPIO_PORT, &GPIO_InitStructure);
 
-    HAL_NVIC_SetPriority( WIRELSS_RISING_IRQn, 0x02, 0 );
-    HAL_NVIC_EnableIRQ( WIRELSS_RISING_IRQn );
+	HAL_NVIC_SetPriority( WIRELSS_RISING_IRQn, 0x02, 0);
+	HAL_NVIC_EnableIRQ( WIRELSS_RISING_IRQn);
 
-    WIRELSS_FALLING_HAL_RCC_GPIO_CLK_ENABLE();
-    GPIO_InitStructure.Pin = WIRELSS_FALLING_GPIO_PIN;
-    GPIO_InitStructure.Mode = GPIO_MODE_IT_FALLING;
-    GPIO_InitStructure.Pull = GPIO_NOPULL;
-    HAL_GPIO_Init( WIRELSS_FALLING_GPIO_PORT, &GPIO_InitStructure );
+	WIRELSS_FALLING_HAL_RCC_GPIO_CLK_ENABLE();
+	GPIO_InitStructure.Pin = WIRELSS_FALLING_GPIO_PIN;
+	GPIO_InitStructure.Mode = GPIO_MODE_IT_FALLING;
+	GPIO_InitStructure.Pull = GPIO_NOPULL;
+	HAL_GPIO_Init( WIRELSS_FALLING_GPIO_PORT, &GPIO_InitStructure);
 
-    HAL_NVIC_SetPriority( WIRELSS_FALLING_IRQn, 0x02, 0 );
-    HAL_NVIC_EnableIRQ( WIRELSS_FALLING_IRQn );
+	HAL_NVIC_SetPriority( WIRELSS_FALLING_IRQn, 0x02, 0);
+	HAL_NVIC_EnableIRQ( WIRELSS_FALLING_IRQn);
 
 }
 
-static void MX_EXTI_wireless_DeInit(void)
-{
-    GPIO_InitTypeDef GPIO_InitStructure;
+static void MX_EXTI_wireless_DeInit(void) {
+	GPIO_InitTypeDef GPIO_InitStructure;
 
-    GPIO_InitStructure.Mode = GPIO_MODE_ANALOG;
-    GPIO_InitStructure.Speed = GPIO_SPEED_LOW;
-    GPIO_InitStructure.Pull = GPIO_NOPULL;
+	GPIO_InitStructure.Mode = GPIO_MODE_ANALOG;
+	GPIO_InitStructure.Speed = GPIO_SPEED_LOW;
+	GPIO_InitStructure.Pull = GPIO_NOPULL;
 
-    GPIO_InitStructure.Pin = WIRELSS_RISING_GPIO_PIN;
-    HAL_GPIO_Init( WIRELSS_RISING_GPIO_PORT, &GPIO_InitStructure );
+	GPIO_InitStructure.Pin = WIRELSS_RISING_GPIO_PIN;
+	HAL_GPIO_Init( WIRELSS_RISING_GPIO_PORT, &GPIO_InitStructure);
 
-    GPIO_InitStructure.Pin = WIRELSS_FALLING_GPIO_PIN;
-    HAL_GPIO_Init( WIRELSS_FALLING_GPIO_PORT, &GPIO_InitStructure );
+	GPIO_InitStructure.Pin = WIRELSS_FALLING_GPIO_PIN;
+	HAL_GPIO_Init( WIRELSS_FALLING_GPIO_PORT, &GPIO_InitStructure);
 
-    GPIO_InitStructure.Pin = WIRELSS_POWER_GPIO_PIN;
-    HAL_GPIO_Init( WIRELSS_POWER_GPIO_PORT, &GPIO_InitStructure );
+	GPIO_InitStructure.Pin = WIRELSS_POWER_GPIO_PIN;
+	HAL_GPIO_Init( WIRELSS_POWER_GPIO_PORT, &GPIO_InitStructure);
 
-    HAL_NVIC_DisableIRQ( WIRELSS_RISING_IRQn );
-    HAL_NVIC_DisableIRQ( WIRELSS_FALLING_IRQn );
+	HAL_NVIC_DisableIRQ( WIRELSS_RISING_IRQn);
+	HAL_NVIC_DisableIRQ( WIRELSS_FALLING_IRQn);
 }
 
 /* NUCLEO C 13
@@ -995,77 +940,75 @@
  }
  */
 
-void HAL_I2C_MasterTxCpltCallback(I2C_HandleTypeDef *I2cHandle)
-{
+void HAL_I2C_MasterTxCpltCallback(I2C_HandleTypeDef *I2cHandle) {
 
 }
 
-void HAL_I2C_MasterRxCpltCallback(I2C_HandleTypeDef *I2cHandle)
-{
+void HAL_I2C_MasterRxCpltCallback(I2C_HandleTypeDef *I2cHandle) {
 
 }
 
-void HAL_I2C_ErrorCallback(I2C_HandleTypeDef *I2cHandle)
-{
+void HAL_I2C_ErrorCallback(I2C_HandleTypeDef *I2cHandle) {
 
 }
 
-void sleep_prepare(void)
-{
-    EXTI_Wakeup_Button_Init();
-    /*
-     GPIO_InitStruct.Pull = GPIO_PULLUP;
-     GPIO_InitStruct.Pin =  GPIO_PIN_0;
-     HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
-     */
-    compass_sleep();
-    HAL_Delay( 100 );
-    accelerator_sleep();
-    HAL_Delay( 100 );
+void sleep_prepare(void) {
+	EXTI_Wakeup_Button_Init();
+	/*
+	 GPIO_InitStruct.Pull = GPIO_PULLUP;
+	 GPIO_InitStruct.Pin =  GPIO_PIN_0;
+	 HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
+	 */
+	compass_sleep();
+	HAL_Delay(100);
+	accelerator_sleep();
+	HAL_Delay(100);
 
-    I2C_DeInit();
-    MX_SPI_DeInit();
-    MX_SPI3_DeInit();
-    ADCx_DeInit();
+	I2C_DeInit();
+	MX_SPI_DeInit();
+	MX_SPI3_DeInit();
+	ADCx_DeInit();
 
-    GPIO_InitTypeDef GPIO_InitStruct;
+	GPIO_InitTypeDef GPIO_InitStruct;
 
-    __HAL_RCC_GPIOA_CLK_ENABLE();
-    __HAL_RCC_GPIOB_CLK_ENABLE();
-    __HAL_RCC_GPIOC_CLK_ENABLE();
-    __HAL_RCC_GPIOH_CLK_ENABLE();
+	__HAL_RCC_GPIOA_CLK_ENABLE();
+	__HAL_RCC_GPIOB_CLK_ENABLE();
+	__HAL_RCC_GPIOC_CLK_ENABLE();
+	__HAL_RCC_GPIOH_CLK_ENABLE();
 
-    GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
-    GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
-    GPIO_InitStruct.Pull = GPIO_NOPULL;
-    GPIO_InitStruct.Pin = GPIO_PIN_All;
-    HAL_GPIO_Init( GPIOH, &GPIO_InitStruct );
+	GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
+	GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
+	GPIO_InitStruct.Pull = GPIO_NOPULL;
+	GPIO_InitStruct.Pin = GPIO_PIN_All;
+	HAL_GPIO_Init( GPIOH, &GPIO_InitStruct);
 #ifdef DEBUGMODE
-    GPIO_InitStruct.Pin = GPIO_PIN_All ^ ( GPIO_PIN_3 | GPIO_PIN_8 | GPIO_PIN_9); /* debug */
+	GPIO_InitStruct.Pin = GPIO_PIN_All ^ ( GPIO_PIN_3 | GPIO_PIN_8 | GPIO_PIN_9); /* debug */
 #endif
-    HAL_GPIO_Init( GPIOB, &GPIO_InitStruct );
+	HAL_GPIO_Init( GPIOB, &GPIO_InitStruct);
 
-    GPIO_InitStruct.Pin = GPIO_PIN_All
-        ^ ( GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_14 | GPIO_PIN_15); /* power off & charger in & charge out & OSC32*/
-    HAL_GPIO_Init( GPIOC, &GPIO_InitStruct );
+	GPIO_InitStruct.Pin =
+			GPIO_PIN_All
+					^ ( GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_14
+							| GPIO_PIN_15); /* power off & charger in & charge out & OSC32*/
+	HAL_GPIO_Init( GPIOC, &GPIO_InitStruct);
 
-    GPIO_InitStruct.Pin = GPIO_PIN_All ^ ( GPIO_PIN_0);
+	GPIO_InitStruct.Pin = GPIO_PIN_All ^ ( GPIO_PIN_0);
 #ifdef DEBUGMODE
-    GPIO_InitStruct.Pin = GPIO_PIN_All ^ ( GPIO_PIN_0 | GPIO_PIN_13 | GPIO_PIN_14); /* wake up button & debug */
+	GPIO_InitStruct.Pin = GPIO_PIN_All ^ ( GPIO_PIN_0 | GPIO_PIN_13 | GPIO_PIN_14); /* wake up button & debug */
 #endif
-    HAL_GPIO_Init( GPIOA, &GPIO_InitStruct );
+	HAL_GPIO_Init( GPIOA, &GPIO_InitStruct);
 
-    GPIO_InitStruct.Pin = GPIO_PIN_All;
-    HAL_GPIO_Init( GPIOH, &GPIO_InitStruct );
+	GPIO_InitStruct.Pin = GPIO_PIN_All;
+	HAL_GPIO_Init( GPIOH, &GPIO_InitStruct);
 
-    GPIO_Power_MainCPU_OFF();
+	GPIO_Power_MainCPU_OFF();
 
 #ifndef DEBUGMODE
-    __HAL_RCC_GPIOB_CLK_DISABLE();
+	__HAL_RCC_GPIOB_CLK_DISABLE();
 #endif
-    __HAL_RCC_GPIOH_CLK_DISABLE();
+	__HAL_RCC_GPIOH_CLK_DISABLE();
 
-    HAL_Delay( 1000 );
+	HAL_Delay(1000);
 }
 
 /*
@@ -1123,20 +1066,38 @@
  */
 void assert_failed(uint8_t* file, uint32_t line)
 {
-    /* User can add his own implementation to report the file name and line number,
-     ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
+	/* User can add his own implementation to report the file name and line number,
+	 ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
 
-    /* Infinite loop */
-    while (1)
-    {
-    }
+	/* Infinite loop */
+	while (1)
+	{
+	}
 }
 #endif
 
 /**
  * @}
  */
+/**
+  * @brief  This function handles SysTick Handler.
+  * @param  None
+  * @retval None
+  */
 
+/*TxRx only here. Every 100 ms.*/
+uint8_t ticks100ms=0;
+void SysTick_Handler(void)
+{
+  HAL_IncTick();
+  if(ticks100ms<100){
+	  ticks100ms++;
+  }else
+  {
+	  ticks100ms=0;
+	  SPI_Start_single_TxRx_with_Master();
+  }
+}
 /**
  * @}
  */
--- a/Small_CPU/Src/compass.c	Thu Jan 03 18:35:11 2019 +0100
+++ b/Small_CPU/Src/compass.c	Thu Jan 03 19:59:36 2019 +0100
@@ -1853,7 +1853,6 @@
     while((ticks) < 60 * 1000)
     {
 				compass_read();
-
 				acceleration_read();
 				compass_calc_roll_pitch_only();
 			
@@ -1873,15 +1872,16 @@
 				}
 
 				copyCompassDataDuringCalibration(compass_DX_f,compass_DY_f,compass_DZ_f);
-        compass_add_calibration(&g);
+				compass_add_calibration(&g);
 				HAL_Delay(1);
 				lasttick = HAL_GetTick();
 				if(lasttick == 0)
 				{
 					 tickstart = -ticks;
 				}	
+				HAL_Delay(1);
 				ticks = lasttick - tickstart;
-		}
+    }
         
     compass_solve_calibration(&g);
 		
--- a/Small_CPU/Src/i2c.c	Thu Jan 03 18:35:11 2019 +0100
+++ b/Small_CPU/Src/i2c.c	Thu Jan 03 19:59:36 2019 +0100
@@ -69,9 +69,9 @@
 {
 	I2cHandle.Instance             = I2Cx;
   I2cHandle.Init.AddressingMode  = I2C_ADDRESSINGMODE_7BIT;
-  I2cHandle.Init.ClockSpeed      = 100000;//400000;
+  I2cHandle.Init.ClockSpeed      = 100000;//400000; REDUCED for compatibility with  HMC5583L + MMA8452Q
   I2cHandle.Init.DualAddressMode = I2C_DUALADDRESS_DISABLED;
-  I2cHandle.Init.DutyCycle       = I2C_DUTYCYCLE_16_9;
+  I2cHandle.Init.DutyCycle       = I2C_DUTYCYCLE_2;
   I2cHandle.Init.GeneralCallMode = I2C_GENERALCALL_DISABLED;
   I2cHandle.Init.NoStretchMode   = I2C_NOSTRETCH_DISABLED;
   I2cHandle.Init.OwnAddress1     = 0x01;
@@ -79,6 +79,10 @@
 	global.dataSendToSlaveStopEval = 1;
 
 	global.I2C_SystemStatus = HAL_I2C_Init(&I2cHandle);
+	HAL_I2CEx_AnalogFilter_Config(&I2cHandle, I2C_ANALOGFILTER_ENABLED);
+	HAL_I2CEx_ConfigDigitalFilter(&I2cHandle,0x0F);
+
+
 
 	global.dataSendToSlaveStopEval = 0;
 	if(global.dataSendToSlavePending)
@@ -116,10 +120,11 @@
 		I2C_Error_count();
 	}
 	global.dataSendToSlaveStopEval = 0;
-	if(global.dataSendToSlavePending)
-	{
-		scheduleSpecial_Evaluate_DataSendToSlave();
-	}
+	//TODO: REMOVE.
+//	if(global.dataSendToSlavePending)
+//	{
+//		scheduleSpecial_Evaluate_DataSendToSlave();
+//	}
 	return (HAL_StatusTypeDef)global.I2C_SystemStatus;
 }
 
@@ -132,17 +137,18 @@
 	
 	global.dataSendToSlaveStopEval = 1;
 
-	global.I2C_SystemStatus = HAL_I2C_Master_Transmit(&I2cHandle, DevAddress,  pData, Size, 100 /*FIXME , 1*/);
+	global.I2C_SystemStatus = HAL_I2C_Master_Transmit(&I2cHandle, DevAddress,  pData, Size,100 /*FIXME , 1*/);
 	if(global.I2C_SystemStatus != HAL_OK)
 	{
 		I2C_Error_count();
 	}
 
 	global.dataSendToSlaveStopEval = 0;
-	if(global.dataSendToSlavePending)
-	{
-		scheduleSpecial_Evaluate_DataSendToSlave();
-	}
+	//TODO: REMOVE.
+//	if(global.dataSendToSlavePending)
+//	{
+//		scheduleSpecial_Evaluate_DataSendToSlave();
+//	}
 	
 	return (HAL_StatusTypeDef)global.I2C_SystemStatus;
 }
@@ -157,17 +163,19 @@
 
 	global.dataSendToSlaveStopEval = 1;
 
-  localHALstatusReturn = HAL_I2C_Master_Receive(&I2cHandle, DevAddress,  pData, Size, 100);
+  localHALstatusReturn = HAL_I2C_Master_Receive(&I2cHandle, DevAddress,  pData, Size, 10);
 	if(localHALstatusReturn != HAL_OK)
 	{
 		I2C_Error_count();
 	}
 
 	global.dataSendToSlaveStopEval = 0;
-	if(global.dataSendToSlavePending)
-	{
-		scheduleSpecial_Evaluate_DataSendToSlave();
-	}
+	//TODO: REMOVE.
+//	if(global.dataSendToSlavePending)
+//	{
+//		scheduleSpecial_Evaluate_DataSendToSlave();
+//	}
+
 	return (HAL_StatusTypeDef)localHALstatusReturn;
 }
 
--- a/Small_CPU/Src/scheduler.c	Thu Jan 03 18:35:11 2019 +0100
+++ b/Small_CPU/Src/scheduler.c	Thu Jan 03 19:59:36 2019 +0100
@@ -110,7 +110,7 @@
 	global.aktualGas[0] = Air;
 	global.lifeData.actualGas = global.aktualGas[0];
 
-	const uint8_t button_standard_sensitivity = ((2400-(  90  *24))/10)+15;
+	const uint8_t button_standard_sensitivity = ((2400-(  40  *24))/10)+15;
 	global.ButtonResponsiveness[0] = button_standard_sensitivity;
 	global.ButtonResponsiveness[1] = button_standard_sensitivity;
 	global.ButtonResponsiveness[2] = button_standard_sensitivity;
@@ -181,9 +181,14 @@
 
 void scheduleSpecial_Evaluate_DataSendToSlave(void)
 {
+	//TEMPORARY fix for compass calibration.
+	//TODO: Fix I2C timeout for complete solving problem.
+	if(global.mode==MODE_CALIB){
+		return;
+	}
+
 	global.dataSendToSlavePending = 0;
-	if(!global.dataSendToSlaveIsValid)
-		return;
+	if(!global.dataSendToSlaveIsValid) return;
 	
 	global.dataSendToMaster.confirmRequest.uw = 0;
 	
@@ -243,8 +248,10 @@
 
 	if(global.dataSendToSlave.setBatteryGaugeNow)
 	{
+		if(global.mode!=MODE_CALIB){
 		global.dataSendToMaster.confirmRequest.ub.batterygauge = 1;
 		battery_gas_gauge_set(global.dataSendToSlave.data.newBatteryGaugePercentageFloat);
+		}
 	}		
 
 	if((global.mode == MODE_SURFACE) && (global.dataSendToSlave.mode == MODE_SHUTDOWN))
@@ -270,6 +277,34 @@
 	deviceDataFlashValid = 0;
 	memcpy(&DeviceDataFlash, &global.dataSendToSlave.data.DeviceData, sizeof(SDevice));
 	deviceDataFlashValid = 1;
+
+
+	//TODO: Temporary placed here. Duration ~210 ms.
+	if (global.I2C_SystemStatus != HAL_OK) {
+		MX_I2C1_TestAndClear();
+		MX_I2C1_Init();
+//		init_pressure();
+//		compass_init(0, 7);
+//		accelerator_init();
+	}
+//Collect and copy sensor data just in one place.
+//TODO: compass_calib_common needs big refactor.
+	compass_read();
+	acceleration_read();
+	compass_calc();
+	pressure_update();
+	copyPressureData();
+	battery_gas_gauge_get_data();
+	copyCompassData();
+//	copyCnsAndOtuData(); //TODO: move here.
+	copyTimeData();
+//	copyBatteryData(); // TODO: move here.
+	copyDeviceData();
+	copyVpmCrushingData();
+//
+	scheduleUpdateDeviceData();
+
+
 }
 
 
@@ -406,16 +441,17 @@
   */
 void schedule_check_resync(void)
 {
-	if((global.check_sync_not_running >= 10) || (global.dataSendToSlaveIsNotValidCount >= 2))
+	//TODO: REMOVE
+	if((global.check_sync_not_running >= 2))
 	{
-		global.dataSendToSlaveIsNotValidCount = 0;
-		global.check_sync_not_running = 0;
-		global.sync_error_count++;
-		MX_SPI_DeInit();
-		HAL_Delay(30); /* could be closer to length of data transmission 23.Feb.2015 hw */
-		MX_DMA_Init();
-		MX_SPI1_Init();
-		SPI_Start_single_TxRx_with_Master();
+//		global.dataSendToSlaveIsNotValidCount = 0;
+//		global.check_sync_not_running = 0;
+//		global.sync_error_count++;
+//		MX_SPI_DeInit();
+//		HAL_Delay(30); /* could be closer to length of data transmission 23.Feb.2015 hw */
+//		MX_DMA_Init();
+//		MX_SPI1_Init();
+//		SPI_Start_single_TxRx_with_Master();
 	}
 }
 
@@ -476,8 +512,8 @@
 		if(ticksdiff >= counterPressure100msec * 100 + 20)
 		{
 				global.check_sync_not_running++;
-				pressure_update();
-				scheduleUpdateDeviceData();
+//				pressure_update();
+//				scheduleUpdateDeviceData();
 				if(global.demo_mode)
 				{
 					turbo_seconds = demo_modify_temperature_and_pressure(global.lifeData.dive_time_seconds, counterPressure100msec, global.ceiling_from_main_CPU_mbar);
@@ -508,18 +544,18 @@
 //					if(global.demo_mode)
 //						global.lifeData.ascent_rate_meter_per_min /= 4;
 				}
-				copyPressureData();
+//				copyPressureData();
 				counterPressure100msec++;
 		}
 			//evaluate compass data at 50 ms, 150 ms, 250 ms,....
-		if(ticksdiff >= counterCompass100msec * 100 + 50)
-		{
-			compass_read();
-			acceleration_read();
-			compass_calc();
-			copyCompassData();
-			counterCompass100msec++;
-		}
+//		if(ticksdiff >= counterCompass100msec * 100 + 50)
+//		{
+//			compass_read();
+//			acceleration_read();
+//			compass_calc();
+//			copyCompassData();
+//			counterCompass100msec++;
+//		}
 		
 		if(ticksdiff >= counterAmbientLight100msec * 100 + 70)
 		{
@@ -686,10 +722,10 @@
 		{
 				global.check_sync_not_running++;
 
-pressure_update();
-scheduleUpdateDeviceData();
+//pressure_update();
+//scheduleUpdateDeviceData();
 global.lifeData.ascent_rate_meter_per_min = 0;
-copyPressureData();
+//copyPressureData();
 
 				if(temperature_carousel > 20.0f)
 				{
@@ -743,7 +779,7 @@
 	while(global.mode == MODE_SURFACE)
 	{
 	    printf("surface...\n");
-
+//	    SPI_Start_single_TxRx_with_Master();
 		schedule_check_resync();
 		lasttick = HAL_GetTick();
 		ticksdiff = time_elapsed_ms(tickstart,lasttick);
@@ -768,26 +804,26 @@
 		if(ticksdiff >= counterPressure100msec * 100 + 20)
 		{
 				global.check_sync_not_running++;
-				pressure_update();
-				scheduleUpdateDeviceData();
+//				pressure_update();
+//				scheduleUpdateDeviceData();
 				global.lifeData.ascent_rate_meter_per_min = 0;
-				copyPressureData();
+//				copyPressureData();
 				counterPressure100msec++;
-				
+
 				if(scheduleCheck_pressure_reached_dive_mode_level())
 					global.mode = MODE_DIVE;
 		}
 		
 		//evaluate compass data at 50 ms, 150 ms, 250 ms,...
 
-		if(ticksdiff >= counterCompass100msec * 100 + 50)
-		{
-			compass_read();
-			acceleration_read();
-			compass_calc();
-			copyCompassData();
-			counterCompass100msec++;
-		}
+//		if(ticksdiff >= counterCompass100msec * 100 + 50)
+//		{
+////			compass_read();
+////			acceleration_read();
+//			compass_calc();
+//			copyCompassData();
+//			counterCompass100msec++;
+//		}
 
 		//evaluate compass data at 70 ms, 170 ms, 270 ms,...
 		if(ticksdiff >= counterAmbientLight100msec * 100 + 70)
@@ -796,7 +832,7 @@
 			copyAmbientLightData();
 			counterAmbientLight100msec++;
 		}
-		//Evaluate tissues, toxic data, etc. once a second 
+		//Evaluate tissues, toxic data, etc. once a second
 		if(ticksdiff >= 1000)
 		{
 			if(clearDecoNow)
@@ -811,11 +847,11 @@
 				vpm_init(&global.vpm, global.conservatism, global.repetitive_dive, global.seconds_since_last_dive);
 				clearDecoNow = 0;
 			}
-	
+
 			//Set back tick counter
 			tickstart = HAL_GetTick();
-			
-			
+
+
 			if(global.seconds_since_last_dive)
 			{
 				schedule_update_timer_helper(-1);
@@ -823,7 +859,7 @@
 //				if(global.seconds_since_last_dive > 777900) // a bit more than nine days [seconds]
 //					global.seconds_since_last_dive = 0;
 			}
-			
+
 			if(global.accidentRemainingSeconds)
 			{
 				global.accidentRemainingSeconds--;
@@ -831,7 +867,7 @@
 					global.accidentFlag = 0;
 			}
 			global.dataSendToMaster.accidentFlags = global.accidentFlag;
-			
+
 			update_surface_pressure(1);
 			scheduleUpdateLifeData(0);
 			decom_oxygen_calculate_otu_degrade(&global.lifeData.otu, global.seconds_since_last_dive);
@@ -839,7 +875,7 @@
 			global.lifeData.desaturation_time_minutes = decom_calc_desaturation_time(global.lifeData.tissue_nitrogen_bar,global.lifeData.tissue_helium_bar,global.lifeData.pressure_surface_bar);
 			battery_charger_get_status_and_contral_battery_gas_gauge(0);
 			battery_gas_gauge_get_data();
-			
+
 			copyCnsAndOtuData();
 			copyTimeData();
 			copyBatteryData();
@@ -855,7 +891,7 @@
 					init_pressure();
 				}
 			}
-			
+
 			counterCompass100msec = 0;
 			counterPressure100msec = 0;
 			counterAmbientLight100msec = 0;
--- a/Small_CPU/Src/spi.c	Thu Jan 03 18:35:11 2019 +0100
+++ b/Small_CPU/Src/spi.c	Thu Jan 03 19:59:36 2019 +0100
@@ -1,23 +1,23 @@
 /**
-  ******************************************************************************
-  * @file    spi.c 
-  * @author  heinrichs weikamp gmbh
-  * @version V0.0.1
-  * @date    16-Sept-2014
-  * @brief   Source code for spi control
-  *           
-  @verbatim                 
-  ============================================================================== 
-                        ##### How to use #####
-  ============================================================================== 
-  @endverbatim
-  ******************************************************************************
-  * @attention
-  *
-  * <h2><center>&copy; COPYRIGHT(c) 2014 heinrichs weikamp</center></h2>
-  *
-  ******************************************************************************
-  */ 
+ ******************************************************************************
+ * @file    spi.c
+ * @author  heinrichs weikamp gmbh
+ * @version V0.0.1
+ * @date    16-Sept-2014
+ * @brief   Source code for spi control
+ *
+ @verbatim
+ ==============================================================================
+ ##### How to use #####
+ ==============================================================================
+ @endverbatim
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>&copy; COPYRIGHT(c) 2014 heinrichs weikamp</center></h2>
+ *
+ ******************************************************************************
+ */
 
 /* Includes ------------------------------------------------------------------*/
 #include "spi.h"
@@ -29,9 +29,8 @@
 extern void GPIO_new_DEBUG_LOW(void);
 extern void GPIO_new_DEBUG_HIGH(void);
 
-
-uint8_t	data_error = 0;
-uint32_t	data_error_time = 0;
+uint8_t data_error = 0;
+uint32_t data_error_time = 0;
 
 static void SPI_Error_Handler(void);
 
@@ -46,193 +45,171 @@
 DMA_HandleTypeDef hdma_rx;
 
 // SPI3 init function
-void MX_SPI3_Init(void)
-{
-  hspi3.Instance 								= SPI3;
-  hspi3.Init.Mode 							= SPI_MODE_MASTER;
-  hspi3.Init.Direction 					= SPI_DIRECTION_2LINES;
-  hspi3.Init.DataSize 					= SPI_DATASIZE_8BIT;
-  hspi3.Init.CLKPolarity 				= SPI_POLARITY_HIGH;
-  hspi3.Init.CLKPhase 					= SPI_PHASE_1EDGE;
-  hspi3.Init.NSS 								= SPI_NSS_SOFT;
-  hspi3.Init.BaudRatePrescaler	= SPI_BAUDRATEPRESCALER_256;
-  hspi3.Init.FirstBit 					= SPI_FIRSTBIT_MSB;
-  hspi3.Init.TIMode 						= SPI_TIMODE_DISABLED;
-  hspi3.Init.CRCCalculation 		= SPI_CRCCALCULATION_DISABLED;
-  hspi3.Init.CRCPolynomial			= 7;
-  HAL_SPI_Init(&hspi3);
+void MX_SPI3_Init(void) {
+	hspi3.Instance = SPI3;
+	hspi3.Init.Mode = SPI_MODE_MASTER;
+	hspi3.Init.Direction = SPI_DIRECTION_2LINES;
+	hspi3.Init.DataSize = SPI_DATASIZE_8BIT;
+	hspi3.Init.CLKPolarity = SPI_POLARITY_HIGH;
+	hspi3.Init.CLKPhase = SPI_PHASE_1EDGE;
+	hspi3.Init.NSS = SPI_NSS_SOFT;
+	hspi3.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_256;
+	hspi3.Init.FirstBit = SPI_FIRSTBIT_MSB;
+	hspi3.Init.TIMode = SPI_TIMODE_DISABLED;
+	hspi3.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLED;
+	hspi3.Init.CRCPolynomial = 7;
+	HAL_SPI_Init(&hspi3);
 }
 
-void MX_SPI3_DeInit(void)
-{
-  HAL_SPI_DeInit(&hspi3);
+void MX_SPI3_DeInit(void) {
+	HAL_SPI_DeInit(&hspi3);
 }
 
-uint8_t SPI3_ButtonAdjust(uint8_t *arrayInput, uint8_t *arrayOutput)
-{
+uint8_t SPI3_ButtonAdjust(uint8_t *arrayInput, uint8_t *arrayOutput) {
 	HAL_StatusTypeDef status;
 	uint8_t answer[10];
 	uint8_t rework[10];
 
 	rework[0] = 0xFF;
-	for(int i = 0; i < 3; i++)
-	{
+	for (int i = 0; i < 3; i++) {
 		// limiter
-		if(arrayInput[i] == 0xFF)
+		if (arrayInput[i] == 0xFF)
 			arrayInput[i] = 0xFE;
-		if(arrayInput[i] >= 15)
-		{
-			// copy - auslöse-schwelle
-			rework[i+1] = arrayInput[i];
+		if (arrayInput[i] >= 15) {
+			// copy - ausl�se-schwelle
+			rework[i + 1] = arrayInput[i];
 			// wieder-scharf-schalte-schwelle
-			rework[i+3+1] = arrayInput[i] - 10;
-		}
-		else
-		if(arrayInput[i] >= 10)
-		{
-			// copy - auslöse-schwelle
-			rework[i+1] = arrayInput[i];
+			rework[i + 3 + 1] = arrayInput[i] - 10;
+		} else if (arrayInput[i] >= 10) {
+			// copy - ausl�se-schwelle
+			rework[i + 1] = arrayInput[i];
 			// wieder-scharf-schalte-schwelle
-			rework[i+3+1] = arrayInput[i] - 5;
-		}
-		else
-		{
-			// copy - auslöse-schwelle
-			rework[i+1] = 7;
+			rework[i + 3 + 1] = arrayInput[i] - 5;
+		} else {
+			// copy - ausl�se-schwelle
+			rework[i + 1] = 7;
 			// wieder-scharf-schalte-schwelle
-			rework[i+3+1] = 6;
+			rework[i + 3 + 1] = 6;
 		}
 	}
 
 	status = HAL_OK; /* = 0 */
-	HAL_GPIO_WritePin(GPIOC, GPIO_PIN_9,GPIO_PIN_SET);
-	for(int i=0;i<7;i++)
-	{
+	HAL_GPIO_WritePin(GPIOC, GPIO_PIN_9, GPIO_PIN_SET);
+	for (int i = 0; i < 7; i++) {
+		HAL_Delay(10);
+		HAL_GPIO_WritePin(GPIOC, GPIO_PIN_9, GPIO_PIN_RESET);
 		HAL_Delay(10);
-		HAL_GPIO_WritePin(GPIOC, GPIO_PIN_9,GPIO_PIN_RESET);
+		status += HAL_SPI_TransmitReceive(&hspi3, &rework[i], &answer[i], 1,
+				20);
 		HAL_Delay(10);
-		status += HAL_SPI_TransmitReceive(&hspi3, &rework[i], &answer[i], 1,20);
-		HAL_Delay(10);
-		HAL_GPIO_WritePin(GPIOC, GPIO_PIN_9,GPIO_PIN_SET);
+		HAL_GPIO_WritePin(GPIOC, GPIO_PIN_9, GPIO_PIN_SET);
 	}
-	
-	if(status == HAL_OK)
-	{
-		for(int i = 0; i < 3; i++)
-		{
-			arrayOutput[i] = answer[i+2]; // first not, return of 0xFF not
-		}	
+
+	if (status == HAL_OK) {
+		for (int i = 0; i < 3; i++) {
+			arrayOutput[i] = answer[i + 2]; // first not, return of 0xFF not
+		}
 		return 1;
-	}
-	else
-		
+	} else
+
 		return 0;
 }
 
-
 // SPI5 init function
-void MX_SPI1_Init(void)
-{
-  hspi1.Instance 								= SPI1;
-  hspi1.Init.Mode 							= SPI_MODE_SLAVE;
-  hspi1.Init.Direction 					= SPI_DIRECTION_2LINES;
-  hspi1.Init.DataSize 					= SPI_DATASIZE_8BIT;
-  hspi1.Init.CLKPolarity 				= SPI_POLARITY_LOW;
-  hspi1.Init.CLKPhase 					= SPI_PHASE_1EDGE;
-  hspi1.Init.NSS 								= SPI_NSS_HARD_INPUT;//SPI_NSS_SOFT;
-  hspi1.Init.BaudRatePrescaler	= SPI_BAUDRATEPRESCALER_128;
-  hspi1.Init.FirstBit 					= SPI_FIRSTBIT_MSB;
-  hspi1.Init.TIMode 						= SPI_TIMODE_DISABLED;
-  hspi1.Init.CRCCalculation 		= SPI_CRCCALCULATION_DISABLED;//_DISABLED; _ENABLED;
-  hspi1.Init.CRCPolynomial			= 7;
-  HAL_SPI_Init(&hspi1);
+void MX_SPI1_Init(void) {
+	hspi1.Instance = SPI1;
+	hspi1.Init.Mode = SPI_MODE_SLAVE;
+	hspi1.Init.Direction = SPI_DIRECTION_2LINES;
+	hspi1.Init.DataSize = SPI_DATASIZE_8BIT;
+	hspi1.Init.CLKPolarity = SPI_POLARITY_LOW;
+	hspi1.Init.CLKPhase = SPI_PHASE_1EDGE;
+	hspi1.Init.NSS = SPI_NSS_HARD_INPUT; //SPI_NSS_SOFT;
+	hspi1.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_8;
+	hspi1.Init.FirstBit = SPI_FIRSTBIT_MSB;
+	hspi1.Init.TIMode = SPI_TIMODE_DISABLED;
+	hspi1.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLED; //_DISABLED; _ENABLED;
+	hspi1.Init.CRCPolynomial = 7;
+	HAL_SPI_Init(&hspi1);
 }
 
-void MX_SPI_DeInit(void)
-{
-  HAL_SPI_DeInit(&hspi1);
+void MX_SPI_DeInit(void) {
+	HAL_SPI_DeInit(&hspi1);
 }
 
+void HAL_SPI_MspInit(SPI_HandleTypeDef* hspi) {
 
-void HAL_SPI_MspInit(SPI_HandleTypeDef* hspi)
-{
-
-  GPIO_InitTypeDef GPIO_InitStruct;
+	GPIO_InitTypeDef GPIO_InitStruct;
 
-  if(hspi->Instance==SPI1)
-  {
-    // Peripheral clock enable
-    __SPI1_CLK_ENABLE();
-    __GPIOA_CLK_ENABLE();
+	if (hspi->Instance == SPI1) {
+		// Peripheral clock enable
+		__SPI1_CLK_ENABLE();
+		__GPIOA_CLK_ENABLE();
 		//SPI1 GPIO Configuration  
 		//PA4   ------> SPI1_CS 
 		//PA5   ------> SPI1_SCK
 		//PA6   ------> SPI1_MISO 
 		//PA7   ------> SPI1_MOSI 
-		
-    GPIO_InitStruct.Pin = GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7;
+
+		GPIO_InitStruct.Pin = GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_6 | GPIO_PIN_7;
 //    GPIO_InitStruct.Pin = GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7;
-    GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
-    GPIO_InitStruct.Pull = GPIO_PULLUP;
-    GPIO_InitStruct.Speed = GPIO_SPEED_MEDIUM;
-    GPIO_InitStruct.Alternate = GPIO_AF5_SPI1;
-    HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
+		GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
+		GPIO_InitStruct.Pull = GPIO_PULLUP;
+		GPIO_InitStruct.Speed = GPIO_SPEED_MEDIUM;
+		GPIO_InitStruct.Alternate = GPIO_AF5_SPI1;
+		HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
 
 		//##-3- Configure the DMA streams ##########################################
 		// Configure the DMA handler for Transmission process 
-		hdma_tx.Instance                 = DMA2_Stream3;
-		hdma_tx.Init.Channel             = DMA_CHANNEL_3;
-		hdma_tx.Init.Direction           = DMA_MEMORY_TO_PERIPH;
-		hdma_tx.Init.PeriphInc           = DMA_PINC_DISABLE;
-		hdma_tx.Init.MemInc              = DMA_MINC_ENABLE;
+		hdma_tx.Instance = DMA2_Stream3;
+		hdma_tx.Init.Channel = DMA_CHANNEL_3;
+		hdma_tx.Init.Direction = DMA_MEMORY_TO_PERIPH;
+		hdma_tx.Init.PeriphInc = DMA_PINC_DISABLE;
+		hdma_tx.Init.MemInc = DMA_MINC_ENABLE;
 		hdma_tx.Init.PeriphDataAlignment = DMA_PDATAALIGN_BYTE;
-		hdma_tx.Init.MemDataAlignment    = DMA_MDATAALIGN_BYTE;
-		hdma_tx.Init.Mode                = DMA_NORMAL;
-		hdma_tx.Init.Priority            = DMA_PRIORITY_LOW;
-		hdma_tx.Init.FIFOMode            = DMA_FIFOMODE_DISABLE;         
-		hdma_tx.Init.FIFOThreshold       = DMA_FIFO_THRESHOLD_FULL;
-		hdma_tx.Init.MemBurst            = DMA_MBURST_INC4;
-		hdma_tx.Init.PeriphBurst         = DMA_PBURST_INC4;
-		
-		HAL_DMA_Init(&hdma_tx);   
-		
+		hdma_tx.Init.MemDataAlignment = DMA_MDATAALIGN_BYTE;
+		hdma_tx.Init.Mode = DMA_NORMAL;
+		hdma_tx.Init.Priority = DMA_PRIORITY_VERY_HIGH;
+		hdma_tx.Init.FIFOMode = DMA_FIFOMODE_DISABLE;
+		hdma_tx.Init.FIFOThreshold = DMA_FIFO_THRESHOLD_FULL;
+		hdma_tx.Init.MemBurst = DMA_MBURST_INC4;
+		hdma_tx.Init.PeriphBurst = DMA_PBURST_INC4;
+
+		HAL_DMA_Init(&hdma_tx);
+
 		// Associate the initialized DMA handle to the the SPI handle
 		__HAL_LINKDMA(hspi, hdmatx, hdma_tx);
-			
+
 		// Configure the DMA handler for Transmission process
-		hdma_rx.Instance                 = DMA2_Stream0;
-		hdma_rx.Init.Channel             = DMA_CHANNEL_3;
-		hdma_rx.Init.Direction           = DMA_PERIPH_TO_MEMORY;
-		hdma_rx.Init.PeriphInc           = DMA_PINC_DISABLE;
-		hdma_rx.Init.MemInc              = DMA_MINC_ENABLE;
+		hdma_rx.Instance = DMA2_Stream0;
+		hdma_rx.Init.Channel = DMA_CHANNEL_3;
+		hdma_rx.Init.Direction = DMA_PERIPH_TO_MEMORY;
+		hdma_rx.Init.PeriphInc = DMA_PINC_DISABLE;
+		hdma_rx.Init.MemInc = DMA_MINC_ENABLE;
 		hdma_rx.Init.PeriphDataAlignment = DMA_PDATAALIGN_BYTE;
-		hdma_rx.Init.MemDataAlignment    = DMA_MDATAALIGN_BYTE;
-		hdma_rx.Init.Mode                = DMA_NORMAL;
-		hdma_rx.Init.Priority            = DMA_PRIORITY_HIGH;
-		hdma_rx.Init.FIFOMode            = DMA_FIFOMODE_DISABLE;         
-		hdma_rx.Init.FIFOThreshold       = DMA_FIFO_THRESHOLD_FULL;
-		hdma_rx.Init.MemBurst            = DMA_MBURST_INC4;
-		hdma_rx.Init.PeriphBurst         = DMA_PBURST_INC4; 
+		hdma_rx.Init.MemDataAlignment = DMA_MDATAALIGN_BYTE;
+		hdma_rx.Init.Mode = DMA_NORMAL;
+		hdma_rx.Init.Priority = DMA_PRIORITY_HIGH;
+		hdma_rx.Init.FIFOMode = DMA_FIFOMODE_DISABLE;
+		hdma_rx.Init.FIFOThreshold = DMA_FIFO_THRESHOLD_FULL;
+		hdma_rx.Init.MemBurst = DMA_MBURST_INC4;
+		hdma_rx.Init.PeriphBurst = DMA_PBURST_INC4;
 
 		HAL_DMA_Init(&hdma_rx);
-    
-  // Associate the initialized DMA handle to the the SPI handle
-  __HAL_LINKDMA(hspi, hdmarx, hdma_rx);
-    
-  //##-4- Configure the NVIC for DMA #########################################
-  //NVIC configuration for DMA transfer complete interrupt (SPI3_RX)
-  HAL_NVIC_SetPriority(DMA2_Stream0_IRQn, 1, 0);   
-  HAL_NVIC_EnableIRQ(DMA2_Stream0_IRQn);
+
+		// Associate the initialized DMA handle to the the SPI handle
+		__HAL_LINKDMA(hspi, hdmarx, hdma_rx);
 
-	// NVIC configuration for DMA transfer complete interrupt (SPI1_TX)
-  HAL_NVIC_SetPriority(DMA2_Stream3_IRQn, 1, 1);
-  HAL_NVIC_EnableIRQ(DMA2_Stream3_IRQn);
-	}
-	else
-  if(hspi->Instance==SPI3)
-  {
-    __GPIOC_CLK_ENABLE();
-    __SPI3_CLK_ENABLE();
+		//##-4- Configure the NVIC for DMA #########################################
+		//NVIC configuration for DMA transfer complete interrupt (SPI3_RX)
+		HAL_NVIC_SetPriority(DMA2_Stream0_IRQn, 1, 0);
+		HAL_NVIC_EnableIRQ(DMA2_Stream0_IRQn);
+
+		// NVIC configuration for DMA transfer complete interrupt (SPI1_TX)
+		HAL_NVIC_SetPriority(DMA2_Stream3_IRQn, 1, 1);
+		HAL_NVIC_EnableIRQ(DMA2_Stream3_IRQn);
+	} else if (hspi->Instance == SPI3) {
+		__GPIOC_CLK_ENABLE();
+		__SPI3_CLK_ENABLE();
 
 		//SPI1 GPIO Configuration  
 		//PC10   ------> SPI3_SCK
@@ -240,27 +217,26 @@
 		//PC12   ------> SPI3_MOSI 
 		//PA15   ------> SPI3_NSS (official)
 		//PC9    ------> SPI3_NSS (hw)
-		
-    GPIO_InitStruct.Pin = GPIO_PIN_10|GPIO_PIN_11|GPIO_PIN_12;
-    GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
-    GPIO_InitStruct.Pull = GPIO_PULLUP;
-    GPIO_InitStruct.Speed = GPIO_SPEED_FAST;
-    GPIO_InitStruct.Alternate = GPIO_AF6_SPI3;
-    HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
+
+		GPIO_InitStruct.Pin = GPIO_PIN_10 | GPIO_PIN_11 | GPIO_PIN_12;
+		GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
+		GPIO_InitStruct.Pull = GPIO_PULLUP;
+		GPIO_InitStruct.Speed = GPIO_SPEED_FAST;
+		GPIO_InitStruct.Alternate = GPIO_AF6_SPI3;
+		HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
 
 		GPIO_InitStruct.Pin = GPIO_PIN_9;
 		GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
 		GPIO_InitStruct.Pull = GPIO_PULLUP;
 		GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
-		HAL_GPIO_Init(GPIOC, &GPIO_InitStruct); 
+		HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
 
-		HAL_GPIO_WritePin(GPIOC, GPIO_PIN_9,GPIO_PIN_SET);
+		HAL_GPIO_WritePin(GPIOC, GPIO_PIN_9, GPIO_PIN_SET);
 	}
 }
 
-void HAL_SPI_MspDeInit(SPI_HandleTypeDef* hspi){
-  if(hspi->Instance==SPI1)
-  {
+void HAL_SPI_MspDeInit(SPI_HandleTypeDef* hspi) {
+	if (hspi->Instance == SPI1) {
 		__SPI1_FORCE_RESET();
 		__SPI1_RELEASE_RESET();
 
@@ -268,18 +244,15 @@
 		//PA5   ------> SPI1_SCK
 		//PA6   ------> SPI1_MISO 
 		//PA7   ------> SPI1_MOSI 
-		
-			HAL_GPIO_DeInit(GPIOA, GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7);
+
+		HAL_GPIO_DeInit(GPIOA, GPIO_PIN_5 | GPIO_PIN_6 | GPIO_PIN_7);
 
 		HAL_DMA_DeInit(&hdma_tx);
 		HAL_DMA_DeInit(&hdma_rx);
-		
+
 		HAL_NVIC_DisableIRQ(DMA2_Stream3_IRQn);
 		HAL_NVIC_DisableIRQ(DMA2_Stream0_IRQn);
-	}
-	else
-  if(hspi->Instance==SPI3)
-  {
+	} else if (hspi->Instance == SPI3) {
 		__SPI3_FORCE_RESET();
 		__SPI3_RELEASE_RESET();
 
@@ -289,143 +262,120 @@
 		//PC12   ------> SPI3_MOSI 
 		//PA15   ------> SPI3_NSS (official)
 		//PC9    ------> SPI3_NSS (hw)
-		HAL_GPIO_DeInit(GPIOC, GPIO_PIN_10|GPIO_PIN_11|GPIO_PIN_12);
+		HAL_GPIO_DeInit(GPIOC, GPIO_PIN_10 | GPIO_PIN_11 | GPIO_PIN_12);
 	}
 }
 
-void SPI_synchronize_with_Master(void)
-{
-  GPIO_InitTypeDef GPIO_InitStruct;
-
-		__GPIOA_CLK_ENABLE();
-	/**SPI1 GPIO Configuration  
-	PA5   ------> SPI1_SCK
-	*/
-	GPIO_InitStruct.Pin = GPIO_PIN_4|GPIO_PIN_5;
-	GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
-	GPIO_InitStruct.Pull = GPIO_PULLUP;
-	GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
-	HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
-
-	HAL_Delay(10);
-	while(HAL_GPIO_ReadPin(GPIOA, GPIO_PIN_4) == 0);
-	HAL_Delay(10);
-	while(HAL_GPIO_ReadPin(GPIOA, GPIO_PIN_5) == 1);
-	HAL_Delay(50);
+void SPI_synchronize_with_Master(void) {
+//	GPIO_InitTypeDef GPIO_InitStruct;
+//
+//	__GPIOA_CLK_ENABLE();
+//	/**SPI1 GPIO Configuration
+//	 PA5   ------> SPI1_SCK
+//	 */
+//	GPIO_InitStruct.Pin = GPIO_PIN_4 | GPIO_PIN_5;
+//	GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
+//	GPIO_InitStruct.Pull = GPIO_PULLUP;
+//	GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
+//	HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
+//
+//	HAL_Delay(10);
+//	while (HAL_GPIO_ReadPin(GPIOA, GPIO_PIN_4) == 0);
+//	HAL_Delay(10);
+//	while (HAL_GPIO_ReadPin(GPIOA, GPIO_PIN_5) == 1);
+//	HAL_Delay(20);
 }
 
-
-void SPI_Start_single_TxRx_with_Master(void)
-{
+void SPI_Start_single_TxRx_with_Master(void) {
 	uint8_t * pOutput;
 
-	if(global.dataSendToSlave.getDeviceDataNow)
-	{
+	if (global.dataSendToSlave.getDeviceDataNow) {
 		global.dataSendToSlave.getDeviceDataNow = 0;
-		pOutput = (uint8_t*)&(global.deviceDataSendToMaster);
-	}
-	else
-	{
-		pOutput = (uint8_t*)&(global.dataSendToMaster);
+		pOutput = (uint8_t*) &(global.deviceDataSendToMaster);
+	} else {
+		pOutput = (uint8_t*) &(global.dataSendToMaster);
 	}
 
-	if(HAL_SPI_TransmitReceive_DMA(&hspi1,pOutput, (uint8_t*)&(global.dataSendToSlave), EXCHANGE_BUFFERSIZE+1) != HAL_OK)
-	{
-		// Transfer error in transmission process 
+	if (HAL_SPI_TransmitReceive_DMA(&hspi1, pOutput,(uint8_t*) &(global.dataSendToSlave), EXCHANGE_BUFFERSIZE)!= HAL_OK) {
+		// Transfer error in transmission process
 		SPI_Error_Handler();
 	}
 }
 
+void HAL_SPI_TxRxCpltCallback(SPI_HandleTypeDef *hspi) {
+	/* restart SPI */
+	if (hspi == &hspi1) {
 
-void HAL_SPI_TxRxCpltCallback(SPI_HandleTypeDef *hspi)
-{
-	global.check_sync_not_running = 0;
-	/* stop data exchange? */
-	if(global.mode == MODE_SHUTDOWN)
-	{
-		global.mode = MODE_SLEEP;
-		global.dataSendToSlavePending = 0;
-		global.dataSendToSlaveIsValid = 1;
-		global.dataSendToSlaveIsNotValidCount = 0;
-		return;
-	}
-	
-	/* data consistent? */
-	if(SPI_check_header_and_footer_ok())
-	{
-		GPIO_new_DEBUG_HIGH();
-		global.dataSendToSlaveIsValid = 1;
-		global.dataSendToSlaveIsNotValidCount = 0;
-	}
-	else
-	{
-		GPIO_new_DEBUG_LOW();
-		global.dataSendToSlaveIsValid = 0;
-		global.dataSendToSlaveIsNotValidCount++;
-	}
-	global.dataSendToMaster.power_on_reset = 0;
-	global.deviceDataSendToMaster.power_on_reset = 0;
-	/* no i2c or other time critical threads? */
-	if(global.dataSendToSlaveIsValid)
-	{
-		if(!global.dataSendToSlaveStopEval)
-		{
-			scheduleSpecial_Evaluate_DataSendToSlave();
+		global.check_sync_not_running = 0;
+		/* stop data exchange? */
+		if (global.mode == MODE_SHUTDOWN) {
+			global.mode = MODE_SLEEP;
+			global.dataSendToSlavePending = 0;
+			global.dataSendToSlaveIsValid = 1;
+			global.dataSendToSlaveIsNotValidCount = 0;
+			return;
 		}
-		else
-		{
-			global.dataSendToSlavePending = 1;
+
+		/* data consistent? */
+		if (SPI_check_header_and_footer_ok()) {
+//		GPIO_new_DEBUG_HIGH(); //For debug.
+			global.dataSendToSlaveIsValid = 1;
+			global.dataSendToSlaveIsNotValidCount = 0;
+		} else {
+//		GPIO_new_DEBUG_LOW(); //For debug.
+			global.dataSendToSlaveIsValid = 0;
+			global.dataSendToSlaveIsNotValidCount++;
+			MX_SPI_DeInit();
+			HAL_Delay(30);
+			MX_DMA_Init();
+			MX_SPI1_Init();
 		}
-	}
-	else
-	{
-		global.dataSendToSlavePending = 0;
-	}
-	
-	/* restart SPI */
-	if(hspi == &hspi1)
-	{
-		if(global.dataSendToSlaveIsValid)
-			SPI_Start_single_TxRx_with_Master();
+		global.dataSendToMaster.power_on_reset = 0;
+		global.deviceDataSendToMaster.power_on_reset = 0;
+
+//TODO:REMOVE
+//		if ( !global.dataSendToSlaveStopEval ) {
+//			scheduleSpecial_Evaluate_DataSendToSlave();
+//		}
+		scheduleSpecial_Evaluate_DataSendToSlave();
+		SPI_Start_single_TxRx_with_Master(); //Send data always.
 	}
 }
 
-
-static uint8_t SPI_check_header_and_footer_ok(void)
-{
-	if(global.dataSendToSlave.header.checkCode[0] != 0xBB)
+static uint8_t SPI_check_header_and_footer_ok(void) {
+	if (global.dataSendToSlave.header.checkCode[0] != 0xBB)
 		return 0;
-	if(global.dataSendToSlave.header.checkCode[1] != 0x01)
+	if (global.dataSendToSlave.header.checkCode[1] != 0x01)
 		return 0;
-	if(global.dataSendToSlave.header.checkCode[2] != 0x01)
+	if (global.dataSendToSlave.header.checkCode[2] != 0x01)
 		return 0;
-	if(global.dataSendToSlave.header.checkCode[3] != 0xBB)
+	if (global.dataSendToSlave.header.checkCode[3] != 0xBB)
 		return 0;
-	if(global.dataSendToSlave.footer.checkCode[0] != 0xF4)
+	if (global.dataSendToSlave.footer.checkCode[0] != 0xF4)
 		return 0;
-	if(global.dataSendToSlave.footer.checkCode[1] != 0xF3)
+	if (global.dataSendToSlave.footer.checkCode[1] != 0xF3)
 		return 0;
-	if(global.dataSendToSlave.footer.checkCode[2] != 0xF2)
+	if (global.dataSendToSlave.footer.checkCode[2] != 0xF2)
 		return 0;
-	if(global.dataSendToSlave.footer.checkCode[3] != 0xF1)
+	if (global.dataSendToSlave.footer.checkCode[3] != 0xF1)
 		return 0;
 
 	return 1;
 }
 
-static void SPI_Error_Handler(void)
-{
-  while(1)
-  {
-  }
+static void SPI_Error_Handler(void) {
+	//The device is locks. Hard to recover.
+//  while(1)
+//  {
+//  }
 }
 
 /**
-  * @}
-  */
+ * @}
+ */
 
 /**
-  * @}
-  */
+ * @}
+ */
 
 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
--- a/Small_CPU/Src/stm32f4xx_it_v3.c	Thu Jan 03 18:35:11 2019 +0100
+++ b/Small_CPU/Src/stm32f4xx_it_v3.c	Thu Jan 03 19:59:36 2019 +0100
@@ -159,10 +159,10 @@
   * @param  None
   * @retval None
   */
-void SysTick_Handler(void)
-{
-  HAL_IncTick();
-}
+//void SysTick_Handler(void)
+//{
+//  HAL_IncTick();
+//}
 
 
 /******************************************************************************/
--- a/ostc4pack/step0_copy_bins.bat	Thu Jan 03 18:35:11 2019 +0100
+++ b/ostc4pack/step0_copy_bins.bat	Thu Jan 03 19:59:36 2019 +0100
@@ -1,3 +1,3 @@
-copy ..\RefPrj\Firmware\Release\OSTC4_Firmware.bin OSTC4_Firmware.bin /V /Y
-copy ..\RefPrj\RTE\Release\OSTC4_RTE.bin OSTC4_RTE.bin /V /Y
+copy D:\Kitt\Coding\AC6-workspace\OSTC4_Firmware\Debug\OSTC4_Firmware.bin OSTC4_Firmware.bin /V /Y
+copy D:\Kitt\Coding\AC6-workspace\OSTC4_RTE\Debug\OSTC4_RTE.bin OSTC4_RTE.bin /V /Y