MCPcopy Create free account
hub / github.com/TactilityProject/Tactility / optBool

Method optBool

Tactility/Source/PreferencesEsp.cpp:13–27  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11static const auto LOGGER = Logger("Preferences");
12
13bool 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
29bool Preferences::optInt32(const std::string& key, int32_t& out) const {
30 nvs_handle_t handle;

Callers 2

isCompletedFunction · 0.45
onCreateMethod · 0.45

Calls 1

errorMethod · 0.80

Tested by

no test coverage detected