mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2026-01-26 08:39:09 +03:00
Merge branch 'emsesp:dev' into dev
This commit is contained in:
@@ -2447,9 +2447,11 @@ bool System::load_board_profile(std::vector<int8_t> & data, const std::string &
|
||||
} else if (board_profile == "S2MINI") {
|
||||
data = {15, 7, 11, 12, 0, PHY_type::PHY_TYPE_NONE, 0, 0, 0, 0}; // Lolin S2 Mini
|
||||
// https://www.wemos.cc/en/latest/s2/s2_mini.html
|
||||
set_valid_system_gpios();
|
||||
} else if (board_profile == "S3MINI") {
|
||||
data = {17, 18, 8, 5, 0, PHY_type::PHY_TYPE_NONE, 0, 0, 0, 0}; // Liligo S3
|
||||
// https://lilygo.cc/products/t7-s3
|
||||
set_valid_system_gpios();
|
||||
} else if (board_profile == "S32S3") {
|
||||
data = {2, 18, 5, 17, 0, PHY_type::PHY_TYPE_NONE, 0, 0, 0, 0}; // BBQKees Gateway S3
|
||||
valid_system_gpios_ = {0, 2, 5, 17, 18};
|
||||
|
||||
@@ -113,6 +113,13 @@ StateUpdateResult WebSettings::update(JsonObject root, WebSettings & settings) {
|
||||
|
||||
reset_flags();
|
||||
|
||||
// before loading new board profile free old gpios from used list to allow remapping
|
||||
EMSESP::system_.remove_gpio(original_settings.led_gpio);
|
||||
EMSESP::system_.remove_gpio(original_settings.dallas_gpio);
|
||||
EMSESP::system_.remove_gpio(original_settings.pbutton_gpio);
|
||||
EMSESP::system_.remove_gpio(original_settings.rx_gpio);
|
||||
EMSESP::system_.remove_gpio(original_settings.tx_gpio);
|
||||
|
||||
// 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 always run when EMS-ESP starts since original_settings{} is empty
|
||||
@@ -149,13 +156,6 @@ StateUpdateResult WebSettings::update(JsonObject root, WebSettings & settings) {
|
||||
}
|
||||
}
|
||||
|
||||
// free old gpios from used list to allow remapping
|
||||
EMSESP::system_.remove_gpio(original_settings.led_gpio);
|
||||
EMSESP::system_.remove_gpio(original_settings.dallas_gpio);
|
||||
EMSESP::system_.remove_gpio(original_settings.pbutton_gpio);
|
||||
EMSESP::system_.remove_gpio(original_settings.rx_gpio);
|
||||
EMSESP::system_.remove_gpio(original_settings.tx_gpio);
|
||||
|
||||
// if any of the GPIOs have changed and re-validate them
|
||||
bool have_valid_gpios = true;
|
||||
|
||||
@@ -308,9 +308,9 @@ StateUpdateResult WebSettings::update(JsonObject root, WebSettings & settings) {
|
||||
}
|
||||
|
||||
// save the settings if changed from the webUI
|
||||
// if we encountered an invalid GPIO on same boardprofile, rollback changes and don't save settings,
|
||||
// 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 && original_settings.board_profile == settings.board_profile) {
|
||||
if (!have_valid_gpios) {
|
||||
// replace settings with original settings
|
||||
settings = original_settings;
|
||||
EMSESP::system_.restore_snapshot_gpios(used_gpios, system_gpios);
|
||||
|
||||
Reference in New Issue
Block a user