From 92851819900c96483a99e5c2b27912b0ad3802ae Mon Sep 17 00:00:00 2001 From: Edward Firmo <94725493+edwardtfn@users.noreply.github.com> Date: Tue, 29 Oct 2024 22:18:04 +0100 Subject: [PATCH] Record `max_loop_time` For DEBUG --- esphome/nspanel_esphome_core_base.yaml | 10 ++++++++++ esphome/nspanel_esphome_core_hw_display.yaml | 6 +++--- esphome/nspanel_esphome_core_page_blank.yaml | 1 + esphome/nspanel_esphome_core_page_home.yaml | 9 +++++---- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/esphome/nspanel_esphome_core_base.yaml b/esphome/nspanel_esphome_core_base.yaml index 4767f57a2..748c23673 100644 --- a/esphome/nspanel_esphome_core_base.yaml +++ b/esphome/nspanel_esphome_core_base.yaml @@ -105,6 +105,11 @@ globals: restore_value: false initial_value: 'false' + - id: max_loop_time + type: uint32_t + restore_value: true + initial_value: '0' + logger: id: logger_std baud_rate: 0 # Disable serial logger to save some memory and CPU @@ -337,6 +342,11 @@ sensor: loop_time: id: debug_loop_time name: Loop time + on_value: + then: + - lambda: |- + if (x > id(max_loop_time)) + id(max_loop_time) = x; text_sensor: - id: detailed_entity # Entity Id of the entity displayed on the detailed pages diff --git a/esphome/nspanel_esphome_core_hw_display.yaml b/esphome/nspanel_esphome_core_hw_display.yaml index 1883b7de8..337fe6f36 100644 --- a/esphome/nspanel_esphome_core_hw_display.yaml +++ b/esphome/nspanel_esphome_core_hw_display.yaml @@ -548,7 +548,7 @@ script: - lambda: return (tf_uart->get_baud_rate() != baud_rate); then: - lambda: |- - ESP_LOGD("script.set_baud_rate", "Baud rate changing from %" PRIu32 " to %" PRIu32 " bps", tf_uart->get_baud_rate(), baud_rate); + ESP_LOGI("script.set_baud_rate", "Baud rate changing from %" PRIu32 " to %" PRIu32 " bps", tf_uart->get_baud_rate(), baud_rate); ESP_LOGD("script.set_baud_rate", "Flush UART"); - wait_until: condition: @@ -566,7 +566,7 @@ script: ESP_LOGD("script.set_baud_rate", "Set ESPHome new baud rate to %" PRIu32 " bps", baud_rate); tf_uart->set_baud_rate(baud_rate); tf_uart->load_settings(); - ESP_LOGD("script.set_baud_rate", "Current baud rate: %" PRIu32 " bps", tf_uart->get_baud_rate()); + ESP_LOGI("script.set_baud_rate", "Current baud rate: %" PRIu32 " bps", tf_uart->get_baud_rate()); - id: set_brightness mode: restart @@ -782,7 +782,7 @@ select: - "256000" - "512000" - "921600" - initial_option: "115200" + initial_option: "921600" optimistic: true restore_value: true internal: false diff --git a/esphome/nspanel_esphome_core_page_blank.yaml b/esphome/nspanel_esphome_core_page_blank.yaml index 4b4bc33e4..03da24b88 100644 --- a/esphome/nspanel_esphome_core_page_blank.yaml +++ b/esphome/nspanel_esphome_core_page_blank.yaml @@ -8,6 +8,7 @@ --- substitutions: BOOT_STEP_PAGE_BLANK: '1UL << 27' + PAGE_ID_BLANK: '0' script: - id: !extend boot_progress_dump diff --git a/esphome/nspanel_esphome_core_page_home.yaml b/esphome/nspanel_esphome_core_page_home.yaml index 54956a7e3..ee767a017 100644 --- a/esphome/nspanel_esphome_core_page_home.yaml +++ b/esphome/nspanel_esphome_core_page_home.yaml @@ -8,6 +8,7 @@ --- substitutions: BOOT_STEP_PAGE_HOME: '1UL << 17' + PAGE_ID_HOME: '1' globals: ##### Chips ##### @@ -129,12 +130,12 @@ script: - lambda: |- static uint8_t page_home_boot_steps_count = 0; page_home_boot_steps_count++; - ESP_LOGW("DEBUG", "page_home_boot_steps_count: %" PRIu8, page_home_boot_steps_count); - boot_progress->execute(${BOOT_STEP_PAGE_HOME}, ("Page Home - " + sub_step_name).c_str()); - if (current_page->state == "boot" and wakeup_page_name->state == "home") { + boot_progress->execute(page_home_boot_steps_count >= 2 ? ${BOOT_STEP_PAGE_HOME} : 0, + ("Page Home - " + sub_step_name).c_str()); + if (current_page->state == "boot" and wakeup_page_name->state == "home" and page_home_boot_steps_count >= 2) { ESP_LOGI("script.page_home_boot_progress", "Jump to Home page"); goto_page->execute("home", true); - set_variable_value->execute("wakeup_page_id", get_page_id("home")); + set_variable_value->execute("wakeup_page_id", ${PAGE_ID_HOME}); } - id: !extend set_var_int