Moved settings from preprocessor directives to variables. Also added a way to (for now only) display them via HTTP server.

This commit is contained in:
2019-10-02 06:13:55 +02:00
parent 382631d7d7
commit 3f6d4cb0be
16 changed files with 154 additions and 79 deletions

View File

@ -42,7 +42,7 @@ void http_server_setup() {
PGM_P text_plain = PSTR("text/plain");
http_server.on("/", HTTP_GET, [&](){
LOGln("HTTP * GET /");
String message = "<html><head><title>Pitrix</title></head><body><h1>Pitrix</h1><p>Known animations:</p>";
String message = "<html><head><title>Pitrix</title></head><body><h1>Pitrix</h1><a href='/settings'>Settings</a><p>Known animations:</p>";
if (!SPIFFS.begin()) {
message += "<strong>No SPIFFS file system found.</strong>";
} else {
@ -57,6 +57,18 @@ void http_server_setup() {
message += "</body></html>";
http_server.send(200, "text/html", message);
});
http_server.on("/settings", HTTP_GET, [&]() {
String message = "<html><head><title>Pitrix settings</title></head><body><h1>Pitrix settings</h1><a href='/'>Back to main page</a><table>";
for (int i=0; i<all_settings_size; i++) {
message += "<tr><td>";
message += all_settings[i].name;
message += "</td><td>";
message += *all_settings[i].value;
message += "</td></tr>";
}
message += "</table></body></html>";
http_server.send(200, "text/html", message);
});
http_server.on("/delete", HTTP_GET, [&]() {
LOGln("HTTP * GET /delete");
if (http_server.args()==0) {