In the main screen dim the not active units.

Tue, 26 Nov 2019 11:20:41 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Tue, 26 Nov 2019 11:20:41 +0100
changeset 42
22a0f9810561
parent 41
d327e0aff62f
child 43
70c99c2084dc

In the main screen dim the not active units.

main/task_user.c file | annotate | diff | comparison | revisions
--- a/main/task_user.c	Mon Nov 25 11:34:38 2019 +0100
+++ b/main/task_user.c	Tue Nov 26 11:20:41 2019 +0100
@@ -341,13 +341,14 @@
 void screen_main()
 {
     char	buf[65];
-    int		i;
+    int		i, mode[3];
     uint32_t	temperature = 0, pressure[3];
 
     if (xSemaphoreTake(xSemaphoreUnits, 25) == pdTRUE) {
 	temperature = units[0].temperature;
 	for (i = 0; i < 3; i++) {
 	    pressure[i] = units[i].pressure;
+	    mode[i] = units[i].mode;
 	}
 	xSemaphoreGive(xSemaphoreUnits);
     } else {
@@ -359,9 +360,12 @@
     sprintf(buf, "%.1f °C", temperature / 1000.0);
     u8g2_uint_t w = u8g2_GetUTF8Width(&u8g2, buf);
     u8g2_DrawUTF8(&u8g2, (128 - w) / 2,40, buf);
-    u8g2_SetFont(&u8g2, u8g2_font_t0_18b_tf);
 
     for (i = 0; i < 3; i++) {
+	if (mode[i])
+	    u8g2_SetFont(&u8g2, u8g2_font_t0_18b_tf);
+	else
+	    u8g2_SetFont(&u8g2, u8g2_font_t0_18_tf);
 	sprintf(buf, "%.1f", pressure[i] / 1000.0);
 	w = u8g2_GetUTF8Width(&u8g2, buf);
 	u8g2_DrawUTF8(&u8g2, ((42 - w) / 2) + i * 43,63, buf);

mercurial