Bump min ESPHome to 2023.12.0b1
To take advantage of Nextion component improvements.
This commit is contained in:
@@ -19,20 +19,22 @@ substitutions:
|
|||||||
upload_tft_chunk_size_max: "32768"
|
upload_tft_chunk_size_max: "32768"
|
||||||
#############################
|
#############################
|
||||||
|
|
||||||
external_components:
|
#external_components:
|
||||||
- source: github://pr#3256 # adds esp-idf support to http_request
|
# - source: github://pr#3256 # adds esp-idf support to http_request
|
||||||
components:
|
# components:
|
||||||
- http_request
|
# - http_request
|
||||||
# - source: github://pr#5484 # adds exit reparse to Nextion library
|
# - source: github://pr#5910
|
||||||
# components:
|
# components:
|
||||||
# - nextion
|
# - nextion
|
||||||
|
# - uart
|
||||||
|
# refresh: 1s
|
||||||
|
|
||||||
##### HTTP REQUEST #####
|
##### HTTP REQUEST #####
|
||||||
# Enables http client #
|
# Enables http client #
|
||||||
# for upload_tft. #
|
# for upload_tft. #
|
||||||
########################
|
########################
|
||||||
http_request:
|
#http_request:
|
||||||
id: httpclient
|
# id: httpclient
|
||||||
|
|
||||||
api:
|
api:
|
||||||
services:
|
services:
|
||||||
@@ -72,12 +74,12 @@ button:
|
|||||||
ESP_LOGD(TAG, "Update TFT display button pressed");
|
ESP_LOGD(TAG, "Update TFT display button pressed");
|
||||||
upload_tft->execute(tft_list->state.c_str());
|
upload_tft->execute(tft_list->state.c_str());
|
||||||
|
|
||||||
#display:
|
display:
|
||||||
# - id: !extend disp1
|
- id: !extend disp1
|
||||||
# tft_url: ${nextion_update_url}
|
tft_url: ${nextion_update_url}
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- id: upload_tft_new #NOT IN USE FOR NOW
|
- id: upload_tft_nextion #NOT IN USE FOR NOW
|
||||||
mode: single
|
mode: single
|
||||||
parameters:
|
parameters:
|
||||||
url: string
|
url: string
|
||||||
@@ -85,8 +87,7 @@ script:
|
|||||||
- lambda: |-
|
- lambda: |-
|
||||||
static const char *const TAG = "script.upload_tft_new";
|
static const char *const TAG = "script.upload_tft_new";
|
||||||
ESP_LOGVV(TAG, "Starting...");
|
ESP_LOGVV(TAG, "Starting...");
|
||||||
|
nextion_status->execute();
|
||||||
nextion_init->state = false;
|
|
||||||
|
|
||||||
auto delay_seconds_ = [](int seconds) {
|
auto delay_seconds_ = [](int seconds) {
|
||||||
ESP_LOGD(TAG, "Wait %i seconds", seconds);
|
ESP_LOGD(TAG, "Wait %i seconds", seconds);
|
||||||
@@ -100,38 +101,109 @@ script:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ESP_LOGV(TAG, "Setting TFT url: %s", url.c_str());
|
std::string framework = "Unknown";
|
||||||
//disp1->set_tft_url(url.c_str());
|
#ifdef ARDUINO
|
||||||
unsigned int upload_tries = 0;
|
framework = "Arduino";
|
||||||
while (upload_tries < 3) {
|
#elif defined(ESP_PLATFORM)
|
||||||
upload_tries++;
|
framework = "ESP-IDF";
|
||||||
ESP_LOGD(TAG, "Try #%i", upload_tries);
|
#endif
|
||||||
|
|
||||||
|
if (disp1->is_setup()) {
|
||||||
|
disp1->set_backlight_brightness(1);
|
||||||
|
disp1->set_component_text_printf("confirm.title", "Upload TFT\\r%s", framework.c_str());
|
||||||
|
disp1->set_component_text_printf("confirm.body", "Preparing...");
|
||||||
|
disp1->goto_page("confirm");
|
||||||
|
disp1->hide_component("bt_close");
|
||||||
|
disp1->hide_component("bt_accept");
|
||||||
|
disp1->hide_component("bt_clear");
|
||||||
|
disp1->hide_component("bt_close");
|
||||||
|
App.feed_wdt();
|
||||||
|
delay_seconds_(1);
|
||||||
|
display_wrapped_text->execute("confirm.body", "Informing the blueprint that panel is unavailable...", 18);
|
||||||
|
disp1->hide_component("bt_close");
|
||||||
|
App.feed_wdt();
|
||||||
|
}
|
||||||
|
nextion_init->publish_state(false);
|
||||||
|
App.feed_wdt();
|
||||||
|
if (disp1->is_setup()) {
|
||||||
|
delay_seconds_(1);
|
||||||
|
display_wrapped_text->execute("confirm.body", "Stopping scripts...", 18);
|
||||||
|
App.feed_wdt();
|
||||||
|
}
|
||||||
|
stop_all->execute();
|
||||||
|
if (disp1->is_setup()) delay_seconds_(1);
|
||||||
|
App.feed_wdt();
|
||||||
|
|
||||||
|
ESP_LOGD(TAG, "Try #1 at 921600 bps");
|
||||||
nextion_status->execute();
|
nextion_status->execute();
|
||||||
if (!disp1->is_setup()) {
|
if (disp1->is_setup()) {
|
||||||
ESP_LOGD(TAG, "Setting Nextion protocol reparse mode to passive");
|
display_wrapped_text->execute("confirm.body", "Try #1 at 921600 bps", 18);
|
||||||
exit_reparse->execute();
|
App.feed_wdt();
|
||||||
|
delay_seconds_(1);
|
||||||
|
}
|
||||||
|
//if (disp1->upload_tft(921600)) id(restart_nspanel).press();
|
||||||
|
ESP_LOGW(TAG, "Try #1 failed");
|
||||||
|
if (disp1->is_setup()) display_wrapped_text->execute("confirm.body", "Try #1 failed", 18);
|
||||||
|
App.feed_wdt();
|
||||||
delay_seconds_(5);
|
delay_seconds_(5);
|
||||||
}
|
ESP_LOGD(TAG, "Try #2 at 921600 bps");
|
||||||
ESP_LOGV(TAG, "Calling upload from Nextion component");
|
nextion_status->execute();
|
||||||
//if (disp1->upload_tft()) id(restart_nspanel).press();
|
App.feed_wdt();
|
||||||
ESP_LOGD(TAG, "Turn off Nextion");
|
if (disp1->is_setup()) display_wrapped_text->execute("confirm.body", "Try #2 at 921600 bps", 18);
|
||||||
screen_power->turn_off();
|
//if (disp1->upload_tft(921600)) id(restart_nspanel).press();
|
||||||
|
ESP_LOGW(TAG, "Try #2 failed");
|
||||||
|
if (disp1->is_setup()) display_wrapped_text->execute("confirm.body", "Try #2 failed", 18);
|
||||||
|
App.feed_wdt();
|
||||||
|
delay_seconds_(5);
|
||||||
|
ESP_LOGD(TAG, "Try #3 at 115200 bps");
|
||||||
|
nextion_status->execute();
|
||||||
|
App.feed_wdt();
|
||||||
|
if (disp1->is_setup()) display_wrapped_text->execute("confirm.body", "Try #3 at 115200 bps", 18);
|
||||||
|
//if (disp1->upload_tft(115200)) id(restart_nspanel).press();
|
||||||
|
ESP_LOGW(TAG, "Try #3 failed");
|
||||||
|
App.feed_wdt();
|
||||||
|
if (disp1->is_setup()) {
|
||||||
|
display_wrapped_text->execute("confirm.body", "Try #3 failed. Restarting display.", 18);
|
||||||
|
App.feed_wdt();
|
||||||
delay_seconds_(3);
|
delay_seconds_(3);
|
||||||
ESP_LOGD(TAG, "Turn on Nextion");
|
|
||||||
screen_power->turn_on();
|
|
||||||
delay_seconds_(10);
|
|
||||||
}
|
}
|
||||||
ESP_LOGE(TAG, "TFT upload failed.");
|
|
||||||
ESP_LOGD(TAG, "Turn off Nextion");
|
ESP_LOGD(TAG, "Turn off Nextion");
|
||||||
screen_power->turn_off();
|
id(screen_power).turn_off();
|
||||||
delay_seconds_(2);
|
delay_seconds_(2);
|
||||||
ESP_LOGD(TAG, "Turn on Nextion");
|
ESP_LOGD(TAG, "Turn on Nextion");
|
||||||
screen_power->turn_on();
|
id(screen_power).turn_on();
|
||||||
ESP_LOGD(TAG, "Restarting esphome");
|
delay_seconds_(10);
|
||||||
|
App.feed_wdt();
|
||||||
|
ESP_LOGD(TAG, "Try #4 at 115200 bps");
|
||||||
|
nextion_status->execute();
|
||||||
|
if (disp1->is_setup()) {
|
||||||
|
disp1->set_backlight_brightness(1);
|
||||||
|
disp1->set_component_text_printf("confirm.title", "Upload TFT\\r%s", framework.c_str());
|
||||||
|
display_wrapped_text->execute("confirm.body", "Try #4 at 115200 bps", 18);
|
||||||
|
disp1->goto_page("confirm");
|
||||||
|
disp1->hide_component("bt_close");
|
||||||
|
disp1->hide_component("bt_accept");
|
||||||
|
disp1->hide_component("bt_clear");
|
||||||
|
disp1->hide_component("bt_close");
|
||||||
|
App.feed_wdt();
|
||||||
delay_seconds_(1);
|
delay_seconds_(1);
|
||||||
restart_nspanel->press();
|
}
|
||||||
nextion_init->state = true;
|
//if (disp1->upload_tft(115200)) id(restart_nspanel).press();
|
||||||
ESP_LOGV(TAG, "Finished!");
|
ESP_LOGE(TAG, "TFT upload failed");
|
||||||
|
if (disp1->is_setup()) display_wrapped_text->execute("confirm.body", "TFT upload failed", 18);
|
||||||
|
if (disp1->is_setup()) delay_seconds_(2);
|
||||||
|
ESP_LOGD(TAG, "Turn off Nextion");
|
||||||
|
if (disp1->is_setup()) display_wrapped_text->execute("confirm.body", "Restarting...", 18);
|
||||||
|
if (disp1->is_setup()) delay_seconds_(2);
|
||||||
|
id(screen_power).turn_off();
|
||||||
|
delay_seconds_(2);
|
||||||
|
ESP_LOGD(TAG, "Turn on Nextion");
|
||||||
|
id(screen_power).turn_on();
|
||||||
|
ESP_LOGD(TAG, "Restarting ESPHome");
|
||||||
|
delay_seconds_(2);
|
||||||
|
id(restart_nspanel).press();
|
||||||
|
|
||||||
|
ESP_LOGD(TAG, "Finished!");
|
||||||
|
|
||||||
- id: upload_tft
|
- id: upload_tft
|
||||||
mode: single
|
mode: single
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ substitutions:
|
|||||||
##### ESPHOME CONFIGURATION #####
|
##### ESPHOME CONFIGURATION #####
|
||||||
esphome:
|
esphome:
|
||||||
name: ${device_name}
|
name: ${device_name}
|
||||||
min_version: 2023.11.0
|
min_version: 2023.12.0b1
|
||||||
platformio_options:
|
platformio_options:
|
||||||
build_flags:
|
build_flags:
|
||||||
- -Wno-missing-field-initializers
|
- -Wno-missing-field-initializers
|
||||||
|
|||||||
Reference in New Issue
Block a user