Mercurial > public > ostc4
comparison Small_CPU/Src/baseCPU2.c @ 473:edfc1a464b42 Improve_Button_Sleep
Do not signal power on reset in case of a "warm" reset:
The RTE signaled at every startup a coldstart to the firmware causing a reset of the button responsitivness to default. Even for example after a firmware update. The reset of the values is a wanted behavior in case a value was set which makes it impossible to operate the buttons. This is still possible by removing the battery => real cold start
author | ideenmodellierer |
---|---|
date | Tue, 12 May 2020 22:39:18 +0200 |
parents | 5b4c78c36b04 |
children | 9eeab3fead8f |
comparison
equal
deleted
inserted
replaced
470:dd0d0952ef35 | 473:edfc1a464b42 |
---|---|
341 init_surface_ring(0); | 341 init_surface_ring(0); |
342 } | 342 } |
343 init_battery_gas_gauge(); | 343 init_battery_gas_gauge(); |
344 HAL_Delay(10); | 344 HAL_Delay(10); |
345 battery_gas_gauge_get_data(); | 345 battery_gas_gauge_get_data(); |
346 if(coldstart != 0xA5) | 346 |
347 MX_SPI3_Init(); | |
348 | |
349 if(coldstart != 0xA5) /* Not reading a 0xA5 means the memory cells has not been initialized before => cold start */ | |
347 { | 350 { |
348 coldstart = 0xA5; | 351 coldstart = 0xA5; |
349 battery_gas_gauge_set(0); | 352 battery_gas_gauge_set(0); |
353 global.dataSendToMaster.power_on_reset = 1; | |
354 global.deviceDataSendToMaster.power_on_reset = 1; | |
355 | |
356 if (!scheduleSetButtonResponsiveness()) | |
357 { | |
358 HAL_Delay(1); | |
359 if (!scheduleSetButtonResponsiveness()) // send again, if problem it's not my problem here. | |
360 { | |
361 HAL_Delay(1); | |
362 scheduleSetButtonResponsiveness(); // init | |
363 HAL_Delay(1); | |
364 } | |
365 } | |
350 } | 366 } |
351 | 367 |
352 global.lifeData.battery_voltage = get_voltage(); | 368 global.lifeData.battery_voltage = get_voltage(); |
353 global.lifeData.battery_charge = get_charge(); | 369 global.lifeData.battery_charge = get_charge(); |
354 copyBatteryData(); | 370 copyBatteryData(); |
355 | |
356 MX_SPI3_Init(); | |
357 if (!scheduleSetButtonResponsiveness()) { | |
358 HAL_Delay(1); | |
359 scheduleSetButtonResponsiveness(); // init | |
360 HAL_Delay(1); | |
361 if (!scheduleSetButtonResponsiveness()) // send again, if problem it's not my problem here. | |
362 { | |
363 HAL_Delay(1); | |
364 scheduleSetButtonResponsiveness(); // init | |
365 HAL_Delay(1); | |
366 } | |
367 } | |
368 | 371 |
369 ADCx_Init(); | 372 ADCx_Init(); |
370 GPIO_Power_MainCPU_Init(); | 373 GPIO_Power_MainCPU_Init(); |
371 global.mode = MODE_POWERUP; | 374 global.mode = MODE_POWERUP; |
372 #else | 375 #else |