├── .gitignore ├── Formal edition ├── v20031 │ ├── ESP32FtpServer.cpp │ ├── ESP32FtpServer.h │ ├── README.MD │ ├── motionDetect.cpp │ ├── motionDetect.h │ └── v20031.ino ├── v20051 │ ├── ESP32FtpServer.cpp │ ├── ESP32FtpServer.h │ ├── README.MD │ ├── motionDetect.cpp │ ├── motionDetect.h │ └── v20051.ino ├── v20061 │ ├── ESP32FtpServer.cpp │ ├── ESP32FtpServer.h │ ├── README.MD │ ├── motionDetect.cpp │ ├── motionDetect.h │ └── v20061.ino └── v20081 │ ├── ESP32FtpServer.cpp │ ├── ESP32FtpServer.h │ ├── README.MD │ ├── motionDetect.cpp │ ├── motionDetect.h │ └── v20081.ino ├── LICENSE ├── README.md ├── References ├── ESP32-CAM-StaticIP-AP-FlashLED-master │ ├── ARDUINO │ │ └── CameraWebServer │ │ │ ├── CameraWebServer.ino │ │ │ ├── app_httpd.cpp │ │ │ ├── camera_index.h │ │ │ └── camera_pins.h │ ├── HTML GZ EDITOR │ │ ├── README.txt │ │ ├── camera.html │ │ ├── camera.html.gz │ │ └── filetoarray.cpp │ └── README.md ├── ESP32-CAM-Video-Recorder-master │ ├── ESP32-CAM-Video-Recorder-master │ │ ├── LICENSE │ │ ├── README.md │ │ ├── de-solder.png │ │ ├── de-solder3.png │ │ ├── v23 │ │ │ ├── ESP32FtpServer.cpp │ │ │ ├── ESP32FtpServer.h │ │ │ ├── README.md │ │ │ └── TimeLapseAvi23x.ino │ │ └── v39 │ │ │ ├── ESP32FtpServer.cpp │ │ │ ├── ESP32FtpServer.h │ │ │ ├── README.md │ │ │ └── TimeLapseAvi39x.ino │ ├── LICENSE │ ├── README.md │ ├── de-solder.png │ ├── de-solder3.png │ ├── v23 │ │ ├── ESP32FtpServer.cpp │ │ ├── ESP32FtpServer.h │ │ ├── README.md │ │ └── TimeLapseAvi23x.ino │ ├── v39 │ │ ├── ESP32FtpServer.cpp │ │ ├── ESP32FtpServer.h │ │ ├── README.md │ │ └── TimeLapseAvi39x.ino │ └── v60 │ │ ├── ESP32FtpServer.cpp │ │ ├── ESP32FtpServer.h │ │ ├── README.MD │ │ └── TimeLapseAvi60x.ino ├── [copy]CameraWifiMotion-master.zip ├── [copy]CameraWifiMotion-master │ └── CameraWifiMotion-master │ │ ├── CameraWifiMotion │ │ ├── CameraWifiMotion.ino │ │ ├── gmail_esp32.h │ │ ├── motion.h │ │ ├── ota.h │ │ ├── standard.h │ │ └── wifi.h │ │ ├── LICENSE │ │ ├── Libraries used.zip │ │ ├── Libraries used │ │ └── Libraries used │ │ │ ├── ESP32_Mail_Client │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── examples │ │ │ │ ├── Receive_email │ │ │ │ │ └── Receive_email.ino │ │ │ │ ├── Send_email │ │ │ │ │ ├── Send_email.ino │ │ │ │ │ └── image.h │ │ │ │ ├── Set_flag │ │ │ │ │ └── Set_flag.ino │ │ │ │ └── Time │ │ │ │ │ └── Time.ino │ │ │ ├── keywords.txt │ │ │ ├── library.properties │ │ │ ├── media │ │ │ │ └── images │ │ │ │ │ ├── esp32-mail.jpg │ │ │ │ │ └── esp32-mail.png │ │ │ └── src │ │ │ │ ├── ESP32MailHTTPClient.cpp │ │ │ │ ├── ESP32MailHTTPClient.h │ │ │ │ ├── ESP32TimeHelper.cpp │ │ │ │ ├── ESP32TimeHelper.h │ │ │ │ ├── ESP32_MailClient.cpp │ │ │ │ ├── ESP32_MailClient.h │ │ │ │ ├── RFC2047.cpp │ │ │ │ ├── RFC2047.h │ │ │ │ ├── WiFiClientSecureESP32.cpp │ │ │ │ ├── WiFiClientSecureESP32.h │ │ │ │ ├── ssl_client32.cpp │ │ │ │ └── ssl_client32.h │ │ │ ├── ESP_WiFiManager-master │ │ │ ├── .gitignore │ │ │ ├── CONTRIBUTING.md │ │ │ ├── Images │ │ │ │ ├── Configuration.png │ │ │ │ ├── Info.png │ │ │ │ ├── Info_Short.png │ │ │ │ ├── Info_Short_1-0-5.png │ │ │ │ ├── Main.png │ │ │ │ └── Main_1-0-5.png │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── examples │ │ │ │ ├── AutoConnect │ │ │ │ │ └── AutoConnect.ino │ │ │ │ ├── AutoConnectWithFSParameters │ │ │ │ │ └── AutoConnectWithFSParameters.ino │ │ │ │ ├── AutoConnectWithFeedback │ │ │ │ │ └── AutoConnectWithFeedback.ino │ │ │ │ ├── AutoConnectWithFeedbackLED │ │ │ │ │ └── AutoConnectWithFeedbackLED.ino │ │ │ │ ├── ConfigOnDoubleReset │ │ │ │ │ └── ConfigOnDoubleReset.ino │ │ │ │ ├── ConfigOnStartup │ │ │ │ │ └── ConfigOnStartup.ino │ │ │ │ ├── ConfigOnSwitch │ │ │ │ │ ├── ConfigOnSwitch.ino │ │ │ │ │ └── README.md │ │ │ │ ├── ConfigOnSwitchFS │ │ │ │ │ └── ConfigOnSwitchFS.ino │ │ │ │ ├── ConfigPortalParamsOnSwitch │ │ │ │ │ └── ConfigPortalParamsOnSwitch.ino │ │ │ │ └── ESP_FSWebServer │ │ │ │ │ ├── ESP_FSWebServer.ino │ │ │ │ │ ├── README.md │ │ │ │ │ ├── data │ │ │ │ │ ├── CanadaFlag_1.png │ │ │ │ │ ├── CanadaFlag_2.png │ │ │ │ │ ├── CanadaFlag_3.jpg │ │ │ │ │ ├── edit.htm.gz │ │ │ │ │ ├── favicon.ico │ │ │ │ │ ├── graphs.js.gz │ │ │ │ │ └── index.htm │ │ │ │ │ └── pics │ │ │ │ │ ├── esp8266fs.local.png │ │ │ │ │ └── esp8266fs.local_edit.png │ │ │ ├── keywords.txt │ │ │ ├── library.json │ │ │ ├── library.properties │ │ │ ├── src │ │ │ │ ├── ESP_WiFiManager.cpp │ │ │ │ └── ESP_WiFiManager.h │ │ │ └── travis │ │ │ │ └── common.sh │ │ │ ├── Time │ │ │ ├── DateStrings.cpp │ │ │ ├── Readme.txt │ │ │ ├── Time.cpp │ │ │ ├── Time.h │ │ │ ├── TimeLib.h │ │ │ ├── examples │ │ │ │ ├── Processing │ │ │ │ │ └── SyncArduinoClock │ │ │ │ │ │ ├── SyncArduinoClock.pde │ │ │ │ │ │ └── readme.txt │ │ │ │ ├── TimeArduinoDue │ │ │ │ │ └── TimeArduinoDue.ino │ │ │ │ ├── TimeGPS │ │ │ │ │ └── TimeGPS.ino │ │ │ │ ├── TimeNTP │ │ │ │ │ └── TimeNTP.ino │ │ │ │ ├── TimeNTP_ESP8266WiFi │ │ │ │ │ └── TimeNTP_ESP8266WiFi.ino │ │ │ │ ├── TimeRTC │ │ │ │ │ └── TimeRTC.ino │ │ │ │ ├── TimeRTCLog │ │ │ │ │ └── TimeRTCLog.ino │ │ │ │ ├── TimeRTCSet │ │ │ │ │ └── TimeRTCSet.ino │ │ │ │ ├── TimeSerial │ │ │ │ │ └── TimeSerial.ino │ │ │ │ ├── TimeSerialDateStrings │ │ │ │ │ └── TimeSerialDateStrings.ino │ │ │ │ └── TimeTeensy3 │ │ │ │ │ └── TimeTeensy3.ino │ │ │ ├── keywords.txt │ │ │ ├── library.json │ │ │ └── library.properties │ │ │ ├── WebServer │ │ │ ├── examples │ │ │ │ ├── AdvancedWebServer │ │ │ │ │ └── AdvancedWebServer.ino │ │ │ │ ├── FSBrowser │ │ │ │ │ ├── FSBrowser.ino │ │ │ │ │ └── data │ │ │ │ │ │ ├── edit.htm.gz │ │ │ │ │ │ ├── favicon.ico │ │ │ │ │ │ ├── graphs.js.gz │ │ │ │ │ │ └── index.htm │ │ │ │ ├── HelloServer │ │ │ │ │ └── HelloServer.ino │ │ │ │ ├── HttpAdvancedAuth │ │ │ │ │ └── HttpAdvancedAuth.ino │ │ │ │ ├── HttpBasicAuth │ │ │ │ │ └── HttpBasicAuth.ino │ │ │ │ ├── PathArgServer │ │ │ │ │ └── PathArgServer.ino │ │ │ │ ├── SDWebServer │ │ │ │ │ ├── SDWebServer.ino │ │ │ │ │ └── SdRoot │ │ │ │ │ │ ├── edit │ │ │ │ │ │ └── index.htm │ │ │ │ │ │ ├── index.htm │ │ │ │ │ │ └── pins.png │ │ │ │ ├── SimpleAuthentification │ │ │ │ │ └── SimpleAuthentification.ino │ │ │ │ └── WebUpdate │ │ │ │ │ └── WebUpdate.ino │ │ │ ├── keywords.txt │ │ │ ├── library.properties │ │ │ └── src │ │ │ │ ├── HTTP_Method.h │ │ │ │ ├── Parsing.cpp │ │ │ │ ├── WebServer.cpp │ │ │ │ ├── WebServer.h │ │ │ │ └── detail │ │ │ │ ├── RequestHandler.h │ │ │ │ ├── RequestHandlersImpl.h │ │ │ │ ├── mimetable.cpp │ │ │ │ └── mimetable.h │ │ │ └── esp32-camera-master │ │ │ ├── .gitignore │ │ │ ├── CMakeLists.txt │ │ │ ├── Kconfig │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── component.mk │ │ │ ├── conversions │ │ │ ├── esp_jpg_decode.c │ │ │ ├── include │ │ │ │ ├── esp_jpg_decode.h │ │ │ │ └── img_converters.h │ │ │ ├── jpge.cpp │ │ │ ├── private_include │ │ │ │ ├── jpge.h │ │ │ │ └── yuv.h │ │ │ ├── to_bmp.c │ │ │ ├── to_jpg.cpp │ │ │ └── yuv.c │ │ │ ├── driver │ │ │ ├── camera.c │ │ │ ├── include │ │ │ │ ├── esp_camera.h │ │ │ │ └── sensor.h │ │ │ ├── private_include │ │ │ │ ├── camera_common.h │ │ │ │ ├── sccb.h │ │ │ │ ├── twi.h │ │ │ │ └── xclk.h │ │ │ ├── sccb.c │ │ │ ├── sensor.c │ │ │ ├── twi.c │ │ │ └── xclk.c │ │ │ └── sensors │ │ │ ├── ov2640.c │ │ │ ├── ov3660.c │ │ │ ├── ov7725.c │ │ │ └── private_include │ │ │ ├── ov2640.h │ │ │ ├── ov2640_regs.h │ │ │ ├── ov2640_settings.h │ │ │ ├── ov3660.h │ │ │ ├── ov3660_regs.h │ │ │ ├── ov3660_settings.h │ │ │ ├── ov7725.h │ │ │ └── ov7725_regs.h │ │ ├── readme.txt │ │ ├── screen capture 1.png │ │ └── screen capture 2.png ├── [copy]ESP32-CAM-Video-Recorder-master.zip ├── [copy]ESP32-CAM_Motion-master.zip ├── [copy]ESP32-CAM_Motion-master │ └── ESP32-CAM_Motion │ │ ├── ESP32-CAM_Motion.ino │ │ ├── LICENSE │ │ ├── README.md │ │ ├── camera_pins.h │ │ └── motionDetect.cpp ├── esp32-cam-camera-flash-sd-pins.webp ├── esp32-cam-pins.jpg ├── takePic2SD │ └── takePic2SD.ino └── 可切换分辨率版本 分析中 │ ├── ARDUINO │ └── CameraWebServer │ │ ├── CameraWebServer.ino │ │ ├── app_httpd.cpp │ │ ├── camera_index.h │ │ └── camera_pins.h │ ├── HTML GZ EDITOR │ ├── README.txt │ ├── camera.html │ ├── camera.html.gz │ └── filetoarray.cpp │ └── README.md └── Tested procedures ├── [fail]camChangeModeTest ├── camChangeModeTest │ └── camChangeModeTest.ino └── readme.md ├── batteryTest ├── ESP32FtpServer.cpp ├── ESP32FtpServer.h ├── README.MD ├── batteryTest.ino ├── motionDetect.cpp └── motionDetect.h ├── test2 ├── ESP32FtpServer.cpp ├── ESP32FtpServer.h ├── README.MD ├── motionDetect.cpp ├── motionDetect.h └── test2.ino ├── time └── time.ino ├── timeWeb └── timeWeb.ino └── 发时间的js └── time.html /.gitignore: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | *.d 3 | 4 | # Compiled Object files 5 | *.slo 6 | *.lo 7 | *.o 8 | *.obj 9 | 10 | # Precompiled Headers 11 | *.gch 12 | *.pch 13 | 14 | # Compiled Dynamic libraries 15 | *.so 16 | *.dylib 17 | *.dll 18 | 19 | # Fortran module files 20 | *.mod 21 | *.smod 22 | 23 | # Compiled Static libraries 24 | *.lai 25 | *.la 26 | *.a 27 | *.lib 28 | 29 | # Executables 30 | *.exe 31 | *.out 32 | *.app 33 | -------------------------------------------------------------------------------- /Formal edition/v20031/ESP32FtpServer.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * FTP SERVER FOR ESP8266 4 | * based on FTP Serveur for Arduino Due and Ethernet shield (W5100) or WIZ820io (W5200) 5 | * based on Jean-Michel Gallego's work 6 | * modified to work with esp8266 SPIFFS by David Paiva (david@nailbuster.com) 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program. If not, see . 20 | */ 21 | // 2017: modified by @robo8080 22 | // 2019: modified by @fa1ke5 23 | 24 | /******************************************************************************* 25 | ** ** 26 | ** DEFINITIONS FOR FTP SERVER ** 27 | ** ** 28 | *******************************************************************************/ 29 | 30 | // Uncomment to print debugging info to console attached to ESP8266 31 | //#define FTP_DEBUG 32 | 33 | #ifndef FTP_SERVERESP_H 34 | #define FTP_SERVERESP_H 35 | 36 | //#include "Streaming.h" 37 | #include "SD_MMC.h" 38 | #include 39 | #include 40 | 41 | #define FTP_SERVER_VERSION "FTP-2016-01-14" 42 | 43 | #define FTP_CTRL_PORT 21 // Command port on wich server is listening 44 | #define FTP_DATA_PORT_PASV 50009 // Data port in passive mode 45 | 46 | #define FTP_TIME_OUT 5 // Disconnect client after 5 minutes of inactivity 47 | #define FTP_CMD_SIZE 255 + 8 // max size of a command 48 | #define FTP_CWD_SIZE 255 + 8 // max size of a directory name 49 | #define FTP_FIL_SIZE 255 // max size of a file name 50 | 51 | //#define FTP_BUF_SIZE 512 //512 // size of file buffer for read/write 52 | //#define FTP_BUF_SIZE 2*1460 //512 // size of file buffer for read/write 53 | #define FTP_BUF_SIZE 4096 //512 // 700 KByte/s download in AP mode, direct connection. 54 | 55 | 56 | class FtpServer 57 | { 58 | public: 59 | void begin(String uname, String pword); 60 | void handleFTP(); 61 | 62 | private: 63 | bool haveParameter(); 64 | bool makeExistsPath( char * path, char * param = NULL ); 65 | void iniVariables(); 66 | void clientConnected(); 67 | void disconnectClient(); 68 | boolean userIdentity(); 69 | boolean userPassword(); 70 | boolean processCommand(); 71 | boolean dataConnect(); 72 | boolean doRetrieve(); 73 | boolean doStore(); 74 | void closeTransfer(); 75 | void abortTransfer(); 76 | boolean makePath( char * fullname ); 77 | boolean makePath( char * fullName, char * param ); 78 | uint8_t getDateTime( uint16_t * pyear, uint8_t * pmonth, uint8_t * pday, 79 | uint8_t * phour, uint8_t * pminute, uint8_t * second ); 80 | char * makeDateTimeStr( char * tstr, uint16_t date, uint16_t time ); 81 | int8_t readChar(); 82 | 83 | IPAddress dataIp; // IP address of client for data 84 | WiFiClient client; 85 | WiFiClient data; 86 | 87 | File file; 88 | 89 | boolean dataPassiveConn; 90 | uint16_t dataPort; 91 | char buf[ FTP_BUF_SIZE ]; // data buffer for transfers 92 | char cmdLine[ FTP_CMD_SIZE ]; // where to store incoming char from client 93 | char cwdName[ FTP_CWD_SIZE ]; // name of current directory 94 | char command[ 5 ]; // command sent by client 95 | boolean rnfrCmd; // previous command was RNFR 96 | char * parameters; // point to begin of parameters sent by client 97 | uint16_t iCL; // pointer to cmdLine next incoming char 98 | int8_t cmdStatus, // status of ftp command connexion 99 | transferStatus; // status of ftp data transfer 100 | uint32_t millisTimeOut, // disconnect after 5 min of inactivity 101 | millisDelay, 102 | millisEndConnection, // 103 | millisBeginTrans, // store time of beginning of a transaction 104 | bytesTransfered; // 105 | String _FTP_USER; 106 | String _FTP_PASS; 107 | 108 | 109 | 110 | }; 111 | 112 | #endif // FTP_SERVERESP_H 113 | -------------------------------------------------------------------------------- /Formal edition/v20031/README.MD: -------------------------------------------------------------------------------- 1 | # ESP32MotionDetectionWithVideoRecorder 2 | # ESP32移动侦测摄像机 3 | 4 | ### 目前功能: 5 | - 移动侦测 6 | - 自动录制视频 7 | 8 | ### 目前问题: 9 | -在SVGA清晰度下无法达到5fps 10 | 11 | ### 未来计划: 12 | - 性能优化 13 | - 降低功耗 14 | 15 | 从 https://github.com/jameszah/ESP32-CAM-Video-Recorder/ 改造而来 16 | 17 | 结合了https://github.com/s60sc/ESP32-CAM_Motion 18 | 19 | 补充了一个h文件 不然在编译的时候会有一点问题 处理得很粗糙,等待修改. 20 | 21 | #### 更新记录: 22 | - 2020.3.22 完成基本程序,或者说程序跑起来没问题. -------------------------------------------------------------------------------- /Formal edition/v20031/motionDetect.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asjdf/ESP32CAMmotion_detection/9e519fb6e63d87f2582c1cf37461fde63cc942e2/Formal edition/v20031/motionDetect.h -------------------------------------------------------------------------------- /Formal edition/v20051/ESP32FtpServer.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * FTP SERVER FOR ESP8266 4 | * based on FTP Serveur for Arduino Due and Ethernet shield (W5100) or WIZ820io (W5200) 5 | * based on Jean-Michel Gallego's work 6 | * modified to work with esp8266 SPIFFS by David Paiva (david@nailbuster.com) 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program. If not, see . 20 | */ 21 | // 2017: modified by @robo8080 22 | // 2019: modified by @fa1ke5 23 | 24 | /******************************************************************************* 25 | ** ** 26 | ** DEFINITIONS FOR FTP SERVER ** 27 | ** ** 28 | *******************************************************************************/ 29 | 30 | // Uncomment to print debugging info to console attached to ESP8266 31 | //#define FTP_DEBUG 32 | 33 | #ifndef FTP_SERVERESP_H 34 | #define FTP_SERVERESP_H 35 | 36 | //#include "Streaming.h" 37 | #include "SD_MMC.h" 38 | #include 39 | #include 40 | 41 | #define FTP_SERVER_VERSION "FTP-2016-01-14" 42 | 43 | #define FTP_CTRL_PORT 21 // Command port on wich server is listening 44 | #define FTP_DATA_PORT_PASV 50009 // Data port in passive mode 45 | 46 | #define FTP_TIME_OUT 5 // Disconnect client after 5 minutes of inactivity 47 | #define FTP_CMD_SIZE 255 + 8 // max size of a command 48 | #define FTP_CWD_SIZE 255 + 8 // max size of a directory name 49 | #define FTP_FIL_SIZE 255 // max size of a file name 50 | 51 | //#define FTP_BUF_SIZE 512 //512 // size of file buffer for read/write 52 | //#define FTP_BUF_SIZE 2*1460 //512 // size of file buffer for read/write 53 | #define FTP_BUF_SIZE 4096 //512 // 700 KByte/s download in AP mode, direct connection. 54 | 55 | 56 | class FtpServer 57 | { 58 | public: 59 | void begin(String uname, String pword); 60 | void handleFTP(); 61 | 62 | private: 63 | bool haveParameter(); 64 | bool makeExistsPath( char * path, char * param = NULL ); 65 | void iniVariables(); 66 | void clientConnected(); 67 | void disconnectClient(); 68 | boolean userIdentity(); 69 | boolean userPassword(); 70 | boolean processCommand(); 71 | boolean dataConnect(); 72 | boolean doRetrieve(); 73 | boolean doStore(); 74 | void closeTransfer(); 75 | void abortTransfer(); 76 | boolean makePath( char * fullname ); 77 | boolean makePath( char * fullName, char * param ); 78 | uint8_t getDateTime( uint16_t * pyear, uint8_t * pmonth, uint8_t * pday, 79 | uint8_t * phour, uint8_t * pminute, uint8_t * second ); 80 | char * makeDateTimeStr( char * tstr, uint16_t date, uint16_t time ); 81 | int8_t readChar(); 82 | 83 | IPAddress dataIp; // IP address of client for data 84 | WiFiClient client; 85 | WiFiClient data; 86 | 87 | File file; 88 | 89 | boolean dataPassiveConn; 90 | uint16_t dataPort; 91 | char buf[ FTP_BUF_SIZE ]; // data buffer for transfers 92 | char cmdLine[ FTP_CMD_SIZE ]; // where to store incoming char from client 93 | char cwdName[ FTP_CWD_SIZE ]; // name of current directory 94 | char command[ 5 ]; // command sent by client 95 | boolean rnfrCmd; // previous command was RNFR 96 | char * parameters; // point to begin of parameters sent by client 97 | uint16_t iCL; // pointer to cmdLine next incoming char 98 | int8_t cmdStatus, // status of ftp command connexion 99 | transferStatus; // status of ftp data transfer 100 | uint32_t millisTimeOut, // disconnect after 5 min of inactivity 101 | millisDelay, 102 | millisEndConnection, // 103 | millisBeginTrans, // store time of beginning of a transaction 104 | bytesTransfered; // 105 | String _FTP_USER; 106 | String _FTP_PASS; 107 | 108 | 109 | 110 | }; 111 | 112 | #endif // FTP_SERVERESP_H 113 | -------------------------------------------------------------------------------- /Formal edition/v20051/README.MD: -------------------------------------------------------------------------------- 1 | 再次优化了一下,这个版本是脱网的 自动创建ap,时间通过用户浏览器校准. 2 | 3 | 使用时先连ap:LinkTest 密码:87654321 4 | 5 | 然后访问192.168.4.1/time校准时间顺便启动侦测 6 | 7 | 2020.5.10 -------------------------------------------------------------------------------- /Formal edition/v20051/motionDetect.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asjdf/ESP32CAMmotion_detection/9e519fb6e63d87f2582c1cf37461fde63cc942e2/Formal edition/v20051/motionDetect.h -------------------------------------------------------------------------------- /Formal edition/v20061/ESP32FtpServer.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * FTP SERVER FOR ESP8266 4 | * based on FTP Serveur for Arduino Due and Ethernet shield (W5100) or WIZ820io (W5200) 5 | * based on Jean-Michel Gallego's work 6 | * modified to work with esp8266 SPIFFS by David Paiva (david@nailbuster.com) 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program. If not, see . 20 | */ 21 | // 2017: modified by @robo8080 22 | // 2019: modified by @fa1ke5 23 | 24 | /******************************************************************************* 25 | ** ** 26 | ** DEFINITIONS FOR FTP SERVER ** 27 | ** ** 28 | *******************************************************************************/ 29 | 30 | // Uncomment to print debugging info to console attached to ESP8266 31 | //#define FTP_DEBUG 32 | 33 | #ifndef FTP_SERVERESP_H 34 | #define FTP_SERVERESP_H 35 | 36 | //#include "Streaming.h" 37 | #include "SD_MMC.h" 38 | #include 39 | #include 40 | 41 | #define FTP_SERVER_VERSION "FTP-2016-01-14" 42 | 43 | #define FTP_CTRL_PORT 21 // Command port on wich server is listening 44 | #define FTP_DATA_PORT_PASV 50009 // Data port in passive mode 45 | 46 | #define FTP_TIME_OUT 5 // Disconnect client after 5 minutes of inactivity 47 | #define FTP_CMD_SIZE 255 + 8 // max size of a command 48 | #define FTP_CWD_SIZE 255 + 8 // max size of a directory name 49 | #define FTP_FIL_SIZE 255 // max size of a file name 50 | 51 | //#define FTP_BUF_SIZE 512 //512 // size of file buffer for read/write 52 | //#define FTP_BUF_SIZE 2*1460 //512 // size of file buffer for read/write 53 | #define FTP_BUF_SIZE 4096 //512 // 700 KByte/s download in AP mode, direct connection. 54 | 55 | 56 | class FtpServer 57 | { 58 | public: 59 | void begin(String uname, String pword); 60 | void handleFTP(); 61 | 62 | private: 63 | bool haveParameter(); 64 | bool makeExistsPath( char * path, char * param = NULL ); 65 | void iniVariables(); 66 | void clientConnected(); 67 | void disconnectClient(); 68 | boolean userIdentity(); 69 | boolean userPassword(); 70 | boolean processCommand(); 71 | boolean dataConnect(); 72 | boolean doRetrieve(); 73 | boolean doStore(); 74 | void closeTransfer(); 75 | void abortTransfer(); 76 | boolean makePath( char * fullname ); 77 | boolean makePath( char * fullName, char * param ); 78 | uint8_t getDateTime( uint16_t * pyear, uint8_t * pmonth, uint8_t * pday, 79 | uint8_t * phour, uint8_t * pminute, uint8_t * second ); 80 | char * makeDateTimeStr( char * tstr, uint16_t date, uint16_t time ); 81 | int8_t readChar(); 82 | 83 | IPAddress dataIp; // IP address of client for data 84 | WiFiClient client; 85 | WiFiClient data; 86 | 87 | File file; 88 | 89 | boolean dataPassiveConn; 90 | uint16_t dataPort; 91 | char buf[ FTP_BUF_SIZE ]; // data buffer for transfers 92 | char cmdLine[ FTP_CMD_SIZE ]; // where to store incoming char from client 93 | char cwdName[ FTP_CWD_SIZE ]; // name of current directory 94 | char command[ 5 ]; // command sent by client 95 | boolean rnfrCmd; // previous command was RNFR 96 | char * parameters; // point to begin of parameters sent by client 97 | uint16_t iCL; // pointer to cmdLine next incoming char 98 | int8_t cmdStatus, // status of ftp command connexion 99 | transferStatus; // status of ftp data transfer 100 | uint32_t millisTimeOut, // disconnect after 5 min of inactivity 101 | millisDelay, 102 | millisEndConnection, // 103 | millisBeginTrans, // store time of beginning of a transaction 104 | bytesTransfered; // 105 | String _FTP_USER; 106 | String _FTP_PASS; 107 | 108 | 109 | 110 | }; 111 | 112 | #endif // FTP_SERVERESP_H 113 | -------------------------------------------------------------------------------- /Formal edition/v20061/README.MD: -------------------------------------------------------------------------------- 1 | 再次优化了一下,这个版本是脱网的 自动创建ap,时间通过用户浏览器校准. 2 | 3 | 使用时先连ap:LinkTest 密码:87654321 4 | 5 | 然后访问192.168.4.1/time校准时间顺便启动侦测 6 | 7 | 2020.5.10 -------------------------------------------------------------------------------- /Formal edition/v20061/motionDetect.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asjdf/ESP32CAMmotion_detection/9e519fb6e63d87f2582c1cf37461fde63cc942e2/Formal edition/v20061/motionDetect.h -------------------------------------------------------------------------------- /Formal edition/v20081/ESP32FtpServer.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * FTP SERVER FOR ESP8266 4 | * based on FTP Serveur for Arduino Due and Ethernet shield (W5100) or WIZ820io (W5200) 5 | * based on Jean-Michel Gallego's work 6 | * modified to work with esp8266 SPIFFS by David Paiva (david@nailbuster.com) 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program. If not, see . 20 | */ 21 | // 2017: modified by @robo8080 22 | // 2019: modified by @fa1ke5 23 | 24 | /******************************************************************************* 25 | ** ** 26 | ** DEFINITIONS FOR FTP SERVER ** 27 | ** ** 28 | *******************************************************************************/ 29 | 30 | // Uncomment to print debugging info to console attached to ESP8266 31 | //#define FTP_DEBUG 32 | 33 | #ifndef FTP_SERVERESP_H 34 | #define FTP_SERVERESP_H 35 | 36 | //#include "Streaming.h" 37 | #include "SD_MMC.h" 38 | #include 39 | #include 40 | 41 | #define FTP_SERVER_VERSION "FTP-2016-01-14" 42 | 43 | #define FTP_CTRL_PORT 21 // Command port on wich server is listening 44 | #define FTP_DATA_PORT_PASV 50009 // Data port in passive mode 45 | 46 | #define FTP_TIME_OUT 5 // Disconnect client after 5 minutes of inactivity 47 | #define FTP_CMD_SIZE 255 + 8 // max size of a command 48 | #define FTP_CWD_SIZE 255 + 8 // max size of a directory name 49 | #define FTP_FIL_SIZE 255 // max size of a file name 50 | 51 | //#define FTP_BUF_SIZE 512 //512 // size of file buffer for read/write 52 | //#define FTP_BUF_SIZE 2*1460 //512 // size of file buffer for read/write 53 | #define FTP_BUF_SIZE 4096 //512 // 700 KByte/s download in AP mode, direct connection. 54 | 55 | 56 | class FtpServer 57 | { 58 | public: 59 | void begin(String uname, String pword); 60 | void handleFTP(); 61 | 62 | private: 63 | bool haveParameter(); 64 | bool makeExistsPath( char * path, char * param = NULL ); 65 | void iniVariables(); 66 | void clientConnected(); 67 | void disconnectClient(); 68 | boolean userIdentity(); 69 | boolean userPassword(); 70 | boolean processCommand(); 71 | boolean dataConnect(); 72 | boolean doRetrieve(); 73 | boolean doStore(); 74 | void closeTransfer(); 75 | void abortTransfer(); 76 | boolean makePath( char * fullname ); 77 | boolean makePath( char * fullName, char * param ); 78 | uint8_t getDateTime( uint16_t * pyear, uint8_t * pmonth, uint8_t * pday, 79 | uint8_t * phour, uint8_t * pminute, uint8_t * second ); 80 | char * makeDateTimeStr( char * tstr, uint16_t date, uint16_t time ); 81 | int8_t readChar(); 82 | 83 | IPAddress dataIp; // IP address of client for data 84 | WiFiClient client; 85 | WiFiClient data; 86 | 87 | File file; 88 | 89 | boolean dataPassiveConn; 90 | uint16_t dataPort; 91 | char buf[ FTP_BUF_SIZE ]; // data buffer for transfers 92 | char cmdLine[ FTP_CMD_SIZE ]; // where to store incoming char from client 93 | char cwdName[ FTP_CWD_SIZE ]; // name of current directory 94 | char command[ 5 ]; // command sent by client 95 | boolean rnfrCmd; // previous command was RNFR 96 | char * parameters; // point to begin of parameters sent by client 97 | uint16_t iCL; // pointer to cmdLine next incoming char 98 | int8_t cmdStatus, // status of ftp command connexion 99 | transferStatus; // status of ftp data transfer 100 | uint32_t millisTimeOut, // disconnect after 5 min of inactivity 101 | millisDelay, 102 | millisEndConnection, // 103 | millisBeginTrans, // store time of beginning of a transaction 104 | bytesTransfered; // 105 | String _FTP_USER; 106 | String _FTP_PASS; 107 | 108 | 109 | 110 | }; 111 | 112 | #endif // FTP_SERVERESP_H 113 | -------------------------------------------------------------------------------- /Formal edition/v20081/README.MD: -------------------------------------------------------------------------------- 1 | 这个版本是脱网的且无通过图像进行识别移动 2 | 自动创建ap,时间通过用户浏览器校准. 3 | 4 | 使用时先连ap:LinkTest 密码:87654321 5 | 6 | 然后访问192.168.4.1/time校准时间顺便启动侦测 7 | 8 | 2020.8.12 -------------------------------------------------------------------------------- /Formal edition/v20081/motionDetect.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asjdf/ESP32CAMmotion_detection/9e519fb6e63d87f2582c1cf37461fde63cc942e2/Formal edition/v20081/motionDetect.h -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ESP32MotionDetectionWithVideoRecorder 2 | [![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fasjdf%2FESP32CAMmotion_detection.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fasjdf%2FESP32CAMmotion_detection?ref=badge_shield) 3 | 4 | ## ESP32移动侦测摄像机 5 | 6 | ### 目录结构: 7 | - Formal edition(正式版) 8 | - References(参考的源码 向原制作者表示感谢) 9 | - Tested procedures(测试功能的程序) 10 | 11 | ### 目前功能: 12 | - 移动侦测 13 | - 自动录制视频 14 | - 自建AP(v20051版) 15 | - 通过浏览器校正时间(v20051版) 16 | 17 | ### 目前问题: 18 | - 在SVGA清晰度下无法达到5fps(前作者就无法达到) 19 | 20 | ### 未来计划: 21 | - 性能优化 22 | - 降低功耗 23 | 24 | #### 更新记录: 25 | - 2020.03.22 完成基本程序,或者说程序跑起来没问题. 26 | - 2020.03.12 从CameraWifiMotion借了改摄像头模式的函数 未测试 已做小修改以匹配自己的测试例程 27 | - 2020.05.01 自建AP而不是连接AP,系统时间通过网页校准并在校准后才开始侦测 28 | 29 | #### 参考资料: 30 | - https://github.com/jameszah/ESP32-CAM-Video-Recorder 31 | - https://github.com/s60sc/ESP32-CAM_Motion 32 | - https://github.com/alanesq/CameraWifiMotion 33 | - https://eloquentarduino.github.io/2020/01/motion-detection-with-esp32-cam-only-arduino-version/#tocreal-world-example 34 | - https://github.com/raphaelbs/esp32-cam-ai-thinker/blob/master/examples/change_detection/README.md 35 | 36 | 再次感谢以上程序的作者 37 | 38 | ## License 39 | [![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fasjdf%2FESP32CAMmotion_detection.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fasjdf%2FESP32CAMmotion_detection?ref=badge_large) -------------------------------------------------------------------------------- /References/ESP32-CAM-StaticIP-AP-FlashLED-master/ARDUINO/CameraWebServer/CameraWebServer.ino: -------------------------------------------------------------------------------- 1 | #include "esp_camera.h" 2 | #include 3 | 4 | // 5 | // WARNING!!! Make sure that you have either selected ESP32 Wrover Module, 6 | // or another board which has PSRAM enabled 7 | // 8 | // modified by lttung1197 9 | // Arduino 1.8.5 , esp32 1.0.2 10 | 11 | // Select camera model 12 | //#define CAMERA_MODEL_WROVER_KIT 13 | //#define CAMERA_MODEL_ESP_EYE 14 | //#define CAMERA_MODEL_M5STACK_PSRAM 15 | //#define CAMERA_MODEL_M5STACK_WIDE 16 | #define CAMERA_MODEL_AI_THINKER 17 | 18 | #include "camera_pins.h" 19 | 20 | const char* ssid = "ESP32-CAM"; 21 | const char* password = "0y5c2k8."; 22 | 23 | // Set your Static IP address 24 | IPAddress local_IP(10, 10, 1, 1); 25 | // Set your Gateway IP address 26 | IPAddress gateway(10, 10, 1, 1); 27 | IPAddress subnet(255, 255, 255, 0); 28 | 29 | void startCameraServer(); 30 | 31 | void setup() { 32 | Serial.begin(115200); 33 | Serial.setDebugOutput(true); 34 | Serial.println(); 35 | 36 | camera_config_t config; 37 | config.ledc_channel = LEDC_CHANNEL_0; 38 | config.ledc_timer = LEDC_TIMER_0; 39 | config.pin_d0 = Y2_GPIO_NUM; 40 | config.pin_d1 = Y3_GPIO_NUM; 41 | config.pin_d2 = Y4_GPIO_NUM; 42 | config.pin_d3 = Y5_GPIO_NUM; 43 | config.pin_d4 = Y6_GPIO_NUM; 44 | config.pin_d5 = Y7_GPIO_NUM; 45 | config.pin_d6 = Y8_GPIO_NUM; 46 | config.pin_d7 = Y9_GPIO_NUM; 47 | config.pin_xclk = XCLK_GPIO_NUM; 48 | config.pin_pclk = PCLK_GPIO_NUM; 49 | config.pin_vsync = VSYNC_GPIO_NUM; 50 | config.pin_href = HREF_GPIO_NUM; 51 | config.pin_sscb_sda = SIOD_GPIO_NUM; 52 | config.pin_sscb_scl = SIOC_GPIO_NUM; 53 | config.pin_pwdn = PWDN_GPIO_NUM; 54 | config.pin_reset = RESET_GPIO_NUM; 55 | config.xclk_freq_hz = 20000000; 56 | config.pixel_format = PIXFORMAT_JPEG; 57 | //init with high specs to pre-allocate larger buffers 58 | if(psramFound()){ 59 | config.frame_size = FRAMESIZE_UXGA; 60 | config.jpeg_quality = 10; 61 | config.fb_count = 2; 62 | } else { 63 | config.frame_size = FRAMESIZE_SVGA; 64 | config.jpeg_quality = 12; 65 | config.fb_count = 1; 66 | } 67 | 68 | #if defined(CAMERA_MODEL_ESP_EYE) 69 | pinMode(13, INPUT_PULLUP); 70 | pinMode(14, INPUT_PULLUP); 71 | #endif 72 | 73 | // camera init 74 | esp_err_t err = esp_camera_init(&config); 75 | if (err != ESP_OK) { 76 | Serial.printf("Camera init failed with error 0x%x", err); 77 | return; 78 | } 79 | 80 | sensor_t * s = esp_camera_sensor_get(); 81 | //initial sensors are flipped vertically and colors are a bit saturated 82 | if (s->id.PID == OV3660_PID) { 83 | s->set_vflip(s, 1);//flip it back 84 | s->set_brightness(s, 1);//up the blightness just a bit 85 | s->set_saturation(s, -2);//lower the saturation 86 | } 87 | //drop down frame size for higher initial frame rate 88 | s->set_framesize(s, FRAMESIZE_QVGA); 89 | 90 | #if defined(CAMERA_MODEL_M5STACK_WIDE) 91 | s->set_vflip(s, 1); 92 | s->set_hmirror(s, 1); 93 | #endif 94 | 95 | // Connect to Wi-Fi network with SSID and password 96 | Serial.println("Setting AP (Access Point)…"); 97 | // Remove the password parameter, if you want the AP (Access Point) to be open 98 | WiFi.softAP(ssid, password); 99 | Serial.println("Wait 100 ms for AP_START..."); 100 | delay(100); 101 | 102 | // Configures static IP address 103 | if (!WiFi.softAPConfig(local_IP, gateway, subnet)) { 104 | Serial.println("STA Failed to configure"); 105 | } 106 | 107 | IPAddress IP = WiFi.softAPIP(); 108 | Serial.print("Camera Stream Ready! Connect to the ESP32 AP and go to: http://"); 109 | Serial.println(IP); 110 | 111 | startCameraServer(); 112 | } 113 | 114 | void loop() { 115 | // put your main code here, to run repeatedly: 116 | delay(10000); 117 | } 118 | -------------------------------------------------------------------------------- /References/ESP32-CAM-StaticIP-AP-FlashLED-master/ARDUINO/CameraWebServer/camera_pins.h: -------------------------------------------------------------------------------- 1 | 2 | #if defined(CAMERA_MODEL_WROVER_KIT) 3 | #define PWDN_GPIO_NUM -1 4 | #define RESET_GPIO_NUM -1 5 | #define XCLK_GPIO_NUM 21 6 | #define SIOD_GPIO_NUM 26 7 | #define SIOC_GPIO_NUM 27 8 | 9 | #define Y9_GPIO_NUM 35 10 | #define Y8_GPIO_NUM 34 11 | #define Y7_GPIO_NUM 39 12 | #define Y6_GPIO_NUM 36 13 | #define Y5_GPIO_NUM 19 14 | #define Y4_GPIO_NUM 18 15 | #define Y3_GPIO_NUM 5 16 | #define Y2_GPIO_NUM 4 17 | #define VSYNC_GPIO_NUM 25 18 | #define HREF_GPIO_NUM 23 19 | #define PCLK_GPIO_NUM 22 20 | 21 | #elif defined(CAMERA_MODEL_ESP_EYE) 22 | #define PWDN_GPIO_NUM -1 23 | #define RESET_GPIO_NUM -1 24 | #define XCLK_GPIO_NUM 4 25 | #define SIOD_GPIO_NUM 18 26 | #define SIOC_GPIO_NUM 23 27 | 28 | #define Y9_GPIO_NUM 36 29 | #define Y8_GPIO_NUM 37 30 | #define Y7_GPIO_NUM 38 31 | #define Y6_GPIO_NUM 39 32 | #define Y5_GPIO_NUM 35 33 | #define Y4_GPIO_NUM 14 34 | #define Y3_GPIO_NUM 13 35 | #define Y2_GPIO_NUM 34 36 | #define VSYNC_GPIO_NUM 5 37 | #define HREF_GPIO_NUM 27 38 | #define PCLK_GPIO_NUM 25 39 | 40 | #elif defined(CAMERA_MODEL_M5STACK_PSRAM) 41 | #define PWDN_GPIO_NUM -1 42 | #define RESET_GPIO_NUM 15 43 | #define XCLK_GPIO_NUM 27 44 | #define SIOD_GPIO_NUM 25 45 | #define SIOC_GPIO_NUM 23 46 | 47 | #define Y9_GPIO_NUM 19 48 | #define Y8_GPIO_NUM 36 49 | #define Y7_GPIO_NUM 18 50 | #define Y6_GPIO_NUM 39 51 | #define Y5_GPIO_NUM 5 52 | #define Y4_GPIO_NUM 34 53 | #define Y3_GPIO_NUM 35 54 | #define Y2_GPIO_NUM 32 55 | #define VSYNC_GPIO_NUM 22 56 | #define HREF_GPIO_NUM 26 57 | #define PCLK_GPIO_NUM 21 58 | 59 | #elif defined(CAMERA_MODEL_M5STACK_WIDE) 60 | #define PWDN_GPIO_NUM -1 61 | #define RESET_GPIO_NUM 15 62 | #define XCLK_GPIO_NUM 27 63 | #define SIOD_GPIO_NUM 22 64 | #define SIOC_GPIO_NUM 23 65 | 66 | #define Y9_GPIO_NUM 19 67 | #define Y8_GPIO_NUM 36 68 | #define Y7_GPIO_NUM 18 69 | #define Y6_GPIO_NUM 39 70 | #define Y5_GPIO_NUM 5 71 | #define Y4_GPIO_NUM 34 72 | #define Y3_GPIO_NUM 35 73 | #define Y2_GPIO_NUM 32 74 | #define VSYNC_GPIO_NUM 25 75 | #define HREF_GPIO_NUM 26 76 | #define PCLK_GPIO_NUM 21 77 | 78 | #elif defined(CAMERA_MODEL_AI_THINKER) 79 | #define PWDN_GPIO_NUM 32 80 | #define RESET_GPIO_NUM -1 81 | #define XCLK_GPIO_NUM 0 82 | #define SIOD_GPIO_NUM 26 83 | #define SIOC_GPIO_NUM 27 84 | 85 | #define Y9_GPIO_NUM 35 86 | #define Y8_GPIO_NUM 34 87 | #define Y7_GPIO_NUM 39 88 | #define Y6_GPIO_NUM 36 89 | #define Y5_GPIO_NUM 21 90 | #define Y4_GPIO_NUM 19 91 | #define Y3_GPIO_NUM 18 92 | #define Y2_GPIO_NUM 5 93 | #define VSYNC_GPIO_NUM 25 94 | #define HREF_GPIO_NUM 23 95 | #define PCLK_GPIO_NUM 22 96 | 97 | #else 98 | #error "Camera model not selected" 99 | #endif 100 | -------------------------------------------------------------------------------- /References/ESP32-CAM-StaticIP-AP-FlashLED-master/HTML GZ EDITOR/README.txt: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////// 2 | //////////HTML GZ EDITOR////////////// 3 | ////////////////////////////////////// 4 | 5 | 1/ Open ESP32 Control Panel on your browser, then save all source code (View page source) to .html file 6 | 2/ Convert .html to .html.gz by gzip tool (for Linux) or this online tool (remember to check option 2): 7 | https://online-converting.com/archives/convert-to-gzip/ 8 | 2/ Build filetoarray cpp file (GCC or Visual Studio) (SKIP IT if you can run filetoarray.exe) 9 | 3/ Use cmd.exe to run this command: filetoarray.exe index.html.gz > camera_index.h 10 | 4/ Open camera_index.h and update len and array data to arduino's camera_index.h 11 | 5/ Finish, continue to build your code 12 | 13 | //////////////lttung1197////////////// 14 | //////////////18/11/2019////////////// -------------------------------------------------------------------------------- /References/ESP32-CAM-StaticIP-AP-FlashLED-master/HTML GZ EDITOR/camera.html.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asjdf/ESP32CAMmotion_detection/9e519fb6e63d87f2582c1cf37461fde63cc942e2/References/ESP32-CAM-StaticIP-AP-FlashLED-master/HTML GZ EDITOR/camera.html.gz -------------------------------------------------------------------------------- /References/ESP32-CAM-StaticIP-AP-FlashLED-master/HTML GZ EDITOR/filetoarray.cpp: -------------------------------------------------------------------------------- 1 | // filetoarray.cpp : Defines the entry point for the console application. 2 | // 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | int main(int argc, char *argv[]) { 11 | FILE * fp; 12 | char *buffer; 13 | long flen; 14 | char *fname; 15 | char pname[1024]; 16 | 17 | if (argc == 2) { 18 | fname = argv[1]; 19 | strcpy(pname, fname); 20 | char * dot = strchr(pname, '.'); 21 | while (dot != NULL) { 22 | *dot = '_'; 23 | dot = strchr(pname, '.'); 24 | } 25 | } 26 | else { 27 | printf("Filename not supplied\n"); 28 | return 1; 29 | } 30 | 31 | fp = fopen(fname, "rb"); 32 | fseek(fp, 0, SEEK_END); 33 | flen = ftell(fp); 34 | rewind(fp); 35 | 36 | buffer = (char *)malloc((flen + 1) * sizeof(char)); 37 | fread(buffer, flen, 1, fp); 38 | fclose(fp); 39 | 40 | printf("\n//File: %s, Size: %lu\n", fname, flen); 41 | printf("#define %s_len %lu\n", pname, flen); 42 | printf("const uint8_t %s[] PROGMEM = {\n", pname); 43 | long i; 44 | for (i = 0; i. 20 | */ 21 | // 2017: modified by @robo8080 22 | // 2019: modified by @fa1ke5 23 | 24 | /******************************************************************************* 25 | ** ** 26 | ** DEFINITIONS FOR FTP SERVER ** 27 | ** ** 28 | *******************************************************************************/ 29 | 30 | // Uncomment to print debugging info to console attached to ESP8266 31 | //#define FTP_DEBUG 32 | 33 | #ifndef FTP_SERVERESP_H 34 | #define FTP_SERVERESP_H 35 | 36 | //#include "Streaming.h" 37 | #include "SD_MMC.h" 38 | #include 39 | #include 40 | 41 | #define FTP_SERVER_VERSION "FTP-2016-01-14" 42 | 43 | #define FTP_CTRL_PORT 21 // Command port on wich server is listening 44 | #define FTP_DATA_PORT_PASV 50009 // Data port in passive mode 45 | 46 | #define FTP_TIME_OUT 5 // Disconnect client after 5 minutes of inactivity 47 | #define FTP_CMD_SIZE 255 + 8 // max size of a command 48 | #define FTP_CWD_SIZE 255 + 8 // max size of a directory name 49 | #define FTP_FIL_SIZE 255 // max size of a file name 50 | 51 | //#define FTP_BUF_SIZE 512 //512 // size of file buffer for read/write 52 | //#define FTP_BUF_SIZE 2*1460 //512 // size of file buffer for read/write 53 | #define FTP_BUF_SIZE 4096 //512 // 700 KByte/s download in AP mode, direct connection. 54 | 55 | 56 | class FtpServer 57 | { 58 | public: 59 | void begin(String uname, String pword); 60 | void handleFTP(); 61 | 62 | private: 63 | bool haveParameter(); 64 | bool makeExistsPath( char * path, char * param = NULL ); 65 | void iniVariables(); 66 | void clientConnected(); 67 | void disconnectClient(); 68 | boolean userIdentity(); 69 | boolean userPassword(); 70 | boolean processCommand(); 71 | boolean dataConnect(); 72 | boolean doRetrieve(); 73 | boolean doStore(); 74 | void closeTransfer(); 75 | void abortTransfer(); 76 | boolean makePath( char * fullname ); 77 | boolean makePath( char * fullName, char * param ); 78 | uint8_t getDateTime( uint16_t * pyear, uint8_t * pmonth, uint8_t * pday, 79 | uint8_t * phour, uint8_t * pminute, uint8_t * second ); 80 | char * makeDateTimeStr( char * tstr, uint16_t date, uint16_t time ); 81 | int8_t readChar(); 82 | 83 | IPAddress dataIp; // IP address of client for data 84 | WiFiClient client; 85 | WiFiClient data; 86 | 87 | File file; 88 | 89 | boolean dataPassiveConn; 90 | uint16_t dataPort; 91 | char buf[ FTP_BUF_SIZE ]; // data buffer for transfers 92 | char cmdLine[ FTP_CMD_SIZE ]; // where to store incoming char from client 93 | char cwdName[ FTP_CWD_SIZE ]; // name of current directory 94 | char command[ 5 ]; // command sent by client 95 | boolean rnfrCmd; // previous command was RNFR 96 | char * parameters; // point to begin of parameters sent by client 97 | uint16_t iCL; // pointer to cmdLine next incoming char 98 | int8_t cmdStatus, // status of ftp command connexion 99 | transferStatus; // status of ftp data transfer 100 | uint32_t millisTimeOut, // disconnect after 5 min of inactivity 101 | millisDelay, 102 | millisEndConnection, // 103 | millisBeginTrans, // store time of beginning of a transaction 104 | bytesTransfered; // 105 | String _FTP_USER; 106 | String _FTP_PASS; 107 | 108 | 109 | 110 | }; 111 | 112 | #endif // FTP_SERVERESP_H 113 | -------------------------------------------------------------------------------- /References/ESP32-CAM-Video-Recorder-master/ESP32-CAM-Video-Recorder-master/v23/README.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /References/ESP32-CAM-Video-Recorder-master/ESP32-CAM-Video-Recorder-master/v39/ESP32FtpServer.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * FTP SERVER FOR ESP8266 4 | * based on FTP Serveur for Arduino Due and Ethernet shield (W5100) or WIZ820io (W5200) 5 | * based on Jean-Michel Gallego's work 6 | * modified to work with esp8266 SPIFFS by David Paiva (david@nailbuster.com) 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program. If not, see . 20 | */ 21 | // 2017: modified by @robo8080 22 | // 2019: modified by @fa1ke5 23 | 24 | /******************************************************************************* 25 | ** ** 26 | ** DEFINITIONS FOR FTP SERVER ** 27 | ** ** 28 | *******************************************************************************/ 29 | 30 | // Uncomment to print debugging info to console attached to ESP8266 31 | #define FTP_DEBUG 32 | 33 | #ifndef FTP_SERVERESP_H 34 | #define FTP_SERVERESP_H 35 | 36 | //#include "Streaming.h" 37 | #include "SD_MMC.h" 38 | #include 39 | #include 40 | 41 | #define FTP_SERVER_VERSION "FTP-2016-01-14" 42 | 43 | #define FTP_CTRL_PORT 21 // Command port on wich server is listening 44 | #define FTP_DATA_PORT_PASV 50009 // Data port in passive mode 45 | 46 | #define FTP_TIME_OUT 5 // Disconnect client after 5 minutes of inactivity 47 | #define FTP_CMD_SIZE 255 + 8 // max size of a command 48 | #define FTP_CWD_SIZE 255 + 8 // max size of a directory name 49 | #define FTP_FIL_SIZE 255 // max size of a file name 50 | 51 | //#define FTP_BUF_SIZE 512 //512 // size of file buffer for read/write 52 | //#define FTP_BUF_SIZE 2*1460 //512 // size of file buffer for read/write 53 | #define FTP_BUF_SIZE 4096 //512 // 700 KByte/s download in AP mode, direct connection. 54 | 55 | 56 | class FtpServer 57 | { 58 | public: 59 | void begin(String uname, String pword); 60 | void handleFTP(); 61 | 62 | private: 63 | bool haveParameter(); 64 | bool makeExistsPath( char * path, char * param = NULL ); 65 | void iniVariables(); 66 | void clientConnected(); 67 | void disconnectClient(); 68 | boolean userIdentity(); 69 | boolean userPassword(); 70 | boolean processCommand(); 71 | boolean dataConnect(); 72 | boolean doRetrieve(); 73 | boolean doStore(); 74 | void closeTransfer(); 75 | void abortTransfer(); 76 | boolean makePath( char * fullname ); 77 | boolean makePath( char * fullName, char * param ); 78 | uint8_t getDateTime( uint16_t * pyear, uint8_t * pmonth, uint8_t * pday, 79 | uint8_t * phour, uint8_t * pminute, uint8_t * second ); 80 | char * makeDateTimeStr( char * tstr, uint16_t date, uint16_t time ); 81 | int8_t readChar(); 82 | 83 | IPAddress dataIp; // IP address of client for data 84 | WiFiClient client; 85 | WiFiClient data; 86 | 87 | File file; 88 | 89 | boolean dataPassiveConn; 90 | uint16_t dataPort; 91 | char buf[ FTP_BUF_SIZE ]; // data buffer for transfers 92 | char cmdLine[ FTP_CMD_SIZE ]; // where to store incoming char from client 93 | char cwdName[ FTP_CWD_SIZE ]; // name of current directory 94 | char command[ 5 ]; // command sent by client 95 | boolean rnfrCmd; // previous command was RNFR 96 | char * parameters; // point to begin of parameters sent by client 97 | uint16_t iCL; // pointer to cmdLine next incoming char 98 | int8_t cmdStatus, // status of ftp command connexion 99 | transferStatus; // status of ftp data transfer 100 | uint32_t millisTimeOut, // disconnect after 5 min of inactivity 101 | millisDelay, 102 | millisEndConnection, // 103 | millisBeginTrans, // store time of beginning of a transaction 104 | bytesTransfered; // 105 | String _FTP_USER; 106 | String _FTP_PASS; 107 | 108 | 109 | 110 | }; 111 | 112 | #endif // FTP_SERVERESP_H 113 | -------------------------------------------------------------------------------- /References/ESP32-CAM-Video-Recorder-master/ESP32-CAM-Video-Recorder-master/v39/README.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /References/ESP32-CAM-Video-Recorder-master/de-solder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asjdf/ESP32CAMmotion_detection/9e519fb6e63d87f2582c1cf37461fde63cc942e2/References/ESP32-CAM-Video-Recorder-master/de-solder.png -------------------------------------------------------------------------------- /References/ESP32-CAM-Video-Recorder-master/de-solder3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asjdf/ESP32CAMmotion_detection/9e519fb6e63d87f2582c1cf37461fde63cc942e2/References/ESP32-CAM-Video-Recorder-master/de-solder3.png -------------------------------------------------------------------------------- /References/ESP32-CAM-Video-Recorder-master/v23/ESP32FtpServer.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * FTP SERVER FOR ESP8266 4 | * based on FTP Serveur for Arduino Due and Ethernet shield (W5100) or WIZ820io (W5200) 5 | * based on Jean-Michel Gallego's work 6 | * modified to work with esp8266 SPIFFS by David Paiva (david@nailbuster.com) 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program. If not, see . 20 | */ 21 | // 2017: modified by @robo8080 22 | // 2019: modified by @fa1ke5 23 | 24 | /******************************************************************************* 25 | ** ** 26 | ** DEFINITIONS FOR FTP SERVER ** 27 | ** ** 28 | *******************************************************************************/ 29 | 30 | // Uncomment to print debugging info to console attached to ESP8266 31 | //#define FTP_DEBUG 32 | 33 | #ifndef FTP_SERVERESP_H 34 | #define FTP_SERVERESP_H 35 | 36 | //#include "Streaming.h" 37 | #include "SD_MMC.h" 38 | #include 39 | #include 40 | 41 | #define FTP_SERVER_VERSION "FTP-2016-01-14" 42 | 43 | #define FTP_CTRL_PORT 21 // Command port on wich server is listening 44 | #define FTP_DATA_PORT_PASV 50009 // Data port in passive mode 45 | 46 | #define FTP_TIME_OUT 5 // Disconnect client after 5 minutes of inactivity 47 | #define FTP_CMD_SIZE 255 + 8 // max size of a command 48 | #define FTP_CWD_SIZE 255 + 8 // max size of a directory name 49 | #define FTP_FIL_SIZE 255 // max size of a file name 50 | 51 | //#define FTP_BUF_SIZE 512 //512 // size of file buffer for read/write 52 | //#define FTP_BUF_SIZE 2*1460 //512 // size of file buffer for read/write 53 | #define FTP_BUF_SIZE 4096 //512 // 700 KByte/s download in AP mode, direct connection. 54 | 55 | 56 | class FtpServer 57 | { 58 | public: 59 | void begin(String uname, String pword); 60 | void handleFTP(); 61 | 62 | private: 63 | bool haveParameter(); 64 | bool makeExistsPath( char * path, char * param = NULL ); 65 | void iniVariables(); 66 | void clientConnected(); 67 | void disconnectClient(); 68 | boolean userIdentity(); 69 | boolean userPassword(); 70 | boolean processCommand(); 71 | boolean dataConnect(); 72 | boolean doRetrieve(); 73 | boolean doStore(); 74 | void closeTransfer(); 75 | void abortTransfer(); 76 | boolean makePath( char * fullname ); 77 | boolean makePath( char * fullName, char * param ); 78 | uint8_t getDateTime( uint16_t * pyear, uint8_t * pmonth, uint8_t * pday, 79 | uint8_t * phour, uint8_t * pminute, uint8_t * second ); 80 | char * makeDateTimeStr( char * tstr, uint16_t date, uint16_t time ); 81 | int8_t readChar(); 82 | 83 | IPAddress dataIp; // IP address of client for data 84 | WiFiClient client; 85 | WiFiClient data; 86 | 87 | File file; 88 | 89 | boolean dataPassiveConn; 90 | uint16_t dataPort; 91 | char buf[ FTP_BUF_SIZE ]; // data buffer for transfers 92 | char cmdLine[ FTP_CMD_SIZE ]; // where to store incoming char from client 93 | char cwdName[ FTP_CWD_SIZE ]; // name of current directory 94 | char command[ 5 ]; // command sent by client 95 | boolean rnfrCmd; // previous command was RNFR 96 | char * parameters; // point to begin of parameters sent by client 97 | uint16_t iCL; // pointer to cmdLine next incoming char 98 | int8_t cmdStatus, // status of ftp command connexion 99 | transferStatus; // status of ftp data transfer 100 | uint32_t millisTimeOut, // disconnect after 5 min of inactivity 101 | millisDelay, 102 | millisEndConnection, // 103 | millisBeginTrans, // store time of beginning of a transaction 104 | bytesTransfered; // 105 | String _FTP_USER; 106 | String _FTP_PASS; 107 | 108 | 109 | 110 | }; 111 | 112 | #endif // FTP_SERVERESP_H 113 | -------------------------------------------------------------------------------- /References/ESP32-CAM-Video-Recorder-master/v23/README.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /References/ESP32-CAM-Video-Recorder-master/v39/ESP32FtpServer.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * FTP SERVER FOR ESP8266 4 | * based on FTP Serveur for Arduino Due and Ethernet shield (W5100) or WIZ820io (W5200) 5 | * based on Jean-Michel Gallego's work 6 | * modified to work with esp8266 SPIFFS by David Paiva (david@nailbuster.com) 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program. If not, see . 20 | */ 21 | // 2017: modified by @robo8080 22 | // 2019: modified by @fa1ke5 23 | 24 | /******************************************************************************* 25 | ** ** 26 | ** DEFINITIONS FOR FTP SERVER ** 27 | ** ** 28 | *******************************************************************************/ 29 | 30 | // Uncomment to print debugging info to console attached to ESP8266 31 | #define FTP_DEBUG 32 | 33 | #ifndef FTP_SERVERESP_H 34 | #define FTP_SERVERESP_H 35 | 36 | //#include "Streaming.h" 37 | #include "SD_MMC.h" 38 | #include 39 | #include 40 | 41 | #define FTP_SERVER_VERSION "FTP-2016-01-14" 42 | 43 | #define FTP_CTRL_PORT 21 // Command port on wich server is listening 44 | #define FTP_DATA_PORT_PASV 50009 // Data port in passive mode 45 | 46 | #define FTP_TIME_OUT 5 // Disconnect client after 5 minutes of inactivity 47 | #define FTP_CMD_SIZE 255 + 8 // max size of a command 48 | #define FTP_CWD_SIZE 255 + 8 // max size of a directory name 49 | #define FTP_FIL_SIZE 255 // max size of a file name 50 | 51 | //#define FTP_BUF_SIZE 512 //512 // size of file buffer for read/write 52 | //#define FTP_BUF_SIZE 2*1460 //512 // size of file buffer for read/write 53 | #define FTP_BUF_SIZE 4096 //512 // 700 KByte/s download in AP mode, direct connection. 54 | 55 | 56 | class FtpServer 57 | { 58 | public: 59 | void begin(String uname, String pword); 60 | void handleFTP(); 61 | 62 | private: 63 | bool haveParameter(); 64 | bool makeExistsPath( char * path, char * param = NULL ); 65 | void iniVariables(); 66 | void clientConnected(); 67 | void disconnectClient(); 68 | boolean userIdentity(); 69 | boolean userPassword(); 70 | boolean processCommand(); 71 | boolean dataConnect(); 72 | boolean doRetrieve(); 73 | boolean doStore(); 74 | void closeTransfer(); 75 | void abortTransfer(); 76 | boolean makePath( char * fullname ); 77 | boolean makePath( char * fullName, char * param ); 78 | uint8_t getDateTime( uint16_t * pyear, uint8_t * pmonth, uint8_t * pday, 79 | uint8_t * phour, uint8_t * pminute, uint8_t * second ); 80 | char * makeDateTimeStr( char * tstr, uint16_t date, uint16_t time ); 81 | int8_t readChar(); 82 | 83 | IPAddress dataIp; // IP address of client for data 84 | WiFiClient client; 85 | WiFiClient data; 86 | 87 | File file; 88 | 89 | boolean dataPassiveConn; 90 | uint16_t dataPort; 91 | char buf[ FTP_BUF_SIZE ]; // data buffer for transfers 92 | char cmdLine[ FTP_CMD_SIZE ]; // where to store incoming char from client 93 | char cwdName[ FTP_CWD_SIZE ]; // name of current directory 94 | char command[ 5 ]; // command sent by client 95 | boolean rnfrCmd; // previous command was RNFR 96 | char * parameters; // point to begin of parameters sent by client 97 | uint16_t iCL; // pointer to cmdLine next incoming char 98 | int8_t cmdStatus, // status of ftp command connexion 99 | transferStatus; // status of ftp data transfer 100 | uint32_t millisTimeOut, // disconnect after 5 min of inactivity 101 | millisDelay, 102 | millisEndConnection, // 103 | millisBeginTrans, // store time of beginning of a transaction 104 | bytesTransfered; // 105 | String _FTP_USER; 106 | String _FTP_PASS; 107 | 108 | 109 | 110 | }; 111 | 112 | #endif // FTP_SERVERESP_H 113 | -------------------------------------------------------------------------------- /References/ESP32-CAM-Video-Recorder-master/v39/README.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /References/ESP32-CAM-Video-Recorder-master/v60/ESP32FtpServer.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * FTP SERVER FOR ESP8266 4 | * based on FTP Serveur for Arduino Due and Ethernet shield (W5100) or WIZ820io (W5200) 5 | * based on Jean-Michel Gallego's work 6 | * modified to work with esp8266 SPIFFS by David Paiva (david@nailbuster.com) 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program. If not, see . 20 | */ 21 | // 2017: modified by @robo8080 22 | // 2019: modified by @fa1ke5 23 | 24 | /******************************************************************************* 25 | ** ** 26 | ** DEFINITIONS FOR FTP SERVER ** 27 | ** ** 28 | *******************************************************************************/ 29 | 30 | // Uncomment to print debugging info to console attached to ESP8266 31 | //#define FTP_DEBUG 32 | 33 | #ifndef FTP_SERVERESP_H 34 | #define FTP_SERVERESP_H 35 | 36 | //#include "Streaming.h" 37 | #include "SD_MMC.h" 38 | #include 39 | #include 40 | 41 | #define FTP_SERVER_VERSION "FTP-2016-01-14" 42 | 43 | #define FTP_CTRL_PORT 21 // Command port on wich server is listening 44 | #define FTP_DATA_PORT_PASV 50009 // Data port in passive mode 45 | 46 | #define FTP_TIME_OUT 5 // Disconnect client after 5 minutes of inactivity 47 | #define FTP_CMD_SIZE 255 + 8 // max size of a command 48 | #define FTP_CWD_SIZE 255 + 8 // max size of a directory name 49 | #define FTP_FIL_SIZE 255 // max size of a file name 50 | 51 | //#define FTP_BUF_SIZE 512 //512 // size of file buffer for read/write 52 | //#define FTP_BUF_SIZE 2*1460 //512 // size of file buffer for read/write 53 | #define FTP_BUF_SIZE 4096 //512 // 700 KByte/s download in AP mode, direct connection. 54 | 55 | 56 | class FtpServer 57 | { 58 | public: 59 | void begin(String uname, String pword); 60 | void handleFTP(); 61 | 62 | private: 63 | bool haveParameter(); 64 | bool makeExistsPath( char * path, char * param = NULL ); 65 | void iniVariables(); 66 | void clientConnected(); 67 | void disconnectClient(); 68 | boolean userIdentity(); 69 | boolean userPassword(); 70 | boolean processCommand(); 71 | boolean dataConnect(); 72 | boolean doRetrieve(); 73 | boolean doStore(); 74 | void closeTransfer(); 75 | void abortTransfer(); 76 | boolean makePath( char * fullname ); 77 | boolean makePath( char * fullName, char * param ); 78 | uint8_t getDateTime( uint16_t * pyear, uint8_t * pmonth, uint8_t * pday, 79 | uint8_t * phour, uint8_t * pminute, uint8_t * second ); 80 | char * makeDateTimeStr( char * tstr, uint16_t date, uint16_t time ); 81 | int8_t readChar(); 82 | 83 | IPAddress dataIp; // IP address of client for data 84 | WiFiClient client; 85 | WiFiClient data; 86 | 87 | File file; 88 | 89 | boolean dataPassiveConn; 90 | uint16_t dataPort; 91 | char buf[ FTP_BUF_SIZE ]; // data buffer for transfers 92 | char cmdLine[ FTP_CMD_SIZE ]; // where to store incoming char from client 93 | char cwdName[ FTP_CWD_SIZE ]; // name of current directory 94 | char command[ 5 ]; // command sent by client 95 | boolean rnfrCmd; // previous command was RNFR 96 | char * parameters; // point to begin of parameters sent by client 97 | uint16_t iCL; // pointer to cmdLine next incoming char 98 | int8_t cmdStatus, // status of ftp command connexion 99 | transferStatus; // status of ftp data transfer 100 | uint32_t millisTimeOut, // disconnect after 5 min of inactivity 101 | millisDelay, 102 | millisEndConnection, // 103 | millisBeginTrans, // store time of beginning of a transaction 104 | bytesTransfered; // 105 | String _FTP_USER; 106 | String _FTP_PASS; 107 | 108 | 109 | 110 | }; 111 | 112 | #endif // FTP_SERVERESP_H 113 | -------------------------------------------------------------------------------- /References/ESP32-CAM-Video-Recorder-master/v60/README.MD: -------------------------------------------------------------------------------- 1 | v60 implements dates and times for ftp that v59 did not have 2 | -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asjdf/ESP32CAMmotion_detection/9e519fb6e63d87f2582c1cf37461fde63cc942e2/References/[copy]CameraWifiMotion-master.zip -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/CameraWifiMotion/ota.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************************** 2 | * 3 | * Over The Air updates (OTA) - 17Feb20 4 | * 5 | * part of the Webserver library 6 | * 7 | * In Arduino IDE Select "ESP32 dev module" not ESP32-cam, PSRAM enabled 8 | * 9 | * access with http:///ota 10 | * 11 | ************************************************************************************************** 12 | 13 | WARNING: This is not secure, anyone with access to your wifi can upload their own sketch ! 14 | 15 | To enable/disable OTA see setting at top of main sketch (#define ENABLE_OTA 1) 16 | 17 | 18 | **************************************************************************************************/ 19 | 20 | 21 | #include 22 | 23 | 24 | // forward declarations 25 | void otaSetup(); 26 | void handleOTA(); 27 | 28 | 29 | // ---------------------------------------------------------------- 30 | // -OTA setup section 31 | // ---------------------------------------------------------------- 32 | 33 | // Called from 'setup' 34 | 35 | void otaSetup() { 36 | 37 | server.on("/ota", handleOTA); 38 | 39 | server.on("/update", HTTP_POST, []() { 40 | server.sendHeader("Connection", "close"); 41 | server.send(200, "text/plain", (Update.hasError()) ? "Update Failed!" : "Update complete, device is rebooting..."); 42 | delay(500); 43 | ESP.restart(); 44 | delay(2000); 45 | }, []() { 46 | HTTPUpload& upload = server.upload(); 47 | if (upload.status == UPLOAD_FILE_START) { 48 | Serial.setDebugOutput(true); 49 | Serial.printf("Update: %s\n", upload.filename.c_str()); 50 | if (!Update.begin()) { //start with max available size 51 | Update.printError(Serial); 52 | } 53 | } else if (upload.status == UPLOAD_FILE_WRITE) { 54 | if (Update.write(upload.buf, upload.currentSize) != upload.currentSize) { 55 | Update.printError(Serial); 56 | } 57 | } else if (upload.status == UPLOAD_FILE_END) { 58 | if (Update.end(true)) { //true to set the size to the current progress 59 | Serial.printf("Update Success: %u\nRebooting...\n", upload.totalSize); 60 | } else { 61 | Update.printError(Serial); 62 | } 63 | Serial.setDebugOutput(false); 64 | } else { 65 | Serial.printf("Update Failed Unexpectedly (likely broken connection): status=%d\n", upload.status); 66 | } 67 | }); 68 | } 69 | 70 | 71 | // ---------------------------------------------------------------- 72 | // -OTA web page requested i.e. http://x.x.x.x/ota 73 | // ---------------------------------------------------------------- 74 | 75 | void handleOTA(){ 76 | 77 | bool OTAEnabled = 0; 78 | 79 | log_system_message("OTA web page requested"); 80 | String message = webheader(); 81 | 82 | message += "

Update firmware


\n"; 83 | message += "Current version = " + stitle + ", " + sversion + "

"; 84 | 85 | message += "
\n"; 86 | message += "\n"; 87 | message += "


\n"; 88 | 89 | message += "

Device will reboot when upload complete"; 90 | message += red + "
OTA is enabled - Restart device to disable
" + endcolour; 91 | 92 | 93 | message += webfooter(); // add standard footer html 94 | 95 | server.send(200, "text/html", message); // send the web page 96 | message = ""; // clear string 97 | 98 | } 99 | 100 | // ---------------------------------------------- end ---------------------------------------------- 101 | -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asjdf/ESP32CAMmotion_detection/9e519fb6e63d87f2582c1cf37461fde63cc942e2/References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used.zip -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/ESP32_Mail_Client/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 mobizt 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/ESP32_Mail_Client/examples/Set_flag/Set_flag.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by K. Suwatchai (Mobizt) 3 | * 4 | * Email: k_suwatchai@hotmail.com 5 | * 6 | * Github: https://github.com/mobizt 7 | * 8 | * Copyright (c) 2019 mobizt 9 | * 10 | */ 11 | 12 | 13 | #include 14 | #include "ESP32_MailClient.h" 15 | 16 | #define WIFI_SSID "YOUR_WIFI_SSID" 17 | #define WIFI_PASSWORD "YOUR_WIFI_PASSWORD" 18 | 19 | //The Email Reading data object contains config and data that received 20 | IMAPData imapData; 21 | 22 | void readEmail(); 23 | 24 | unsigned long lastTime = 0; 25 | 26 | void setup() 27 | { 28 | 29 | Serial.begin(115200); 30 | Serial.println(); 31 | 32 | Serial.print("Connecting to AP"); 33 | 34 | WiFi.begin(WIFI_SSID, WIFI_PASSWORD); 35 | while (WiFi.status() != WL_CONNECTED) 36 | { 37 | Serial.print("."); 38 | delay(200); 39 | } 40 | 41 | Serial.println(""); 42 | Serial.println("WiFi connected."); 43 | Serial.println("IP address: "); 44 | Serial.println(WiFi.localIP()); 45 | 46 | Serial.println(); 47 | 48 | Serial.println(); 49 | 50 | imapData.setLogin("imap.gmail.com", 993, "YOUR_EMAIL_ACCOUNT@gmail.com", "YOUR_EMAIL_PASSWORD"); 51 | imapData.setFolder("INBOX"); 52 | imapData.setDebug(true); 53 | 54 | //Set \Seen and \Answered to flags for message with UID 100 55 | MailClient.setFlag(imapData, 100, "\\Seen \\Answered"); 56 | 57 | //Add \Seen and \Answered to flags for message with UID 100 58 | //MailClient.addFlag(imapData, 100, "\\Seen \\Answered"); 59 | 60 | //Remove \Seen and \Answered from flags for message with UID 100 61 | //MailClient.removeFlag(imapData, 100, "\\Seen \\Answered"); 62 | } 63 | 64 | 65 | 66 | void loop() 67 | { 68 | 69 | } 70 | 71 | -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/ESP32_Mail_Client/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map ESP32-Mail-Client 3 | ####################################### 4 | 5 | ####################################### 6 | # Classes (KEYWORD1) 7 | ####################################### 8 | 9 | IMAPData KEYWORD1 10 | SMTPData KEYWORD1 11 | attachmentData KEYWORD1 12 | SendStatus KEYWORD1 13 | messageBodyData KEYWORD1 14 | DownloadProgress KEYWORD1 15 | MessageData KEYWORD1 16 | 17 | TIME KEYWORD1 18 | 19 | 20 | ################################## 21 | # Methods and Functions (KEYWORD2) 22 | ################################## 23 | 24 | sendMail KEYWORD2 25 | readMail KEYWORD2 26 | smtpErrorReason KEYWORD2 27 | imapErrorReason KEYWORD2 28 | sdBegin KEYWORD2 29 | setFlag KEYWORD2 30 | addFlag KEYWORD2 31 | removeFlag KEYWORD2 32 | 33 | 34 | setClock KEYWORD2 35 | getUnixTime KEYWORD2 36 | getTimestamp KEYWORD2 37 | getYear KEYWORD2 38 | getMonth KEYWORD2 39 | getDay KEYWORD2 40 | getDayOfWeek KEYWORD2 41 | getDayOfWeekString KEYWORD2 42 | getHour KEYWORD2 43 | getMin KEYWORD2 44 | getSec KEYWORD2 45 | getNumberOfDayThisYear KEYWORD2 46 | getTotalDays KEYWORD2 47 | dayofweek KEYWORD2 48 | getCurrentSecond KEYWORD2 49 | getCurrentTimestamp KEYWORD2 50 | getTimeFromSec KEYWORD2 51 | 52 | ######################################### 53 | # Methods for IMAP Data object (KEYWORD2) 54 | ######################################### 55 | 56 | setLogin KEYWORD2 57 | setSTARTTLS KEYWORD2 58 | setDebug KEYWORD2 59 | setFolder KEYWORD2 60 | setMessageBufferSize KEYWORD2 61 | setAttachmentSizeLimit KEYWORD2 62 | setSearchCriteria KEYWORD2 63 | setSaveFilePath KEYWORD2 64 | setFechUID KEYWORD2 65 | setDownloadAttachment KEYWORD2 66 | setHTMLMessage KEYWORD2 67 | setTextMessage KEYWORD2 68 | setSearchLimit KEYWORD2 69 | setRecentSort KEYWORD2 70 | setReadCallback KEYWORD2 71 | setDownloadReport KEYWORD2 72 | isHeaderOnly KEYWORD2 73 | getFrom KEYWORD2 74 | getFromCharset KEYWORD2 75 | getTo KEYWORD2 76 | getToCharset KEYWORD2 77 | getCC KEYWORD2 78 | getCCCharset KEYWORD2 79 | getSubject KEYWORD2 80 | getSubjectCharset KEYWORD2 81 | getHTMLMessage KEYWORD2 82 | getTextMessage KEYWORD2 83 | getHTMLMessgaeCharset KEYWORD2 84 | getTextMessgaeCharset KEYWORD2 85 | getDate KEYWORD2 86 | getUID KEYWORD2 87 | getNumber KEYWORD2 88 | getMessageID KEYWORD2 89 | getAcceptLanguage KEYWORD2 90 | getContentLanguage KEYWORD2 91 | isFetchMessageFailed KEYWORD2 92 | getFetchMessageFailedReason KEYWORD2 93 | isDownloadAttachmentFailed KEYWORD2 94 | getDownloadAttachmentFailedReason KEYWORD2 95 | isDownloadMessageFailed KEYWORD2 96 | getDownloadMessageFailedReason KEYWORD2 97 | saveHTMLMessage KEYWORD2 98 | saveTextMessage KEYWORD2 99 | getFolderCount KEYWORD2 100 | getFolder KEYWORD2 101 | getFlagCount KEYWORD2 102 | getFlag KEYWORD2 103 | totalMessages KEYWORD2 104 | searchCount KEYWORD2 105 | availableMessages KEYWORD2 106 | getAttachmentCount KEYWORD2 107 | getAttachmentFileName KEYWORD2 108 | getAttachmentName KEYWORD2 109 | getAttachmentFileSize KEYWORD2 110 | getAttachmentCreationDate KEYWORD2 111 | getAttachmentType KEYWORD2 112 | empty KEYWORD2 113 | clearMessageData KEYWORD2 114 | 115 | ######################################### 116 | # Methods for SMTP Data object (KEYWORD2) 117 | ######################################### 118 | 119 | setSender KEYWORD2 120 | getFromName KEYWORD2 121 | getSenderEmail KEYWORD2 122 | setPriority KEYWORD2 123 | getPriority KEYWORD2 124 | addRecipient KEYWORD2 125 | removeRecipient KEYWORD2 126 | clearRecipient KEYWORD2 127 | getRecipient KEYWORD2 128 | recipientCount KEYWORD2 129 | setSubject KEYWORD2 130 | getSubject KEYWORD2 131 | setMessage KEYWORD2 132 | getMessage KEYWORD2 133 | htmlFormat KEYWORD2 134 | addCC KEYWORD2 135 | removeCC KEYWORD2 136 | clearCC KEYWORD2 137 | getCC KEYWORD2 138 | ccCount KEYWORD2 139 | addBCC KEYWORD2 140 | removeBCC KEYWORD2 141 | clearBCC KEYWORD2 142 | getBCC KEYWORD2 143 | bccCount KEYWORD2 144 | addAttachData KEYWORD2 145 | removeAttachData KEYWORD2 146 | attachDataCount KEYWORD2 147 | addAttachFile KEYWORD2 148 | removeAttachFile KEYWORD2 149 | clearAttachData KEYWORD2 150 | clearAttachFile KEYWORD2 151 | clearAttachment KEYWORD2 152 | attachFileCount KEYWORD2 153 | setSendCallback KEYWORD2 154 | 155 | 156 | ############################################################ 157 | # Functions for ReadStatus and SendStatus classes (KEYWORD2) 158 | ############################################################ 159 | 160 | SendStatus KEYWORD2 161 | info KEYWORD2 162 | success KEYWORD2 163 | ReadStatus KEYWORD2 164 | status KEYWORD2 165 | startAt KEYWORD2 166 | endAt KEYWORD2 167 | equalTo KEYWORD2 168 | equalTo KEYWORD2 169 | 170 | clockReady KEYWORD3 -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/ESP32_Mail_Client/library.properties: -------------------------------------------------------------------------------- 1 | name=ESP32 Mail Client 2 | 3 | version=2.1.1 4 | 5 | author=Mobizt 6 | 7 | maintainer=Mobizt 8 | 9 | sentence=Mail Client Arduino Library for ESP32 10 | 11 | paragraph=This library allows ESP32 to send Email with/without attachment and receive Email with/without attachment download through SMTP and IMAP servers. 12 | 13 | category=Communication 14 | 15 | url=https://github.com/mobizt/ESP32-Mail-Client 16 | 17 | architectures=esp32 18 | -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/ESP32_Mail_Client/media/images/esp32-mail.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asjdf/ESP32CAMmotion_detection/9e519fb6e63d87f2582c1cf37461fde63cc942e2/References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/ESP32_Mail_Client/media/images/esp32-mail.jpg -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/ESP32_Mail_Client/media/images/esp32-mail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asjdf/ESP32CAMmotion_detection/9e519fb6e63d87f2582c1cf37461fde63cc942e2/References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/ESP32_Mail_Client/media/images/esp32-mail.png -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/ESP32_Mail_Client/src/ESP32MailHTTPClient.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Customized version of ESP32 HTTPClient Library. 3 | * Allow custom header and payload with STARTTLS support 4 | * 5 | * v 1.0.0 6 | * 7 | * The MIT License (MIT) 8 | * Copyright (c) 2019 K. Suwatchai (Mobizt) 9 | * 10 | * HTTPClient Arduino library for ESP32 11 | * 12 | * Copyright (c) 2015 Markus Sattler. All rights reserved. 13 | * This file is part of the HTTPClient for Arduino. 14 | * Port to ESP32 by Evandro Luis Copercini (2017), 15 | * changed fingerprints to CA verification. 16 | * 17 | * This library is free software; you can redistribute it and/or 18 | * modify it under the terms of the GNU Lesser General Public 19 | * License as published by the Free Software Foundation; either 20 | * version 2.1 of the License, or (at your option) any later version. 21 | * 22 | * This library is distributed in the hope that it will be useful, 23 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 24 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 25 | * Lesser General Public License for more details. 26 | * 27 | * You should have received a copy of the GNU Lesser General Public 28 | * License along with this library; if not, write to the Free Software 29 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 30 | * 31 | */ 32 | 33 | #ifndef HTTP_CLIENT_ESP32EX_H_ 34 | #define HTTP_CLIENT_ESP32EX_H_ 35 | 36 | #include 37 | #include 38 | 39 | #include 40 | #include "WiFiClientSecureESP32.h" 41 | 42 | class ESP32MailHTTPClient : public HTTPClient 43 | { 44 | public: 45 | ESP32MailHTTPClient(); 46 | ~ESP32MailHTTPClient(); 47 | 48 | /** 49 | * Initialization of new http connection. 50 | * \param host - Host name without protocols. 51 | * \param port - Server's port. 52 | * \param uri - The URI of resource. 53 | * \param CAcert - The Base64 encode root certificate string 54 | * \return True as default. 55 | * If no certificate string provided, use (const char*)NULL to CAcert param 56 | */ 57 | bool begin(const char *host, uint16_t port, const char *uri, const char *CAcert); 58 | 59 | /** 60 | * Check the http connection status. 61 | * \return True if connected. 62 | */ 63 | bool connected(); 64 | 65 | /** 66 | * Establish http connection if header provided and send it, send payload if provided. 67 | * \param header - The header string (constant chars array). 68 | * \param payload - The payload string (constant chars array), optional. 69 | * \return http status code, Return zero if new http connection and header and/or payload sent 70 | * with no error or no header and payload provided. If obly payload provided, no new http connection was established. 71 | */ 72 | int sendRequest(const char *header, const char *payload); 73 | 74 | /** 75 | * Send extra header without making new http connection (if sendRequest has been called) 76 | * \param header - The header string (constant chars array). 77 | * \return True if header sending success. 78 | * Need to call sendRequest with header first. 79 | */ 80 | bool sendHeader(const char *header); 81 | 82 | /** 83 | * Get the WiFi client pointer. 84 | * \return WiFi client pointer. 85 | */ 86 | WiFiClient *getStreamPtr(void); 87 | 88 | uint16_t tcpTimeout = HTTPCLIENT_DEFAULT_TCP_TIMEOUT; 89 | bool connect(void); 90 | bool connect(bool starttls); 91 | void setDebugCallback(DebugMsgCallback cb); 92 | 93 | protected: 94 | TransportTraitsPtr transportTraits; 95 | std::unique_ptr _client; 96 | DebugMsgCallback _debugCallback = NULL; 97 | 98 | std::string _host = ""; 99 | std::string _uri = ""; 100 | uint16_t _port = 0; 101 | }; 102 | 103 | 104 | 105 | #endif /* ESP32MailHTTPClient_H_ */ 106 | 107 | 108 | -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/ESP32_Mail_Client/src/ESP32TimeHelper.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ESP32 Internet Time Helper Arduino Library v 1.0.1 3 | * 4 | * The MIT License (MIT) 5 | * Copyright (c) 2019 K. Suwatchai (Mobizt) 6 | * 7 | * 8 | * Permission is hereby granted, free of charge, to any person returning a copy of 9 | * this software and associated documentation files (the "Software"), to deal in 10 | * the Software without restriction, including without limitation the rights to 11 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 12 | * the Software, and to permit persons to whom the Software is furnished to do so, 13 | * subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in all 16 | * copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 20 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 21 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 22 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | #ifndef ESP_TIME_HELPER_h 27 | #define ESP_TIME_HELPER_h 28 | #include 29 | #include 30 | #include 31 | 32 | class ESP32TimeHelper 33 | { 34 | public: 35 | ESP32TimeHelper(); 36 | bool clockReady = false; 37 | bool setClock(float gmtOffset, float daylightOffset); 38 | uint32_t getUnixTime(); 39 | time_t getTimestamp(int year, int mon, int date, int hour, int mins, int sec); 40 | int getYear(); 41 | int getMonth(); 42 | int getDay(); 43 | int getDayOfWeek(); 44 | String getDayOfWeekString(); 45 | int getHour(); 46 | int getMin(); 47 | int getSec(); 48 | int getNumberOfDayThisYear(); 49 | int getTotalDays(int year, int month, int day); 50 | int dayofWeek(int year, int month, int day); 51 | int getCurrentSecond(); 52 | uint64_t getCurrentTimestamp(); 53 | void getTimeFromSec(int secCount, int &yrs, int &months, int &days, int &hr, int &min, int &sec); 54 | 55 | private: 56 | time_t now; 57 | uint64_t msec_time_diff = 0; 58 | struct tm timeinfo; 59 | float TZ = 0.0; 60 | float DST_MN = 0.0; 61 | 62 | bool setClock(); 63 | int totalDays(int y, int m, int d); 64 | const char *dow[20] = {"sunday", "monday", "tuesday", "wednesday", "thurseday", "friday", "saturday"}; 65 | }; 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/ESP32_Mail_Client/src/RFC2047.cpp: -------------------------------------------------------------------------------- 1 | #include "RFC2047.h" 2 | 3 | RFC2047::RFC2047(){} 4 | 5 | 6 | void RFC2047::rfc2047Decode(char *d, const char *s, size_t dlen){ 7 | 8 | const char *p, *q; 9 | size_t n; 10 | int found_encoded = 0; 11 | 12 | dlen--; /* save room for the terminal nul */ 13 | 14 | while (*s && dlen > 0) 15 | { 16 | if ((p = strstr (s, "=?")) == NULL || 17 | (q = strchr (p + 2, '?')) == NULL || 18 | (q = strchr (q + 1, '?')) == NULL || 19 | (q = strstr (q + 1, "?=")) == NULL) 20 | { 21 | /* no encoded words */ 22 | if (d != s) 23 | strfcpy (d, s, dlen + 1); 24 | return; 25 | } 26 | 27 | if (p != s) 28 | { 29 | n = (size_t) (p - s); 30 | /* ignore spaces between encoded words */ 31 | if (!found_encoded || strspn (s, " \t\r\n") != n) 32 | { 33 | if (n > dlen) 34 | n = dlen; 35 | if (d != s) 36 | memcpy (d, s, n); 37 | d += n; 38 | dlen -= n; 39 | } 40 | } 41 | 42 | rfc2047DecodeWord (d, p, dlen); 43 | found_encoded = 1; 44 | s = q + 2; 45 | n = strlen (d); 46 | dlen -= n; 47 | d += n; 48 | } 49 | *d = 0; 50 | 51 | } 52 | 53 | void RFC2047::rfc2047DecodeWord(char *d, const char *s, size_t dlen){ 54 | 55 | char *p = safe_strdup (s); 56 | char *pp = p; 57 | char *pd = d; 58 | size_t len = dlen; 59 | int enc = 0, filter = 0, count = 0, c1, c2, c3, c4; 60 | 61 | while ((pp = strtok (pp, "?")) != NULL) 62 | { 63 | count++; 64 | switch (count) 65 | { 66 | case 2: 67 | if (strcasecmp (pp, Charset) != 0) 68 | { 69 | filter = 1; 70 | } 71 | break; 72 | case 3: 73 | if (toupper (*pp) == 'Q') 74 | enc = ENCQUOTEDPRINTABLE; 75 | else if (toupper (*pp) == 'B') 76 | enc = ENCBASE64; 77 | else 78 | return; 79 | break; 80 | case 4: 81 | if (enc == ENCQUOTEDPRINTABLE) 82 | { 83 | while (*pp && len > 0) 84 | { 85 | if (*pp == '_') 86 | { 87 | *pd++ = ' '; 88 | len--; 89 | } 90 | else if (*pp == '=') 91 | { 92 | *pd++ = (hexval(pp[1]) << 4) | hexval(pp[2]); 93 | len--; 94 | pp += 2; 95 | } 96 | else 97 | { 98 | *pd++ = *pp; 99 | len--; 100 | } 101 | pp++; 102 | } 103 | *pd = 0; 104 | } 105 | else if (enc == ENCBASE64) 106 | { 107 | while (*pp && len > 0) 108 | { 109 | c1 = base64val(pp[0]); 110 | c2 = base64val(pp[1]); 111 | *pd++ = (c1 << 2) | ((c2 >> 4) & 0x3); 112 | if (--len == 0) break; 113 | 114 | if (pp[2] == '=') break; 115 | 116 | c3 = base64val(pp[2]); 117 | *pd++ = ((c2 & 0xf) << 4) | ((c3 >> 2) & 0xf); 118 | if (--len == 0) 119 | break; 120 | 121 | if (pp[3] == '=') 122 | break; 123 | 124 | c4 = base64val(pp[3]); 125 | *pd++ = ((c3 & 0x3) << 6) | c4; 126 | if (--len == 0) 127 | break; 128 | 129 | pp += 4; 130 | } 131 | *pd = 0; 132 | } 133 | break; 134 | } 135 | pp = 0; 136 | } 137 | safe_free (&p); 138 | if (filter) 139 | { 140 | 141 | pd = d; 142 | while (*pd) 143 | { 144 | if (!IsPrint (*pd)) 145 | *pd = '?'; 146 | pd++; 147 | } 148 | } 149 | return; 150 | } 151 | 152 | 153 | void *RFC2047::safe_calloc (size_t nmemb, size_t size) 154 | { 155 | void *p; 156 | 157 | if (!nmemb || !size) 158 | return NULL; 159 | if (!(p = calloc (nmemb, size))) 160 | { 161 | //out of memory 162 | return NULL; 163 | } 164 | return p; 165 | } 166 | 167 | void *RFC2047::safe_malloc (unsigned int siz) 168 | { 169 | void *p; 170 | 171 | if (siz == 0) 172 | return 0; 173 | if ((p = (void *) malloc (siz)) == 0) 174 | { 175 | //out of memory 176 | return NULL; 177 | } 178 | return (p); 179 | } 180 | 181 | void RFC2047::safe_realloc (void **p, size_t siz) 182 | { 183 | void *r; 184 | 185 | if (siz == 0) 186 | { 187 | if (*p) 188 | { 189 | free (*p); 190 | *p = NULL; 191 | } 192 | return; 193 | } 194 | 195 | if (*p) 196 | r = (void *) realloc (*p, siz); 197 | else 198 | { 199 | r = (void *) malloc (siz); 200 | } 201 | 202 | if (!r) 203 | { 204 | //out of memory 205 | return; 206 | } 207 | 208 | *p = r; 209 | } 210 | 211 | void RFC2047::safe_free (void *ptr) 212 | { 213 | void **p = (void **)ptr; 214 | if (*p) 215 | { 216 | free (*p); 217 | *p = 0; 218 | } 219 | } 220 | 221 | char *RFC2047::safe_strdup (const char *s) 222 | { 223 | char *p; 224 | size_t l; 225 | 226 | if (!s || !*s) return 0; 227 | l = strlen (s) + 1; 228 | p = (char *)safe_malloc (l); 229 | memcpy (p, s, l); 230 | return (p); 231 | } 232 | 233 | 234 | -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/ESP32_Mail_Client/src/RFC2047.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef RFC2047_H 3 | #define RFC2047_H 4 | 5 | #include 6 | 7 | 8 | #define strfcpy(A,B,C) strncpy(A,B,C), *(A+(C)-1)=0 9 | 10 | enum 11 | { 12 | ENCOTHER, 13 | ENC7BIT, 14 | ENC8BIT, 15 | ENCQUOTEDPRINTABLE, 16 | ENCBASE64, 17 | ENCBINARY 18 | }; 19 | 20 | __attribute__((used)) static const char *Charset = "utf-8"; 21 | 22 | __attribute__((used)) static int Index_hex[128] = { 23 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 24 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 25 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 26 | 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, -1, -1, 27 | -1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, 28 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 29 | -1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, 30 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; 31 | 32 | __attribute__((used)) static int Index_64[128] = { 33 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 34 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 35 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, 36 | 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, 37 | -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 38 | 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, 39 | -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 40 | 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1}; 41 | 42 | #define IsPrint(c) (isprint((unsigned char)(c)) || \ 43 | ((unsigned char)(c) >= 0xa0)) 44 | 45 | #define hexval(c) Index_hex[(unsigned int)(c)] 46 | #define base64val(c) Index_64[(unsigned int)(c)] 47 | 48 | class RFC2047{ 49 | 50 | public: 51 | RFC2047(); 52 | void rfc2047Decode(char *d, const char *s, size_t dlen); 53 | 54 | 55 | private: 56 | void rfc2047DecodeWord(char *d, const char *s, size_t dlen); 57 | void *safe_calloc (size_t nmemb, size_t size); 58 | void *safe_malloc (unsigned int siz); 59 | void safe_realloc (void **p, size_t siz); 60 | void safe_free (void *ptr); 61 | char *safe_strdup (const char *s); 62 | 63 | 64 | }; 65 | 66 | #endif -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/ESP_WiFiManager-master/.gitignore: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | *.d 3 | 4 | # Compiled Object files 5 | *.slo 6 | *.lo 7 | *.o 8 | *.obj 9 | 10 | # Precompiled Headers 11 | *.gch 12 | *.pch 13 | 14 | # Compiled Dynamic libraries 15 | *.so 16 | *.dylib 17 | *.dll 18 | 19 | # Fortran module files 20 | *.mod 21 | *.smod 22 | 23 | # Compiled Static libraries 24 | *.lai 25 | *.la 26 | *.a 27 | *.lib 28 | 29 | # Executables 30 | *.exe 31 | *.out 32 | *.app 33 | -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/ESP_WiFiManager-master/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ## Contributing to ESP_WiFiManager 2 | 3 | ### Reporting Bugs 4 | 5 | Please report bugs in ESP_WiFiManager if you find them. 6 | 7 | However, before reporting a bug please check through the following: 8 | 9 | * [Existing Open Issues](https://github.com/khoih-prog/ESP_WiFiManager/issues) - someone might have already encountered this. 10 | 11 | If you don't find anything, please [open a new issue](https://github.com/khoih-prog/ESP_WiFiManager/issues/new). 12 | 13 | ### How to submit a bug report 14 | 15 | Please ensure to specify the following: 16 | 17 | * Arduino IDE version (e.g. 1.8.11) or Platform.io version 18 | * `ESP8266` or `ESP32` Core Version (e.g. ESP8266 core v2.6.3 or ESP32 v1.0.4) 19 | * Contextual information (e.g. what you were trying to achieve) 20 | * Simplest possible steps to reproduce 21 | * Anything that might be relevant in your opinion, such as: 22 | * Operating system (Windows, Ubuntu, etc.) and the output of `uname -a` 23 | * Network configuration 24 | 25 | 26 | ### Example 27 | 28 | ``` 29 | Arduino IDE version: 1.8.11 30 | ESP8266 Core Version 2.6.3 31 | OS: Ubuntu 16.04 LTS 32 | Linux Inspiron 4.4.0-170-generic #199-Ubuntu SMP Thu Nov 14 01:45:04 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux 33 | 34 | Context: 35 | I encountered an endless loop while trying to connect to Local WiFi. 36 | 37 | Steps to reproduce: 38 | 1. ... 39 | 2. ... 40 | 3. ... 41 | 4. ... 42 | ``` 43 | ### Sending Feature Requests 44 | 45 | Feel free to post feature requests. It's helpful if you can explain exactly why the feature would be useful. 46 | 47 | There are usually some outstanding feature requests in the [existing issues list](https://github.com/khoih-prog/ESP_WiFiManager/issues?q=is%3Aopen+is%3Aissue+label%3Aenhancement), feel free to add comments to them. 48 | 49 | ### Sending Pull Requests 50 | 51 | Pull Requests with changes and fixes are also welcome! 52 | -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/ESP_WiFiManager-master/Images/Configuration.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asjdf/ESP32CAMmotion_detection/9e519fb6e63d87f2582c1cf37461fde63cc942e2/References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/ESP_WiFiManager-master/Images/Configuration.png -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/ESP_WiFiManager-master/Images/Info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asjdf/ESP32CAMmotion_detection/9e519fb6e63d87f2582c1cf37461fde63cc942e2/References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/ESP_WiFiManager-master/Images/Info.png -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/ESP_WiFiManager-master/Images/Info_Short.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asjdf/ESP32CAMmotion_detection/9e519fb6e63d87f2582c1cf37461fde63cc942e2/References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/ESP_WiFiManager-master/Images/Info_Short.png -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/ESP_WiFiManager-master/Images/Info_Short_1-0-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asjdf/ESP32CAMmotion_detection/9e519fb6e63d87f2582c1cf37461fde63cc942e2/References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/ESP_WiFiManager-master/Images/Info_Short_1-0-5.png -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/ESP_WiFiManager-master/Images/Main.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asjdf/ESP32CAMmotion_detection/9e519fb6e63d87f2582c1cf37461fde63cc942e2/References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/ESP_WiFiManager-master/Images/Main.png -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/ESP_WiFiManager-master/Images/Main_1-0-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asjdf/ESP32CAMmotion_detection/9e519fb6e63d87f2582c1cf37461fde63cc942e2/References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/ESP_WiFiManager-master/Images/Main_1-0-5.png -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/ESP_WiFiManager-master/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Khoi Hoang 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/ESP_WiFiManager-master/examples/ConfigOnSwitch/README.md: -------------------------------------------------------------------------------- 1 | # The Config On Switch Example 2 | In this example we initiate the configuration portal to connect an ESP8266 to WiFi by pushing a button. The example requires this version of WiFi Manager. It will not work with the tzapu version. 3 | 4 | ## Why Have A Button To Initiate Configuration? 5 | Once the ESP device contains network credentials it will always try to connect to that network in the background and succeed whenever that network becomes visible. The application continues to function and because WiFi networks tend to be flaky only a human has the knowledge of whether a new network is required or it is better to wait for the network to become visible again. Therefore, providing a configuration portal must be human initiated and requiring a button push is a good way to get human input. 6 | 7 | The alternative of automatically going into configuration mode every time a WiFi network becomes invisible will cause the application to stop and the device will sit in configuration mode forever. This is undesirable when a network is temporarily unavailable. 8 | 9 | ## Issues With Automatically Going Into Configuration Mode 10 | Providing a timeout on configuration mode is one way to get the application running again when a network becomes temporarily unavailable and no one is around to reboot. However, the application will still not function while waiting for the timeout and the device is vulnerable to sabotage when in config mode. With a push button it will also be vulnerable to sabotage whenever the saboteur has physical access but then it is vulnerable in other ways as well. An assumption that saboteurs will not have physical access to the device is sufficient for most applications. 11 | 12 | 13 | -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/ESP_WiFiManager-master/examples/ESP_FSWebServer/README.md: -------------------------------------------------------------------------------- 1 | # ESP_FSWebServer Example 2 | 3 | ## First, how Config Portal works? 4 | In `Configuration Portal Mode`, it starts an access point called `ESP_xxxxxx`. Connect to it using the configurable password you can define in the code. For example, `your_password` (see examples): 5 | 6 | ```cpp 7 | // SSID and PW for Config Portal 8 | String ssid = "ESP_" + String(ESP_getChipId(), HEX); 9 | const char* password = "your_password"; 10 | ``` 11 | After you connected, please, go to http://192.168.4.1, you'll see this `Main` page: 12 | 13 |

14 | 15 |

16 | 17 | Select `Information` to enter the Info page where the board info will be shown (long page) 18 | 19 |

20 | 21 |

22 | 23 | or short page (default) 24 | 25 |

26 | 27 |

28 | 29 | Select `Configuration` to enter this page where you can select an AP and specify its WiFi Credentials 30 | 31 |

32 | 33 |

34 | 35 | Enter your credentials, then click `Save`. The WiFi Credentials will be saved and the board reboots to connect to the selected WiFi AP. 36 | 37 | If you're already connected to a listed WiFi AP and don't want to change anything, just select `Exit Portal` from the `Main` page to reboot the board and connect to the previously-stored AP. The WiFi Credentials are still intact. 38 | 39 | 40 | ## How to use this ESP_FSWebServer example? 41 | 42 | This shows you how to use this example in Ubuntu (but you can use similar commands in other OSes) 43 | 44 | 1. For example, you already downloaded from (https://github.com/khoih-prog/ESP_WiFiManager/tree/master/examples/ESP_FSWebServer/data) to a local folder, e.g., 45 | 46 | ~/Arduino/libraries/ESP_WiFiManager-master/examples/ESP_FSWebServer/data 47 | 48 | 1. Upload the contents of that `data folder` with MkSPIFFS Tool ("ESP8266 Sketch Data Upload" in Tools menu in Arduino IDE) 49 | 2. or upload the contents of a folder by running the following commands: 50 | - Ubuntu$ cd ~/Arduino/libraries/ESP_WiFiManager-master/examples/ESP_FSWebServer/data 51 | - Ubuntu$ for file in \`\ls -A1\`; do curl -F "file=@$PWD/$file" esp8266fs.local/edit; done 52 | 3. Access the sample web page at http://esp8266fs.local 53 | 54 |

55 | 56 |

57 | 58 | 4. Edit / Delete / Download any file in the the folder by going to http://esp8266fs.local/edit 59 | 60 |

61 | 62 |

63 | 64 | 65 | -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/ESP_WiFiManager-master/examples/ESP_FSWebServer/data/CanadaFlag_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asjdf/ESP32CAMmotion_detection/9e519fb6e63d87f2582c1cf37461fde63cc942e2/References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/ESP_WiFiManager-master/examples/ESP_FSWebServer/data/CanadaFlag_1.png -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/ESP_WiFiManager-master/examples/ESP_FSWebServer/data/CanadaFlag_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asjdf/ESP32CAMmotion_detection/9e519fb6e63d87f2582c1cf37461fde63cc942e2/References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/ESP_WiFiManager-master/examples/ESP_FSWebServer/data/CanadaFlag_2.png -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/ESP_WiFiManager-master/examples/ESP_FSWebServer/data/CanadaFlag_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asjdf/ESP32CAMmotion_detection/9e519fb6e63d87f2582c1cf37461fde63cc942e2/References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/ESP_WiFiManager-master/examples/ESP_FSWebServer/data/CanadaFlag_3.jpg -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/ESP_WiFiManager-master/examples/ESP_FSWebServer/data/edit.htm.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asjdf/ESP32CAMmotion_detection/9e519fb6e63d87f2582c1cf37461fde63cc942e2/References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/ESP_WiFiManager-master/examples/ESP_FSWebServer/data/edit.htm.gz -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/ESP_WiFiManager-master/examples/ESP_FSWebServer/data/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asjdf/ESP32CAMmotion_detection/9e519fb6e63d87f2582c1cf37461fde63cc942e2/References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/ESP_WiFiManager-master/examples/ESP_FSWebServer/data/favicon.ico -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/ESP_WiFiManager-master/examples/ESP_FSWebServer/data/graphs.js.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asjdf/ESP32CAMmotion_detection/9e519fb6e63d87f2582c1cf37461fde63cc942e2/References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/ESP_WiFiManager-master/examples/ESP_FSWebServer/data/graphs.js.gz -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/ESP_WiFiManager-master/examples/ESP_FSWebServer/data/index.htm: -------------------------------------------------------------------------------- 1 | 18 | 19 | 20 | 21 | 22 | ESP Monitor 23 | 24 | 85 | 86 | 87 |
88 | 89 | 90 | 91 | 92 |
93 |
94 |
95 |
96 | 97 | -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/ESP_WiFiManager-master/examples/ESP_FSWebServer/pics/esp8266fs.local.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asjdf/ESP32CAMmotion_detection/9e519fb6e63d87f2582c1cf37461fde63cc942e2/References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/ESP_WiFiManager-master/examples/ESP_FSWebServer/pics/esp8266fs.local.png -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/ESP_WiFiManager-master/examples/ESP_FSWebServer/pics/esp8266fs.local_edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asjdf/ESP32CAMmotion_detection/9e519fb6e63d87f2582c1cf37461fde63cc942e2/References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/ESP_WiFiManager-master/examples/ESP_FSWebServer/pics/esp8266fs.local_edit.png -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/ESP_WiFiManager-master/keywords.txt: -------------------------------------------------------------------------------- 1 | ########################################## 2 | # Syntax Coloring Map For ESP_WifiManager 3 | ########################################## 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | ESP_WiFiManager KEYWORD1 10 | ESP_WMParameter KEYWORD1 11 | 12 | 13 | ####################################### 14 | # Methods and Functions (KEYWORD2) 15 | ####################################### 16 | getID KEYWORD2 17 | getValue KEYWORD2 18 | getPlaceholder KEYWORD2 19 | getValueLength KEYWORD2 20 | getLabelPlacement KEYWORD2 21 | getCustomHTML KEYWORD2 22 | autoConnect KEYWORD2 23 | startConfigPortal KEYWORD2 24 | getConfigPortalSSID KEYWORD2 25 | getConfigPortalPW KEYWORD2 26 | resetSettings KEYWORD2 27 | setConfigPortalTimeout KEYWORD2 28 | setTimeout KEYWORD2 29 | setConnectTimeout KEYWORD2 30 | setDebugOutput KEYWORD2 31 | setMinimumSignalQuality KEYWORD2 32 | setAPStaticIPConfig KEYWORD2 33 | setSTAStaticIPConfig KEYWORD2 34 | setAPCallback KEYWORD2 35 | setSaveConfigCallback KEYWORD2 36 | addParameter KEYWORD2 37 | setBreakAfterConfig KEYWORD2 38 | setCustomHeadElement KEYWORD2 39 | setRemoveDuplicateAPs KEYWORD2 40 | scanWifiNetworks KEYWORD2 41 | getSSID KEYWORD2 42 | getPW KEYWORD2 43 | getParameters KEYWORD2 44 | getParametersCount KEYWORD2 45 | getStatus KEYWORD2 46 | getStoredWiFiSSID KEYWORD2 47 | getStoredWiFiPass KEYWORD2 48 | WiFi_SSID KEYWORD2 49 | WiFi_Pass KEYWORD2 50 | setHostname KEYWORD2 51 | 52 | ####################################### 53 | # Constants (LITERAL1) 54 | ####################################### 55 | 56 | # LITERAL1 57 | -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/ESP_WiFiManager-master/library.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ESP_WifiManager", 3 | "keywords": "wifi, wi-fi", 4 | "description": "ESP32, ESP8266 WiFi Connection manager with fallback web configuration portal", 5 | "repository": 6 | { 7 | "type": "git", 8 | "url": "https://github.com/khoih-prog/ESP_WiFiManager" 9 | }, 10 | "frameworks": "arduino", 11 | "platforms": "espressif", 12 | "version": "1.0.6" 13 | } 14 | -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/ESP_WiFiManager-master/library.properties: -------------------------------------------------------------------------------- 1 | name=ESP_WiFiManager 2 | version=1.0.6 3 | author=Khoi Hoang 4 | maintainer=Khoi Hoang 5 | license=MIT 6 | sentence=ESP32, ESP8266 WiFi Connection manager with fallback web configuration portal 7 | paragraph=Library for configuring ESP32, ESP8266 modules WiFi credentials at runtime. You can also specify static DNS servers, personalized HostName. 8 | category=Communication 9 | url=https://github.com/khoih-prog/ESP_WiFiManager 10 | architectures=esp8266,esp32 11 | -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/ESP_WiFiManager-master/travis/common.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | function build_examples() 4 | { 5 | # track the exit code for this platform 6 | local exit_code=0 7 | # loop through results and add them to the array 8 | examples=($(find $PWD/examples/ -name "*.pde" -o -name "*.ino")) 9 | 10 | # get the last example in the array 11 | local last="${examples[@]:(-1)}" 12 | 13 | # loop through example sketches 14 | for example in "${examples[@]}"; do 15 | 16 | # store the full path to the example's sketch directory 17 | local example_dir=$(dirname $example) 18 | 19 | # store the filename for the example without the path 20 | local example_file=$(basename $example) 21 | 22 | echo "$example_file: " 23 | local sketch="$example_dir/$example_file" 24 | echo "$sketch" 25 | #arduino -v --verbose-build --verify $sketch 26 | 27 | # verify the example, and save stdout & stderr to a variable 28 | # we have to avoid reading the exit code of local: 29 | # "when declaring a local variable in a function, the local acts as a command in its own right" 30 | local build_stdout 31 | build_stdout=$(arduino --verify $sketch 2>&1) 32 | 33 | # echo output if the build failed 34 | if [ $? -ne 0 ]; then 35 | # heavy X 36 | echo -e "\xe2\x9c\x96" 37 | echo -e "----------------------------- DEBUG OUTPUT -----------------------------\n" 38 | echo "$build_stdout" 39 | echo -e "\n------------------------------------------------------------------------\n" 40 | 41 | # mark as fail 42 | exit_code=1 43 | 44 | else 45 | # heavy checkmark 46 | echo -e "\xe2\x9c\x93" 47 | fi 48 | done 49 | 50 | return $exit_code 51 | } 52 | -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/Time/DateStrings.cpp: -------------------------------------------------------------------------------- 1 | /* DateStrings.cpp 2 | * Definitions for date strings for use with the Time library 3 | * 4 | * Updated for Arduino 1.5.7 18 July 2014 5 | * 6 | * No memory is consumed in the sketch if your code does not call any of the string methods 7 | * You can change the text of the strings, make sure the short strings are each exactly 3 characters 8 | * the long strings can be any length up to the constant dt_MAX_STRING_LEN defined in TimeLib.h 9 | * 10 | */ 11 | 12 | #if defined(__AVR__) 13 | #include 14 | #else 15 | // for compatiblity with Arduino Due and Teensy 3.0 and maybe others? 16 | #define PROGMEM 17 | #define PGM_P const char * 18 | #define pgm_read_byte(addr) (*(const unsigned char *)(addr)) 19 | #define pgm_read_word(addr) (*(const unsigned char **)(addr)) 20 | #define strcpy_P(dest, src) strcpy((dest), (src)) 21 | #endif 22 | #include // for strcpy_P or strcpy 23 | #include "TimeLib.h" 24 | 25 | // the short strings for each day or month must be exactly dt_SHORT_STR_LEN 26 | #define dt_SHORT_STR_LEN 3 // the length of short strings 27 | 28 | static char buffer[dt_MAX_STRING_LEN+1]; // must be big enough for longest string and the terminating null 29 | 30 | const char monthStr0[] PROGMEM = ""; 31 | const char monthStr1[] PROGMEM = "January"; 32 | const char monthStr2[] PROGMEM = "February"; 33 | const char monthStr3[] PROGMEM = "March"; 34 | const char monthStr4[] PROGMEM = "April"; 35 | const char monthStr5[] PROGMEM = "May"; 36 | const char monthStr6[] PROGMEM = "June"; 37 | const char monthStr7[] PROGMEM = "July"; 38 | const char monthStr8[] PROGMEM = "August"; 39 | const char monthStr9[] PROGMEM = "September"; 40 | const char monthStr10[] PROGMEM = "October"; 41 | const char monthStr11[] PROGMEM = "November"; 42 | const char monthStr12[] PROGMEM = "December"; 43 | 44 | const PROGMEM char * const PROGMEM monthNames_P[] = 45 | { 46 | monthStr0,monthStr1,monthStr2,monthStr3,monthStr4,monthStr5,monthStr6, 47 | monthStr7,monthStr8,monthStr9,monthStr10,monthStr11,monthStr12 48 | }; 49 | 50 | const char monthShortNames_P[] PROGMEM = "ErrJanFebMarAprMayJunJulAugSepOctNovDec"; 51 | 52 | const char dayStr0[] PROGMEM = "Err"; 53 | const char dayStr1[] PROGMEM = "Sunday"; 54 | const char dayStr2[] PROGMEM = "Monday"; 55 | const char dayStr3[] PROGMEM = "Tuesday"; 56 | const char dayStr4[] PROGMEM = "Wednesday"; 57 | const char dayStr5[] PROGMEM = "Thursday"; 58 | const char dayStr6[] PROGMEM = "Friday"; 59 | const char dayStr7[] PROGMEM = "Saturday"; 60 | 61 | const PROGMEM char * const PROGMEM dayNames_P[] = 62 | { 63 | dayStr0,dayStr1,dayStr2,dayStr3,dayStr4,dayStr5,dayStr6,dayStr7 64 | }; 65 | 66 | const char dayShortNames_P[] PROGMEM = "ErrSunMonTueWedThuFriSat"; 67 | 68 | /* functions to return date strings */ 69 | 70 | char* monthStr(uint8_t month) 71 | { 72 | strcpy_P(buffer, (PGM_P)pgm_read_word(&(monthNames_P[month]))); 73 | return buffer; 74 | } 75 | 76 | char* monthShortStr(uint8_t month) 77 | { 78 | for (int i=0; i < dt_SHORT_STR_LEN; i++) 79 | buffer[i] = pgm_read_byte(&(monthShortNames_P[i+ (month*dt_SHORT_STR_LEN)])); 80 | buffer[dt_SHORT_STR_LEN] = 0; 81 | return buffer; 82 | } 83 | 84 | char* dayStr(uint8_t day) 85 | { 86 | strcpy_P(buffer, (PGM_P)pgm_read_word(&(dayNames_P[day]))); 87 | return buffer; 88 | } 89 | 90 | char* dayShortStr(uint8_t day) 91 | { 92 | uint8_t index = day*dt_SHORT_STR_LEN; 93 | for (int i=0; i < dt_SHORT_STR_LEN; i++) 94 | buffer[i] = pgm_read_byte(&(dayShortNames_P[index + i])); 95 | buffer[dt_SHORT_STR_LEN] = 0; 96 | return buffer; 97 | } 98 | -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/Time/Time.h: -------------------------------------------------------------------------------- 1 | #include "TimeLib.h" 2 | -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/Time/examples/Processing/SyncArduinoClock/SyncArduinoClock.pde: -------------------------------------------------------------------------------- 1 | /** 2 | * SyncArduinoClock. 3 | * 4 | * portIndex must be set to the port connected to the Arduino 5 | * 6 | * The current time is sent in response to request message from Arduino 7 | * or by clicking the display window 8 | * 9 | * The time message is 11 ASCII text characters; a header (the letter 'T') 10 | * followed by the ten digit system time (unix time) 11 | */ 12 | 13 | 14 | import processing.serial.*; 15 | import java.util.Date; 16 | import java.util.Calendar; 17 | import java.util.GregorianCalendar; 18 | 19 | public static final short portIndex = 0; // select the com port, 0 is the first port 20 | public static final String TIME_HEADER = "T"; //header for arduino serial time message 21 | public static final char TIME_REQUEST = 7; // ASCII bell character 22 | public static final char LF = 10; // ASCII linefeed 23 | public static final char CR = 13; // ASCII linefeed 24 | Serial myPort; // Create object from Serial class 25 | 26 | void setup() { 27 | size(200, 200); 28 | println(Serial.list()); 29 | println(" Connecting to -> " + Serial.list()[portIndex]); 30 | myPort = new Serial(this,Serial.list()[portIndex], 9600); 31 | println(getTimeNow()); 32 | } 33 | 34 | void draw() 35 | { 36 | textSize(20); 37 | textAlign(CENTER); 38 | fill(0); 39 | text("Click to send\nTime Sync", 0, 75, 200, 175); 40 | if ( myPort.available() > 0) { // If data is available, 41 | char val = char(myPort.read()); // read it and store it in val 42 | if(val == TIME_REQUEST){ 43 | long t = getTimeNow(); 44 | sendTimeMessage(TIME_HEADER, t); 45 | } 46 | else 47 | { 48 | if(val == LF) 49 | ; //igonore 50 | else if(val == CR) 51 | println(); 52 | else 53 | print(val); // echo everying but time request 54 | } 55 | } 56 | } 57 | 58 | void mousePressed() { 59 | sendTimeMessage( TIME_HEADER, getTimeNow()); 60 | } 61 | 62 | 63 | void sendTimeMessage(String header, long time) { 64 | String timeStr = String.valueOf(time); 65 | myPort.write(header); // send header and time to arduino 66 | myPort.write(timeStr); 67 | myPort.write('\n'); 68 | } 69 | 70 | long getTimeNow(){ 71 | // java time is in ms, we want secs 72 | Date d = new Date(); 73 | Calendar cal = new GregorianCalendar(); 74 | long current = d.getTime()/1000; 75 | long timezone = cal.get(cal.ZONE_OFFSET)/1000; 76 | long daylight = cal.get(cal.DST_OFFSET)/1000; 77 | return current + timezone + daylight; 78 | } 79 | -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/Time/examples/Processing/SyncArduinoClock/readme.txt: -------------------------------------------------------------------------------- 1 | SyncArduinoClock is a Processing sketch that responds to Arduino requests for 2 | time synchronization messages. 3 | 4 | The portIndex must be set the Serial port connected to Arduino. 5 | 6 | Download TimeSerial.pde onto Arduino and you should see the time 7 | message displayed when you run SyncArduinoClock in Processing. 8 | The Arduino time is set from the time on your computer through the 9 | Processing sketch. 10 | -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/Time/examples/TimeArduinoDue/TimeArduinoDue.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * TimeRTC.pde 3 | * example code illustrating Time library with Real Time Clock. 4 | * 5 | * This example requires Markus Lange's Arduino Due RTC Library 6 | * https://github.com/MarkusLange/Arduino-Due-RTC-Library 7 | */ 8 | 9 | #include 10 | #include 11 | 12 | // Select the Slowclock source 13 | //RTC_clock rtc_clock(RC); 14 | RTC_clock rtc_clock(XTAL); 15 | 16 | void setup() { 17 | Serial.begin(9600); 18 | rtc_clock.init(); 19 | if (rtc_clock.date_already_set() == 0) { 20 | // Unfortunately, the Arduino Due hardware does not seem to 21 | // be designed to maintain the RTC clock state when the 22 | // board resets. Markus described it thusly: "Uhh the Due 23 | // does reset with the NRSTB pin. This resets the full chip 24 | // with all backup regions including RTC, RTT and SC. Only 25 | // if the reset is done with the NRST pin will these regions 26 | // stay with their old values." 27 | rtc_clock.set_time(__TIME__); 28 | rtc_clock.set_date(__DATE__); 29 | // However, this might work on other unofficial SAM3X boards 30 | // with different reset circuitry than Arduino Due? 31 | } 32 | setSyncProvider(getArduinoDueTime); 33 | if(timeStatus()!= timeSet) 34 | Serial.println("Unable to sync with the RTC"); 35 | else 36 | Serial.println("RTC has set the system time"); 37 | } 38 | 39 | time_t getArduinoDueTime() 40 | { 41 | return rtc_clock.unixtime(); 42 | } 43 | 44 | void loop() 45 | { 46 | digitalClockDisplay(); 47 | delay(1000); 48 | } 49 | 50 | void digitalClockDisplay(){ 51 | // digital clock display of the time 52 | Serial.print(hour()); 53 | printDigits(minute()); 54 | printDigits(second()); 55 | Serial.print(" "); 56 | Serial.print(day()); 57 | Serial.print(" "); 58 | Serial.print(month()); 59 | Serial.print(" "); 60 | Serial.print(year()); 61 | Serial.println(); 62 | } 63 | 64 | void printDigits(int digits){ 65 | // utility function for digital clock display: prints preceding colon and leading 0 66 | Serial.print(":"); 67 | if(digits < 10) 68 | Serial.print('0'); 69 | Serial.print(digits); 70 | } 71 | 72 | -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/Time/examples/TimeGPS/TimeGPS.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * TimeGPS.pde 3 | * example code illustrating time synced from a GPS 4 | * 5 | */ 6 | 7 | #include 8 | #include // http://arduiniana.org/libraries/TinyGPS/ 9 | #include 10 | // TinyGPS and SoftwareSerial libraries are the work of Mikal Hart 11 | 12 | SoftwareSerial SerialGPS = SoftwareSerial(10, 11); // receive on pin 10 13 | TinyGPS gps; 14 | 15 | // To use a hardware serial port, which is far more efficient than 16 | // SoftwareSerial, uncomment this line and remove SoftwareSerial 17 | //#define SerialGPS Serial1 18 | 19 | // Offset hours from gps time (UTC) 20 | const int offset = 1; // Central European Time 21 | //const int offset = -5; // Eastern Standard Time (USA) 22 | //const int offset = -4; // Eastern Daylight Time (USA) 23 | //const int offset = -8; // Pacific Standard Time (USA) 24 | //const int offset = -7; // Pacific Daylight Time (USA) 25 | 26 | // Ideally, it should be possible to learn the time zone 27 | // based on the GPS position data. However, that would 28 | // require a complex library, probably incorporating some 29 | // sort of database using Eric Muller's time zone shape 30 | // maps, at http://efele.net/maps/tz/ 31 | 32 | time_t prevDisplay = 0; // when the digital clock was displayed 33 | 34 | void setup() 35 | { 36 | Serial.begin(9600); 37 | while (!Serial) ; // Needed for Leonardo only 38 | SerialGPS.begin(4800); 39 | Serial.println("Waiting for GPS time ... "); 40 | } 41 | 42 | void loop() 43 | { 44 | while (SerialGPS.available()) { 45 | if (gps.encode(SerialGPS.read())) { // process gps messages 46 | // when TinyGPS reports new data... 47 | unsigned long age; 48 | int Year; 49 | byte Month, Day, Hour, Minute, Second; 50 | gps.crack_datetime(&Year, &Month, &Day, &Hour, &Minute, &Second, NULL, &age); 51 | if (age < 500) { 52 | // set the Time to the latest GPS reading 53 | setTime(Hour, Minute, Second, Day, Month, Year); 54 | adjustTime(offset * SECS_PER_HOUR); 55 | } 56 | } 57 | } 58 | if (timeStatus()!= timeNotSet) { 59 | if (now() != prevDisplay) { //update the display only if the time has changed 60 | prevDisplay = now(); 61 | digitalClockDisplay(); 62 | } 63 | } 64 | } 65 | 66 | void digitalClockDisplay(){ 67 | // digital clock display of the time 68 | Serial.print(hour()); 69 | printDigits(minute()); 70 | printDigits(second()); 71 | Serial.print(" "); 72 | Serial.print(day()); 73 | Serial.print(" "); 74 | Serial.print(month()); 75 | Serial.print(" "); 76 | Serial.print(year()); 77 | Serial.println(); 78 | } 79 | 80 | void printDigits(int digits) { 81 | // utility function for digital clock display: prints preceding colon and leading 0 82 | Serial.print(":"); 83 | if(digits < 10) 84 | Serial.print('0'); 85 | Serial.print(digits); 86 | } 87 | 88 | -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/Time/examples/TimeRTC/TimeRTC.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * TimeRTC.pde 3 | * example code illustrating Time library with Real Time Clock. 4 | * 5 | */ 6 | 7 | #include 8 | #include 9 | #include // a basic DS1307 library that returns time as a time_t 10 | 11 | void setup() { 12 | Serial.begin(9600); 13 | while (!Serial) ; // wait until Arduino Serial Monitor opens 14 | setSyncProvider(RTC.get); // the function to get the time from the RTC 15 | if(timeStatus()!= timeSet) 16 | Serial.println("Unable to sync with the RTC"); 17 | else 18 | Serial.println("RTC has set the system time"); 19 | } 20 | 21 | void loop() 22 | { 23 | if (timeStatus() == timeSet) { 24 | digitalClockDisplay(); 25 | } else { 26 | Serial.println("The time has not been set. Please run the Time"); 27 | Serial.println("TimeRTCSet example, or DS1307RTC SetTime example."); 28 | Serial.println(); 29 | delay(4000); 30 | } 31 | delay(1000); 32 | } 33 | 34 | void digitalClockDisplay(){ 35 | // digital clock display of the time 36 | Serial.print(hour()); 37 | printDigits(minute()); 38 | printDigits(second()); 39 | Serial.print(" "); 40 | Serial.print(day()); 41 | Serial.print(" "); 42 | Serial.print(month()); 43 | Serial.print(" "); 44 | Serial.print(year()); 45 | Serial.println(); 46 | } 47 | 48 | void printDigits(int digits){ 49 | // utility function for digital clock display: prints preceding colon and leading 0 50 | Serial.print(":"); 51 | if(digits < 10) 52 | Serial.print('0'); 53 | Serial.print(digits); 54 | } 55 | 56 | -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/Time/examples/TimeRTCLog/TimeRTCLog.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * TimeRTCLogger.pde 3 | * example code illustrating adding and subtracting Time. 4 | * 5 | * this sketch logs pin state change events 6 | * the time of the event and time since the previous event is calculated and sent to the serial port. 7 | */ 8 | 9 | #include 10 | #include 11 | #include // a basic DS1307 library that returns time as a time_t 12 | 13 | const int nbrInputPins = 6; // monitor 6 digital pins 14 | const int inputPins[nbrInputPins] = {2,3,4,5,6,7}; // pins to monitor 15 | boolean state[nbrInputPins] ; // the state of the monitored pins 16 | time_t prevEventTime[nbrInputPins] ; // the time of the previous event 17 | 18 | void setup() { 19 | Serial.begin(9600); 20 | setSyncProvider(RTC.get); // the function to sync the time from the RTC 21 | for(int i=0; i < nbrInputPins; i++){ 22 | pinMode( inputPins[i], INPUT); 23 | // uncomment these lines if pull-up resistors are wanted 24 | // pinMode( inputPins[i], INPUT_PULLUP); 25 | // state[i] = HIGH; 26 | } 27 | } 28 | 29 | void loop() 30 | { 31 | for(int i=0; i < nbrInputPins; i++) 32 | { 33 | boolean val = digitalRead(inputPins[i]); 34 | if(val != state[i]) 35 | { 36 | time_t duration = 0; // the time since the previous event 37 | state[i] = val; 38 | time_t timeNow = now(); 39 | if(prevEventTime[i] > 0) 40 | // if this was not the first state change, calculate the time from the previous change 41 | duration = duration = timeNow - prevEventTime[i]; 42 | logEvent(inputPins[i], val, timeNow, duration ); // log the event 43 | prevEventTime[i] = timeNow; // store the time for this event 44 | } 45 | } 46 | } 47 | 48 | void logEvent( int pin, boolean state, time_t timeNow, time_t duration) 49 | { 50 | Serial.print("Pin "); 51 | Serial.print(pin); 52 | if( state == HIGH) 53 | Serial.print(" went High at "); 54 | else 55 | Serial.print(" went Low at "); 56 | showTime(timeNow); 57 | if(duration > 0){ 58 | // only display duration if greater than 0 59 | Serial.print(", Duration was "); 60 | showDuration(duration); 61 | } 62 | Serial.println(); 63 | } 64 | 65 | 66 | void showTime(time_t t){ 67 | // display the given time 68 | Serial.print(hour(t)); 69 | printDigits(minute(t)); 70 | printDigits(second(t)); 71 | Serial.print(" "); 72 | Serial.print(day(t)); 73 | Serial.print(" "); 74 | Serial.print(month(t)); 75 | Serial.print(" "); 76 | Serial.print(year(t)); 77 | } 78 | 79 | void printDigits(int digits){ 80 | // utility function for digital clock display: prints preceding colon and leading 0 81 | Serial.print(":"); 82 | if(digits < 10) 83 | Serial.print('0'); 84 | Serial.print(digits); 85 | } 86 | 87 | void showDuration(time_t duration){ 88 | // prints the duration in days, hours, minutes and seconds 89 | if(duration >= SECS_PER_DAY){ 90 | Serial.print(duration / SECS_PER_DAY); 91 | Serial.print(" day(s) "); 92 | duration = duration % SECS_PER_DAY; 93 | } 94 | if(duration >= SECS_PER_HOUR){ 95 | Serial.print(duration / SECS_PER_HOUR); 96 | Serial.print(" hour(s) "); 97 | duration = duration % SECS_PER_HOUR; 98 | } 99 | if(duration >= SECS_PER_MIN){ 100 | Serial.print(duration / SECS_PER_MIN); 101 | Serial.print(" minute(s) "); 102 | duration = duration % SECS_PER_MIN; 103 | } 104 | Serial.print(duration); 105 | Serial.print(" second(s) "); 106 | } 107 | 108 | -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/Time/examples/TimeRTCSet/TimeRTCSet.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * TimeRTCSet.pde 3 | * example code illustrating Time library with Real Time Clock. 4 | * 5 | * RTC clock is set in response to serial port time message 6 | * A Processing example sketch to set the time is included in the download 7 | * On Linux, you can use "date +T%s > /dev/ttyACM0" (UTC time zone) 8 | */ 9 | 10 | #include 11 | #include 12 | #include // a basic DS1307 library that returns time as a time_t 13 | 14 | 15 | void setup() { 16 | Serial.begin(9600); 17 | while (!Serial) ; // Needed for Leonardo only 18 | setSyncProvider(RTC.get); // the function to get the time from the RTC 19 | if (timeStatus() != timeSet) 20 | Serial.println("Unable to sync with the RTC"); 21 | else 22 | Serial.println("RTC has set the system time"); 23 | } 24 | 25 | void loop() 26 | { 27 | if (Serial.available()) { 28 | time_t t = processSyncMessage(); 29 | if (t != 0) { 30 | RTC.set(t); // set the RTC and the system time to the received value 31 | setTime(t); 32 | } 33 | } 34 | digitalClockDisplay(); 35 | delay(1000); 36 | } 37 | 38 | void digitalClockDisplay(){ 39 | // digital clock display of the time 40 | Serial.print(hour()); 41 | printDigits(minute()); 42 | printDigits(second()); 43 | Serial.print(" "); 44 | Serial.print(day()); 45 | Serial.print(" "); 46 | Serial.print(month()); 47 | Serial.print(" "); 48 | Serial.print(year()); 49 | Serial.println(); 50 | } 51 | 52 | void printDigits(int digits){ 53 | // utility function for digital clock display: prints preceding colon and leading 0 54 | Serial.print(":"); 55 | if(digits < 10) 56 | Serial.print('0'); 57 | Serial.print(digits); 58 | } 59 | 60 | /* code to process time sync messages from the serial port */ 61 | #define TIME_HEADER "T" // Header tag for serial time sync message 62 | 63 | unsigned long processSyncMessage() { 64 | unsigned long pctime = 0L; 65 | const unsigned long DEFAULT_TIME = 1357041600; // Jan 1 2013 66 | 67 | if(Serial.find(TIME_HEADER)) { 68 | pctime = Serial.parseInt(); 69 | return pctime; 70 | if( pctime < DEFAULT_TIME) { // check the value is a valid time (greater than Jan 1 2013) 71 | pctime = 0L; // return 0 to indicate that the time is not valid 72 | } 73 | } 74 | return pctime; 75 | } 76 | 77 | 78 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/Time/examples/TimeSerial/TimeSerial.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * TimeSerial.pde 3 | * example code illustrating Time library set through serial port messages. 4 | * 5 | * Messages consist of the letter T followed by ten digit time (as seconds since Jan 1 1970) 6 | * you can send the text on the next line using Serial Monitor to set the clock to noon Jan 1 2013 7 | T1357041600 8 | * 9 | * A Processing example sketch to automatically send the messages is included in the download 10 | * On Linux, you can use "date +T%s\n > /dev/ttyACM0" (UTC time zone) 11 | */ 12 | 13 | #include 14 | 15 | #define TIME_HEADER "T" // Header tag for serial time sync message 16 | #define TIME_REQUEST 7 // ASCII bell character requests a time sync message 17 | 18 | void setup() { 19 | Serial.begin(9600); 20 | while (!Serial) ; // Needed for Leonardo only 21 | pinMode(13, OUTPUT); 22 | setSyncProvider( requestSync); //set function to call when sync required 23 | Serial.println("Waiting for sync message"); 24 | } 25 | 26 | void loop(){ 27 | if (Serial.available()) { 28 | processSyncMessage(); 29 | } 30 | if (timeStatus()!= timeNotSet) { 31 | digitalClockDisplay(); 32 | } 33 | if (timeStatus() == timeSet) { 34 | digitalWrite(13, HIGH); // LED on if synced 35 | } else { 36 | digitalWrite(13, LOW); // LED off if needs refresh 37 | } 38 | delay(1000); 39 | } 40 | 41 | void digitalClockDisplay(){ 42 | // digital clock display of the time 43 | Serial.print(hour()); 44 | printDigits(minute()); 45 | printDigits(second()); 46 | Serial.print(" "); 47 | Serial.print(day()); 48 | Serial.print(" "); 49 | Serial.print(month()); 50 | Serial.print(" "); 51 | Serial.print(year()); 52 | Serial.println(); 53 | } 54 | 55 | void printDigits(int digits){ 56 | // utility function for digital clock display: prints preceding colon and leading 0 57 | Serial.print(":"); 58 | if(digits < 10) 59 | Serial.print('0'); 60 | Serial.print(digits); 61 | } 62 | 63 | 64 | void processSyncMessage() { 65 | unsigned long pctime; 66 | const unsigned long DEFAULT_TIME = 1357041600; // Jan 1 2013 67 | 68 | if(Serial.find(TIME_HEADER)) { 69 | pctime = Serial.parseInt(); 70 | if( pctime >= DEFAULT_TIME) { // check the integer is a valid time (greater than Jan 1 2013) 71 | setTime(pctime); // Sync Arduino clock to the time received on the serial port 72 | } 73 | } 74 | } 75 | 76 | time_t requestSync() 77 | { 78 | Serial.write(TIME_REQUEST); 79 | return 0; // the time will be sent later in response to serial mesg 80 | } 81 | 82 | -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/Time/examples/TimeSerialDateStrings/TimeSerialDateStrings.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * TimeSerialDateStrings.pde 3 | * example code illustrating Time library date strings 4 | * 5 | * This sketch adds date string functionality to TimeSerial sketch 6 | * Also shows how to handle different messages 7 | * 8 | * A message starting with a time header sets the time 9 | * A Processing example sketch to automatically send the messages is inclided in the download 10 | * On Linux, you can use "date +T%s\n > /dev/ttyACM0" (UTC time zone) 11 | * 12 | * A message starting with a format header sets the date format 13 | 14 | * send: Fs\n for short date format 15 | * send: Fl\n for long date format 16 | */ 17 | 18 | #include 19 | 20 | // single character message tags 21 | #define TIME_HEADER 'T' // Header tag for serial time sync message 22 | #define FORMAT_HEADER 'F' // Header tag indicating a date format message 23 | #define FORMAT_SHORT 's' // short month and day strings 24 | #define FORMAT_LONG 'l' // (lower case l) long month and day strings 25 | 26 | #define TIME_REQUEST 7 // ASCII bell character requests a time sync message 27 | 28 | static boolean isLongFormat = true; 29 | 30 | void setup() { 31 | Serial.begin(9600); 32 | while (!Serial) ; // Needed for Leonardo only 33 | setSyncProvider( requestSync); //set function to call when sync required 34 | Serial.println("Waiting for sync message"); 35 | } 36 | 37 | void loop(){ 38 | if (Serial.available() > 1) { // wait for at least two characters 39 | char c = Serial.read(); 40 | if( c == TIME_HEADER) { 41 | processSyncMessage(); 42 | } 43 | else if( c== FORMAT_HEADER) { 44 | processFormatMessage(); 45 | } 46 | } 47 | if (timeStatus()!= timeNotSet) { 48 | digitalClockDisplay(); 49 | } 50 | delay(1000); 51 | } 52 | 53 | void digitalClockDisplay() { 54 | // digital clock display of the time 55 | Serial.print(hour()); 56 | printDigits(minute()); 57 | printDigits(second()); 58 | Serial.print(" "); 59 | if(isLongFormat) 60 | Serial.print(dayStr(weekday())); 61 | else 62 | Serial.print(dayShortStr(weekday())); 63 | Serial.print(" "); 64 | Serial.print(day()); 65 | Serial.print(" "); 66 | if(isLongFormat) 67 | Serial.print(monthStr(month())); 68 | else 69 | Serial.print(monthShortStr(month())); 70 | Serial.print(" "); 71 | Serial.print(year()); 72 | Serial.println(); 73 | } 74 | 75 | void printDigits(int digits) { 76 | // utility function for digital clock display: prints preceding colon and leading 0 77 | Serial.print(":"); 78 | if(digits < 10) 79 | Serial.print('0'); 80 | Serial.print(digits); 81 | } 82 | 83 | void processFormatMessage() { 84 | char c = Serial.read(); 85 | if( c == FORMAT_LONG){ 86 | isLongFormat = true; 87 | Serial.println(F("Setting long format")); 88 | } 89 | else if( c == FORMAT_SHORT) { 90 | isLongFormat = false; 91 | Serial.println(F("Setting short format")); 92 | } 93 | } 94 | 95 | void processSyncMessage() { 96 | unsigned long pctime; 97 | const unsigned long DEFAULT_TIME = 1357041600; // Jan 1 2013 - paul, perhaps we define in time.h? 98 | 99 | pctime = Serial.parseInt(); 100 | if( pctime >= DEFAULT_TIME) { // check the integer is a valid time (greater than Jan 1 2013) 101 | setTime(pctime); // Sync Arduino clock to the time received on the serial port 102 | } 103 | } 104 | 105 | time_t requestSync() { 106 | Serial.write(TIME_REQUEST); 107 | return 0; // the time will be sent later in response to serial mesg 108 | } 109 | -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/Time/examples/TimeTeensy3/TimeTeensy3.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * TimeRTC.pde 3 | * example code illustrating Time library with Real Time Clock. 4 | * 5 | */ 6 | 7 | #include 8 | 9 | void setup() { 10 | // set the Time library to use Teensy 3.0's RTC to keep time 11 | setSyncProvider(getTeensy3Time); 12 | 13 | Serial.begin(115200); 14 | while (!Serial); // Wait for Arduino Serial Monitor to open 15 | delay(100); 16 | if (timeStatus()!= timeSet) { 17 | Serial.println("Unable to sync with the RTC"); 18 | } else { 19 | Serial.println("RTC has set the system time"); 20 | } 21 | } 22 | 23 | void loop() { 24 | if (Serial.available()) { 25 | time_t t = processSyncMessage(); 26 | if (t != 0) { 27 | Teensy3Clock.set(t); // set the RTC 28 | setTime(t); 29 | } 30 | } 31 | digitalClockDisplay(); 32 | delay(1000); 33 | } 34 | 35 | void digitalClockDisplay() { 36 | // digital clock display of the time 37 | Serial.print(hour()); 38 | printDigits(minute()); 39 | printDigits(second()); 40 | Serial.print(" "); 41 | Serial.print(day()); 42 | Serial.print(" "); 43 | Serial.print(month()); 44 | Serial.print(" "); 45 | Serial.print(year()); 46 | Serial.println(); 47 | } 48 | 49 | time_t getTeensy3Time() 50 | { 51 | return Teensy3Clock.get(); 52 | } 53 | 54 | /* code to process time sync messages from the serial port */ 55 | #define TIME_HEADER "T" // Header tag for serial time sync message 56 | 57 | unsigned long processSyncMessage() { 58 | unsigned long pctime = 0L; 59 | const unsigned long DEFAULT_TIME = 1357041600; // Jan 1 2013 60 | 61 | if(Serial.find(TIME_HEADER)) { 62 | pctime = Serial.parseInt(); 63 | return pctime; 64 | if( pctime < DEFAULT_TIME) { // check the value is a valid time (greater than Jan 1 2013) 65 | pctime = 0L; // return 0 to indicate that the time is not valid 66 | } 67 | } 68 | return pctime; 69 | } 70 | 71 | void printDigits(int digits){ 72 | // utility function for digital clock display: prints preceding colon and leading 0 73 | Serial.print(":"); 74 | if(digits < 10) 75 | Serial.print('0'); 76 | Serial.print(digits); 77 | } 78 | 79 | -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/Time/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For Time 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | time_t KEYWORD1 9 | ####################################### 10 | # Methods and Functions (KEYWORD2) 11 | ####################################### 12 | now KEYWORD2 13 | second KEYWORD2 14 | minute KEYWORD2 15 | hour KEYWORD2 16 | day KEYWORD2 17 | month KEYWORD2 18 | year KEYWORD2 19 | isAM KEYWORD2 20 | isPM KEYWORD2 21 | weekday KEYWORD2 22 | setTime KEYWORD2 23 | adjustTime KEYWORD2 24 | setSyncProvider KEYWORD2 25 | setSyncInterval KEYWORD2 26 | timeStatus KEYWORD2 27 | TimeLib KEYWORD2 28 | ####################################### 29 | # Instances (KEYWORD2) 30 | ####################################### 31 | 32 | ####################################### 33 | # Constants (LITERAL1) 34 | ####################################### 35 | -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/Time/library.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Time", 3 | "description": "Time keeping library", 4 | "keywords": "Time, date, hour, minute, second, day, week, month, year, RTC", 5 | "authors": [ 6 | { 7 | "name": "Michael Margolis" 8 | }, 9 | { 10 | "name": "Paul Stoffregen", 11 | "email": "paul@pjrc.com", 12 | "url": "http://www.pjrc.com", 13 | "maintainer": true 14 | } 15 | ], 16 | "repository": { 17 | "type": "git", 18 | "url": "https://github.com/PaulStoffregen/Time" 19 | }, 20 | "version": "1.5", 21 | "homepage": "http://playground.arduino.cc/Code/Time", 22 | "frameworks": "Arduino", 23 | "examples": [ 24 | "examples/*/*.ino" 25 | ] 26 | } 27 | -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/Time/library.properties: -------------------------------------------------------------------------------- 1 | name=Time 2 | version=1.5 3 | author=Michael Margolis 4 | maintainer=Paul Stoffregen 5 | sentence=Timekeeping functionality for Arduino 6 | paragraph=Date and Time functions, with provisions to synchronize to external time sources like GPS and NTP (Internet). This library is often used together with TimeAlarms and DS1307RTC. 7 | category=Timing 8 | url=http://playground.arduino.cc/code/time 9 | architectures=* 10 | 11 | -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/WebServer/examples/FSBrowser/data/edit.htm.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asjdf/ESP32CAMmotion_detection/9e519fb6e63d87f2582c1cf37461fde63cc942e2/References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/WebServer/examples/FSBrowser/data/edit.htm.gz -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/WebServer/examples/FSBrowser/data/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asjdf/ESP32CAMmotion_detection/9e519fb6e63d87f2582c1cf37461fde63cc942e2/References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/WebServer/examples/FSBrowser/data/favicon.ico -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/WebServer/examples/FSBrowser/data/graphs.js.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asjdf/ESP32CAMmotion_detection/9e519fb6e63d87f2582c1cf37461fde63cc942e2/References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/WebServer/examples/FSBrowser/data/graphs.js.gz -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/WebServer/examples/FSBrowser/data/index.htm: -------------------------------------------------------------------------------- 1 | 18 | 19 | 20 | 21 | 22 | ESP Monitor 23 | 24 | 85 | 86 | 87 |
88 | 89 | 90 | 91 | 92 |
93 |
94 |
95 |
96 | 97 | -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/WebServer/examples/HelloServer/HelloServer.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | const char* ssid = "........"; 7 | const char* password = "........"; 8 | 9 | WebServer server(80); 10 | 11 | const int led = 13; 12 | 13 | void handleRoot() { 14 | digitalWrite(led, 1); 15 | server.send(200, "text/plain", "hello from esp8266!"); 16 | digitalWrite(led, 0); 17 | } 18 | 19 | void handleNotFound() { 20 | digitalWrite(led, 1); 21 | String message = "File Not Found\n\n"; 22 | message += "URI: "; 23 | message += server.uri(); 24 | message += "\nMethod: "; 25 | message += (server.method() == HTTP_GET) ? "GET" : "POST"; 26 | message += "\nArguments: "; 27 | message += server.args(); 28 | message += "\n"; 29 | for (uint8_t i = 0; i < server.args(); i++) { 30 | message += " " + server.argName(i) + ": " + server.arg(i) + "\n"; 31 | } 32 | server.send(404, "text/plain", message); 33 | digitalWrite(led, 0); 34 | } 35 | 36 | void setup(void) { 37 | pinMode(led, OUTPUT); 38 | digitalWrite(led, 0); 39 | Serial.begin(115200); 40 | WiFi.mode(WIFI_STA); 41 | WiFi.begin(ssid, password); 42 | Serial.println(""); 43 | 44 | // Wait for connection 45 | while (WiFi.status() != WL_CONNECTED) { 46 | delay(500); 47 | Serial.print("."); 48 | } 49 | Serial.println(""); 50 | Serial.print("Connected to "); 51 | Serial.println(ssid); 52 | Serial.print("IP address: "); 53 | Serial.println(WiFi.localIP()); 54 | 55 | if (MDNS.begin("esp32")) { 56 | Serial.println("MDNS responder started"); 57 | } 58 | 59 | server.on("/", handleRoot); 60 | 61 | server.on("/inline", []() { 62 | server.send(200, "text/plain", "this works as well"); 63 | }); 64 | 65 | server.onNotFound(handleNotFound); 66 | 67 | server.begin(); 68 | Serial.println("HTTP server started"); 69 | } 70 | 71 | void loop(void) { 72 | server.handleClient(); 73 | } 74 | -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/WebServer/examples/HttpAdvancedAuth/HttpAdvancedAuth.ino: -------------------------------------------------------------------------------- 1 | /* 2 | HTTP Advanced Authentication example 3 | Created Mar 16, 2017 by Ahmed El-Sharnoby. 4 | This example code is in the public domain. 5 | */ 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | const char* ssid = "........"; 13 | const char* password = "........"; 14 | 15 | WebServer server(80); 16 | 17 | const char* www_username = "admin"; 18 | const char* www_password = "esp32"; 19 | // allows you to set the realm of authentication Default:"Login Required" 20 | const char* www_realm = "Custom Auth Realm"; 21 | // the Content of the HTML response in case of Unautherized Access Default:empty 22 | String authFailResponse = "Authentication Failed"; 23 | 24 | void setup() { 25 | Serial.begin(115200); 26 | WiFi.mode(WIFI_STA); 27 | WiFi.begin(ssid, password); 28 | if (WiFi.waitForConnectResult() != WL_CONNECTED) { 29 | Serial.println("WiFi Connect Failed! Rebooting..."); 30 | delay(1000); 31 | ESP.restart(); 32 | } 33 | ArduinoOTA.begin(); 34 | 35 | server.on("/", []() { 36 | if (!server.authenticate(www_username, www_password)) 37 | //Basic Auth Method with Custom realm and Failure Response 38 | //return server.requestAuthentication(BASIC_AUTH, www_realm, authFailResponse); 39 | //Digest Auth Method with realm="Login Required" and empty Failure Response 40 | //return server.requestAuthentication(DIGEST_AUTH); 41 | //Digest Auth Method with Custom realm and empty Failure Response 42 | //return server.requestAuthentication(DIGEST_AUTH, www_realm); 43 | //Digest Auth Method with Custom realm and Failure Response 44 | { 45 | return server.requestAuthentication(DIGEST_AUTH, www_realm, authFailResponse); 46 | } 47 | server.send(200, "text/plain", "Login OK"); 48 | }); 49 | server.begin(); 50 | 51 | Serial.print("Open http://"); 52 | Serial.print(WiFi.localIP()); 53 | Serial.println("/ in your browser to see it working"); 54 | } 55 | 56 | void loop() { 57 | ArduinoOTA.handle(); 58 | server.handleClient(); 59 | } 60 | -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/WebServer/examples/HttpBasicAuth/HttpBasicAuth.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | const char* ssid = "........"; 7 | const char* password = "........"; 8 | 9 | WebServer server(80); 10 | 11 | const char* www_username = "admin"; 12 | const char* www_password = "esp32"; 13 | 14 | void setup() { 15 | Serial.begin(115200); 16 | WiFi.mode(WIFI_STA); 17 | WiFi.begin(ssid, password); 18 | if (WiFi.waitForConnectResult() != WL_CONNECTED) { 19 | Serial.println("WiFi Connect Failed! Rebooting..."); 20 | delay(1000); 21 | ESP.restart(); 22 | } 23 | ArduinoOTA.begin(); 24 | 25 | server.on("/", []() { 26 | if (!server.authenticate(www_username, www_password)) { 27 | return server.requestAuthentication(); 28 | } 29 | server.send(200, "text/plain", "Login OK"); 30 | }); 31 | server.begin(); 32 | 33 | Serial.print("Open http://"); 34 | Serial.print(WiFi.localIP()); 35 | Serial.println("/ in your browser to see it working"); 36 | } 37 | 38 | void loop() { 39 | ArduinoOTA.handle(); 40 | server.handleClient(); 41 | } 42 | -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/WebServer/examples/PathArgServer/PathArgServer.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | const char *ssid = "........"; 7 | const char *password = "........"; 8 | 9 | WebServer server(80); 10 | 11 | void setup(void) { 12 | Serial.begin(9600); 13 | WiFi.mode(WIFI_STA); 14 | WiFi.begin(ssid, password); 15 | Serial.println(""); 16 | 17 | // Wait for connection 18 | while (WiFi.status() != WL_CONNECTED) { 19 | delay(500); 20 | Serial.print("."); 21 | } 22 | Serial.println(""); 23 | Serial.print("Connected to "); 24 | Serial.println(ssid); 25 | Serial.print("IP address: "); 26 | Serial.println(WiFi.localIP()); 27 | 28 | if (MDNS.begin("esp32")) { 29 | Serial.println("MDNS responder started"); 30 | } 31 | 32 | server.on("/", []() { 33 | server.send(200, "text/plain", "hello from esp32!"); 34 | }); 35 | 36 | server.on("/users/{}", []() { 37 | String user = server.pathArg(0); 38 | server.send(200, "text/plain", "User: '" + user + "'"); 39 | }); 40 | 41 | server.on("/users/{}/devices/{}", []() { 42 | String user = server.pathArg(0); 43 | String device = server.pathArg(1); 44 | server.send(200, "text/plain", "User: '" + user + "' and Device: '" + device + "'"); 45 | }); 46 | 47 | server.begin(); 48 | Serial.println("HTTP server started"); 49 | } 50 | 51 | void loop(void) { 52 | server.handleClient(); 53 | } 54 | -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/WebServer/examples/SDWebServer/SdRoot/index.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | ESP Index 6 | 12 | 17 | 18 | 19 |

ESP8266 Pin Functions

20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/WebServer/examples/SDWebServer/SdRoot/pins.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asjdf/ESP32CAMmotion_detection/9e519fb6e63d87f2582c1cf37461fde63cc942e2/References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/WebServer/examples/SDWebServer/SdRoot/pins.png -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/WebServer/examples/WebUpdate/WebUpdate.ino: -------------------------------------------------------------------------------- 1 | /* 2 | To upload through terminal you can use: curl -F "image=@firmware.bin" esp8266-webupdate.local/update 3 | */ 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | const char* host = "esp32-webupdate"; 12 | const char* ssid = "........"; 13 | const char* password = "........"; 14 | 15 | WebServer server(80); 16 | const char* serverIndex = "
"; 17 | 18 | void setup(void) { 19 | Serial.begin(115200); 20 | Serial.println(); 21 | Serial.println("Booting Sketch..."); 22 | WiFi.mode(WIFI_AP_STA); 23 | WiFi.begin(ssid, password); 24 | if (WiFi.waitForConnectResult() == WL_CONNECTED) { 25 | MDNS.begin(host); 26 | server.on("/", HTTP_GET, []() { 27 | server.sendHeader("Connection", "close"); 28 | server.send(200, "text/html", serverIndex); 29 | }); 30 | server.on("/update", HTTP_POST, []() { 31 | server.sendHeader("Connection", "close"); 32 | server.send(200, "text/plain", (Update.hasError()) ? "FAIL" : "OK"); 33 | ESP.restart(); 34 | }, []() { 35 | HTTPUpload& upload = server.upload(); 36 | if (upload.status == UPLOAD_FILE_START) { 37 | Serial.setDebugOutput(true); 38 | Serial.printf("Update: %s\n", upload.filename.c_str()); 39 | if (!Update.begin()) { //start with max available size 40 | Update.printError(Serial); 41 | } 42 | } else if (upload.status == UPLOAD_FILE_WRITE) { 43 | if (Update.write(upload.buf, upload.currentSize) != upload.currentSize) { 44 | Update.printError(Serial); 45 | } 46 | } else if (upload.status == UPLOAD_FILE_END) { 47 | if (Update.end(true)) { //true to set the size to the current progress 48 | Serial.printf("Update Success: %u\nRebooting...\n", upload.totalSize); 49 | } else { 50 | Update.printError(Serial); 51 | } 52 | Serial.setDebugOutput(false); 53 | } else { 54 | Serial.printf("Update Failed Unexpectedly (likely broken connection): status=%d\n", upload.status); 55 | } 56 | }); 57 | server.begin(); 58 | MDNS.addService("http", "tcp", 80); 59 | 60 | Serial.printf("Ready! Open http://%s.local in your browser\n", host); 61 | } else { 62 | Serial.println("WiFi Failed"); 63 | } 64 | } 65 | 66 | void loop(void) { 67 | server.handleClient(); 68 | delay(1); 69 | } 70 | -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/WebServer/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For Ultrasound 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | WebServer KEYWORD1 10 | WebServerSecure KEYWORD1 11 | HTTPMethod KEYWORD1 12 | 13 | ####################################### 14 | # Methods and Functions (KEYWORD2) 15 | ####################################### 16 | 17 | begin KEYWORD2 18 | handleClient KEYWORD2 19 | on KEYWORD2 20 | addHandler KEYWORD2 21 | uri KEYWORD2 22 | method KEYWORD2 23 | client KEYWORD2 24 | send KEYWORD2 25 | arg KEYWORD2 26 | argName KEYWORD2 27 | args KEYWORD2 28 | hasArg KEYWORD2 29 | onNotFound KEYWORD2 30 | 31 | ####################################### 32 | # Constants (LITERAL1) 33 | ####################################### 34 | 35 | HTTP_GET LITERAL1 36 | HTTP_POST LITERAL1 37 | HTTP_ANY LITERAL1 38 | CONTENT_LENGTH_UNKNOWN LITERAL1 39 | -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/WebServer/library.properties: -------------------------------------------------------------------------------- 1 | name=WebServer 2 | version=1.0 3 | author=Ivan Grokhotkov 4 | maintainer=Ivan Grokhtkov 5 | sentence=Simple web server library 6 | paragraph=The library supports HTTP GET and POST requests, provides argument parsing, handles one client at a time. 7 | category=Communication 8 | url= 9 | architectures=esp32 10 | -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/WebServer/src/HTTP_Method.h: -------------------------------------------------------------------------------- 1 | #ifndef _HTTP_Method_H_ 2 | #define _HTTP_Method_H_ 3 | 4 | typedef enum { 5 | HTTP_GET = 0b00000001, 6 | HTTP_POST = 0b00000010, 7 | HTTP_DELETE = 0b00000100, 8 | HTTP_PUT = 0b00001000, 9 | HTTP_PATCH = 0b00010000, 10 | HTTP_HEAD = 0b00100000, 11 | HTTP_OPTIONS = 0b01000000, 12 | HTTP_ANY = 0b01111111, 13 | } HTTPMethod; 14 | 15 | #endif /* _HTTP_Method_H_ */ 16 | -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/WebServer/src/detail/RequestHandler.h: -------------------------------------------------------------------------------- 1 | #ifndef REQUESTHANDLER_H 2 | #define REQUESTHANDLER_H 3 | 4 | #include 5 | #include 6 | 7 | class RequestHandler { 8 | public: 9 | virtual ~RequestHandler() { } 10 | virtual bool canHandle(HTTPMethod method, String uri) { (void) method; (void) uri; return false; } 11 | virtual bool canUpload(String uri) { (void) uri; return false; } 12 | virtual bool handle(WebServer& server, HTTPMethod requestMethod, String requestUri) { (void) server; (void) requestMethod; (void) requestUri; return false; } 13 | virtual void upload(WebServer& server, String requestUri, HTTPUpload& upload) { (void) server; (void) requestUri; (void) upload; } 14 | 15 | RequestHandler* next() { return _next; } 16 | void next(RequestHandler* r) { _next = r; } 17 | 18 | private: 19 | RequestHandler* _next = nullptr; 20 | 21 | protected: 22 | std::vector pathArgs; 23 | 24 | public: 25 | const String& pathArg(unsigned int i) { 26 | assert(i < pathArgs.size()); 27 | return pathArgs[i]; 28 | } 29 | }; 30 | 31 | #endif //REQUESTHANDLER_H 32 | -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/WebServer/src/detail/mimetable.cpp: -------------------------------------------------------------------------------- 1 | #include "mimetable.h" 2 | #include "pgmspace.h" 3 | 4 | namespace mime 5 | { 6 | 7 | // Table of extension->MIME strings stored in PROGMEM, needs to be global due to GCC section typing rules 8 | const Entry mimeTable[maxType] = 9 | { 10 | { ".html", "text/html" }, 11 | { ".htm", "text/html" }, 12 | { ".css", "text/css" }, 13 | { ".txt", "text/plain" }, 14 | { ".js", "application/javascript" }, 15 | { ".json", "application/json" }, 16 | { ".png", "image/png" }, 17 | { ".gif", "image/gif" }, 18 | { ".jpg", "image/jpeg" }, 19 | { ".ico", "image/x-icon" }, 20 | { ".svg", "image/svg+xml" }, 21 | { ".ttf", "application/x-font-ttf" }, 22 | { ".otf", "application/x-font-opentype" }, 23 | { ".woff", "application/font-woff" }, 24 | { ".woff2", "application/font-woff2" }, 25 | { ".eot", "application/vnd.ms-fontobject" }, 26 | { ".sfnt", "application/font-sfnt" }, 27 | { ".xml", "text/xml" }, 28 | { ".pdf", "application/pdf" }, 29 | { ".zip", "application/zip" }, 30 | { ".gz", "application/x-gzip" }, 31 | { ".appcache", "text/cache-manifest" }, 32 | { "", "application/octet-stream" } 33 | }; 34 | 35 | } 36 | -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/WebServer/src/detail/mimetable.h: -------------------------------------------------------------------------------- 1 | #ifndef __MIMETABLE_H__ 2 | #define __MIMETABLE_H__ 3 | 4 | 5 | namespace mime 6 | { 7 | 8 | enum type 9 | { 10 | html, 11 | htm, 12 | css, 13 | txt, 14 | js, 15 | json, 16 | png, 17 | gif, 18 | jpg, 19 | ico, 20 | svg, 21 | ttf, 22 | otf, 23 | woff, 24 | woff2, 25 | eot, 26 | sfnt, 27 | xml, 28 | pdf, 29 | zip, 30 | gz, 31 | appcache, 32 | none, 33 | maxType 34 | }; 35 | 36 | struct Entry 37 | { 38 | const char endsWith[16]; 39 | const char mimeType[32]; 40 | }; 41 | 42 | 43 | extern const Entry mimeTable[maxType]; 44 | } 45 | 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/esp32-camera-master/.gitignore: -------------------------------------------------------------------------------- 1 | *.DS_Store 2 | -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/esp32-camera-master/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(COMPONENT_SRCS 2 | driver/camera.c 3 | driver/sccb.c 4 | driver/sensor.c 5 | driver/twi.c 6 | driver/xclk.c 7 | sensors/ov2640.c 8 | sensors/ov3660.c 9 | sensors/ov7725.c 10 | conversions/yuv.c 11 | conversions/to_jpg.cpp 12 | conversions/to_bmp.c 13 | conversions/jpge.cpp 14 | conversions/esp_jpg_decode.c 15 | ) 16 | 17 | set(COMPONENT_ADD_INCLUDEDIRS 18 | driver/include 19 | conversions/include 20 | ) 21 | 22 | set(COMPONENT_PRIV_INCLUDEDIRS 23 | driver/private_include 24 | sensors/private_include 25 | conversions/private_include 26 | ) 27 | 28 | set(COMPONENT_REQUIRES driver) 29 | set(COMPONENT_PRIV_REQUIRES freertos nvs_flash) 30 | 31 | register_component() 32 | -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/esp32-camera-master/Kconfig: -------------------------------------------------------------------------------- 1 | menu "Camera configuration" 2 | 3 | config OV2640_SUPPORT 4 | bool "OV2640 Support" 5 | default y 6 | help 7 | Enable this option if you want to use the OV2640. 8 | Disable this option to safe memory. 9 | 10 | config OV7725_SUPPORT 11 | bool "OV7725 Support" 12 | default n 13 | help 14 | Enable this option if you want to use the OV7725. 15 | Disable this option to safe memory. 16 | 17 | config OV3660_SUPPORT 18 | bool "OV3660 Support" 19 | default y 20 | help 21 | Enable this option if you want to use the OV3360. 22 | Disable this option to safe memory. 23 | 24 | config SCCB_HARDWARE_I2C 25 | bool "Use hardware I2C1 for SCCB" 26 | default y 27 | help 28 | Enable this option if you want to use hardware I2C to control the camera. 29 | Disable this option to use software I2C. 30 | 31 | choice CAMERA_TASK_PINNED_TO_CORE 32 | bool "Camera task pinned to core" 33 | default CAMERA_CORE0 34 | help 35 | Pin the camera handle task to a certain core(0/1). It can also be done automatically choosing NO_AFFINITY. 36 | 37 | config CAMERA_CORE0 38 | bool "CORE0" 39 | config CAMERA_CORE1 40 | bool "CORE1" 41 | config CAMERA_NO_AFFINITY 42 | bool "NO_AFFINITY" 43 | 44 | endchoice 45 | 46 | endmenu 47 | -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/esp32-camera-master/component.mk: -------------------------------------------------------------------------------- 1 | COMPONENT_ADD_INCLUDEDIRS := driver/include conversions/include 2 | COMPONENT_PRIV_INCLUDEDIRS := driver/private_include conversions/private_include sensors/private_include 3 | COMPONENT_SRCDIRS := driver conversions sensors 4 | CXXFLAGS += -fno-rtti 5 | -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/esp32-camera-master/conversions/esp_jpg_decode.c: -------------------------------------------------------------------------------- 1 | // Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | #include "esp_jpg_decode.h" 15 | 16 | #include "esp_system.h" 17 | #ifdef ESP_IDF_VERSION_MAJOR // IDF 4+ 18 | #if CONFIG_IDF_TARGET_ESP32 // ESP32/PICO-D4 19 | #include "esp32/rom/tjpgd.h" 20 | #else 21 | #error Target CONFIG_IDF_TARGET is not supported 22 | #endif 23 | #else // ESP32 Before IDF 4.0 24 | #include "rom/tjpgd.h" 25 | #endif 26 | 27 | #if defined(ARDUINO_ARCH_ESP32) && defined(CONFIG_ARDUHAL_ESP_LOG) 28 | #include "esp32-hal-log.h" 29 | #define TAG "" 30 | #else 31 | #include "esp_log.h" 32 | static const char* TAG = "esp_jpg_decode"; 33 | #endif 34 | 35 | typedef struct { 36 | jpg_scale_t scale; 37 | jpg_reader_cb reader; 38 | jpg_writer_cb writer; 39 | void * arg; 40 | size_t len; 41 | size_t index; 42 | } esp_jpg_decoder_t; 43 | 44 | static const char * jd_errors[] = { 45 | "Succeeded", 46 | "Interrupted by output function", 47 | "Device error or wrong termination of input stream", 48 | "Insufficient memory pool for the image", 49 | "Insufficient stream input buffer", 50 | "Parameter error", 51 | "Data format error", 52 | "Right format but not supported", 53 | "Not supported JPEG standard" 54 | }; 55 | 56 | static uint32_t _jpg_write(JDEC *decoder, void *bitmap, JRECT *rect) 57 | { 58 | uint16_t x = rect->left; 59 | uint16_t y = rect->top; 60 | uint16_t w = rect->right + 1 - x; 61 | uint16_t h = rect->bottom + 1 - y; 62 | uint8_t *data = (uint8_t *)bitmap; 63 | 64 | esp_jpg_decoder_t * jpeg = (esp_jpg_decoder_t *)decoder->device; 65 | 66 | if (jpeg->writer) { 67 | return jpeg->writer(jpeg->arg, x, y, w, h, data); 68 | } 69 | return 0; 70 | } 71 | 72 | static uint32_t _jpg_read(JDEC *decoder, uint8_t *buf, uint32_t len) 73 | { 74 | esp_jpg_decoder_t * jpeg = (esp_jpg_decoder_t *)decoder->device; 75 | if (jpeg->len && len > (jpeg->len - jpeg->index)) { 76 | len = jpeg->len - jpeg->index; 77 | } 78 | if (len) { 79 | len = jpeg->reader(jpeg->arg, jpeg->index, buf, len); 80 | if (!len) { 81 | ESP_LOGE(TAG, "Read Fail at %u/%u", jpeg->index, jpeg->len); 82 | } 83 | jpeg->index += len; 84 | } 85 | return len; 86 | } 87 | 88 | esp_err_t esp_jpg_decode(size_t len, jpg_scale_t scale, jpg_reader_cb reader, jpg_writer_cb writer, void * arg) 89 | { 90 | static uint8_t work[3100]; 91 | JDEC decoder; 92 | esp_jpg_decoder_t jpeg; 93 | 94 | jpeg.len = len; 95 | jpeg.reader = reader; 96 | jpeg.writer = writer; 97 | jpeg.arg = arg; 98 | jpeg.scale = scale; 99 | jpeg.index = 0; 100 | 101 | JRESULT jres = jd_prepare(&decoder, _jpg_read, work, 3100, &jpeg); 102 | if(jres != JDR_OK){ 103 | ESP_LOGE(TAG, "JPG Header Parse Failed! %s", jd_errors[jres]); 104 | return ESP_FAIL; 105 | } 106 | 107 | uint16_t output_width = decoder.width / (1 << (uint8_t)(jpeg.scale)); 108 | uint16_t output_height = decoder.height / (1 << (uint8_t)(jpeg.scale)); 109 | 110 | //output start 111 | writer(arg, 0, 0, output_width, output_height, NULL); 112 | //output write 113 | jres = jd_decomp(&decoder, _jpg_write, (uint8_t)jpeg.scale); 114 | //output end 115 | writer(arg, output_width, output_height, output_width, output_height, NULL); 116 | 117 | if (jres != JDR_OK) { 118 | ESP_LOGE(TAG, "JPG Decompression Failed! %s", jd_errors[jres]); 119 | return ESP_FAIL; 120 | } 121 | //check if all data has been consumed. 122 | if (len && jpeg.index < len) { 123 | _jpg_read(&decoder, NULL, len - jpeg.index); 124 | } 125 | 126 | return ESP_OK; 127 | } 128 | 129 | -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/esp32-camera-master/conversions/include/esp_jpg_decode.h: -------------------------------------------------------------------------------- 1 | // Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | #ifndef _ESP_JPG_DECODE_H_ 15 | #define _ESP_JPG_DECODE_H_ 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | #include 22 | #include 23 | #include 24 | #include "esp_err.h" 25 | 26 | typedef enum { 27 | JPG_SCALE_NONE, 28 | JPG_SCALE_2X, 29 | JPG_SCALE_4X, 30 | JPG_SCALE_8X, 31 | JPG_SCALE_MAX = JPG_SCALE_8X 32 | } jpg_scale_t; 33 | 34 | typedef size_t (* jpg_reader_cb)(void * arg, size_t index, uint8_t *buf, size_t len); 35 | typedef bool (* jpg_writer_cb)(void * arg, uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint8_t *data); 36 | 37 | esp_err_t esp_jpg_decode(size_t len, jpg_scale_t scale, jpg_reader_cb reader, jpg_writer_cb writer, void * arg); 38 | 39 | #ifdef __cplusplus 40 | } 41 | #endif 42 | 43 | #endif /* _ESP_JPG_DECODE_H_ */ 44 | -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/esp32-camera-master/conversions/private_include/yuv.h: -------------------------------------------------------------------------------- 1 | // Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | #ifndef _CONVERSIONS_YUV_H_ 15 | #define _CONVERSIONS_YUV_H_ 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | #include 22 | 23 | void yuv2rgb(uint8_t y, uint8_t u, uint8_t v, uint8_t *r, uint8_t *g, uint8_t *b); 24 | 25 | #ifdef __cplusplus 26 | } 27 | #endif 28 | 29 | #endif /* _CONVERSIONS_YUV_H_ */ 30 | -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/esp32-camera-master/driver/private_include/camera_common.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include "esp_err.h" 7 | #include "esp_intr_alloc.h" 8 | #include "freertos/FreeRTOS.h" 9 | #include "freertos/semphr.h" 10 | #include "freertos/task.h" 11 | #include "esp_camera.h" 12 | #include "sensor.h" 13 | 14 | #include "esp_system.h" 15 | #ifdef ESP_IDF_VERSION_MAJOR // IDF 4+ 16 | #if CONFIG_IDF_TARGET_ESP32 // ESP32/PICO-D4 17 | #include "esp32/rom/lldesc.h" 18 | #else 19 | #error Target CONFIG_IDF_TARGET is not supported 20 | #endif 21 | #else // ESP32 Before IDF 4.0 22 | #include "rom/lldesc.h" 23 | #endif 24 | 25 | typedef union { 26 | struct { 27 | uint8_t sample2; 28 | uint8_t unused2; 29 | uint8_t sample1; 30 | uint8_t unused1; 31 | }; 32 | uint32_t val; 33 | } dma_elem_t; 34 | 35 | typedef enum { 36 | /* camera sends byte sequence: s1, s2, s3, s4, ... 37 | * fifo receives: 00 s1 00 s2, 00 s2 00 s3, 00 s3 00 s4, ... 38 | */ 39 | SM_0A0B_0B0C = 0, 40 | /* camera sends byte sequence: s1, s2, s3, s4, ... 41 | * fifo receives: 00 s1 00 s2, 00 s3 00 s4, ... 42 | */ 43 | SM_0A0B_0C0D = 1, 44 | /* camera sends byte sequence: s1, s2, s3, s4, ... 45 | * fifo receives: 00 s1 00 00, 00 s2 00 00, 00 s3 00 00, ... 46 | */ 47 | SM_0A00_0B00 = 3, 48 | } i2s_sampling_mode_t; 49 | 50 | -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/esp32-camera-master/driver/private_include/sccb.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the OpenMV project. 3 | * Copyright (c) 2013/2014 Ibrahim Abdelkader 4 | * This work is licensed under the MIT license, see the file LICENSE for details. 5 | * 6 | * SCCB (I2C like) driver. 7 | * 8 | */ 9 | #ifndef __SCCB_H__ 10 | #define __SCCB_H__ 11 | #include 12 | int SCCB_Init(int pin_sda, int pin_scl); 13 | uint8_t SCCB_Probe(); 14 | uint8_t SCCB_Read(uint8_t slv_addr, uint8_t reg); 15 | uint8_t SCCB_Write(uint8_t slv_addr, uint8_t reg, uint8_t data); 16 | uint8_t SCCB_Read16(uint8_t slv_addr, uint16_t reg); 17 | uint8_t SCCB_Write16(uint8_t slv_addr, uint16_t reg, uint8_t data); 18 | #endif // __SCCB_H__ 19 | -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/esp32-camera-master/driver/private_include/twi.h: -------------------------------------------------------------------------------- 1 | /* 2 | twi.h - Software I2C library for ESP31B 3 | 4 | Copyright (c) 2015 Hristo Gochkov. All rights reserved. 5 | This file is part of the ESP31B core for Arduino environment. 6 | 7 | This library is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU Lesser General Public 9 | License as published by the Free Software Foundation; either 10 | version 2.1 of the License, or (at your option) any later version. 11 | 12 | This library is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | Lesser General Public License for more details. 16 | 17 | You should have received a copy of the GNU Lesser General Public 18 | License along with this library; if not, write to the Free Software 19 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | #ifndef SI2C_h 22 | #define SI2C_h 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | void twi_init(unsigned char sda, unsigned char scl); 29 | void twi_stop(void); 30 | void twi_setClock(unsigned int freq); 31 | uint8_t twi_writeTo(unsigned char address, unsigned char * buf, unsigned int len, unsigned char sendStop); 32 | uint8_t twi_readFrom(unsigned char address, unsigned char * buf, unsigned int len, unsigned char sendStop); 33 | 34 | #ifdef __cplusplus 35 | } 36 | #endif 37 | 38 | #endif -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/esp32-camera-master/driver/private_include/xclk.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "camera_common.h" 4 | 5 | esp_err_t camera_enable_out_clock(); 6 | 7 | void camera_disable_out_clock(); 8 | -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/esp32-camera-master/driver/sensor.c: -------------------------------------------------------------------------------- 1 | 2 | const int resolution[][2] = { 3 | { 96, 96 }, /* 96x96 */ 4 | { 160, 120 }, /* QQVGA */ 5 | { 128, 160 }, /* QQVGA2*/ 6 | { 176, 144 }, /* QCIF */ 7 | { 240, 176 }, /* HQVGA */ 8 | { 240, 240 }, /* 240x240 */ 9 | { 320, 240 }, /* QVGA */ 10 | { 400, 296 }, /* CIF */ 11 | { 640, 480 }, /* VGA */ 12 | { 800, 600 }, /* SVGA */ 13 | { 1024, 768 }, /* XGA */ 14 | { 1280, 1024 }, /* SXGA */ 15 | { 1600, 1200 }, /* UXGA */ 16 | { 2048, 1536 }, /* QXGA */ 17 | }; 18 | -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/esp32-camera-master/driver/xclk.c: -------------------------------------------------------------------------------- 1 | #include "driver/gpio.h" 2 | #include "driver/ledc.h" 3 | #include "esp_err.h" 4 | #include "esp_log.h" 5 | #include "esp_system.h" 6 | #include "xclk.h" 7 | 8 | #if defined(ARDUINO_ARCH_ESP32) && defined(CONFIG_ARDUHAL_ESP_LOG) 9 | #include "esp32-hal-log.h" 10 | #else 11 | #include "esp_log.h" 12 | static const char* TAG = "camera_xclk"; 13 | #endif 14 | 15 | esp_err_t camera_enable_out_clock(camera_config_t* config) 16 | { 17 | periph_module_enable(PERIPH_LEDC_MODULE); 18 | 19 | ledc_timer_config_t timer_conf = {}; 20 | timer_conf.duty_resolution = 2; 21 | timer_conf.freq_hz = config->xclk_freq_hz; 22 | timer_conf.speed_mode = LEDC_HIGH_SPEED_MODE; 23 | timer_conf.timer_num = config->ledc_timer; 24 | #ifdef ESP_IDF_VERSION_MAJOR 25 | timer_conf.clk_cfg = LEDC_AUTO_CLK; 26 | #endif 27 | esp_err_t err = ledc_timer_config(&timer_conf); 28 | if (err != ESP_OK) { 29 | ESP_LOGE(TAG, "ledc_timer_config failed, rc=%x", err); 30 | return err; 31 | } 32 | 33 | ledc_channel_config_t ch_conf; 34 | ch_conf.gpio_num = config->pin_xclk; 35 | ch_conf.speed_mode = LEDC_HIGH_SPEED_MODE; 36 | ch_conf.channel = config->ledc_channel; 37 | ch_conf.intr_type = LEDC_INTR_DISABLE; 38 | ch_conf.timer_sel = config->ledc_timer; 39 | ch_conf.duty = 2; 40 | ch_conf.hpoint = 0; 41 | err = ledc_channel_config(&ch_conf); 42 | if (err != ESP_OK) { 43 | ESP_LOGE(TAG, "ledc_channel_config failed, rc=%x", err); 44 | return err; 45 | } 46 | return ESP_OK; 47 | } 48 | 49 | void camera_disable_out_clock() 50 | { 51 | periph_module_disable(PERIPH_LEDC_MODULE); 52 | } 53 | -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/esp32-camera-master/sensors/private_include/ov2640.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the OpenMV project. 3 | * Copyright (c) 2013/2014 Ibrahim Abdelkader 4 | * This work is licensed under the MIT license, see the file LICENSE for details. 5 | * 6 | * OV2640 driver. 7 | * 8 | */ 9 | #ifndef __OV2640_H__ 10 | #define __OV2640_H__ 11 | #include "sensor.h" 12 | int ov2640_init(sensor_t *sensor); 13 | #endif // __OV2640_H__ 14 | -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/esp32-camera-master/sensors/private_include/ov3660.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the OpenMV project. 3 | * Copyright (c) 2013/2014 Ibrahim Abdelkader 4 | * This work is licensed under the MIT license, see the file LICENSE for details. 5 | * 6 | * OV3660 driver. 7 | * 8 | */ 9 | #ifndef __OV3660_H__ 10 | #define __OV3660_H__ 11 | 12 | #include "sensor.h" 13 | 14 | int ov3660_init(sensor_t *sensor); 15 | 16 | #endif // __OV3660_H__ 17 | -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/Libraries used/Libraries used/esp32-camera-master/sensors/private_include/ov7725.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the OpenMV project. 3 | * Copyright (c) 2013/2014 Ibrahim Abdelkader 4 | * This work is licensed under the MIT license, see the file LICENSE for details. 5 | * 6 | * OV7725 driver. 7 | * 8 | */ 9 | #ifndef __OV7725_H__ 10 | #define __OV7725_H__ 11 | #include "sensor.h" 12 | 13 | int ov7725_init(sensor_t *sensor); 14 | #endif // __OV7725_H__ 15 | -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/screen capture 1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asjdf/ESP32CAMmotion_detection/9e519fb6e63d87f2582c1cf37461fde63cc942e2/References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/screen capture 1.png -------------------------------------------------------------------------------- /References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/screen capture 2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asjdf/ESP32CAMmotion_detection/9e519fb6e63d87f2582c1cf37461fde63cc942e2/References/[copy]CameraWifiMotion-master/CameraWifiMotion-master/screen capture 2.png -------------------------------------------------------------------------------- /References/[copy]ESP32-CAM-Video-Recorder-master.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asjdf/ESP32CAMmotion_detection/9e519fb6e63d87f2582c1cf37461fde63cc942e2/References/[copy]ESP32-CAM-Video-Recorder-master.zip -------------------------------------------------------------------------------- /References/[copy]ESP32-CAM_Motion-master.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asjdf/ESP32CAMmotion_detection/9e519fb6e63d87f2582c1cf37461fde63cc942e2/References/[copy]ESP32-CAM_Motion-master.zip -------------------------------------------------------------------------------- /References/[copy]ESP32-CAM_Motion-master/ESP32-CAM_Motion/ESP32-CAM_Motion.ino: -------------------------------------------------------------------------------- 1 | // Motion detection test - looks for diffs between camera images. 2 | 3 | #define CAMERA_MODEL_AI_THINKER 4 | 5 | #include "esp_camera.h" 6 | #include "camera_pins.h" 7 | 8 | #define THIS_FRAME FRAMESIZE_SVGA // JPEG frames size to be retrieved 9 | #define LAMP_PIN 4 10 | 11 | bool debug = true; 12 | uint8_t fsizePtr = THIS_FRAME; // framesize selection 13 | uint8_t lightLevel; // Current ambient light level 14 | uint8_t nightSwitch = 10; // white level % for night/day switching 15 | uint8_t motionVal = 7; // motion sensitivity difference setting 16 | bool haveMotion = false; 17 | 18 | struct frameStruct { 19 | const char* frameSizeStr; 20 | const uint16_t frameWidth; 21 | const uint16_t frameHeight; 22 | const uint16_t defaultFPS; 23 | const uint8_t scaleFactor; 24 | const uint8_t sampleRate; 25 | }; 26 | // sample factors, 5th arg is scaling factor (1..N), 6th arg is sample factor (0..3) 27 | // indexed by frame size - needs to be consistent with sensor.h enum 28 | extern const frameStruct frameData[] = { 29 | {"QQVGA", 160, 120, 25, 2, 1}, 30 | {"n/a", 0, 0, 0, 0, 1}, 31 | {"n/a", 0, 0, 0, 0, 1}, 32 | {"HQVGA", 240, 176, 25, 3, 1}, 33 | {"QVGA", 320, 240, 25, 3, 1}, 34 | {"CIF", 400, 296, 25, 3, 1}, 35 | {"VGA", 640, 480, 15, 3, 2}, 36 | {"SVGA", 800, 600, 10, 3, 2}, 37 | {"XGA", 1024, 768, 5, 3, 3}, 38 | {"SXGA", 1280, 1024, 3, 3, 4}, 39 | {"UXGA", 1600, 1200, 2, 6, 5} 40 | }; 41 | 42 | bool checkMotion(camera_fb_t* fb, bool motionStatus); 43 | bool isNight(uint8_t nightSwitch); 44 | 45 | void setup() { 46 | Serial.begin(115200); 47 | setup_camera(); 48 | } 49 | 50 | void loop() { 51 | camera_fb_t* fb = esp_camera_fb_get(); 52 | if (fb) { 53 | haveMotion = checkMotion(fb, haveMotion); 54 | Serial.println(haveMotion); 55 | controlLamp(isNight(nightSwitch)); // switch on lamp if dark 56 | esp_camera_fb_return(fb); 57 | } else Serial.println("Failed to get frame"); 58 | delay(100); 59 | } 60 | 61 | void controlLamp(bool lampVal) { 62 | pinMode(LAMP_PIN, OUTPUT); 63 | digitalWrite(LAMP_PIN, lampVal); 64 | Serial.printf("Turn lamp %s\n", lampVal ? "On" : "Off"); 65 | } 66 | 67 | void setup_camera() { 68 | camera_config_t config; 69 | config.ledc_channel = LEDC_CHANNEL_0; 70 | config.ledc_timer = LEDC_TIMER_0; 71 | config.pin_d0 = Y2_GPIO_NUM; 72 | config.pin_d1 = Y3_GPIO_NUM; 73 | config.pin_d2 = Y4_GPIO_NUM; 74 | config.pin_d3 = Y5_GPIO_NUM; 75 | config.pin_d4 = Y6_GPIO_NUM; 76 | config.pin_d5 = Y7_GPIO_NUM; 77 | config.pin_d6 = Y8_GPIO_NUM; 78 | config.pin_d7 = Y9_GPIO_NUM; 79 | config.pin_xclk = XCLK_GPIO_NUM; 80 | config.pin_pclk = PCLK_GPIO_NUM; 81 | config.pin_vsync = VSYNC_GPIO_NUM; 82 | config.pin_href = HREF_GPIO_NUM; 83 | config.pin_sscb_sda = SIOD_GPIO_NUM; 84 | config.pin_sscb_scl = SIOC_GPIO_NUM; 85 | config.pin_pwdn = PWDN_GPIO_NUM; 86 | config.pin_reset = RESET_GPIO_NUM; 87 | config.xclk_freq_hz = 10000000; 88 | config.pixel_format = PIXFORMAT_JPEG; 89 | config.frame_size = THIS_FRAME; 90 | config.jpeg_quality = 10; 91 | config.fb_count = 8; 92 | 93 | // camera init 94 | esp_err_t err = ESP_FAIL; 95 | uint8_t retries = 2; 96 | while (retries && err != ESP_OK) { 97 | err = esp_camera_init(&config); 98 | if (err != ESP_OK) { 99 | Serial.printf("Camera init failed with error 0x%x", err); 100 | digitalWrite(PWDN_GPIO_NUM, 1); 101 | delay(100); 102 | digitalWrite(PWDN_GPIO_NUM, 0); // power cycle the camera (OV2640) 103 | retries--; 104 | } 105 | } 106 | if (err != ESP_OK) ESP.restart(); 107 | } 108 | -------------------------------------------------------------------------------- /References/[copy]ESP32-CAM_Motion-master/ESP32-CAM_Motion/README.md: -------------------------------------------------------------------------------- 1 | # ESP32-CAM_Motion 2 | 3 | ESP32 Camera extension to allow the camera to detect movement using image centre of mass shift, whilst still retrieving large JPEG images. 4 | 5 | ## Purpose 6 | 7 | This allows the camera to detect movement eg for security camera purposes, without additional hardware such as a PIR. It also allows the light level to be determined by the camera eg to switch on the lamp, without additional hardware such as an LDR. 8 | 9 | Movement detection using image centre of mass shift is more effective than simply comparing bitmap changes as the latter is subject to spurious movement such as camera noise, particularly in low light, transient movements such as leaves rustling or rain, and illumination changes such as passing clouds. 10 | 11 | This extension can be used in conjunction with the [ESP32-CAM_MJPEG2SD](https://github.com/s60sc/ESP32-CAM_MJPEG2SD) repository for a more complete solution. 12 | 13 | ## Design 14 | 15 | JPEG images of any size are retrieved from the camera and 1 in N images are sampled on the fly for movement by decoding them to very small bitmap images from which the image centre of mass is calculated and compared to the previous sample. 16 | The table shows typical time taken to decode and analyse a frame retrieved from the OV2640 camera. 17 | 18 | Frame Size | Time in ms 19 | ------------ | ------------- 20 | QQVGA | 20 21 | HQVGA | 15 22 | QVGA | 30 23 | CIF | 40 24 | VGA | 70 25 | SVGA | 100 26 | XGA | 200 27 | SXGA | 300 28 | UXGA | 400 29 | 30 | QQVGA is slower because it uses a different scale factor. 31 | 32 | In the [ESP32-CAM_MJPEG2SD](https://github.com/s60sc/ESP32-CAM_MJPEG2SD) sketch, for movement detection a high sample rate of 1 in 2 is used. When movement has been detected, the rate for checking for movement stop is reduced to 1 in 10 so that the JPEGs can be captured with only a small overhead. 33 | 34 | ## Installation and Use 35 | 36 | Download the files into the Arduino IDE sketch location, removing `-master` from the folder name. The included Arduino sketch provides the basic functionality for testing and calibrating the extension using the OV2640 camera. 37 | 38 | The following monitoring parameters can be modified: 39 | * `#define MOTION_SEQUENCE 5` The number of sequential frame changes that constitute a valid movement 40 | * `#define NIGHT_SEQUENCE 100` The number of sequential dark frames that constitute night time 41 | 42 | The web page in [ESP32-CAM_MJPEG2SD](https://github.com/s60sc/ESP32-CAM_MJPEG2SD) includes additional options: 43 | * __Motion Sensitivity__ sets how much centre of mass shift is needed to constitute a movement. The faster that frames are received the higher the value should be for more sensitivity 44 | * __Night Switch__ sets the ambient light level that constitutes night time. __Ambient Light__ displays the current light level 45 | 46 | The file `mjpeg2sd.cpp` in [ESP32-CAM_MJPEG2SD](https://github.com/s60sc/ESP32-CAM_MJPEG2SD) has the parameter: 47 | * `#define POST_MOTION_TIME 2` which sets the number of seconds the recording continues after motion stop. 48 | 49 | -------------------------------------------------------------------------------- /References/[copy]ESP32-CAM_Motion-master/ESP32-CAM_Motion/camera_pins.h: -------------------------------------------------------------------------------- 1 | 2 | #if defined(CAMERA_MODEL_WROVER_KIT) 3 | #define PWDN_GPIO_NUM -1 4 | #define RESET_GPIO_NUM -1 5 | #define XCLK_GPIO_NUM 21 6 | #define SIOD_GPIO_NUM 26 7 | #define SIOC_GPIO_NUM 27 8 | 9 | #define Y9_GPIO_NUM 35 10 | #define Y8_GPIO_NUM 34 11 | #define Y7_GPIO_NUM 39 12 | #define Y6_GPIO_NUM 36 13 | #define Y5_GPIO_NUM 19 14 | #define Y4_GPIO_NUM 18 15 | #define Y3_GPIO_NUM 5 16 | #define Y2_GPIO_NUM 4 17 | #define VSYNC_GPIO_NUM 25 18 | #define HREF_GPIO_NUM 23 19 | #define PCLK_GPIO_NUM 22 20 | 21 | #elif defined(CAMERA_MODEL_ESP_EYE) 22 | #define PWDN_GPIO_NUM -1 23 | #define RESET_GPIO_NUM -1 24 | #define XCLK_GPIO_NUM 4 25 | #define SIOD_GPIO_NUM 18 26 | #define SIOC_GPIO_NUM 23 27 | 28 | #define Y9_GPIO_NUM 36 29 | #define Y8_GPIO_NUM 37 30 | #define Y7_GPIO_NUM 38 31 | #define Y6_GPIO_NUM 39 32 | #define Y5_GPIO_NUM 35 33 | #define Y4_GPIO_NUM 14 34 | #define Y3_GPIO_NUM 13 35 | #define Y2_GPIO_NUM 34 36 | #define VSYNC_GPIO_NUM 5 37 | #define HREF_GPIO_NUM 27 38 | #define PCLK_GPIO_NUM 25 39 | 40 | #elif defined(CAMERA_MODEL_M5STACK_PSRAM) 41 | #define PWDN_GPIO_NUM -1 42 | #define RESET_GPIO_NUM 15 43 | #define XCLK_GPIO_NUM 27 44 | #define SIOD_GPIO_NUM 25 45 | #define SIOC_GPIO_NUM 23 46 | 47 | #define Y9_GPIO_NUM 19 48 | #define Y8_GPIO_NUM 36 49 | #define Y7_GPIO_NUM 18 50 | #define Y6_GPIO_NUM 39 51 | #define Y5_GPIO_NUM 5 52 | #define Y4_GPIO_NUM 34 53 | #define Y3_GPIO_NUM 35 54 | #define Y2_GPIO_NUM 32 55 | #define VSYNC_GPIO_NUM 22 56 | #define HREF_GPIO_NUM 26 57 | #define PCLK_GPIO_NUM 21 58 | 59 | #elif defined(CAMERA_MODEL_M5STACK_WIDE) 60 | #define PWDN_GPIO_NUM -1 61 | #define RESET_GPIO_NUM 15 62 | #define XCLK_GPIO_NUM 27 63 | #define SIOD_GPIO_NUM 22 64 | #define SIOC_GPIO_NUM 23 65 | 66 | #define Y9_GPIO_NUM 19 67 | #define Y8_GPIO_NUM 36 68 | #define Y7_GPIO_NUM 18 69 | #define Y6_GPIO_NUM 39 70 | #define Y5_GPIO_NUM 5 71 | #define Y4_GPIO_NUM 34 72 | #define Y3_GPIO_NUM 35 73 | #define Y2_GPIO_NUM 32 74 | #define VSYNC_GPIO_NUM 25 75 | #define HREF_GPIO_NUM 26 76 | #define PCLK_GPIO_NUM 21 77 | 78 | #elif defined(CAMERA_MODEL_AI_THINKER) 79 | #define PWDN_GPIO_NUM 32 80 | #define RESET_GPIO_NUM -1 81 | #define XCLK_GPIO_NUM 0 82 | #define SIOD_GPIO_NUM 26 83 | #define SIOC_GPIO_NUM 27 84 | 85 | #define Y9_GPIO_NUM 35 86 | #define Y8_GPIO_NUM 34 87 | #define Y7_GPIO_NUM 39 88 | #define Y6_GPIO_NUM 36 89 | #define Y5_GPIO_NUM 21 90 | #define Y4_GPIO_NUM 19 91 | #define Y3_GPIO_NUM 18 92 | #define Y2_GPIO_NUM 5 93 | #define VSYNC_GPIO_NUM 25 94 | #define HREF_GPIO_NUM 23 95 | #define PCLK_GPIO_NUM 22 96 | 97 | #else 98 | #error "Camera model not selected" 99 | #endif 100 | -------------------------------------------------------------------------------- /References/esp32-cam-camera-flash-sd-pins.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asjdf/ESP32CAMmotion_detection/9e519fb6e63d87f2582c1cf37461fde63cc942e2/References/esp32-cam-camera-flash-sd-pins.webp -------------------------------------------------------------------------------- /References/esp32-cam-pins.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asjdf/ESP32CAMmotion_detection/9e519fb6e63d87f2582c1cf37461fde63cc942e2/References/esp32-cam-pins.jpg -------------------------------------------------------------------------------- /References/可切换分辨率版本 分析中/ARDUINO/CameraWebServer/CameraWebServer.ino: -------------------------------------------------------------------------------- 1 | #include "esp_camera.h" 2 | #include 3 | 4 | // 5 | // WARNING!!! Make sure that you have either selected ESP32 Wrover Module, 6 | // or another board which has PSRAM enabled 7 | // 8 | // modified by lttung1197 9 | // Arduino 1.8.5 , esp32 1.0.2 10 | 11 | // Select camera model 12 | //#define CAMERA_MODEL_WROVER_KIT 13 | //#define CAMERA_MODEL_ESP_EYE 14 | //#define CAMERA_MODEL_M5STACK_PSRAM 15 | //#define CAMERA_MODEL_M5STACK_WIDE 16 | #define CAMERA_MODEL_AI_THINKER 17 | 18 | #include "camera_pins.h" 19 | 20 | const char* ssid = "ESP32-CAM"; 21 | const char* password = "0y5c2k8."; 22 | 23 | // Set your Static IP address 24 | IPAddress local_IP(10, 10, 1, 1); 25 | // Set your Gateway IP address 26 | IPAddress gateway(10, 10, 1, 1); 27 | IPAddress subnet(255, 255, 255, 0); 28 | 29 | void startCameraServer(); 30 | 31 | void setup() { 32 | Serial.begin(115200); 33 | Serial.setDebugOutput(true); 34 | Serial.println(); 35 | 36 | camera_config_t config; 37 | config.ledc_channel = LEDC_CHANNEL_0; 38 | config.ledc_timer = LEDC_TIMER_0; 39 | config.pin_d0 = Y2_GPIO_NUM; 40 | config.pin_d1 = Y3_GPIO_NUM; 41 | config.pin_d2 = Y4_GPIO_NUM; 42 | config.pin_d3 = Y5_GPIO_NUM; 43 | config.pin_d4 = Y6_GPIO_NUM; 44 | config.pin_d5 = Y7_GPIO_NUM; 45 | config.pin_d6 = Y8_GPIO_NUM; 46 | config.pin_d7 = Y9_GPIO_NUM; 47 | config.pin_xclk = XCLK_GPIO_NUM; 48 | config.pin_pclk = PCLK_GPIO_NUM; 49 | config.pin_vsync = VSYNC_GPIO_NUM; 50 | config.pin_href = HREF_GPIO_NUM; 51 | config.pin_sscb_sda = SIOD_GPIO_NUM; 52 | config.pin_sscb_scl = SIOC_GPIO_NUM; 53 | config.pin_pwdn = PWDN_GPIO_NUM; 54 | config.pin_reset = RESET_GPIO_NUM; 55 | config.xclk_freq_hz = 20000000; 56 | config.pixel_format = PIXFORMAT_JPEG; 57 | //init with high specs to pre-allocate larger buffers 58 | if(psramFound()){ 59 | config.frame_size = FRAMESIZE_UXGA; 60 | config.jpeg_quality = 10; 61 | config.fb_count = 2; 62 | } else { 63 | config.frame_size = FRAMESIZE_SVGA; 64 | config.jpeg_quality = 12; 65 | config.fb_count = 1; 66 | } 67 | 68 | #if defined(CAMERA_MODEL_ESP_EYE) 69 | pinMode(13, INPUT_PULLUP); 70 | pinMode(14, INPUT_PULLUP); 71 | #endif 72 | 73 | // camera init 74 | esp_err_t err = esp_camera_init(&config); 75 | if (err != ESP_OK) { 76 | Serial.printf("Camera init failed with error 0x%x", err); 77 | return; 78 | } 79 | 80 | sensor_t * s = esp_camera_sensor_get(); 81 | //initial sensors are flipped vertically and colors are a bit saturated 82 | if (s->id.PID == OV3660_PID) { 83 | s->set_vflip(s, 1);//flip it back 84 | s->set_brightness(s, 1);//up the blightness just a bit 85 | s->set_saturation(s, -2);//lower the saturation 86 | } 87 | //drop down frame size for higher initial frame rate 88 | s->set_framesize(s, FRAMESIZE_QVGA); 89 | 90 | #if defined(CAMERA_MODEL_M5STACK_WIDE) 91 | s->set_vflip(s, 1); 92 | s->set_hmirror(s, 1); 93 | #endif 94 | 95 | // Connect to Wi-Fi network with SSID and password 96 | Serial.println("Setting AP (Access Point)…"); 97 | // Remove the password parameter, if you want the AP (Access Point) to be open 98 | WiFi.softAP(ssid, password); 99 | Serial.println("Wait 100 ms for AP_START..."); 100 | delay(100); 101 | 102 | // Configures static IP address 103 | if (!WiFi.softAPConfig(local_IP, gateway, subnet)) { 104 | Serial.println("STA Failed to configure"); 105 | } 106 | 107 | IPAddress IP = WiFi.softAPIP(); 108 | Serial.print("Camera Stream Ready! Connect to the ESP32 AP and go to: http://"); 109 | Serial.println(IP); 110 | 111 | startCameraServer(); 112 | } 113 | 114 | void loop() { 115 | // put your main code here, to run repeatedly: 116 | delay(10000); 117 | } 118 | -------------------------------------------------------------------------------- /References/可切换分辨率版本 分析中/ARDUINO/CameraWebServer/camera_pins.h: -------------------------------------------------------------------------------- 1 | 2 | #if defined(CAMERA_MODEL_WROVER_KIT) 3 | #define PWDN_GPIO_NUM -1 4 | #define RESET_GPIO_NUM -1 5 | #define XCLK_GPIO_NUM 21 6 | #define SIOD_GPIO_NUM 26 7 | #define SIOC_GPIO_NUM 27 8 | 9 | #define Y9_GPIO_NUM 35 10 | #define Y8_GPIO_NUM 34 11 | #define Y7_GPIO_NUM 39 12 | #define Y6_GPIO_NUM 36 13 | #define Y5_GPIO_NUM 19 14 | #define Y4_GPIO_NUM 18 15 | #define Y3_GPIO_NUM 5 16 | #define Y2_GPIO_NUM 4 17 | #define VSYNC_GPIO_NUM 25 18 | #define HREF_GPIO_NUM 23 19 | #define PCLK_GPIO_NUM 22 20 | 21 | #elif defined(CAMERA_MODEL_ESP_EYE) 22 | #define PWDN_GPIO_NUM -1 23 | #define RESET_GPIO_NUM -1 24 | #define XCLK_GPIO_NUM 4 25 | #define SIOD_GPIO_NUM 18 26 | #define SIOC_GPIO_NUM 23 27 | 28 | #define Y9_GPIO_NUM 36 29 | #define Y8_GPIO_NUM 37 30 | #define Y7_GPIO_NUM 38 31 | #define Y6_GPIO_NUM 39 32 | #define Y5_GPIO_NUM 35 33 | #define Y4_GPIO_NUM 14 34 | #define Y3_GPIO_NUM 13 35 | #define Y2_GPIO_NUM 34 36 | #define VSYNC_GPIO_NUM 5 37 | #define HREF_GPIO_NUM 27 38 | #define PCLK_GPIO_NUM 25 39 | 40 | #elif defined(CAMERA_MODEL_M5STACK_PSRAM) 41 | #define PWDN_GPIO_NUM -1 42 | #define RESET_GPIO_NUM 15 43 | #define XCLK_GPIO_NUM 27 44 | #define SIOD_GPIO_NUM 25 45 | #define SIOC_GPIO_NUM 23 46 | 47 | #define Y9_GPIO_NUM 19 48 | #define Y8_GPIO_NUM 36 49 | #define Y7_GPIO_NUM 18 50 | #define Y6_GPIO_NUM 39 51 | #define Y5_GPIO_NUM 5 52 | #define Y4_GPIO_NUM 34 53 | #define Y3_GPIO_NUM 35 54 | #define Y2_GPIO_NUM 32 55 | #define VSYNC_GPIO_NUM 22 56 | #define HREF_GPIO_NUM 26 57 | #define PCLK_GPIO_NUM 21 58 | 59 | #elif defined(CAMERA_MODEL_M5STACK_WIDE) 60 | #define PWDN_GPIO_NUM -1 61 | #define RESET_GPIO_NUM 15 62 | #define XCLK_GPIO_NUM 27 63 | #define SIOD_GPIO_NUM 22 64 | #define SIOC_GPIO_NUM 23 65 | 66 | #define Y9_GPIO_NUM 19 67 | #define Y8_GPIO_NUM 36 68 | #define Y7_GPIO_NUM 18 69 | #define Y6_GPIO_NUM 39 70 | #define Y5_GPIO_NUM 5 71 | #define Y4_GPIO_NUM 34 72 | #define Y3_GPIO_NUM 35 73 | #define Y2_GPIO_NUM 32 74 | #define VSYNC_GPIO_NUM 25 75 | #define HREF_GPIO_NUM 26 76 | #define PCLK_GPIO_NUM 21 77 | 78 | #elif defined(CAMERA_MODEL_AI_THINKER) 79 | #define PWDN_GPIO_NUM 32 80 | #define RESET_GPIO_NUM -1 81 | #define XCLK_GPIO_NUM 0 82 | #define SIOD_GPIO_NUM 26 83 | #define SIOC_GPIO_NUM 27 84 | 85 | #define Y9_GPIO_NUM 35 86 | #define Y8_GPIO_NUM 34 87 | #define Y7_GPIO_NUM 39 88 | #define Y6_GPIO_NUM 36 89 | #define Y5_GPIO_NUM 21 90 | #define Y4_GPIO_NUM 19 91 | #define Y3_GPIO_NUM 18 92 | #define Y2_GPIO_NUM 5 93 | #define VSYNC_GPIO_NUM 25 94 | #define HREF_GPIO_NUM 23 95 | #define PCLK_GPIO_NUM 22 96 | 97 | #else 98 | #error "Camera model not selected" 99 | #endif 100 | -------------------------------------------------------------------------------- /References/可切换分辨率版本 分析中/HTML GZ EDITOR/README.txt: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////// 2 | //////////HTML GZ EDITOR////////////// 3 | ////////////////////////////////////// 4 | 5 | 1/ Open ESP32 Control Panel on your browser, then save all source code (View page source) to .html file 6 | 2/ Convert .html to .html.gz by gzip tool (for Linux) or this online tool (remember to check option 2): 7 | https://online-converting.com/archives/convert-to-gzip/ 8 | 2/ Build filetoarray cpp file (GCC or Visual Studio) (SKIP IT if you can run filetoarray.exe) 9 | 3/ Use cmd.exe to run this command: filetoarray.exe index.html.gz > camera_index.h 10 | 4/ Open camera_index.h and update len and array data to arduino's camera_index.h 11 | 5/ Finish, continue to build your code 12 | 13 | //////////////lttung1197////////////// 14 | //////////////18/11/2019////////////// -------------------------------------------------------------------------------- /References/可切换分辨率版本 分析中/HTML GZ EDITOR/camera.html.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asjdf/ESP32CAMmotion_detection/9e519fb6e63d87f2582c1cf37461fde63cc942e2/References/可切换分辨率版本 分析中/HTML GZ EDITOR/camera.html.gz -------------------------------------------------------------------------------- /References/可切换分辨率版本 分析中/HTML GZ EDITOR/filetoarray.cpp: -------------------------------------------------------------------------------- 1 | // filetoarray.cpp : Defines the entry point for the console application. 2 | // 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | int main(int argc, char *argv[]) { 11 | FILE * fp; 12 | char *buffer; 13 | long flen; 14 | char *fname; 15 | char pname[1024]; 16 | 17 | if (argc == 2) { 18 | fname = argv[1]; 19 | strcpy(pname, fname); 20 | char * dot = strchr(pname, '.'); 21 | while (dot != NULL) { 22 | *dot = '_'; 23 | dot = strchr(pname, '.'); 24 | } 25 | } 26 | else { 27 | printf("Filename not supplied\n"); 28 | return 1; 29 | } 30 | 31 | fp = fopen(fname, "rb"); 32 | fseek(fp, 0, SEEK_END); 33 | flen = ftell(fp); 34 | rewind(fp); 35 | 36 | buffer = (char *)malloc((flen + 1) * sizeof(char)); 37 | fread(buffer, flen, 1, fp); 38 | fclose(fp); 39 | 40 | printf("\n//File: %s, Size: %lu\n", fname, flen); 41 | printf("#define %s_len %lu\n", pname, flen); 42 | printf("const uint8_t %s[] PROGMEM = {\n", pname); 43 | long i; 44 | for (i = 0; i. 20 | */ 21 | // 2017: modified by @robo8080 22 | // 2019: modified by @fa1ke5 23 | 24 | /******************************************************************************* 25 | ** ** 26 | ** DEFINITIONS FOR FTP SERVER ** 27 | ** ** 28 | *******************************************************************************/ 29 | 30 | // Uncomment to print debugging info to console attached to ESP8266 31 | //#define FTP_DEBUG 32 | 33 | #ifndef FTP_SERVERESP_H 34 | #define FTP_SERVERESP_H 35 | 36 | //#include "Streaming.h" 37 | #include "SD_MMC.h" 38 | #include 39 | #include 40 | 41 | #define FTP_SERVER_VERSION "FTP-2016-01-14" 42 | 43 | #define FTP_CTRL_PORT 21 // Command port on wich server is listening 44 | #define FTP_DATA_PORT_PASV 50009 // Data port in passive mode 45 | 46 | #define FTP_TIME_OUT 5 // Disconnect client after 5 minutes of inactivity 47 | #define FTP_CMD_SIZE 255 + 8 // max size of a command 48 | #define FTP_CWD_SIZE 255 + 8 // max size of a directory name 49 | #define FTP_FIL_SIZE 255 // max size of a file name 50 | 51 | //#define FTP_BUF_SIZE 512 //512 // size of file buffer for read/write 52 | //#define FTP_BUF_SIZE 2*1460 //512 // size of file buffer for read/write 53 | #define FTP_BUF_SIZE 4096 //512 // 700 KByte/s download in AP mode, direct connection. 54 | 55 | 56 | class FtpServer 57 | { 58 | public: 59 | void begin(String uname, String pword); 60 | void handleFTP(); 61 | 62 | private: 63 | bool haveParameter(); 64 | bool makeExistsPath( char * path, char * param = NULL ); 65 | void iniVariables(); 66 | void clientConnected(); 67 | void disconnectClient(); 68 | boolean userIdentity(); 69 | boolean userPassword(); 70 | boolean processCommand(); 71 | boolean dataConnect(); 72 | boolean doRetrieve(); 73 | boolean doStore(); 74 | void closeTransfer(); 75 | void abortTransfer(); 76 | boolean makePath( char * fullname ); 77 | boolean makePath( char * fullName, char * param ); 78 | uint8_t getDateTime( uint16_t * pyear, uint8_t * pmonth, uint8_t * pday, 79 | uint8_t * phour, uint8_t * pminute, uint8_t * second ); 80 | char * makeDateTimeStr( char * tstr, uint16_t date, uint16_t time ); 81 | int8_t readChar(); 82 | 83 | IPAddress dataIp; // IP address of client for data 84 | WiFiClient client; 85 | WiFiClient data; 86 | 87 | File file; 88 | 89 | boolean dataPassiveConn; 90 | uint16_t dataPort; 91 | char buf[ FTP_BUF_SIZE ]; // data buffer for transfers 92 | char cmdLine[ FTP_CMD_SIZE ]; // where to store incoming char from client 93 | char cwdName[ FTP_CWD_SIZE ]; // name of current directory 94 | char command[ 5 ]; // command sent by client 95 | boolean rnfrCmd; // previous command was RNFR 96 | char * parameters; // point to begin of parameters sent by client 97 | uint16_t iCL; // pointer to cmdLine next incoming char 98 | int8_t cmdStatus, // status of ftp command connexion 99 | transferStatus; // status of ftp data transfer 100 | uint32_t millisTimeOut, // disconnect after 5 min of inactivity 101 | millisDelay, 102 | millisEndConnection, // 103 | millisBeginTrans, // store time of beginning of a transaction 104 | bytesTransfered; // 105 | String _FTP_USER; 106 | String _FTP_PASS; 107 | 108 | 109 | 110 | }; 111 | 112 | #endif // FTP_SERVERESP_H 113 | -------------------------------------------------------------------------------- /Tested procedures/batteryTest/README.MD: -------------------------------------------------------------------------------- 1 | # ESP32MotionDetectionWithVideoRecorder 2 | # ESP32移动侦测摄像机 3 | 4 | ### 目前功能: 5 | - 移动侦测 6 | - 自动录制视频 7 | 8 | ### 目前问题: 9 | -在SVGA清晰度下无法达到5fps 10 | 11 | ### 未来计划: 12 | - 性能优化 13 | - 降低功耗 14 | 15 | 从 https://github.com/jameszah/ESP32-CAM-Video-Recorder/ 改造而来 16 | 17 | 结合了https://github.com/s60sc/ESP32-CAM_Motion 18 | 19 | 补充了一个h文件 不然在编译的时候会有一点问题 处理得很粗糙,等待修改. 20 | 21 | #### 更新记录: 22 | - 2020.3.22 完成基本程序,或者说程序跑起来没问题. -------------------------------------------------------------------------------- /Tested procedures/batteryTest/motionDetect.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asjdf/ESP32CAMmotion_detection/9e519fb6e63d87f2582c1cf37461fde63cc942e2/Tested procedures/batteryTest/motionDetect.h -------------------------------------------------------------------------------- /Tested procedures/test2/ESP32FtpServer.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * FTP SERVER FOR ESP8266 4 | * based on FTP Serveur for Arduino Due and Ethernet shield (W5100) or WIZ820io (W5200) 5 | * based on Jean-Michel Gallego's work 6 | * modified to work with esp8266 SPIFFS by David Paiva (david@nailbuster.com) 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program. If not, see . 20 | */ 21 | // 2017: modified by @robo8080 22 | // 2019: modified by @fa1ke5 23 | 24 | /******************************************************************************* 25 | ** ** 26 | ** DEFINITIONS FOR FTP SERVER ** 27 | ** ** 28 | *******************************************************************************/ 29 | 30 | // Uncomment to print debugging info to console attached to ESP8266 31 | //#define FTP_DEBUG 32 | 33 | #ifndef FTP_SERVERESP_H 34 | #define FTP_SERVERESP_H 35 | 36 | //#include "Streaming.h" 37 | #include "SD_MMC.h" 38 | #include 39 | #include 40 | 41 | #define FTP_SERVER_VERSION "FTP-2016-01-14" 42 | 43 | #define FTP_CTRL_PORT 21 // Command port on wich server is listening 44 | #define FTP_DATA_PORT_PASV 50009 // Data port in passive mode 45 | 46 | #define FTP_TIME_OUT 5 // Disconnect client after 5 minutes of inactivity 47 | #define FTP_CMD_SIZE 255 + 8 // max size of a command 48 | #define FTP_CWD_SIZE 255 + 8 // max size of a directory name 49 | #define FTP_FIL_SIZE 255 // max size of a file name 50 | 51 | //#define FTP_BUF_SIZE 512 //512 // size of file buffer for read/write 52 | //#define FTP_BUF_SIZE 2*1460 //512 // size of file buffer for read/write 53 | #define FTP_BUF_SIZE 4096 //512 // 700 KByte/s download in AP mode, direct connection. 54 | 55 | 56 | class FtpServer 57 | { 58 | public: 59 | void begin(String uname, String pword); 60 | void handleFTP(); 61 | 62 | private: 63 | bool haveParameter(); 64 | bool makeExistsPath( char * path, char * param = NULL ); 65 | void iniVariables(); 66 | void clientConnected(); 67 | void disconnectClient(); 68 | boolean userIdentity(); 69 | boolean userPassword(); 70 | boolean processCommand(); 71 | boolean dataConnect(); 72 | boolean doRetrieve(); 73 | boolean doStore(); 74 | void closeTransfer(); 75 | void abortTransfer(); 76 | boolean makePath( char * fullname ); 77 | boolean makePath( char * fullName, char * param ); 78 | uint8_t getDateTime( uint16_t * pyear, uint8_t * pmonth, uint8_t * pday, 79 | uint8_t * phour, uint8_t * pminute, uint8_t * second ); 80 | char * makeDateTimeStr( char * tstr, uint16_t date, uint16_t time ); 81 | int8_t readChar(); 82 | 83 | IPAddress dataIp; // IP address of client for data 84 | WiFiClient client; 85 | WiFiClient data; 86 | 87 | File file; 88 | 89 | boolean dataPassiveConn; 90 | uint16_t dataPort; 91 | char buf[ FTP_BUF_SIZE ]; // data buffer for transfers 92 | char cmdLine[ FTP_CMD_SIZE ]; // where to store incoming char from client 93 | char cwdName[ FTP_CWD_SIZE ]; // name of current directory 94 | char command[ 5 ]; // command sent by client 95 | boolean rnfrCmd; // previous command was RNFR 96 | char * parameters; // point to begin of parameters sent by client 97 | uint16_t iCL; // pointer to cmdLine next incoming char 98 | int8_t cmdStatus, // status of ftp command connexion 99 | transferStatus; // status of ftp data transfer 100 | uint32_t millisTimeOut, // disconnect after 5 min of inactivity 101 | millisDelay, 102 | millisEndConnection, // 103 | millisBeginTrans, // store time of beginning of a transaction 104 | bytesTransfered; // 105 | String _FTP_USER; 106 | String _FTP_PASS; 107 | 108 | 109 | 110 | }; 111 | 112 | #endif // FTP_SERVERESP_H 113 | -------------------------------------------------------------------------------- /Tested procedures/test2/README.MD: -------------------------------------------------------------------------------- 1 | 从 https://github.com/jameszah/ESP32-CAM-Video-Recorder/ 改造而来 2 | 3 | 结合了https://github.com/s60sc/ESP32-CAM_Motion 4 | 补充了一个h文件 不然在编译的时候会有一点问题 处理得很粗糙,等待修改. 5 | 6 | 目前问题:cpu性能似乎不足(也可能是我负优化)录制的时候会有跳帧的问题,在SVGA清晰度下没有办法达到10fps. 7 | 8 | 2020.03.21 -------------------------------------------------------------------------------- /Tested procedures/test2/motionDetect.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asjdf/ESP32CAMmotion_detection/9e519fb6e63d87f2582c1cf37461fde63cc942e2/Tested procedures/test2/motionDetect.h -------------------------------------------------------------------------------- /Tested procedures/time/time.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include "time.h" 3 | #include 4 | 5 | 6 | void printLocalTime() 7 | { 8 | struct tm timeinfo; 9 | if(!getLocalTime(&timeinfo)){ 10 | Serial.println("Failed to obtain time"); 11 | return; 12 | } 13 | Serial.println(&timeinfo, "%A, %B %d %Y %H:%M:%S"); 14 | } 15 | 16 | void setup() 17 | { 18 | Serial.begin(115200); 19 | WiFi.mode(WIFI_OFF); 20 | 21 | time_t now; 22 | char strftime_buf[64]; 23 | struct tm timeinfo; 24 | 25 | time(&now); 26 | // Set timezone to China Standard Time 27 | setenv("TZ", "CST-8", 1); 28 | tzset(); 29 | 30 | localtime_r(&now, &timeinfo); 31 | strftime(strftime_buf, sizeof(strftime_buf), "%c", &timeinfo); 32 | Serial.println(strftime_buf); 33 | 34 | struct tm tmGet; 35 | tmGet.tm_year = 2018 - 1900; 36 | tmGet.tm_mon = 10; 37 | tmGet.tm_mday = 15; 38 | tmGet.tm_hour = 14; 39 | tmGet.tm_min = 10; 40 | tmGet.tm_sec = 10; 41 | time_t t = mktime(&tmGet); 42 | printf("Setting time: %s", asctime(&tmGet)); 43 | timeval tmSet = { .tv_sec = t }; 44 | settimeofday(&tmSet, NULL); 45 | 46 | printLocalTime(); 47 | } 48 | 49 | void loop() 50 | { 51 | delay(1000); 52 | printLocalTime(); 53 | } -------------------------------------------------------------------------------- /Tested procedures/发时间的js/time.html: -------------------------------------------------------------------------------- 1 | 12 | --------------------------------------------------------------------------------