mirror of
https://github.com/HendrikRauh/dmx-interface.git
synced 2025-07-05 05:38:54 +00:00
Merge pull request #7 from HendrikRauh/DMX-18-reset-config
Dmx 18 reset config
This commit is contained in:
commit
8b47daceb4
5 changed files with 59 additions and 4 deletions
11
src/main.cpp
11
src/main.cpp
|
@ -84,10 +84,21 @@ void setup()
|
|||
server.on("/config", HTTP_GET, [](AsyncWebServerRequest *request)
|
||||
{ onGetConfig(request); });
|
||||
|
||||
server.on("/config", HTTP_DELETE, [](AsyncWebServerRequest *request)
|
||||
{
|
||||
config.begin("dmx", false);
|
||||
config.clear();
|
||||
config.end();
|
||||
// respond with default config
|
||||
onGetConfig(config, request);
|
||||
|
||||
ESP.restart(); });
|
||||
|
||||
server.onRequestBody([](AsyncWebServerRequest *request, uint8_t *data, size_t len, size_t index, size_t total)
|
||||
{
|
||||
if (request->url() == "/config" && request->method() == HTTP_PUT) {
|
||||
onPutConfig(request, data, len, index, total);
|
||||
ESP.restart();
|
||||
} });
|
||||
|
||||
delay(1000);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue