From 3d70e8c1e66e52a8f2be7517eaca132be9860b70 Mon Sep 17 00:00:00 2001 From: proddy Date: Tue, 23 Dec 2025 19:32:25 +0100 Subject: [PATCH] clear_snapshot_gpios --- src/core/system.cpp | 8 ++++++++ src/core/system.h | 1 + src/web/WebSettingsService.cpp | 2 ++ 3 files changed, 11 insertions(+) diff --git a/src/core/system.cpp b/src/core/system.cpp index c0a1e15f9..08fe00a66 100644 --- a/src/core/system.cpp +++ b/src/core/system.cpp @@ -2819,6 +2819,14 @@ void System::restore_snapshot_gpios() { for (const auto & gpio : snapshot_valid_system_gpios_) { valid_system_gpios_.push_back(gpio); } + + // clear the snapshot + clear_snapshot_gpios(); +} + +void System::clear_snapshot_gpios() { + snapshot_used_gpios_.clear(); + snapshot_valid_system_gpios_.clear(); } } // namespace emsesp diff --git a/src/core/system.h b/src/core/system.h index 154e4ee3e..9705f7135 100644 --- a/src/core/system.h +++ b/src/core/system.h @@ -157,6 +157,7 @@ class System { static bool load_board_profile(std::vector & data, const std::string & board_profile); static void make_snapshot_gpios(); static void restore_snapshot_gpios(); + static void clear_snapshot_gpios(); static bool readCommand(const char * data); diff --git a/src/web/WebSettingsService.cpp b/src/web/WebSettingsService.cpp index 3705a7188..3564feeda 100644 --- a/src/web/WebSettingsService.cpp +++ b/src/web/WebSettingsService.cpp @@ -322,6 +322,8 @@ StateUpdateResult WebSettings::update(JsonObject root, WebSettings & settings) { return StateUpdateResult::ERROR; // don't save the settings if the GPIOs are invalid } + // clean up snapshot of the GPIOs + EMSESP::system_.clear_snapshot_gpios(); // save the setting internally, for reference later EMSESP::system_.store_settings(settings);