Fix crash on startup when not configured - ESP32
This commit is contained in:
parent
142235c355
commit
cf2a20fbd4
15
src/main.cpp
15
src/main.cpp
@ -10,7 +10,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <FS.h>
|
#include <FS.h>
|
||||||
|
#include <esp_wifi.h>
|
||||||
#include <SecuritySettingsService.h>
|
#include <SecuritySettingsService.h>
|
||||||
#include <WiFiSettingsService.h>
|
#include <WiFiSettingsService.h>
|
||||||
#include <APSettingsService.h>
|
#include <APSettingsService.h>
|
||||||
@ -45,13 +45,22 @@ void setup() {
|
|||||||
WiFi.persistent(false);
|
WiFi.persistent(false);
|
||||||
WiFi.setAutoReconnect(false);
|
WiFi.setAutoReconnect(false);
|
||||||
|
|
||||||
|
#if defined(ESP_PLATFORM)
|
||||||
|
// Init the wifi driver on ESP32
|
||||||
|
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
|
||||||
|
esp_err_t err = esp_wifi_init(&cfg);
|
||||||
|
if(err){
|
||||||
|
log_e("esp_wifi_init %d", err);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
Serial.begin(SERIAL_BAUD_RATE);
|
Serial.begin(SERIAL_BAUD_RATE);
|
||||||
SPIFFS.begin();
|
SPIFFS.begin();
|
||||||
|
|
||||||
// start security settings service first
|
// Start security settings service first
|
||||||
securitySettingsService.begin();
|
securitySettingsService.begin();
|
||||||
|
|
||||||
// start services
|
// Start services
|
||||||
ntpSettingsService.begin();
|
ntpSettingsService.begin();
|
||||||
otaSettingsService.begin();
|
otaSettingsService.begin();
|
||||||
apSettingsService.begin();
|
apSettingsService.begin();
|
||||||
|
Loading…
Reference in New Issue
Block a user