Disable auto captive portal when configuration exists (#5)

* only bring up the config portal if there is no config file or
config button is held

* use slightly older version of WiFiManager
This commit is contained in:
liebman 2020-01-04 05:24:35 -08:00 committed by GitHub
parent 6ad9081eaa
commit 437842776c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 3 deletions

View File

@ -21,7 +21,7 @@ lib_deps =
https://github.com/liebman/DLog.git
https://github.com/liebman/DLogNet.git
MicroNMEA@2.0.1
https://github.com/tzapu/WiFiManager.git#development
https://github.com/tzapu/WiFiManager.git#9d6ce13
https://github.com/ThingPulse/esp8266-oled-ssd1306.git#4fa903f
https://github.com/me-no-dev/ESPAsyncUDP.git#b592ac6
https://github.com/arcao/Syslog.git#e9c2eea
@ -29,7 +29,7 @@ lib_deps =
monitor_speed = 76800
[env:default]
platform = espressif8266@2.2.2
platform = espressif8266@2.3.2
[env:staging]
build_flags = ${env.build_flags} -DUSE_CERT_STORE

View File

@ -204,6 +204,9 @@ void setup()
dlog.info(SETUP_TAG, "enabling syslog: '%s:%u'", syslog_host, syslog_port);
dlog.begin(new DLogSyslogWriter(syslog_host, syslog_port, devicename, ESPNTP_SERVER_VERSION));
}
dlog.info(SETUP_TAG, "ESP::FullVersion: %s", ESP.getFullVersion().c_str());
const char* url = wifi.getOTAURL();
const char* fp = wifi.getOTAFP();
if (fp == nullptr)

View File

@ -50,6 +50,10 @@ void WiFiSetup::connect(bool force_config)
{
WiFi.mode(WiFiMode::WIFI_STA);
WiFi.setSleepMode(WIFI_NONE_SLEEP);
dlog.info(TAG, F("connect: disableing captive portal when auto-connecting"));
_wm.setEnableConfigPortal(false); // don't automatically use the captive portal
if (force_config)
{
dlog.info(TAG, F("connect: starting forced config portal!"));
@ -58,7 +62,11 @@ void WiFiSetup::connect(bool force_config)
else
{
dlog.info(TAG, F("connect: auto-connecting"));
_wm.autoConnect(_devicename, NULL);
while (!_wm.autoConnect(_devicename, NULL))
{
dlog.error(TAG, F("connect: not connected! retrying...."));
delay(1000);
}
}
}