Refactor boot sequence: remove boot_test_mode global variable; simplify backlight control and update display logic

This commit is contained in:
Joshua King
2026-03-04 20:02:55 -05:00
parent ccb50f1c37
commit 45c9186f25

View File

@@ -2,27 +2,16 @@ substitutions:
name: cat-medication-tracker
friendly_name: "Cat Medication Tracker"
globals:
- id: boot_test_mode
type: bool
restore_value: false
initial_value: 'true'
esphome:
name: ${name}
friendly_name: ${friendly_name}
on_boot:
- priority: -10
then:
- light.turn_on: backlight
- delay: 300ms
- lambda: |-
id(boot_test_mode) = true;
- component.update: my_display
- delay: 1s
- lambda: |-
id(boot_test_mode) = false;
- component.update: my_display
then:
- light.turn_on:
id: backlight
brightness: 100%
- delay: 1s
- component.update: my_display
esp32:
board: esp32dev
@@ -91,14 +80,9 @@ display:
height: 320
id: my_display
auto_clear_enabled: false
update_interval: never
update_interval: 1s
color_palette: 8BIT
lambda: |-
if (id(boot_test_mode)) {
it.fill(Color(0, 128, 255));
return;
}
// Colors
auto red = Color(255, 0, 0);
auto green = Color(0, 200, 0);