Skip to content

WDT init compilation error #20

Description

@Hackbert117

When compiling in ESPHome Builder i get the following error:

Compiling .pioenvs/esp32emon/lib4c5/Network/NetworkInterface.cpp.o
src/esp32emon.h: In member function 'virtual void MyPowerSensor::setup()':
src/esp32emon.h:7:21: error: invalid conversion from 'int' to 'const esp_task_wdt_config_t*' [-fpermissive]
    7 | #define WDT_TIMEOUT 5
      |                     ^
      |                     |
      |                     int
src/esp32emon.h:76:23: note: in expansion of macro 'WDT_TIMEOUT'
   76 |     esp_task_wdt_init(WDT_TIMEOUT, true); // enable panic so ESP32 restarts
      |                       ^~~~~~~~~~~
src/esp32emon.h:76:22: error: too many arguments to function 'esp_err_t esp_task_wdt_init(const esp_task_wdt_config_t*)'
   76 |     esp_task_wdt_init(WDT_TIMEOUT, true); // enable panic so ESP32 restarts
      |     ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
In file included from src/esp32emon.h:3:
/data/cache/platformio/packages/framework-espidf/components/esp_system/include/esp_task_wdt.h:47:11: note: declared here
   47 | esp_err_t esp_task_wdt_init(const esp_task_wdt_config_t *config);
      |           ^~~~~~~~~~~~~~~~~

Full log attached.
logs_esp32emon_compile.txt

I tried the fix from here as i am just a hobby coder:
https://iotassistant.io/esp32/fixing-error-hardware-wdt-arduino-esp32/

changed line 76 in esp32emon.h from

esp_task_wdt_init(WDT_TIMEOUT, true); // enable panic so ESP32 restarts

to:

#define CONFIG_FREERTOS_NUMBER_OF_CORES 1 
esp_task_wdt_config_t twdt_config = {
        .timeout_ms = WDT_TIMEOUT,
        .idle_core_mask = (1 << CONFIG_FREERTOS_NUMBER_OF_CORES) - 1,    // Bitmask of all cores
        .trigger_panic = true,
    };

after that the project will compile.

I am no programmer so i don't know if this fix is working as intended?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions