mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 00:09:51 +03:00
skip if CUSTOM
This commit is contained in:
@@ -86,9 +86,11 @@ void WebSettings::read(WebSettings & settings, JsonObject root) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// call on initialization and also when settings are updated/saved via web or console
|
// call on initialization and also when settings are updated/saved via web or console
|
||||||
|
// note, settings is empty when the service starts
|
||||||
StateUpdateResult WebSettings::update(JsonObject root, WebSettings & settings) {
|
StateUpdateResult WebSettings::update(JsonObject root, WebSettings & settings) {
|
||||||
// make a copy of the settings to compare to later
|
// make a copy of the settings to compare to later
|
||||||
WebSettings original_settings = settings;
|
const WebSettings original_settings(settings);
|
||||||
|
|
||||||
reset_flags();
|
reset_flags();
|
||||||
|
|
||||||
settings.version = root["version"] | EMSESP_DEFAULT_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()
|
||||||
@@ -113,9 +115,9 @@ StateUpdateResult WebSettings::update(JsonObject root, WebSettings & settings) {
|
|||||||
settings.board_profile.c_str());
|
settings.board_profile.c_str());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// TODO: make sure board profile is loaded when EMS-ESP starts. it will because original_settings.board_profile is empty when EMS-ESP starts
|
|
||||||
// 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
|
||||||
if (original_settings.board_profile != settings.board_profile) {
|
if (original_settings.board_profile != settings.board_profile) {
|
||||||
set_board_profile(settings);
|
set_board_profile(settings);
|
||||||
add_flags(ChangeFlags::RESTART);
|
add_flags(ChangeFlags::RESTART);
|
||||||
@@ -356,8 +358,6 @@ void WebSettingsService::onUpdate() {
|
|||||||
|
|
||||||
void WebSettingsService::begin() {
|
void WebSettingsService::begin() {
|
||||||
_fsPersistence.readFromFS();
|
_fsPersistence.readFromFS();
|
||||||
|
|
||||||
WebSettings::reset_flags();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebSettingsService::save() {
|
void WebSettingsService::save() {
|
||||||
@@ -413,6 +413,12 @@ void WebSettings::set_board_profile(WebSettings & settings) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if it's CUSTOM no need to load the board profile from the settings
|
||||||
|
// as it's already set
|
||||||
|
if (settings.board_profile == "CUSTOM") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// load the board profile into the data vector
|
// load the board profile into the data vector
|
||||||
// 0=led, 1=dallas, 2=rx, 3=tx, 4=button, 5=phy_type, 6=eth_power, 7=eth_phy_addr, 8=eth_clock_mode, 9=led_type
|
// 0=led, 1=dallas, 2=rx, 3=tx, 4=button, 5=phy_type, 6=eth_power, 7=eth_phy_addr, 8=eth_clock_mode, 9=led_type
|
||||||
std::vector<int8_t> data(10, 255); // initialize with 255 for all values
|
std::vector<int8_t> data(10, 255); // initialize with 255 for all values
|
||||||
|
|||||||
Reference in New Issue
Block a user