Mercurial > public > ostc4
diff Discovery/Src/base.c @ 407:b11e50415982 Improment_NVM
Bugfix parallel call of external flash functions:
read / write calls to external flash were performed from main loop as well as from timer callback. As result the update of devicedata (every10 minutes) could colidate with the writing of log samples during dive (if logging takes longer then 100ms (clear page). To avoid this raise condition logging of devicedata has been moved to background loop
author | ideenmodellierer |
---|---|
date | Sun, 12 Jan 2020 18:06:59 +0100 |
parents | eb7696e0510f |
children | b3ab85121e4d |
line wrap: on
line diff
--- a/Discovery/Src/base.c Sun Jan 12 17:57:11 2020 +0100 +++ b/Discovery/Src/base.c Sun Jan 12 18:06:59 2020 +0100 @@ -351,6 +351,7 @@ uint8_t lastsecond = 0xFF; #endif + SStateList status; detectionState_t pitchstate; set_globalState( StBoot0 ); LastButtonPressed = 0; @@ -477,6 +478,16 @@ updateMenu(); ext_flash_write_settings(); } + + /* check if tasks depending on global state are pending */ + get_globalStateList(&status); + if(status.base == BaseHome) + { + tMenuEdit_writeSettingsToFlash(); // takes 900 ms!! + } + + DataEX_merge_devicedata(); /* data is exchanged at startup and every 10 minutes => check if something changed */ + deco_loop(); TriggerButtonAction(); if(DoDisplayRefresh) /* set every 100ms by timer interrupt */ @@ -624,8 +635,6 @@ base_tempLightLevel = TIM_BACKLIGHT_adjust(); tCCR_tick(); tHome_tick(); - if(status.base == BaseHome) - tMenuEdit_writeSettingsToFlash(); // takes 900 ms!! break; case BaseStop: DateEx_copy_to_dataOut();