浏览代码

rebase and move to nvs_erase_flash

BlueMark Innovations BV 3 年之前
父节点
当前提交
665c772dd9
共有 2 个文件被更改,包括 6 次插入11 次删除
  1. 6 4
      RemoteIDModule/parameters.cpp
  2. 0 7
      RemoteIDModule/parameters.h

+ 6 - 4
RemoteIDModule/parameters.cpp

@@ -147,7 +147,8 @@ void Parameters::Param::set_uint8(uint8_t v) const
     nvs_set_u8(handle, name, *p);
     if (strcmp(name, "TO_DEFAULTS") == 0) {
         if (v == 1) {
-            esp_restart(); //reset, so the init function will set it to factory defaults
+            nvs_flash_erase();
+            esp_restart();
         }
     }
 }
@@ -347,10 +348,11 @@ void Parameters::init(void)
 
     }
     if (g.to_factory_defaults == 1) {
-        reset_to_defaults(); //save to NVS
-        load_defaults();
-        set_by_name_uint8("TO_DEFAULTS", 0);
+        //should not happen, but in case the parameter is still set to 1, erase flash and reboot
+        nvs_flash_erase();
+        esp_restart();
     }
+
     if (g.done_init == 0) {
         set_by_name_uint8("DONE_INIT", 1);
         // setup public keys

+ 0 - 7
RemoteIDModule/parameters.h

@@ -35,15 +35,8 @@ public:
     char wifi_ssid[21] = "";
     char wifi_password[21] = "ArduRemoteID";
     uint8_t wifi_channel = 6;
-<<<<<<< HEAD
-    uint8_t options;
-=======
-<<<<<<< HEAD
->>>>>>> 727a68a (added OPTIONS parameter)
     uint8_t to_factory_defaults = 0;
-=======
     uint8_t options;
->>>>>>> 9a24a3e (added OPTIONS parameter)
     struct {
         char b64_key[64];
     } public_keys[MAX_PUBLIC_KEYS];