Fix crash on startup when not configured - ESP32

This commit is contained in:
Rick Watson 2019-06-07 20:08:46 +01:00
parent 142235c355
commit cf2a20fbd4

View File

@ -10,7 +10,7 @@
#endif
#include <FS.h>
#include <esp_wifi.h>
#include <SecuritySettingsService.h>
#include <WiFiSettingsService.h>
#include <APSettingsService.h>
@ -45,13 +45,22 @@ void setup() {
WiFi.persistent(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);
SPIFFS.begin();
// start security settings service first
// Start security settings service first
securitySettingsService.begin();
// start services
// Start services
ntpSettingsService.begin();
otaSettingsService.begin();
apSettingsService.begin();