Add Factory Reset button and switch (#3724)

Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
anatoly-savchenkov
2022-09-12 01:23:46 +03:00
committed by GitHub
parent 790280ace9
commit 9a5f865eea
13 changed files with 198 additions and 3 deletions
+8
View File
@@ -46,6 +46,14 @@ class ESPPreferences {
*/
virtual bool sync() = 0;
/**
* Forget all unsaved changes and re-initialize the permanent preferences storage.
* Usually followed by a restart which moves the system to "factory" conditions
*
* @return true if operation is successful.
*/
virtual bool reset() = 0;
template<typename T, enable_if_t<is_trivially_copyable<T>::value, bool> = true>
ESPPreferenceObject make_preference(uint32_t type, bool in_flash) {
return this->make_preference(sizeof(T), type, in_flash);