Idle hook on ESP8266

#1

Hi all,

I try to connect the idle hook for ESP32 and ESP8266.

I do the following in my main.cpp file:
#include “esp_freertos_hooks.h”

bool myTestIdleHook(void)
{

return true;
}

esp_register_freertos_idle_hook(myTestIdleHook);

On the ESP32 platform, I can compile without error, but on ESP8266 platform, I get the following error:
“fatal error: esp_freertos_hooks.h: No such file or directory”

Can anybody help me please?

Kind regards,
Rolf

#2

Monngoose OS for ESP8266 is based on nonos sdk, so no esp_register_freertos_idle_hook.

#3

Is there another possibility for hooking into the main/idle loop for ESP8266?

#4

There is no idle loop, mOS for ESP32 uses FreeRTOS, mOS for ESP8266 does not. As nliviu said, “Mongoose OS for ESP8266 is based on nonos sdk”, study Espressif’s nonos SDK to see if there is actually an idle loop. Last time I’ve checked (and that was really long ago) the nonos SDK used a proprietary event-driven kernel, as the main function of the CPU was handling WiFi stuff. You registered a timer callback and waited for that call to take place.