1
0
mirror of https://github.com/esphome/esphome.git synced 2025-11-10 20:05:48 +00:00

[nrf52,watchdog] do not disable watchog if it is not nesesery (#11686)

This commit is contained in:
tomaszduda23
2025-11-10 03:21:38 +01:00
committed by GitHub
parent c17a31a8f8
commit b47e89a7d5
3 changed files with 11 additions and 1 deletions

View File

@@ -59,6 +59,7 @@ async def to_code(config):
zephyr_add_prj_conf("SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL", True)
var = cg.new_Pvariable(config[CONF_ID])
await cg.register_component(var, config)
cg.add_define("USE_DEBUG")
FILTER_SOURCE_FILES = filter_source_files_from_platform(

View File

@@ -6,6 +6,7 @@
#include <zephyr/random/random.h>
#include "esphome/core/hal.h"
#include "esphome/core/helpers.h"
#include "esphome/core/defines.h"
namespace esphome {
@@ -25,7 +26,14 @@ void arch_init() {
wdt_config.window.max = 2000;
wdt_channel_id = wdt_install_timeout(WDT, &wdt_config);
if (wdt_channel_id >= 0) {
wdt_setup(WDT, WDT_OPT_PAUSE_HALTED_BY_DBG | WDT_OPT_PAUSE_IN_SLEEP);
uint8_t options = 0;
#ifdef USE_DEBUG
options |= WDT_OPT_PAUSE_HALTED_BY_DBG;
#endif
#ifdef USE_DEEP_SLEEP
options |= WDT_OPT_PAUSE_IN_SLEEP;
#endif
wdt_setup(WDT, options);
}
}
}

View File

@@ -34,6 +34,7 @@
#define USE_DATETIME_DATE
#define USE_DATETIME_DATETIME
#define USE_DATETIME_TIME
#define USE_DEBUG
#define USE_DEEP_SLEEP
#define USE_DEVICES
#define USE_DISPLAY