[GH-ISSUE #312] softap left on #264

Closed
opened 2026-02-28 01:24:24 +03:00 by kerem · 8 comments
Owner

Originally created by @tablatronix on GitHub (Feb 8, 2017).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/312

#216
#267

probably more

When configportal is abandoned, ap mode is left persistent,

Originally created by @tablatronix on GitHub (Feb 8, 2017). Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/312 #216 #267 probably more When configportal is abandoned, ap mode is left persistent,
kerem 2026-02-28 01:24:24 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@tzapu commented on GitHub (Feb 8, 2017):

for now it's probably worth just going to WIFI_AP and then back to WIFI_STA rather than AP+STA it goes to now.

it was a half assed attempt to do something else i think

<!-- gh-comment-id:278405622 --> @tzapu commented on GitHub (Feb 8, 2017): for now it's probably worth just going to WIFI_AP and then back to WIFI_STA rather than AP+STA it goes to now. it was a half assed attempt to do something else i think
Author
Owner

@tablatronix commented on GitHub (Feb 8, 2017):

Easiest fix is to make sure to turn off AP when timeout of configportal, or else it gets stuck on every time.
Also worth noting that switching modes alot may cause flash wear.

<!-- gh-comment-id:278407514 --> @tablatronix commented on GitHub (Feb 8, 2017): Easiest fix is to make sure to turn off AP when timeout of configportal, or else it gets stuck on every time. Also worth noting that switching modes alot may cause flash wear.
Author
Owner

@tablatronix commented on GitHub (Feb 8, 2017):

man github is being slow today, could not even see or merge updates.

pr on its way

<!-- gh-comment-id:278412366 --> @tablatronix commented on GitHub (Feb 8, 2017): man github is being slow today, could not even see or merge updates. pr on its way
Author
Owner

@tablatronix commented on GitHub (Feb 8, 2017):

best solution is to handle this directly via SDK, no flash involved
wifi_set_opmode_current()

Set Wi-Fi working mode to Station mode, SoftAP or Station + SoftAP, and do not
update flash.

That or toggle persistent before and after changing modes.

<!-- gh-comment-id:278421164 --> @tablatronix commented on GitHub (Feb 8, 2017): best solution is to handle this directly via SDK, no flash involved `wifi_set_opmode_current()` >Set Wi-Fi working mode to Station mode, SoftAP or Station + SoftAP, and do not update flash. That or toggle persistent before and after changing modes.
Author
Owner

@tablatronix commented on GitHub (Feb 8, 2017):

Testing good so far

/**
 * toggle mode, non persistant
 * @param m WiFiMode_t
 */
bool WiFiManager::wifimode(WiFiMode_t m) {
    DEBUG_WM(F("changing wifi mode non persistant"));
    if(wifi_get_opmode() == (uint8) m) {
        return true;
    }
    bool ret;
    ETS_UART_INTR_DISABLE();
    ret =  wifi_set_opmode_current(m);
    ETS_UART_INTR_ENABLE();
    return ret;
}

So now even if rebooted mid portal, it will not get stuck in STA+AP mode, etc.

Ideally we would also be able to rework the library to not step on users configs.

do a wifi_station_get_config save state locally, switch to lib ap, finish, restore users ap.
or when in doubt reboot works now since not overwriting flash.

As it is now, user ap mode has to be handled in user code, as you cannot use flash.

<!-- gh-comment-id:278430965 --> @tablatronix commented on GitHub (Feb 8, 2017): Testing good so far ```C++ /** * toggle mode, non persistant * @param m WiFiMode_t */ bool WiFiManager::wifimode(WiFiMode_t m) { DEBUG_WM(F("changing wifi mode non persistant")); if(wifi_get_opmode() == (uint8) m) { return true; } bool ret; ETS_UART_INTR_DISABLE(); ret = wifi_set_opmode_current(m); ETS_UART_INTR_ENABLE(); return ret; } ``` So now even if rebooted mid portal, it will not get stuck in STA+AP mode, etc. Ideally we would also be able to rework the library to not step on users configs. do a `wifi_station_get_config` save state locally, switch to lib ap, finish, restore users ap. or when in doubt reboot works now since not overwriting flash. As it is now, user ap mode has to be handled in user code, as you cannot use flash.
Author
Owner

@tablatronix commented on GitHub (Feb 10, 2017):

It is also worth noting that even though opmode wont be saved when you start the softap the conf is always saved.

<!-- gh-comment-id:278964582 --> @tablatronix commented on GitHub (Feb 10, 2017): It is also worth noting that even though opmode wont be saved when you start the softap the conf is always saved.
Author
Owner

@neilyoung commented on GitHub (Feb 11, 2017):

How do you ETS_UART_INTR_ENABLE(); after return?

<!-- gh-comment-id:279134735 --> @neilyoung commented on GitHub (Feb 11, 2017): How do you ETS_UART_INTR_ENABLE(); after return?
Author
Owner

@tablatronix commented on GitHub (Feb 11, 2017):

good catch

ohhh yeah duh, fixed, either way i think this might work for a workaround but ultimately it is not gonna be a solution. see #314

I am working on a pr for development to solve some major issues instead.

<!-- gh-comment-id:279147064 --> @tablatronix commented on GitHub (Feb 11, 2017): good catch ohhh yeah duh, fixed, either way i think this might work for a workaround but ultimately it is not gonna be a solution. see #314 I am working on a pr for development to solve some major issues instead.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/WiFiManager#264
No description provided.