-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is it possible to reconfigure after autoconnect? #263
Comments
In my view @smadds would be better off to use the IOT configurator for setting parameters other than WiFi configuration. Here is an example of configuration on button press and here is an example where the button must be pushed for a few seconds to respond, and in this case you see a sliding bar on a screen. A button library is used that detects short press, long press, double press and, is button pressed now. |
Thanks, Ken. I had a look at IOT Configurator and it looks interesting - albeit putting a dependency for a 3rd-party system. My main problem is not the button, but how to reconfigure the WiFi settings within WM. The best I've come up with so far is to use the WM reset function and then restart the device. This is not ideal, however, as it clears all of the settings - but works as a "restore to factory defaults" type of use case. |
When @smadds says:
I don't understand but that's fine. |
Theres an example called ondemand why not just do that or handle the button press how ever you want to start it. Whats the problem? |
@smadds Did you ever figure out your button press to factory defaults? I am TOTALLY new to programming and have been beating my head against the wall for about a week trying to figure it out. Any help you could give would be great! Tnx |
guys, here s an example that includes logic for a button triggered reset of settings |
or #define TRIGGER_PIN 0
void setup(){
pinMode(TRIGGER_PIN, INPUT_PULLUP);
}
//crappy button handler for testing
//erase config reboot
void handleButton(){
int debounce = 50;
if ( digitalRead(TRIGGER_PIN) == LOW ){
delay(debounce);
if(digitalRead(TRIGGER_PIN) == LOW ){
WiFiManager wifiManager;
wifiManager.resetSettings();
delay(1000);
ESP.reset();
}
}
}
void loop() {
handleButton();
} |
My request was to make the web page reset button more protected by adding a
confirm stage, which Theo has kindly done.
There is a button sequence for clearing locally stored settings - hold
button down for more than 4 seconds. See wiki/button page.
One issue I constantly have is a new install tries to connect to Theo's
mqtt server and this has a very long timeout, during which the system is
unresponsive. Beware if this!!
I usually try to get it into web manager mode first (4 button presses) ,
set the log on to its Wi-Fi access point, then configure the client Wi-Fi
ssid & password. I then look for it showing up on my Dhcp server, go to the
web page and update the mqtt before anything else. Lots of reboots, but
once you are at this stage it's plain sailing.
On 3 Jan 2017 01:19, "jaygrooms" <notifications@github.com> wrote:
@smadds <https://github.com/smadds> Did you ever figure out your button
press to factory defaults? I am TOTALLY new to programming and have been
beating my head against the wall for about a week trying to figure it out.
Any help you could give would be great!
Tnx
-J
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#263 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFBCXmX9gT19AZMV23YZe5eMlpqyNBTdks5rOaIPgaJpZM4LLD-o>
.
|
Interesting, Button hold and mutiple presses are easy to implement,there are many ways to do that. I even wrote this to use a reset button to reset stuff. |
Hi I was wondering how to implement an wifiManager.autoConnect() on Setup and a wifiManager.startConfigPortal() when the button is pressed. |
Just add autoconnect and either 2 wm instances or move the class obj outside of setup |
This exact thing is discussed in another issue i think |
if WiFi.SSID() is an empty string then you could call autoConnect() and on button you call startConfigPortal() |
Great I made it work, both with Master and Dev branch. The problem is that with Dev branch after WiFi configuration I cannot connect to a server client to send data or to update the clock using NTP server. |
Can you elaborate, are you in sta mode or sta + ap mode, |
I checked and in Master, after pressing the button, startConfigPortal crashes after scan networks |
In conclusion, in dev branch, after configuration or after startConfigPortal, connection to servers doesn't work. |
can you add an print mode after exit to see which mode you are in or add WiFi.mode(WIFI_STA); after exiting portal, and see if it starts working ? |
( that crash in master is new also, hmm ) which esp lib ver are you using ? |
#688 |
investigating.. |
hmm I was trying to make a quick test sketch, but I cannot get this ntp example to work at all. |
ah i forgot to start udp nm |
cannot reproduce
added some debugging to lib |
also added ntp example to the dev/ example |
cannot reproduce on staging either |
I am using this library https://github.com/gmag11/NtpClient |
It works adding WiFi.mode(WIFI_STA);!!! Thanks |
What version of esp lib? There is clearly a bug |
SDK Version 2.2.1 |
Also in Dev branch setAPStaticIPConfig does not work! It always goes to 192.168.4.1 *WM: [1] SETTINGS ERASED //gets called when WiFiManager enters configuration mode |
thanks, callback was moved, fixed |
I have added some debugging for this can you test and post debug log ? |
*WM: [2] AccessPoint set password is VALID |
Are you still using callback? Did you try setting it before wm starts? |
Yes still using callback, is it better not to use it? Added settings but still going to 192.168.4.1 |
There is no need to use it, but curious where the bug is. |
Updated development branch but still... |
Doing a wifiManager.resetSettings(); mounted file system And then pressing the button to start config portal Now it is working with 10.0.1.1 but when reset is deleted again it goes to 192.168.4.1 |
Ok well there is no callback if already connected so probably always set config first |
Even adding setAPStaticIPConfig first |
same output ? |
Yes same output, even if I delete callback and add configuration first. |
Ok sorry this is ap sta config , so different issue, ill try to debug today |
@rodri16 can you create a new issue for this and fill out the info, I want to track this seperately this is getting confusing. You clearly have "softAPConfig failed" so this is either a sketch issue or a esp bug or wrong mode in wm before setting config. |
Implementation using the double reset library: |
This is such a great library. I cannot thank you enough for the time it has saved.
Can I ask how to force a reconfigure after using autoconnect? I read in your docs:
I would like to give users the opportunity to reconfigure some of the parameters (including the additional ones I have created), even if the unit has connected to wifi. I'd like to look for a continuous button press for a few seconds to trigger the config mode.
The text was updated successfully, but these errors were encountered: