Enhance boot sequence: add boot_test_mode global variable; adjust backlight delay and update display logic for test mode
This commit is contained in:
@@ -2,14 +2,26 @@ substitutions:
|
|||||||
name: cat-medication-tracker
|
name: cat-medication-tracker
|
||||||
friendly_name: "Cat Medication Tracker"
|
friendly_name: "Cat Medication Tracker"
|
||||||
|
|
||||||
|
globals:
|
||||||
|
- id: boot_test_mode
|
||||||
|
type: bool
|
||||||
|
restore_value: false
|
||||||
|
initial_value: 'true'
|
||||||
|
|
||||||
esphome:
|
esphome:
|
||||||
name: ${name}
|
name: ${name}
|
||||||
friendly_name: ${friendly_name}
|
friendly_name: ${friendly_name}
|
||||||
on_boot:
|
on_boot:
|
||||||
priority: -10
|
- priority: -10
|
||||||
then:
|
then:
|
||||||
- light.turn_on: backlight
|
- light.turn_on: backlight
|
||||||
|
- delay: 300ms
|
||||||
|
- lambda: |-
|
||||||
|
id(boot_test_mode) = true;
|
||||||
|
- component.update: my_display
|
||||||
- delay: 1s
|
- delay: 1s
|
||||||
|
- lambda: |-
|
||||||
|
id(boot_test_mode) = false;
|
||||||
- component.update: my_display
|
- component.update: my_display
|
||||||
|
|
||||||
esp32:
|
esp32:
|
||||||
@@ -79,9 +91,14 @@ display:
|
|||||||
height: 320
|
height: 320
|
||||||
id: my_display
|
id: my_display
|
||||||
auto_clear_enabled: false
|
auto_clear_enabled: false
|
||||||
update_interval: 2s
|
update_interval: never
|
||||||
color_palette: 8BIT
|
color_palette: 8BIT
|
||||||
lambda: |-
|
lambda: |-
|
||||||
|
if (id(boot_test_mode)) {
|
||||||
|
it.fill(Color(0, 128, 255));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Colors
|
// Colors
|
||||||
auto red = Color(255, 0, 0);
|
auto red = Color(255, 0, 0);
|
||||||
auto green = Color(0, 200, 0);
|
auto green = Color(0, 200, 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user