mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2026-01-29 18:19:09 +03:00
fix setting default version
This commit is contained in:
@@ -96,9 +96,7 @@ StateUpdateResult WebSettings::update(JsonObject root, WebSettings & settings) {
|
|||||||
std::vector<int8_t> system_gpios;
|
std::vector<int8_t> system_gpios;
|
||||||
EMSESP::system_.make_snapshot_gpios(used_gpios, system_gpios);
|
EMSESP::system_.make_snapshot_gpios(used_gpios, system_gpios);
|
||||||
|
|
||||||
reset_flags();
|
settings.version = root["version"] | EMSESP_APP_VERSION; // save the version, we use it later in System::check_upgrade()
|
||||||
|
|
||||||
settings.version = root["version"] | EMSESP_DEFAULT_VERSION; // save the version, we use it later in System::check_upgrade()
|
|
||||||
settings.board_profile = root["board_profile"] | EMSESP_DEFAULT_BOARD_PROFILE;
|
settings.board_profile = root["board_profile"] | EMSESP_DEFAULT_BOARD_PROFILE;
|
||||||
|
|
||||||
// get current values that are related to the board profile
|
// get current values that are related to the board profile
|
||||||
@@ -113,6 +111,8 @@ StateUpdateResult WebSettings::update(JsonObject root, WebSettings & settings) {
|
|||||||
settings.eth_clock_mode = root["eth_clock_mode"];
|
settings.eth_clock_mode = root["eth_clock_mode"];
|
||||||
settings.led_type = root["led_type"]; // 1 = RGB-LED
|
settings.led_type = root["led_type"]; // 1 = RGB-LED
|
||||||
|
|
||||||
|
reset_flags();
|
||||||
|
|
||||||
// see if the user has changed the board profile
|
// see if the user has changed the board profile
|
||||||
// this will set: led_gpio, dallas_gpio, rx_gpio, tx_gpio, pbutton_gpio, phy_type, eth_power, eth_phy_addr, eth_clock_mode, led_type
|
// this will set: led_gpio, dallas_gpio, rx_gpio, tx_gpio, pbutton_gpio, phy_type, eth_power, eth_phy_addr, eth_clock_mode, led_type
|
||||||
// this will always run when EMS-ESP starts since original_settings{} is empty
|
// this will always run when EMS-ESP starts since original_settings{} is empty
|
||||||
@@ -307,6 +307,7 @@ StateUpdateResult WebSettings::update(JsonObject root, WebSettings & settings) {
|
|||||||
|
|
||||||
// save the settings if changed from the webUI
|
// save the settings if changed from the webUI
|
||||||
// if we encountered an invalid GPIO, rollback changes and don't save settings, and report the error to WebUI
|
// if we encountered an invalid GPIO, rollback changes and don't save settings, and report the error to WebUI
|
||||||
|
// without a restart
|
||||||
if (!have_valid_gpios) {
|
if (!have_valid_gpios) {
|
||||||
// replace settings with original settings
|
// replace settings with original settings
|
||||||
settings = original_settings;
|
settings = original_settings;
|
||||||
@@ -320,7 +321,8 @@ StateUpdateResult WebSettings::update(JsonObject root, WebSettings & settings) {
|
|||||||
// save the setting internally, for reference later
|
// save the setting internally, for reference later
|
||||||
EMSESP::system_.store_settings(settings);
|
EMSESP::system_.store_settings(settings);
|
||||||
|
|
||||||
if (has_flags(WebSettings::ChangeFlags::RESTART)) {
|
// and finally always write to the settings file
|
||||||
|
if (has_flags(ChangeFlags::RESTART)) {
|
||||||
return StateUpdateResult::CHANGED_RESTART;
|
return StateUpdateResult::CHANGED_RESTART;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user