Update libs. arduino-esp32, ESPAsyncWebServer, AsyncTCP, ArduinoJson, DHTnew
parent
cf6af3958f
commit
d9394e4c6b
|
|
@ -8,12 +8,12 @@
|
||||||
|
|
||||||
This project uses other libraries. It is necessary to install them in the arduino IDE.
|
This project uses other libraries. It is necessary to install them in the arduino IDE.
|
||||||
- Library - License - Version - Link
|
- Library - License - Version - Link
|
||||||
- ESPAsyncWebServer - LGPL 3.0 - 3.0.6 - https://github.com/mathieucarbou/ESPAsyncWebServer
|
- ESPAsyncWebServer - LGPL 3.0 - 3.3.22 - https://github.com/mathieucarbou/ESPAsyncWebServer
|
||||||
- AsyncTCP - LGPL 3.0 - 3.1.4 - https://github.com/mathieucarbou/AsyncTCP
|
- AsyncTCP - LGPL 3.0 - 3.2.14 - https://github.com/mathieucarbou/AsyncTCP
|
||||||
- ArduinoJson - MIT - 7.1.0 - https://github.com/bblanchon/ArduinoJson
|
- ArduinoJson - MIT - 7.2.1 - https://github.com/bblanchon/ArduinoJson
|
||||||
- ArduinoUniqueID - MIT - 1.3.0 - https://github.com/ricaun/ArduinoUniqueID
|
- ArduinoUniqueID - MIT - 1.3.0 - https://github.com/ricaun/ArduinoUniqueID
|
||||||
- arduino-esp32 - LGPL 2.1 - 3.0.4 - https://github.com/espressif/arduino-esp32
|
- arduino-esp32 - LGPL 2.1 - 3.0.7 - https://github.com/espressif/arduino-esp32
|
||||||
- DHTnew - MIT - 0.4.20 - https://github.com/RobTillaart/DHTNew
|
- DHTnew - MIT - 0.4.21 - https://github.com/RobTillaart/DHTNew
|
||||||
|
|
||||||
Arduino IDE configuration for the MCU are stored in the module_XXX.h file.
|
Arduino IDE configuration for the MCU are stored in the module_XXX.h file.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,10 +52,19 @@ void Server_InitWebServer() {
|
||||||
/* send photo with exif data */
|
/* send photo with exif data */
|
||||||
SystemLog.AddEvent(LogLevel_Verbose, F("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;
|
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->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);
|
request->send(response);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -443,7 +452,7 @@ void Server_InitWebServer_Actions() {
|
||||||
request->send(200, "text/plain", "Send Photo");
|
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) {
|
server.on("/action_led", HTTP_GET, [](AsyncWebServerRequest* request) {
|
||||||
SystemLog.AddEvent(LogLevel_Verbose, F("WEB server: /action_led Change LED status"));
|
SystemLog.AddEvent(LogLevel_Verbose, F("WEB server: /action_led Change LED status"));
|
||||||
if (Server_CheckBasicAuth(request) == false)
|
if (Server_CheckBasicAuth(request) == false)
|
||||||
|
|
@ -455,7 +464,7 @@ void Server_InitWebServer_Actions() {
|
||||||
request->send(200, "text/plain", "Change LED status");
|
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) {
|
server.on("/light", HTTP_GET, [](AsyncWebServerRequest* request) {
|
||||||
SystemLog.AddEvent(LogLevel_Verbose, F("WEB server: /light set LED status"));
|
SystemLog.AddEvent(LogLevel_Verbose, F("WEB server: /light set LED status"));
|
||||||
if (Server_CheckBasicAuth(request) == false)
|
if (Server_CheckBasicAuth(request) == false)
|
||||||
|
|
@ -511,7 +520,7 @@ void Server_InitWebServer_Actions() {
|
||||||
ESP.restart();
|
ESP.restart();
|
||||||
});
|
});
|
||||||
|
|
||||||
/* route for erasing the SD card */
|
/* route for change LED status */
|
||||||
server.on("/action_sderase", HTTP_GET, [](AsyncWebServerRequest* request) {
|
server.on("/action_sderase", HTTP_GET, [](AsyncWebServerRequest* request) {
|
||||||
SystemLog.AddEvent(LogLevel_Verbose, F("WEB server: /action_sderase remove files from SD card"));
|
SystemLog.AddEvent(LogLevel_Verbose, F("WEB server: /action_sderase remove files from SD card"));
|
||||||
if (Server_CheckBasicAuth(request) == false)
|
if (Server_CheckBasicAuth(request) == false)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue