Update nspanel_esphome_addon_upload_tft.yaml
Use target speed only when setup
This commit is contained in:
@@ -111,8 +111,8 @@ script:
|
|||||||
ESP_LOGD(TAG, "Waiting for empty UART and Nextion queues");
|
ESP_LOGD(TAG, "Waiting for empty UART and Nextion queues");
|
||||||
- wait_until:
|
- wait_until:
|
||||||
condition:
|
condition:
|
||||||
- lambda: !lambda return (disp1->queue_size() < 1);
|
- lambda: return (disp1->queue_size() < 1);
|
||||||
- lambda: !lambda return (tf_uart->available() < 1);
|
- lambda: return (tf_uart->available() < 1);
|
||||||
timeout: 10s
|
timeout: 10s
|
||||||
- delay: 2s
|
- delay: 2s
|
||||||
- lambda: |-
|
- lambda: |-
|
||||||
@@ -269,7 +269,7 @@ script:
|
|||||||
- lambda: page_id->update();
|
- lambda: page_id->update();
|
||||||
- wait_until:
|
- wait_until:
|
||||||
condition:
|
condition:
|
||||||
- lambda: !lambda return (page_id->state == 26);
|
- lambda: return (page_id->state == 26);
|
||||||
timeout: 2s
|
timeout: 2s
|
||||||
- script.execute:
|
- script.execute:
|
||||||
id: report_upload_progress
|
id: report_upload_progress
|
||||||
@@ -286,20 +286,24 @@ script:
|
|||||||
- script.wait: stop_all
|
- script.wait: stop_all
|
||||||
- wait_until:
|
- wait_until:
|
||||||
condition:
|
condition:
|
||||||
- lambda: !lambda return (!id(tft_is_valid));
|
- lambda: return (!id(tft_is_valid));
|
||||||
timeout: 1s
|
timeout: 1s
|
||||||
|
|
||||||
### Attempt twice at the target baud rate
|
### Attempt twice at the target baud rate
|
||||||
- script.execute:
|
- if:
|
||||||
id: upload_tft_sequence_attempt
|
condition:
|
||||||
baud_rate: !lambda return id(baud_rate_target);
|
- lambda: return disp1->is_setup();
|
||||||
- script.wait: upload_tft_sequence_attempt
|
then:
|
||||||
|
- script.execute:
|
||||||
|
id: upload_tft_sequence_attempt
|
||||||
|
baud_rate: !lambda return id(baud_rate_target);
|
||||||
|
- script.wait: upload_tft_sequence_attempt
|
||||||
|
|
||||||
### Attempt twice at the original baud rate
|
### Attempt twice at the original baud rate
|
||||||
- if:
|
- if:
|
||||||
condition:
|
condition:
|
||||||
- lambda: |-
|
- lambda: |-
|
||||||
return (id(baud_rate_original) != id(baud_rate_target));
|
return ((id(baud_rate_original) != id(baud_rate_target)) or (!disp1->is_setup()));
|
||||||
then:
|
then:
|
||||||
- script.execute:
|
- script.execute:
|
||||||
id: upload_tft_sequence_attempt
|
id: upload_tft_sequence_attempt
|
||||||
@@ -324,7 +328,7 @@ script:
|
|||||||
- script.wait: report_upload_progress
|
- script.wait: report_upload_progress
|
||||||
- wait_until:
|
- wait_until:
|
||||||
condition:
|
condition:
|
||||||
- lambda: !lambda return (!id(tft_is_valid));
|
- lambda: return (!id(tft_is_valid));
|
||||||
timeout: 3s
|
timeout: 3s
|
||||||
- switch.turn_off: screen_power
|
- switch.turn_off: screen_power
|
||||||
- delay: 2s
|
- delay: 2s
|
||||||
@@ -342,7 +346,7 @@ script:
|
|||||||
- script.wait: report_upload_progress
|
- script.wait: report_upload_progress
|
||||||
- wait_until:
|
- wait_until:
|
||||||
condition:
|
condition:
|
||||||
- lambda: !lambda return (!id(tft_is_valid));
|
- lambda: return (!id(tft_is_valid));
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
- script.execute:
|
- script.execute:
|
||||||
id: report_upload_progress
|
id: report_upload_progress
|
||||||
@@ -350,12 +354,12 @@ script:
|
|||||||
- script.wait: report_upload_progress
|
- script.wait: report_upload_progress
|
||||||
- wait_until:
|
- wait_until:
|
||||||
condition:
|
condition:
|
||||||
- lambda: !lambda return (!id(tft_is_valid));
|
- lambda: return (!id(tft_is_valid));
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
- switch.turn_off: screen_power
|
- switch.turn_off: screen_power
|
||||||
- delay: 2s
|
- delay: 2s
|
||||||
# Restart ESPHome
|
# Restart ESPHome
|
||||||
- lambda: !lambda App.safe_reboot();
|
- lambda: App.safe_reboot();
|
||||||
|
|
||||||
### This code should never run
|
### This code should never run
|
||||||
- delay: 2s
|
- delay: 2s
|
||||||
@@ -395,7 +399,7 @@ script:
|
|||||||
mode: single
|
mode: single
|
||||||
then:
|
then:
|
||||||
- logger.log: "Attempting to upload TFT"
|
- logger.log: "Attempting to upload TFT"
|
||||||
- lambda: !lambda id(tft_upload_attempt)++;
|
- lambda: id(tft_upload_attempt)++;
|
||||||
- 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());
|
||||||
@@ -404,7 +408,7 @@ script:
|
|||||||
- script.wait: report_upload_progress
|
- script.wait: report_upload_progress
|
||||||
- wait_until:
|
- wait_until:
|
||||||
condition:
|
condition:
|
||||||
- lambda: !lambda return (!id(tft_is_valid));
|
- lambda: return (!id(tft_is_valid));
|
||||||
timeout: 1s
|
timeout: 1s
|
||||||
- script.execute: nextion_upload
|
- script.execute: nextion_upload
|
||||||
- script.wait: nextion_upload
|
- script.wait: nextion_upload
|
||||||
|
|||||||
Reference in New Issue
Block a user