Removed -DOLD_NVS; Implemented dump-nvs for new config system

This commit is contained in:
CommanderRedYT
2022-01-18 09:07:27 +01:00
parent 777134eaf1
commit 3ccccc81a9
8 changed files with 9 additions and 12 deletions

View File

@ -73,7 +73,6 @@ set(BOBBYCAR_BUILDFLAGS
-DPINS_LEDSTRIP=33
-DHEAP_LRGST_CRASH_TEXT_FIX
-DLEDSTRIP_WRONG_DIRECTION
-DOLD_NVS
-DFEATURE_DNS_NS
-DFEATURE_ESPNOW
)

View File

@ -66,7 +66,6 @@ set(BOBBYCAR_BUILDFLAGS
-DPINS_LEDSTRIP=33
-DHEAP_LRGST_CRASH_TEXT_FIX
# -DLEDSTRIP_WRONG_DIRECTION
-DOLD_NVS
-DFEATURE_DNS_NS
-DFEATURE_IS_MIR_EGAL_OB_DER_WEBSERVER_KORREKT_ARBEITET
-DFEATURE_ESPNOW

View File

@ -64,7 +64,6 @@ set(BOBBYCAR_BUILDFLAGS
-DPINS_LEDSTRIP=26
# -DHEAP_LRGST_CRASH_TEXT_FIX
# -DLEDSTRIP_WRONG_DIRECTION
-DOLD_NVS
-DFEATURE_DNS_NS
# -DSWITCH_BLINK
# -DFEATURE_IS_MIR_EGAL_OB_DER_WEBSERVER_KORREKT_ARBEITET

View File

@ -63,7 +63,6 @@ set(BOBBYCAR_BUILDFLAGS
-DFEATURE_WIRELESS_CONFIG
-DPINS_LEDSTRIP=33
# -DLEDSTRIP_WRONG_DIRECTION
-DOLD_NVS
-DFEATURE_DNS_NS
-DFEATURE_IS_MIR_EGAL_OB_DER_WEBSERVER_KORREKT_ARBEITET
)

View File

@ -73,7 +73,6 @@ set(BOBBYCAR_BUILDFLAGS
-DPINS_LEDSTRIP=33
# -DHEAP_LRGST_CRASH_TEXT_FIX
# -DLEDSTRIP_WRONG_DIRECTION
-DOLD_NVS
# -DFEATURE_DNS_NS
# -DSWITCH_BLINK
-DFEATURE_IS_MIR_EGAL_OB_DER_WEBSERVER_KORREKT_ARBEITET

View File

@ -64,7 +64,6 @@ set(BOBBYCAR_BUILDFLAGS
-DPINS_LEDSTRIP=33
# -DHEAP_LRGST_CRASH_TEXT_FIX
# -DLEDSTRIP_WRONG_DIRECTION
-DOLD_NVS
-DFEATURE_DNS_NS
# -DSWITCH_BLINK
-DFEATURE_IS_MIR_EGAL_OB_DER_WEBSERVER_KORREKT_ARBEITET

View File

@ -25,9 +25,7 @@
#endif
#include "webserver_settings.h"
#include "webserver_newsettings.h"
#ifdef OLD_NVS
#include "webserver_dumpnvs.h"
#endif
#include "globals.h"
#include "newsettings.h"
@ -86,9 +84,7 @@ void initWebserver()
httpd_uri_t { .uri = "/newSettings", .method = HTTP_GET, .handler = webserver_newSettings_handler, .user_ctx = NULL },
httpd_uri_t { .uri = "/saveNewSettings", .method = HTTP_GET, .handler = webserver_saveNewSettings_handler, .user_ctx = NULL },
httpd_uri_t { .uri = "/resetNewSettings", .method = HTTP_GET, .handler = webserver_resetNewSettings_handler, .user_ctx = NULL },
#ifdef OLD_NVS
httpd_uri_t { .uri = "/dumpnvs", .method = HTTP_GET, .handler = webserver_dump_nvs_handler, .user_ctx = NULL },
#endif
httpd_uri_t { .uri = "/check", .method = HTTP_GET, .handler = webserver_status_handler, .user_ctx = NULL },
})
{

View File

@ -146,6 +146,14 @@ esp_err_t webserver_dump_nvs_handler(httpd_req_t *req)
}
}
DynamicJsonDocument doc(6144);
JsonObject settings = doc.createNestedObject("settings");
configs.callForEveryConfig([&](auto &config){
const std::string_view nvsName{config.nvsName()};
showInputForSetting(nvsName, config.value, settings);
});
const auto profile = settingsPersister.currentlyOpenProfileIndex();
const auto switchBackProfile = profile ? int(*profile) : 0;
@ -165,10 +173,9 @@ esp_err_t webserver_dump_nvs_handler(httpd_req_t *req)
const auto profile_str = cur_profile ? std::to_string(*cur_profile) : "-";
JsonObject profile = profiles.createNestedObject(profile_str);
JsonObject profile_settings = profile.createNestedObject("settings");
profileSettings.executeForEveryProfileSetting([&](const char *key, auto &value){
showInputForSetting(key, value, profile_settings);
showInputForSetting(key, value, profile);
});
}