added application setting 'disable factory' Feature request->Button anti tampering mode

Fixes #3150
This commit is contained in:
proddy
2026-07-26 13:34:15 +02:00
parent e584adaa07
commit 2bef33f81a
25 changed files with 64 additions and 8 deletions
+12
View File
@@ -677,6 +677,7 @@ void System::store_settings(WebSettings & settings) {
locale_ = settings.locale;
system_name_ = settings.system_name;
developer_mode_ = settings.developer_mode;
disable_reset_ = settings.disable_reset;
}
// Starts up core services
@@ -761,6 +762,10 @@ void System::button_OnLongPress(PButton & b) {
// button indefinite press
void System::button_OnVLongPress(PButton & b) {
if (EMSESP::system_.disable_reset()) {
LOG_NOTICE("Factory reset disabled");
return;
}
LOG_NOTICE("Button pressed - very long press - perform factory reset");
EMSESP::led_.start_led_fast_flash(5); // Start LED flash timer for 5 seconds
}
@@ -2646,6 +2651,7 @@ bool System::command_info(const char * value, const int8_t id, JsonObject output
node["modbusEnabled"] = settings.modbus_enabled;
node["forceHeatingOff"] = settings.boiler_heatingoff;
node["developerMode"] = settings.developer_mode;
node["disableReset"] = settings.disable_reset;
});
// Devices - show EMS devices if we have any
@@ -2870,6 +2876,12 @@ bool System::command_txpause(const char * value, const int8_t id) {
// format command - factory reset, removing all config files
bool System::command_format(const char * value, const int8_t id) {
if (EMSESP::system_.disable_reset()) {
LOG_NOTICE("Factory reset disabled");
return false;
}
#if !defined(EMSESP_STANDALONE) && !defined(EMSESP_TEST)
// don't really format the filesystem in test or standalone mode
if (LittleFS.format()) {