Browse Source

provide OTA defaults (#77)

(cherry picked from commit 438b258546)
master
rjwats 4 years ago
committed by GitHub
parent
commit
59326c6426
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      lib/framework/OTASettingsService.cpp
  2. 1
      lib/framework/OTASettingsService.h

9
lib/framework/OTASettingsService.cpp

@ -25,14 +25,9 @@ void OTASettingsService::onConfigUpdated() {
}
void OTASettingsService::readFromJsonObject(JsonObject& root) {
_enabled = root["enabled"];
_port = root["port"];
_enabled = root["enabled"] | DEFAULT_OTA_ENABLED;
_port = root["port"] | DEFAULT_OTA_PORT;
_password = root["password"] | DEFAULT_OTA_PASSWORD;
// provide defaults
if (_port < 0) {
_port = DEFAULT_OTA_PORT;
}
}
void OTASettingsService::writeToJsonObject(JsonObject& root) {

1
lib/framework/OTASettingsService.h

@ -15,6 +15,7 @@
// Emergency defaults
#define DEFAULT_OTA_PORT 8266
#define DEFAULT_OTA_PASSWORD "esp-react"
#define DEFAULT_OTA_ENABLED true
#define OTA_SETTINGS_FILE "/config/otaSettings.json"
#define OTA_SETTINGS_SERVICE_PATH "/rest/otaSettings"

Loading…
Cancel
Save