326 void screen_splash() |
326 void screen_splash() |
327 { |
327 { |
328 screen_top("CO2 meter %s", app_desc->version); |
328 screen_top("CO2 meter %s", app_desc->version); |
329 |
329 |
330 u8g2_SetFont(&u8g2, u8g2_font_t0_22b_tf); |
330 u8g2_SetFont(&u8g2, u8g2_font_t0_22b_tf); |
331 u8g2_uint_t w = u8g2_GetUTF8Width(&u8g2, "START"); |
331 u8g2_uint_t w = u8g2_GetUTF8Width(&u8g2, "Welkom"); |
332 u8g2_DrawUTF8(&u8g2, (128 - w) / 2,50, "START"); |
332 u8g2_DrawUTF8(&u8g2, (128 - w) / 2,50, "Welkom"); |
333 |
333 |
334 u8g2_SendBuffer(&u8g2); |
334 u8g2_SendBuffer(&u8g2); |
335 u8g2_SetPowerSave(&u8g2, 0); // wake up display |
335 u8g2_SetPowerSave(&u8g2, 0); // wake up display |
336 } |
336 } |
337 |
337 |
378 { |
378 { |
379 char buf[65]; |
379 char buf[65]; |
380 |
380 |
381 if (xSemaphoreTake(xSemaphoreUnits, 35) == pdTRUE) { |
381 if (xSemaphoreTake(xSemaphoreUnits, 35) == pdTRUE) { |
382 |
382 |
383 screen_top("Unit %d %s", no + 1, units[no].mode ? "On":"Off"); |
383 screen_top("Meter %d %s", no + 1, units[no].mode ? "Aan":"Uit"); |
384 |
384 |
385 u8g2_SetFont(&u8g2, u8g2_font_t0_22b_tf); |
385 u8g2_SetFont(&u8g2, u8g2_font_t0_22b_tf); |
386 sprintf(buf, "%.1f °C", units[no].temperature / 1000.0); |
386 sprintf(buf, "%.1f °C", units[no].temperature / 1000.0); |
387 u8g2_uint_t w = u8g2_GetUTF8Width(&u8g2, buf); |
387 u8g2_uint_t w = u8g2_GetUTF8Width(&u8g2, buf); |
388 u8g2_DrawUTF8(&u8g2, (128 - w) / 2,40, buf); |
388 u8g2_DrawUTF8(&u8g2, (128 - w) / 2,40, buf); |
405 * @param no The unit index number. |
405 * @param no The unit index number. |
406 * @param sub The submenu index number. |
406 * @param sub The submenu index number. |
407 */ |
407 */ |
408 void screen_unit_zero(int no, int sub) |
408 void screen_unit_zero(int no, int sub) |
409 { |
409 { |
410 screen_top("Unit %d zeroset", no + 1); |
410 screen_top("Meter %d nulpunt", no + 1); |
411 menu_line( 0, 2, 25, "Current %d", units[no].pressure_zero); |
411 menu_line( 0, 2, 25, "Huidig %d", units[no].pressure_zero); |
412 menu_line(sub == 0, 2, 37, "New value %d", units[no].pressure_voltage / (adc_state->Batt_voltage / 1000)); |
412 menu_line(sub == 0, 2, 37, "Nieuw %d", units[no].pressure_voltage / (adc_state->Batt_voltage / 1000)); |
413 menu_line(sub == 1, 2, 49, "Return"); |
413 menu_line(sub == 1, 2, 49, "Terug"); |
414 u8g2_SendBuffer(&u8g2); |
414 u8g2_SendBuffer(&u8g2); |
415 } |
415 } |
416 |
416 |
417 |
417 |
418 |
418 |
421 * @param no The unit index number. |
421 * @param no The unit index number. |
422 * @param sub The submenu index number. |
422 * @param sub The submenu index number. |
423 */ |
423 */ |
424 void screen_unit_setup(int no, int sub) |
424 void screen_unit_setup(int no, int sub) |
425 { |
425 { |
426 screen_top("Unit %d setup", no + 1); |
426 screen_top("Meter %d setup", no + 1); |
427 menu_line(sub == 0, 2, 25, "Mode %s", units[no].mode ? "ON":"OFF"); |
427 menu_line(sub == 0, 2, 25, "Werking %s", units[no].mode ? "Aan":"Uit"); |
428 menu_line(sub == 1, 2, 37, "Zero %d", units[no].pressure_zero); |
428 menu_line(sub == 1, 2, 37, "Nulpunt %d", units[no].pressure_zero); |
429 menu_line(sub == 2, 2, 49, "DS18B20 %s", units[no].temperature_rom_code); |
429 menu_line(sub == 2, 2, 49, "DS18B20 %s", units[no].temperature_rom_code); |
430 menu_line(sub == 3, 2, 61, "Return"); |
430 menu_line(sub == 3, 2, 61, "Terug"); |
431 u8g2_SendBuffer(&u8g2); |
431 u8g2_SendBuffer(&u8g2); |
432 } |
432 } |
433 |
433 |
434 |
434 |
435 |
435 |
441 screen_top("WiFi Status"); |
441 screen_top("WiFi Status"); |
442 snprintf(buf, 65, "SSID %s", wifi_state->STA_ssid); |
442 snprintf(buf, 65, "SSID %s", wifi_state->STA_ssid); |
443 u8g2_DrawStr(&u8g2, 1, 28, buf); |
443 u8g2_DrawStr(&u8g2, 1, 28, buf); |
444 snprintf(buf, 65, "RSSI %d", wifi_state->STA_rssi); |
444 snprintf(buf, 65, "RSSI %d", wifi_state->STA_rssi); |
445 u8g2_DrawStr(&u8g2, 1, 43, buf); |
445 u8g2_DrawStr(&u8g2, 1, 43, buf); |
446 snprintf(buf, 65, "Online %s", wifi_state->STA_online ? "Yes":"No"); |
446 snprintf(buf, 65, "Verbonden %s", wifi_state->STA_online ? "Ja":"Nee"); |
447 u8g2_DrawStr(&u8g2, 1, 59, buf); |
447 u8g2_DrawStr(&u8g2, 1, 59, buf); |
448 u8g2_SendBuffer(&u8g2); |
448 u8g2_SendBuffer(&u8g2); |
449 xSemaphoreGive(xSemaphoreWiFi); |
449 xSemaphoreGive(xSemaphoreWiFi); |
450 } else { |
450 } else { |
451 ESP_LOGE(TAG, "screen_wifi() lock error"); |
451 ESP_LOGE(TAG, "screen_wifi() lock error"); |
467 |
467 |
468 |
468 |
469 void screen_network() |
469 void screen_network() |
470 { |
470 { |
471 if (xSemaphoreTake(xSemaphoreWiFi, 25) == pdTRUE) { |
471 if (xSemaphoreTake(xSemaphoreWiFi, 25) == pdTRUE) { |
472 screen_top("Network Status"); |
472 screen_top("Netwerk Status"); |
473 menu_line(0, 1, 25, "IP %s", wifi_state->STA_ip); |
473 menu_line(0, 1, 25, "IP %s", wifi_state->STA_ip); |
474 menu_line(0, 1, 37, "Mask %s", wifi_state->STA_nm); |
474 menu_line(0, 1, 37, "Mask %s", wifi_state->STA_nm); |
475 menu_line(0, 1, 49, "GW %s", wifi_state->STA_gw); |
475 menu_line(0, 1, 49, "GW %s", wifi_state->STA_gw); |
476 menu_line(0, 1, 61, "Name %s", config.hostname); |
476 menu_line(0, 1, 61, "Naam %s", config.hostname); |
477 u8g2_SendBuffer(&u8g2); |
477 u8g2_SendBuffer(&u8g2); |
478 xSemaphoreGive(xSemaphoreWiFi); |
478 xSemaphoreGive(xSemaphoreWiFi); |
479 } else { |
479 } else { |
480 ESP_LOGE(TAG, "screen_network() lock error"); |
480 ESP_LOGE(TAG, "screen_network() lock error"); |
481 } |
481 } |
483 |
483 |
484 |
484 |
485 |
485 |
486 void screen_network_setup(int sub) |
486 void screen_network_setup(int sub) |
487 { |
487 { |
488 screen_top("Network setup"); |
488 screen_top("Netwerk setup"); |
489 menu_line(sub == 0, 2, 25, "Name %s", config.hostname); |
489 menu_line(sub == 0, 2, 25, "Naam %s", config.hostname); |
490 menu_line(sub == 1, 2, 37, "NTP %s", config.ntp_server); |
490 menu_line(sub == 1, 2, 37, "NTP %s", config.ntp_server); |
491 menu_line(sub == 2, 2, 49, "Return"); |
491 menu_line(sub == 2, 2, 49, "Terug"); |
492 u8g2_SendBuffer(&u8g2); |
492 u8g2_SendBuffer(&u8g2); |
493 } |
493 } |
494 |
494 |
495 |
495 |
496 |
496 |
509 { |
509 { |
510 screen_top("MQTT Setup"); |
510 screen_top("MQTT Setup"); |
511 menu_line(sub == 0, 2, 25, "serv %s", config.mqtt_server); |
511 menu_line(sub == 0, 2, 25, "serv %s", config.mqtt_server); |
512 menu_line(sub == 1, 2, 37, "port %d", config.mqtt_port); |
512 menu_line(sub == 1, 2, 37, "port %d", config.mqtt_port); |
513 menu_line(sub == 2, 2, 49, "user %s", config.mqtt_user); |
513 menu_line(sub == 2, 2, 49, "user %s", config.mqtt_user); |
514 menu_line(sub == 3, 2, 61, "Return"); |
514 menu_line(sub == 3, 2, 61, "Terug"); |
515 u8g2_SendBuffer(&u8g2); |
515 u8g2_SendBuffer(&u8g2); |
516 } |
516 } |
517 |
517 |
518 |
518 |
519 |
519 |
520 void screen_update() |
520 void screen_update() |
521 { |
521 { |
522 screen_top("Update firmware"); |
522 screen_top("Update software"); |
523 menu_line(0, 1, 43, "Push to update"); |
523 menu_line(0, 1, 43, "Druk voor update"); |
524 u8g2_SendBuffer(&u8g2); |
524 u8g2_SendBuffer(&u8g2); |
525 } |
525 } |
526 |
526 |
527 |
527 |
528 |
528 |
529 void screen_updating(char *m1, char *m2) |
529 void screen_updating(char *m1, char *m2) |
530 { |
530 { |
531 screen_top("Updating ..."); |
531 screen_top("Bijwerken ..."); |
532 u8g2_SetFont(&u8g2, u8g2_font_unifont_t_symbols); |
532 u8g2_SetFont(&u8g2, u8g2_font_unifont_t_symbols); |
533 if (m1) { |
533 if (m1) { |
534 u8g2_DrawUTF8(&u8g2,2,30, m1); |
534 u8g2_DrawUTF8(&u8g2,2,30, m1); |
535 } |
535 } |
536 if (m2) { |
536 if (m2) { |
832 New_Loop2 = ML2_SETUP_NETWORK; |
832 New_Loop2 = ML2_SETUP_NETWORK; |
833 break; |
833 break; |
834 |
834 |
835 case ML2_SETUP_NETWORK: |
835 case ML2_SETUP_NETWORK: |
836 if (SubMenu == 0) { |
836 if (SubMenu == 0) { |
837 rotary_editer("Hostname", config.hostname, "", 16, EDIT_TYPE_TEXT); |
837 rotary_editer("Hostnaam", config.hostname, "", 16, EDIT_TYPE_TEXT); |
838 screen_network_setup(SubMenu); |
838 screen_network_setup(SubMenu); |
839 } |
839 } |
840 if (SubMenu == 1) { |
840 if (SubMenu == 1) { |
841 rotary_editer("NTP server", config.ntp_server, "", 16, EDIT_TYPE_TEXT); |
841 rotary_editer("NTP server", config.ntp_server, "", 16, EDIT_TYPE_TEXT); |
842 screen_network_setup(SubMenu); |
842 screen_network_setup(SubMenu); |