-
Notifications
You must be signed in to change notification settings - Fork 16
Adding Double Reset Detector As An example To WiFi Manager #1
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
Comments
Thanks. Yes, a flaky power supply could trigger a double reset detection. I hadn't been aware of the characteristics of the ESPS8266's RTC memory. Thanks for the idea, I like it. The device doesn't freeze. Calling drd.loop() in your main loop simply checks whether it's time to remove the flag (SPIFFS file) indicating that the device has recently booted. That's a non-blocking if statement, not a while loop. I do plan on uploading a couple of repositories of my code that use my double reset detector, and your modified version of the WiFiManager. I did have to alter WiFiManager more though, since there was no way to change your mind once you entered configuration mode. The change I made was to set configuration changes to not be persistent while clearing the connection details. (I'm also thinking of changing the default configuration action to be "save and reset" - since I'm always switching channels, resulting in losing my connection, and I'm not too concerned with getting feedback to my browser regarding the configuration change.) |
Thanks for the freezing explanation. I don't understand "there was no way to change your mind once you entered configuration mode". URL http://192.168.4.1/close goes out of configuration mode and can be called prior to changing configuration parameters. If you would fork kentaylor/wifimanager and implement your changes in a way that is easy to incorporate into the existing version that would be great. Perhaps you could have a branch that has minimal changes and another with changes that are harder to integrate into the existing version. Human initiated configuration without a dedicated button is useful. I'd like to add that as an example. |
I've pushed one of my repositories that uses WifiManager and DoubleResetDetector, to https://github.com/datacute/OLED_MQTT My comment was about an older version, before you removed the call to WiFi.disconnect(true) in startConfigPortal. I had spent an evening with no internet access, trying to get double reset detection behaviour I liked, but couldn't enter config mode without it losing my connections settings. When I got home and saw the code that is run within WiFi.disconnect, I discovered I could get the behaviour I liked with this:
|
I see you are using a screen. I am too with this sketch https://github.com/kentaylor/esp8266-weather-station/blob/master/examples/WeatherDHT22ThreeScreensWiFiManager/WeatherDHT22ThreeScreensWiFiManager.ino . An idea I'm trying there is a single multi function button. Long press, short press and double press are 3 different states. I've been do some user testing with this app and found users find WiFi configuration much easier with screen feedback. So you must be still using an old WiFiManager library version. You can see why setting wifi.persistent false keeps the WiFi data at https://github.com/esp8266/Arduino/blob/bbaed29b7e55f15d61eeedbf4d91e0473672222d/libraries/ESP8266WiFi/src/ESP8266WiFiSTA.cpp#L255 . You should try the latest version. I've added a feature set explanation at https://github.com/kentaylor/WiFiManager/blob/master/README.md . One thing which should fix a lot of user confusion is setting the device URL to http://wifi.urremote.com regardless of the URL you call it with. Then when users go to this address on the wrong WiFi network they get advice on what they are doing wrong rather than just a failure. I remain keen to incorporate double reset configuration portal launching using the RTC clock. |
Hi good afternoon, sorry about my english..... When I use the double reset library I have a problem with this code line:
This is all the sketch I use: `#include <DNSServer.h> #include <LiquidCrystal_I2C.h> LiquidCrystal_I2C lcd(0x27, 16, 2); const char* serverThingspeak = "api.thingspeak.com"; DHT dht(DHTpin, DHTTYPE); WiFiClient client; void setup() {
if (!wifiManager.autoConnect()) { //if you get here you have connected to the WiFi Serial.println("local ip");
ThingSpeak.begin(client); void refreshDatos(){ if (millis() > anteriorRefreshDatos + 20000){ float temp = dht.readTemperature(); if (isnan(temp) || isnan(humi)){
void loop() { refreshDatos(); // Check if a client has connected // Read the first line of the request int val;
} // Set GPIO2 according to the request // Prepare the response // Send the response to the client |
Hey, Here is the source (which might need clearing up because it hackathon code): Here is a video for demo and proof: |
Using a double reset to go into WiFi configuration mode which was mentioned at tzapu/WiFiManager#160 (comment) is a great concept. This has the advantage that human intervention is required to initiate WiFi configuration but avoids the requirement of an extra button to initiate WiFi configuration.
I can see two issues though:-
If this was done with RTC memory rather than SPIFFS the record of a reset disappears in the case of a power outage but remains when the reset button is pushed. This would eliminate issue 1.
Perhaps issue 2 wouldn't be too bad if the double reset time was short, say half a second, or maybe the reset flag could be cleared with a timer and callback so it is non blocking.
I'd like to add an example using using a double reset to go into WiFi configuration mode to the version of WiFiManager at https://github.com/kentaylor/WiFiManager, ideally with your help.
The text was updated successfully, but these errors were encountered: