main/task_user.c

changeset 36
e2a43e7c4035
parent 34
495b7eafbf5a
child 37
358bbd5b608e
--- a/main/task_user.c	Thu Nov 21 22:19:27 2019 +0100
+++ b/main/task_user.c	Sat Nov 23 19:10:05 2019 +0100
@@ -332,15 +332,11 @@
  */
 void screen_splash()
 {
-//    screen_top("CO2 meter %s", app_desc->version);
+    screen_top("CO2 meter %s", app_desc->version);
 
-//    u8g2_SetFont(&u8g2, u8g2_font_t0_22b_tf);
-//    u8g2_uint_t w = u8g2_GetUTF8Width(&u8g2, "Welkom");
-//    u8g2_DrawUTF8(&u8g2, (128 - w) / 2,50, "Welkom");
-
-u8g2_SetDrawColor(&u8g2, 1);
-u8g2_DrawBox(&u8g2, 0, 0, 128, 64);
-
+    u8g2_SetFont(&u8g2, u8g2_font_t0_22b_tf);
+    u8g2_uint_t w = u8g2_GetUTF8Width(&u8g2, "Welkom");
+    u8g2_DrawUTF8(&u8g2, (128 - w) / 2,50, "Welkom");
     u8g2_SendBuffer(&u8g2);
     u8g2_SetPowerSave(&u8g2, 0); // wake up display
 }
@@ -1006,7 +1002,18 @@
 		idx = Main_Loop2 - ML2_SEL_SENSOR1;
 		if ((SubMenu + SubOffset) < num_sensors) {
 		    ESP_LOGI(TAG, "Select sensor %d %s for unit %d", SubMenu + SubOffset, sensors[SubMenu + SubOffset], idx + 1);
-
+		    if (xSemaphoreTake(xSemaphoreUnits, 25) == pdTRUE) {
+			strcpy(units[idx].temperature_rom_code, sensors[SubMenu + SubOffset]);
+                        write_units();
+                        xSemaphoreGive(xSemaphoreUnits);
+			New_Loop2 = ML2_SETUP_UNIT1 + idx;
+                    	SubMenu = 2;
+                    	SubOffset = 0;
+			if (Main_Loop1 == ML1_DONE)
+                            Main_Loop1 = ML1_INIT;
+                    } else {
+			ESP_LOGE(TAG, "Failed units lock for new romcode");
+		    }
 		} else {
 		    New_Loop2 = ML2_SETUP_UNIT1 + idx;
 		    SubMenu = 2;

mercurial