From 059ac25d7e08c6b4b04d792a0abcd0f5514f76b7 Mon Sep 17 00:00:00 2001 From: Paul Guyot Date: Sun, 12 Jul 2026 16:24:47 +0200 Subject: [PATCH] esp32: register sleep_enable_ulp_wakeup under its documented name The NIF was only registered as esp:sleep_ulp_wakeup/0 while esp.erl exports sleep_enable_ulp_wakeup/0, making the documented API undef at runtime. Register both names. Signed-off-by: Paul Guyot --- src/platforms/esp32/components/avm_sys/platform_nifs.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/platforms/esp32/components/avm_sys/platform_nifs.c b/src/platforms/esp32/components/avm_sys/platform_nifs.c index 1c4f410cd8..4276f30510 100644 --- a/src/platforms/esp32/components/avm_sys/platform_nifs.c +++ b/src/platforms/esp32/components/avm_sys/platform_nifs.c @@ -1226,10 +1226,16 @@ const struct Nif *platform_nifs_get_nif(const char *nifname) return &esp_sleep_enable_timer_wakeup_nif; } #if SOC_ULP_SUPPORTED + // Historical name kept for compatibility; esp.erl's documented API + // is sleep_enable_ulp_wakeup/0. if (strcmp("esp:sleep_ulp_wakeup/0", nifname) == 0) { TRACE("Resolved platform nif %s ...\n", nifname); return &esp_sleep_ulp_wakeup_nif; } + if (strcmp("esp:sleep_enable_ulp_wakeup/0", nifname) == 0) { + TRACE("Resolved platform nif %s ...\n", nifname); + return &esp_sleep_ulp_wakeup_nif; + } #endif if (strcmp("atomvm:platform/0", nifname) == 0) { TRACE("Resolved platform nif %s ...\n", nifname);