Use boolean result from Nextion upload
This commit is contained in:
@@ -84,9 +84,9 @@ globals:
|
||||
initial_value: '0'
|
||||
|
||||
- id: tft_upload_result
|
||||
type: esphome::nextion::Nextion::TFTUploadResult
|
||||
type: bool
|
||||
restore_value: false
|
||||
initial_value: 'esphome::nextion::Nextion::TFTUploadResult::UNKNOWN'
|
||||
initial_value: 'false'
|
||||
|
||||
script:
|
||||
- id: !extend dump_config
|
||||
@@ -125,7 +125,7 @@ script:
|
||||
- lambda: |-
|
||||
ESP_LOGD("addon_upload_tft.script.nextion_upload", "Starting TFT upload...");
|
||||
id(tft_upload_result) = disp1->upload_tft(baud_rate, !disp1->is_setup());
|
||||
ESP_LOGD("addon_upload_tft.script.nextion_upload", "TFT upload: %s", esphome::nextion::Nextion::tft_upload_result_to_string(id(tft_upload_result)));
|
||||
ESP_LOGD("addon_upload_tft.script.nextion_upload", "TFT upload: %s", YESNO(id(tft_upload_result)));
|
||||
|
||||
- id: open_upload_dialog
|
||||
mode: restart
|
||||
@@ -394,7 +394,7 @@ script:
|
||||
- lambda: |-
|
||||
char update_msg[128];
|
||||
sprintf(update_msg, "Attempt #%d at %" PRIu32 " bps", id(tft_upload_attempt), tf_uart->get_baud_rate());
|
||||
id(tft_upload_result) = esphome::nextion::Nextion::TFTUploadResult::UNKNOWN;
|
||||
id(tft_upload_result) = false;
|
||||
report_upload_progress->execute(update_msg);
|
||||
- script.wait: report_upload_progress
|
||||
- wait_until:
|
||||
@@ -408,17 +408,12 @@ script:
|
||||
- lambda: |-
|
||||
char update_msg[128];
|
||||
sprintf(update_msg, "Attempt #%d at %" PRIu32 " bps returned: %s", id(tft_upload_attempt),
|
||||
tf_uart->get_baud_rate(), esphome::nextion::Nextion::tft_upload_result_to_string(id(tft_upload_result)));
|
||||
tf_uart->get_baud_rate(), YESNO(id(tft_upload_result)));
|
||||
report_upload_progress->execute(update_msg);
|
||||
- script.wait: report_upload_progress
|
||||
- if:
|
||||
condition:
|
||||
- lambda: |-
|
||||
return
|
||||
id(tft_upload_result) != esphome::nextion::Nextion::TFTUploadResult::UNKNOWN and
|
||||
id(tft_upload_result) != esphome::nextion::Nextion::TFTUploadResult::UPLOAD_IN_PROGRESS and
|
||||
id(tft_upload_result) != esphome::nextion::Nextion::TFTUploadResult::NEXTION_ERROR_PREPARATION_FAILED and
|
||||
id(tft_upload_result) != esphome::nextion::Nextion::TFTUploadResult::NEXTION_ERROR_INVALID_RESPONSE;
|
||||
- lambda: return id(tft_upload_result);
|
||||
then:
|
||||
- delay: 5s
|
||||
- lambda: |-
|
||||
|
||||
@@ -22,23 +22,18 @@ substitutions:
|
||||
|
||||
##### External components #####
|
||||
external_components:
|
||||
- source:
|
||||
# type: local
|
||||
# path: packages/Blackymas/components
|
||||
type: git
|
||||
url: https://github.com/Blackymas/NSPanel_HA_Blueprint
|
||||
ref: v4.3.7
|
||||
- source: components
|
||||
components:
|
||||
- nspanel_ha_blueprint
|
||||
refresh: 300s
|
||||
refresh: 30s
|
||||
- source:
|
||||
type: git
|
||||
url: https://github.com/edwardtfn/esphome
|
||||
ref: nextion-v435
|
||||
ref: nextion-39 #nextion-v435
|
||||
components:
|
||||
- nextion # Change this when that PR#6192 gets released (2024.5?)
|
||||
- psram # Change this when that PR#6526 gets released (2024.5?)
|
||||
refresh: 300s
|
||||
refresh: 30s # To do: 300s
|
||||
- source:
|
||||
type: git
|
||||
url: https://github.com/edwardtfn/esphome
|
||||
|
||||
Reference in New Issue
Block a user