Skip to content

Commit e9e5292

Browse files
committed
Reorg boot_progress calls
1 parent e95c1bb commit e9e5292

1 file changed

Lines changed: 20 additions & 17 deletions

File tree

esphome/nspanel_esphome_boot.yaml

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,19 @@ script:
3838
boot_preparation->execute();
3939
boot_critical_components->execute();
4040
- script.wait: boot_critical_components
41-
- lambda: boot_early_routines->execute();
41+
- script.execute: boot_early_routines
4242
- script.wait: boot_early_routines
43-
- lambda: boot_nextion->execute();
43+
- script.execute: boot_nextion
44+
- script.wait: boot_nextion
4445
- delay: 1s
4546
# This should be moved somewhere else
47+
- lambda: boot_progress->execute(0);
4648
- lambda: |-
4749
boot_log->execute("Boot", "Starting sequence");
48-
boot_progress->execute(0);
4950
boot_log->execute("Boot", "Waiting for Wi-Fi");
5051
wait_for_wifi->execute();
5152
- script.wait: wait_for_wifi
53+
- lambda: boot_progress->execute(1);
5254

5355
- delay: ${DELAY_DEFAULT}ms
5456
- if:
@@ -61,13 +63,13 @@ script:
6163
else: # Wi-Fi connected
6264
- lambda: |-
6365
boot_log->execute("Boot", "Wi-Fi connected");
64-
boot_progress->execute(3);
6566
page_boot_show_ip->execute();
6667
68+
- lambda: boot_progress->execute(2);
6769
- lambda: wait_for_api->execute();
6870
- script.wait: wait_for_api
6971
- lambda: |-
70-
boot_progress->execute(4);
72+
boot_progress->execute(3);
7173
if (system_flags.api_ready) {
7274
boot_log->execute("Boot", "API connected");
7375
} else {
@@ -77,11 +79,10 @@ script:
7779
// Publish Nextion state
7880
boot_log->execute("Boot", "Publish Nextion state");
7981
nextion_init->publish_state(disp1->is_setup());
80-
feed_wdt_delay(${DELAY_DEFAULT});
81-
boot_progress->execute(6);
8282
8383
# Wait for a response from the blueprint
8484
- delay: ${DELAY_DEFAULT}ms
85+
- lambda: boot_progress->execute(4);
8586
- if:
8687
condition:
8788
- lambda: return not system_flags.blueprint_ready;
@@ -91,14 +92,20 @@ script:
9192
wait_for_blueprint->execute();
9293
- script.wait: wait_for_blueprint
9394
- lambda: |-
95+
boot_progress->execute(5);
9496
if (not system_flags.blueprint_ready) {
9597
boot_log->execute("Boot", "Blueprint not available");
9698
}
97-
boot_progress->execute(7);
9899
feed_wdt_delay(${DELAY_DEFAULT});
99100
101+
// Display settings
102+
boot_log->execute("Boot", "Sending display settings");
103+
disp1->send_command_printf("brightness=%i", int(display_brightness->state));
104+
disp1->send_command_printf("brightness_dim=%i", int(display_dim_brightness->state));
105+
disp1->send_command_printf("brightness_sleep=%i", int(display_sleep_brightness->state));
106+
disp1->send_command_printf("wakeup_page_id=%" PRIu8, get_page_id(wakeup_page_name->current_option()));
107+
100108
// Wrap-up
101-
boot_progress->execute(8);
102109
feed_wdt_delay(${DELAY_DEFAULT});
103110
boot_log->execute("Boot", "Wait to finish");
104111
feed_wdt_delay(${DELAY_DEFAULT});
@@ -109,9 +116,13 @@ script:
109116
wait_for_blueprint->execute();
110117
feed_wdt_delay(${DELAY_DEFAULT});
111118
- script.wait: wait_for_wifi
119+
- lambda: boot_progress->execute(6);
112120
- script.wait: wait_for_api
121+
- lambda: boot_progress->execute(7);
113122
- script.wait: wait_for_blueprint
123+
- lambda: boot_progress->execute(8);
114124
- script.wait: wait_for_version_tft
125+
- lambda: boot_progress->execute(9);
115126
- script.execute: boot_wrap_up
116127
- script.wait: boot_wrap_up
117128

@@ -150,14 +161,6 @@ script:
150161
- id: boot_nextion
151162
mode: single
152163
then:
153-
- lambda: |-
154-
// Display settings
155-
boot_log->execute("Boot", "Sending display settings");
156-
disp1->send_command_printf("brightness=%i", int(display_brightness->state));
157-
disp1->send_command_printf("brightness_dim=%i", int(display_dim_brightness->state));
158-
disp1->send_command_printf("brightness_sleep=%i", int(display_sleep_brightness->state));
159-
disp1->send_command_printf("wakeup_page_id=%" PRIu8, get_page_id(wakeup_page_name->current_option()));
160-
boot_progress->execute(5);
161164

162165
- id: boot_preparation
163166
mode: single

0 commit comments

Comments
 (0)