Jan 12, 2022 - ver 58.8

pull/34/head
jameszah 2022-01-22 19:21:07 -07:00
rodzic 321b7e5860
commit 458ffc83c5
2 zmienionych plików z 2461 dodań i 2461 usunięć

Wyświetl plik

@ -33,7 +33,9 @@
- add esp32 sd filemanager to download files - add esp32 sd filemanager to download files
- v57 dec 28, 2021 - final changes to https://github.com/jameszah/ESPxWebFlMgr/tree/master/esp32_sd_file_manager - v57 dec 28, 2021 - final changes to https://github.com/jameszah/ESPxWebFlMgr/tree/master/esp32_sd_file_manager
- v58 dec 30, 2021 - changes for Arduino 1.8.19 and esp32 Board Library 2.0.2 - v58 dec 30, 2021 - changes for Arduino 1.8.19 and esp32 Board Library 2.0.2
jan 12, 2022 - add dates to file manager
- add simple version of config.txt configuration
https://github.com/jameszah/ESP32-CAM-Video-Recorder-junior https://github.com/jameszah/ESP32-CAM-Video-Recorder-junior
jameszah/ESP32-CAM-Video-Recorder-junior is licensed under the jameszah/ESP32-CAM-Video-Recorder-junior is licensed under the
@ -45,14 +47,14 @@
- or with AI Thinker ESP32-CAM - or with AI Thinker ESP32-CAM
Needs these libraries or better: Needs these libraries or better:
ArduinoJson 6.18.5 by Benoit Blanchon ArduinoJson 6.18.5 by Benoit Blanchon
WiFiManager 2.05-beat by tablatronix WiFiManager 2.05-beat by tablatronix
Compiled with Arduino 1.8.19, and esp32-arduino core version 2.0.2, on Dec 30, 2021. Compiled with Arduino 1.8.19, and esp32-arduino core version 2.0.2, on Jan 12, 2022
Using library FS at version 2.0.0 in folder: C:\ArduinoPortable\arduino-1.8.19\portable\packages\esp32\hardware\esp32\2.0.2\libraries\FS Using library FS at version 2.0.0 in folder: C:\ArduinoPortable\arduino-1.8.19\portable\packages\esp32\hardware\esp32\2.0.2\libraries\FS
Using library SD_MMC at version 2.0.0 in folder: C:\ArduinoPortable\arduino-1.8.19\portable\packages\esp32\hardware\esp32\2.0.2\libraries\SD_MMC Using library SD_MMC at version 2.0.0 in folder: C:\ArduinoPortable\arduino-1.8.19\portable\packages\esp32\hardware\esp32\2.0.2\libraries\SD_MMC
Using library EEPROM at version 2.0.0 in folder: C:\ArduinoPortable\arduino-1.8.19\portable\packages\esp32\hardware\esp32\2.0.2\libraries\EEPROM Using library EEPROM at version 2.0.0 in folder: C:\ArduinoPortable\arduino-1.8.19\portable\packages\esp32\hardware\esp32\2.0.2\libraries\EEPROM
Using library WiFi at version 2.0.0 in folder: C:\ArduinoPortable\arduino-1.8.19\portable\packages\esp32\hardware\esp32\2.0.2\libraries\WiFi Using library WiFi at version 2.0.0 in folder: C:\ArduinoPortable\arduino-1.8.19\portable\packages\esp32\hardware\esp32\2.0.2\libraries\WiFi
@ -63,10 +65,10 @@ Using library DNSServer at version 2.0.0 in folder: C:\ArduinoPortable\arduino-1
Using library ESPmDNS at version 2.0.0 in folder: C:\ArduinoPortable\arduino-1.8.19\portable\packages\esp32\hardware\esp32\2.0.2\libraries\ESPmDNS Using library ESPmDNS at version 2.0.0 in folder: C:\ArduinoPortable\arduino-1.8.19\portable\packages\esp32\hardware\esp32\2.0.2\libraries\ESPmDNS
Using library HTTPClient at version 2.0.0 in folder: C:\ArduinoPortable\arduino-1.8.19\portable\packages\esp32\hardware\esp32\2.0.2\libraries\HTTPClient Using library HTTPClient at version 2.0.0 in folder: C:\ArduinoPortable\arduino-1.8.19\portable\packages\esp32\hardware\esp32\2.0.2\libraries\HTTPClient
Using library WiFiClientSecure at version 2.0.0 in folder: C:\ArduinoPortable\arduino-1.8.19\portable\packages\esp32\hardware\esp32\2.0.2\libraries\WiFiClientSecure Using library WiFiClientSecure at version 2.0.0 in folder: C:\ArduinoPortable\arduino-1.8.19\portable\packages\esp32\hardware\esp32\2.0.2\libraries\WiFiClientSecure
"C:\\ArduinoPortable\\arduino-1.8.19\\portable\\packages\\esp32\\tools\\xtensa-esp32-elf-gcc\\gcc8_4_0-esp-2021r2/bin/xtensa-esp32-elf-size" -A "C:\\Users\\James\\AppData\\Local\\Temp\\arduino_build_895714/ESP32-CAM-Video-Recorder-junior-58x.ino.elf" "C:\\ArduinoPortable\\arduino-1.8.19\\portable\\packages\\esp32\\tools\\xtensa-esp32-elf-gcc\\gcc8_4_0-esp-2021r2/bin/xtensa-esp32-elf-size" -A "C:\\Users\\James\\AppData\\Local\\Temp\\arduino_build_568185/ESP32-CAM-Video-Recorder-junior-58x.8.ino.elf"
Sketch uses 1056201 bytes (33%) of program storage space. Maximum is 3145728 bytes. Sketch uses 1060501 bytes (33%) of program storage space. Maximum is 3145728 bytes.
Global variables use 59268 bytes (18%) of dynamic memory, leaving 268412 bytes for local variables. Maximum is 327680 bytes. Global variables use 59268 bytes (18%) of dynamic memory, leaving 268412 bytes for local variables. Maximum is 327680 bytes.
C:\ArduinoPortable\arduino-1.8.19\portable\packages\esp32\tools\esptool_py\3.1.0/esptool.exe --chip esp32 --port COM7 --baud 460800 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size 4MB 0xe000 C:\ArduinoPortable\arduino-1.8.19\portable\packages\esp32\hardware\esp32\2.0.2/tools/partitions/boot_app0.bin 0x1000 C:\Users\James\AppData\Local\Temp\arduino_build_895714/ESP32-CAM-Video-Recorder-junior-58x.ino.bootloader.bin 0x10000 C:\Users\James\AppData\Local\Temp\arduino_build_895714/ESP32-CAM-Video-Recorder-junior-58x.ino.bin 0x8000 C:\Users\James\AppData\Local\Temp\arduino_build_895714/ESP32-CAM-Video-Recorder-junior-58x.ino.partitions.bin C:\ArduinoPortable\arduino-1.8.19\portable\packages\esp32\tools\esptool_py\3.1.0/esptool.exe --chip esp32 --port COM7 --baud 460800 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size 4MB 0xe000 C:\ArduinoPortable\arduino-1.8.19\portable\packages\esp32\hardware\esp32\2.0.2/tools/partitions/boot_app0.bin 0x1000 C:\Users\James\AppData\Local\Temp\arduino_build_568185/ESP32-CAM-Video-Recorder-junior-58x.8.ino.bootloader.bin 0x10000 C:\Users\James\AppData\Local\Temp\arduino_build_568185/ESP32-CAM-Video-Recorder-junior-58x.8.ino.bin 0x8000 C:\Users\James\AppData\Local\Temp\arduino_build_568185/ESP32-CAM-Video-Recorder-junior-58x.8.ino.partitions.bin
*/ */
@ -509,11 +511,167 @@ static esp_err_t init_sdcard()
return ESP_OK; return ESP_OK;
} }
//File: simple.txt, Size: 2330
#define simple_txt_len 2330
//const uint8_t simple_txt[] PROGMEM = {
const char simple_txt[] PROGMEM = {
0x64, 0x65, 0x73, 0x6B, 0x6C, 0x65, 0x6E, 0x73, 0x20, 0x20, 0x2F, 0x2F, 0x20, 0x63, 0x61, 0x6D,
0x65, 0x72, 0x61, 0x20, 0x6E, 0x61, 0x6D, 0x65, 0x0D, 0x0A, 0x31, 0x31, 0x20, 0x20, 0x2F, 0x2F,
0x20, 0x66, 0x72, 0x61, 0x6D, 0x65, 0x73, 0x69, 0x7A, 0x65, 0x20, 0x20, 0x31, 0x31, 0x3D, 0x68,
0x64, 0x0D, 0x0A, 0x31, 0x38, 0x30, 0x30, 0x20, 0x20, 0x2F, 0x2F, 0x20, 0x6C, 0x65, 0x6E, 0x67,
0x74, 0x68, 0x20, 0x6F, 0x66, 0x20, 0x76, 0x69, 0x64, 0x65, 0x6F, 0x20, 0x69, 0x6E, 0x20, 0x73,
0x65, 0x63, 0x6F, 0x6E, 0x64, 0x73, 0x0D, 0x0A, 0x30, 0x20, 0x20, 0x2F, 0x2F, 0x20, 0x69, 0x6E,
0x74, 0x65, 0x72, 0x76, 0x61, 0x6C, 0x20, 0x2D, 0x20, 0x6D, 0x73, 0x20, 0x62, 0x65, 0x74, 0x77,
0x65, 0x65, 0x6E, 0x20, 0x72, 0x65, 0x63, 0x6F, 0x72, 0x64, 0x69, 0x6E, 0x67, 0x20, 0x66, 0x72,
0x61, 0x6D, 0x65, 0x73, 0x20, 0x0D, 0x0A, 0x31, 0x20, 0x20, 0x2F, 0x2F, 0x20, 0x73, 0x70, 0x65,
0x65, 0x64, 0x75, 0x70, 0x20, 0x2D, 0x20, 0x6D, 0x75, 0x6C, 0x74, 0x69, 0x70, 0x6C, 0x79, 0x20,
0x66, 0x72, 0x61, 0x6D, 0x65, 0x72, 0x61, 0x74, 0x65, 0x20, 0x0D, 0x0A, 0x30, 0x20, 0x20, 0x2F,
0x2F, 0x20, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6D, 0x64, 0x65, 0x6C, 0x61, 0x79, 0x20, 0x2D, 0x20,
0x6D, 0x73, 0x20, 0x62, 0x65, 0x74, 0x77, 0x65, 0x65, 0x6E, 0x20, 0x73, 0x74, 0x72, 0x65, 0x61,
0x6D, 0x69, 0x6E, 0x67, 0x20, 0x66, 0x72, 0x61, 0x6D, 0x65, 0x73, 0x0D, 0x0A, 0x47, 0x4D, 0x54,
0x20, 0x2F, 0x2F, 0x20, 0x74, 0x69, 0x6D, 0x65, 0x7A, 0x6F, 0x6E, 0x65, 0x0D, 0x0A, 0x73, 0x73,
0x69, 0x64, 0x31, 0x32, 0x33, 0x34, 0x20, 0x20, 0x2F, 0x2F, 0x20, 0x73, 0x73, 0x69, 0x64, 0x20,
0x77, 0x69, 0x66, 0x69, 0x20, 0x6E, 0x61, 0x6D, 0x65, 0x0D, 0x0A, 0x6D, 0x72, 0x70, 0x65, 0x61,
0x6E, 0x75, 0x74, 0x20, 0x20, 0x2F, 0x2F, 0x20, 0x73, 0x73, 0x69, 0x64, 0x20, 0x70, 0x61, 0x73,
0x73, 0x77, 0x6F, 0x72, 0x64, 0x0D, 0x0A, 0x0D, 0x0A, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E,
0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E,
0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E,
0x7E, 0x7E, 0x7E, 0x0D, 0x0A, 0x41, 0x62, 0x6F, 0x76, 0x65, 0x20, 0x6C, 0x69, 0x6E, 0x65, 0x73,
0x20, 0x2D, 0x20, 0x31, 0x20, 0x69, 0x74, 0x65, 0x6D, 0x20, 0x70, 0x65, 0x72, 0x20, 0x6C, 0x69,
0x6E, 0x65, 0x20, 0x66, 0x6F, 0x6C, 0x6C, 0x6F, 0x77, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x32,
0x20, 0x73, 0x70, 0x61, 0x63, 0x65, 0x73, 0x0D, 0x0A, 0x0D, 0x0A, 0x64, 0x65, 0x73, 0x6B, 0x6C,
0x65, 0x6E, 0x73, 0x20, 0x2D, 0x20, 0x63, 0x61, 0x6D, 0x65, 0x72, 0x61, 0x20, 0x6E, 0x61, 0x6D,
0x65, 0x20, 0x66, 0x6F, 0x72, 0x20, 0x66, 0x69, 0x6C, 0x65, 0x73, 0x2C, 0x20, 0x6D, 0x64, 0x6E,
0x73, 0x2C, 0x20, 0x65, 0x74, 0x63, 0x0D, 0x0A, 0x31, 0x31, 0x20, 0x2D, 0x20, 0x66, 0x72, 0x61,
0x6D, 0x65, 0x73, 0x69, 0x7A, 0x65, 0x20, 0x31, 0x31, 0x20, 0x69, 0x73, 0x20, 0x68, 0x64, 0x20,
0x37, 0x32, 0x30, 0x70, 0x20, 0x31, 0x32, 0x38, 0x30, 0x78, 0x37, 0x32, 0x30, 0x0D, 0x0A, 0x20,
0x2D, 0x20, 0x66, 0x6F, 0x72, 0x20, 0x6F, 0x76, 0x32, 0x36, 0x34, 0x30, 0x20, 0x63, 0x61, 0x6D,
0x65, 0x72, 0x61, 0x20, 0x38, 0x3D, 0x76, 0x67, 0x61, 0x2C, 0x20, 0x39, 0x3D, 0x73, 0x76, 0x67,
0x61, 0x2C, 0x20, 0x31, 0x30, 0x3D, 0x78, 0x67, 0x61, 0x2C, 0x20, 0x31, 0x31, 0x3D, 0x68, 0x64,
0x2C, 0x20, 0x31, 0x32, 0x3D, 0x73, 0x78, 0x67, 0x61, 0x2C, 0x20, 0x31, 0x33, 0x3D, 0x75, 0x78,
0x67, 0x61, 0x0D, 0x0A, 0x20, 0x2D, 0x20, 0x66, 0x6F, 0x72, 0x20, 0x6F, 0x76, 0x35, 0x36, 0x34,
0x30, 0x20, 0x63, 0x61, 0x6D, 0x65, 0x72, 0x61, 0x20, 0x61, 0x64, 0x64, 0x20, 0x31, 0x34, 0x3D,
0x66, 0x68, 0x64, 0x2C, 0x20, 0x31, 0x37, 0x3D, 0x71, 0x78, 0x67, 0x61, 0x2C, 0x20, 0x31, 0x38,
0x3D, 0x71, 0x68, 0x64, 0x2C, 0x20, 0x32, 0x31, 0x3D, 0x71, 0x73, 0x78, 0x67, 0x61, 0x0D, 0x0A,
0x31, 0x38, 0x30, 0x30, 0x20, 0x2D, 0x20, 0x6C, 0x65, 0x6E, 0x67, 0x74, 0x68, 0x20, 0x6F, 0x66,
0x20, 0x76, 0x69, 0x64, 0x65, 0x6F, 0x20, 0x69, 0x6E, 0x20, 0x73, 0x65, 0x63, 0x6F, 0x6E, 0x64,
0x73, 0x0D, 0x0A, 0x30, 0x20, 0x2D, 0x20, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6C, 0x20,
0x2D, 0x20, 0x6D, 0x69, 0x6C, 0x6C, 0x69, 0x73, 0x65, 0x63, 0x6F, 0x6E, 0x64, 0x20, 0x62, 0x65,
0x74, 0x77, 0x65, 0x65, 0x6E, 0x20, 0x66, 0x72, 0x61, 0x6D, 0x65, 0x73, 0x20, 0x66, 0x6F, 0x72,
0x20, 0x72, 0x65, 0x63, 0x6F, 0x72, 0x64, 0x69, 0x6E, 0x67, 0x0D, 0x0A, 0x20, 0x2D, 0x20, 0x30,
0x20, 0x69, 0x73, 0x20, 0x61, 0x73, 0x20, 0x66, 0x61, 0x73, 0x74, 0x20, 0x61, 0x73, 0x20, 0x70,
0x6F, 0x73, 0x73, 0x69, 0x62, 0x6C, 0x65, 0x20, 0x62, 0x6F, 0x75, 0x6E, 0x64, 0x20, 0x62, 0x79,
0x20, 0x63, 0x61, 0x6D, 0x65, 0x72, 0x61, 0x20, 0x73, 0x70, 0x65, 0x65, 0x64, 0x20, 0x6F, 0x72,
0x20, 0x73, 0x64, 0x20, 0x77, 0x72, 0x69, 0x74, 0x69, 0x6E, 0x67, 0x20, 0x73, 0x70, 0x65, 0x65,
0x64, 0x0D, 0x0A, 0x20, 0x2D, 0x20, 0x35, 0x30, 0x30, 0x20, 0x69, 0x73, 0x20, 0x32, 0x20, 0x66,
0x72, 0x61, 0x6D, 0x65, 0x73, 0x20, 0x70, 0x65, 0x72, 0x20, 0x73, 0x65, 0x63, 0x6F, 0x6E, 0x64,
0x20, 0x28, 0x73, 0x75, 0x62, 0x6A, 0x65, 0x63, 0x74, 0x20, 0x74, 0x6F, 0x20, 0x62, 0x6F, 0x75,
0x6E, 0x64, 0x73, 0x29, 0x0D, 0x0A, 0x20, 0x2D, 0x20, 0x31, 0x30, 0x30, 0x30, 0x30, 0x20, 0x69,
0x73, 0x20, 0x30, 0x2E, 0x31, 0x20, 0x66, 0x72, 0x61, 0x6D, 0x65, 0x73, 0x20, 0x70, 0x65, 0x72,
0x20, 0x73, 0x65, 0x63, 0x6F, 0x6E, 0x64, 0x20, 0x6F, 0x72, 0x20, 0x31, 0x30, 0x20, 0x73, 0x65,
0x63, 0x6F, 0x6E, 0x64, 0x73, 0x20, 0x70, 0x65, 0x72, 0x20, 0x66, 0x72, 0x61, 0x6D, 0x65, 0x0D,
0x0A, 0x20, 0x2D, 0x20, 0x76, 0x67, 0x61, 0x20, 0x69, 0x73, 0x20, 0x6D, 0x61, 0x78, 0x20, 0x32,
0x35, 0x20, 0x66, 0x70, 0x73, 0x2C, 0x20, 0x68, 0x64, 0x20, 0x69, 0x73, 0x20, 0x6D, 0x61, 0x78,
0x20, 0x31, 0x32, 0x2E, 0x35, 0x20, 0x66, 0x70, 0x73, 0x2C, 0x20, 0x75, 0x78, 0x67, 0x61, 0x20,
0x61, 0x74, 0x20, 0x31, 0x32, 0x2E, 0x35, 0x20, 0x66, 0x70, 0x73, 0x20, 0x65, 0x74, 0x63, 0x0D,
0x0A, 0x31, 0x20, 0x2D, 0x20, 0x73, 0x70, 0x65, 0x65, 0x64, 0x75, 0x70, 0x20, 0x2D, 0x20, 0x6D,
0x75, 0x6C, 0x74, 0x69, 0x70, 0x6C, 0x79, 0x20, 0x66, 0x72, 0x61, 0x6D, 0x65, 0x72, 0x61, 0x74,
0x65, 0x20, 0x74, 0x6F, 0x20, 0x73, 0x70, 0x65, 0x65, 0x64, 0x20, 0x75, 0x70, 0x20, 0x70, 0x6C,
0x61, 0x79, 0x62, 0x61, 0x63, 0x6B, 0x0D, 0x0A, 0x20, 0x20, 0x2D, 0x20, 0x31, 0x20, 0x69, 0x73,
0x20, 0x72, 0x65, 0x61, 0x6C, 0x74, 0x69, 0x6D, 0x65, 0x0D, 0x0A, 0x20, 0x20, 0x2D, 0x20, 0x32,
0x34, 0x20, 0x77, 0x69, 0x6C, 0x6C, 0x20, 0x70, 0x6C, 0x61, 0x79, 0x20, 0x61, 0x20, 0x31, 0x20,
0x66, 0x70, 0x73, 0x20, 0x72, 0x65, 0x63, 0x6F, 0x72, 0x64, 0x69, 0x6E, 0x67, 0x20, 0x61, 0x74,
0x20, 0x32, 0x34, 0x20, 0x66, 0x70, 0x73, 0x20, 0x6F, 0x6E, 0x20, 0x79, 0x6F, 0x75, 0x72, 0x20,
0x63, 0x6F, 0x6D, 0x70, 0x75, 0x74, 0x65, 0x72, 0x0D, 0x0A, 0x20, 0x20, 0x2D, 0x20, 0x33, 0x30,
0x30, 0x20, 0x77, 0x69, 0x6C, 0x6C, 0x20, 0x70, 0x6C, 0x61, 0x79, 0x20, 0x31, 0x30, 0x20, 0x73,
0x65, 0x63, 0x20, 0x70, 0x65, 0x72, 0x20, 0x66, 0x72, 0x61, 0x6D, 0x65, 0x20, 0x61, 0x74, 0x20,
0x33, 0x30, 0x20, 0x66, 0x70, 0x73, 0x20, 0x6F, 0x6E, 0x20, 0x79, 0x6F, 0x75, 0x72, 0x20, 0x63,
0x6F, 0x6D, 0x70, 0x75, 0x74, 0x65, 0x72, 0x0D, 0x0A, 0x30, 0x20, 0x2D, 0x20, 0x73, 0x74, 0x72,
0x65, 0x61, 0x6D, 0x64, 0x65, 0x6C, 0x61, 0x79, 0x20, 0x2D, 0x20, 0x6D, 0x69, 0x6C, 0x6C, 0x69,
0x73, 0x65, 0x63, 0x6F, 0x6E, 0x64, 0x73, 0x20, 0x6F, 0x66, 0x20, 0x64, 0x65, 0x6C, 0x61, 0x79,
0x20, 0x62, 0x65, 0x74, 0x77, 0x65, 0x65, 0x6E, 0x20, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6D, 0x69,
0x6E, 0x67, 0x20, 0x66, 0x72, 0x61, 0x6D, 0x65, 0x73, 0x0D, 0x0A, 0x20, 0x2D, 0x20, 0x74, 0x68,
0x69, 0x73, 0x20, 0x61, 0x6C, 0x6C, 0x6F, 0x77, 0x73, 0x20, 0x79, 0x6F, 0x75, 0x20, 0x74, 0x6F,
0x20, 0x73, 0x6C, 0x6F, 0x77, 0x20, 0x64, 0x6F, 0x77, 0x6E, 0x20, 0x73, 0x74, 0x72, 0x65, 0x61,
0x6D, 0x69, 0x6E, 0x67, 0x20, 0x74, 0x6F, 0x20, 0x73, 0x61, 0x76, 0x65, 0x20, 0x62, 0x61, 0x74,
0x74, 0x65, 0x72, 0x79, 0x20, 0x70, 0x6F, 0x77, 0x65, 0x72, 0x20, 0x0D, 0x0A, 0x20, 0x20, 0x20,
0x20, 0x20, 0x61, 0x6E, 0x64, 0x20, 0x6E, 0x65, 0x74, 0x77, 0x6F, 0x72, 0x6B, 0x20, 0x75, 0x73,
0x61, 0x67, 0x65, 0x0D, 0x0A, 0x20, 0x2D, 0x20, 0x61, 0x6C, 0x73, 0x6F, 0x20, 0x61, 0x6C, 0x6C,
0x6F, 0x77, 0x73, 0x20, 0x61, 0x20, 0x66, 0x69, 0x78, 0x65, 0x64, 0x20, 0x72, 0x61, 0x74, 0x65,
0x20, 0x69, 0x66, 0x20, 0x79, 0x6F, 0x75, 0x20, 0x61, 0x72, 0x65, 0x20, 0x72, 0x65, 0x63, 0x6F,
0x72, 0x64, 0x69, 0x6E, 0x67, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6D,
0x20, 0x61, 0x74, 0x20, 0x79, 0x6F, 0x75, 0x72, 0x20, 0x63, 0x6F, 0x6D, 0x70, 0x75, 0x74, 0x65,
0x72, 0x0D, 0x0A, 0x20, 0x2D, 0x20, 0x76, 0x67, 0x61, 0x20, 0x77, 0x69, 0x6C, 0x6C, 0x20, 0x73,
0x74, 0x72, 0x65, 0x61, 0x6D, 0x20, 0x61, 0x62, 0x6F, 0x75, 0x74, 0x20, 0x33, 0x30, 0x2D, 0x33,
0x33, 0x20, 0x66, 0x70, 0x73, 0x20, 0x64, 0x65, 0x70, 0x65, 0x6E, 0x64, 0x69, 0x6E, 0x67, 0x20,
0x6F, 0x6E, 0x20, 0x77, 0x69, 0x66, 0x69, 0x20, 0x61, 0x6E, 0x64, 0x20, 0x62, 0x72, 0x69, 0x67,
0x68, 0x74, 0x6E, 0x65, 0x73, 0x73, 0x20, 0x63, 0x6F, 0x6C, 0x6F, 0x72, 0x73, 0x20, 0x0D, 0x0A,
0x20, 0x20, 0x20, 0x20, 0x69, 0x6E, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6A, 0x70, 0x65, 0x67, 0x0D,
0x0A, 0x20, 0x2D, 0x20, 0x68, 0x64, 0x20, 0x77, 0x69, 0x6C, 0x6C, 0x20, 0x73, 0x74, 0x72, 0x65,
0x61, 0x6D, 0x20, 0x61, 0x62, 0x6F, 0x75, 0x74, 0x20, 0x31, 0x30, 0x2D, 0x31, 0x32, 0x20, 0x66,
0x70, 0x73, 0x20, 0x0D, 0x0A, 0x20, 0x2D, 0x20, 0x75, 0x78, 0x67, 0x61, 0x20, 0x77, 0x69, 0x6C,
0x6C, 0x20, 0x6F, 0x6E, 0x6C, 0x79, 0x20, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6D, 0x20, 0x61, 0x74,
0x20, 0x33, 0x20, 0x66, 0x70, 0x73, 0x20, 0x0D, 0x0A, 0x47, 0x4D, 0x54, 0x20, 0x2D, 0x20, 0x74,
0x69, 0x6D, 0x65, 0x7A, 0x6F, 0x6E, 0x65, 0x20, 0x66, 0x6F, 0x72, 0x20, 0x64, 0x61, 0x74, 0x65,
0x73, 0x20, 0x61, 0x6E, 0x64, 0x20, 0x74, 0x69, 0x6D, 0x65, 0x73, 0x20, 0x6F, 0x6E, 0x20, 0x79,
0x6F, 0x75, 0x72, 0x20, 0x66, 0x69, 0x6C, 0x65, 0x73, 0x0D, 0x0A, 0x20, 0x20, 0x2D, 0x20, 0x6D,
0x6F, 0x75, 0x6E, 0x74, 0x61, 0x69, 0x6E, 0x3A, 0x20, 0x4D, 0x53, 0x54, 0x37, 0x4D, 0x44, 0x54,
0x2C, 0x4D, 0x33, 0x2E, 0x32, 0x2E, 0x30, 0x2F, 0x32, 0x3A, 0x30, 0x30, 0x3A, 0x30, 0x30, 0x2C,
0x4D, 0x31, 0x31, 0x2E, 0x31, 0x2E, 0x30, 0x2F, 0x32, 0x3A, 0x30, 0x30, 0x3A, 0x30, 0x30, 0x0D,
0x0A, 0x20, 0x20, 0x2D, 0x20, 0x65, 0x61, 0x73, 0x74, 0x65, 0x72, 0x6E, 0x3A, 0x20, 0x45, 0x53,
0x54, 0x35, 0x45, 0x44, 0x54, 0x2C, 0x4D, 0x33, 0x2E, 0x32, 0x2E, 0x30, 0x2C, 0x4D, 0x31, 0x31,
0x2E, 0x31, 0x2E, 0x30, 0x0D, 0x0A, 0x20, 0x20, 0x2D, 0x20, 0x63, 0x65, 0x6E, 0x74, 0x72, 0x61,
0x6C, 0x20, 0x65, 0x75, 0x72, 0x6F, 0x70, 0x65, 0x3A, 0x20, 0x43, 0x45, 0x54, 0x2D, 0x31, 0x43,
0x45, 0x53, 0x54, 0x2D, 0x32, 0x2C, 0x4D, 0x33, 0x2E, 0x35, 0x2E, 0x30, 0x2F, 0x30, 0x32, 0x3A,
0x30, 0x30, 0x3A, 0x30, 0x30, 0x2C, 0x4D, 0x31, 0x30, 0x2E, 0x35, 0x2E, 0x30, 0x2F, 0x30, 0x33,
0x3A, 0x30, 0x30, 0x3A, 0x30, 0x30, 0x0D, 0x0A, 0x20, 0x20, 0x2D, 0x20, 0x55, 0x6C, 0x61, 0x61,
0x6E, 0x62, 0x61, 0x61, 0x74, 0x61, 0x72, 0x2C, 0x20, 0x4D, 0x6F, 0x6E, 0x67, 0x6F, 0x6C, 0x69,
0x61, 0x3A, 0x20, 0x55, 0x4C, 0x41, 0x54, 0x2D, 0x38, 0x55, 0x4C, 0x41, 0x53, 0x54, 0x2C, 0x4D,
0x33, 0x2E, 0x35, 0x2E, 0x30, 0x2F, 0x32, 0x2C, 0x4D, 0x39, 0x2E, 0x35, 0x2E, 0x30, 0x2F, 0x32,
0x20, 0x0D, 0x0A, 0x20, 0x20, 0x2D, 0x20, 0x66, 0x69, 0x6E, 0x64, 0x20, 0x74, 0x69, 0x6D, 0x65,
0x7A, 0x6F, 0x6E, 0x65, 0x20, 0x68, 0x65, 0x72, 0x65, 0x3A, 0x20, 0x0D, 0x0A, 0x20, 0x20, 0x20,
0x20, 0x20, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3A, 0x2F, 0x2F, 0x73, 0x69, 0x74, 0x65, 0x73, 0x2E,
0x67, 0x6F, 0x6F, 0x67, 0x6C, 0x65, 0x2E, 0x63, 0x6F, 0x6D, 0x2F, 0x61, 0x2F, 0x75, 0x73, 0x61,
0x70, 0x69, 0x65, 0x6E, 0x73, 0x2E, 0x63, 0x6F, 0x6D, 0x2F, 0x6F, 0x70, 0x6E, 0x6F, 0x64, 0x65,
0x2F, 0x74, 0x69, 0x6D, 0x65, 0x2D, 0x7A, 0x6F, 0x6E, 0x65, 0x73, 0x0D, 0x0A, 0x73, 0x73, 0x69,
0x64, 0x31, 0x32, 0x33, 0x34, 0x20, 0x2D, 0x20, 0x79, 0x6F, 0x75, 0x72, 0x20, 0x77, 0x69, 0x66,
0x69, 0x20, 0x73, 0x73, 0x69, 0x64, 0x20, 0x75, 0x73, 0x65, 0x72, 0x6E, 0x61, 0x6D, 0x65, 0x0D,
0x0A, 0x20, 0x2D, 0x20, 0x65, 0x6E, 0x74, 0x65, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6B, 0x65,
0x79, 0x77, 0x6F, 0x72, 0x64, 0x20, 0x22, 0x77, 0x69, 0x66, 0x69, 0x6D, 0x61, 0x6E, 0x22, 0x20,
0x74, 0x6F, 0x20, 0x6C, 0x61, 0x75, 0x6E, 0x63, 0x68, 0x20, 0x74, 0x68, 0x65, 0x20, 0x57, 0x69,
0x46, 0x69, 0x4D, 0x61, 0x6E, 0x61, 0x67, 0x65, 0x72, 0x20, 0x74, 0x6F, 0x20, 0x63, 0x6F, 0x6E,
0x66, 0x69, 0x67, 0x75, 0x72, 0x65, 0x20, 0x0D, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x79, 0x6F,
0x75, 0x72, 0x20, 0x73, 0x73, 0x69, 0x64, 0x2F, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6F, 0x72, 0x64,
0x20, 0x61, 0x74, 0x20, 0x74, 0x68, 0x65, 0x20, 0x77, 0x65, 0x62, 0x20, 0x70, 0x6F, 0x72, 0x74,
0x61, 0x6C, 0x20, 0x31, 0x39, 0x32, 0x2E, 0x31, 0x36, 0x38, 0x2E, 0x34, 0x2E, 0x31, 0x20, 0x6F,
0x72, 0x20, 0x45, 0x53, 0x50, 0x33, 0x32, 0x2D, 0x43, 0x41, 0x4D, 0x0D, 0x0A, 0x20, 0x2D, 0x20,
0x65, 0x6E, 0x74, 0x65, 0x72, 0x20, 0x6B, 0x65, 0x79, 0x77, 0x6F, 0x72, 0x64, 0x20, 0x22, 0x73,
0x73, 0x69, 0x64, 0x31, 0x32, 0x33, 0x34, 0x22, 0x20, 0x66, 0x6F, 0x72, 0x20, 0x6E, 0x6F, 0x20,
0x77, 0x69, 0x66, 0x69, 0x0D, 0x0A, 0x6D, 0x72, 0x70, 0x65, 0x61, 0x6E, 0x75, 0x74, 0x20, 0x2D,
0x20, 0x79, 0x6F, 0x75, 0x72, 0x20, 0x77, 0x69, 0x66, 0x69, 0x20, 0x73, 0x73, 0x69, 0x64, 0x20,
0x70, 0x61, 0x73, 0x73, 0x77, 0x6F, 0x72, 0x64, 0x0D, 0x0A, 0x0D, 0x0A, 0x53, 0x6F, 0x75, 0x72,
0x63, 0x65, 0x43, 0x6F, 0x64, 0x65, 0x3A, 0x20, 0x20, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3A, 0x2F,
0x2F, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2E, 0x63, 0x6F, 0x6D, 0x2F, 0x6A, 0x61, 0x6D, 0x65,
0x73, 0x7A, 0x61, 0x68, 0x2F, 0x45, 0x53, 0x50, 0x33, 0x32, 0x2D, 0x43, 0x41, 0x4D, 0x2D, 0x56,
0x69, 0x64, 0x65, 0x6F, 0x2D, 0x52, 0x65, 0x63, 0x6F, 0x72, 0x64, 0x65, 0x72, 0x2D, 0x6A, 0x75,
0x6E, 0x69, 0x6F, 0x72, 0x0D, 0x0A, 0x4F, 0x6E, 0x65, 0x2D, 0x43, 0x6C, 0x69, 0x63, 0x6B, 0x20,
0x49, 0x6E, 0x73, 0x74, 0x61, 0x6C, 0x6C, 0x65, 0x72, 0x3A, 0x20, 0x68, 0x74, 0x74, 0x70, 0x73,
0x3A, 0x2F, 0x2F, 0x6A, 0x61, 0x6D, 0x65, 0x73, 0x7A, 0x61, 0x68, 0x2E, 0x67, 0x69, 0x74, 0x68,
0x75, 0x62, 0x2E, 0x69, 0x6F, 0x2F, 0x45, 0x53, 0x50, 0x33, 0x32, 0x2D, 0x43, 0x41, 0x4D, 0x2D,
0x56, 0x69, 0x64, 0x65, 0x6F, 0x43, 0x61, 0x6D, 0x2F, 0x0D, 0x0A, 0x4A, 0x61, 0x6D, 0x65, 0x73,
0x20, 0x5A, 0x61, 0x68, 0x61, 0x72, 0x79, 0x20, 0x2D, 0x20, 0x4A, 0x61, 0x6E, 0x20, 0x31, 0x31,
0x2C, 0x20, 0x32, 0x30, 0x32, 0x32, 0x0D, 0x0A, 0x0D, 0x0A
};
void read_config_file() { void read_config_file() {
// if there is a config.txt, use it plus defaults
// else use defaults, and create a config.txt
// put a file "config.txt" onto SD card, to set parameters different from your hardcoded parameters // put a file "config.txt" onto SD card, to set parameters different from your hardcoded parameters
// it should look like this - one paramter per line, in the correct order, followed by 2 spaces, and any comments you choose // it should look like this - one paramter per line, in the correct order, followed by 2 spaces, and any comments you choose
/* /*
~~~ old config.txt file ~~~
desklens // camera name for files, mdns, etc desklens // camera name for files, mdns, etc
11 // framesize 9=svga, 10=xga, 11=hd, 12=sxga, 13=uxga, 14=fhd, 17=qxga, 18=qhd, 21=qsxga 11 // framesize 9=svga, 10=xga, 11=hd, 12=sxga, 13=uxga, 14=fhd, 17=qxga, 18=qhd, 21=qsxga
8 // quality 0-63, lower the better, 10 good start, must be higher than "quality config" 8 // quality 0-63, lower the better, 10 good start, must be higher than "quality config"
@ -529,40 +687,56 @@ void read_config_file() {
ssid1234 // ssid ssid1234 // ssid
mrpeanut // ssid password mrpeanut // ssid password
~~~ new config.txt file ~~~
desklens // camera name
11 // framesize 11=hd
1800 // length of video in seconds
0 // interval - ms between recording frames
1 // speedup - multiply framerate
0 // streamdelay - ms between streaming frames
GMT // timezone
ssid1234 // ssid wifi name
mrpeanut // ssid password
~~~
Lines above are rigid - do not delete lines, must have 2 spaces after the number or string Lines above are rigid - do not delete lines, must have 2 spaces after the number or string
*/ */
String junk;
String cname = "desklens";
int cframesize = 11;
int cquality = 12;
int cframesizeconfig = 13;
int cqualityconfig = 5;
int cbuffersconfig = 3;
int clength = 1800;
int cinterval = 0;
int cspeedup = 1;
int cstreamdelay = 0;
int cinternet = 0;
String czone = "GMT";
cssid = "ssid1234";
cpass = "mrpeanut";
File config_file = SD_MMC.open("/config.txt", "r"); File config_file = SD_MMC.open("/config.txt", "r");
if (!config_file) { if (config_file) {
Serial.println("Failed to open config_file for reading");
} else { Serial.println("Reading simple.txt");
String junk; cname = config_file.readStringUntil(' ');
Serial.println("Reading config.txt");
String cname = config_file.readStringUntil(' ');
junk = config_file.readStringUntil('\n'); junk = config_file.readStringUntil('\n');
int cframesize = config_file.parseInt(); cframesize = config_file.parseInt();
junk = config_file.readStringUntil('\n');
int cquality = config_file.parseInt();
junk = config_file.readStringUntil('\n'); junk = config_file.readStringUntil('\n');
int cframesizeconfig = config_file.parseInt(); clength = config_file.parseInt();
junk = config_file.readStringUntil('\n'); junk = config_file.readStringUntil('\n');
int cqualityconfig = config_file.parseInt(); cinterval = config_file.parseInt();
junk = config_file.readStringUntil('\n'); junk = config_file.readStringUntil('\n');
int cbuffersconfig = config_file.parseInt(); cspeedup = config_file.parseInt();
junk = config_file.readStringUntil('\n'); junk = config_file.readStringUntil('\n');
cstreamdelay = config_file.parseInt();
int clength = config_file.parseInt();
junk = config_file.readStringUntil('\n'); junk = config_file.readStringUntil('\n');
int cinterval = config_file.parseInt(); czone = config_file.readStringUntil(' ');
junk = config_file.readStringUntil('\n');
int cspeedup = config_file.parseInt();
junk = config_file.readStringUntil('\n');
int cstreamdelay = config_file.parseInt();
junk = config_file.readStringUntil('\n');
int cinternet = config_file.parseInt();
junk = config_file.readStringUntil('\n');
String czone = config_file.readStringUntil(' ');
junk = config_file.readStringUntil('\n'); junk = config_file.readStringUntil('\n');
cssid = config_file.readStringUntil(' '); cssid = config_file.readStringUntil(' ');
junk = config_file.readStringUntil('\n'); junk = config_file.readStringUntil('\n');
@ -570,39 +744,55 @@ void read_config_file() {
junk = config_file.readStringUntil('\n'); junk = config_file.readStringUntil('\n');
config_file.close(); config_file.close();
Serial.printf("========= Data fram config.txt =========\n"); if (String(cssid) == "ssid1234") {
Serial.printf("Name %s\n", cname); logfile.printf("Name %s\n", cname); cinternet = 0;
Serial.printf("Framesize %d\n", cframesize); logfile.printf("Framesize %d\n", cframesize); } else if (String(cssid) == "wifiman") {
Serial.printf("Quality %d\n", cquality); logfile.printf("Quality %d\n", cquality); cinternet = 2;
Serial.printf("Framesize config %d\n", cframesizeconfig); logfile.printf("Framesize config%d\n", cframesizeconfig); } else {
Serial.printf("Quality config %d\n", cqualityconfig); logfile.printf("Quality config%d\n", cqualityconfig); cinternet = 4;
Serial.printf("Buffers config %d\n", cbuffersconfig); logfile.printf("Buffers config %d\n", cbuffersconfig); }
Serial.printf("Length %d\n", clength); logfile.printf("Length %d\n", clength); } else {
Serial.printf("Interval %d\n", cinterval); logfile.printf("Interval %d\n", cinterval); Serial.println("Failed to open config.txt - writing a default");
Serial.printf("Speedup %d\n", cspeedup); logfile.printf("Speedup %d\n", cspeedup);
Serial.printf("Streamdelay %d\n", cstreamdelay); logfile.printf("Streamdelay %d\n", cstreamdelay);
Serial.printf("Internet %d\n", cinternet); logfile.printf("Internet %d\n", cinternet);
//Serial.printf("Zone len %d, %s\n", czone.length(), czone); //logfile.printf("Zone len %d, %s\n", czone.length(), czone);
Serial.printf("Zone len %d\n", czone.length()); logfile.printf("Zone len %d\n", czone.length());
Serial.printf("ssid %s\n", cssid); logfile.printf("ssid %s\n", cssid);
Serial.printf("pass %s\n", cpass); logfile.printf("pass %s\n", cpass);
// lets make a simple.txt config file
File new_simple = SD_MMC.open("/config.txt", "w");
new_simple.print(simple_txt);
new_simple.close();
framesize = cframesize;
quality = cquality;
framesizeconfig = cframesizeconfig;
qualityconfig = cqualityconfig;
buffersconfig = cbuffersconfig;
avi_length = clength;
frame_interval = cinterval;
speed_up_factor = cspeedup;
stream_delay = cstreamdelay;
IncludeInternet = cinternet;
configfile = true;
TIMEZONE = czone;
cname.toCharArray(devname, cname.length() + 1);
} }
Serial.printf("========= Data fram config.txt and defaults =========\n");
Serial.printf("Name %s\n", cname); logfile.printf("Name %s\n", cname);
Serial.printf("Framesize %d\n", cframesize); logfile.printf("Framesize %d\n", cframesize);
Serial.printf("Quality %d\n", cquality); logfile.printf("Quality %d\n", cquality);
Serial.printf("Framesize config %d\n", cframesizeconfig); logfile.printf("Framesize config%d\n", cframesizeconfig);
Serial.printf("Quality config %d\n", cqualityconfig); logfile.printf("Quality config%d\n", cqualityconfig);
Serial.printf("Buffers config %d\n", cbuffersconfig); logfile.printf("Buffers config %d\n", cbuffersconfig);
Serial.printf("Length %d\n", clength); logfile.printf("Length %d\n", clength);
Serial.printf("Interval %d\n", cinterval); logfile.printf("Interval %d\n", cinterval);
Serial.printf("Speedup %d\n", cspeedup); logfile.printf("Speedup %d\n", cspeedup);
Serial.printf("Streamdelay %d\n", cstreamdelay); logfile.printf("Streamdelay %d\n", cstreamdelay);
Serial.printf("Internet %d\n", cinternet); logfile.printf("Internet %d\n", cinternet);
Serial.printf("Zone len %d, %s\n", czone.length(), czone.c_str()); //logfile.printf("Zone len %d, %s\n", czone.length(), czone);
Serial.printf("ssid %s\n", cssid); logfile.printf("ssid %s\n", cssid);
Serial.printf("pass %s\n", cpass); logfile.printf("pass %s\n", cpass);
framesize = cframesize;
quality = cquality;
framesizeconfig = cframesizeconfig;
qualityconfig = cqualityconfig;
buffersconfig = cbuffersconfig;
avi_length = clength;
frame_interval = cinterval;
speed_up_factor = cspeedup;
stream_delay = cstreamdelay;
IncludeInternet = cinternet;
configfile = true;
TIMEZONE = czone;
cname.toCharArray(devname, cname.length() + 1);
} }
@ -1279,9 +1469,9 @@ bool init_wifi()
if (IncludeInternet >= 3) { if (IncludeInternet >= 3) {
WiFi.disconnect(true, true); WiFi.disconnect(true, true);
WiFi.mode(WIFI_STA); //WiFi.mode(WIFI_STA); // https://github.com/espressif/arduino-esp32/issues/6086
WiFi.setHostname(devname); WiFi.setHostname(devname);
WiFi.mode(WIFI_STA);
char ssidch[20]; char ssidch[20];
char passch[20]; char passch[20];
cssid.toCharArray(ssidch, cssid.length() + 1); cssid.toCharArray(ssidch, cssid.length() + 1);
@ -1329,7 +1519,7 @@ bool init_wifi()
}); });
} else { } else {
WiFi.mode(WIFI_STA); // https://github.com/espressif/arduino-esp32/issues/6086
WiFiManager wm; WiFiManager wm;
bool res; bool res;
wm.setHostname(devname); wm.setHostname(devname);
@ -1487,6 +1677,7 @@ static esp_err_t index_handler(httpd_req_t *req) {
<h3><a href="http://%s/stream">Stream </a></h3> <h3><a href="http://%s/stream">Stream </a></h3>
<h3><a href="http://%s/photos">Photos - 10 saveable photos every 3 seconds </a></h3> <h3><a href="http://%s/photos">Photos - 10 saveable photos every 3 seconds </a></h3>
<h3><a href="http://%s:%d">File Manager - download, delete, edit </a></h3> <h3><a href="http://%s:%d">File Manager - download, delete, edit </a></h3>
<h3></h3>
<h3><a href="http://%s/reboot">End recording, and reboot </a></h3> <h3><a href="http://%s/reboot">End recording, and reboot </a></h3>
</body> </body>
</html>)rawliteral"; </html>)rawliteral";
@ -1587,7 +1778,7 @@ static esp_err_t reboot_handler(httpd_req_t *req) {
//start_record = 0; //start_record = 0;
reboot_now = true; reboot_now = true;
const char the_message[] = "Status"; const char the_message[] = "Status";
time(&now); time(&now);
@ -1614,7 +1805,7 @@ static esp_err_t reboot_handler(httpd_req_t *req) {
httpd_resp_send(req, the_page, strlen(the_page)); httpd_resp_send(req, the_page, strlen(the_page));
time_in_web1 += (millis() - start); time_in_web1 += (millis() - start);
return ESP_OK; return ESP_OK;
} }
@ -1784,13 +1975,13 @@ void startCameraServer() {
.user_ctx = NULL .user_ctx = NULL
}; };
httpd_uri_t reboot_uri = { httpd_uri_t reboot_uri = {
.uri = "/reboot", .uri = "/reboot",
.method = HTTP_GET, .method = HTTP_GET,
.handler = reboot_handler, .handler = reboot_handler,
.user_ctx = NULL .user_ctx = NULL
}; };
if (httpd_start(&camera_httpd, &config) == ESP_OK) { if (httpd_start(&camera_httpd, &config) == ESP_OK) {
httpd_register_uri_handler(camera_httpd, &index_uri); httpd_register_uri_handler(camera_httpd, &index_uri);
httpd_register_uri_handler(camera_httpd, &capture_uri); httpd_register_uri_handler(camera_httpd, &capture_uri);
@ -1890,6 +2081,11 @@ void setup() {
Serial.println("Starting the wifi ..."); Serial.println("Starting the wifi ...");
init_wifi(); init_wifi();
InternetOff = false; InternetOff = false;
} else {
Serial.println("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
Serial.println("You have not wifi - no streamning, no file manager");
Serial.println("Put your ssid and password in config.txt on the sd card");
Serial.println("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
} }
Serial.println("Setting up the camera ..."); Serial.println("Setting up the camera ...");
@ -1918,7 +2114,7 @@ void setup() {
wait_for_sd = xSemaphoreCreateBinary(); //xSemaphoreCreateMutex(); wait_for_sd = xSemaphoreCreateBinary(); //xSemaphoreCreateMutex();
sd_go = xSemaphoreCreateBinary(); //xSemaphoreCreateMutex(); sd_go = xSemaphoreCreateBinary(); //xSemaphoreCreateMutex();
// prio 3 - higher than the camera loop(), and the streaming // prio 3 - higher than the camera loop(), and the streaming
xTaskCreatePinnedToCore( the_camera_loop, "the_camera_loop", 3000, NULL, 6, &the_camera_loop_task, 0); // prio 3, core 0 //v56 core 1 as http dominating 0 ... back to 0, raise prio xTaskCreatePinnedToCore( the_camera_loop, "the_camera_loop", 3000, NULL, 6, &the_camera_loop_task, 0); // prio 3, core 0 //v56 core 1 as http dominating 0 ... back to 0, raise prio
@ -1934,14 +2130,16 @@ void setup() {
const char *strdate = ctime(&now); const char *strdate = ctime(&now);
logfile.println(strdate); logfile.println(strdate);
filemgr.begin(); if ( !InternetOff && IncludeInternet > 1) {
filemgr.setBackGroundColor("Gray"); filemgr.begin();
filemgr.setBackGroundColor("Gray");
Serial.print("Open Filemanager with http://"); Serial.print("Open Filemanager with http://");
Serial.print(WiFi.localIP()); Serial.print(WiFi.localIP());
Serial.print(":"); Serial.print(":");
Serial.print(filemanagerport); Serial.print(filemanagerport);
Serial.print("/"); Serial.print("/");
Serial.println(); Serial.println();
}
Serial.println(" End of setup()\n\n"); Serial.println(" End of setup()\n\n");
} }
@ -1954,7 +2152,7 @@ void the_sd_loop (void* pvParameter) {
Serial.print("the_sd_loop, core "); Serial.print(xPortGetCoreID()); Serial.print("the_sd_loop, core "); Serial.print(xPortGetCoreID());
Serial.print(", priority = "); Serial.println(uxTaskPriorityGet(NULL)); Serial.print(", priority = "); Serial.println(uxTaskPriorityGet(NULL));
while (1) { while (1) {
xSemaphoreTake( sd_go, portMAX_DELAY ); // we wait for camera loop to tell us to go xSemaphoreTake( sd_go, portMAX_DELAY ); // we wait for camera loop to tell us to go
another_save_avi( fb_curr); // do the actual sd wrte another_save_avi( fb_curr); // do the actual sd wrte
@ -1965,12 +2163,13 @@ void the_sd_loop (void* pvParameter) {
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// the_camera_loop() // the_camera_loop()
int delete_old_stuff_flag = 0;
void the_camera_loop (void* pvParameter) { void the_camera_loop (void* pvParameter) {
Serial.print("the camera loop, core "); Serial.print(xPortGetCoreID()); Serial.print("the camera loop, core "); Serial.print(xPortGetCoreID());
Serial.print(", priority = "); Serial.println(uxTaskPriorityGet(NULL)); Serial.print(", priority = "); Serial.println(uxTaskPriorityGet(NULL));
frame_cnt = 0; frame_cnt = 0;
start_record_2nd_opinion = digitalRead(12); start_record_2nd_opinion = digitalRead(12);
start_record_1st_opinion = digitalRead(12); start_record_1st_opinion = digitalRead(12);
@ -2000,7 +2199,7 @@ void the_camera_loop (void* pvParameter) {
we_are_already_stopped = 0; we_are_already_stopped = 0;
//delete_old_stuff(); // move to loop //delete_old_stuff(); // move to loop
avi_start_time = millis(); avi_start_time = millis();
Serial.printf("\nStart the avi ... at %d\n", avi_start_time); Serial.printf("\nStart the avi ... at %d\n", avi_start_time);
@ -2049,6 +2248,9 @@ void the_camera_loop (void* pvParameter) {
digitalWrite(33, HIGH); // light off digitalWrite(33, HIGH); // light off
delete_old_stuff_flag = 1;
delay(50);
avi_end_time = millis(); avi_end_time = millis();
float fps = 1.0 * frame_cnt / ((avi_end_time - avi_start_time) / 1000) ; float fps = 1.0 * frame_cnt / ((avi_end_time - avi_start_time) / 1000) ;
@ -2116,14 +2318,16 @@ void the_camera_loop (void* pvParameter) {
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// loop() - loop runs at low prio, so I had to move it to the task the_camera_loop at higher priority // loop() - loop runs at low prio, so I had to move it to the task the_camera_loop at higher priority
long next_delete = 1000; //long next_delete = 1000;
void loop() { void loop() {
long run_time = millis() - boot_time; long run_time = millis() - boot_time;
if ( millis() > next_delete){ // if ( millis() > next_delete){
next_delete = millis() + (15 * 60 * 1000); // next_delete = millis() + (15 * 60 * 1000);
delete_old_stuff(); if (delete_old_stuff_flag == 1) {
delete_old_stuff_flag = 0;
delete_old_stuff();
} }
start_record_2nd_opinion = start_record_1st_opinion; start_record_2nd_opinion = start_record_1st_opinion;
start_record_1st_opinion = digitalRead(12); start_record_1st_opinion = digitalRead(12);
@ -2148,6 +2352,7 @@ void loop() {
if (IncludeInternet > 1) { if (IncludeInternet > 1) {
if (read13 == 2 && !InternetOff) { if (read13 == 2 && !InternetOff) {
Serial.println("Shutting off wifi ..."); logfile.println("Shutting off wifi ..."); Serial.println("Shutting off wifi ..."); logfile.println("Shutting off wifi ...");
filemgr.end();
stopCameraServer(); stopCameraServer();
WiFiManager wm; WiFiManager wm;
wm.disconnect(); wm.disconnect();
@ -2158,6 +2363,7 @@ void loop() {
init_wifi(); init_wifi();
Serial.println("Starting Web Services ..."); Serial.println("Starting Web Services ...");
startCameraServer(); startCameraServer();
filemgr.begin();
InternetOff = false; InternetOff = false;
} }
} }
@ -2167,8 +2373,9 @@ void loop() {
delay(2000); delay(2000);
ESP.restart(); ESP.restart();
} }
if (!InternetOff) {
filemgr.handleClient(); //v56 filemgr.handleClient(); //v56
}
delay(200); delay(200);
} }