logo elektroda
logo elektroda
X
logo elektroda

How do I save an empty password in the code? Wi-Fi configuration.

pier 561 13
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 19736135
    pier
    Level 24  
    Hi.
    I have a program that allows me to set up a wifi connection from a browser. Sketch works fine but I am fine with configuring without a wifi password for some reason. I have corrected the program to the point that it ingests the configuration without a password but after that esp crashes and I have to give it a manual reset. After that it works fine. Probably the program crashes on trying to save a blank password. I have added comments in the code where I made the changes.
    I would not like to throw away the original functionality just to add the ability to save a blank password.
    Can you suggest a solution?

    Code: C / C++
    Log in, to see the code
    .
  • ADVERTISEMENT
  • #2 19736727
    khoam
    Level 42  
    pier wrote:
    I wouldn't want to throw away the original functionality just add the ability to save a blank password.
    .
    If it's going to be "blank", why save? Are you referring to logging into an open WiFi network?
  • ADVERTISEMENT
  • #3 19736737
    pier
    Level 24  
    khoam wrote:
    pier wrote:
    I wouldn't want to throw away the original functionality just add the ability to save an empty password.
    .
    If it's going to be "blank", why save it? Are you talking about logging into an open WiFi network?
    .
    You have to save something because otherwise the "configurator" doesn't execute. This is how I want to log in to the open network, for now at least but this will change in the future.
  • #4 19736757
    khoam
    Level 42  
    Insert after line:
    Code: C / C++
    Log in, to see the code
    .
    in addition:
    Code: C / C++
    Log in, to see the code
    .
    What value is showing up?
  • #5 19736904
    pier
    Level 24  
    khoam wrote:
    Insert after line:
    Code: C / C++
    Log in, to see the code
    .
    in addition:
    Code: C / C++
    Log in, to see the code
    .
    What value is shown:
    .

    Value = 0

    This is the end of the record from the monitor serial:
    Code: C / C++
    Log in, to see the code
    .
  • #6 19737431
    khoam
    Level 42  
    Strange, but it looks as if the WTD is triggered due to insufficient current capacity of the ESP supply and a drop in supply voltage.
  • #7 19737436
    pier
    Level 24  
    khoam wrote:
    Strange, but it looks like the WTD is being triggered due to insufficient current capacity of the ESP power supply and a drop in supply voltage.
    .
    And wait wait wait because I am powering from the adapter already switching on the battery power.

    But no, correct power supply doesn't change anything. Still the same serial message and crashes.
    After the sequence turn off on correctly connects to the open network.
  • ADVERTISEMENT
  • #8 19737594
    khoam
    Level 42  
    Instead of EEPROM.commit() type:
    Code: C / C++
    Log in, to see the code
    .
    I'm curious if it's on commit that it crashes. A properly executed commit returns true, so it should display "1".
  • #9 19737615
    pier
    Level 24  
    khoam wrote:
    Instead of EEPROM.commit() type:
    Code: C / C++
    Log in, to see the code
    .
    I'm curious if it's on commit that it crashes. A properly executed commit returns true, so it should display "1".


    It displays "1⸮"
  • #10 19737625
    khoam
    Level 42  
    This next command that can trigger WTD is just ESP.reset() :) .
    Maybe try using ESP.restart().

    Added after 9 [minutes]:

    For the sake of argument, before ESP.reset() or ESP.restart() there should be an EEPROM.end() command
  • #11 19737639
    pier
    Level 24  
    khoam wrote:
    This next command that can trigger WTD is just ESP.reset() :) .
    Maybe try using ESP.restart().


    Didn't help. WDT reset twice and it hangs.

    Code: C / C++
    Log in, to see the code
    .

    I think I'll let it go. For testing it will be what it is and then I'll secure the network anyway because I'll have neighbours eventually.
  • ADVERTISEMENT
  • #12 19737641
    khoam
    Level 42  
    For the sake of order, before ESP.reset() or ESP.restart() there should be an EEPROM.end() command and a WiFi stop.
  • #13 19739530
    pier
    Level 24  
    khoam wrote:
    For the record, before ESP.reset() or ESP.restart() there should be an EEPROM.end() command and a WiFi stop.
    .

    Khoam but before my code modification these commands were not there and everything worked as expected.
  • #14 19739535
    khoam
    Level 42  
    pier wrote:
    but before my code modification these commands were not there and everything worked as expected.
    .
    After giving these additional commands I suggested, does this problem continue?

Topic summary

The discussion revolves around a programming issue related to saving an empty password for Wi-Fi configuration using an ESP8266 module. The user has modified their code to accept a blank password for connecting to an open Wi-Fi network but encounters crashes after attempting to save this configuration. Responses suggest troubleshooting steps, including checking EEPROM commit behavior, ensuring proper power supply, and using commands like ESP.reset() and ESP.restart(). The user reports persistent issues despite these adjustments and considers reverting to a secured network in the future.
Summary generated by the language model.
ADVERTISEMENT