Wait for TFT version on boot sequence

This should be reviewed after https://github.com/esphome/esphome/pull/5673 is released.
This commit is contained in:
Edward Firmo
2023-11-05 20:16:10 +01:00
parent 8184ada7a1
commit 8f128ac6b5
10 changed files with 44 additions and 6 deletions

View File

@@ -2050,6 +2050,8 @@ script:
- lambda: |-
static const char *const TAG = "script.page_changed";
// Go to boot page if not initiated
if (page != "boot" and not nextion_init->state) disp1->goto_page("boot");
// Reset globals
if (page != "climate" &&
page != "cover" &&
@@ -2124,11 +2126,11 @@ script:
static const char *const TAG = "script.page_boot";
if (construct_page) {
ESP_LOGV(TAG, "Construct boot page");
disp1->send_command_printf("tm_esphome.en=0");
disp1->send_command_printf("tm_pageid.en=0");
set_brightness->execute(100);
disp1->set_component_text_printf("boot.esph_version", "%s", "${version}"); // ### esphome-version ###
disp1->show_component("bt_reboot");
if (current_page->state == "boot") {
set_brightness->execute(100);
disp1->set_component_text_printf("esph_version", "%s", "${version}"); // ### esphome-version ###
disp1->show_component("bt_reboot");
}
}
- id: page_buttonpage
@@ -2396,8 +2398,20 @@ script:
- lambda: |-
static const char *const TAG = "script.boot_sequence";
ESP_LOGD(TAG, "Starting boot sequence");
if (current_page->state == "boot") page_boot->execute(true);
ESP_LOGD(TAG, "Wait for TFT version");
- wait_until:
- lambda: !lambda return !id(version_tft).empty();
- lambda: |-
static const char *const TAG = "script.boot_sequence";
ESP_LOGD(TAG, "TFT version: %s", id(version_tft).c_str());
if (current_page->state == "boot") {
disp1->send_command_printf("tm_esphome.en=0");
disp1->send_command_printf("tm_pageid.en=0");
page_boot->execute(true);
}
timer_reset_all->execute("boot");
- lambda: |-
static const char *const TAG = "script.boot_sequence";
ESP_LOGD(TAG, "Wait for API");
- wait_until:
api.connected

Binary file not shown.

Binary file not shown.

View File

@@ -21,6 +21,14 @@ Page boot
dim=0
vis bt_reboot,0
covx baud,baud_rate.txt,0,0
covx display_mode,aux2.txt,0,0
nspanelevent.txt="{\"page\": \"boot\", \"event\": \"pagechanged\", \"version\": \""+tft_version.txt+"\", \"display_mode\": \""+aux2.txt+"\"}"
printh 92
prints "localevent",0
printh 00
prints nspanelevent.txt,0
printh 00
printh FF FF FF
Touch Press Event
printh 91

Binary file not shown.

Binary file not shown.

View File

@@ -21,6 +21,14 @@ Page boot
dim=0
vis bt_reboot,0
covx baud,baud_rate.txt,0,0
covx display_mode,aux2.txt,0,0
nspanelevent.txt="{\"page\": \"boot\", \"event\": \"pagechanged\", \"version\": \""+tft_version.txt+"\", \"display_mode\": \""+aux2.txt+"\"}"
printh 92
prints "localevent",0
printh 00
prints nspanelevent.txt,0
printh 00
printh FF FF FF
Touch Press Event
printh 91

Binary file not shown.

Binary file not shown.

View File

@@ -21,6 +21,14 @@ Page boot
dim=0
vis bt_reboot,0
covx baud,baud_rate.txt,0,0
covx display_mode,aux2.txt,0,0
nspanelevent.txt="{\"page\": \"boot\", \"event\": \"pagechanged\", \"version\": \""+tft_version.txt+"\", \"display_mode\": \""+aux2.txt+"\"}"
printh 92
prints "localevent",0
printh 00
prints nspanelevent.txt,0
printh 00
printh FF FF FF
Touch Press Event
printh 91