Move reboot button control to on_touch

So save a few more bytes of memory
This commit is contained in:
Edward Firmo
2024-03-19 15:32:41 +01:00
parent e0415c35cd
commit e2c639a32d

View File

@@ -27,7 +27,7 @@ external_components:
# path: packages/Blackymas/components # path: packages/Blackymas/components
type: git type: git
url: https://github.com/Blackymas/NSPanel_HA_Blueprint url: https://github.com/Blackymas/NSPanel_HA_Blueprint
ref: dev # To do: Change to "main" when releasing ref: beta # To do: Change to "main" when releasing
components: components:
- nspanel_ha_blueprint - nspanel_ha_blueprint
refresh: 300s refresh: 300s
@@ -75,7 +75,6 @@ esphome:
- switch.turn_off: screen_power - switch.turn_off: screen_power
- delay: 2s - delay: 2s
- switch.turn_on: screen_power - switch.turn_on: screen_power
- delay: 5s
on_shutdown: on_shutdown:
- priority: 0 - priority: 0
@@ -866,6 +865,24 @@ display:
if (!id(is_uploading_tft)) { if (!id(is_uploading_tft)) {
timer_reset_all->execute(); timer_reset_all->execute();
switch (page_id) { switch (page_id) {
case 0: // Boot
switch (component_id) {
case 4: // Reboot button
if (!touch_event) { // Release
App.safe_reboot();
}
break;
}
break;
case 8: // Settings
switch (component_id) {
case 9: // Reboot button
if (!touch_event) { // Release
App.safe_reboot();
}
break;
}
break;
case 10: // light case 10: // light
switch (component_id) { switch (component_id) {
case 34: // power_button case 34: // power_button
@@ -1164,23 +1181,6 @@ binary_sensor:
component: "hw_bt_right" component: "hw_bt_right"
command: "short_click" command: "short_click"
##### Restart NSPanel Button - Setting Page #####
- name: Restart
platform: nextion
page_id: 8
component_id: 9
internal: true
on_click:
- button.press: restart_nspanel
##### Restart NSPanel Button - Boot Page #####
- name: Restart
platform: nextion
page_id: 0
component_id: 4
internal: true
on_click:
- button.press: restart_nspanel
## Delays initial info from HA to the display ##### ## Delays initial info from HA to the display #####
- name: Nextion display - name: Nextion display
id: nextion_init id: nextion_init