comparison 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
comparison
equal deleted inserted replaced
406:439874690f85 407:b11e50415982
349 RTC_TimeTypeDef Stime; 349 RTC_TimeTypeDef Stime;
350 uint8_t measurementindex = 0; 350 uint8_t measurementindex = 0;
351 uint8_t lastsecond = 0xFF; 351 uint8_t lastsecond = 0xFF;
352 #endif 352 #endif
353 353
354 SStateList status;
354 detectionState_t pitchstate; 355 detectionState_t pitchstate;
355 set_globalState( StBoot0 ); 356 set_globalState( StBoot0 );
356 LastButtonPressed = 0; 357 LastButtonPressed = 0;
357 358
358 HAL_Init(); 359 HAL_Init();
475 { 476 {
476 createDiveSettings(); 477 createDiveSettings();
477 updateMenu(); 478 updateMenu();
478 ext_flash_write_settings(); 479 ext_flash_write_settings();
479 } 480 }
481
482 /* check if tasks depending on global state are pending */
483 get_globalStateList(&status);
484 if(status.base == BaseHome)
485 {
486 tMenuEdit_writeSettingsToFlash(); // takes 900 ms!!
487 }
488
489 DataEX_merge_devicedata(); /* data is exchanged at startup and every 10 minutes => check if something changed */
490
480 deco_loop(); 491 deco_loop();
481 TriggerButtonAction(); 492 TriggerButtonAction();
482 if(DoDisplayRefresh) /* set every 100ms by timer interrupt */ 493 if(DoDisplayRefresh) /* set every 100ms by timer interrupt */
483 { 494 {
484 DoDisplayRefresh = 0; 495 DoDisplayRefresh = 0;
622 updateMiniLiveLogbook(1); 633 updateMiniLiveLogbook(1);
623 timer_UpdateSecond(1); 634 timer_UpdateSecond(1);
624 base_tempLightLevel = TIM_BACKLIGHT_adjust(); 635 base_tempLightLevel = TIM_BACKLIGHT_adjust();
625 tCCR_tick(); 636 tCCR_tick();
626 tHome_tick(); 637 tHome_tick();
627 if(status.base == BaseHome)
628 tMenuEdit_writeSettingsToFlash(); // takes 900 ms!!
629 break; 638 break;
630 case BaseStop: 639 case BaseStop:
631 DateEx_copy_to_dataOut(); 640 DateEx_copy_to_dataOut();
632 DataEX_call(); 641 DataEX_call();
633 DataEX_control_connection_while_asking_for_sleep(); 642 DataEX_control_connection_while_asking_for_sleep();