working basic OTA

This commit is contained in:
Siwat Sirichai 2024-01-15 21:56:07 +07:00
parent df09914bd3
commit a2fe4a3d67
5 changed files with 207 additions and 195 deletions

View file

@ -86,12 +86,13 @@ void ESPMegaDisplayOTA::otaUpdateWriteHandler(AsyncWebServerRequest *request, Js
}
// Write the data to the display
display->writeUpdate(data_array, size);
request->send(200, "application/json", "{\"status\": \"success\"}");
request->send(200, "application/json", "{\"status\": \"success\",\"bytes_written\": "+String(this->display->getOtaBytesWritten())+"}");
}
void ESPMegaDisplayOTA::otaUpdateEndHandler(AsyncWebServerRequest *request, JsonVariant &json) {
this->webServer->checkAuthentication(request);
display->endUpdate();
request->send(200, "application/json", "{\"status\": \"success\"}");
esp_restart();
}
void ESPMegaDisplayOTA::displayWebPageHandler(AsyncWebServerRequest *request) {