Skip to content
Snippets Groups Projects
Commit ba43e474 authored by fxk8y's avatar fxk8y :spider:
Browse files

Begin using our fancey mutex

parent e481fffb
No related branches found
No related tags found
No related merge requests found
...@@ -39,10 +39,6 @@ namespace SiliconTorch { ...@@ -39,10 +39,6 @@ namespace SiliconTorch {
nvs_flash_init(); nvs_flash_init();
mutex.run([]() {
ESP_LOGE(TAG, "Running inside our ManagedMutex");
});
uint16_t deviceTopicLEN = deviceTopic("").length(); uint16_t deviceTopicLEN = deviceTopic("").length();
auto wrapMessageHandler = [deviceTopicLEN](std::function<void(std::vector<std::string>&, qthing::multipart_message_t)> handler) { auto wrapMessageHandler = [deviceTopicLEN](std::function<void(std::vector<std::string>&, qthing::multipart_message_t)> handler) {
...@@ -81,20 +77,19 @@ namespace SiliconTorch { ...@@ -81,20 +77,19 @@ namespace SiliconTorch {
void NVSExplorer::BullShit() { void NVSExplorer::BullShit() {
ESP_LOGW(TAG, "Scanning 👀"); ESP_LOGW(TAG, "Scanning 👀");
nvs_iterator_t it = nvs_entry_find("nvs", NULL, NVS_TYPE_ANY); mutex.run([&]() {
nvs_iterator_t it = nvs_entry_find("nvs", NULL, NVS_TYPE_ANY);
while (it != NULL) {
nvs_entry_info_t info;
nvs_entry_info(it, &info);
it = nvs_entry_next(it);
ESP_LOGW(TAG, "namespace[ %s ] key[ %s ] type[ %d ]", info.namespace_name, info.key, info.type);
}
while (it != NULL) {
nvs_entry_info_t info;
nvs_entry_info(it, &info);
it = nvs_entry_next(it);
ESP_LOGW(TAG, "namespace[ %s ] key[ %s ] type[ %d ]", info.namespace_name, info.key, info.type);
}
});
} }
...@@ -102,18 +97,19 @@ namespace SiliconTorch { ...@@ -102,18 +97,19 @@ namespace SiliconTorch {
std::set<std::string> keys; std::set<std::string> keys;
mutex.run([&]() {
nvs_iterator_t it = nvs_entry_find("nvs", nameSpace.c_str(), NVS_TYPE_ANY);
nvs_iterator_t it = nvs_entry_find("nvs", nameSpace.c_str(), NVS_TYPE_ANY); while (it != NULL) {
nvs_entry_info_t info;
while (it != NULL) { nvs_entry_info(it, &info);
nvs_entry_info_t info; it = nvs_entry_next(it);
nvs_entry_info(it, &info);
it = nvs_entry_next(it);
ESP_LOGW(TAG, "namespace[ %s ] key[ %s ] type[ %d ]", info.namespace_name, info.key, info.type); // TODO: remove after dev! ESP_LOGW(TAG, "namespace[ %s ] key[ %s ] type[ %d ]", info.namespace_name, info.key, info.type); // TODO: remove after dev!
keys.insert(info.key); keys.insert(info.key);
} }
});
return keys; return keys;
} }
...@@ -123,17 +119,19 @@ namespace SiliconTorch { ...@@ -123,17 +119,19 @@ namespace SiliconTorch {
std::set<std::string> namespaces; std::set<std::string> namespaces;
nvs_iterator_t it = nvs_entry_find("nvs", NULL, NVS_TYPE_ANY); mutex.run([&]() {
nvs_iterator_t it = nvs_entry_find("nvs", NULL, NVS_TYPE_ANY);
while (it != NULL) { while (it != NULL) {
nvs_entry_info_t info; nvs_entry_info_t info;
nvs_entry_info(it, &info); nvs_entry_info(it, &info);
it = nvs_entry_next(it); it = nvs_entry_next(it);
ESP_LOGW(TAG, "namespace[ %s ] key[ %s ] type[ %d ]", info.namespace_name, info.key, info.type); // TODO: remove after dev! ESP_LOGW(TAG, "namespace[ %s ] key[ %s ] type[ %d ]", info.namespace_name, info.key, info.type); // TODO: remove after dev!
namespaces.insert(info.namespace_name); namespaces.insert(info.namespace_name);
} }
});
return namespaces; return namespaces;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment