From 55bdcecf843497d59a857c9c772ac7c181c74131 Mon Sep 17 00:00:00 2001 From: Miroslav Pivovarsky Date: Mon, 27 May 2024 17:42:44 +0200 Subject: [PATCH] added saving image snapshot to micro SD card --- .../ESP32_PrusaConnectCam.ino | 2 + ESP32_PrusaConnectCam/WebPage.h | 716 +++++++++--------- ESP32_PrusaConnectCam/camera.cpp | 45 +- ESP32_PrusaConnectCam/camera.h | 2 + ESP32_PrusaConnectCam/cfg.cpp | 40 +- ESP32_PrusaConnectCam/cfg.h | 4 +- ESP32_PrusaConnectCam/connect.cpp | 76 +- ESP32_PrusaConnectCam/connect.h | 5 + ESP32_PrusaConnectCam/log.cpp | 47 +- ESP32_PrusaConnectCam/log.h | 3 +- ESP32_PrusaConnectCam/mcu_cfg.h | 57 +- ESP32_PrusaConnectCam/micro_sd.cpp | 215 +++++- ESP32_PrusaConnectCam/micro_sd.h | 27 +- ESP32_PrusaConnectCam/server.cpp | 72 +- ESP32_PrusaConnectCam/server.h | 2 + ESP32_PrusaConnectCam/system.cpp | 63 +- ESP32_PrusaConnectCam/system.h | 9 +- ESP32_PrusaConnectCam/var.cpp | 4 + ESP32_PrusaConnectCam/var.h | 4 + ESP32_PrusaConnectCam/wifi_mngt.cpp | 6 +- webpage/index.html | 23 +- webpage/page_auth.html | 2 - webpage/page_config.html | 12 +- webpage/page_system.html | 25 +- webpage/page_wifi.html | 9 - webpage/scripts.js | 15 + webpage/styles.css | 624 ++++++++------- 27 files changed, 1272 insertions(+), 837 deletions(-) diff --git a/ESP32_PrusaConnectCam/ESP32_PrusaConnectCam.ino b/ESP32_PrusaConnectCam/ESP32_PrusaConnectCam.ino index 7c75475..86716cf 100644 --- a/ESP32_PrusaConnectCam/ESP32_PrusaConnectCam.ino +++ b/ESP32_PrusaConnectCam/ESP32_PrusaConnectCam.ino @@ -123,6 +123,7 @@ void setup() { xTaskCreatePinnedToCore(System_TaskStreamTelemetry, "PrintStreamTelemetry", 3300, NULL, 6, &Task_StreamTelemetry, 0); /*function, description, stack size, parameters, priority, task handle, core*/ xTaskCreatePinnedToCore(System_TaskSysLed, "SystemLed", 3000, NULL, 7, &Task_SysLed, 0); /*function, description, stack size, parameters, priority, task handle, core*/ xTaskCreatePinnedToCore(System_TaskWiFiWatchdog, "WiFiWatchdog", 3500, NULL, 8, &Task_WiFiWatchdog, 0); /*function, description, stack size, parameters, priority, task handle, core*/ + //xTaskCreatePinnedToCore(System_TaskSdCardRemove, "SdCardRemove", 3000, NULL, 9, &Task_SdCardFileRemove, 0); /*function, description, stack size, parameters, priority, task handle, core*/ /* init wdg */ SystemLog.AddEvent(LogLevel_Info, F("Init WDG")); @@ -136,6 +137,7 @@ void setup() { esp_task_wdt_add(Task_StreamTelemetry); esp_task_wdt_add(Task_SysLed); esp_task_wdt_add(Task_WiFiWatchdog); + //esp_task_wdt_add(Task_SdCardFileRemove); esp_task_wdt_reset(); /* reset wdg */ SystemLog.AddEvent(LogLevel_Info, F("MCU configuration done")); diff --git a/ESP32_PrusaConnectCam/WebPage.h b/ESP32_PrusaConnectCam/WebPage.h index 254768d..e48a800 100644 --- a/ESP32_PrusaConnectCam/WebPage.h +++ b/ESP32_PrusaConnectCam/WebPage.h @@ -14,13 +14,13 @@ #ifndef _WEB_PAGE_H_ #define _WEB_PAGE_H_ -#define MSG_REBOOT_MCU "Reboot process started, wait several seconds for mcu to boot up. You can close this window now." +#define MSG_REBOOT_MCU "Reboot process started, wait several seconds for mcu to boot up. You can close this window now" #define MSG_SAVE_OK_REBOOT "Save OK. Please reboot MCU" ///< WEB app msg save OK -#define MSG_SAVE_OK_WIFI "Save OK. Connecting to Wi-Fi. Please wait several second." +#define MSG_SAVE_OK_WIFI "Save OK. Connecting to Wi-Fi. Please wait several second" #define MSG_SAVE_OK "Save cfg OK" ///< WEB app msg save OK #define MSG_SAVE_NOTOK "Save cfg NOT OK!" ///< WEB app msg save NOT OK #define MSG_SCANNING "Scanning Wi-Fi networks. Wait 8s..." ///< WEB app msg Scanning wifi -#define MSG_UPDATE_START "Start updating." +#define MSG_UPDATE_START "Start updating" /* ------------------------------------------------------------------------------------------------------------ */ const char index_html[] PROGMEM = R"rawliteral( @@ -40,7 +40,6 @@ const char index_html[] PROGMEM = R"rawliteral( $("#content").load(page); setActive(this); }); - $("#content").load("page_config.html", function() { var defaultLink = document.querySelector('a[href="page_config.html"]'); setActive(defaultLink); @@ -48,7 +47,6 @@ const char index_html[] PROGMEM = R"rawliteral( }); -
-
@@ -78,23 +75,20 @@ const char index_html[] PROGMEM = R"rawliteral(
-
- - +
-
-



@@ -103,7 +97,6 @@ const char index_html[] PROGMEM = R"rawliteral(

Prusa Connect ESP32 cam

- -
@@ -131,7 +123,6 @@ const char page_auth_html[] PROGMEM = R"rawliteral(
- - - - - - -
@@ -156,12 +146,10 @@ const char page_wifi_html[] PROGMEM = R"rawliteral(

IP Address:

mDNS: http://.local


Available networks

@@ -178,12 +166,10 @@ const char page_wifi_html[] PROGMEM = R"rawliteral(


@@ -193,9 +179,7 @@ const char page_wifi_html[] PROGMEM = R"rawliteral(
-
@@ -219,9 +203,7 @@ const char page_wifi_html[] PROGMEM = R"rawliteral( - -
- + @@ -261,7 +243,7 @@ const char page_config_html[] PROGMEM = R"rawliteral( - + +
Basic image settings
Basic settings
Connect Token 
Fingerprint
Trigger Interval [s] 
SaturationLow High
Image rotation + Image Rotation
Flash durationLow High
Flash duration ms
Save images to micro SD
- -
+
- + @@ -315,7 +298,6 @@ const char page_config_html[] PROGMEM = R"rawliteral(
Advanced image settings
Advanced settings
Automatic white balancing
Automatic white balancing gain
- -
-
@@ -52,23 +49,20 @@
-
- - +
-
-



@@ -77,7 +71,6 @@

Prusa Connect ESP32 cam

- -
@@ -13,7 +12,6 @@
-
- + @@ -27,7 +27,7 @@ - + +
Basic image settings
Basic settings
Connect Token 
Fingerprint
Trigger Interval [s] 
SaturationLow High
Image rotation + Image Rotation
Flash durationLow High
Flash duration ms
Save images to micro SD
- -
+
- + @@ -81,7 +82,6 @@
Advanced image settings
Advanced settings
Automatic white balancing
Automatic white balancing gain
- - - - - - -
@@ -11,12 +10,10 @@

IP Address:

mDNS: http://.local


Available networks

@@ -33,12 +30,10 @@


@@ -48,9 +43,7 @@
-
@@ -74,9 +67,7 @@ - -