ESP32.deepsleepExt0() "MJS: called non-calablle"


Iam using JS. My goal is to force the ESP32 to deepsleep and wake up by ext interruption.
add in esp32_mjs.c:
void mgos_esp_deep_sleep_enable_ext0_wakeup_d(int gpio_num, int level) {
esp_deep_sleep_enable_ext0_wakeup(gpio_num, level);

add in api_esp32.js:
deepSleepExt0: ffi('void mgos_esp_deep_sleep_enable_ext0_wakeup_d(int, int)'),

in init.js:

The result I see is: MJS: called non-calablle

what is wrong?


How did you add mgos_esp_deep_sleep_enable_ext0_wakeup_d in esp32_mjs.c?

It’s simpler to to add the function in src/main.c and ffi it in your init.js:

let deepSleepExt0 = ffi('void mgos_esp_deep_sleep_enable_ext0_wakeup_d(int, int)');