diff 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
line wrap: on
line diff
--- a/Discovery/Src/base.c	Wed Feb 03 21:45:48 2021 +0100
+++ b/Discovery/Src/base.c	Sun Feb 07 22:04:43 2021 +0100
@@ -292,6 +292,7 @@
 uint32_t base_tempLightLevel = 0;
 static uint8_t	wasFirmwareUpdateCheckBattery = 0;
 static uint8_t DoDisplayRefresh = 0;	/* trigger to refresh display data */
+static uint8_t DoHousekeeping = 0;		/* trigger to cleanup the frame buffers */
 
 /* Private function prototypes -----------------------------------------------*/
 static void SystemClock_Config(void);
@@ -497,6 +498,10 @@
 
         deco_loop();
         TriggerButtonAction();
+        if(DoHousekeeping)
+        {
+           	DoHousekeeping = housekeepingFrame();
+        }
         if(DoDisplayRefresh)							/* set every 100ms by timer interrupt */
         {
 	        DoDisplayRefresh = 0;
@@ -509,7 +514,8 @@
             updateMiniLiveLogbook(1);
 
         	RefreshDisplay();
-        	TimeoutControl();								/* exit menus if needed */
+        	DoHousekeeping = 0;							/* make sure frames are not cleared before they are transferred */
+        	TimeoutControl();							/* exit menus if needed */
 
 #ifdef ENABLE_MOTION_CONTROL
         	if((stateUsed->mode == MODE_DIVE) && (settingsGetPointer()->MotionDetection != MOTION_DETECT_OFF))		/* handle motion events in divemode only */
@@ -648,7 +654,7 @@
 	if (GPIO_Pin == VSYNC_IRQ_PIN) // rechts, unten
 	{
 		GFX_change_LTDC();
-		housekeepingFrame();
+		DoHousekeeping = 1;
 		/*
 		 #ifdef DEMOMODE
 		 static uint8_t countCall = 0;