| 87 | } |
| 88 | |
| 89 | void Preferences::putBool(const std::string& key, bool value) { |
| 90 | nvs_handle_t handle; |
| 91 | if (nvs_open(namespace_, NVS_READWRITE, &handle) == ESP_OK) { |
| 92 | if (nvs_set_u8(handle, key.c_str(), value) != ESP_OK) { |
| 93 | LOGGER.error("Failed to set {}:{}", namespace_, key); |
| 94 | } else if (nvs_commit(handle) != ESP_OK) { |
| 95 | LOGGER.error("Failed to commit {}:{}", namespace_, key); |
| 96 | } |
| 97 | nvs_close(handle); |
| 98 | } else { |
| 99 | LOGGER.error("Failed to open namespace {}", namespace_); |
| 100 | } |
| 101 | } |
| 102 | |
| 103 | void Preferences::putInt32(const std::string& key, int32_t value) { |
| 104 | nvs_handle_t handle; |
no test coverage detected