Update arduino-esp32 from 2.0.16 to 3.0.2 (from ESP IDF 4.4.7 to ESP IDF 5.1.4)

pull/60/head
Miroslav Pivovarsky 2024-06-27 22:15:12 +02:00
parent 51330258d4
commit a82fa2e48c
28 changed files with 123 additions and 210 deletions

View File

@ -1,37 +0,0 @@
/**
@file Camera_cfg.h
@brief Here is saved camera GPIO cfg for camera module OV2640
@author Miroslav Pivovarsky
Contact: miroslav.pivovarsky@gmail.com
@bug: no know bug
*/
#ifndef _CAMERA_CFG_H_
#define _CAMERA_CFG_H_
// OV2640 camera module pins (CAMERA_MODEL_AI_THINKER)
#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
#define FLASH_GPIO_NUM 4 ///< Flash control pin
#endif
/* EOF */

View File

@ -9,8 +9,7 @@
@bug: no know bug @bug: no know bug
*/ */
#ifndef _CERTIFICATE_H_ #pragma once
#define _CERTIFICATE_H_
/* /*
echo -n | openssl s_client -servername connect.prusa.com -connect connect.prusa.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > connect_prusa_com.crt echo -n | openssl s_client -servername connect.prusa.com -connect connect.prusa.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > connect_prusa_com.crt
@ -54,6 +53,4 @@ emyPxgcYxn/eR44/KJ4EBs+lVDR3veyJm+kXQ99b21/+jh5Xos1AnX5iItreGCc=
-----END CERTIFICATE----- -----END CERTIFICATE-----
)rawliteral"; )rawliteral";
#endif
/* EOF */ /* EOF */

View File

@ -9,8 +9,7 @@
@bug: no know bug @bug: no know bug
*/ */
#ifndef _CERTIFICATE_OTA_H_ #pragma once
#define _CERTIFICATE_OTA_H_
/* /*
echo -n | openssl s_client -servername github.com -connect github.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > github_com.crt echo -n | openssl s_client -servername github.com -connect github.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > github_com.crt
@ -135,6 +134,4 @@ RNZu9YO6bVi9JNlWSOrvxKJGgYhqOkbRqZtNyWHa0V1Xahg=
-----END CERTIFICATE----- -----END CERTIFICATE-----
)rawliteral"; )rawliteral";
#endif
/* EOF */ /* EOF */

View File

@ -9,10 +9,10 @@
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.8 - 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 - 3.1.4 - https://github.com/mathieucarbou/AsyncTCP
- 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 - 3.0.1 - https://github.com/espressif/arduino-esp32
Arduino IDE configuration for the MCU are stored in the module_XXX.h file. Arduino IDE configuration for the MCU are stored in the module_XXX.h file.
@ -38,14 +38,12 @@
*/ */
/* includes */ /* includes */
#include <WiFi.h>
#include "Arduino.h" #include "Arduino.h"
#include <esp_task_wdt.h> #include <esp_task_wdt.h>
#include <ESPmDNS.h> #include <ESPmDNS.h>
#include <esp_wifi.h>
#include "esp32-hal-cpu.h" #include "esp32-hal-cpu.h"
#include "server.h" #include "WebServer.h"
#include "cfg.h" #include "cfg.h"
#include "var.h" #include "var.h"
#include "mcu_cfg.h" #include "mcu_cfg.h"
@ -107,43 +105,47 @@ void setup() {
/* init class for communication with PrusaConnect */ /* init class for communication with PrusaConnect */
Connect.Init(); Connect.Init();
/* init wdg */
SystemLog.AddEvent(LogLevel_Info, F("Init WDG"));
esp_task_wdt_config_t twdt_config;
twdt_config.timeout_ms = 60000;
twdt_config.idle_core_mask = (1 << portNUM_PROCESSORS) - 1, /* Bitmask of all cores */
twdt_config.trigger_panic = true;
esp_task_wdt_reconfigure(&twdt_config);
//ESP_ERROR_CHECK(esp_task_wdt_init(&twdt_config)); /* enable panic so ESP32 restarts */
ESP_ERROR_CHECK(esp_task_wdt_add(NULL)); /* add current thread to WDT watch */
ESP_ERROR_CHECK(esp_task_wdt_reset()); /* reset wdg */
/* init tasks */ /* init tasks */
SystemLog.AddEvent(LogLevel_Info, F("Start tasks")); SystemLog.AddEvent(LogLevel_Info, F("Start tasks"));
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*/
ESP_ERROR_CHECK(esp_task_wdt_add(Task_SystemMain));
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*/
ESP_ERROR_CHECK(esp_task_wdt_add(Task_CapturePhotoAndSend));
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*/
ESP_ERROR_CHECK(esp_task_wdt_add(Task_WiFiManagement));
#if (true == ENABLE_SD_CARD) #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*/
ESP_ERROR_CHECK(esp_task_wdt_add(Task_SdCardCheck));
#endif #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*/
ESP_ERROR_CHECK(esp_task_wdt_add(Task_SerialCfg));
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*/
ESP_ERROR_CHECK(esp_task_wdt_add(Task_StreamTelemetry));
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*/
ESP_ERROR_CHECK(esp_task_wdt_add(Task_SysLed));
xTaskCreatePinnedToCore(System_TaskWiFiWatchdog, "WiFiWatchdog", 2200, NULL, 8, &Task_WiFiWatchdog, 0); /*function, description, stack size, parameters, priority, task handle, core*/ xTaskCreatePinnedToCore(System_TaskWiFiWatchdog, "WiFiWatchdog", 2200, NULL, 8, &Task_WiFiWatchdog, 0); /*function, description, stack size, parameters, priority, task handle, core*/
ESP_ERROR_CHECK(esp_task_wdt_add(Task_WiFiWatchdog));
//xTaskCreatePinnedToCore(System_TaskSdCardRemove, "SdCardRemove", 3000, NULL, 9, &Task_SdCardFileRemove, 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"));
esp_task_wdt_init(WDG_TIMEOUT, true); /* enable panic so ESP32 restarts */
esp_task_wdt_add(NULL); /* add current thread to WDT watch */
esp_task_wdt_add(Task_CapturePhotoAndSend);
esp_task_wdt_add(Task_WiFiManagement);
esp_task_wdt_add(Task_SystemMain);
#if (true == ENABLE_SD_CARD)
esp_task_wdt_add(Task_SdCardCheck);
#endif
esp_task_wdt_add(Task_SerialCfg);
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_add(Task_SdCardFileRemove);
esp_task_wdt_reset(); /* reset wdg */
SystemLog.AddEvent(LogLevel_Info, F("MCU configuration done")); SystemLog.AddEvent(LogLevel_Info, F("MCU configuration done"));
} }
void loop() { void loop() {
/* reset wdg */ /* reset wdg */
esp_task_wdt_reset(); ESP_ERROR_CHECK(esp_task_wdt_reset());
} }
/* EOF */ /* EOF */

View File

@ -11,8 +11,7 @@
@bug: no know bug @bug: no know bug
*/ */
#ifndef _WEB_PAGE_H_ #pragma once
#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_REBOOT "Save OK. Please reboot MCU" ///< WEB app msg save OK
@ -1412,6 +1411,4 @@ const char cookies_html[] PROGMEM = R"rawliteral(
</script> </script>
)rawliteral"; )rawliteral";
#endif
/* EOF */ /* EOF */

View File

@ -10,8 +10,7 @@
@bug: no know bug @bug: no know bug
*/ */
#ifndef _WEB_PAGE_ICONS_H_ #pragma once
#define _WEB_PAGE_ICONS_H_
/* ------------------------------------------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------------------------------------------ */
const char esp32_cam_logo_svg[] PROGMEM = R"rawliteral( const char esp32_cam_logo_svg[] PROGMEM = R"rawliteral(
@ -89,7 +88,4 @@ const char favicon_svg[] PROGMEM = R"rawliteral(
</svg> </svg>
)rawliteral"; )rawliteral";
#endif
/* EOF */ /* EOF */

View File

@ -10,7 +10,7 @@
*/ */
#include "server.h" #include "WebServer.h"
#include "Certificate.h" #include "Certificate.h"
AsyncWebServer server(WEB_SERVER_PORT); AsyncWebServer server(WEB_SERVER_PORT);

View File

@ -10,21 +10,16 @@
*/ */
#ifndef _SERVER_H_ #pragma once
#define _SERVER_H_
#include <AsyncEventSource.h> #include <Arduino.h>
#include <AsyncWebSocket.h> #include <WiFi.h>
#include <AsyncWebSynchronization.h> #include <AsyncTCP.h>
#include <ESPAsyncWebServer.h> #include <ESPAsyncWebServer.h>
#include <esp_task_wdt.h>
#include <StringArray.h>
#include <WiFiClientSecure.h>
#include <HTTPClient.h>
#include <EEPROM.h>
#include <Update.h>
#include <ArduinoJson.h> #include <ArduinoJson.h>
#include "micro_sd.h"
#include "log.h"
#include "WebPage.h" #include "WebPage.h"
#include "WebPage_Icons.h" #include "WebPage_Icons.h"
#include "mcu_cfg.h" #include "mcu_cfg.h"
@ -33,12 +28,9 @@
#include "cfg.h" #include "cfg.h"
#include "jquery.h" #include "jquery.h"
#include "system.h" #include "system.h"
#include "log.h"
#include "connect.h" #include "connect.h"
#include "wifi_mngt.h" #include "wifi_mngt.h"
#include "stream.h" #include "WebStream.h"
#include "exif.h"
extern AsyncWebServer server; ///< global variable for web server extern AsyncWebServer server; ///< global variable for web server
@ -67,6 +59,4 @@ bool Server_TransfeStringToBool(String);
String Server_TranslateBoolToString(bool); String Server_TranslateBoolToString(bool);
#endif
/* EOF */ /* EOF */

View File

@ -10,7 +10,7 @@
@bug: no know bug @bug: no know bug
*/ */
#include "stream.h" #include "WebStream.h"
#define PART_BOUNDARY "123456789000000000000987654321" ///< Must be unique for each stream #define PART_BOUNDARY "123456789000000000000987654321" ///< Must be unique for each stream
static const char *STREAM_CONTENT_TYPE = "multipart/x-mixed-replace;boundary=" PART_BOUNDARY; ///< content type for stream static const char *STREAM_CONTENT_TYPE = "multipart/x-mixed-replace;boundary=" PART_BOUNDARY; ///< content type for stream

View File

@ -11,12 +11,14 @@
@bug: no know bug @bug: no know bug
*/ */
#ifndef _STREAM_H_ #pragma once
#define _STREAM_H_
#include "ESPAsyncWebServer.h" #include <Arduino.h>
#include <WiFi.h>
#include <AsyncTCP.h>
#include <ESPAsyncWebServer.h>
#include "Arduino.h" #include "WebServer.h"
#include "mcu_cfg.h" #include "mcu_cfg.h"
#include "var.h" #include "var.h"
#include "log.h" #include "log.h"
@ -71,5 +73,4 @@ public:
size_t _content(uint8_t *, size_t , size_t ); size_t _content(uint8_t *, size_t , size_t );
}; };
#endif
/* EOF */ /* EOF */

View File

@ -48,9 +48,8 @@ void Camera::Init() {
log->AddEvent(LogLevel_Info, F("Init camera lib")); log->AddEvent(LogLevel_Info, F("Init camera lib"));
log->AddEvent(LogLevel_Info, F("Init GPIO")); log->AddEvent(LogLevel_Info, F("Init GPIO"));
ledcSetup(FLASH_PWM_CHANNEL, FLASH_PWM_FREQ, FLASH_PWM_RESOLUTION); ledcAttach(FLASH_GPIO_NUM, FLASH_PWM_FREQ, FLASH_PWM_RESOLUTION);
ledcAttachPin(FLASH_GPIO_NUM, FLASH_PWM_CHANNEL); ledcWrite(FLASH_GPIO_NUM, FLASH_OFF_STATUS);
ledcWrite(FLASH_PWM_CHANNEL, FLASH_OFF_STATUS);
InitCameraModule(); InitCameraModule();
ApplyCameraCfg(); ApplyCameraCfg();
@ -213,9 +212,9 @@ void Camera::SetPhotoSending(bool i_data) {
*/ */
void Camera::SetFlashStatus(bool i_data) { void Camera::SetFlashStatus(bool i_data) {
if (true == i_data) { if (true == i_data) {
ledcWrite(FLASH_PWM_CHANNEL, FLASH_ON_STATUS); ledcWrite(FLASH_GPIO_NUM, FLASH_ON_STATUS);
} else if (false == i_data) { } else if (false == i_data) {
ledcWrite(FLASH_PWM_CHANNEL, FLASH_OFF_STATUS); ledcWrite(FLASH_GPIO_NUM, FLASH_OFF_STATUS);
} }
} }
@ -225,9 +224,9 @@ void Camera::SetFlashStatus(bool i_data) {
@return bool - true = on, false = off @return bool - true = on, false = off
*/ */
bool Camera::GetFlashStatus() { bool Camera::GetFlashStatus() {
if (ledcRead(FLASH_PWM_CHANNEL) == FLASH_OFF_STATUS) { if (ledcRead(FLASH_GPIO_NUM) == FLASH_OFF_STATUS) {
return false; return false;
} else if (ledcRead(FLASH_PWM_CHANNEL) == FLASH_ON_STATUS) { } else if (ledcRead(FLASH_GPIO_NUM) == FLASH_ON_STATUS) {
return true; return true;
} }
@ -334,7 +333,7 @@ void Camera::CapturePhoto() {
CameraCaptureSuccess = false; CameraCaptureSuccess = false;
/* check flash, and enable FLASH LED */ /* check flash, and enable FLASH LED */
if (true == CameraFlashEnable) { if (true == CameraFlashEnable) {
ledcWrite(FLASH_PWM_CHANNEL, FLASH_ON_STATUS); ledcWrite(FLASH_GPIO_NUM, FLASH_ON_STATUS);
delay(CameraFlashTime); delay(CameraFlashTime);
} }
@ -403,7 +402,7 @@ void Camera::CapturePhoto() {
/* Disable flash */ /* Disable flash */
if (true == CameraFlashEnable) { if (true == CameraFlashEnable) {
//delay(CameraFlashTime); //delay(CameraFlashTime);
ledcWrite(FLASH_PWM_CHANNEL, FLASH_OFF_STATUS); ledcWrite(FLASH_GPIO_NUM, FLASH_OFF_STATUS);
} }
xSemaphoreGive(frameBufferSemaphore); xSemaphoreGive(frameBufferSemaphore);

View File

@ -9,8 +9,7 @@
@bug: no know bug @bug: no know bug
*/ */
#ifndef _CAMERA_H_ #pragma once
#define _CAMERA_H_
#include "esp_camera.h" #include "esp_camera.h"
#include "esp_timer.h" #include "esp_timer.h"
@ -18,13 +17,13 @@
#include "soc/soc.h" #include "soc/soc.h"
#include "soc/rtc_cntl_reg.h" #include "soc/rtc_cntl_reg.h"
#include "micro_sd.h"
#include "log.h"
#include "cfg.h" #include "cfg.h"
#include "exif.h" #include "exif.h"
#include "module_templates.h" #include "module_templates.h"
#include "Arduino.h"
#include "mcu_cfg.h" #include "mcu_cfg.h"
#include "var.h" #include "var.h"
#include "log.h"
class Configuration; class Configuration;
@ -176,6 +175,4 @@ public:
extern Camera SystemCamera; ///< Camera object extern Camera SystemCamera; ///< Camera object
#endif
/* EOF */ /* EOF */

View File

@ -9,19 +9,20 @@
@bug: no know bug @bug: no know bug
*/ */
#ifndef _CFG_H_ #pragma once
#define _CFG_H_
#include <WiFi.h>
#include <EEPROM.h>
#include "Arduino.h" #include <EEPROM.h>
#include <Arduino.h>
#include <ArduinoUniqueID.h> #include <ArduinoUniqueID.h>
#include <base64.h> #include <base64.h>
#include "micro_sd.h"
#include "log.h"
#include "log_level.h"
#include "mcu_cfg.h" #include "mcu_cfg.h"
#include "module_templates.h" #include "module_templates.h"
#include "var.h" #include "var.h"
#include "log.h" #include "wifi_mngt.h"
class Configuration { class Configuration {
public: public:
@ -139,6 +140,4 @@ private:
extern Configuration SystemConfig; ///< Configuration object extern Configuration SystemConfig; ///< Configuration object
#endif
/* EOF */ /* EOF */

View File

@ -8,14 +8,12 @@
@bug: no know bug @bug: no know bug
*/ */
#pragma once
#ifndef _PRUSA_CONNECT_H_
#define _PRUSA_CONNECT_H_
#include <WiFiClientSecure.h> #include <WiFiClientSecure.h>
#include <HTTPClient.h> #include <HTTPClient.h>
#include <esp_task_wdt.h> #include <esp_task_wdt.h>
#include "Arduino.h" #include <Arduino.h>
#include <ArduinoJson.h> #include <ArduinoJson.h>
#include "wifi_mngt.h" #include "wifi_mngt.h"
@ -26,27 +24,11 @@
#include "cfg.h" #include "cfg.h"
#include "Certificate.h" #include "Certificate.h"
#include "server.h" #include "server.h"
#include "connect_types.h"
class WiFiMngt; class WiFiMngt;
class Configuration;
/** class Camera;
* @brief BackendAvailabilitStatus enum
* status of backend availability
*/
enum BackendAvailabilitStatus {
WaitForFirstConnection = 0, ///< waiting for first connection to backend
BackendAvailable = 1, ///< backend is available
BackendUnavailable = 2, ///< backend is unavailable
};
/**
* @brief SendDataToBackendType enum
* type of data to send to backend
*/
enum SendDataToBackendType {
SendPhoto = 0, ///< send photo to backend
SendInfo = 1, ///< send device information to backend
};
class PrusaConnect { class PrusaConnect {
private: private:
@ -109,4 +91,4 @@ public:
extern PrusaConnect Connect; ///< PrusaConnect object extern PrusaConnect Connect; ///< PrusaConnect object
#endif /* EOF */

View File

@ -0,0 +1,20 @@
#pragma once
/**
* @brief BackendAvailabilitStatus enum
* status of backend availability
*/
enum BackendAvailabilitStatus {
WaitForFirstConnection = 0, ///< waiting for first connection to backend
BackendAvailable = 1, ///< backend is available
BackendUnavailable = 2, ///< backend is unavailable
};
/**
* @brief SendDataToBackendType enum
* type of data to send to backend
*/
enum SendDataToBackendType {
SendPhoto = 0, ///< send photo to backend
SendInfo = 1, ///< send device information to backend
};

File diff suppressed because one or more lines are too long

View File

@ -9,22 +9,12 @@
@bug: no know bug @bug: no know bug
*/ */
#ifndef _LOG_H_ #pragma once
#define _LOG_H_
#include "Arduino.h" #include <Arduino.h>
#include "mcu_cfg.h"
#include "var.h"
#include "micro_sd.h" #include "micro_sd.h"
#include "module_templates.h" #include "log_level.h"
enum LogLevel_enum {
LogLevel_Error = 0, ///< Error
LogLevel_Warning = 1, ///< Warning
LogLevel_Info = 2, ///< Info
LogLevel_Verbose = 3 ///< Verbose
};
class Logs : public MicroSd { class Logs : public MicroSd {
private: private:
@ -71,6 +61,4 @@ public:
extern Logs SystemLog; ///< log object extern Logs SystemLog; ///< log object
#endif
/* EOF */ /* EOF */

View File

@ -0,0 +1,10 @@
#pragma once
enum LogLevel_enum {
LogLevel_Error = 0, ///< Error
LogLevel_Warning = 1, ///< Warning
LogLevel_Info = 2, ///< Info
LogLevel_Verbose = 3 ///< Verbose
};
/* EOF */

View File

@ -50,7 +50,7 @@
/* --------------- WEB SERVER CFG --------------*/ /* --------------- WEB SERVER CFG --------------*/
#define WEB_SERVER_PORT 80 ///< WEB server port #define WEB_SERVER_PORT 80 ///< WEB server port
#define SERIAL_PORT_SPEED 115200 ///< baud rate #define SERIAL_PORT_SPEED 115200 ///< baud rate
#define WDG_TIMEOUT 40 ///< wdg timeout [second] #define WDG_TIMEOUT 40 ///< wdg timeout [second]
#define PHOTO_FRAGMENT_SIZE 5120 ///< photo fragmentation size [bytes] #define PHOTO_FRAGMENT_SIZE 5120 ///< photo fragmentation size [bytes]
#define LOOP_DELAY 100 ///< loop delay [ms] #define LOOP_DELAY 100 ///< loop delay [ms]
#define WIFI_CLIENT_WAIT_CON false ///< wait for connecting to WiFi network #define WIFI_CLIENT_WAIT_CON false ///< wait for connecting to WiFi network

View File

@ -21,12 +21,11 @@
D1 4 D1 4
*/ */
#ifndef _MICRO_SD_H_ #pragma once
#define _MICRO_SD_H_
#include "Arduino.h" #include <Arduino.h>
#include "FS.h" #include <FS.h>
#include "SD_MMC.h" #include <SD_MMC.h>
#include "mcu_cfg.h" #include "mcu_cfg.h"
#include "module_templates.h" #include "module_templates.h"
@ -87,6 +86,4 @@ public:
uint8_t GetUsedSpacePercent(); uint8_t GetUsedSpacePercent();
}; };
#endif
/* EOF */ /* EOF */

View File

@ -21,8 +21,7 @@
*/ */
#ifndef __MODULE_AI_THINKER_ESP32_CAM_H__ #pragma once
#define __MODULE_AI_THINKER_ESP32_CAM_H__
#include "mcu_cfg.h" #include "mcu_cfg.h"
@ -70,5 +69,4 @@
#define STATUS_LED_OFF_PIN_LEVEL LOW ///< GPIO pin level for status LED ON #define STATUS_LED_OFF_PIN_LEVEL LOW ///< GPIO pin level for status LED ON
#endif // AI_THINKER_ESP32_CAM #endif // AI_THINKER_ESP32_CAM
#endif // MODULE_AI_THINKER_ESP32_CAM_H
/* EOF */ /* EOF */

View File

@ -21,8 +21,7 @@
*/ */
#ifndef __MODULE_ESP32_WROVER_DEV_H__ #pragma once
#define __MODULE_ESP32_WROVER_DEV_H__
#include "mcu_cfg.h" #include "mcu_cfg.h"
@ -70,5 +69,4 @@
#define STATUS_LED_OFF_PIN_LEVEL HIGH ///< GPIO pin level for status LED ON #define STATUS_LED_OFF_PIN_LEVEL HIGH ///< GPIO pin level for status LED ON
#endif // ESP32_WROVER_DEV #endif // ESP32_WROVER_DEV
#endif // MODULE_ESP32_WROVER_DEV_H
/* EOF */ /* EOF */

View File

@ -10,8 +10,7 @@
*/ */
#ifndef __MODULE_TEMPLATES_H__ #pragma once
#define __MODULE_TEMPLATES_H__
#include "mcu_cfg.h" #include "mcu_cfg.h"
@ -23,5 +22,4 @@
#include "module_ESP32-WROVER-DEV.h" #include "module_ESP32-WROVER-DEV.h"
#endif #endif
#endif // MODULE_TEMPLATES_H
/* EOF */ /* EOF */

View File

@ -9,10 +9,9 @@
@bug: no know bug @bug: no know bug
*/ */
#ifndef _SERIAL_CFG_H #pragma once
#define _SERIAL_CFG_H
#include "Arduino.h" #include <Arduino.h>
#include "mcu_cfg.h" #include "mcu_cfg.h"
#include "var.h" #include "var.h"
@ -48,6 +47,4 @@ public:
extern SerialCfg SystemSerialCfg; ///< SerialCfg object extern SerialCfg SystemSerialCfg; ///< SerialCfg object
#endif
/* EOF */ /* EOF */

View File

@ -9,12 +9,13 @@
@bug: no know bug @bug: no know bug
*/ */
#ifndef _SYS_LED_H_ #pragma once
#define _SYS_LED_H_
#include <Arduino.h>
#include "log.h" #include "log.h"
#include "mcu_cfg.h" #include "mcu_cfg.h"
#include "arduino.h"
class Logs;
class sys_led { class sys_led {
private: private:
@ -38,6 +39,4 @@ public:
extern sys_led system_led; extern sys_led system_led;
#endif
/* EOF */ /* EOF */

View File

@ -9,18 +9,17 @@
@bug: no know bug @bug: no know bug
*/ */
#ifndef _SYSTEM_H_ #pragma once
#define _SYSTEM_H_
#include <WiFi.h> #include <WiFi.h>
#include <Update.h> #include <Update.h>
#include "Arduino.h" #include <Arduino.h>
#include <WiFiClientSecure.h> #include <WiFiClientSecure.h>
#include <HTTPClient.h> #include <HTTPClient.h>
#include <HTTPUpdate.h> #include <HTTPUpdate.h>
#include <ArduinoJson.h> #include <ArduinoJson.h>
#include <esp_wifi.h> #include <esp_wifi.h>
#include "esp32/rom/rtc.h" #include <esp32/rom/rtc.h>
#include <esp_task_wdt.h> #include <esp_task_wdt.h>
#include "mcu_cfg.h" #include "mcu_cfg.h"
@ -65,5 +64,4 @@ void System_TaskSysLed(void *);
void System_TaskWiFiWatchdog(void *); void System_TaskWiFiWatchdog(void *);
void System_TaskSdCardRemove(void *); void System_TaskSdCardRemove(void *);
#endif
/* EOF */ /* EOF */

View File

@ -9,10 +9,9 @@
@bug: no know bug @bug: no know bug
*/ */
#ifndef _VARIABLE_H_ #pragma once
#define _VARIABLE_H_
#include "Arduino.h" #include <Arduino.h>
#include "mcu_cfg.h" #include "mcu_cfg.h"
struct WebBasicAuth_struct { struct WebBasicAuth_struct {
@ -53,6 +52,4 @@ extern TaskHandle_t Task_WiFiWatchdog; ///< task handle for wifi w
extern uint8_t StartRemoveSdCard; extern uint8_t StartRemoveSdCard;
extern uint32_t SdCardRemoveTime; extern uint32_t SdCardRemoveTime;
#endif
/* EOF */ /* EOF */

View File

@ -8,16 +8,14 @@
@bug: no know bug @bug: no know bug
*/ */
#pragma once
#ifndef _WIFI_MNGT_H_
#define _WIFI_MNGT_H_
#include <WiFi.h> #include <WiFi.h>
#include "Arduino.h" #include <Arduino.h>
#include <esp_task_wdt.h> #include <esp_task_wdt.h>
#include <ESPmDNS.h> #include <ESPmDNS.h>
#include <esp_wifi.h> #include <esp_wifi.h>
#include "esp32-hal-cpu.h" #include <esp32-hal-cpu.h>
#include "mcu_cfg.h" #include "mcu_cfg.h"
#include "var.h" #include "var.h"
@ -143,6 +141,4 @@ public:
extern WiFiMngt SystemWifiMngt; ///< global variable for wifi management extern WiFiMngt SystemWifiMngt; ///< global variable for wifi management
#endif
/* EOF */ /* EOF */