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