mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
add back factory reset after long button press - we missed in pull/1969
This commit is contained in:
@@ -512,13 +512,16 @@ void System::button_OnDblClick(PButton & b) {
|
|||||||
|
|
||||||
// button long press
|
// button long press
|
||||||
void System::button_OnLongPress(PButton & b) {
|
void System::button_OnLongPress(PButton & b) {
|
||||||
LOG_NOTICE("Button pressed - long press - restart from factory/boot partition");
|
LOG_NOTICE("Button pressed - long press - perform factory reset");
|
||||||
EMSESP::system_.system_restart("boot"); // this is default when first installed. it may contain the bootloader code.
|
#ifndef EMSESP_STANDALONE
|
||||||
|
System::command_format(nullptr, 0);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// button indefinite press - do nothing for now
|
// button indefinite press - do nothing for now
|
||||||
void System::button_OnVLongPress(PButton & b) {
|
void System::button_OnVLongPress(PButton & b) {
|
||||||
LOG_NOTICE("Button pressed - very long press");
|
LOG_NOTICE("Button pressed - very long press - restart from factory/boot partition");
|
||||||
|
EMSESP::system_.system_restart("boot");
|
||||||
}
|
}
|
||||||
|
|
||||||
// push button
|
// push button
|
||||||
@@ -1920,7 +1923,7 @@ bool System::load_board_profile(std::vector<int8_t> & data, const std::string &
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// format command - factory reset, removing all config fi`les
|
// format command - factory reset, removing all config files
|
||||||
bool System::command_format(const char * value, const int8_t id) {
|
bool System::command_format(const char * value, const int8_t id) {
|
||||||
LOG_INFO("Removing all config files");
|
LOG_INFO("Removing all config files");
|
||||||
#ifndef EMSESP_STANDALONE
|
#ifndef EMSESP_STANDALONE
|
||||||
|
|||||||
@@ -351,10 +351,10 @@ class System {
|
|||||||
static void button_OnDblClick(PButton & b);
|
static void button_OnDblClick(PButton & b);
|
||||||
static void button_OnLongPress(PButton & b);
|
static void button_OnLongPress(PButton & b);
|
||||||
static void button_OnVLongPress(PButton & b);
|
static void button_OnVLongPress(PButton & b);
|
||||||
static constexpr uint32_t BUTTON_Debounce = 40; // Debounce period to prevent flickering when pressing or releasing the button (in ms)
|
static constexpr uint32_t BUTTON_Debounce = 40; // Debounce period to prevent flickering when pressing or releasing the button (in ms)
|
||||||
static constexpr uint32_t BUTTON_DblClickDelay = 250; // Max period between clicks for a double click event (in ms)
|
static constexpr uint32_t BUTTON_DblClickDelay = 250; // Max period between clicks for a double click event (in ms)
|
||||||
static constexpr uint32_t BUTTON_LongPressDelay = 750; // Hold period for a long press event (in ms)
|
static constexpr uint32_t BUTTON_LongPressDelay = 9500; // Hold period for a long press event (in ms) - 10 seconds
|
||||||
static constexpr uint32_t BUTTON_VLongPressDelay = 9000; // Hold period for a very long press event (in ms)
|
static constexpr uint32_t BUTTON_VLongPressDelay = 20000; // Hold period for a very long press event (in ms) - 20 seconds
|
||||||
|
|
||||||
// healthcheck
|
// healthcheck
|
||||||
#ifdef EMSESP_PINGTEST
|
#ifdef EMSESP_PINGTEST
|
||||||
|
|||||||
Reference in New Issue
Block a user