| 129 | } |
| 130 | |
| 131 | void Preferences::putString(const std::string& key, const std::string& text) { |
| 132 | nvs_handle_t handle; |
| 133 | if (nvs_open(namespace_, NVS_READWRITE, &handle) == ESP_OK) { |
| 134 | if (nvs_set_str(handle, key.c_str(), text.c_str()) != ESP_OK) { |
| 135 | LOGGER.error("Failed to set {}:{}", namespace_, key.c_str()); |
| 136 | } else if (nvs_commit(handle) != ESP_OK) { |
| 137 | LOGGER.error("Failed to commit {}:{}", namespace_, key); |
| 138 | } |
| 139 | nvs_close(handle); |
| 140 | } else { |
| 141 | LOGGER.error("Failed to open namespace {}", namespace_); |
| 142 | } |
| 143 | } |
| 144 | |
| 145 | } // namespace |
| 146 |
no test coverage detected