Porównaj commity

..

No commits in common. "0363ea8de5d3f92c13b50cbef577870b476c276d" and "30066279ab6a78a79ae2eb92db98d399d71fafb4" have entirely different histories.

2 zmienionych plików z 19 dodań i 33 usunięć

Wyświetl plik

@ -42,36 +42,26 @@
*******************************************************************************************************************/
#if !defined ESP32
#error This sketch is only for an ESP32 Camera module
#error This sketch is only for an ESP32Cam module
#endif
#include "esp_camera.h" // https://github.com/espressif/esp32-camera
#include <Arduino.h>
#include "wifiSettings.h"
// ---------------------------------------------------------------------------------------------------------
// Enter your Wifi Settings here
// ======================================
// Enter your wifi settings
// ======================================
#define SSID_NAME "<WIFI SSID>"
#define SSID_PASWORD "<WIFI PASSWORD>"
#define ENABLE_OTA 0 // If OTA updating of this sketch is enabled (requires ota.h file)
const String OTAPassword = "password"; // Password for performing OTA update (i.e. http://x.x.x.x/ota)
#define SSID_NAME "<wifi name>"
#define SSID_PASWORD "<wifi password>"
// ---------------------------------------------------------------------------------------------------------
// Required by PlatformIO
#include <Arduino.h>
// forward declarations
bool initialiseCamera(bool); // this sets up and enables the camera (if bool=1 standard settings are applied but 0 allows you to apply custom settings)
bool cameraImageSettings(); // this applies the image settings to the camera (brightness etc.)
@ -102,7 +92,10 @@
// ---------------------------------------------------------------
char* stitle = "ESP32Cam-demo"; // title of this sketch
char* sversion = "18oct23"; // Sketch version
char* sversion = "17oct23"; // Sketch version
#define ENABLE_OTA 0 // If OTA updating of this sketch is enabled (requires ota.h)
const String OTAPassword = "password"; // Password reuired to enable OTA (supplied as - http://<ip address>?pwd=xxxx )
bool sendRGBfile = 0; // if set '/rgb' will just return raw rgb data which can be saved as a file rather than display a HTML pag
@ -118,7 +111,7 @@
const framesize_t cyclingRes[] = { FRAMESIZE_SVGA, FRAMESIZE_XGA, FRAMESIZE_SXGA, FRAMESIZE_QVGA, FRAMESIZE_VGA }; // resolutions to use
// Image resolutions available:
// default = "const framesize_t FRAME_SIZE_IMAGE = FRAMESIZE_VGA"
// 160x120 (QQVGA), 128x160 (QQVGA2), 176x144 (QCIF), 240x176 (HQVGA), 240X240,
// 160x120 (QQVGA), 128x160 (QQVGA2), 176x144 (QCIF), 240x176 (HQVGA),
// 320x240 (QVGA), 400x296 (CIF), 640x480 (VGA, default), 800x600 (SVGA),
// 1024x768 (XGA), 1280x1024 (SXGA), 1600x1200 (UXGA)
int cameraImageExposure = 0; // Camera exposure (0 - 1200) If gain and exposure both set to zero then auto adjust is enabled
@ -226,6 +219,7 @@ WebServer server(80); // serve web pages on port 80
#include "ota.h" // Over The Air updates (OTA)
#endif
// ---------------------------------------------------------------
// -SETUP SETUP SETUP SETUP SETUP SETUP
// ---------------------------------------------------------------
@ -916,7 +910,7 @@ void handleRoot() {
// info which is periodically updated using AJAX - https://www.w3schools.com/xml/ajax_intro.asp
// empty lines which are populated via vbscript with live data from http://x.x.x.x/data in the form of comma separated text
int noLines = 6; // number of text lines to be populated by javascript
int noLines = 5; // number of text lines to be populated by javascript
for (int i = 0; i < noLines; i++) {
client.println("<span id='uline" + String(i) + "'></span><br>");
}
@ -985,7 +979,7 @@ void handleRoot() {
client.write("<a href='/test'>Test procedure</a>\n");
#if ENABLE_OTA
client.write(" - <a href='/ota'>Update via OTA</a>\n");
#endif
#endif
// addnl info if sd card present
if (sdcardPresent) {
@ -1068,10 +1062,7 @@ void handleData(){
// line5 - image resolution
reply += "Image size: " + ImageResDetails;
reply += ",";
// line6 - free memory
reply += "Free memory: " + String(ESP.getFreeHeap() /1000) + "K";
server.send(200, "text/plane", reply); //Send millis value only to client ajax request
}
@ -1234,7 +1225,6 @@ void handleNotFound() {
// You may want to disable auto white balance when experimenting with RGB otherwise the camera is always trying to adjust the
// image colours to mainly white. (disable in the 'cameraImageSettings' procedure).
// It will fail on the higher resolutions as it requires more than the 4mb of available psram to store the data (1600x1200x3 bytes)
// See this sketch for example of saving and viewing RGB files: https://github.com/alanesq/misc/blob/main/saveAndViewRGBfiles.ino
// I learned how to read the RGB data from: https://github.com/Makerfabs/Project_Touch-Screen-Camera/blob/master/Camera_v2/Camera_v2.ino
void readRGBImage() {
@ -1328,6 +1318,7 @@ void readRGBImage() {
return;
}
// ****** examples of using the resulting RGB data *****
// display some of the resulting data
@ -1655,7 +1646,7 @@ void readGreyscaleImage() {
client.write("<br><br><a href='/'>Return</a>\n"); // link back
// resize the image
int newWidth = 115; int newHeight = 42; // much bigger than this seems to cause problems, possible web page is too large?
int newWidth = 115; int newHeight = 42; // much bigger than this seems to cause problems, probably a memory issue?
byte newBuf[newWidth * newHeight];
resize_esp32cam_image_buffer(fb->buf, fb->width, fb->height, newBuf, newWidth, newHeight);

Wyświetl plik

@ -1,12 +1,10 @@
## ESP32Cam-demo sketch for use with the Arduino IDE
## ESP32Cam-demo sketch for use with the Arduino IDE or PlatformIO
I show in this sketch how to use the esp32cam as easily as possible. Everything I learn I try to add to it, please let me know if you have anything which you think can be added or changed to improve it - I am not a professional programmer so am sure there is plenty of room for improvement...
<br>This sketch has got a bit larger than I anticipated but this is just because it now has so many individual demonstartions of ways to use the camera, I have tried to make each part as easy to follow as possible with lots of comments etc..
<br>The camera is not great quality and very poor in low light conditions but it is very cheap (around £5 each if buying several) and I think has lots of potential for interesting applications.
<br>This sketch is just a collection of all I have discovered/learned in the process of using them myself<br><br>
<br>It is just a collection of all I have discovered/learned in the process of using them myself<br><br>
Note: This sketch now has the facilty for OTA updates over the network, you need to copy the file ota.h in to your sketch folder and enable it in settings (#define ENABLE_OTA 1)
<br><br>If you have issues with the camera keep stopping working etc. I have had a couple of these with dodgy camera modules so it is worth trying another one to see if this is the
<br><br>If you have issues with the camera keep stopping working I have had a couple of these with dodgy camera modules so it is worth trying another one to see if this is the
source of your problems.
<br>
@ -166,9 +164,6 @@ Some sites I find handy when creating HTML:
You may like to have a play with a Processing sketch I created which could be used to grab JPG images from this camera and motion detect:
https://github.com/alanesq/imageChangeMonitor
I have a demo sketch of how to capture and save a raw RGB file (see comments at top of how you can view the resulting file)
https://github.com/alanesq/misc/blob/main/saveAndViewRGBfiles.ino
If you have any handy info, tips, or improvements to my code etc. please feel let me know at: alanesq@disroot.org