Skip to content

Commit

Permalink
asyncweb: rewrite StillResponse
Browse files Browse the repository at this point in the history
  • Loading branch information
yoursunny committed Jan 6, 2025
1 parent 39fb26c commit fb4455c
Show file tree
Hide file tree
Showing 7 changed files with 347 additions and 312 deletions.
10 changes: 4 additions & 6 deletions examples/AsyncCam/AsyncCam.hpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
#ifndef ASYNCCAM_HPP
#define ASYNCCAM_HPP

// This macro indicates where to send debug logs.
// Delete this macro to disable debug logging.
#define ESP32CAM_ASYNCWEB_LOGGER Serial

#include <esp32cam-asyncweb.h>

// It is necessary to include ESPAsyncWebServer.h before esp32cam.h for Arduino builder to
// recognize the dependency.
#include <ESPAsyncWebServer.h>

#include <esp32cam.h>

extern esp32cam::Resolution initialResolution;
extern esp32cam::Resolution currentResolution;

Expand Down
2 changes: 1 addition & 1 deletion examples/AsyncCam/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

This example runs on ESP32-CAM board.
It demonstrates how to use esp32cam library with [ESPAsyncWebServer](https://github.com/mathieucarbou/ESPAsyncWebServer) library.
The HTTP server supports both ~~JPEG still image~~ and MJPEG stream, and allows changing camera resolution on the fly.
The HTTP server supports both JPEG still image and MJPEG stream, and allows changing camera resolution on the fly.
To use this example, modify WiFi SSID+password, then upload to ESP32.
2 changes: 1 addition & 1 deletion examples/AsyncCam/handlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ addRequestHandlers() {
Serial.printf("changeResolution(%ld,%ld) success\n", width, height);
StreamString b;
b.print(currentResolution);
request->send(b, "text/plain", b.length());
request->send(200, "text/plain", static_cast<String>(b));
});

server.on("/cam.jpg", esp32cam::asyncweb::handleStill);
Expand Down
304 changes: 0 additions & 304 deletions src/esp32cam-asyncweb.h

This file was deleted.

1 change: 1 addition & 0 deletions src/esp32cam.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#ifndef ESP32CAM_H
#define ESP32CAM_H

#include "esp32cam/asyncweb.hpp"
#include "esp32cam/camera.hpp"

namespace esp32cam {
Expand Down
Loading

0 comments on commit fb4455c

Please sign in to comment.