From bbde4ddb85ca61b569e44b71302daa30dbbac7e4 Mon Sep 17 00:00:00 2001 From: Junxiao Shi Date: Tue, 18 Jun 2024 17:20:02 -0400 Subject: [PATCH] examples: build with arduino-esp32 3.x --- .github/workflows/build.yml | 14 ++++++++------ README.md | 2 +- examples/AsyncCam/AsyncCam.ino | 3 ++- examples/WifiCam/WifiCam.ino | 3 ++- examples/WifiCam/handlers.cpp | 6 ++---- 5 files changed, 15 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f431b07..3333d7c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,14 +7,16 @@ permissions: {} jobs: build: runs-on: ubuntu-22.04 + env: + ARDUINO_BOARD_MANAGER_ADDITIONAL_URLS: | + https://espressif.github.io/arduino-esp32/package_esp32_index.json steps: - uses: arduino/setup-arduino-cli@v1 - id: cores name: Refresh Arduino cores run: | - echo 'https://espressif.github.io/arduino-esp32/package_esp32_index.json' >~/arduino-cores.txt arduino-cli version - arduino-cli update --additional-urls "$(<~/arduino-cores.txt)" + arduino-cli update echo d=$(sha256sum ~/.arduino15/package_*index.json | sha256sum | cut -d' ' -f1) >> $GITHUB_OUTPUT - name: Cache Arduino cores uses: actions/cache@v4 @@ -23,7 +25,7 @@ jobs: key: cores-${{ steps.cores.outputs.d }} - name: Install Arduino cores run: | - arduino-cli core install esp32:esp32 --additional-urls "$(<~/arduino-cores.txt)" + arduino-cli core install esp32:esp32 - name: Install dependencies run: | sudo apt-get install -y --no-install-recommends clang-format-15 doxygen @@ -43,8 +45,8 @@ jobs: curl -fsLS https://github.com/me-no-dev/ESPAsyncWebServer/archive/${ESPASYNCWEBSERVER_VERSION}.tar.gz \ | tar -C ESPAsyncWebServer -xz --strip-components=1 env: - ASYNCTCP_VERSION: ca8ac5f919d02bea07b474531981ddbfd64de97c - ESPASYNCWEBSERVER_VERSION: 1d46269cedf477661ca8a29518414f4b74e957d4 + ASYNCTCP_VERSION: 58cbe1fabe78977e3140391c01c03f0cb51e347c + ESPASYNCWEBSERVER_VERSION: 7f3753454b1f176c4b6d6bcd1587a135d95ca63c - name: Compile examples run: | arduino-cli compile -b esp32:esp32:esp32cam ./examples/WifiCam @@ -52,7 +54,7 @@ jobs: - name: Build docs run: docs/build.sh - name: Deploy docs - uses: nwtgck/actions-netlify@v2.1.0 + uses: nwtgck/actions-netlify@v3 with: publish-dir: ./docs/html/ production-deploy: true diff --git a/README.md b/README.md index 45927e3..0263f2a 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ **esp32cam** library provides an object oriented API to use OV2640 camera on ESP32 microcontroller. It is a wrapper of [esp32-camera library](https://github.com/espressif/esp32-camera). -This library has been tested with AI Thinker [ESP32-CAM](http://www.ai-thinker.com/pro_view-24.html) board and OV2640 camera. +This library has been tested with AI Thinker [ESP32-CAM](https://docs.ai-thinker.com/en/esp32-cam) board and OV2640 camera. * [Doxygen documentation](https://esp32cam.yoursunny.dev) * [#esp32cam on Twitter](https://twitter.com/hashtag/esp32cam) diff --git a/examples/AsyncCam/AsyncCam.ino b/examples/AsyncCam/AsyncCam.ino index 16e076d..15afcb1 100644 --- a/examples/AsyncCam/AsyncCam.ino +++ b/examples/AsyncCam/AsyncCam.ino @@ -13,7 +13,7 @@ void setup() { Serial.begin(115200); Serial.println(); - delay(2000); + delay(1000); WiFi.persistent(false); WiFi.mode(WIFI_STA); @@ -24,6 +24,7 @@ setup() { ESP.restart(); } Serial.println("WiFi connected"); + delay(1000); { using namespace esp32cam; diff --git a/examples/WifiCam/WifiCam.ino b/examples/WifiCam/WifiCam.ino index 90ec735..4761003 100644 --- a/examples/WifiCam/WifiCam.ino +++ b/examples/WifiCam/WifiCam.ino @@ -12,7 +12,7 @@ void setup() { Serial.begin(115200); Serial.println(); - delay(2000); + delay(1000); WiFi.persistent(false); WiFi.mode(WIFI_STA); @@ -23,6 +23,7 @@ setup() { ESP.restart(); } Serial.println("WiFi connected"); + delay(1000); { using namespace esp32cam; diff --git a/examples/WifiCam/handlers.cpp b/examples/WifiCam/handlers.cpp index abbe355..a9c0eba 100644 --- a/examples/WifiCam/handlers.cpp +++ b/examples/WifiCam/handlers.cpp @@ -63,16 +63,14 @@ serveStill(bool wantBmp) { server.setContentLength(frame->size()); server.send(200, wantBmp ? "image/bmp" : "image/jpeg"); - WiFiClient client = server.client(); - frame->writeTo(client); + frame->writeTo(server.client()); } static void serveMjpeg() { Serial.println("MJPEG streaming begin"); - WiFiClient client = server.client(); auto startTime = millis(); - int nFrames = esp32cam::Camera.streamMjpeg(client); + int nFrames = esp32cam::Camera.streamMjpeg(server.client()); auto duration = millis() - startTime; Serial.printf("MJPEG streaming end: %dfrm %0.2ffps\n", nFrames, 1000.0 * nFrames / duration); }