Bring in latest v4 changes where appropriate
This commit is contained in:
parent
827e533236
commit
4a6e80d137
|
@ -11,12 +11,13 @@ branches:
|
|||
only:
|
||||
- master
|
||||
|
||||
|
||||
before_script:
|
||||
- "export DISPLAY=:99.0"
|
||||
- sleep 3 # give xvfb some time to start
|
||||
- wget http://downloads.arduino.cc/arduino-1.8.16-linux64.tar.xz
|
||||
- tar xf arduino-1.8.16-linux64.tar.xz
|
||||
- mv arduino-1.8.16 $HOME/arduino_ide
|
||||
- wget https://downloads.arduino.cc/arduino-1.8.19-linux64.tar.xz
|
||||
- tar xf arduino-1.8.19-linux64.tar.xz
|
||||
- mv arduino-1.8.19 $HOME/arduino_ide
|
||||
- cd $HOME/arduino_ide/hardware
|
||||
- mkdir esp32
|
||||
- cd esp32
|
||||
|
@ -32,7 +33,7 @@ before_script:
|
|||
script:
|
||||
- cd $TRAVIS_BUILD_DIR
|
||||
- export PATH="$HOME/arduino_ide:$PATH"
|
||||
- arduino --board esp32:esp32:esp32:PartitionScheme=huge_app,FlashFreq=80 --pref compiler.warning_level=all --save-prefs
|
||||
- arduino --board esp32:esp32:esp32:PSRAM=enabled,PartitionScheme=huge_app,FlashFreq=80 --pref compiler.warning_level=all --save-prefs
|
||||
- arduino --verbose --verify esp32-cam-webserver.ino
|
||||
- cp --preserve --verbose myconfig.sample.h myconfig.h
|
||||
- arduino --verbose --verify esp32-cam-webserver.ino
|
||||
|
|
|
@ -87,6 +87,8 @@ To make a permanent config with your home wifi settings, different defaults or a
|
|||
Assuming you are using the latest Espressif Arduino core the `AI-THINKER` board (or whatever board you select for programming) will appear in the ESP32 Arduino section of the boards list.
|
||||

|
||||
|
||||
If you have a different board and are using a generic ESP32 DEV board select `Huge APP (3MB No OTA/1MB SPIFFS` for the partition scheme, and make sure PSRAM is enabled (it defaults to off!)
|
||||
|
||||
Compile and upload the code from the IDE, when the `Connecting...` appears in the console reboot the ESP32 module while keeping **GPIO0** grounded. You can release GPO0 once the sketch is uploading, most boards have a 'boot' button to trigger a reboot.
|
||||
|
||||
Once the upload completes (be patient, it can be a bit slow) open the serial monitor in the IDE and reboot the board again without GPIO0 grounded. In the serial monitor you should see the board start, connect to the wifi and then report the IP address it has been assigned.
|
||||
|
|
|
@ -64,6 +64,8 @@ extern int sketchSpace;
|
|||
extern String sketchMD5;
|
||||
extern char knownFaceText[];
|
||||
extern char unknownFaceText[];
|
||||
extern unsigned long xclkFreqHz;
|
||||
|
||||
|
||||
|
||||
#include "fb_gfx.h"
|
||||
|
@ -260,11 +262,7 @@ static int run_face_recognition(dl_matrix3du_t *image_matrix, box_array_t *net_b
|
|||
}
|
||||
|
||||
void serialDump() {
|
||||
Serial.println("\r\nPreferences file: ");
|
||||
dumpPrefs(SPIFFS);
|
||||
if (critERR.length() > 0) {
|
||||
Serial.printf("\r\n\r\nA critical error has occurred when initialising Camera Hardware, see startup megssages\r\n");
|
||||
}
|
||||
Serial.println();
|
||||
// Module
|
||||
Serial.printf("Name: %s\r\n", myName);
|
||||
Serial.printf("Firmware: %s (base: %s)\r\n", myVer, baseVersion);
|
||||
|
@ -303,15 +301,33 @@ void serialDump() {
|
|||
int upHours = int64_t(floor(sec/3600)) % 24;
|
||||
int upMin = int64_t(floor(sec/60)) % 60;
|
||||
int upSec = sec % 60;
|
||||
int McuTc = (temprature_sens_read() - 32) / 1.8; // celsius
|
||||
int McuTf = temprature_sens_read(); // fahrenheit
|
||||
float xclk = xclkFreqHz/1000000;
|
||||
Serial.printf("System up: %" PRId64 ":%02i:%02i:%02i (d:h:m:s)\r\n", upDays, upHours, upMin, upSec);
|
||||
Serial.printf("Active streams: %i, Previous streams: %lu, Images captured: %lu\r\n", streamCount, streamsServed, imagesServed);
|
||||
Serial.printf("Freq: %i MHz\r\n", ESP.getCpuFreqMHz());
|
||||
Serial.printf("CPU Freq: %i MHz, Xclk Freq: %.1f MHz\r\n", ESP.getCpuFreqMHz(), xclk);
|
||||
Serial.printf("MCU temperature : %i C, %i F (approximate)\r\n", McuTc, McuTf);
|
||||
Serial.printf("Heap: %i, free: %i, min free: %i, max block: %i\r\n", ESP.getHeapSize(), ESP.getFreeHeap(), ESP.getMinFreeHeap(), ESP.getMaxAllocHeap());
|
||||
Serial.printf("Psram: %i, free: %i, min free: %i, max block: %i\r\n", ESP.getPsramSize(), ESP.getFreePsram(), ESP.getMinFreePsram(), ESP.getMaxAllocPsram());
|
||||
if (filesystem) {
|
||||
if(psramFound()) {
|
||||
Serial.printf("Psram: %i, free: %i, min free: %i, max block: %i\r\n", ESP.getPsramSize(), ESP.getFreePsram(), ESP.getMinFreePsram(), ESP.getMaxAllocPsram());
|
||||
} else {
|
||||
Serial.printf("Psram: Not found; please check your board configuration.\r\n");
|
||||
Serial.printf("- High resolution/quality settings will show incomplete frames due to low memory.\r\n");
|
||||
}
|
||||
// Filesystems
|
||||
if (filesystem && (SPIFFS.totalBytes() > 0)) {
|
||||
Serial.printf("Spiffs: %i, used: %i\r\n", SPIFFS.totalBytes(), SPIFFS.usedBytes());
|
||||
} else {
|
||||
Serial.printf("Spiffs: No filesystem found, please check your board configuration.\r\n");
|
||||
Serial.printf("- Saving and restoring camera settings will not function without this.\r\n");
|
||||
}
|
||||
Serial.printf("Enrolled faces: %i (max %i)\r\n", id_list.count, id_list.size);
|
||||
Serial.println("Preferences file: ");
|
||||
dumpPrefs(SPIFFS);
|
||||
if (critERR.length() > 0) {
|
||||
Serial.printf("\r\n\r\nA critical error has occurred when initialising Camera Hardware, see startup megssages\r\n");
|
||||
}
|
||||
Serial.println();
|
||||
return;
|
||||
}
|
||||
|
@ -333,7 +349,10 @@ static esp_err_t capture_handler(httpd_req_t *req){
|
|||
esp_err_t res = ESP_OK;
|
||||
|
||||
Serial.println("Capture Requested");
|
||||
if (autoLamp && (lampVal != -1)) setLamp(lampVal);
|
||||
if (autoLamp && (lampVal != -1)) {
|
||||
setLamp(lampVal);
|
||||
delay(75); // coupled with the status led flash this gives ~150ms for lamp to settle.
|
||||
}
|
||||
flashLED(75); // little flash of status LED
|
||||
|
||||
int64_t fr_start = esp_timer_get_time();
|
||||
|
@ -392,7 +411,8 @@ static esp_err_t capture_handler(httpd_req_t *req){
|
|||
|
||||
s = fmt2rgb888(fb->buf, fb->len, fb->format, out_buf);
|
||||
esp_camera_fb_return(fb);
|
||||
if(!s){
|
||||
fb = NULL;
|
||||
if(!s){
|
||||
dl_matrix3du_free(image_matrix);
|
||||
Serial.println("CAPTURE: frame convert to rgb888 failed");
|
||||
httpd_resp_send_500(req);
|
||||
|
@ -429,7 +449,9 @@ static esp_err_t capture_handler(httpd_req_t *req){
|
|||
}
|
||||
|
||||
imagesServed++;
|
||||
if (autoLamp && (lampVal != -1)) setLamp(0);
|
||||
if (autoLamp && (lampVal != -1)) {
|
||||
setLamp(0);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -609,6 +631,7 @@ static esp_err_t cmd_handler(httpd_req_t *req){
|
|||
size_t buf_len;
|
||||
char variable[32] = {0,};
|
||||
char value[32] = {0,};
|
||||
|
||||
flashLED(75);
|
||||
|
||||
buf_len = httpd_req_get_url_query_len(req) + 1;
|
||||
|
@ -835,8 +858,8 @@ static esp_err_t dump_handler(httpd_req_t *req){
|
|||
d+= sprintf(d,"<body>\n");
|
||||
d+= sprintf(d,"<img src=\"/logo.svg\" style=\"position: relative; float: right;\">\n");
|
||||
if (critERR.length() > 0) {
|
||||
d+= sprintf(d,"Hardware Error Detected!\n(the serial log may give more information)\n");
|
||||
d+= sprintf(d,"%s<hr>\n", critERR.c_str());
|
||||
d+= sprintf(d,"<span style=\"color:red;\">%s<hr></span>\n", critERR.c_str());
|
||||
d+= sprintf(d,"<h2 style=\"color:red;\">(the serial log may give more information)</h2><br>\n");
|
||||
}
|
||||
d+= sprintf(d,"<h1>ESP32 Cam Webserver</h1>\n");
|
||||
// Module
|
||||
|
@ -882,16 +905,25 @@ static esp_err_t dump_handler(httpd_req_t *req){
|
|||
int upSec = sec % 60;
|
||||
int McuTc = (temprature_sens_read() - 32) / 1.8; // celsius
|
||||
int McuTf = temprature_sens_read(); // fahrenheit
|
||||
float xclk = xclkFreqHz/1000000;
|
||||
|
||||
d+= sprintf(d,"Up: %" PRId64 ":%02i:%02i:%02i (d:h:m:s)<br>\n", upDays, upHours, upMin, upSec);
|
||||
d+= sprintf(d,"Active streams: %i, Previous streams: %lu, Images captured: %lu<br>\n", streamCount, streamsServed, imagesServed);
|
||||
d+= sprintf(d,"Freq: %i MHz<br>\n", ESP.getCpuFreqMHz());
|
||||
d+= sprintf(d,"CPU Freq: %i MHz, Xclk Freq: %.1f MHz<br>\n", ESP.getCpuFreqMHz(), xclk);
|
||||
d+= sprintf(d,"<span title=\"NOTE: Internal temperature sensor readings can be innacurate on the ESP32-c1 chipset, and may vary significantly between devices!\">");
|
||||
d+= sprintf(d,"MCU temperature : %i °C, %i °F</span>\n<br>", McuTc, McuTf);
|
||||
d+= sprintf(d,"Heap: %i, free: %i, min free: %i, max block: %i<br>\n", ESP.getHeapSize(), ESP.getFreeHeap(), ESP.getMinFreeHeap(), ESP.getMaxAllocHeap());
|
||||
d+= sprintf(d,"Psram: %i, free: %i, min free: %i, max block: %i<br>\n", ESP.getPsramSize(), ESP.getFreePsram(), ESP.getMinFreePsram(), ESP.getMaxAllocPsram());
|
||||
if (filesystem) {
|
||||
if (psramFound()) {
|
||||
d+= sprintf(d,"Psram: %i, free: %i, min free: %i, max block: %i<br>\n", ESP.getPsramSize(), ESP.getFreePsram(), ESP.getMinFreePsram(), ESP.getMaxAllocPsram());
|
||||
} else {
|
||||
d+= sprintf(d,"Psram: <span style=\"color:red;\">Not found</span>, please check your board configuration.<br>\n");
|
||||
d+= sprintf(d,"- High resolution/quality images & streams will show incomplete frames due to low memory.<br>\n");
|
||||
}
|
||||
if (filesystem && (SPIFFS.totalBytes() > 0)) {
|
||||
d+= sprintf(d,"Spiffs: %i, used: %i<br>\n", SPIFFS.totalBytes(), SPIFFS.usedBytes());
|
||||
} else {
|
||||
d+= sprintf(d,"Spiffs: <span style=\"color:red;\">No filesystem found</span>, please check your board configuration.<br>\n");
|
||||
d+= sprintf(d,"- saving and restoring camera settings will not function without this.<br>\n");
|
||||
}
|
||||
d+= sprintf(d,"Enrolled faces: %i (max %i)<br>\n", id_list.count, id_list.size);
|
||||
|
||||
|
|
|
@ -5,7 +5,33 @@
|
|||
* Defaults to AI-THINKER CAM module
|
||||
*
|
||||
*/
|
||||
#if defined(CAMERA_MODEL_WROVER_KIT)
|
||||
#if defined(CAMERA_MODEL_AI_THINKER)
|
||||
//
|
||||
// AI Thinker
|
||||
// https://github.com/SeeedDocument/forum_doc/raw/master/reg/ESP32_CAM_V1.6.pdf
|
||||
//
|
||||
#define PWDN_GPIO_NUM 32
|
||||
#define RESET_GPIO_NUM -1
|
||||
#define XCLK_GPIO_NUM 0
|
||||
#define SIOD_GPIO_NUM 26
|
||||
#define SIOC_GPIO_NUM 27
|
||||
#define Y9_GPIO_NUM 35
|
||||
#define Y8_GPIO_NUM 34
|
||||
#define Y7_GPIO_NUM 39
|
||||
#define Y6_GPIO_NUM 36
|
||||
#define Y5_GPIO_NUM 21
|
||||
#define Y4_GPIO_NUM 19
|
||||
#define Y3_GPIO_NUM 18
|
||||
#define Y2_GPIO_NUM 5
|
||||
#define VSYNC_GPIO_NUM 25
|
||||
#define HREF_GPIO_NUM 23
|
||||
#define PCLK_GPIO_NUM 22
|
||||
#define LED_PIN 33 // Status led
|
||||
#define LED_ON LOW // - Pin is inverted.
|
||||
#define LED_OFF HIGH //
|
||||
#define LAMP_PIN 4 // LED FloodLamp.
|
||||
|
||||
#elif defined(CAMERA_MODEL_WROVER_KIT)
|
||||
//
|
||||
// ESP WROVER
|
||||
// https://dl.espressif.com/dl/schematics/ESP-WROVER-KIT_SCH-2.pdf
|
||||
|
@ -161,32 +187,6 @@
|
|||
// #define LED_OFF LOW //
|
||||
// #define LAMP_PIN x // LED FloodLamp.
|
||||
|
||||
#elif defined(CAMERA_MODEL_AI_THINKER)
|
||||
//
|
||||
// AI Thinker
|
||||
// https://github.com/SeeedDocument/forum_doc/raw/master/reg/ESP32_CAM_V1.6.pdf
|
||||
//
|
||||
#define PWDN_GPIO_NUM 32
|
||||
#define RESET_GPIO_NUM -1
|
||||
#define XCLK_GPIO_NUM 0
|
||||
#define SIOD_GPIO_NUM 26
|
||||
#define SIOC_GPIO_NUM 27
|
||||
#define Y9_GPIO_NUM 35
|
||||
#define Y8_GPIO_NUM 34
|
||||
#define Y7_GPIO_NUM 39
|
||||
#define Y6_GPIO_NUM 36
|
||||
#define Y5_GPIO_NUM 21
|
||||
#define Y4_GPIO_NUM 19
|
||||
#define Y3_GPIO_NUM 18
|
||||
#define Y2_GPIO_NUM 5
|
||||
#define VSYNC_GPIO_NUM 25
|
||||
#define HREF_GPIO_NUM 23
|
||||
#define PCLK_GPIO_NUM 22
|
||||
#define LED_PIN 33 // Status led
|
||||
#define LED_ON LOW // - Pin is inverted.
|
||||
#define LED_OFF HIGH //
|
||||
#define LAMP_PIN 4 // LED FloodLamp.
|
||||
|
||||
#elif defined(CAMERA_MODEL_TTGO_T_JOURNAL)
|
||||
//
|
||||
// LilyGO TTGO T-Journal ESP32; with OLED! but not used here.. :-(
|
||||
|
@ -212,6 +212,31 @@
|
|||
// #define LED_OFF HIGH //
|
||||
// #define LAMP_PIN 4 // LED FloodLamp.
|
||||
|
||||
#elif defined(CAMERA_MODEL_ARDUCAM_ESP32S_UNO)
|
||||
// Pins from user @rdragonrydr
|
||||
// https://github.com/ArduCAM/ArduCAM_ESP32S_UNO/
|
||||
// Based on AI-THINKER definitions
|
||||
#define PWDN_GPIO_NUM 32
|
||||
#define RESET_GPIO_NUM -1
|
||||
#define XCLK_GPIO_NUM 0
|
||||
#define SIOD_GPIO_NUM 26
|
||||
#define SIOC_GPIO_NUM 27
|
||||
#define Y9_GPIO_NUM 35
|
||||
#define Y8_GPIO_NUM 34
|
||||
#define Y7_GPIO_NUM 39
|
||||
#define Y6_GPIO_NUM 36
|
||||
#define Y5_GPIO_NUM 21
|
||||
#define Y4_GPIO_NUM 19
|
||||
#define Y3_GPIO_NUM 18
|
||||
#define Y2_GPIO_NUM 5
|
||||
#define VSYNC_GPIO_NUM 25
|
||||
#define HREF_GPIO_NUM 23
|
||||
#define PCLK_GPIO_NUM 22
|
||||
#define LED_PIN 2 // Status led
|
||||
#define LED_ON HIGH // - Pin is not inverted.
|
||||
#define LED_OFF LOW //
|
||||
//#define LAMP_PIN x // No LED FloodLamp.
|
||||
|
||||
#else
|
||||
// Well.
|
||||
// that went badly...
|
||||
|
|
|
@ -93,7 +93,7 @@ extern void serialDump();
|
|||
#endif
|
||||
|
||||
#if !defined(WIFI_WATCHDOG)
|
||||
#define WIFI_WATCHDOG 5000
|
||||
#define WIFI_WATCHDOG 15000
|
||||
#endif
|
||||
|
||||
// Number of known networks in stationList[]
|
||||
|
@ -131,6 +131,15 @@ unsigned long imagesServed = 0; // Total image requests
|
|||
// This will be displayed to identify the firmware
|
||||
char myVer[] PROGMEM = __DATE__ " @ " __TIME__;
|
||||
|
||||
// Camera module bus communications frequency.
|
||||
// Originally: config.xclk_freq_hz = 20000000, but this lead to visual artifacts on many modules.
|
||||
// See https://github.com/espressif/esp32-camera/issues/150#issuecomment-726473652 et al.
|
||||
#if !defined (XCLK_FREQ_HZ)
|
||||
unsigned long xclkFreqHz = 16500000;
|
||||
#else
|
||||
unsigned long xclkFreqHz = XCLK_FREQ_HZ;
|
||||
#endif
|
||||
|
||||
// initial rotation
|
||||
// can be set in myconfig.h
|
||||
#if !defined(CAM_ROTATION)
|
||||
|
@ -495,9 +504,9 @@ void setup() {
|
|||
config.pin_sscb_scl = SIOC_GPIO_NUM;
|
||||
config.pin_pwdn = PWDN_GPIO_NUM;
|
||||
config.pin_reset = RESET_GPIO_NUM;
|
||||
config.xclk_freq_hz = 20000000;
|
||||
config.xclk_freq_hz = xclkFreqHz;
|
||||
config.pixel_format = PIXFORMAT_JPEG;
|
||||
//init with highest supported specs to pre-allocate large buffers
|
||||
// Pre-allocate large buffers
|
||||
if(psramFound()){
|
||||
config.frame_size = FRAMESIZE_UXGA;
|
||||
config.jpeg_quality = 10;
|
||||
|
@ -611,6 +620,7 @@ void setup() {
|
|||
// check for saved preferences and apply them
|
||||
|
||||
if (filesystem) {
|
||||
delay(200); // a short delay to let spi bus settle after camera init
|
||||
filesystemStart();
|
||||
loadPrefs(SPIFFS);
|
||||
loadFaceDB(SPIFFS);
|
||||
|
@ -662,6 +672,13 @@ void setup() {
|
|||
|
||||
// As a final init step chomp out the serial buffer in case we have recieved mis-keys or garbage during startup
|
||||
while (Serial.available()) Serial.read();
|
||||
|
||||
// Warn if no PSRAM is detected (typically user error with board selection in the IDE)
|
||||
if(!psramFound()){
|
||||
Serial.printf("\r\nNo PSRAM found.\r\nPlease check the board config for your module.\r\n");
|
||||
Serial.printf("High resolution/quality images & streams will show incomplete frames due to low memory.\r\n");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void loop() {
|
||||
|
|
|
@ -12,6 +12,10 @@
|
|||
src_dir = ./
|
||||
|
||||
[env:esp32cam]
|
||||
platform = espressif32
|
||||
platform = https://github.com/platformio/platform-espressif32.git#feature/arduino-upstream
|
||||
platform_packages = framework-arduinoespressif32@https://github.com/espressif/arduino-esp32.git#2.0.0
|
||||
board = esp32cam
|
||||
framework = arduino
|
||||
build_flags =
|
||||
-DBOARD_HAS_PSRAM
|
||||
-mfix-esp32-psram-cache-issue
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
/* Version of upstream code */
|
||||
|
||||
char baseVersion[] = "3.4";
|
||||
char baseVersion[] = "3.5-beta1";
|
||||
|
|
Loading…
Reference in New Issue