mirror of
https://github.com/esphome/esphome.git
synced 2025-11-15 06:15:47 +00:00
[nrf52,watchdog] do not disable watchog if it is not nesesery (#11686)
This commit is contained in:
@@ -59,6 +59,7 @@ async def to_code(config):
|
|||||||
zephyr_add_prj_conf("SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL", True)
|
zephyr_add_prj_conf("SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL", True)
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
await cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
|
cg.add_define("USE_DEBUG")
|
||||||
|
|
||||||
|
|
||||||
FILTER_SOURCE_FILES = filter_source_files_from_platform(
|
FILTER_SOURCE_FILES = filter_source_files_from_platform(
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
#include <zephyr/random/random.h>
|
#include <zephyr/random/random.h>
|
||||||
#include "esphome/core/hal.h"
|
#include "esphome/core/hal.h"
|
||||||
#include "esphome/core/helpers.h"
|
#include "esphome/core/helpers.h"
|
||||||
|
#include "esphome/core/defines.h"
|
||||||
|
|
||||||
namespace esphome {
|
namespace esphome {
|
||||||
|
|
||||||
@@ -25,7 +26,14 @@ void arch_init() {
|
|||||||
wdt_config.window.max = 2000;
|
wdt_config.window.max = 2000;
|
||||||
wdt_channel_id = wdt_install_timeout(WDT, &wdt_config);
|
wdt_channel_id = wdt_install_timeout(WDT, &wdt_config);
|
||||||
if (wdt_channel_id >= 0) {
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
#define USE_DATETIME_DATE
|
#define USE_DATETIME_DATE
|
||||||
#define USE_DATETIME_DATETIME
|
#define USE_DATETIME_DATETIME
|
||||||
#define USE_DATETIME_TIME
|
#define USE_DATETIME_TIME
|
||||||
|
#define USE_DEBUG
|
||||||
#define USE_DEEP_SLEEP
|
#define USE_DEEP_SLEEP
|
||||||
#define USE_DEVICES
|
#define USE_DEVICES
|
||||||
#define USE_DISPLAY
|
#define USE_DISPLAY
|
||||||
|
|||||||
Reference in New Issue
Block a user