comparison Discovery/Src/base.c @ 623:ba83a8ef9bad

Improvment frame Handling: In previous version, especially during fast menu operations, from time to time a flicker (in case of cyclic updated views) or corrupted menus appeared. Possible root cause is a interferance in the chain: refresh display (~100ms) => release frame (in parallel to) provide frame (~45ms) => clear frame (~45ms). to improve the behaviour the clear frame loop is not iterated until all bufferes are cleared (before one buffer every~45ms). getFrame() does now iterate through all frame buffers instead reusing the first possible (to avoid ghoust views and to provide more time to housekeeping function for cleanup)
author Ideenmodellierer
date Sun, 07 Feb 2021 22:04:43 +0100
parents 6826731ff2be
children 028d8f3a9410
comparison
equal deleted inserted replaced
622:8f78faf88fc5 623:ba83a8ef9bad
290 uint8_t bootToBootloader = 0; ///< set in tComm.c to install firmware updates, calls resetToFirmwareUpdate() 290 uint8_t bootToBootloader = 0; ///< set in tComm.c to install firmware updates, calls resetToFirmwareUpdate()
291 static uint8_t returnFromCommCleanUpRequest = 0; ///< use this to exit bluetooth mode and call tComm_exit() 291 static uint8_t returnFromCommCleanUpRequest = 0; ///< use this to exit bluetooth mode and call tComm_exit()
292 uint32_t base_tempLightLevel = 0; 292 uint32_t base_tempLightLevel = 0;
293 static uint8_t wasFirmwareUpdateCheckBattery = 0; 293 static uint8_t wasFirmwareUpdateCheckBattery = 0;
294 static uint8_t DoDisplayRefresh = 0; /* trigger to refresh display data */ 294 static uint8_t DoDisplayRefresh = 0; /* trigger to refresh display data */
295 static uint8_t DoHousekeeping = 0; /* trigger to cleanup the frame buffers */
295 296
296 /* Private function prototypes -----------------------------------------------*/ 297 /* Private function prototypes -----------------------------------------------*/
297 static void SystemClock_Config(void); 298 static void SystemClock_Config(void);
298 static void Error_Handler(void); 299 static void Error_Handler(void);
299 static void SDRAM_Initialization_Sequence(SDRAM_HandleTypeDef *hsdram, FMC_SDRAM_CommandTypeDef *Command); 300 static void SDRAM_Initialization_Sequence(SDRAM_HandleTypeDef *hsdram, FMC_SDRAM_CommandTypeDef *Command);
495 496
496 DataEX_merge_devicedata(); /* data is exchanged at startup and every 10 minutes => check if something changed */ 497 DataEX_merge_devicedata(); /* data is exchanged at startup and every 10 minutes => check if something changed */
497 498
498 deco_loop(); 499 deco_loop();
499 TriggerButtonAction(); 500 TriggerButtonAction();
501 if(DoHousekeeping)
502 {
503 DoHousekeeping = housekeepingFrame();
504 }
500 if(DoDisplayRefresh) /* set every 100ms by timer interrupt */ 505 if(DoDisplayRefresh) /* set every 100ms by timer interrupt */
501 { 506 {
502 DoDisplayRefresh = 0; 507 DoDisplayRefresh = 0;
503 508
504 if(stateUsed == stateSimGetPointer()) 509 if(stateUsed == stateSimGetPointer())
507 } 512 }
508 check_warning(); 513 check_warning();
509 updateMiniLiveLogbook(1); 514 updateMiniLiveLogbook(1);
510 515
511 RefreshDisplay(); 516 RefreshDisplay();
512 TimeoutControl(); /* exit menus if needed */ 517 DoHousekeeping = 0; /* make sure frames are not cleared before they are transferred */
518 TimeoutControl(); /* exit menus if needed */
513 519
514 #ifdef ENABLE_MOTION_CONTROL 520 #ifdef ENABLE_MOTION_CONTROL
515 if((stateUsed->mode == MODE_DIVE) && (settingsGetPointer()->MotionDetection != MOTION_DETECT_OFF)) /* handle motion events in divemode only */ 521 if((stateUsed->mode == MODE_DIVE) && (settingsGetPointer()->MotionDetection != MOTION_DETECT_OFF)) /* handle motion events in divemode only */
516 { 522 {
517 if(get_globalState() != StD) 523 if(get_globalState() != StD)
646 return; 652 return;
647 653
648 if (GPIO_Pin == VSYNC_IRQ_PIN) // rechts, unten 654 if (GPIO_Pin == VSYNC_IRQ_PIN) // rechts, unten
649 { 655 {
650 GFX_change_LTDC(); 656 GFX_change_LTDC();
651 housekeepingFrame(); 657 DoHousekeeping = 1;
652 /* 658 /*
653 #ifdef DEMOMODE 659 #ifdef DEMOMODE
654 static uint8_t countCall = 0; 660 static uint8_t countCall = 0;
655 if(countCall++ < 10) 661 if(countCall++ < 10)
656 return; 662 return;