连接wifi时按下boot重置wifi

This commit is contained in:
Terrence
2024-11-25 02:27:21 +08:00
parent 472219d5bf
commit b07ec1a148
10 changed files with 49 additions and 6 deletions

View File

@@ -63,3 +63,19 @@ void Settings::SetInt(const std::string& key, int32_t value) {
ESP_LOGW(TAG, "Namespace %s is not open for writing", ns_.c_str());
}
}
void Settings::EraseKey(const std::string& key) {
if (read_write_) {
ESP_ERROR_CHECK(nvs_erase_key(nvs_handle_, key.c_str()));
} else {
ESP_LOGW(TAG, "Namespace %s is not open for writing", ns_.c_str());
}
}
void Settings::EraseAll() {
if (read_write_) {
ESP_ERROR_CHECK(nvs_erase_all(nvs_handle_));
} else {
ESP_LOGW(TAG, "Namespace %s is not open for writing", ns_.c_str());
}
}