provide OTA defaults (#77)
(cherry picked from commit 438b2585463e902b6e9710ae26c3aea4fe64928d)
This commit is contained in:
parent
bcfeef8004
commit
59326c6426
@ -25,14 +25,9 @@ void OTASettingsService::onConfigUpdated() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void OTASettingsService::readFromJsonObject(JsonObject& root) {
|
void OTASettingsService::readFromJsonObject(JsonObject& root) {
|
||||||
_enabled = root["enabled"];
|
_enabled = root["enabled"] | DEFAULT_OTA_ENABLED;
|
||||||
_port = root["port"];
|
_port = root["port"] | DEFAULT_OTA_PORT;
|
||||||
_password = root["password"] | DEFAULT_OTA_PASSWORD;
|
_password = root["password"] | DEFAULT_OTA_PASSWORD;
|
||||||
|
|
||||||
// provide defaults
|
|
||||||
if (_port < 0) {
|
|
||||||
_port = DEFAULT_OTA_PORT;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OTASettingsService::writeToJsonObject(JsonObject& root) {
|
void OTASettingsService::writeToJsonObject(JsonObject& root) {
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
// Emergency defaults
|
// Emergency defaults
|
||||||
#define DEFAULT_OTA_PORT 8266
|
#define DEFAULT_OTA_PORT 8266
|
||||||
#define DEFAULT_OTA_PASSWORD "esp-react"
|
#define DEFAULT_OTA_PASSWORD "esp-react"
|
||||||
|
#define DEFAULT_OTA_ENABLED true
|
||||||
|
|
||||||
#define OTA_SETTINGS_FILE "/config/otaSettings.json"
|
#define OTA_SETTINGS_FILE "/config/otaSettings.json"
|
||||||
#define OTA_SETTINGS_SERVICE_PATH "/rest/otaSettings"
|
#define OTA_SETTINGS_SERVICE_PATH "/rest/otaSettings"
|
||||||
|
Loading…
Reference in New Issue
Block a user