Skip to content

Error when reinitializing WiFi after deinitialization with WiFi.mode( WIFI_MODE_NULL ) #4421

Closed
@GiovanniCmpaner

Description

@GiovanniCmpaner

Using branch esp32s2 with PlataformIO and build_flags = -DCORE_DEBUG_LEVEL=5

Minimal sketch:

#include <Arduino.h>
#include <WiFi.h>

void setup()
{
    Serial.begin( 115200 );
    Serial.setDebugOutput( true );

    WiFi.mode( WIFI_MODE_STA );
    WiFi.mode( WIFI_MODE_NULL );
    WiFi.mode( WIFI_MODE_STA );
}

void loop(){ }

Output:

[   942][V][WiFiGeneric.cpp:314] _arduino_event_cb(): STA Started
[   943][D][WiFiGeneric.cpp:967] _eventCallback(): Arduino Event: 2 - STA_START
[   946][V][WiFiGeneric.cpp:319] _arduino_event_cb(): STA Stopped
[   950][D][WiFiGeneric.cpp:967] _eventCallback(): Arduino Event: 3 - STA_STOP
[   960][W][WiFiGeneric.cpp:1268] getMode(): WiFi not started
[   963][E][WiFiGeneric.cpp:1224] mode(): Could not set mode! 12289

With error code 12289 = ESP_ERR_WIFI_NOT_INIT

This assignment:

lowLevelInitDone = esp_wifi_deinit() == ESP_OK;

Should be
lowLevelInitDone = !(esp_wifi_deinit() == ESP_OK);

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: StaleIssue is stale stage (outdated/stuck)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions