Skip to content

Commit

Permalink
examples: build with arduino-esp32 3.x
Browse files Browse the repository at this point in the history
  • Loading branch information
yoursunny committed Jun 18, 2024
1 parent e2870ea commit bbde4dd
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 13 deletions.
14 changes: 8 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -43,16 +45,16 @@ 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
arduino-cli compile -b esp32:esp32:esp32cam ./examples/AsyncCam
- 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
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion examples/AsyncCam/AsyncCam.ino
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ void
setup() {
Serial.begin(115200);
Serial.println();
delay(2000);
delay(1000);

WiFi.persistent(false);
WiFi.mode(WIFI_STA);
Expand All @@ -24,6 +24,7 @@ setup() {
ESP.restart();
}
Serial.println("WiFi connected");
delay(1000);

{
using namespace esp32cam;
Expand Down
3 changes: 2 additions & 1 deletion examples/WifiCam/WifiCam.ino
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ void
setup() {
Serial.begin(115200);
Serial.println();
delay(2000);
delay(1000);

WiFi.persistent(false);
WiFi.mode(WIFI_STA);
Expand All @@ -23,6 +23,7 @@ setup() {
ESP.restart();
}
Serial.println("WiFi connected");
delay(1000);

{
using namespace esp32cam;
Expand Down
6 changes: 2 additions & 4 deletions examples/WifiCam/handlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit bbde4dd

Please sign in to comment.