From 884bb927f856a6553e5c01a1776957ba2cd94626 Mon Sep 17 00:00:00 2001 From: AkaY <98938792+aliffathoni@users.noreply.github.com> Date: Sat, 8 Jul 2023 21:00:49 +0700 Subject: [PATCH 1/3] Create README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 00000000..36827e6c --- /dev/null +++ b/README.md @@ -0,0 +1,4 @@ +# EloquentEsp32cam +Use your Esp32-cam like an expert + +Add option for Seeed Studio Xiao S3 Sense From 9355cbea9ac24b5a1cfb1d69191a483e5e061238 Mon Sep 17 00:00:00 2001 From: aliffathoni Date: Sat, 8 Jul 2023 21:09:46 +0700 Subject: [PATCH 2/3] Set Xiao S3 pins config --- README.md | 3 ++- src/traits/SetModelPins.h | 27 +++++++++++++++++++++++++-- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 36827e6c..3d8b6f66 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # EloquentEsp32cam Use your Esp32-cam like an expert -Add option for Seeed Studio Xiao S3 Sense +Add option for Seeed Studio Xiao S3 Sense. +Set camera model to cam.xiao() on setup() \ No newline at end of file diff --git a/src/traits/SetModelPins.h b/src/traits/SetModelPins.h index f8f90826..aa142259 100644 --- a/src/traits/SetModelPins.h +++ b/src/traits/SetModelPins.h @@ -174,6 +174,29 @@ namespace Eloquent { _pins.flashlight = -1; } + /** + * + */ + void xiao() { + _pins.d0 = 15; + _pins.d1 = 17; + _pins.d2 = 18; + _pins.d3 = 16; + _pins.d4 = 14; + _pins.d5 = 12; + _pins.d6 = 11; + _pins.d7 = 48; + _pins.xclk = 10; + _pins.pclk = 13; + _pins.vsync = 38; + _pins.href = 47; + _pins.sscb_sda = 40; + _pins.sscb_scl = 39; + _pins.pwdn = -1; + _pins.reset = -1; + _pins.flashlight = 21; + } + protected: struct { int8_t d0 = 0; @@ -213,8 +236,8 @@ namespace Eloquent { config->pin_pclk = _pins.pclk; config->pin_vsync = _pins.vsync; config->pin_href = _pins.href; - config->pin_sscb_sda = _pins.sscb_sda; - config->pin_sscb_scl = _pins.sscb_scl; + config->pin_sccb_sda = _pins.sscb_sda; + config->pin_sccb_scl = _pins.sscb_scl; config->pin_pwdn = _pins.pwdn; config->pin_reset = _pins.reset; From ebf97b59acddb5090c7223cdce97b63a408a9877 Mon Sep 17 00:00:00 2001 From: aliffathoni Date: Sun, 9 Jul 2023 02:55:30 +0700 Subject: [PATCH 3/3] downgrade to ver 1.1.1 --- .../2_CameraSettings/2_CameraSettings.ino | 6 +-- .../3_Get_Your_First_Picture.ino | 5 --- .../4_Live_Style_Transfer.ino | 42 +++++++++++++++++++ examples/4_Video_Feed/4_Video_Feed.ino | 25 ++++------- library.json | 2 +- library.properties | 2 +- src/esp32cam/Cam.h | 12 ------ src/esp32cam/JpegDecoder.h | 4 +- src/esp32cam/JpegDecoderGray.h | 5 ++- src/esp32cam/apps/ColorBlobDetector.h | 13 ------ 10 files changed, 58 insertions(+), 58 deletions(-) create mode 100644 examples/4_Live_Style_Transfer/4_Live_Style_Transfer.ino diff --git a/examples/2_CameraSettings/2_CameraSettings.ino b/examples/2_CameraSettings/2_CameraSettings.ino index 085be20f..3a36222d 100644 --- a/examples/2_CameraSettings/2_CameraSettings.ino +++ b/examples/2_CameraSettings/2_CameraSettings.ino @@ -1,10 +1,6 @@ /** - * Example 2: Camera Configuration - * This sketch shows the available sensor configurations for the - * Esp32 camera. - * It does nothing: it's only a reference of the available methods + * Include the EloquentEsp32Cam library */ - #include "esp32cam.h" diff --git a/examples/3_Get_Your_First_Picture/3_Get_Your_First_Picture.ino b/examples/3_Get_Your_First_Picture/3_Get_Your_First_Picture.ino index 05865e81..4ef476e5 100644 --- a/examples/3_Get_Your_First_Picture/3_Get_Your_First_Picture.ino +++ b/examples/3_Get_Your_First_Picture/3_Get_Your_First_Picture.ino @@ -1,8 +1,3 @@ -/** - * Example 3: Get your First picture - * This sketch shows the basic code you need to take a picture - * from your Esp32 camera - */ #define MAX_RESOLUTION_VGA #include "esp32cam.h" diff --git a/examples/4_Live_Style_Transfer/4_Live_Style_Transfer.ino b/examples/4_Live_Style_Transfer/4_Live_Style_Transfer.ino new file mode 100644 index 00000000..a08242d8 --- /dev/null +++ b/examples/4_Live_Style_Transfer/4_Live_Style_Transfer.ino @@ -0,0 +1,42 @@ +#include "esp32cam.h" +#include "esp32cam/http/LiveStyleTransfer.h" + +// Replace with your WiFi credentials +#define WIFI_SSID "Your SSID" +#define WIFI_PASS "Your password" + +// 80 is the port to listen to +// You can change it to whatever you want, 80 is the default for HTTP +Eloquent::Esp32cam::Cam cam; +Eloquent::Esp32cam::Http::LiveStyleTransfer styleTransfer(cam, 80); + + +void setup() { + Serial.begin(115200); + delay(3000); + Serial.println("Init"); + + cam.aithinker(); + cam.highQuality(); + cam.qvga(); + + while (!cam.begin()) + Serial.println(cam.getErrorMessage()); + + while (!cam.connect(WIFI_SSID, WIFI_PASS)) + Serial.println(cam.getErrorMessage()); + + //Initialize live style transfer http server + // If something goes wrong, print the error message + while (!styleTransfer.begin()) + Serial.println(styleTransfer.getErrorMessage()); + + cam.viewAt("esp32cam"); + + // display the IP address of the camera + Serial.println(styleTransfer.getWelcomeMessage()); +} + + +void loop() { +} diff --git a/examples/4_Video_Feed/4_Video_Feed.ino b/examples/4_Video_Feed/4_Video_Feed.ino index d525f544..38650cc4 100644 --- a/examples/4_Video_Feed/4_Video_Feed.ino +++ b/examples/4_Video_Feed/4_Video_Feed.ino @@ -1,23 +1,16 @@ -/** - * Example 4: Video Feed over HTTP - * This sketch shows how to access the live camera feed - * from a browser using HTTP - */ #include "esp32cam.h" #include "esp32cam/http/LiveFeed.h" // Replace with your WiFi credentials -#define WIFI_SSID "SSID" -#define WIFI_PASS "PASSWORD" - +#define WIFI_SSID "Your SSID" +#define WIFI_PASS "Your password" +// 80 is the port to listen to +// You can change it to whatever you want, 80 is the default for HTTP Eloquent::Esp32cam::Cam cam; -Eloquent::Esp32cam::Http::LiveFeed feed(cam); +Eloquent::Esp32cam::Http::LiveFeed feed(cam, 80); -/** - * - */ void setup() { Serial.begin(115200); delay(3000); @@ -42,17 +35,15 @@ void setup() { Serial.println(feed.getErrorMessage()); // make the camera accessible at http://esp32cam.local - if (!cam.mDNS("esp32cam")) + if (!cam.viewAt("esp32cam")) Serial.println("Cannot create alias, use the IP address"); + else + Serial.println("Live Feed available at http://esp32cam.local"); // display the IP address of the camera Serial.println(feed.getWelcomeMessage()); } -/** - * - */ void loop() { - // do nothing, web server handles the requests } diff --git a/library.json b/library.json index 25682343..858602e0 100644 --- a/library.json +++ b/library.json @@ -6,7 +6,7 @@ "type": "git", "url": "https://github.com/eloquentarduino/EloquentEsp32cam" }, - "version": "1.1.2", + "version": "1.1.1", "authors": { "name": "Simone Salerno", "url": "https://github.com/eloquentarduino" diff --git a/library.properties b/library.properties index 19668733..ed3c0222 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=EloquentEsp32cam -version=1.1.2 +version=1.1.1 author=Simone Salerno maintainer=Simone Salerno sentence=Use your Esp32-cam like an expert diff --git a/src/esp32cam/Cam.h b/src/esp32cam/Cam.h index f99ee06f..9966b1ed 100644 --- a/src/esp32cam/Cam.h +++ b/src/esp32cam/Cam.h @@ -16,7 +16,6 @@ #include "../traits/ConnectsToWiFi.h" #include "../traits/HasMDNS.h" #include "../traits/SavesToFilesystem.h" -#include "./features/CloudStorageUploader.h" namespace Eloquent { @@ -39,7 +38,6 @@ namespace Eloquent { public: camera_config_t config; camera_fb_t *frame; - Features::CloudStorageUploader cloudStorageUploader; /** * @@ -165,16 +163,6 @@ namespace Eloquent { return SavesToFilesystem::saveTo(fs, filename, frame->buf, frame->len); } - /** - * Upload current picture to https://esp32camstorage.eloquentarduino.com - * - * @param deviceToken - * @return - */ - bool uploadToCloudStorage(String deviceToken) { - return setErrorMessage(cloudStorageUploader.upload(deviceToken, frame->buf, frame->len)); - } - /** * Get HTTP address of camera * @param port diff --git a/src/esp32cam/JpegDecoder.h b/src/esp32cam/JpegDecoder.h index 068ced00..2ec6d9a2 100644 --- a/src/esp32cam/JpegDecoder.h +++ b/src/esp32cam/JpegDecoder.h @@ -83,10 +83,10 @@ namespace Eloquent { startBenchmark(); - if (status = pjpeg_decode_init(&jpeg, pjpegConsume, (void *) &decoding, 1)) { + if (pjpeg_decode_init(&jpeg, pjegConsume, (void *) &decoding, 1)) { stopBenchmark(); - return this->setErrorMessage(String("Jpeg decode error: ") + status); + return this->setErrorMessage("Jpeg decode error"); } while ((status = pjpeg_decode_mcu()) != PJPG_NO_MORE_BLOCKS) { diff --git a/src/esp32cam/JpegDecoderGray.h b/src/esp32cam/JpegDecoderGray.h index 2dc513a8..61ca8d16 100644 --- a/src/esp32cam/JpegDecoderGray.h +++ b/src/esp32cam/JpegDecoderGray.h @@ -39,6 +39,7 @@ unsigned char pjpegConsume(unsigned char* dest, unsigned char chunkSize, unsigne if (!len || (*offset) > len) { *read = 0; + Serial.println("exit..."); return PJPG_STREAM_READ_ERROR; } @@ -86,10 +87,10 @@ namespace Eloquent { startBenchmark(); - if (status = pjpeg_decode_init(&jpeg, pjpegConsume, (void *) &decoding, 1)) { + if (pjpeg_decode_init(&jpeg, pjpegConsume, (void *) &decoding, 1)) { stopBenchmark(); - return this->setErrorMessage(String("Jpeg decode error: ") + status); + return this->setErrorMessage("Jpeg decode error"); } while ((status = pjpeg_decode_mcu()) != PJPG_NO_MORE_BLOCKS) { diff --git a/src/esp32cam/apps/ColorBlobDetector.h b/src/esp32cam/apps/ColorBlobDetector.h index 68b6af02..4960bdff 100644 --- a/src/esp32cam/apps/ColorBlobDetector.h +++ b/src/esp32cam/apps/ColorBlobDetector.h @@ -170,19 +170,6 @@ namespace Eloquent { return isOk(); } - /** - * Update target color - * - * @param y - * @param cb - * @param cr - */ - void updateColor(uint8_t y, uint8_t cb, uint8_t cr) { - _y = y; - _cb = cb; - _cr = cr; - } - /** * Detect color blog in Jpeg frame *