Skip to content

Commit

Permalink
Record max_loop_time
Browse files Browse the repository at this point in the history
For DEBUG
  • Loading branch information
edwardtfn committed Oct 29, 2024
1 parent d2c1687 commit 9285181
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
10 changes: 10 additions & 0 deletions esphome/nspanel_esphome_core_base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions esphome/nspanel_esphome_core_hw_display.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down Expand Up @@ -782,7 +782,7 @@ select:
- "256000"
- "512000"
- "921600"
initial_option: "115200"
initial_option: "921600"
optimistic: true
restore_value: true
internal: false
Expand Down
1 change: 1 addition & 0 deletions esphome/nspanel_esphome_core_page_blank.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
---
substitutions:
BOOT_STEP_PAGE_BLANK: '1UL << 27'
PAGE_ID_BLANK: '0'

script:
- id: !extend boot_progress_dump
Expand Down
9 changes: 5 additions & 4 deletions esphome/nspanel_esphome_core_page_home.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
---
substitutions:
BOOT_STEP_PAGE_HOME: '1UL << 17'
PAGE_ID_HOME: '1'

globals:
##### Chips #####
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 9285181

Please sign in to comment.