|
41 | 41 | #include "obsimprov.h"
|
42 | 42 | #include <WiFi.h>
|
43 | 43 | #include <WiFiMulti.h>
|
| 44 | +#include <esp_wifi.h> |
44 | 45 | #include <esp_arduino_version.h>
|
45 | 46 |
|
46 | 47 | using namespace httpsserver;
|
@@ -698,7 +699,13 @@ bool CreateWifiSoftAP() {
|
698 | 699 | log_i("Initialize SoftAP");
|
699 | 700 | String apName = OBS_ID;
|
700 | 701 | String APPassword = "12345678";
|
701 |
| - softAccOK = WiFi.softAP(apName.c_str(), APPassword.c_str(), 1, 0, 1); |
| 702 | + |
| 703 | + // without this sometimes during firmware upgrades when upgrading esp-idf |
| 704 | + // the wifi SoftAP will not accept clients |
| 705 | + esp_wifi_restore(); |
| 706 | + |
| 707 | + softAccOK = WiFi.softAP(apName.c_str(), APPassword.c_str(), 1, 0, 2); |
| 708 | + |
702 | 709 | delay(2000); // Without delay I've seen the IP address blank
|
703 | 710 | /* Soft AP network parameters */
|
704 | 711 | IPAddress apIP(172, 20, 0, 1);
|
@@ -827,6 +834,13 @@ void startServer(ObsConfig *obsConfig) {
|
827 | 834 | obsDisplay->showTextOnGrid(1, 1,
|
828 | 835 | theObsConfig->getProperty<String>(ObsConfig::PROPERTY_WIFI_SSID));
|
829 | 836 |
|
| 837 | + // We don't really need persistent wifi config from the ESP |
| 838 | + // - it will even potentially leave wifi credentials on ESPs. |
| 839 | + // additionally it can break softAP during ESP-Framework upgrades. |
| 840 | + // The main purpose seems to be to slightly speed up wifi |
| 841 | + // config which is not so relevant for us. |
| 842 | + WiFi.persistent(false); |
| 843 | + |
830 | 844 | tryWiFiConnect();
|
831 | 845 |
|
832 | 846 | if (WiFiClass::status() != WL_CONNECTED) {
|
|
0 commit comments