| 11 | static const auto LOGGER = Logger("Preferences"); |
| 12 | |
| 13 | bool Preferences::optBool(const std::string& key, bool& out) const { |
| 14 | nvs_handle_t handle; |
| 15 | if (nvs_open(namespace_, NVS_READWRITE, &handle) != ESP_OK) { |
| 16 | LOGGER.error("Failed to open namespace {}", namespace_); |
| 17 | return false; |
| 18 | } else { |
| 19 | uint8_t out_number; |
| 20 | bool success = nvs_get_u8(handle, key.c_str(), &out_number) == ESP_OK; |
| 21 | nvs_close(handle); |
| 22 | if (success) { |
| 23 | out = (bool)out_number; |
| 24 | } |
| 25 | return success; |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | bool Preferences::optInt32(const std::string& key, int32_t& out) const { |
| 30 | nvs_handle_t handle; |
no test coverage detected