diff --git a/code/components/jomjol_configfile/configFile.cpp b/code/components/jomjol_configfile/configFile.cpp index 0e1dd70a..775661b6 100644 --- a/code/components/jomjol_configfile/configFile.cpp +++ b/code/components/jomjol_configfile/configFile.cpp @@ -6,6 +6,8 @@ #include "configFile.h" #include +#include "../../include/defines.h" + static const char *TAG = "CONFIG"; ConfigFile::ConfigFile(std::string filePath) diff --git a/code/components/jomjol_controlGPIO/server_GPIO.cpp b/code/components/jomjol_controlGPIO/server_GPIO.cpp index ba9019f6..b3cc67a9 100644 --- a/code/components/jomjol_controlGPIO/server_GPIO.cpp +++ b/code/components/jomjol_controlGPIO/server_GPIO.cpp @@ -10,15 +10,12 @@ #include "server_tflite.h" -//#define LOG_LOCAL_LEVEL ESP_LOG_DEBUG #include "esp_log.h" -//#include "errno.h" #include #include -//#include -#include "defines.h" +#include "../../include/defines.h" #include "server_GPIO.h" @@ -29,11 +26,10 @@ #include "interface_mqtt.h" #endif //ENABLE_MQTT + static const char *TAG = "GPIO"; QueueHandle_t gpio_queue_handle = NULL; -//#define DEBUG_DETAIL_ON - GpioPin::GpioPin(gpio_num_t gpio, const char* name, gpio_pin_mode_t mode, gpio_int_type_t interruptType, uint8_t dutyResolution, std::string mqttTopic, bool httpEnable) { _gpio = gpio; diff --git a/code/components/jomjol_controlGPIO/server_GPIO.h b/code/components/jomjol_controlGPIO/server_GPIO.h index 6f104603..4a71036f 100644 --- a/code/components/jomjol_controlGPIO/server_GPIO.h +++ b/code/components/jomjol_controlGPIO/server_GPIO.h @@ -9,11 +9,6 @@ #include "SmartLeds.h" -//#include "ClassControllCamera.h" - -// wenn __LEDGLOBAL definiert ist, wird eine globale Variable für die LED-Ansteuerung verwendet, ansonsten lokal und jedesmal neu -#define __LEDGLOBAL - typedef enum { GPIO_PIN_MODE_DISABLED = 0x0, GPIO_PIN_MODE_INPUT = 0x1, diff --git a/code/components/jomjol_controlcamera/ClassControllCamera.cpp b/code/components/jomjol_controlcamera/ClassControllCamera.cpp index 666993e6..f70e459c 100644 --- a/code/components/jomjol_controlcamera/ClassControllCamera.cpp +++ b/code/components/jomjol_controlcamera/ClassControllCamera.cpp @@ -12,9 +12,7 @@ #include "server_ota.h" #include "server_GPIO.h" - -#define BOARD_ESP32CAM_AITHINKER - +#include "../../include/defines.h" #include #include @@ -28,45 +26,7 @@ #include "esp_camera.h" -// #define DEBUG_DETAIL_ON - -#define USE_PWM_LEDFLASH - -#ifdef USE_PWM_LEDFLASH - -//// PWM für Flash-LED -#define LEDC_TIMER LEDC_TIMER_1 // LEDC_TIMER_0 -#define LEDC_MODE LEDC_LOW_SPEED_MODE -#define LEDC_OUTPUT_IO (4) // Define the output GPIO -#define LEDC_CHANNEL LEDC_CHANNEL_1 -#define LEDC_DUTY_RES LEDC_TIMER_13_BIT // Set duty resolution to 13 bits -//#define LEDC_DUTY (195) // Set duty to 50%. ((2 ** 13) - 1) * 50% = 4095 -#define LEDC_FREQUENCY (5000) // Frequency in Hertz. Set frequency at 5 kHz - -#endif - - - -// ESP32Cam (AiThinker) PIN Map - -#define CAM_PIN_PWDN 32 -#define CAM_PIN_RESET -1 //software reset will be performed -#define CAM_PIN_XCLK 0 -#define CAM_PIN_SIOD 26 -#define CAM_PIN_SIOC 27 - -#define CAM_PIN_D7 35 -#define CAM_PIN_D6 34 -#define CAM_PIN_D5 39 -#define CAM_PIN_D4 36 -#define CAM_PIN_D3 21 -#define CAM_PIN_D2 19 -#define CAM_PIN_D1 18 -#define CAM_PIN_D0 5 -#define CAM_PIN_VSYNC 25 -#define CAM_PIN_HREF 23 -#define CAM_PIN_PCLK 22 - +#include "driver/ledc.h" static const char *TAG = "CAM"; @@ -107,13 +67,10 @@ static camera_config_t camera_config = { }; -#include "driver/ledc.h" + CCamera Camera; -#define FLASH_GPIO GPIO_NUM_4 -#define BLINK_GPIO GPIO_NUM_33 - typedef struct { httpd_req_t *req; size_t len; diff --git a/code/components/jomjol_controlcamera/ClassControllCamera.h b/code/components/jomjol_controlcamera/ClassControllCamera.h index 3bac8f0e..68be8724 100644 --- a/code/components/jomjol_controlcamera/ClassControllCamera.h +++ b/code/components/jomjol_controlcamera/ClassControllCamera.h @@ -11,10 +11,7 @@ #include #include #include "CImageBasis.h" - - -#define CAMERA_MODEL_AI_THINKER - +#include "../../include/defines.h" class CCamera { protected: diff --git a/code/components/jomjol_controlcamera/server_camera.cpp b/code/components/jomjol_controlcamera/server_camera.cpp index b5955451..2cac56b2 100644 --- a/code/components/jomjol_controlcamera/server_camera.cpp +++ b/code/components/jomjol_controlcamera/server_camera.cpp @@ -9,16 +9,13 @@ #include "ClassLogFile.h" #include "esp_log.h" +#include "../../include/defines.h" + static const char *TAG = "server_cam"; -#define SCRATCH_BUFSIZE2 8192 -char scratch2[SCRATCH_BUFSIZE2]; -//#define DEBUG_DETAIL_ON +void PowerResetCamera(){ - -void PowerResetCamera() -{ ESP_LOGD(TAG, "Resetting camera by power down line"); gpio_config_t conf; conf.intr_type = GPIO_INTR_DISABLE; diff --git a/code/components/jomjol_fileserver_ota/server_file.cpp b/code/components/jomjol_fileserver_ota/server_file.cpp index 00efaeeb..917e75fc 100644 --- a/code/components/jomjol_fileserver_ota/server_file.cpp +++ b/code/components/jomjol_fileserver_ota/server_file.cpp @@ -33,7 +33,7 @@ extern "C" { #include #include "esp_http_server.h" -#include "defines.h" +#include "../../include/defines.h" #include "ClassLogFile.h" #include "server_tflite.h" @@ -47,30 +47,15 @@ extern "C" { #include "Helper.h" #include "miniz.h" + static const char *TAG = "OTA FILE"; -/* Max length a file path can have on storage */ -// #define FILE_PATH_MAX (ESP_VFS_PATH_MAX + CONFIG_SPIFFS_OBJ_NAME_LEN) -#define FILE_PATH_MAX (255) - -/* Max size of an individual file. Make sure this - * value is same as that set in upload_script.html */ -#define MAX_FILE_SIZE (8000*1024) // 8 MB -#define MAX_FILE_SIZE_STR "8MB" - - -/* Scratch buffer size */ -#define SCRATCH_BUFSIZE 4096 - -/* Size of partial log file to return */ -#define LOGFILE_LAST_PART_BYTES SCRATCH_BUFSIZE * 20 /* 80 kBytes */ - struct file_server_data { /* Base path of file storage */ char base_path[ESP_VFS_PATH_MAX + 1]; /* Scratch buffer for temporary storage during file transfer */ - char scratch[SCRATCH_BUFSIZE]; + char scratch[SERVER_FILER_SCRATCH_BUFSIZE]; }; @@ -236,7 +221,7 @@ static esp_err_t http_resp_dir_html(httpd_req_t *req, const char *dirpath, const char *chunk = ((struct file_server_data *)req->user_ctx)->scratch; size_t chunksize; do { - chunksize = fread(chunk, 1, SCRATCH_BUFSIZE, fd); + chunksize = fread(chunk, 1, SERVER_FILER_SCRATCH_BUFSIZE, fd); // ESP_LOGD(TAG, "Chunksize %d", chunksize); if (chunksize > 0){ if (httpd_resp_send_chunk(req, chunk, chunksize) != ESP_OK) { @@ -322,10 +307,10 @@ static esp_err_t http_resp_dir_html(httpd_req_t *req, const char *dirpath, const httpd_resp_sendstr_chunk(req, NULL); return ESP_OK; } - +/* #define IS_FILE_EXT(filename, ext) \ (strcasecmp(&filename[strlen(filename) - sizeof(ext) + 1], ext) == 0) - +*/ static esp_err_t logfileact_get_full_handler(httpd_req_t *req) { return send_logfile(req, true); @@ -405,7 +390,7 @@ static esp_err_t send_datafile(httpd_req_t *req, bool send_full_file) size_t chunksize; do { /* Read file in chunks into the scratch buffer */ - chunksize = fread(chunk, 1, SCRATCH_BUFSIZE, fd); + chunksize = fread(chunk, 1, SERVER_FILER_SCRATCH_BUFSIZE, fd); /* Send the buffer contents as HTTP response chunk */ if (httpd_resp_send_chunk(req, chunk, chunksize) != ESP_OK) { @@ -490,7 +475,7 @@ static esp_err_t send_logfile(httpd_req_t *req, bool send_full_file) size_t chunksize; do { /* Read file in chunks into the scratch buffer */ - chunksize = fread(chunk, 1, SCRATCH_BUFSIZE, fd); + chunksize = fread(chunk, 1, SERVER_FILER_SCRATCH_BUFSIZE, fd); /* Send the buffer contents as HTTP response chunk */ if (httpd_resp_send_chunk(req, chunk, chunksize) != ESP_OK) { @@ -592,7 +577,7 @@ static esp_err_t download_get_handler(httpd_req_t *req) size_t chunksize; do { /* Read file in chunks into the scratch buffer */ - chunksize = fread(chunk, 1, SCRATCH_BUFSIZE, fd); + chunksize = fread(chunk, 1, SERVER_FILER_SCRATCH_BUFSIZE, fd); /* Send the buffer contents as HTTP response chunk */ if (httpd_resp_send_chunk(req, chunk, chunksize) != ESP_OK) { @@ -684,7 +669,7 @@ static esp_err_t upload_post_handler(httpd_req_t *req) ESP_LOGI(TAG, "Remaining size: %d", remaining); /* Receive the file part by part into a buffer */ - if ((received = httpd_req_recv(req, buf, MIN(remaining, SCRATCH_BUFSIZE))) <= 0) { + if ((received = httpd_req_recv(req, buf, MIN(remaining, SERVER_FILER_SCRATCH_BUFSIZE))) <= 0) { if (received == HTTPD_SOCK_ERR_TIMEOUT) { /* Retry if timeout occurred */ continue; diff --git a/code/components/jomjol_fileserver_ota/server_help.cpp b/code/components/jomjol_fileserver_ota/server_help.cpp index 92a08c27..8cef9ce7 100644 --- a/code/components/jomjol_fileserver_ota/server_help.cpp +++ b/code/components/jomjol_fileserver_ota/server_help.cpp @@ -21,16 +21,12 @@ extern "C" { #include "esp_http_server.h" +#include "../../include/defines.h" + static const char *TAG = "SERVER HELP"; -#define SCRATCH_BUFSIZE 8192 -char scratch[SCRATCH_BUFSIZE]; - - -#define IS_FILE_EXT(filename, ext) \ - (strcasecmp(&filename[strlen(filename) - sizeof(ext) + 1], ext) == 0) - +char scratch[SERVER_HELPER_SCRATCH_BUFSIZE]; esp_err_t send_file(httpd_req_t *req, std::string filename) { @@ -51,7 +47,7 @@ esp_err_t send_file(httpd_req_t *req, std::string filename) size_t chunksize; do { /* Read file in chunks into the scratch buffer */ - chunksize = fread(chunk, 1, SCRATCH_BUFSIZE, fd); + chunksize = fread(chunk, 1, SERVER_HELPER_SCRATCH_BUFSIZE, fd); /* Send the buffer contents as HTTP response chunk */ if (httpd_resp_send_chunk(req, chunk, chunksize) != ESP_OK) { diff --git a/code/components/jomjol_fileserver_ota/server_ota.cpp b/code/components/jomjol_fileserver_ota/server_ota.cpp index 41d5e128..60bec35e 100644 --- a/code/components/jomjol_fileserver_ota/server_ota.cpp +++ b/code/components/jomjol_fileserver_ota/server_ota.cpp @@ -37,20 +37,11 @@ #include "ClassLogFile.h" #include "Helper.h" - - -// #define DEBUG_DETAIL_ON - - -#define BUFFSIZE 1024 -#define HASH_LEN 32 /* SHA-256 digest length */ - +#include "../../include/defines.h" /*an ota data write buffer ready to write to the flash*/ -static char ota_write_data[BUFFSIZE + 1] = { 0 }; +static char ota_write_data[SERVER_OTA_SCRATCH_BUFSIZE + 1] = { 0 }; - -#define OTA_URL_SIZE 256 static const char *TAG = "OTA"; esp_err_t handler_reboot(httpd_req_t *req); @@ -169,7 +160,7 @@ static bool ota_update_task(std::string fn) return false; } - data_read = fread(ota_write_data, 1, BUFFSIZE, f); + data_read = fread(ota_write_data, 1, SERVER_OTA_SCRATCH_BUFSIZE, f); while (data_read > 0) { if (data_read < 0) { @@ -239,7 +230,7 @@ static bool ota_update_task(std::string fn) break; } } - data_read = fread(ota_write_data, 1, BUFFSIZE, f); + data_read = fread(ota_write_data, 1, SERVER_OTA_SCRATCH_BUFSIZE, f); } fclose(f); diff --git a/code/components/jomjol_flowcontroll/ClassFlow.cpp b/code/components/jomjol_flowcontroll/ClassFlow.cpp index 48f7fdd6..491f2879 100644 --- a/code/components/jomjol_flowcontroll/ClassFlow.cpp +++ b/code/components/jomjol_flowcontroll/ClassFlow.cpp @@ -4,6 +4,7 @@ #include #include #include "esp_log.h" +#include "../../include/defines.h" static const char *TAG = "CLASS"; diff --git a/code/components/jomjol_flowcontroll/ClassFlow.h b/code/components/jomjol_flowcontroll/ClassFlow.h index fa947f16..f8760e45 100644 --- a/code/components/jomjol_flowcontroll/ClassFlow.h +++ b/code/components/jomjol_flowcontroll/ClassFlow.h @@ -9,10 +9,6 @@ using namespace std; -#define LOGFILE_TIME_FORMAT "%Y%m%d-%H%M%S" -#define LOGFILE_TIME_FORMAT_DATE_EXTR substr(0, 8) -#define LOGFILE_TIME_FORMAT_HOUR_EXTR substr(9, 2) - struct HTMLInfo { float val; diff --git a/code/components/jomjol_flowcontroll/ClassFlowAlignment.cpp b/code/components/jomjol_flowcontroll/ClassFlowAlignment.cpp index f68f721f..3442a5e2 100644 --- a/code/components/jomjol_flowcontroll/ClassFlowAlignment.cpp +++ b/code/components/jomjol_flowcontroll/ClassFlowAlignment.cpp @@ -7,6 +7,7 @@ #include "ClassLogFile.h" +#include "../../include/defines.h" static const char *TAG = "ALIGN"; diff --git a/code/components/jomjol_flowcontroll/ClassFlowCNNGeneral.cpp b/code/components/jomjol_flowcontroll/ClassFlowCNNGeneral.cpp index 800e75ec..a07da032 100644 --- a/code/components/jomjol_flowcontroll/ClassFlowCNNGeneral.cpp +++ b/code/components/jomjol_flowcontroll/ClassFlowCNNGeneral.cpp @@ -8,6 +8,7 @@ #include "CTfLiteClass.h" #include "ClassLogFile.h" #include "esp_log.h" +#include "../../include/defines.h" static const char* TAG = "CNN"; diff --git a/code/components/jomjol_flowcontroll/ClassFlowCNNGeneral.h b/code/components/jomjol_flowcontroll/ClassFlowCNNGeneral.h index 2452f002..e090a449 100644 --- a/code/components/jomjol_flowcontroll/ClassFlowCNNGeneral.h +++ b/code/components/jomjol_flowcontroll/ClassFlowCNNGeneral.h @@ -23,13 +23,15 @@ protected: t_CNNType CNNType; std::vector GENERAL; float CNNGoodThreshold; - float AnalogFehler = 3.0; - float AnalogToDigtalFehler = 0.8; - float DigitalUnschaerfe = 0.2; - int DigitalBand = 3; - float DigitalAnalogerVorgaengerUebergangsbereich = 2; - float DigitalUebergangsbereichVorgaenger = 0.7; // 9.3 - 0.7 - float DigitalUebergangsbereichVorlauf = 9.7; // Vorlauf-Nulldurchgang passiert erst ab ca. 9.7 + //moved to define.h + //float Analog_error = 3.0; + //float AnalogToDigtalFehler = 0.8; + //float Digital_Uncertainty = 0.2; + //int DigitalBand = 3; + //float Digital_Transition_Range_Predecessor = 2; + //float Digital_Transition_Area_Predecessor = 0.7; // 9.3 - 0.7 + //float Digital_Transition_Area_Forward = 9.7; // Pre-run zero crossing only happens from approx. 9.7 onwards + string cnnmodelfile; int modelxsize, modelysize, modelchannel; diff --git a/code/components/jomjol_flowcontroll/ClassFlowControll.cpp b/code/components/jomjol_flowcontroll/ClassFlowControll.cpp index ed5459da..afffd9bb 100644 --- a/code/components/jomjol_flowcontroll/ClassFlowControll.cpp +++ b/code/components/jomjol_flowcontroll/ClassFlowControll.cpp @@ -24,11 +24,8 @@ extern "C" { #include "server_mqtt.h" #endif //ENABLE_MQTT -//#include "CImg.h" - #include "server_help.h" - -//#define DEBUG_DETAIL_ON +#include "../../include/defines.h" static const char* TAG = "CTRL"; diff --git a/code/components/jomjol_flowcontroll/ClassFlowControll.h b/code/components/jomjol_flowcontroll/ClassFlowControll.h index 2113c91b..23bfb404 100644 --- a/code/components/jomjol_flowcontroll/ClassFlowControll.h +++ b/code/components/jomjol_flowcontroll/ClassFlowControll.h @@ -19,13 +19,6 @@ #include "ClassFlowCNNGeneral.h" #include "ClassFlowWriteList.h" - -#define READOUT_TYPE_VALUE 0 -#define READOUT_TYPE_PREVALUE 1 -#define READOUT_TYPE_RAWVALUE 2 -#define READOUT_TYPE_ERROR 3 - - class ClassFlowControll : public ClassFlow { diff --git a/code/components/jomjol_flowcontroll/ClassFlowImage.cpp b/code/components/jomjol_flowcontroll/ClassFlowImage.cpp index 89732104..ec892075 100644 --- a/code/components/jomjol_flowcontroll/ClassFlowImage.cpp +++ b/code/components/jomjol_flowcontroll/ClassFlowImage.cpp @@ -15,6 +15,7 @@ extern "C" { #include "ClassLogFile.h" #include "CImageBasis.h" #include "esp_log.h" +#include "../../include/defines.h" static const char* TAG = "IMG"; diff --git a/code/components/jomjol_flowcontroll/ClassFlowInfluxDB.cpp b/code/components/jomjol_flowcontroll/ClassFlowInfluxDB.cpp index f9406dca..9d91ec22 100644 --- a/code/components/jomjol_flowcontroll/ClassFlowInfluxDB.cpp +++ b/code/components/jomjol_flowcontroll/ClassFlowInfluxDB.cpp @@ -9,6 +9,7 @@ #include "ClassFlowPostProcessing.h" #include "esp_log.h" +#include "../../include/defines.h" #include diff --git a/code/components/jomjol_flowcontroll/ClassFlowMQTT.cpp b/code/components/jomjol_flowcontroll/ClassFlowMQTT.cpp index 3ad5f8de..10a53ea6 100644 --- a/code/components/jomjol_flowcontroll/ClassFlowMQTT.cpp +++ b/code/components/jomjol_flowcontroll/ClassFlowMQTT.cpp @@ -15,14 +15,9 @@ #include "server_mqtt.h" #include - - -#define __HIDE_PASSWORD +#include "../../include/defines.h" static const char *TAG = "MQTT"; -#define LWT_TOPIC "connection" -#define LWT_CONNECTED "connected" -#define LWT_DISCONNECTED "connection lost" extern const char* libfive_git_version(void); extern const char* libfive_git_revision(void); diff --git a/code/components/jomjol_flowcontroll/ClassFlowMakeImage.cpp b/code/components/jomjol_flowcontroll/ClassFlowMakeImage.cpp index 9cae2205..ef28d5f8 100644 --- a/code/components/jomjol_flowcontroll/ClassFlowMakeImage.cpp +++ b/code/components/jomjol_flowcontroll/ClassFlowMakeImage.cpp @@ -7,6 +7,7 @@ #include "esp_wifi.h" #include "esp_log.h" +#include "../../include/defines.h" #include diff --git a/code/components/jomjol_flowcontroll/ClassFlowMakeImage.h b/code/components/jomjol_flowcontroll/ClassFlowMakeImage.h index 4150cf7f..048c19a3 100644 --- a/code/components/jomjol_flowcontroll/ClassFlowMakeImage.h +++ b/code/components/jomjol_flowcontroll/ClassFlowMakeImage.h @@ -1,15 +1,10 @@ #pragma once #include "ClassFlowImage.h" #include "ClassControllCamera.h" +#include "../../include/defines.h" #include -#define BLINK_GPIO GPIO_NUM_4 - -#define CAMERA_MODEL_AI_THINKER - - - class ClassFlowMakeImage : public ClassFlowImage { diff --git a/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.cpp b/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.cpp index 614cef99..f125189f 100644 --- a/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.cpp +++ b/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.cpp @@ -11,16 +11,10 @@ #include "time_sntp.h" #include "esp_log.h" +#include "../../include/defines.h" static const char* TAG = "POSTPROC"; -//#define SERIAL_DEBUG // testing debug on serial enabled - - -#define PREVALUE_TIME_FORMAT_OUTPUT "%Y-%m-%dT%H:%M:%S%z" -#define PREVALUE_TIME_FORMAT_INPUT "%d-%d-%dT%d:%d:%d" - - std::string ClassFlowPostProcessing::getNumbersName() { std::string ret=""; diff --git a/code/components/jomjol_flowcontroll/ClassFlowWriteList.cpp b/code/components/jomjol_flowcontroll/ClassFlowWriteList.cpp index 40d5ca02..9e987f12 100644 --- a/code/components/jomjol_flowcontroll/ClassFlowWriteList.cpp +++ b/code/components/jomjol_flowcontroll/ClassFlowWriteList.cpp @@ -3,7 +3,7 @@ #include "Helper.h" #include "time_sntp.h" - +#include "../../include/defines.h" #include diff --git a/code/components/jomjol_flowcontroll/camera_define.h b/code/components/jomjol_flowcontroll/camera_define.h deleted file mode 100644 index 8629c232..00000000 --- a/code/components/jomjol_flowcontroll/camera_define.h +++ /dev/null @@ -1,101 +0,0 @@ -#ifndef CAMERADEFINED -#define CAMERADEFINED - - -#if defined(CAMERA_MODEL_WROVER_KIT) -#define PWDN_GPIO_NUM -1 -#define RESET_GPIO_NUM -1 -#define XCLK_GPIO_NUM 21 -#define SIOD_GPIO_NUM 26 -#define SIOC_GPIO_NUM 27 - -#define Y9_GPIO_NUM 35 -#define Y8_GPIO_NUM 34 -#define Y7_GPIO_NUM 39 -#define Y6_GPIO_NUM 36 -#define Y5_GPIO_NUM 19 -#define Y4_GPIO_NUM 18 -#define Y3_GPIO_NUM 5 -#define Y2_GPIO_NUM 4 -#define VSYNC_GPIO_NUM 25 -#define HREF_GPIO_NUM 23 -#define PCLK_GPIO_NUM 22 - -#elif defined(CAMERA_MODEL_M5STACK_PSRAM) -#define PWDN_GPIO_NUM -1 -#define RESET_GPIO_NUM 15 -#define XCLK_GPIO_NUM 27 -#define SIOD_GPIO_NUM 25 -#define SIOC_GPIO_NUM 23 - -#define Y9_GPIO_NUM 19 -#define Y8_GPIO_NUM 36 -#define Y7_GPIO_NUM 18 -#define Y6_GPIO_NUM 39 -#define Y5_GPIO_NUM 5 -#define Y4_GPIO_NUM 34 -#define Y3_GPIO_NUM 35 -#define Y2_GPIO_NUM 32 -#define VSYNC_GPIO_NUM 22 -#define HREF_GPIO_NUM 26 -#define PCLK_GPIO_NUM 21 - -#elif defined(CAMERA_MODEL_AI_THINKER) -#define PWDN_GPIO_NUM GPIO_NUM_32 -#define RESET_GPIO_NUM -1 -#define XCLK_GPIO_NUM GPIO_NUM_0 -#define SIOD_GPIO_NUM GPIO_NUM_26 -#define SIOC_GPIO_NUM GPIO_NUM_27 - -#define Y9_GPIO_NUM GPIO_NUM_35 -#define Y8_GPIO_NUM GPIO_NUM_34 -#define Y7_GPIO_NUM GPIO_NUM_39 -#define Y6_GPIO_NUM GPIO_NUM_36 -#define Y5_GPIO_NUM GPIO_NUM_21 -#define Y4_GPIO_NUM GPIO_NUM_19 -#define Y3_GPIO_NUM GPIO_NUM_18 -#define Y2_GPIO_NUM GPIO_NUM_5 -#define VSYNC_GPIO_NUM GPIO_NUM_25 -#define HREF_GPIO_NUM GPIO_NUM_23 -#define PCLK_GPIO_NUM GPIO_NUM_22 - -#else -#error "Camera model not selected" -#endif - - - -static camera_config_t camera_config = { - .pin_pwdn = PWDN_GPIO_NUM, - .pin_reset = RESET_GPIO_NUM, - .pin_xclk = XCLK_GPIO_NUM, - .pin_sscb_sda = SIOD_GPIO_NUM, - .pin_sscb_scl = SIOC_GPIO_NUM, - - .pin_d7 = Y9_GPIO_NUM, - .pin_d6 = Y8_GPIO_NUM, - .pin_d5 = Y7_GPIO_NUM, - .pin_d4 = Y6_GPIO_NUM, - .pin_d3 = Y5_GPIO_NUM, - .pin_d2 = Y4_GPIO_NUM, - .pin_d1 = Y3_GPIO_NUM, - .pin_d0 = Y2_GPIO_NUM, - .pin_vsync = VSYNC_GPIO_NUM, - .pin_href = HREF_GPIO_NUM, - .pin_pclk = PCLK_GPIO_NUM, - - //XCLK 20MHz or 10MHz for OV2640 double FPS (Experimental) - .xclk_freq_hz = 20000000, - .ledc_timer = LEDC_TIMER_0, - .ledc_channel = LEDC_CHANNEL_0, - - .pixel_format = PIXFORMAT_JPEG,//YUV422,GRAYSCALE,RGB565,JPEG -// .pixel_format = PIXFORMAT_RGB888,//YUV422,GRAYSCALE,RGB565,JPEG -// .frame_size = FRAMESIZE_QVGA,//QQVGA-QXGA Do not use sizes above QVGA when not JPEG - .frame_size = FRAMESIZE_SVGA,//QQVGA-QXGA Do not use sizes above QVGA when not JPEG - - .jpeg_quality = 12, //0-63 lower number means higher quality - .fb_count = 1 //if more than one, i2s runs in continuous mode. Use only with JPEG -}; - -#endif diff --git a/code/components/jomjol_helper/Helper.cpp b/code/components/jomjol_helper/Helper.cpp index 1e7e28a1..4365b30d 100644 --- a/code/components/jomjol_helper/Helper.cpp +++ b/code/components/jomjol_helper/Helper.cpp @@ -23,6 +23,7 @@ extern "C" { #include #include +#include "../../include/defines.h" #include "ClassLogFile.h" @@ -31,9 +32,6 @@ extern "C" { static const char* TAG = "HELPER"; -//#define ISWINDOWS_TRUE -#define PATH_MAX_STRING_SIZE 256 - using namespace std; unsigned int systemStatus = 0; @@ -426,14 +424,14 @@ string getFileType(string filename) /* recursive mkdir */ int mkdir_r(const char *dir, const mode_t mode) { - char tmp[PATH_MAX_STRING_SIZE]; + char tmp[FILE_PATH_MAX]; char *p = NULL; struct stat sb; size_t len; /* copy path */ - len = strnlen (dir, PATH_MAX_STRING_SIZE); - if (len == 0 || len == PATH_MAX_STRING_SIZE) { + len = strnlen (dir, FILE_PATH_MAX); + if (len == 0 || len == FILE_PATH_MAX) { return -1; } memcpy (tmp, dir, len); diff --git a/code/components/jomjol_image_proc/CAlignAndCutImage.cpp b/code/components/jomjol_image_proc/CAlignAndCutImage.cpp index 3cec7419..0a08b3f6 100644 --- a/code/components/jomjol_image_proc/CAlignAndCutImage.cpp +++ b/code/components/jomjol_image_proc/CAlignAndCutImage.cpp @@ -2,19 +2,13 @@ #include "CRotateImage.h" #include "ClassLogFile.h" -#define _USE_MATH_DEFINES #include #include #include +#include "../../include/defines.h" static const char* TAG = "c_align_and_cut_image"; -//#define GET_MEMORY malloc -#define GET_MEMORY(X) heap_caps_malloc(X, MALLOC_CAP_SPIRAM) - -// #define DEBUG_DETAIL_ON - - CAlignAndCutImage::CAlignAndCutImage(CImageBasis *_org, CImageBasis *_temp) { rgb_image = _org->rgb_image; diff --git a/code/components/jomjol_image_proc/CFindTemplate.cpp b/code/components/jomjol_image_proc/CFindTemplate.cpp index f77ec19f..28f70a66 100644 --- a/code/components/jomjol_image_proc/CFindTemplate.cpp +++ b/code/components/jomjol_image_proc/CFindTemplate.cpp @@ -2,6 +2,7 @@ #include "ClassLogFile.h" #include "Helper.h" +#include "../../include/defines.h" #include diff --git a/code/components/jomjol_image_proc/CImageBasis.cpp b/code/components/jomjol_image_proc/CImageBasis.cpp index aed53aa3..48829d94 100644 --- a/code/components/jomjol_image_proc/CImageBasis.cpp +++ b/code/components/jomjol_image_proc/CImageBasis.cpp @@ -4,26 +4,20 @@ #include "server_ota.h" #include +#include "../../include/defines.h" #include "esp_system.h" #include - -#define _USE_MATH_DEFINES #include #include -#define _ESP32_PSRAM using namespace std; static const char *TAG = "C IMG BASIS"; -//#define DEBUG_DETAIL_ON - - - uint8_t * CImageBasis::RGBImageLock(int _waitmaxsec) { if (islocked) @@ -87,7 +81,6 @@ ImageData* CImageBasis::writeToMemoryAsJPG(const int quality) return ii; } -#define HTTP_BUFFER_SENT 1024 struct SendJPGHTTP { diff --git a/code/components/jomjol_image_proc/CImageBasis.h b/code/components/jomjol_image_proc/CImageBasis.h index bbe1b4ce..01f1540f 100644 --- a/code/components/jomjol_image_proc/CImageBasis.h +++ b/code/components/jomjol_image_proc/CImageBasis.h @@ -7,7 +7,8 @@ #include #include -#define _USE_MATH_DEFINES +#include "../../include/defines.h" + #include #include "stb_image.h" @@ -16,13 +17,6 @@ #include "esp_heap_caps.h" -//#define GET_MEMORY malloc -#define GET_MEMORY(X) heap_caps_malloc(X, MALLOC_CAP_SPIRAM) - - -#define MAX_JPG_SIZE 128000 - - struct ImageData { uint8_t data[MAX_JPG_SIZE]; diff --git a/code/components/jomjol_image_proc/make_stb.cpp b/code/components/jomjol_image_proc/make_stb.cpp index ee63f44e..cd02e4cd 100644 --- a/code/components/jomjol_image_proc/make_stb.cpp +++ b/code/components/jomjol_image_proc/make_stb.cpp @@ -1,6 +1,8 @@ #include #include +#include "../../include/defines.h" + #define STB_IMAGE_IMPLEMENTATION #include "stb_image.h" diff --git a/code/components/jomjol_influxdb/interface_influxdb.cpp b/code/components/jomjol_influxdb/interface_influxdb.cpp index 7120f607..db544d6a 100644 --- a/code/components/jomjol_influxdb/interface_influxdb.cpp +++ b/code/components/jomjol_influxdb/interface_influxdb.cpp @@ -1,13 +1,12 @@ #ifdef ENABLE_INFLUXDB #include "interface_influxdb.h" -//#define LOG_LOCAL_LEVEL ESP_LOG_DEBUG #include "esp_log.h" #include #include "ClassLogFile.h" #include "esp_http_client.h" +#include "../../include/defines.h" -#define MAX_HTTP_OUTPUT_BUFFER 2048 static const char *TAG = "INFLUXDB"; diff --git a/code/components/jomjol_logfile/ClassLogFile.cpp b/code/components/jomjol_logfile/ClassLogFile.cpp index 99b5fc3b..c1f756bc 100644 --- a/code/components/jomjol_logfile/ClassLogFile.cpp +++ b/code/components/jomjol_logfile/ClassLogFile.cpp @@ -15,6 +15,7 @@ extern "C" { #endif #include "Helper.h" +#include "../../include/defines.h" static const char *TAG = "LOGFILE"; diff --git a/code/components/jomjol_mqtt/interface_mqtt.cpp b/code/components/jomjol_mqtt/interface_mqtt.cpp index ec6848e9..2496e111 100644 --- a/code/components/jomjol_mqtt/interface_mqtt.cpp +++ b/code/components/jomjol_mqtt/interface_mqtt.cpp @@ -6,10 +6,7 @@ #include "mqtt_client.h" #include "ClassLogFile.h" #include "server_tflite.h" - -#define __HIDE_PASSWORD - -//#define DEBUG_DETAIL_ON +#include "../../include/defines.h" static const char *TAG = "MQTT IF"; diff --git a/code/components/jomjol_mqtt/server_mqtt.cpp b/code/components/jomjol_mqtt/server_mqtt.cpp index 0b31ac0f..cec14842 100644 --- a/code/components/jomjol_mqtt/server_mqtt.cpp +++ b/code/components/jomjol_mqtt/server_mqtt.cpp @@ -10,6 +10,7 @@ #include "server_mqtt.h" #include "interface_mqtt.h" #include "time_sntp.h" +#include "../../include/defines.h" diff --git a/code/components/jomjol_mqtt/server_mqtt.h b/code/components/jomjol_mqtt/server_mqtt.h index f96e107a..22d8020a 100644 --- a/code/components/jomjol_mqtt/server_mqtt.h +++ b/code/components/jomjol_mqtt/server_mqtt.h @@ -2,11 +2,6 @@ #include "ClassFlowDefineTypes.h" -#define LWT_TOPIC "connection" -#define LWT_CONNECTED "connected" -#define LWT_DISCONNECTED "connection lost" - - void SetHomeassistantDiscoveryEnabled(bool enabled); void mqttServer_setParameter(std::vector* _NUMBERS, int interval, float roundInterval); void mqttServer_setMeterType(std::string meterType, std::string valueUnit, std::string timeUnit,std::string rateUnit); diff --git a/code/components/jomjol_tfliteclass/CTfLiteClass.cpp b/code/components/jomjol_tfliteclass/CTfLiteClass.cpp index 7af92a23..a996dce9 100644 --- a/code/components/jomjol_tfliteclass/CTfLiteClass.cpp +++ b/code/components/jomjol_tfliteclass/CTfLiteClass.cpp @@ -2,6 +2,7 @@ #include "ClassLogFile.h" #include "Helper.h" #include "esp_log.h" +#include "../../include/defines.h" #include diff --git a/code/components/jomjol_tfliteclass/CTfLiteClass.h b/code/components/jomjol_tfliteclass/CTfLiteClass.h index ef98c1fa..66485e96 100644 --- a/code/components/jomjol_tfliteclass/CTfLiteClass.h +++ b/code/components/jomjol_tfliteclass/CTfLiteClass.h @@ -1,9 +1,11 @@ +/* #define TFLITE_MINIMAL_CHECK(x) \ if (!(x)) { \ fprintf(stderr, "Error at %s:%d\n", __FILE__, __LINE__); \ exit(1); \ } +*/ #include "tensorflow/lite/micro/all_ops_resolver.h" #include "tensorflow/lite/micro/micro_error_reporter.h" @@ -15,10 +17,6 @@ #include "CImageBasis.h" - - -#define SUPRESS_TFLITE_ERRORS // use, to avoid error messages from TFLITE - #ifdef SUPRESS_TFLITE_ERRORS #include "tensorflow/lite/core/api/error_reporter.h" #include "tensorflow/lite/micro/compatibility.h" diff --git a/code/components/jomjol_tfliteclass/server_tflite.cpp b/code/components/jomjol_tfliteclass/server_tflite.cpp index 6d4574fd..b214be24 100644 --- a/code/components/jomjol_tfliteclass/server_tflite.cpp +++ b/code/components/jomjol_tfliteclass/server_tflite.cpp @@ -8,7 +8,7 @@ #include #include -#include "defines.h" +#include "../../include/defines.h" #include "Helper.h" #include "esp_camera.h" @@ -23,9 +23,6 @@ #include "server_file.h" #include "connect_wlan.h" -//#define DEBUG_DETAIL_ON - - ClassFlowControll tfliteflow; TaskHandle_t xHandleblink_task_doFlow = NULL; diff --git a/code/components/jomjol_time_sntp/time_sntp.cpp b/code/components/jomjol_time_sntp/time_sntp.cpp index 4da72e88..c539e970 100644 --- a/code/components/jomjol_time_sntp/time_sntp.cpp +++ b/code/components/jomjol_time_sntp/time_sntp.cpp @@ -12,6 +12,7 @@ #include "esp_attr.h" #include "esp_sleep.h" #include "esp_sntp.h" +#include "../../include/defines.h" #include "ClassLogFile.h" diff --git a/code/components/jomjol_wlan/connect_wlan.cpp b/code/components/jomjol_wlan/connect_wlan.cpp index df7d5df9..7e348bf4 100644 --- a/code/components/jomjol_wlan/connect_wlan.cpp +++ b/code/components/jomjol_wlan/connect_wlan.cpp @@ -23,20 +23,12 @@ #include #include -#define __HIDE_PASSWORD +#include "../../include/defines.h" - -#define EXAMPLE_ESP_MAXIMUM_RETRY 1000 - /* FreeRTOS event group to signal when we are connected*/ static EventGroupHandle_t s_wifi_event_group; -/* The event group allows multiple bits for each event, but we only care about two events: - * - we are connected to the AP with an IP - * - we failed to connect after the maximum amount of retries */ -#define WIFI_CONNECTED_BIT BIT0 -#define WIFI_FAIL_BIT BIT1 static const char *TAG = "WIFI"; @@ -44,7 +36,6 @@ static int s_retry_num = 0; bool WIFIConnected = false; /////////////////////////////////////////////////////////// -#define BLINK_GPIO GPIO_NUM_33 int BlinkDauer; int BlinkAnzahl; diff --git a/code/components/jomjol_wlan/read_wlanini.cpp b/code/components/jomjol_wlan/read_wlanini.cpp index 4fb3a0e7..edc91628 100644 --- a/code/components/jomjol_wlan/read_wlanini.cpp +++ b/code/components/jomjol_wlan/read_wlanini.cpp @@ -11,6 +11,7 @@ #include #include #include "esp_log.h" +#include "../../include/defines.h" static const char *TAG = "WLAN.INI"; diff --git a/code/include/defines.h b/code/include/defines.h index 436b0baa..f91ec69c 100644 --- a/code/include/defines.h +++ b/code/include/defines.h @@ -1,6 +1,260 @@ +#pragma once #ifndef defines_h #define defines_h -#define CONFIG_FILE "/sdcard/config/config.ini" +///////////////////////////////////////////// +//// Global definitions //// +///////////////////////////////////////////// -#endif // ifndef defines_h \ No newline at end of file + //ClassControllCamera + ClassFlowMakeImage + connect_wlan + main + #define FLASH_GPIO GPIO_NUM_4 + #define BLINK_GPIO GPIO_NUM_33 + + //ClassFlowMQTT + interface_mqtt + connect_wlan + main + #define __HIDE_PASSWORD + + //ClassControllCamera + #define USE_PWM_LEDFLASH // if __LEDGLOBAL is defined, a global variable is used for LED control, otherwise locally and each time a new + + //server_GPIO + #define __LEDGLOBAL + + //ClassControllCamera + ClassFlowMakeImage + #define CAMERA_MODEL_AI_THINKER + #define BOARD_ESP32CAM_AITHINKER + + //server_GPIO + server_file + #define CONFIG_FILE "/sdcard/config/config.ini" + //main + #define __SD_USE_ONE_LINE_MODE__ + + // server_file + Helper + #define FILE_PATH_MAX (255) //Max length a file path can have on storage + + //server_file +(ota_page.html + upload_script.html) + #define MAX_FILE_SIZE (8000*1024) // 8 MB Max size of an individual file. Make sure this value is same as that set in upload_script.html + #define MAX_FILE_SIZE_STR "8MB" + + #define LOGFILE_LAST_PART_BYTES SERVER_FILER_SCRATCH_BUFSIZE * 20 // 80 kBytes // Size of partial log file to return + + #define SERVER_FILER_SCRATCH_BUFSIZE 4096 + #define SERVER_HELPER_SCRATCH_BUFSIZE 8192 + #define SERVER_OTA_SCRATCH_BUFSIZE 1024 + + //server_file + server_help + #define IS_FILE_EXT(filename, ext) \ + (strcasecmp(&filename[strlen(filename) - sizeof(ext) + 1], ext) == 0) + + //server_ota + #define HASH_LEN 32 // SHA-256 digest length + #define OTA_URL_SIZE 256 + + //ClassFlow + ClassFlowImage + server_tflite + #define LOGFILE_TIME_FORMAT "%Y%m%d-%H%M%S" + #define LOGFILE_TIME_FORMAT_DATE_EXTR substr(0, 8) + #define LOGFILE_TIME_FORMAT_HOUR_EXTR substr(9, 2) + + //ClassFlowControll + #define READOUT_TYPE_VALUE 0 + #define READOUT_TYPE_PREVALUE 1 + #define READOUT_TYPE_RAWVALUE 2 + #define READOUT_TYPE_ERROR 3 + + //ClassFlowMQTT + #define LWT_TOPIC "connection" + #define LWT_CONNECTED "connected" + #define LWT_DISCONNECTED "connection lost" + + //ClassFlowPostProcessing + #define PREVALUE_TIME_FORMAT_OUTPUT "%Y-%m-%dT%H:%M:%S%z" + #define PREVALUE_TIME_FORMAT_INPUT "%d-%d-%dT%d:%d:%d" + + //CImageBasis + #define HTTP_BUFFER_SENT 1024 + #define GET_MEMORY(X) heap_caps_malloc(X, MALLOC_CAP_SPIRAM) + #define MAX_JPG_SIZE 128000 + + + //CAlignAdnCutImage + CImageBasis + #define _USE_MATH_DEFINES + #define GET_MEMORY(X) heap_caps_malloc(X, MALLOC_CAP_SPIRAM) + + //make_stb + stb_image_resize + stb_image_write + stb_image //do not work if not in make_stb.cpp + //#define STB_IMAGE_IMPLEMENTATION + //#define STB_IMAGE_WRITE_IMPLEMENTATION + //#define STB_IMAGE_RESIZE_IMPLEMENTATION + #define STBI_ONLY_JPEG //added 17.12.2022 (save 2% of Flash) + + //interface_influxdb + #define MAX_HTTP_OUTPUT_BUFFER 2048 + + //server_mqtt + #define LWT_TOPIC "connection" + #define LWT_CONNECTED "connected" + #define LWT_DISCONNECTED "connection lost" + + //CTfLiteClass + #define TFLITE_MINIMAL_CHECK(x) \ + if (!(x)) { \ + fprintf(stderr, "Error at %s:%d\n", __FILE__, __LINE__); \ + exit(1); \ + } + #define SUPRESS_TFLITE_ERRORS // use, to avoid error messages from TFLITE + + //connect_wlan + #define EXAMPLE_ESP_MAXIMUM_RETRY 1000 + /* The event group allows multiple bits for each event, but we only care about two events: + * - we are connected to the AP with an IP + * - we failed to connect after the maximum amount of retries */ + #define WIFI_CONNECTED_BIT BIT0 + #define WIFI_FAIL_BIT BIT1 + + //ClassFlowCNNGeneral +/* //ready for translateion + #define Analog_error 3 + #define AnalogToDigtalFehler 0.8 + #define Digital_Uncertainty 0.2 + #define DigitalBand 3 + #define Digital_Transition_Range_Predecessor 2 + #define Digital_Transition_Area_Predecessor 0.7 // 9.3 - 0.7 + #define Digital_Transition_Area_Forward 9.7 // Pre-run zero crossing only happens from approx. 9.7 onwards +*/ + + #define AnalogFehler 3 + #define AnalogToDigtalFehler 0.8 + #define DigitalUnschaerfe 0.2 + #define DigitalBand 3 + #define DigitalAnalogerVorgaengerUebergangsbereich 2 + #define DigitalUebergangsbereichVorgaenger 0.7 // 9.3 - 0.7 + #define DigitalUebergangsbereichVorlauf 9.7 // Pre-run zero crossing only happens from approx. 9.7 onwards + + //#define DEBUG_DETAIL_ON + + +///////////////////////////////////////////// +//// Conditionnal definitions //// +///////////////////////////////////////////// + +//******* camera model +#if defined(CAMERA_MODEL_WROVER_KIT) + #define PWDN_GPIO_NUM -1 + #define RESET_GPIO_NUM -1 + #define XCLK_GPIO_NUM 21 + #define SIOD_GPIO_NUM 26 + #define SIOC_GPIO_NUM 27 + + #define Y9_GPIO_NUM 35 + #define Y8_GPIO_NUM 34 + #define Y7_GPIO_NUM 39 + #define Y6_GPIO_NUM 36 + #define Y5_GPIO_NUM 19 + #define Y4_GPIO_NUM 18 + #define Y3_GPIO_NUM 5 + #define Y2_GPIO_NUM 4 + #define VSYNC_GPIO_NUM 25 + #define HREF_GPIO_NUM 23 + #define PCLK_GPIO_NUM 22 + +#elif defined(CAMERA_MODEL_M5STACK_PSRAM) + #define PWDN_GPIO_NUM -1 + #define RESET_GPIO_NUM 15 + #define XCLK_GPIO_NUM 27 + #define SIOD_GPIO_NUM 25 + #define SIOC_GPIO_NUM 23 + + #define Y9_GPIO_NUM 19 + #define Y8_GPIO_NUM 36 + #define Y7_GPIO_NUM 18 + #define Y6_GPIO_NUM 39 + #define Y5_GPIO_NUM 5 + #define Y4_GPIO_NUM 34 + #define Y3_GPIO_NUM 35 + #define Y2_GPIO_NUM 32 + #define VSYNC_GPIO_NUM 22 + #define HREF_GPIO_NUM 26 + #define PCLK_GPIO_NUM 21 + +#elif defined(CAMERA_MODEL_AI_THINKER) + #define PWDN_GPIO_NUM GPIO_NUM_32 + #define RESET_GPIO_NUM -1 + #define XCLK_GPIO_NUM GPIO_NUM_0 + #define SIOD_GPIO_NUM GPIO_NUM_26 + #define SIOC_GPIO_NUM GPIO_NUM_27 + + #define Y9_GPIO_NUM GPIO_NUM_35 + #define Y8_GPIO_NUM GPIO_NUM_34 + #define Y7_GPIO_NUM GPIO_NUM_39 + #define Y6_GPIO_NUM GPIO_NUM_36 + #define Y5_GPIO_NUM GPIO_NUM_21 + #define Y4_GPIO_NUM GPIO_NUM_19 + #define Y3_GPIO_NUM GPIO_NUM_18 + #define Y2_GPIO_NUM GPIO_NUM_5 + #define VSYNC_GPIO_NUM GPIO_NUM_25 + #define HREF_GPIO_NUM GPIO_NUM_23 + #define PCLK_GPIO_NUM GPIO_NUM_22 + +#else + #error "Camera model not selected" +#endif //camera model + +// ******* Board type +#ifdef BOARD_WROVER_KIT // WROVER-KIT PIN Map + + #define CAM_PIN_PWDN -1 //power down is not used + #define CAM_PIN_RESET -1 //software reset will be performed + #define CAM_PIN_XCLK 21 + #define CAM_PIN_SIOD 26 + #define CAM_PIN_SIOC 27 + + #define CAM_PIN_D7 35 + #define CAM_PIN_D6 34 + #define CAM_PIN_D5 39 + #define CAM_PIN_D4 36 + #define CAM_PIN_D3 19 + #define CAM_PIN_D2 18 + #define CAM_PIN_D1 5 + #define CAM_PIN_D0 4 + #define CAM_PIN_VSYNC 25 + #define CAM_PIN_HREF 23 + #define CAM_PIN_PCLK 22 + +#endif //// WROVER-KIT PIN Map + + +#ifdef BOARD_ESP32CAM_AITHINKER // ESP32Cam (AiThinker) PIN Map + + #define CAM_PIN_PWDN 32 + #define CAM_PIN_RESET -1 //software reset will be performed + #define CAM_PIN_XCLK 0 + #define CAM_PIN_SIOD 26 + #define CAM_PIN_SIOC 27 + + #define CAM_PIN_D7 35 + #define CAM_PIN_D6 34 + #define CAM_PIN_D5 39 + #define CAM_PIN_D4 36 + #define CAM_PIN_D3 21 + #define CAM_PIN_D2 19 + #define CAM_PIN_D1 18 + #define CAM_PIN_D0 5 + #define CAM_PIN_VSYNC 25 + #define CAM_PIN_HREF 23 + #define CAM_PIN_PCLK 22 + +#endif // ESP32Cam (AiThinker) PIN Map + +// ******* LED definition +#ifdef USE_PWM_LEDFLASH + + //// PWM für Flash-LED + #define LEDC_TIMER LEDC_TIMER_1 // LEDC_TIMER_0 + #define LEDC_MODE LEDC_LOW_SPEED_MODE + #define LEDC_OUTPUT_IO FLASH_GPIO // Define the output GPIO + #define LEDC_CHANNEL LEDC_CHANNEL_1 + #define LEDC_DUTY_RES LEDC_TIMER_13_BIT // Set duty resolution to 13 bits + //#define LEDC_DUTY (195) // Set duty to 50%. ((2 ** 13) - 1) * 50% = 4095 + #define LEDC_FREQUENCY (5000) // Frequency in Hertz. Set frequency at 5 kHz + +#endif //USE_PWM_LEDFLASH + +#endif // ifndef defines_h diff --git a/code/main/main.cpp b/code/main/main.cpp index 4fcebf52..a61b9374 100644 --- a/code/main/main.cpp +++ b/code/main/main.cpp @@ -6,6 +6,7 @@ #include "driver/gpio.h" #include "sdkconfig.h" //#include "esp_psram.h" // Comming in IDF 5.0, see https://docs.espressif.com/projects/esp-idf/en/v5.0-beta1/esp32/migration-guides/release-5.x/system.html?highlight=esp_psram_get_size +//#include "spiram.h" #include "esp32/spiram.h" // SD-Card //////////////////// @@ -33,6 +34,8 @@ #include "server_mqtt.h" #endif //ENABLE_MQTT #include "Helper.h" +#include "../../include/defines.h" +#include "server_GPIO.h" extern const char* GIT_TAG; extern const char* GIT_REV; @@ -42,23 +45,8 @@ extern const char* BUILD_TIME; extern std::string getHTMLversion(void); extern std::string getHTMLcommit(void); -#define __HIDE_PASSWORD - -// #include "jomjol_WS2812Slow.h" -#include "SmartLeds.h" - - -#define __SD_USE_ONE_LINE_MODE__ - -#include "server_GPIO.h" - - -#define BLINK_GPIO GPIO_NUM_33 - static const char *TAG = "MAIN"; -//#define FLASH_GPIO GPIO_NUM_4 - bool Init_NVS_SDCard() { esp_err_t ret = nvs_flash_init(); diff --git a/code/main/server_main.cpp b/code/main/server_main.cpp index 39763e70..6ab0912f 100644 --- a/code/main/server_main.cpp +++ b/code/main/server_main.cpp @@ -18,10 +18,6 @@ #include "Helper.h" -//#define DEBUG_DETAIL_ON - - - httpd_handle_t server = NULL; std::string starttime = ""; diff --git a/code/sdkconfig.defaults b/code/sdkconfig.defaults index 95caac5f..11587c15 100644 --- a/code/sdkconfig.defaults +++ b/code/sdkconfig.defaults @@ -69,4 +69,4 @@ CONFIG_OV5640_SUPPORT=n CONFIG_GC2145_SUPPORT=n CONFIG_GC032A_SUPPORT=n CONFIG_GC0308_SUPPORT=n -CONFIG_BF3005_SUPPORT=n \ No newline at end of file +CONFIG_BF3005_SUPPORT=n