diff --git a/README.md b/README.md index e30ea6c8..33e4bc96 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,15 @@ If you would like to support the developer with a cup of coffee you can do that **General remark:** Beside the `firmware.bin`, typically also the content of `/html` needs to be updated! +##### Rolling (2021-01-23) +* Implementation of image brightness setting + +* Bug fixing: minor topics in html, waiting time in doFlow + +* based on Master v6.1.0 (2021-01-20) + + ##### 6.1.0 Image Processing in Memory - (2021-01-20) diff --git a/code/components/esp32-camera-master/driver/camera.c b/code/components/esp32-camera-master/driver/camera.c index 1fe43871..b89dd37a 100644 --- a/code/components/esp32-camera-master/driver/camera.c +++ b/code/components/esp32-camera-master/driver/camera.c @@ -750,7 +750,7 @@ static void IRAM_ATTR dma_filter_buffer(size_t buf_idx) if(s_state->sensor.pixformat == PIXFORMAT_JPEG) { uint32_t sig = *((uint32_t *)s_state->fb->buf) & 0xFFFFFF; if(sig != 0xffd8ff) { - ets_printf("bh 0x%08x\n", sig); + ESP_LOGD(TAG,"unexpected JPEG signature 0x%08x\n", sig); s_state->fb->bad = 1; return; } diff --git a/code/components/esp32-camera-master/driver/sccb.c b/code/components/esp32-camera-master/driver/sccb.c index 8befb7c2..cb615bbc 100644 --- a/code/components/esp32-camera-master/driver/sccb.c +++ b/code/components/esp32-camera-master/driver/sccb.c @@ -7,6 +7,7 @@ * */ #include +#include #include #include #include "sccb.h" @@ -42,6 +43,7 @@ int SCCB_Init(int pin_sda, int pin_scl) ESP_LOGI(TAG, "pin_sda %d pin_scl %d\n", pin_sda, pin_scl); //log_i("SCCB_Init start"); i2c_config_t conf; + memset(&conf, 0, sizeof(i2c_config_t)); conf.mode = I2C_MODE_MASTER; conf.sda_io_num = pin_sda; conf.sda_pullup_en = GPIO_PULLUP_ENABLE; diff --git a/code/components/esp32-camera-master/examples/take_picture.c b/code/components/esp32-camera-master/examples/take_picture.c index 6bd3f822..96b224fd 100644 --- a/code/components/esp32-camera-master/examples/take_picture.c +++ b/code/components/esp32-camera-master/examples/take_picture.c @@ -6,7 +6,7 @@ // 1. Board setup (Uncomment): // #define BOARD_WROVER_KIT -#define BOARD_ESP32CAM_AITHINKER +// #define BOARD_ESP32CAM_AITHINKER /** * 2. Kconfig setup diff --git a/code/components/jomjol_controlcamera/ClassControllCamera.cpp b/code/components/jomjol_controlcamera/ClassControllCamera.cpp index dfd693a6..5a421512 100644 --- a/code/components/jomjol_controlcamera/ClassControllCamera.cpp +++ b/code/components/jomjol_controlcamera/ClassControllCamera.cpp @@ -136,6 +136,19 @@ static size_t jpg_encode_stream(void * arg, size_t index, const void* data, size return len; } +void CCamera::SetBrightnessContrastSaturation(int _brightness, int _contrast, int _saturation) +{ + sensor_t * s = esp_camera_sensor_get(); + _brightness = min(2, max(-2, _brightness)); +// _contrast = min(2, max(-2, _contrast)); +// _saturation = min(2, max(-2, _saturation)); + +// s->set_saturation(s, _saturation); +// s->set_contrast(s, _contrast); + s->set_brightness(s, _brightness); +} + + void CCamera::SetQualitySize(int qual, framesize_t resol) { diff --git a/code/components/jomjol_controlcamera/ClassControllCamera.h b/code/components/jomjol_controlcamera/ClassControllCamera.h index 7e4dd6bb..6cdbaa73 100644 --- a/code/components/jomjol_controlcamera/ClassControllCamera.h +++ b/code/components/jomjol_controlcamera/ClassControllCamera.h @@ -34,6 +34,7 @@ class CCamera { void LEDOnOff(bool status); esp_err_t CaptureToHTTP(httpd_req_t *req, int delay = 0); void SetQualitySize(int qual, framesize_t resol); + void SetBrightnessContrastSaturation(int _brightness, int _contrast, int _saturation); void GetCameraParameter(httpd_req_t *req, int &qual, framesize_t &resol); framesize_t TextToFramesize(const char * text); diff --git a/code/components/jomjol_flowcontroll/ClassFlowControll.cpp b/code/components/jomjol_flowcontroll/ClassFlowControll.cpp index 3d24feab..3d846f6c 100644 --- a/code/components/jomjol_flowcontroll/ClassFlowControll.cpp +++ b/code/components/jomjol_flowcontroll/ClassFlowControll.cpp @@ -39,7 +39,8 @@ std::string ClassFlowControll::doSingleStep(std::string _stepname, std::string _ for (int i = 0; i < FlowControll.size(); ++i) if (FlowControll[i]->name().compare(_classname) == 0){ - FlowControll[i]->doFlow(""); + if (!(FlowControll[i]->name().compare("ClassFlowMakeImage") == 0)) // falls es ein MakeImage ist, braucht das Bild nicht extra aufgenommen zu werden, dass passiert bei html-Abfrage automatisch + FlowControll[i]->doFlow(""); result = FlowControll[i]->getHTMLSingleStep(_host); } diff --git a/code/components/jomjol_flowcontroll/ClassFlowMakeImage.cpp b/code/components/jomjol_flowcontroll/ClassFlowMakeImage.cpp index 3e18c71c..fd20986b 100644 --- a/code/components/jomjol_flowcontroll/ClassFlowMakeImage.cpp +++ b/code/components/jomjol_flowcontroll/ClassFlowMakeImage.cpp @@ -48,6 +48,9 @@ bool ClassFlowMakeImage::ReadParameter(FILE* pfile, string& aktparamgraph) std::vector zerlegt; aktparamgraph = trim(aktparamgraph); + int _brightness = 0; + int _contrast = 0; + int _saturation = 0; if (aktparamgraph.size() == 0) if (!this->GetNextParagraph(pfile, aktparamgraph)) @@ -79,9 +82,26 @@ bool ClassFlowMakeImage::ReadParameter(FILE* pfile, string& aktparamgraph) SaveAllFiles = true; } + if ((toUpper(zerlegt[0]) == "BRIGHTNESS") && (zerlegt.size() > 1)) + { + _brightness = stoi(zerlegt[1]); + } + + if ((toUpper(zerlegt[0]) == "CONTRAST") && (zerlegt.size() > 1)) + { + _contrast = stoi(zerlegt[1]); + } + + if ((toUpper(zerlegt[0]) == "SATURATION") && (zerlegt.size() > 1)) + { + _saturation = stoi(zerlegt[1]); + } + } + Camera.SetBrightnessContrastSaturation(_brightness, _contrast, _saturation); Camera.SetQualitySize(ImageQuality, ImageSize); + image_width = Camera.image_width; image_height = Camera.image_height; rawImage = new CImageBasis(); diff --git a/code/components/jomjol_tfliteclass/server_tflite.cpp b/code/components/jomjol_tfliteclass/server_tflite.cpp index b4ff5a25..786e7ff6 100644 --- a/code/components/jomjol_tfliteclass/server_tflite.cpp +++ b/code/components/jomjol_tfliteclass/server_tflite.cpp @@ -403,11 +403,33 @@ esp_err_t handler_editflow(httpd_req_t *req) if (_task.compare("test_take") == 0) { std::string _host = ""; + std::string _bri = ""; + std::string _con = ""; + std::string _sat = ""; + int bri = 0; + int sat = 0; + int con = 0; + if (httpd_query_key_value(_query, "host", _valuechar, 30) == ESP_OK) { _host = std::string(_valuechar); } + if (httpd_query_key_value(_query, "bri", _valuechar, 30) == ESP_OK) { + _bri = std::string(_valuechar); + bri = stoi(_bri); + } + if (httpd_query_key_value(_query, "con", _valuechar, 30) == ESP_OK) { + _con = std::string(_valuechar); + con = stoi(_con); + } + if (httpd_query_key_value(_query, "sat", _valuechar, 30) == ESP_OK) { + _sat = std::string(_valuechar); + sat = stoi(_sat); + } + + // printf("Parameter host: "); printf(_host.c_str()); printf("\n"); // string zwzw = "Do " + _task + " start\n"; printf(zwzw.c_str()); + Camera.SetBrightnessContrastSaturation(bri, con, sat); std::string zw = tfliteflow.doSingleStep("[MakeImage]", _host); httpd_resp_sendstr_chunk(req, zw.c_str()); } @@ -559,9 +581,12 @@ void task_autodoFlow(void *pvParameter) LogFile.WriteToFile(zwtemp); printf("CPU Temperature: %.2f\n", cputmp); fr_delta_ms = (esp_timer_get_time() - fr_start) / 1000; - const TickType_t xDelay = (auto_intervall - fr_delta_ms) / portTICK_PERIOD_MS; - printf("Autoflow: sleep for : %ldms\n", (long) xDelay); - vTaskDelay( xDelay ); + if (auto_intervall > fr_delta_ms) + { + const TickType_t xDelay = (auto_intervall - fr_delta_ms) / portTICK_PERIOD_MS; + printf("Autoflow: sleep for : %ldms\n", (long) xDelay); + vTaskDelay( xDelay ); + } } vTaskDelete(NULL); //Delete this task if it exits from the loop above xHandletask_autodoFlow = NULL; diff --git a/code/main/version.cpp b/code/main/version.cpp index 4328fc25..81642e39 100644 --- a/code/main/version.cpp +++ b/code/main/version.cpp @@ -1,4 +1,4 @@ -const char* GIT_REV="46cfe45"; +const char* GIT_REV="abc4cb4"; const char* GIT_TAG=""; -const char* GIT_BRANCH="master"; -const char* BUILD_TIME="2021-01-20 19:47"; \ No newline at end of file +const char* GIT_BRANCH="rolling"; +const char* BUILD_TIME="2021-01-23 22:04"; \ No newline at end of file diff --git a/code/version.cpp b/code/version.cpp index 4328fc25..81642e39 100644 --- a/code/version.cpp +++ b/code/version.cpp @@ -1,4 +1,4 @@ -const char* GIT_REV="46cfe45"; +const char* GIT_REV="abc4cb4"; const char* GIT_TAG=""; -const char* GIT_BRANCH="master"; -const char* BUILD_TIME="2021-01-20 19:47"; \ No newline at end of file +const char* GIT_BRANCH="rolling"; +const char* BUILD_TIME="2021-01-23 22:04"; \ No newline at end of file diff --git a/firmware/bootloader.bin b/firmware/bootloader.bin index 1d516fbd..95b6de48 100644 Binary files a/firmware/bootloader.bin and b/firmware/bootloader.bin differ diff --git a/firmware/firmware.bin b/firmware/firmware.bin index 20567745..8f1c948e 100644 Binary files a/firmware/firmware.bin and b/firmware/firmware.bin differ diff --git a/firmware/html.zip b/firmware/html.zip index e53bfa04..28432c8b 100644 Binary files a/firmware/html.zip and b/firmware/html.zip differ diff --git a/sd-card/config/config.ini b/sd-card/config/config.ini index 822a5538..841b261d 100644 --- a/sd-card/config/config.ini +++ b/sd-card/config/config.ini @@ -4,6 +4,7 @@ WaitBeforeTakingPicture = 5 ImageQuality = 5 ImageSize = VGA +Brightness = 0 [Alignment] InitalRotate=180 diff --git a/sd-card/html/debug.log b/sd-card/html/debug.log index decfc8b3..c2a5e456 100644 --- a/sd-card/html/debug.log +++ b/sd-card/html/debug.log @@ -1,3 +1,7 @@ [1204/185120.033:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3) [0102/122131.430:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3) [0118/210038.095:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3) +[0122/182642.937:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3) +[0122/191644.620:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3) +[0122/214224.255:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3) +[0123/204102.088:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3) diff --git a/sd-card/html/edit_config_param.html b/sd-card/html/edit_config_param.html index 329fca2f..d586c7ec 100644 --- a/sd-card/html/edit_config_param.html +++ b/sd-card/html/edit_config_param.html @@ -130,6 +130,49 @@ textarea { Picture size camera (default = "VGA") + + + + + Brightness + + + + + + Image Brightness (-2 .. 2 - default = "0") + + + +

Alignment

@@ -767,6 +810,9 @@ function UpdateInput() { WriteParameter(param, category, "MakeImage", "LogfileRetentionInDays", true); WriteParameter(param, category, "MakeImage", "WaitBeforeTakingPicture", false); WriteParameter(param, category, "MakeImage", "ImageQuality", false); + WriteParameter(param, category, "MakeImage", "Brightness", false); +// WriteParameter(param, category, "MakeImage", "Contrast", false); +// WriteParameter(param, category, "MakeImage", "Saturation", false); WriteParameter(param, category, "MakeImage", "ImageSize", false, true, true); WriteParameter(param, category, "Alignment", "SearchFieldX", false); @@ -820,6 +866,9 @@ function ReadParameterAll() ReadParameter(param, "MakeImage", "LogfileRetentionInDays", true); ReadParameter(param, "MakeImage", "WaitBeforeTakingPicture", false); ReadParameter(param, "MakeImage", "ImageQuality", false); + ReadParameter(param, "MakeImage", "Brightness", false); +// ReadParameter(param, "MakeImage", "Contrast", false); +// ReadParameter(param, "MakeImage", "Saturation", false); ReadParameter(param, "MakeImage", "ImageSize", false, true); ReadParameter(param, "Alignment", "SearchFieldX", false); diff --git a/sd-card/html/edit_reference.html b/sd-card/html/edit_reference.html index aac815e2..4c7f55b4 100644 --- a/sd-card/html/edit_reference.html +++ b/sd-card/html/edit_reference.html @@ -34,7 +34,7 @@ table {

Create Reference out of Raw Image

- + @@ -42,17 +42,32 @@ table { - - + + + + - + +
Degrees + Brightness: + +
Degrees
@@ -68,6 +83,9 @@ table { + + +