Update libs. arduino-esp32, ESPAsyncWebServer, AsyncTCP, ArduinoJson, DHTnew

pull/89/head
Miroslav Pivovarsky 2024-11-20 21:13:53 +01:00
parent cf6af3958f
commit d9394e4c6b
2 changed files with 20 additions and 11 deletions

View File

@ -8,12 +8,12 @@
This project uses other libraries. It is necessary to install them in the arduino IDE.
- Library - License - Version - Link
- ESPAsyncWebServer - LGPL 3.0 - 3.0.6 - https://github.com/mathieucarbou/ESPAsyncWebServer
- AsyncTCP - LGPL 3.0 - 3.1.4 - https://github.com/mathieucarbou/AsyncTCP
- ArduinoJson - MIT - 7.1.0 - https://github.com/bblanchon/ArduinoJson
- ESPAsyncWebServer - LGPL 3.0 - 3.3.22 - https://github.com/mathieucarbou/ESPAsyncWebServer
- AsyncTCP - LGPL 3.0 - 3.2.14 - https://github.com/mathieucarbou/AsyncTCP
- ArduinoJson - MIT - 7.2.1 - https://github.com/bblanchon/ArduinoJson
- ArduinoUniqueID - MIT - 1.3.0 - https://github.com/ricaun/ArduinoUniqueID
- arduino-esp32 - LGPL 2.1 - 3.0.4 - https://github.com/espressif/arduino-esp32
- DHTnew - MIT - 0.4.20 - https://github.com/RobTillaart/DHTNew
- arduino-esp32 - LGPL 2.1 - 3.0.7 - https://github.com/espressif/arduino-esp32
- DHTnew - MIT - 0.4.21 - https://github.com/RobTillaart/DHTNew
Arduino IDE configuration for the MCU are stored in the module_XXX.h file.

View File

@ -52,10 +52,19 @@ void Server_InitWebServer() {
/* send photo with exif data */
SystemLog.AddEvent(LogLevel_Verbose, F("Send photo with EXIF data"));
size_t total_len = SystemCamera.GetPhotoExifData()->len + SystemCamera.GetPhotoFb()->len - SystemCamera.GetPhotoExifData()->offset;
auto response = request->beginResponseStream("image/jpg");
auto response = request->beginChunkedResponse("image/jpg", [total_len](uint8_t *buffer, size_t maxLen, size_t index) -> size_t {
size_t len = 0;
if (index < SystemCamera.GetPhotoExifData()->len) {
len = min(maxLen, SystemCamera.GetPhotoExifData()->len - index);
memcpy(buffer, SystemCamera.GetPhotoExifData()->header + index, len);
} else {
size_t offset = index - SystemCamera.GetPhotoExifData()->len + SystemCamera.GetPhotoExifData()->offset;
len = min(maxLen, SystemCamera.GetPhotoFb()->len - offset);
memcpy(buffer, SystemCamera.GetPhotoFb()->buf + offset, len);
}
return len;
});
response->addHeader("Content-Length", String(total_len));
response->write(SystemCamera.GetPhotoExifData()->header, SystemCamera.GetPhotoExifData()->len);
response->write(&SystemCamera.GetPhotoFb()->buf[SystemCamera.GetPhotoExifData()->offset], SystemCamera.GetPhotoFb()->len - SystemCamera.GetPhotoExifData()->offset);
request->send(response);
} else {
@ -443,7 +452,7 @@ void Server_InitWebServer_Actions() {
request->send(200, "text/plain", "Send Photo");
});
/* route to toggle the LED on and off. If the LED is on, this route turns it off, and vice-versa. */
/* route for change LED status */
server.on("/action_led", HTTP_GET, [](AsyncWebServerRequest* request) {
SystemLog.AddEvent(LogLevel_Verbose, F("WEB server: /action_led Change LED status"));
if (Server_CheckBasicAuth(request) == false)
@ -455,7 +464,7 @@ void Server_InitWebServer_Actions() {
request->send(200, "text/plain", "Change LED status");
});
/* route to set the LED on or off manually */
/* route for change LED status */
server.on("/light", HTTP_GET, [](AsyncWebServerRequest* request) {
SystemLog.AddEvent(LogLevel_Verbose, F("WEB server: /light set LED status"));
if (Server_CheckBasicAuth(request) == false)
@ -511,7 +520,7 @@ void Server_InitWebServer_Actions() {
ESP.restart();
});
/* route for erasing the SD card */
/* route for change LED status */
server.on("/action_sderase", HTTP_GET, [](AsyncWebServerRequest* request) {
SystemLog.AddEvent(LogLevel_Verbose, F("WEB server: /action_sderase remove files from SD card"));
if (Server_CheckBasicAuth(request) == false)