Mercurial > public > ostc4
diff Small_CPU/Src/baseCPU2.c @ 329:da5b91b1e20e I2C_Improvment
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
author | ideenmodellierer |
---|---|
date | Wed, 17 Jul 2019 22:42:55 +0200 |
parents | d4d8d717e9a7 |
children | 143fe85f82a2 |
line wrap: on
line diff
--- 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();