# HG changeset patch
# User ideenmodellierer
# Date 1563396175 -7200
# Node ID da5b91b1e20ec8951c768255b5b9d454377168e6
# Parent  4fe5400567e7aea73d716ec7f1b10df417af29ef
Improved startup robustness
The firmware implements a 30 minute delay for surface pressure values. This array might be corrupted if first pressure communication fails => only init array if initialization was successfull

diff -r 4fe5400567e7 -r da5b91b1e20e Small_CPU/Src/baseCPU2.c
--- a/Small_CPU/Src/baseCPU2.c	Wed Jul 17 22:42:15 2019 +0200
+++ b/Small_CPU/Src/baseCPU2.c	Wed Jul 17 22:42:55 2019 +0200
@@ -302,19 +302,25 @@
 
 /*	printf("CPU2-RTE running...\n"); */
 
+	HAL_Delay(100);
+
 	MX_I2C1_Init();
-	if (global.I2C_SystemStatus != HAL_OK) {
+	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);
 #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 (global.I2C_SystemStatus != HAL_OK)
+	{
 		if (MX_I2C1_TestAndClear() == GPIO_PIN_RESET) {
 			MX_I2C1_TestAndClear(); // do it a second time
 		}
@@ -325,7 +331,11 @@
 
 	global.dataSendToMaster.sensorErrors =
 			global.sensorError[SENSOR_PRESSURE_ID];
-	init_surface_ring();
+
+	if(is_init_pressure_done())
+	{
+		init_surface_ring();
+	}
 	init_battery_gas_gauge();
 	HAL_Delay(10);
 	battery_gas_gauge_get_data();