Skip to content

Commit

Permalink
WDT fix
Browse files Browse the repository at this point in the history
  • Loading branch information
cziter15 committed Apr 24, 2024
1 parent fc7f1d3 commit 02112b9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/ksf/ksConstants.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@
* https://github.com/cziter15/ksIotFrameworkLib/blob/master/LICENSE
*/



#if ESP32
#include <WiFi.h>
#include <esp_phy_init.h>
#include <nvs_flash.h>
#include <esp_task_wdt.h>
#elif ESP8266
#include <ESP8266WiFi.h>
#else
Expand Down Expand Up @@ -38,11 +41,17 @@ namespace ksf
void initializeFramework()
{
#ifdef ESP32
/* Setup watchdog. */
esp_task_wdt_init(KSF_WATCHDOG_TIMEOUT_SECS, true);

/* Initialize filesystem. */
LittleFS.begin(true);
#endif

#if ESP8266
/* Setup watchdog. */
ESP.wdtEnable(KSF_WATCHDOG_TIMEOUT_SECS * 1000);

/* Initialize filesystem. */
LittleFS.begin();
#endif
Expand Down
5 changes: 5 additions & 0 deletions src/ksf/ksConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@
#define KSF_WIFI_RECONNECT_TIME_MS 5000UL
#endif

#ifndef KSF_WATCHDOG_TIMEOUT_SECS
/*! Watchdog timeout in seconds. */
#define KSF_WATCHDOG_TIMEOUT_SECS 10UL
#endif

/*! Helper macro for init ks Framework. */
#define KSF_FRAMEWORK_INIT() ksf::initializeFramework();

Expand Down

0 comments on commit 02112b9

Please sign in to comment.