diff --git a/Sming/Arch/Esp32/Components/esp32/src/startup.cpp b/Sming/Arch/Esp32/Components/esp32/src/startup.cpp index 6107937864..87b2026972 100644 --- a/Sming/Arch/Esp32/Components/esp32/src/startup.cpp +++ b/Sming/Arch/Esp32/Components/esp32/src/startup.cpp @@ -33,7 +33,7 @@ extern "C" void app_main(void) esp_event_loop_create_default(); -#ifndef DISABLE_NETWORK +#ifndef DISABLE_WIFI esp_network_initialise(); #endif diff --git a/Sming/Components/Network/Arch/Esp32/Platform/IdfService.cpp b/Sming/Components/Network/Arch/Esp32/Platform/IdfService.cpp index 7dce438f48..19af0a1ac8 100644 --- a/Sming/Components/Network/Arch/Esp32/Platform/IdfService.cpp +++ b/Sming/Components/Network/Arch/Esp32/Platform/IdfService.cpp @@ -9,6 +9,7 @@ ****/ #include +#include #include #include #include @@ -54,10 +55,9 @@ void IdfService::enableEventCallback(bool enable) auto handler = [](void* arg, esp_event_base_t, int32_t event_id, void*) { auto service = static_cast(arg); service->state = Event(event_id); - if(!service->eventCallback) { - return; + if(service->eventCallback) { + System.queueCallback([service, event_id]() { service->eventCallback(Event(event_id)); }); } - service->eventCallback(Event(event_id)); }; if(enable) {