[GH-ISSUE #1444] setDebugOutput(false) causes the automatic Wi-Fi connection to fail #1235

Closed
opened 2026-02-28 01:29:10 +03:00 by kerem · 15 comments
Owner

Originally created by @Maurizio1 on GitHub (Jun 30, 2022).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1444

Basic Infos

Hardware

WiFimanager Branch/Release: Master

Esp8266/Esp32: Esp32

Hardware: LILYGO TTGO T-Camera WROVER PIR Mic (v1.6.2)

Core Version: 2.4.0, staging

Description

When setting setDebugOutput(false) Wi-Fi connection will systematically fail.

Settings in IDE

Module: Esp32 Dev Module

Additional libraries:

Sketch

#BEGIN
#include WiFi.h
#include FS.h
#include esp_camera.h

void setup() {

    WiFiManager wifiManager;
    bool connected = false;

    wifiManager.setDebugOutput(false); // ATTENTION - when debug is set to false, connection to the configured Wi-Fi SSID fails systematically and the AP comes available...
    wifiManager.setConfigPortalTimeout(30);

    Serial.println("\nCheck Wi-Fi connection...");

    connected = wifiManager.autoConnect("iomitacam", "Password1"); 
}

void loop() {

}
#END

Debug Messages

messages here
Originally created by @Maurizio1 on GitHub (Jun 30, 2022). Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1444 ### Basic Infos #### Hardware WiFimanager Branch/Release: Master Esp8266/Esp32: Esp32 Hardware: LILYGO TTGO T-Camera WROVER PIR Mic (v1.6.2) Core Version: 2.4.0, staging ### Description When setting setDebugOutput(false) Wi-Fi connection will systematically fail. ### Settings in IDE Module: Esp32 Dev Module Additional libraries: ### Sketch ```cpp #BEGIN #include WiFi.h #include FS.h #include esp_camera.h void setup() { WiFiManager wifiManager; bool connected = false; wifiManager.setDebugOutput(false); // ATTENTION - when debug is set to false, connection to the configured Wi-Fi SSID fails systematically and the AP comes available... wifiManager.setConfigPortalTimeout(30); Serial.println("\nCheck Wi-Fi connection..."); connected = wifiManager.autoConnect("iomitacam", "Password1"); } void loop() { } #END ``` ### Debug Messages ``` messages here ```
kerem 2026-02-28 01:29:10 +03:00
  • closed this issue
  • added the
    bug
    ESP32
    labels
Author
Owner

@tablatronix commented on GitHub (Jun 30, 2022):

yikes, I bet theres a bad debug block check

<!-- gh-comment-id:1171285760 --> @tablatronix commented on GitHub (Jun 30, 2022): yikes, I bet theres a bad debug block check
Author
Owner

@tablatronix commented on GitHub (Jun 30, 2022):

confirmed, but i have no idea wtf is going on

<!-- gh-comment-id:1171453362 --> @tablatronix commented on GitHub (Jun 30, 2022): confirmed, but i have no idea wtf is going on
Author
Owner

@tablatronix commented on GitHub (Jun 30, 2022):

Its a race condition, ill fix it

<!-- gh-comment-id:1171498708 --> @tablatronix commented on GitHub (Jun 30, 2022): Its a race condition, ill fix it
Author
Owner

@tablatronix commented on GitHub (Jun 30, 2022):

Added a fix to git, a workaround is to make sure you set mode sta in setup early as possible on esp32

<!-- gh-comment-id:1171553884 --> @tablatronix commented on GitHub (Jun 30, 2022): Added a fix to git, a workaround is to make sure you set mode sta in setup early as possible on esp32
Author
Owner

@tablatronix commented on GitHub (Jun 30, 2022):

b8205e71f3

<!-- gh-comment-id:1171554191 --> @tablatronix commented on GitHub (Jun 30, 2022): b8205e71f35c942c3714537563d0553b6f5828a6
Author
Owner

@Maurizio1 commented on GitHub (Jun 30, 2022):

Thank you @tablatronix.

I'll just add this comment because it could help someway...

Error seems to happen only when WM_DEBUG_LEVEL == DEBUG_VERBOSE

I also have found a quick workaround by adding a small delay in the following function in WiFiManager.cpp:

template <typename Generic, typename Genericb>
void WiFiManager::DEBUG_WM(wm_debuglevel_t level, Generic text, Genericb textb) {

  **delay(100); // 30/06/2022 - Maurizio Baralla - This is a workaround for the error in Wi-Fi connection when WM_DEBUG_LEVEL == DEBUG_VERBOSE**

  if(!_debug || _debugLevel < level) return;

  if(_debugLevel >= DEBUG_MAX){
    #ifdef ESP8266
    // uint32_t free;
    // uint16_t max;
    // uint8_t frag;
    // ESP.getHeapStats(&free, &max, &frag);// @todo Does not exist in 2.3.0
    // _debugPort.printf("[MEM] free: %5d | max: %5d | frag: %3d%% \n", free, max, frag); 
    #elif defined ESP32
    // total_free_bytes;      ///<  Total free bytes in the heap. Equivalent to multi_free_heap_size().
    // total_allocated_bytes; ///<  Total bytes allocated to data in the heap.
    // largest_free_block;    ///<  Size of largest free block in the heap. This is the largest malloc-able size.
    // minimum_free_bytes;    ///<  Lifetime minimum free heap size. Equivalent to multi_minimum_free_heap_size().
    // allocated_blocks;      ///<  Number of (variable size) blocks allocated in the heap.
    // free_blocks;           ///<  Number of (variable size) free blocks in the heap.
    // total_blocks;          ///<  Total number of (variable size) blocks in the heap.
    multi_heap_info_t info;
    heap_caps_get_info(&info, MALLOC_CAP_INTERNAL);
    uint32_t free = info.total_free_bytes;
    uint16_t max  = info.largest_free_block;
    uint8_t frag = 100 - (max * 100) / free;
    _debugPort.printf("[MEM] free: %5d | max: %5d | frag: %3d%% \n", free, max, frag);    
    #endif
  }
  _debugPort.print(_debugPrefix);
  if(_debugLevel >= debugLvlShow) _debugPort.print("["+(String)level+"] ");
  _debugPort.print(text);
  if(textb){
    _debugPort.print(" ");
    _debugPort.print(textb);
  }
  _debugPort.println();
}
<!-- gh-comment-id:1171574871 --> @Maurizio1 commented on GitHub (Jun 30, 2022): > Thank you @tablatronix. I'll just add this comment because it could help someway... Error seems to happen only when WM_DEBUG_LEVEL == DEBUG_VERBOSE I also have found a quick workaround by adding a small delay in the following function in WiFiManager.cpp: ```C++ template <typename Generic, typename Genericb> void WiFiManager::DEBUG_WM(wm_debuglevel_t level, Generic text, Genericb textb) { **delay(100); // 30/06/2022 - Maurizio Baralla - This is a workaround for the error in Wi-Fi connection when WM_DEBUG_LEVEL == DEBUG_VERBOSE** if(!_debug || _debugLevel < level) return; if(_debugLevel >= DEBUG_MAX){ #ifdef ESP8266 // uint32_t free; // uint16_t max; // uint8_t frag; // ESP.getHeapStats(&free, &max, &frag);// @todo Does not exist in 2.3.0 // _debugPort.printf("[MEM] free: %5d | max: %5d | frag: %3d%% \n", free, max, frag); #elif defined ESP32 // total_free_bytes; ///< Total free bytes in the heap. Equivalent to multi_free_heap_size(). // total_allocated_bytes; ///< Total bytes allocated to data in the heap. // largest_free_block; ///< Size of largest free block in the heap. This is the largest malloc-able size. // minimum_free_bytes; ///< Lifetime minimum free heap size. Equivalent to multi_minimum_free_heap_size(). // allocated_blocks; ///< Number of (variable size) blocks allocated in the heap. // free_blocks; ///< Number of (variable size) free blocks in the heap. // total_blocks; ///< Total number of (variable size) blocks in the heap. multi_heap_info_t info; heap_caps_get_info(&info, MALLOC_CAP_INTERNAL); uint32_t free = info.total_free_bytes; uint16_t max = info.largest_free_block; uint8_t frag = 100 - (max * 100) / free; _debugPort.printf("[MEM] free: %5d | max: %5d | frag: %3d%% \n", free, max, frag); #endif } _debugPort.print(_debugPrefix); if(_debugLevel >= debugLvlShow) _debugPort.print("["+(String)level+"] "); _debugPort.print(text); if(textb){ _debugPort.print(" "); _debugPort.print(textb); } _debugPort.println(); } ```
Author
Owner

@tablatronix commented on GitHub (Jul 1, 2022):

The debugging is just causing delays in code, helping the race condition fix itself.

The workaround would be set WiFi.mode to sta after setup and add a delay immediately after setup, wifi takes about 200ms to start

I will test on esp8266 today, this was only tested in esp32 as it requires wifi to init, esp8266 does not, But I will check if it is a different or similar situation

<!-- gh-comment-id:1172567982 --> @tablatronix commented on GitHub (Jul 1, 2022): The debugging is just causing delays in code, helping the race condition fix itself. The workaround would be set WiFi.mode to sta after setup and add a delay immediately after setup, wifi takes about 200ms to start I will test on esp8266 today, this was only tested in esp32 as it requires wifi to init, esp8266 does not, But I will check if it is a different or similar situation
Author
Owner

@tablatronix commented on GitHub (Jul 1, 2022):

esp8266 works fine, this is unrelated to this issue, and your wasting my time, thanks.

@Maurizio1 did you get a chance to test latest git?

<!-- gh-comment-id:1172664174 --> @tablatronix commented on GitHub (Jul 1, 2022): esp8266 works fine, this is unrelated to this issue, and your wasting my time, thanks. @Maurizio1 did you get a chance to test latest git?
Author
Owner

@TI-SH-K205 commented on GitHub (Jul 2, 2022):

Sir can we meet in WhatsApp place 🙏

+8801799259190

On Sat, Jul 2, 2022, 1:43 AM Shawn A @.***> wrote:

esp8266 works fine


Reply to this email directly, view it on GitHub
https://github.com/tzapu/WiFiManager/issues/1444#issuecomment-1172664174,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AZ3PEOO3EOG3W7XOMPMMVNDVR5C6PANCNFSM52IA4WGQ
.
You are receiving this because you commented.Message ID:
@.***>

<!-- gh-comment-id:1172808434 --> @TI-SH-K205 commented on GitHub (Jul 2, 2022): Sir can we meet in WhatsApp place 🙏 +8801799259190 On Sat, Jul 2, 2022, 1:43 AM Shawn A ***@***.***> wrote: > esp8266 works fine > > — > Reply to this email directly, view it on GitHub > <https://github.com/tzapu/WiFiManager/issues/1444#issuecomment-1172664174>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/AZ3PEOO3EOG3W7XOMPMMVNDVR5C6PANCNFSM52IA4WGQ> > . > You are receiving this because you commented.Message ID: > ***@***.***> >
Author
Owner

@tablatronix commented on GitHub (Jul 2, 2022):

we have a discord, or create a new issue for your specific issue, do not highjack closed issues

<!-- gh-comment-id:1172809872 --> @tablatronix commented on GitHub (Jul 2, 2022): we have a discord, or create a new issue for your specific issue, do not highjack closed issues
Author
Owner

@TI-SH-K205 commented on GitHub (Jul 4, 2022):

Sir someone give me this link.. is this link is safe for me

On Sat, Jul 2, 2022, 7:40 AM Shawn A @.***> wrote:

we have a discord, or create a new issue for your specific issue, do not
highjack closed issues


Reply to this email directly, view it on GitHub
https://github.com/tzapu/WiFiManager/issues/1444#issuecomment-1172809872,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AZ3PEOKN6RTPHS7IOXMZBALVR6MZLANCNFSM52IA4WGQ
.
You are receiving this because you commented.Message ID:
@.***>

<!-- gh-comment-id:1173223319 --> @TI-SH-K205 commented on GitHub (Jul 4, 2022): Sir someone give me this link.. is this link is safe for me On Sat, Jul 2, 2022, 7:40 AM Shawn A ***@***.***> wrote: > we have a discord, or create a new issue for your specific issue, do not > highjack closed issues > > — > Reply to this email directly, view it on GitHub > <https://github.com/tzapu/WiFiManager/issues/1444#issuecomment-1172809872>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/AZ3PEOKN6RTPHS7IOXMZBALVR6MZLANCNFSM52IA4WGQ> > . > You are receiving this because you commented.Message ID: > ***@***.***> >
Author
Owner

@tablatronix commented on GitHub (Jul 4, 2022):

Its on the readme

<!-- gh-comment-id:1173264022 --> @tablatronix commented on GitHub (Jul 4, 2022): Its on the readme
Author
Owner

@Maurizio1 commented on GitHub (Jul 4, 2022):

esp8266 works fine, this is unrelated to this issue, and your wasting my time, thanks.

@Maurizio1 did you get a chance to test latest git?

I'm sorry. I didn't mean to waste your time.
Of course I did test your patch and it worked.
That's why I wrote "Thank you @tablatronix" before my last post and put a "thumb up" emoji on your answer. Sorry if I was not clear enough.

As for the "debugging" that you mentioned I just added the "delay(100)" instruction, that's all. My intent was to help to pinpoint the cause.
Also, on my device (ESP32), I get more than 25 failed attempts before Wi-Fi starts.

E (3382) wifi:Association refused temporarily, comeback time 200 mSec
E (3588) wifi:Association refused temporarily, comeback time 200 mSec
E (3793) wifi:Association refused temporarily, comeback time 200 mSec
E (3998) wifi:Association refused temporarily, comeback time 200 mSec
E (4203) wifi:Association refused temporarily, comeback time 200 mSec
E (4408) wifi:Association refused temporarily, comeback time 200 mSec
E (4613) wifi:Association refused temporarily, comeback time 200 mSec
E (4818) wifi:Association refused temporarily, comeback time 200 mSec
E (5024) wifi:Association refused temporarily, comeback time 200 mSec
E (5229) wifi:Association refused temporarily, comeback time 200 mSec
E (5434) wifi:Association refused temporarily, comeback time 200 mSec
E (5639) wifi:Association refused temporarily, comeback time 200 mSec
E (5849) wifi:Association refused temporarily, comeback time 200 mSec
E (6054) wifi:Association refused temporarily, comeback time 200 mSec
E (6260) wifi:Association refused temporarily, comeback time 200 mSec
E (6465) wifi:Association refused temporarily, comeback time 200 mSec
E (6670) wifi:Association refused temporarily, comeback time 200 mSec
E (6875) wifi:Association refused temporarily, comeback time 200 mSec
E (7080) wifi:Association refused temporarily, comeback time 200 mSec
E (7285) wifi:Association refused temporarily, comeback time 200 mSec
E (7490) wifi:Association refused temporarily, comeback time 200 mSec
E (7695) wifi:Association refused temporarily, comeback time 200 mSec
E (7900) wifi:Association refused temporarily, comeback time 200 mSec
E (8106) wifi:Association refused temporarily, comeback time 200 mSec
E (8311) wifi:Association refused temporarily, comeback time 200 mSec
E (8516) wifi:Association refused temporarily, comeback time 200 mSec

Again, I'm not trying to devour your time, I'm just giving some more info in the hope it can help, so please forgive me.
Anyway, your patch worked for me, so I am OK with that. Thank you again.

<!-- gh-comment-id:1173857207 --> @Maurizio1 commented on GitHub (Jul 4, 2022): > esp8266 works fine, this is unrelated to this issue, and your wasting my time, thanks. > > @Maurizio1 did you get a chance to test latest git? I'm sorry. I didn't mean to waste your time. Of course I did test your patch and it worked. That's why I wrote "Thank you @tablatronix" before my last post and put a "thumb up" emoji on your answer. Sorry if I was not clear enough. As for the "debugging" that you mentioned I just added the "delay(100)" instruction, that's all. My intent was to help to pinpoint the cause. Also, on my device (ESP32), I get more than 25 failed attempts before Wi-Fi starts. > E (3382) wifi:Association refused temporarily, comeback time 200 mSec > E (3588) wifi:Association refused temporarily, comeback time 200 mSec > E (3793) wifi:Association refused temporarily, comeback time 200 mSec > E (3998) wifi:Association refused temporarily, comeback time 200 mSec > E (4203) wifi:Association refused temporarily, comeback time 200 mSec > E (4408) wifi:Association refused temporarily, comeback time 200 mSec > E (4613) wifi:Association refused temporarily, comeback time 200 mSec > E (4818) wifi:Association refused temporarily, comeback time 200 mSec > E (5024) wifi:Association refused temporarily, comeback time 200 mSec > E (5229) wifi:Association refused temporarily, comeback time 200 mSec > E (5434) wifi:Association refused temporarily, comeback time 200 mSec > E (5639) wifi:Association refused temporarily, comeback time 200 mSec > E (5849) wifi:Association refused temporarily, comeback time 200 mSec > E (6054) wifi:Association refused temporarily, comeback time 200 mSec > E (6260) wifi:Association refused temporarily, comeback time 200 mSec > E (6465) wifi:Association refused temporarily, comeback time 200 mSec > E (6670) wifi:Association refused temporarily, comeback time 200 mSec > E (6875) wifi:Association refused temporarily, comeback time 200 mSec > E (7080) wifi:Association refused temporarily, comeback time 200 mSec > E (7285) wifi:Association refused temporarily, comeback time 200 mSec > E (7490) wifi:Association refused temporarily, comeback time 200 mSec > E (7695) wifi:Association refused temporarily, comeback time 200 mSec > E (7900) wifi:Association refused temporarily, comeback time 200 mSec > E (8106) wifi:Association refused temporarily, comeback time 200 mSec > E (8311) wifi:Association refused temporarily, comeback time 200 mSec > E (8516) wifi:Association refused temporarily, comeback time 200 mSec Again, I'm not trying to devour your time, I'm just giving some more info in the hope it can help, so please forgive me. Anyway, your patch worked for me, so I am OK with that. Thank you again.
Author
Owner

@tablatronix commented on GitHub (Jul 4, 2022):

Sorry @Maurizio1 that was not to you!, I deleted some other posts, someone else.

Thanks for creating issues and improving wifimanager!

That comeback issue is another known issue with some routers.. Although its a bit different, can you open a new issue for that one, and I will link it to the workarounds and other issue

<!-- gh-comment-id:1173924002 --> @tablatronix commented on GitHub (Jul 4, 2022): Sorry @Maurizio1 that was not to you!, I deleted some other posts, someone else. Thanks for creating issues and improving wifimanager! That comeback issue is another known issue with some routers.. Although its a bit different, can you open a new issue for that one, and I will link it to the workarounds and other issue
Author
Owner

@Maurizio1 commented on GitHub (Jul 4, 2022):

No problem @tablatronix. :-)

Sure! I will open another issue for that then.

Thank you

<!-- gh-comment-id:1174074797 --> @Maurizio1 commented on GitHub (Jul 4, 2022): > No problem @tablatronix. :-) Sure! I will open another issue for that then. Thank you
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#1235
No description provided.