From 88b8fcc9e4ca91fef3a669e2ea85c0c7dad9a3d3 Mon Sep 17 00:00:00 2001 From: Max Prokhorov Date: Mon, 24 Jun 2019 00:19:56 +0300 Subject: [PATCH] Start SmartConfig without any networks configured (#1785) --- code/espurna/wifi.ino | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/code/espurna/wifi.ino b/code/espurna/wifi.ino index 95e66763..79878594 100644 --- a/code/espurna/wifi.ino +++ b/code/espurna/wifi.ino @@ -12,6 +12,7 @@ Copyright (C) 2016-2019 by Xose PĂ©rez uint32_t _wifi_scan_client_id = 0; bool _wifi_wps_running = false; bool _wifi_smartconfig_running = false; +bool _wifi_smartconfig_initial = false; uint8_t _wifi_ap_mode = WIFI_AP_FALLBACK; // ----------------------------------------------------------------------------- @@ -73,6 +74,10 @@ void _wifiConfigure() { } } + #if JUSTWIFI_ENABLE_SMARTCONFIG + if (i == 0) _wifi_smartconfig_initial = true; + #endif + jw.enableScan(getSetting("wifiScan", WIFI_SCAN_NETWORKS).toInt() == 1); unsigned char sleep_mode = getSetting("wifiSleep", WIFI_SLEEP_MODE).toInt(); @@ -608,6 +613,10 @@ void wifiSetup() { _wifiInject(); _wifiConfigure(); + #if JUSTWIFI_ENABLE_SMARTCONFIG + if (_wifi_smartconfig_initial) jw.startSmartConfig(); + #endif + // Message callbacks wifiRegister(_wifiCallback); #if WIFI_AP_CAPTIVE