thermferm/panel.c

changeset 728
da038d0bed04
parent 724
01e3936f62d4
--- a/thermferm/panel.c	Sat May 04 19:10:03 2024 +0200
+++ b/thermferm/panel.c	Sun May 05 15:49:03 2024 +0200
@@ -188,9 +188,11 @@
 	    /*
 	     * Any key is pressed.
 	     */
-	    pthread_mutex_lock(&mutexes[LOCK_LCD]);
-	    setBacklight(1);
-	    pthread_mutex_unlock(&mutexes[LOCK_LCD]);
+	    if (Backlight == 0) {
+	    	pthread_mutex_lock(&mutexes[LOCK_LCD]);
+	    	setBacklight(1);
+	    	pthread_mutex_unlock(&mutexes[LOCK_LCD]);
+	    }
 	    Backlight = LCD_SLEEP;
 	    menutimer = 0;
 	} else {
@@ -214,15 +216,15 @@
 		    Backlight--;
 		}
 
-		pthread_mutex_lock(&mutexes[LOCK_MENU]);
 	    	if (setupmenu != MENU_NONE) {
+		    pthread_mutex_lock(&mutexes[LOCK_MENU]);
 		    if (menutimer < MENU_TIMEOUT)
 			menutimer++;
 		    else {
 			setupmenu = MENU_NONE;
 		    }
+		    pthread_mutex_unlock(&mutexes[LOCK_MENU]);
 		}
-		pthread_mutex_unlock(&mutexes[LOCK_MENU]);
 	    }
 	}
 

mercurial