Skip to content

Commit fb4455c

Browse files
committed
asyncweb: rewrite StillResponse
1 parent 39fb26c commit fb4455c

File tree

7 files changed

+347
-312
lines changed

7 files changed

+347
-312
lines changed

examples/AsyncCam/AsyncCam.hpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
#ifndef ASYNCCAM_HPP
22
#define ASYNCCAM_HPP
33

4-
// This macro indicates where to send debug logs.
5-
// Delete this macro to disable debug logging.
6-
#define ESP32CAM_ASYNCWEB_LOGGER Serial
7-
8-
#include <esp32cam-asyncweb.h>
9-
4+
// It is necessary to include ESPAsyncWebServer.h before esp32cam.h for Arduino builder to
5+
// recognize the dependency.
106
#include <ESPAsyncWebServer.h>
117

8+
#include <esp32cam.h>
9+
1210
extern esp32cam::Resolution initialResolution;
1311
extern esp32cam::Resolution currentResolution;
1412

examples/AsyncCam/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
This example runs on ESP32-CAM board.
44
It demonstrates how to use esp32cam library with [ESPAsyncWebServer](https://github.com/mathieucarbou/ESPAsyncWebServer) library.
5-
The HTTP server supports both ~~JPEG still image~~ and MJPEG stream, and allows changing camera resolution on the fly.
5+
The HTTP server supports both JPEG still image and MJPEG stream, and allows changing camera resolution on the fly.
66
To use this example, modify WiFi SSID+password, then upload to ESP32.

examples/AsyncCam/handlers.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ addRequestHandlers() {
113113
Serial.printf("changeResolution(%ld,%ld) success\n", width, height);
114114
StreamString b;
115115
b.print(currentResolution);
116-
request->send(b, "text/plain", b.length());
116+
request->send(200, "text/plain", static_cast<String>(b));
117117
});
118118

119119
server.on("/cam.jpg", esp32cam::asyncweb::handleStill);

src/esp32cam-asyncweb.h

Lines changed: 0 additions & 304 deletions
This file was deleted.

src/esp32cam.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#ifndef ESP32CAM_H
88
#define ESP32CAM_H
99

10+
#include "esp32cam/asyncweb.hpp"
1011
#include "esp32cam/camera.hpp"
1112

1213
namespace esp32cam {

0 commit comments

Comments
 (0)