8000 Callbacks of WiFi events (onX) are not called · Issue #9086 · esp8266/Arduino · GitHub
[go: up one dir, main page]

Skip to content
Callbacks of WiFi events (onX) are not called #9086
Closed
@srvmgr

Description

@srvmgr

if (handler->canExpire() && handler.unique()) {

I figured out that callbacks of events registered with methods onX... (like onStationModeGotIP) are not executed.
Looking in code, in file ESP8266WiFiGeneric.cpp, method _eventCallback:

For events registered using predefined methods (which have mCanExpire = true), are removed and not executed, because of the next line:

if (handler->canExpire() && handler.unique()) {

But when they are registered using the old way (onEvent(....)), because mCanExpire = false, they are executed.

for(auto it = std::begin(sCbEventList); it != std::end(sCbEventList); ) {
        WiFiEventHandler &handler = *it;
        if (handler->canExpire() && handler.unique()) {
            it = sCbEventList.erase(it);
        }
        else { /** ELSE SHOULD EXISTS? or  (*handler)(event); should be called allways regardless of if (handler->canExpire()... ***/
            (*handler)(event);
            ++it;
        }
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0