diff Small_CPU/Src/baseCPU2.c @ 332:39f146ccdb1b

Merged in Ideenmodellierer/ostc4/I2C_Improvment (pull request #30) I2C Improvment
author heinrichsweikamp <bitbucket@heinrichsweikamp.com>
date Thu, 18 Jul 2019 14:26:56 +0000
parents da5b91b1e20e
children 143fe85f82a2
line wrap: on
line diff
--- a/Small_CPU/Src/baseCPU2.c	Mon Jul 01 14:18:39 2019 +0000
+++ b/Small_CPU/Src/baseCPU2.c	Thu Jul 18 14:26:56 2019 +0000
@@ -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();