From 13e7cb2505d9ab300130a21d133c9c5d65f53f7c Mon Sep 17 00:00:00 2001 From: Edward Firmo <94725493+edwardtfn@users.noreply.github.com> Date: Wed, 16 Oct 2024 20:50:13 +0200 Subject: [PATCH] Introduces `nextion_queue_reset` To prevent the queue growing to infinite. --- esphome/nspanel_esphome_core_hw_display.yaml | 26 +++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/esphome/nspanel_esphome_core_hw_display.yaml b/esphome/nspanel_esphome_core_hw_display.yaml index c92a01498..73eb05b1b 100644 --- a/esphome/nspanel_esphome_core_hw_display.yaml +++ b/esphome/nspanel_esphome_core_hw_display.yaml @@ -255,7 +255,7 @@ globals: initial_value: "'.'" - id: nextion_queue - type: uint32_t + type: uint8_t restore_value: false initial_value: '0' @@ -544,6 +544,8 @@ script: then: - lambda: |- id(nextion_queue)++; + if (id(nextion_queue) > 128) + nextion_queue_reset->execute(); - id: nextion_queue_del mode: queued @@ -552,18 +554,24 @@ script: if (id(nextion_queue) > 0) id(nextion_queue)--; + - id: nextion_queue_reset + mode: restart + then: + - lambda: |- + set_component_font->stop(); + set_component_font_color->stop(); + set_component_pic->stop(); + set_component_text->stop(); + set_component_value->stop(); + set_component_visibility->stop(); + id(nextion_queue) = 0; + - id: page_changed mode: restart then: - lambda: |- - if (current_page->state != id(last_page)) { // Clear the buffer when a new page opens - set_component_font->stop(); - set_component_font_color->stop(); - set_component_pic->stop(); - set_component_text->stop(); - set_component_value->stop(); - set_component_visibility->stop(); - } + if (current_page->state != id(last_page)) // Clear the buffer when a new page opens + nextion_queue_reset->execute(); if ( current_page->state != "alarm" and current_page->state != "climate" and