Initial version with multi-board support
parent
ba209c8c72
commit
51330258d4
|
|
@ -8,19 +8,13 @@
|
||||||
|
|
||||||
This project uses other libraries. It is necessary to install them in the arduino IDE.
|
This project uses other libraries. It is necessary to install them in the arduino IDE.
|
||||||
- Library - License - Version - Link
|
- Library - License - Version - Link
|
||||||
- ESPAsyncWebServer - LGPL 3.0 - 2.10.1 - https://github.com/mathieucarbou/ESPAsyncWebServer
|
- ESPAsyncWebServer - LGPL 3.0 - 2.10.8 - https://github.com/mathieucarbou/ESPAsyncWebServer
|
||||||
- AsyncTCP - LGPL 3.0 - 1.1.4 - https://github.com/dvarrel/ESPAsyncTCP
|
- AsyncTCP - LGPL 3.0 - 1.1.4 - https://github.com/dvarrel/ESPAsyncTCP
|
||||||
- ArduinoJson - MIT - 7.0.4 - https://github.com/bblanchon/ArduinoJson
|
- ArduinoJson - MIT - 7.0.4 - https://github.com/bblanchon/ArduinoJson
|
||||||
- ArduinoUniqueID - MIT - 1.3.0 - https://github.com/ricaun/ArduinoUniqueID
|
- ArduinoUniqueID - MIT - 1.3.0 - https://github.com/ricaun/ArduinoUniqueID
|
||||||
- ESP32 - LGPL 2.1 - 2.0.16 - https://github.com/espressif/arduino-esp32
|
- ESP32 - LGPL 2.1 - 2.0.16 - https://github.com/espressif/arduino-esp32
|
||||||
|
|
||||||
Board configuration in the arduino IDE 2.3.2
|
Arduino IDE configuration for the MCU are stored in the module_XXX.h file.
|
||||||
Tools -> Board -> ESP32 Arduino -> AI Thinker ESP32
|
|
||||||
Tools -> CPU Frequency -> 240MHz (WiFi/BT)
|
|
||||||
Tools -> Core debug level -> None
|
|
||||||
Tools -> Flash frequency -> 80MHz
|
|
||||||
Tools -> Flash Mode -> DIO
|
|
||||||
Tools -> Partition scheme -> Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS)
|
|
||||||
|
|
||||||
When flashing the firmware to a new, empty ESP32-CAM device for the first time, it is necessary to use the 'Erase' function.
|
When flashing the firmware to a new, empty ESP32-CAM device for the first time, it is necessary to use the 'Erase' function.
|
||||||
This can be found under 'Tools' -> 'Erase all Flash Before Sketch Upload' -> 'Enable'.
|
This can be found under 'Tools' -> 'Erase all Flash Before Sketch Upload' -> 'Enable'.
|
||||||
|
|
@ -118,7 +112,9 @@ void setup() {
|
||||||
xTaskCreatePinnedToCore(System_TaskMain, "SystemNtpOtaUpdate", 6200, NULL, 1, &Task_SystemMain, 0); /*function, description, stack size, parameters, priority, task handle, core*/
|
xTaskCreatePinnedToCore(System_TaskMain, "SystemNtpOtaUpdate", 6200, NULL, 1, &Task_SystemMain, 0); /*function, description, stack size, parameters, priority, task handle, core*/
|
||||||
xTaskCreatePinnedToCore(System_TaskCaptureAndSendPhoto, "CaptureAndSendPhoto", 4400, NULL, 2, &Task_CapturePhotoAndSend, 0); /*function, description, stack size, parameters, priority, task handle, core*/
|
xTaskCreatePinnedToCore(System_TaskCaptureAndSendPhoto, "CaptureAndSendPhoto", 4400, NULL, 2, &Task_CapturePhotoAndSend, 0); /*function, description, stack size, parameters, priority, task handle, core*/
|
||||||
xTaskCreatePinnedToCore(System_TaskWifiManagement, "WiFiManagement", 2800, NULL, 3, &Task_WiFiManagement, 0); /*function, description, stack size, parameters, priority, task handle, core*/
|
xTaskCreatePinnedToCore(System_TaskWifiManagement, "WiFiManagement", 2800, NULL, 3, &Task_WiFiManagement, 0); /*function, description, stack size, parameters, priority, task handle, core*/
|
||||||
|
#if (true == ENABLE_SD_CARD)
|
||||||
xTaskCreatePinnedToCore(System_TaskSdCardCheck, "CheckMicroSdCard", 3000, NULL, 4, &Task_SdCardCheck, 0); /*function, description, stack size, parameters, priority, task handle, core*/
|
xTaskCreatePinnedToCore(System_TaskSdCardCheck, "CheckMicroSdCard", 3000, NULL, 4, &Task_SdCardCheck, 0); /*function, description, stack size, parameters, priority, task handle, core*/
|
||||||
|
#endif
|
||||||
xTaskCreatePinnedToCore(System_TaskSerialCfg, "CheckSerialConfiguration", 2600, NULL, 5, &Task_SerialCfg, 0); /*function, description, stack size, parameters, priority, task handle, core*/
|
xTaskCreatePinnedToCore(System_TaskSerialCfg, "CheckSerialConfiguration", 2600, NULL, 5, &Task_SerialCfg, 0); /*function, description, stack size, parameters, priority, task handle, core*/
|
||||||
xTaskCreatePinnedToCore(System_TaskStreamTelemetry, "PrintStreamTelemetry", 2200, NULL, 6, &Task_StreamTelemetry, 0); /*function, description, stack size, parameters, priority, task handle, core*/
|
xTaskCreatePinnedToCore(System_TaskStreamTelemetry, "PrintStreamTelemetry", 2200, NULL, 6, &Task_StreamTelemetry, 0); /*function, description, stack size, parameters, priority, task handle, core*/
|
||||||
xTaskCreatePinnedToCore(System_TaskSysLed, "SystemLed", 2100, NULL, 7, &Task_SysLed, 0); /*function, description, stack size, parameters, priority, task handle, core*/
|
xTaskCreatePinnedToCore(System_TaskSysLed, "SystemLed", 2100, NULL, 7, &Task_SysLed, 0); /*function, description, stack size, parameters, priority, task handle, core*/
|
||||||
|
|
@ -132,7 +128,9 @@ void setup() {
|
||||||
esp_task_wdt_add(Task_CapturePhotoAndSend);
|
esp_task_wdt_add(Task_CapturePhotoAndSend);
|
||||||
esp_task_wdt_add(Task_WiFiManagement);
|
esp_task_wdt_add(Task_WiFiManagement);
|
||||||
esp_task_wdt_add(Task_SystemMain);
|
esp_task_wdt_add(Task_SystemMain);
|
||||||
|
#if (true == ENABLE_SD_CARD)
|
||||||
esp_task_wdt_add(Task_SdCardCheck);
|
esp_task_wdt_add(Task_SdCardCheck);
|
||||||
|
#endif
|
||||||
esp_task_wdt_add(Task_SerialCfg);
|
esp_task_wdt_add(Task_SerialCfg);
|
||||||
esp_task_wdt_add(Task_StreamTelemetry);
|
esp_task_wdt_add(Task_StreamTelemetry);
|
||||||
esp_task_wdt_add(Task_SysLed);
|
esp_task_wdt_add(Task_SysLed);
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
#include "cfg.h"
|
#include "cfg.h"
|
||||||
#include "exif.h"
|
#include "exif.h"
|
||||||
#include "Camera_cfg.h"
|
#include "module_templates.h"
|
||||||
#include "Arduino.h"
|
#include "Arduino.h"
|
||||||
#include "mcu_cfg.h"
|
#include "mcu_cfg.h"
|
||||||
#include "var.h"
|
#include "var.h"
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
#include <base64.h>
|
#include <base64.h>
|
||||||
|
|
||||||
#include "mcu_cfg.h"
|
#include "mcu_cfg.h"
|
||||||
#include "Camera_cfg.h"
|
#include "module_templates.h"
|
||||||
#include "var.h"
|
#include "var.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -482,6 +482,7 @@ void PrusaConnect::SetTimeLapsPhotoSaveStatus(bool i_data) {
|
||||||
@return none
|
@return none
|
||||||
*/
|
*/
|
||||||
void PrusaConnect::SavePhotoToSdCard() {
|
void PrusaConnect::SavePhotoToSdCard() {
|
||||||
|
#if (ENABLE_SD_CARD == true)
|
||||||
/* check if time laps photo save is enabled */
|
/* check if time laps photo save is enabled */
|
||||||
if (EnableTimelapsPhotoSave == true) {
|
if (EnableTimelapsPhotoSave == true) {
|
||||||
log->AddEvent(LogLevel_Info, F("Save TimeLaps photo to SD card"));
|
log->AddEvent(LogLevel_Info, F("Save TimeLaps photo to SD card"));
|
||||||
|
|
@ -520,6 +521,7 @@ void PrusaConnect::SavePhotoToSdCard() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -107,6 +107,7 @@ void Logs::Init() {
|
||||||
Serial.println(F("Init Logs library"));
|
Serial.println(F("Init Logs library"));
|
||||||
|
|
||||||
/* init micro SD card */
|
/* init micro SD card */
|
||||||
|
#if (true == ENABLE_SD_CARD)
|
||||||
InitSdCard();
|
InitSdCard();
|
||||||
LogFileOpened = OpenFile(&LogFile, FilePath + FileName);
|
LogFileOpened = OpenFile(&LogFile, FilePath + FileName);
|
||||||
|
|
||||||
|
|
@ -132,6 +133,10 @@ void Logs::Init() {
|
||||||
} else {
|
} else {
|
||||||
Serial.println(F("Micro-SD card not found! Disable logs"));
|
Serial.println(F("Micro-SD card not found! Disable logs"));
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
Serial.println(F("Micro-SD card not enabled! Disable logs to card"));
|
||||||
|
LogFileOpened = false;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -139,7 +144,9 @@ void Logs::Init() {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void Logs::LogOpenFile() {
|
void Logs::LogOpenFile() {
|
||||||
|
#if (true == ENABLE_SD_CARD)
|
||||||
LogFileOpened = OpenFile(&LogFile, FilePath + FileName);
|
LogFileOpened = OpenFile(&LogFile, FilePath + FileName);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -147,7 +154,9 @@ void Logs::LogOpenFile() {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void Logs::LogCloseFile() {
|
void Logs::LogCloseFile() {
|
||||||
|
#if (true == ENABLE_SD_CARD)
|
||||||
CloseFile(&LogFile);
|
CloseFile(&LogFile);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -155,7 +164,9 @@ void Logs::LogCloseFile() {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void Logs::LogCheckOpenedFile() {
|
void Logs::LogCheckOpenedFile() {
|
||||||
|
#if (true == ENABLE_SD_CARD)
|
||||||
LogFileOpened = CheckOpenFile(&LogFile);
|
LogFileOpened = CheckOpenFile(&LogFile);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -194,7 +205,7 @@ void Logs::AddEvent(LogLevel_enum level, String msg, bool newLine, bool date) {
|
||||||
|
|
||||||
/* print log message to console */
|
/* print log message to console */
|
||||||
Serial.print(LogMsg);
|
Serial.print(LogMsg);
|
||||||
|
#if (true == ENABLE_SD_CARD)
|
||||||
/* append log message to log file */
|
/* append log message to log file */
|
||||||
if (true == LogFileOpened) {
|
if (true == LogFileOpened) {
|
||||||
LogFileOpened = AppendFile(&LogFile, &LogMsg);
|
LogFileOpened = AppendFile(&LogFile, &LogMsg);
|
||||||
|
|
@ -206,6 +217,7 @@ void Logs::AddEvent(LogLevel_enum level, String msg, bool newLine, bool date) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#if (true == CONSOLE_VERBOSE_DEBUG)
|
#if (true == CONSOLE_VERBOSE_DEBUG)
|
||||||
else {
|
else {
|
||||||
|
|
@ -246,6 +258,7 @@ void Logs::AddEvent(LogLevel_enum level, const __FlashStringHelper *msg, String
|
||||||
/* print log message to console */
|
/* print log message to console */
|
||||||
Serial.print(LogMsg);
|
Serial.print(LogMsg);
|
||||||
|
|
||||||
|
#if (true == ENABLE_SD_CARD)
|
||||||
/* append log message to log file */
|
/* append log message to log file */
|
||||||
if (true == LogFileOpened) {
|
if (true == LogFileOpened) {
|
||||||
LogFileOpened = AppendFile(&LogFile, &LogMsg);
|
LogFileOpened = AppendFile(&LogFile, &LogMsg);
|
||||||
|
|
@ -257,6 +270,7 @@ void Logs::AddEvent(LogLevel_enum level, const __FlashStringHelper *msg, String
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#if (true == CONSOLE_VERBOSE_DEBUG)
|
#if (true == CONSOLE_VERBOSE_DEBUG)
|
||||||
else {
|
else {
|
||||||
|
|
@ -347,6 +361,7 @@ bool Logs::GetNtpTimeSynced() {
|
||||||
@return none
|
@return none
|
||||||
*/
|
*/
|
||||||
void Logs::CheckMaxLogFileSize() {
|
void Logs::CheckMaxLogFileSize() {
|
||||||
|
#if (true == ENABLE_SD_CARD)
|
||||||
uint32_t FileSize = GetFileSize(SD_MMC, FilePath + FileName);
|
uint32_t FileSize = GetFileSize(SD_MMC, FilePath + FileName);
|
||||||
AddEvent(LogLevel_Verbose, F("Log file size: "), String(FileSize) + "/" + String(LOGS_FILE_MAX_SIZE) + " B");
|
AddEvent(LogLevel_Verbose, F("Log file size: "), String(FileSize) + "/" + String(LOGS_FILE_MAX_SIZE) + " B");
|
||||||
|
|
||||||
|
|
@ -357,11 +372,14 @@ void Logs::CheckMaxLogFileSize() {
|
||||||
RenameFile(SD_MMC, FilePath + FileName, FilePath + FileName + String(file_count));
|
RenameFile(SD_MMC, FilePath + FileName, FilePath + FileName + String(file_count));
|
||||||
LogOpenFile();
|
LogOpenFile();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Logs::CheckCardSpace() {
|
void Logs::CheckCardSpace() {
|
||||||
|
#if (true == ENABLE_SD_CARD)
|
||||||
CheckCardUsedStatus();
|
CheckCardUsedStatus();
|
||||||
AddEvent(LogLevel_Verbose, "Card size: " + String(GetCardSizeMB()), + " MB, Used: " + String(GetCardUsedMB()) + " MB, Free: " + String(GetCardUsedMB()) + " MB");
|
AddEvent(LogLevel_Verbose, "Card size: " + String(GetCardSizeMB()), + " MB, Used: " + String(GetCardUsedMB()) + " MB, Free: " + String(GetCardUsedMB()) + " MB");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@
|
||||||
#include "mcu_cfg.h"
|
#include "mcu_cfg.h"
|
||||||
#include "var.h"
|
#include "var.h"
|
||||||
#include "micro_sd.h"
|
#include "micro_sd.h"
|
||||||
|
#include "module_templates.h"
|
||||||
|
|
||||||
enum LogLevel_enum {
|
enum LogLevel_enum {
|
||||||
LogLevel_Error = 0, ///< Error
|
LogLevel_Error = 0, ///< Error
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,10 @@
|
||||||
#ifndef _MCU_CFG_H_
|
#ifndef _MCU_CFG_H_
|
||||||
#define _MCU_CFG_H_
|
#define _MCU_CFG_H_
|
||||||
|
|
||||||
|
/* ----------------- CAMERA TYPE ---------------*/
|
||||||
|
#define AI_THINKER_ESP32_CAM
|
||||||
|
//#define ESP32_WROVER_DEV
|
||||||
|
|
||||||
/* ---------------- BASIC MCU CFG --------------*/
|
/* ---------------- BASIC MCU CFG --------------*/
|
||||||
#define SW_VERSION "1.0.3" ///< SW version
|
#define SW_VERSION "1.0.3" ///< SW version
|
||||||
#define SW_BUILD __DATE__ " " __TIME__ ///< build number
|
#define SW_BUILD __DATE__ " " __TIME__ ///< build number
|
||||||
|
|
@ -26,17 +30,7 @@
|
||||||
#define REFRESH_INTERVAL_MIN 10 ///< minimum refresh interval for sending photo to prusa connect [s]
|
#define REFRESH_INTERVAL_MIN 10 ///< minimum refresh interval for sending photo to prusa connect [s]
|
||||||
#define REFRESH_INTERVAL_MAX 240 ///< maximum refresh interval for sending photo to prusa connect [s]
|
#define REFRESH_INTERVAL_MAX 240 ///< maximum refresh interval for sending photo to prusa connect [s]
|
||||||
|
|
||||||
/* --------------- FLASH LED CFG ---------------*/
|
|
||||||
#define FLASH_GPIO_NUM 4 ///< GPIO pin for light
|
|
||||||
#define FLASH_OFF_STATUS 0 ///< PWM intensity LED for OFF. 0-2^FLASH_PWM_RESOLUTION = 0-255
|
|
||||||
#define FLASH_ON_STATUS 205 ///< PWM intensity LED for ON. limitation to 80%. 2^FLASH_PWM_RESOLUTION * 0.8% = 204
|
|
||||||
#define FLASH_PWM_FREQ 2000 ///< frequency of pwm [240MHz / (100 prescale * pwm cycles)] = frequency
|
|
||||||
#define FLASH_PWM_CHANNEL 0 ///< channel 0
|
|
||||||
#define FLASH_PWM_RESOLUTION 8 ///< range 1-20bit. 8bit = 0-255 range
|
|
||||||
|
|
||||||
/* -------------- STATUS LED CFG ----------------*/
|
/* -------------- STATUS LED CFG ----------------*/
|
||||||
#define STATUS_LED_GPIO_NUM 33 ///< GPIO pin for status LED
|
|
||||||
#define STATUS_LED_ENABLE true ///< enable/disable status LED
|
|
||||||
#define STATUS_LED_ON_DURATION 100 ///< time for blink status LED when is module in the ON state [ms]
|
#define STATUS_LED_ON_DURATION 100 ///< time for blink status LED when is module in the ON state [ms]
|
||||||
#define STATUS_LED_WIFI_AP 400 ///< time for blink status LED when is module in the AP mode [ms]
|
#define STATUS_LED_WIFI_AP 400 ///< time for blink status LED when is module in the AP mode [ms]
|
||||||
#define STATUS_LED_STA_CONNECTING 800 ///< time for blink status LED when is module connecting to the WiFi network [ms]
|
#define STATUS_LED_STA_CONNECTING 800 ///< time for blink status LED when is module connecting to the WiFi network [ms]
|
||||||
|
|
@ -65,10 +59,8 @@
|
||||||
/* --------------- OTA UPDATE CFG --------------*/
|
/* --------------- OTA UPDATE CFG --------------*/
|
||||||
#define OTA_UPDATE_API_SERVER "api.github.com" ///< OTA update server URL
|
#define OTA_UPDATE_API_SERVER "api.github.com" ///< OTA update server URL
|
||||||
#define OTA_UPDATE_API_URL F("/repos/prusa3d/Prusa-Firmware-ESP32-Cam/releases/latest") ///< path to file with OTA update
|
#define OTA_UPDATE_API_URL F("/repos/prusa3d/Prusa-Firmware-ESP32-Cam/releases/latest") ///< path to file with OTA update
|
||||||
#define OTA_UPDATE_FW_FILE PSTR("ESP32_PrusaConnectCam.ino.bin") ///< OTA update firmware file name
|
|
||||||
|
|
||||||
/* ---------- RESET CFG CONFIGURATION ----------*/
|
/* ---------- RESET CFG CONFIGURATION ----------*/
|
||||||
#define CFG_RESET_PIN 12 ///< GPIO 16 is for reset CFG to default
|
|
||||||
#define CFG_RESET_TIME_WAIT 10000 ///< wait to 10 000 ms = 10s for reset cfg during grounded CFG_RESET_PIN
|
#define CFG_RESET_TIME_WAIT 10000 ///< wait to 10 000 ms = 10s for reset cfg during grounded CFG_RESET_PIN
|
||||||
#define CFG_RESET_LOOP_DELAY 100 ///< delay in the loop for reset cfg
|
#define CFG_RESET_LOOP_DELAY 100 ///< delay in the loop for reset cfg
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@
|
||||||
#include "SD_MMC.h"
|
#include "SD_MMC.h"
|
||||||
|
|
||||||
#include "mcu_cfg.h"
|
#include "mcu_cfg.h"
|
||||||
|
#include "module_templates.h"
|
||||||
#include "var.h"
|
#include "var.h"
|
||||||
|
|
||||||
class MicroSd {
|
class MicroSd {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,74 @@
|
||||||
|
/**
|
||||||
|
@file module_AI_Thinker_ESP32-CAM.h
|
||||||
|
|
||||||
|
@brief Definition of the AI Thinker ESP32-CAM module
|
||||||
|
|
||||||
|
@author Miroslav Pivovarsky
|
||||||
|
Contact: miroslav.pivovarsky@gmail.com
|
||||||
|
|
||||||
|
https://docs.ai-thinker.com/en/esp32-cam
|
||||||
|
|
||||||
|
|
||||||
|
Board configuration in the arduino IDE 2.3.2
|
||||||
|
Tools -> Board -> ESP32 Arduino -> AI Thinker ESP32
|
||||||
|
Tools -> CPU Frequency -> 240MHz (WiFi/BT)
|
||||||
|
Tools -> Core debug level -> None
|
||||||
|
Tools -> Flash frequency -> 80MHz
|
||||||
|
Tools -> Flash Mode -> DIO
|
||||||
|
Tools -> Partition scheme -> Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS)
|
||||||
|
|
||||||
|
@bug: no know bug
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __MODULE_AI_THINKER_ESP32_CAM_H__
|
||||||
|
#define __MODULE_AI_THINKER_ESP32_CAM_H__
|
||||||
|
|
||||||
|
#include "mcu_cfg.h"
|
||||||
|
|
||||||
|
#ifdef AI_THINKER_ESP32_CAM
|
||||||
|
|
||||||
|
/* --------------- CAMERA CFG -------------------*/
|
||||||
|
#define PWDN_GPIO_NUM 32 ///< Power down control pin
|
||||||
|
#define RESET_GPIO_NUM -1 ///< Reset control pin
|
||||||
|
#define XCLK_GPIO_NUM 0 ///< External clock pin
|
||||||
|
#define SIOD_GPIO_NUM 26 ///< SCCB: SI/O data pin
|
||||||
|
#define SIOC_GPIO_NUM 27 ///< SCCB: SI/O control pin
|
||||||
|
#define Y9_GPIO_NUM 35 ///< SCCB: Y9 pin
|
||||||
|
#define Y8_GPIO_NUM 34 ///< SCCB: Y8 pin
|
||||||
|
#define Y7_GPIO_NUM 39 ///< SCCB: Y7 pin
|
||||||
|
#define Y6_GPIO_NUM 36 ///< SCCB: Y6 pin
|
||||||
|
#define Y5_GPIO_NUM 21 ///< SCCB: Y5 pin
|
||||||
|
#define Y4_GPIO_NUM 19 ///< SCCB: Y4 pin
|
||||||
|
#define Y3_GPIO_NUM 18 ///< SCCB: Y3 pin
|
||||||
|
#define Y2_GPIO_NUM 5 ///< SCCB: Y2 pin
|
||||||
|
#define VSYNC_GPIO_NUM 25 ///< Vertical sync pin
|
||||||
|
#define HREF_GPIO_NUM 23 ///< Line sync pin
|
||||||
|
#define PCLK_GPIO_NUM 22 ///< Pixel clock pin
|
||||||
|
|
||||||
|
/* --------------- OTA UPDATE CFG --------------*/
|
||||||
|
#define OTA_UPDATE_FW_FILE PSTR("ESP32_PrusaConnectCam.ino.bin") ///< OTA update firmware file name
|
||||||
|
|
||||||
|
/* --------------- FLASH LED CFG ---------------*/
|
||||||
|
#define ENABLE_CAMERA_FLASH true ///< Enable camera flash function
|
||||||
|
#define FLASH_GPIO_NUM 4 ///< Flash control pin
|
||||||
|
#define FLASH_OFF_STATUS 0 ///< PWM intensity LED for OFF. 0-2^FLASH_PWM_RESOLUTION = 0-255
|
||||||
|
#define FLASH_ON_STATUS 205 ///< PWM intensity LED for ON. limitation to 80%. 2^FLASH_PWM_RESOLUTION * 0.8% = 204
|
||||||
|
#define FLASH_PWM_FREQ 2000 ///< frequency of pwm [240MHz / (100 prescale * pwm cycles)] = frequency
|
||||||
|
#define FLASH_PWM_CHANNEL 0 ///< channel 0
|
||||||
|
#define FLASH_PWM_RESOLUTION 8 ///< range 1-20bit. 8bit = 0-255 range
|
||||||
|
|
||||||
|
/* --------------- SD CARD CFG ---------------*/
|
||||||
|
#define ENABLE_SD_CARD true ///< Enable SD card function
|
||||||
|
|
||||||
|
/* ---------- RESET CFG CONFIGURATION ----------*/
|
||||||
|
#define CFG_RESET_PIN 12 ///< GPIO 16 is for reset CFG to default
|
||||||
|
|
||||||
|
/* -------------- STATUS LED CFG ----------------*/
|
||||||
|
#define STATUS_LED_ENABLE true ///< enable/disable status LED
|
||||||
|
#define STATUS_LED_GPIO_NUM 33 ///< GPIO pin for status LED
|
||||||
|
#define STATUS_LED_OFF_PIN_LEVEL LOW ///< GPIO pin level for status LED ON
|
||||||
|
|
||||||
|
#endif // AI_THINKER_ESP32_CAM
|
||||||
|
#endif // MODULE_AI_THINKER_ESP32_CAM_H
|
||||||
|
/* EOF */
|
||||||
|
|
@ -0,0 +1,74 @@
|
||||||
|
/**
|
||||||
|
@file module_ESP32-WROVER-DEV.h
|
||||||
|
|
||||||
|
@brief Definition of the ESP32-WROVER-DEV
|
||||||
|
|
||||||
|
@author Miroslav Pivovarsky
|
||||||
|
Contact: miroslav.pivovarsky@gmail.com
|
||||||
|
|
||||||
|
https://github.com/Freenove/Freenove_ESP32_WROVER_Board
|
||||||
|
|
||||||
|
|
||||||
|
Board configuration in the arduino IDE 2.3.2
|
||||||
|
Tools -> Board -> ESP32 Arduino -> ESP32 Wrover Module
|
||||||
|
Tools -> CPU Frequency -> 240MHz (WiFi/BT)
|
||||||
|
Tools -> Core debug level -> None
|
||||||
|
Tools -> Flash frequency -> 80MHz
|
||||||
|
Tools -> Flash Mode -> DIO
|
||||||
|
Tools -> Partition scheme -> Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS)
|
||||||
|
|
||||||
|
@bug: no know bug
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __MODULE_ESP32_WROVER_DEV_H__
|
||||||
|
#define __MODULE_ESP32_WROVER_DEV_H__
|
||||||
|
|
||||||
|
#include "mcu_cfg.h"
|
||||||
|
|
||||||
|
#ifdef ESP32_WROVER_DEV
|
||||||
|
|
||||||
|
/* --------------- CAMERA CFG -------------------*/
|
||||||
|
#define PWDN_GPIO_NUM -1 ///< Power down control pin
|
||||||
|
#define RESET_GPIO_NUM -1 ///< Reset control pin
|
||||||
|
#define XCLK_GPIO_NUM 21 ///< External clock pin
|
||||||
|
#define SIOD_GPIO_NUM 26 ///< SCCB: SI/O data pin
|
||||||
|
#define SIOC_GPIO_NUM 27 ///< SCCB: SI/O control pin
|
||||||
|
#define Y9_GPIO_NUM 35 ///< SCCB: Y9 pin
|
||||||
|
#define Y8_GPIO_NUM 34 ///< SCCB: Y8 pin
|
||||||
|
#define Y7_GPIO_NUM 39 ///< SCCB: Y7 pin
|
||||||
|
#define Y6_GPIO_NUM 36 ///< SCCB: Y6 pin
|
||||||
|
#define Y5_GPIO_NUM 19 ///< SCCB: Y5 pin
|
||||||
|
#define Y4_GPIO_NUM 18 ///< SCCB: Y4 pin
|
||||||
|
#define Y3_GPIO_NUM 5 ///< SCCB: Y3 pin
|
||||||
|
#define Y2_GPIO_NUM 4 ///< SCCB: Y2 pin
|
||||||
|
#define VSYNC_GPIO_NUM 25 ///< Vertical sync pin
|
||||||
|
#define HREF_GPIO_NUM 23 ///< Line sync pin
|
||||||
|
#define PCLK_GPIO_NUM 22 ///< Pixel clock pin
|
||||||
|
|
||||||
|
/* --------------- OTA UPDATE CFG --------------*/
|
||||||
|
#define OTA_UPDATE_FW_FILE PSTR("ESP32_WROVER_DEV_PrusaConnectCam.ino.bin") ///< OTA update firmware file name
|
||||||
|
|
||||||
|
/* --------------- FLASH LED CFG ---------------*/
|
||||||
|
#define ENABLE_CAMERA_FLASH false ///< Enable camera flash function
|
||||||
|
#define FLASH_GPIO_NUM 4 ///< Flash control pin
|
||||||
|
#define FLASH_OFF_STATUS 0 ///< PWM intensity LED for OFF. 0-2^FLASH_PWM_RESOLUTION = 0-255
|
||||||
|
#define FLASH_ON_STATUS 205 ///< PWM intensity LED for ON. limitation to 80%. 2^FLASH_PWM_RESOLUTION * 0.8% = 204
|
||||||
|
#define FLASH_PWM_FREQ 2000 ///< frequency of pwm [240MHz / (100 prescale * pwm cycles)] = frequency
|
||||||
|
#define FLASH_PWM_CHANNEL 0 ///< channel 0
|
||||||
|
#define FLASH_PWM_RESOLUTION 8 ///< range 1-20bit. 8bit = 0-255 range
|
||||||
|
|
||||||
|
/* --------------- SD CARD CFG ---------------*/
|
||||||
|
#define ENABLE_SD_CARD false ///< Enable SD card function
|
||||||
|
|
||||||
|
/* ---------- RESET CFG CONFIGURATION ----------*/
|
||||||
|
#define CFG_RESET_PIN 12 ///< GPIO 16 is for reset CFG to default
|
||||||
|
|
||||||
|
/* -------------- STATUS LED CFG ----------------*/
|
||||||
|
#define STATUS_LED_ENABLE true ///< enable/disable status LED
|
||||||
|
#define STATUS_LED_GPIO_NUM 2 ///< GPIO pin for status LED
|
||||||
|
#define STATUS_LED_OFF_PIN_LEVEL HIGH ///< GPIO pin level for status LED ON
|
||||||
|
|
||||||
|
#endif // ESP32_WROVER_DEV
|
||||||
|
#endif // MODULE_ESP32_WROVER_DEV_H
|
||||||
|
/* EOF */
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
/**
|
||||||
|
@file module_templates.h
|
||||||
|
|
||||||
|
@brief Definition of the module templates
|
||||||
|
|
||||||
|
@author Miroslav Pivovarsky
|
||||||
|
Contact: miroslav.pivovarsky@gmail.com
|
||||||
|
|
||||||
|
@bug: no know bug
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __MODULE_TEMPLATES_H__
|
||||||
|
#define __MODULE_TEMPLATES_H__
|
||||||
|
|
||||||
|
#include "mcu_cfg.h"
|
||||||
|
|
||||||
|
#ifdef AI_THINKER_ESP32_CAM
|
||||||
|
#include "module_AI_Thinker_ESP32-CAM.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef ESP32_WROVER_DEV
|
||||||
|
#include "module_ESP32-WROVER-DEV.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // MODULE_TEMPLATES_H
|
||||||
|
/* EOF */
|
||||||
|
|
@ -696,13 +696,16 @@ void Server_InitWebServer_Sets() {
|
||||||
|
|
||||||
if (request->hasParam("timelaps_enable")) {
|
if (request->hasParam("timelaps_enable")) {
|
||||||
SystemLog.AddEvent(LogLevel_Verbose, F("Set timelaps enable"));
|
SystemLog.AddEvent(LogLevel_Verbose, F("Set timelaps enable"));
|
||||||
|
#if (ENABLE_SD_CARD == true)
|
||||||
bool val = Server_TransfeStringToBool(request->getParam("timelaps_enable")->value());
|
bool val = Server_TransfeStringToBool(request->getParam("timelaps_enable")->value());
|
||||||
if ((true == val ) && (SystemLog.GetCardDetectedStatus() == true)) {
|
if ((true == val ) && (SystemLog.GetCardDetectedStatus() == true)) {
|
||||||
Connect.SetTimeLapsPhotoSaveStatus(val);
|
Connect.SetTimeLapsPhotoSaveStatus(val);
|
||||||
} else {
|
} else {
|
||||||
Connect.SetTimeLapsPhotoSaveStatus(false);
|
Connect.SetTimeLapsPhotoSaveStatus(false);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
Connect.SetTimeLapsPhotoSaveStatus(false);
|
||||||
|
#endif
|
||||||
response = true;
|
response = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ sys_led::sys_led(uint8_t i_pin, uint32_t i_on_duration, Logs *i_log) {
|
||||||
*/
|
*/
|
||||||
void sys_led::init() {
|
void sys_led::init() {
|
||||||
pinMode(pin, OUTPUT);
|
pinMode(pin, OUTPUT);
|
||||||
digitalWrite(pin, LOW);
|
digitalWrite(pin, STATUS_LED_OFF_PIN_LEVEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -91,7 +91,7 @@ void sys_led::setTimer(uint32_t i_time) {
|
||||||
uint32_t sys_led::getTimer() {
|
uint32_t sys_led::getTimer() {
|
||||||
uint32_t tmp = 0;
|
uint32_t tmp = 0;
|
||||||
|
|
||||||
if (digitalRead(pin) == LOW) {
|
if (digitalRead(pin) == STATUS_LED_OFF_PIN_LEVEL) {
|
||||||
tmp = ledOnDuration;
|
tmp = ledOnDuration;
|
||||||
} else {
|
} else {
|
||||||
tmp = time;
|
tmp = time;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue