add config switch

This commit is contained in:
2022-12-23 14:48:47 +01:00
parent 015309f20f
commit 0923c59280
4 changed files with 27 additions and 3 deletions

View File

@ -34,3 +34,24 @@
buffer << std::uppercase << std::setfill('0') << std::setw(2) << std::hex << (int)myConfig.appKey[i];
}
buffer << "\">";
static void handleConfigSave() {
char *arg1 = (char*)server.arg("AppEui").c_str();
Serial.printf("AppEui: %s\n\r", arg1);
parseField(arg1, 1, 8, myConfig.appEui);
if (!configParsingFailed) {
char *arg2 = (char*)server.arg("AppKey").c_str();
Serial.printf("AppKey: %s\n\r", arg2);
parseField(arg2, 2, 16, myConfig.appKey);
}
configSaved = !configParsingFailed;
server.sendHeader("Location", String("/"), true);
server.send(302, "text/plain", "");
}