mirror of
https://github.com/jomjol/AI-on-the-edge-device.git
synced 2025-12-06 11:36:51 +03:00
Prepare next release (#3267)
* Create dig-cont_0640_s3_q.tflite * Update edit_reference.html (#2924) Zoom-Einstellungen ausblenden, wenn zoom deaktiviert ist * Update edit_config_template.html (#2925) Zoom-Einstellungen ausblenden, wenn zoom deaktiviert ist + Kameraeinstellungen nicht nur in der config.ini speichern, sondern auch setzen * The parameter "negative" is processed on the MCU * Renamed menu entry Alignment -> References * renamed model file to make naming consistent * Fix test (#2933) * always reset change absolute (#2956) * Create dig-class11_1701_s2.tflite * Update tflite * Update tflite * Camera settings (#3029) * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Fix minor typo and harmonize spaces (#3030) * Update edit_digits.html * Update edit_analog.html * Update overview.html * Update edit_reference.html --------- Co-authored-by: jomjol <30766535+jomjol@users.noreply.github.com> * Source code formatting, ClassFlowPostProcessing.cpp * fix edit_config_template.html Unfortunately, I didn't take out some entries from other experiments because I overlooked/forgot them^^ * fix readconfigparam.js Unfortunately, I didn't take out some entries from other experiments because I overlooked/forgot them^^ * fix edit_config_template.html TakeImage_CamZoomMode_value1 was replaced by TakeImage_CamZoomSize_value1, but not deleted. This caused problems when saving the camera settings. * Update info.html function loadWLANSSID() was present three times * Update overview.html CamFrameSize is no longer needed/used for zoom * Update reply-bot.yaml * homeassistant service discovery: derive node_id when using nested topics (#3088) * derive correct node_id for homeassistant service discovery in nested topics (fixes #1792) * explicit use of std::string * move nodeId creation to separate function add unit-tests * add documentation about node_id generation for Home Assistant MQTT Service Discovery * add Prometheus/OpenMetrics exporter (#3081) * add prometheus endpoint * refine metrics implementation * move metrics generator to ClassFlowControll * add more metrics align prefix * add more metrics clean up * refine documentation * revert dependencies change * sanitize labels * create separate module for openmetrics * move openmetrics to separate folder * clean up * add basic unit-tests * work with const numbers add replaceAll for string replacement avoid opening std namespace adapt unit-tests * Update code/main/server_main.cpp --------- Co-authored-by: CaCO3 <caco3@ruinelli.ch> * Typo * update platformIO to 6.7.0 (ESP IDF 5.2.1) (#3098) * update to platformio/espressif32 @ 6.7.0 * remove unused getReadout() as it throws errors (error: 'virtual std::string ClassFlow::getReadout()' was hidden). --------- Co-authored-by: CaCO3 <caco@ruinelli.ch> * Update reply-bot.yaml (#3107) * Fix actions-label-commenter * Update Helper.cpp * Update Helper.h * Update Helper.cpp * Update readconfigparam.js fix for: In the selected field the value '1' in the section 'TakeImage' in the field 'CamGainceiling' is invalid. PLEASE CHECK BEFORE SAVING! * proposal for renaming and documentation (#3115) * Update server_camera.cpp Fix building with -D DEBUG_DETAIL_ON better alternative to: https://github.com/jomjol/AI-on-the-edge-device/pull/3160 * Update ClassFlowPostProcessing.cpp * Update ClassFlowAlignment.cpp * Fix building with `-D DEBUG_DETAIL_ON` (#3160) Building with `-D DEBUG_DETAIL_ON` has been broken since #3029. Co-authored-by: CaCO3 <caco3@ruinelli.ch> * Handle empty prevalue.ini gracefully (#3162) Fixes #2149. * Bugfix for boot loop (#3175) * Add files via upload * Add files via upload * Add files via upload * Delete param-docs/parameter-pages/TakeImage/Aec2.md has been replaced by CamAec2.md * Delete param-docs/parameter-pages/TakeImage/AutoExposureLevel.md has been replaced by CamAeLevel.md * Delete param-docs/parameter-pages/TakeImage/Brightness.md has been replaced by CamBrightness.md * Delete param-docs/parameter-pages/TakeImage/Contrast.md has been replaced by CamContrast.md * Delete param-docs/parameter-pages/TakeImage/Grayscale.md has been replaced by CamSpecialEffect.md * Delete param-docs/parameter-pages/TakeImage/Negative.md has been replaced by CamSpecialEffect.md * Delete param-docs/parameter-pages/TakeImage/Saturation.md has been replaced by CamSaturation.md * Delete param-docs/parameter-pages/TakeImage/Sharpness.md has been replaced by CamSharpness.md * Delete param-docs/parameter-pages/TakeImage/ImageQuality.md has been replaced by CamQuality.md * Delete param-docs/parameter-pages/TakeImage/Zoom.md has been replaced by CamZoom.md * Delete param-docs/parameter-pages/TakeImage/ZoomMode.md has been replaced by CamZoomSize.md * Delete param-docs/parameter-pages/TakeImage/ZoomOffsetX.md has been replaced by CamZoomOffsetX.md * Delete param-docs/parameter-pages/TakeImage/ZoomOffsetY.md has been replaced by CamZoomOffsetY.md * Delete param-docs/parameter-pages/TakeImage/ImageSize.md has been replaced by CamZoomSize.md * Delete param-docs/parameter-pages/TakeImage/FixedExposure.md has been replaced by CamAec.md * Delete param-docs/parameter-pages/Alignment/FlipImageSize.md has been replaced by CamVflip.md * Delete param-docs/parameter-pages/Alignment/InitialMirror.md has been replaced by CamHmirror.md * CamParameter documentation update https://github.com/jomjol/AI-on-the-edge-device/issues/3185 * typo * add Webhook #3148 (#3163) * WIP add Webhook * fix config html for webhook add tooltips for webhook * webhook: fix not enabling webhook * send webhook as json * Update ApiKey.md * webhook: fix only sending last "Number" * webhook JSON is now closer to the data log in CSV format * webhook: drop timeStampTimeUTC and switch from timeStamp to lastvalue like lokal csv to fix no timestamp on error --------- Co-authored-by: CaCO3 <caco3@ruinelli.ch> * Bugfix for time stamp (#3180) * Update ClassFlowPostProcessing.cpp * Update ClassFlowDefineTypes.h * Update ClassFlowPostProcessing.cpp * Update ClassFlowPostProcessing.cpp * Update ClassFlowPostProcessing.cpp * Update ClassFlowPostProcessing.cpp * Update interface_webhook.cpp * Update readconfigcommon.js fix for: The same message("Image Contrast got enhanced") came up with "Update Marker" and "Enhance Image Contrast". * fix svg favicon The svg one got added in33893eb566but does not work on Firefox * Update platformIO to 6.8.1 (Contains ESP IDF 5.3) (#3196) * Update platformIO to 6.8.1 (ESP IDF 5.3) * removed now redundant typedef * updated IDF manifest hash * Add files via upload so it should work now * Update server_main.cpp --------- Co-authored-by: CaCO3 <caco@ruinelli.ch> Co-authored-by: michael <Heinrich-Tuning@web.de> * Update MainFlowControl.cpp * Add support for OV5640 camera (#3063) * Add support for OV5640 camera * clean up sharpness handling * limit sharpness range to -2 and +2 * refactor * Fix OV3660 sharpness handling * refactor sharpness handling * fix OV3660 zoom mode * reinstate aspect ratio via imageSize * Changed OV5640 full frame size to match datasheet * various fixes * add denoise config and general clean up * fix line endings to LF * Support enabling red blue swap via web interface * update jpeg quality limits * remove color swap config; color swap workaround dependent on vflip * fix missing commit * fix gain ceiling * Update cam vflip param page * fix typo: camdenoise, not camsdenoise * fix compile errors * Update MainFlowControl.cpp * Add rate threshold parameter (#3195) * still needs to be tested https://github.com/jomjol/AI-on-the-edge-device/issues/3143 * Update ClassFlowPostProcessing.cpp code formatting * Update ClassFlowDefineTypes.h code formatting * Update ClassFlowPostProcessing.h code formatting * Update edit_config_template.html * fix * Update config.ini * Update edit_config_template.html * Updated param doc * Rename parameters * Update edit_config_template.html * Update NUMBER.ChangeRateThreshold.md * Update NUMBER.ChangeRateThreshold.md --------- Co-authored-by: CaCO3 <caco3@ruinelli.ch> * Update main.cpp * Update config.ini Adjusted camera settings to make the image brighter. * Update readconfigparam.js Adjusted camera settings to make the image brighter. * add optional ImageUpload for Webhook (#3174) * WIP add Webhook * fix config html for webhook add tooltips for webhook * webhook: fix not enabling webhook * send webhook as json * Update ApiKey.md * webhook: fix only sending last "Number" * webhook JSON is now closer to the data log in CSV format * webhook: add img upload * webhoop added config for imgupload * webhook html fixes * webhook: drop timeStampTimeUTC and switch from timeStamp to lastvalue like lokal csv to fix no timestamp on error * add checkbox for Webhook_UploadImg * Update sd-card/html/edit_config_template.html * Update edit_config_template.html * Update edit_config_template.html * Update edit_config_template.html * added a long timestamp to both webhook requests --------- Co-authored-by: CaCO3 <caco3@ruinelli.ch> * Add files via upload (#3207) * Update ClassFlowPostProcessing.cpp deleted some unnecessary double entries RateType renamed to MaxRateType * Update ClassFlowDefineTypes.h RateType renamed to MaxRateType * Update text on recognition page * Update digital CNN * add a Delay between the WiFi reconnections (#3068) * add a Delay between the WiFi reconnections * log the delay between the WiFi reconnections move the delay after the log * cleanup * cleanup * cleanup * Update edit_alignment.html * cleanup * cleanup * Update platformIO to 6.9.0 (Contains ESP IDF 5.3.1) * Handle crash on corrupted model (#3220) * Upgrade esp-tflite-micro to 1.3.1 * Added log message to hint in case it crashes on loading a corrupted model --------- Co-authored-by: CaCO3 <caco@ruinelli.ch> * new dig-class100-173-s2-q on 23.800 images (#3257) * new dig-class100-173-s2-q on 23.800 images * platformio/espressif32 @ 6.8.1 for esp32cam-dev * Revert "platformio/espressif32 @ 6.8.1 for esp32cam-dev" This reverts commitcc9297d483. * not using platformio 6.1.16 * Revert "not using platformio 6.1.16" This reverts commitef18e4fae7. * moved number edit box styles into new file edit_style.css (#3262) changed input[type=number] from 60px to 3em, to show 3 digits with current font size. * added note about only TLS 1.2 is supported (#3213) * Renamed digital to digit (#3219) * renamed Digital to Digit * added param migration * Update .github/label-commenter-config.yaml * renamed AnalogDigitTransition* to AnalogToDigitTransition* --------- Co-authored-by: CaCO3 <caco@ruinelli.ch> * Update Changelog.md * Update Changelog.md --------- Co-authored-by: jomjol <30766535+jomjol@users.noreply.github.com> Co-authored-by: michael <Heinrich-Tuning@web.de> Co-authored-by: Frank Haverland <fspapaping@googlemail.com> Co-authored-by: kub3let <95883234+kub3let@users.noreply.github.com> Co-authored-by: Marco H <myxor@users.noreply.github.com> Co-authored-by: Henry Thasler <henrythasler@users.noreply.github.com> Co-authored-by: CaCO3 <caco@ruinelli.ch> Co-authored-by: Sebastian Lövdahl <slovdahl@hibox.fi> Co-authored-by: Raphael Hehl <raphael@rhehl.de> Co-authored-by: jasaw <jasaw@dius.com.au> Co-authored-by: Francesco Carnielli <hex7c0@gmail.com> Co-authored-by: kalwados <kalwados@gmx.de>
This commit is contained in:
4
.github/label-commenter-config.yaml
vendored
4
.github/label-commenter-config.yaml
vendored
@@ -115,9 +115,9 @@
|
|||||||
labeled:
|
labeled:
|
||||||
issue:
|
issue:
|
||||||
body: |
|
body: |
|
||||||
See [Digital Digits](https://jomjol.github.io/neural-network-digital-counter-readout) resp. [Analogue Pointers](https://jomjol.github.io/neural-network-analog-needle-readout) for an overview of all trained data.
|
See [Digits](https://jomjol.github.io/neural-network-digital-counter-readout) resp. [Analogue Pointers](https://jomjol.github.io/neural-network-analog-needle-readout) for an overview of all trained data.
|
||||||
If your type is not contained it can be added to our training material, see [here](https://jomjol.github.io/AI-on-the-edge-device-docs/collect-new-images/).
|
If your type is not contained it can be added to our training material, see [here](https://jomjol.github.io/AI-on-the-edge-device-docs/collect-new-images/).
|
||||||
discussion:
|
discussion:
|
||||||
body: |
|
body: |
|
||||||
See [Digital Digits](https://jomjol.github.io/neural-network-digital-counter-readout) resp. [Analogue Pointers](https://jomjol.github.io/neural-network-analog-needle-readout) for an overview of all trained data.
|
See [Digits](https://jomjol.github.io/neural-network-digital-counter-readout) resp. [Analogue Pointers](https://jomjol.github.io/neural-network-analog-needle-readout) for an overview of all trained data.
|
||||||
If your type is not contained it can be added to our training material, see [here](https://jomjol.github.io/AI-on-the-edge-device-docs/collect-new-images/).
|
If your type is not contained it can be added to our training material, see [here](https://jomjol.github.io/AI-on-the-edge-device-docs/collect-new-images/).
|
||||||
|
|||||||
1
.github/workflows/build.yaml
vendored
1
.github/workflows/build.yaml
vendored
@@ -150,7 +150,6 @@ jobs:
|
|||||||
path: ./update/*
|
path: ./update/*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#########################################################################################
|
#########################################################################################
|
||||||
## Pack for Remote Setup
|
## Pack for Remote Setup
|
||||||
#########################################################################################
|
#########################################################################################
|
||||||
|
|||||||
@@ -60,4 +60,3 @@ jobs:
|
|||||||
- name: Deploy to GitHub Pages
|
- name: Deploy to GitHub Pages
|
||||||
id: deployment
|
id: deployment
|
||||||
uses: actions/deploy-pages@v1
|
uses: actions/deploy-pages@v1
|
||||||
|
|
||||||
|
|||||||
5
.github/workflows/reply-bot.yaml
vendored
5
.github/workflows/reply-bot.yaml
vendored
@@ -20,8 +20,7 @@ jobs:
|
|||||||
comment:
|
comment:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
|
||||||
####################################################################
|
####################################################################
|
||||||
## Remove labels again (issues only)
|
## Remove labels again (issues only)
|
||||||
@@ -74,7 +73,7 @@ jobs:
|
|||||||
## Write the response
|
## Write the response
|
||||||
####################################################################
|
####################################################################
|
||||||
- name: Write Response
|
- name: Write Response
|
||||||
uses: peaceiris/actions-label-commenter@v1
|
uses: peaceiris/actions-label-commenter@c2d00660c86f2b9ed0fb35b372c451558eba85b3
|
||||||
with:
|
with:
|
||||||
github_token: "${{ secrets.GITHUB_TOKEN }}"
|
github_token: "${{ secrets.GITHUB_TOKEN }}"
|
||||||
config_file: .github/label-commenter-config.yaml
|
config_file: .github/label-commenter-config.yaml
|
||||||
|
|||||||
79
Changelog.md
79
Changelog.md
@@ -1,3 +1,32 @@
|
|||||||
|
## [16.0.0-RC1] - 2024-09-24
|
||||||
|
|
||||||
|
For a full list of changes see [Full list of changes](https://github.com/jomjol/AI-on-the-edge-device/compare/v15.7.0...v16.0.0-RC1)
|
||||||
|
|
||||||
|
#### Known issues
|
||||||
|
Please check the [issues](https://github.com/jomjol/AI-on-the-edge-device/issues) and
|
||||||
|
[discussions](https://github.com/jomjol/AI-on-the-edge-device/discussions) before reporting a new issue.
|
||||||
|
|
||||||
|
#### Core Changes
|
||||||
|
Those are just the major changes:
|
||||||
|
- Add support for OV5640 camera (#3063)
|
||||||
|
- New tflite-Models
|
||||||
|
- Homeassistant service discovery: derive node_id when using nested topics (#3088)
|
||||||
|
- Added Prometheus/OpenMetrics exporter (#3081)
|
||||||
|
- Added Webhook (#3148, #3163, #3174)
|
||||||
|
- Add rate threshold parameter (#3195)
|
||||||
|
- Added a Delay between the WiFi reconnections (#3068)
|
||||||
|
- Web UI improvements
|
||||||
|
- Various minor changes
|
||||||
|
- Update platformIO to 6.9.0 (Contains ESP IDF 5.3.1)
|
||||||
|
|
||||||
|
#### Bug Fixes
|
||||||
|
Those are just the major changes:
|
||||||
|
- Handle crash on corrupted model (#3220)
|
||||||
|
- Bugfix for boot loop (#3175)
|
||||||
|
- Bugfix for time stamp (#3180)
|
||||||
|
- Handle empty prevalue.ini gracefully (#3162)
|
||||||
|
- Added note about only TLS 1.2 is supported (#3213)
|
||||||
|
|
||||||
## [15.7.0] - 2024-02-17
|
## [15.7.0] - 2024-02-17
|
||||||
|
|
||||||
For a full list of changes see [Full list of changes](https://github.com/jomjol/AI-on-the-edge-device/compare/v15.6.0...v15.7.0)
|
For a full list of changes see [Full list of changes](https://github.com/jomjol/AI-on-the-edge-device/compare/v15.6.0...v15.7.0)
|
||||||
@@ -10,7 +39,7 @@ For a full list of changes see [Full list of changes](https://github.com/jomjol/
|
|||||||
- Add Firmware Version to MQTT
|
- Add Firmware Version to MQTT
|
||||||
|
|
||||||
#### Bug Fixes
|
#### Bug Fixes
|
||||||
- Reverted "Implemented late analog / digital transition [#2778](https://github.com/jomjol/AI-on-the-edge-device/pull/2778) (introduced in `v15.5`) as is seems to cause issues for many users.
|
- Reverted "Implemented late analog / digit transition [#2778](https://github.com/jomjol/AI-on-the-edge-device/pull/2778) (introduced in `v15.5`) as is seems to cause issues for many users.
|
||||||
|
|
||||||
|
|
||||||
## [15.6.0] - 2024-02-09
|
## [15.6.0] - 2024-02-09
|
||||||
@@ -29,7 +58,7 @@ For a full list of changes see [Full list of changes](https://github.com/jomjol/
|
|||||||
|
|
||||||
- Update PlattformIO to v6.5.0, which means esp-idf to v5.1
|
- Update PlattformIO to v6.5.0, which means esp-idf to v5.1
|
||||||
- Enhance busy notification
|
- Enhance busy notification
|
||||||
- Implemented late analog / digital transition
|
- Implemented late analog / digit transition
|
||||||
|
|
||||||
#### Fixed
|
#### Fixed
|
||||||
|
|
||||||
@@ -189,7 +218,7 @@ For a full list of changes see [Full list of changes](https://github.com/jomjol/
|
|||||||
:bangbang: **Attention:** Update your configuration!
|
:bangbang: **Attention:** Update your configuration!
|
||||||
- Hybrid CNN network to `dig-cont_0611_s3`
|
- Hybrid CNN network to `dig-cont_0611_s3`
|
||||||
- Analog CNN network to `ana-cont-11.0.5` and `ana-clas100-1.5.7`
|
- Analog CNN network to `ana-cont-11.0.5` and `ana-clas100-1.5.7`
|
||||||
- Digital CNN network to `dig-class100-1.6.0`
|
- Digit CNN network to `dig-class100-1.6.0`
|
||||||
- Various Web interface Improvements/Enhancements:
|
- Various Web interface Improvements/Enhancements:
|
||||||
- Restructured Menu (Needs cache clearing to be applied)
|
- Restructured Menu (Needs cache clearing to be applied)
|
||||||
- Enhanced `Previous Value` page
|
- Enhanced `Previous Value` page
|
||||||
@@ -325,7 +354,7 @@ For a full list of changes see [Full list of changes](https://github.com/jomjol/
|
|||||||
- Improved OTA Update mechanism (only working after installation for next update)
|
- Improved OTA Update mechanism (only working after installation for next update)
|
||||||
- Added data logging in `/log/data` - One day per file and each measurement is on one line
|
- Added data logging in `/log/data` - One day per file and each measurement is on one line
|
||||||
- Format: csv - comma separated
|
- Format: csv - comma separated
|
||||||
- Content: `time`, `name-of-number`, `raw-value`, `return-value`, `pre-value`, `change-rate`, `change-absolute`, `error-text`, `cnn-digital`, `cnn-analog`
|
- Content: `time`, `name-of-number`, `raw-value`, `return-value`, `pre-value`, `change-rate`, `change-absolute`, `error-text`, `cnn-digit`, `cnn-analog`
|
||||||
- Show graph of values direct in the user interface (thanks to [@rdmueller](https://github.com/rdmueller))
|
- Show graph of values direct in the user interface (thanks to [@rdmueller](https://github.com/rdmueller))
|
||||||
|
|
||||||
- Using new data logging (see above)
|
- Using new data logging (see above)
|
||||||
@@ -343,10 +372,10 @@ For a full list of changes see [Full list of changes](https://github.com/jomjol/
|
|||||||
- Updated OTA functionality (more robust, but not fully bullet prove yet)
|
- Updated OTA functionality (more robust, but not fully bullet prove yet)
|
||||||
- Updated Espressif library to `espressif32@v5.2.0`
|
- Updated Espressif library to `espressif32@v5.2.0`
|
||||||
- [#1176](https://github.com/jomjol/AI-on-the-edge-device/discussions/1176) accept minor negative values (-0.2) if extended resolution is enabled
|
- [#1176](https://github.com/jomjol/AI-on-the-edge-device/discussions/1176) accept minor negative values (-0.2) if extended resolution is enabled
|
||||||
- [#1143](https://github.com/jomjol/AI-on-the-edge-device/issues/1143) added config parameter `AnalogDigitalTransitionStart`. It can setup very early and very late digit transition starts.
|
- [#1143](https://github.com/jomjol/AI-on-the-edge-device/issues/1143) added config parameter `AnalogDigTransitionStart`. It can setup very early and very late digit transition starts.
|
||||||
- New version of `dig-class100` (v1.4.0): added images of heliowatt powermeter
|
- New version of `dig-class100` (v1.4.0): added images of heliowatt powermeter
|
||||||
- NEW v13.0.2: Update Tool "Logfile downloader and combiner" to handle the new csv file format.
|
- NEW v13.0.2: Update Tool "Logfile downloader and combiner" to handle the new csv file format.
|
||||||
- NEW v13.0.2: MQTT: Added MQTT topic `status` (Digitalization Status), Timezone to MQTT topic `timestamp`.#
|
- NEW v13.0.2: MQTT: Added MQTT topic `status` (Digitization Status), Timezone to MQTT topic `timestamp`.#
|
||||||
- NEW v13.0.2: Logging: Disable heap logs by default, cleanup
|
- NEW v13.0.2: Logging: Disable heap logs by default, cleanup
|
||||||
- NEW v13.0.7:
|
- NEW v13.0.7:
|
||||||
- log NTP server name
|
- log NTP server name
|
||||||
@@ -471,7 +500,7 @@ Intermediate Digits
|
|||||||
|
|
||||||
- Updated analog neural network file (`ana-cont_11.3.0_s2.tflite` - default, `ana-class100_0120_s1_q.tflite`)
|
- Updated analog neural network file (`ana-cont_11.3.0_s2.tflite` - default, `ana-class100_0120_s1_q.tflite`)
|
||||||
|
|
||||||
- Updated digital neural network file (`dig-cont_0570_s3.tflite` - default, `dig-class100_0120_s2_q.tflite`)
|
- Updated digit neural network file (`dig-cont_0570_s3.tflite` - default, `dig-class100_0120_s2_q.tflite`)
|
||||||
|
|
||||||
- Added automated filtering of tflite-file in the graphical configuration (thanks to @**[caco3](https://github.com/caco3)**)
|
- Added automated filtering of tflite-file in the graphical configuration (thanks to @**[caco3](https://github.com/caco3)**)
|
||||||
|
|
||||||
@@ -483,8 +512,8 @@ Intermediate Digits
|
|||||||
|
|
||||||
Intermediate Digits
|
Intermediate Digits
|
||||||
|
|
||||||
- New and improved consistency check (especially with analog and digital counters mixed)
|
- New and improved consistency check (especially with analog and digit counters mixed)
|
||||||
- Bug Fix: digital counter algorithm
|
- Bug Fix: digit counter algorithm
|
||||||
|
|
||||||
## [11.0.1](https://github.com/jomjol/AI-on-the-edge-device/releases/tag/v11.0.1), 2022-08-18
|
## [11.0.1](https://github.com/jomjol/AI-on-the-edge-device/releases/tag/v11.0.1), 2022-08-18
|
||||||
|
|
||||||
@@ -524,7 +553,7 @@ Stability Increase
|
|||||||
|
|
||||||
- `config.ini`: removal of modelsize (readout from tflite)
|
- `config.ini`: removal of modelsize (readout from tflite)
|
||||||
|
|
||||||
- Updated analog neural network file (`ana1000s2.tflite`) & digital neural network file (`dig1400s2q.tflite`)
|
- Updated analog neural network file (`ana1000s2.tflite`) & digit neural network file (`dig1400s2q.tflite`)
|
||||||
|
|
||||||
- TFMicro/Lite: Update (espressif Version 20220716)
|
- TFMicro/Lite: Update (espressif Version 20220716)
|
||||||
|
|
||||||
@@ -560,7 +589,7 @@ Stability Increase
|
|||||||
- In the future the new files will also be copied to the `firmware` directory of the repository
|
- In the future the new files will also be copied to the `firmware` directory of the repository
|
||||||
- Added Wifi RSSI to MQTT information
|
- Added Wifi RSSI to MQTT information
|
||||||
- Updated analog neural network file (`ana-s3-q-20220105.tflite`)
|
- Updated analog neural network file (`ana-s3-q-20220105.tflite`)
|
||||||
- Updated digital neural network file (`dig-s1-q-20220102.tflite`)
|
- Updated digit neural network file (`dig-s1-q-20220102.tflite`)
|
||||||
- Updated build environment to `Espressif 3.5.0`
|
- Updated build environment to `Espressif 3.5.0`
|
||||||
|
|
||||||
## [10.3.0] - (2022-01-29)
|
## [10.3.0] - (2022-01-29)
|
||||||
@@ -626,7 +655,7 @@ Stability Increase
|
|||||||
|
|
||||||
- Update analog neural network (ana-s3-q-20220105.tflite)
|
- Update analog neural network (ana-s3-q-20220105.tflite)
|
||||||
|
|
||||||
- Update digital neural network (dig-s1-q-20220102.tflite)
|
- Update digit neural network (dig-s1-q-20220102.tflite)
|
||||||
|
|
||||||
- Increased web-server buffers
|
- Increased web-server buffers
|
||||||
|
|
||||||
@@ -663,7 +692,7 @@ External Illumination
|
|||||||
- Direct JSON access: `http://IP-ADRESS/json`
|
- Direct JSON access: `http://IP-ADRESS/json`
|
||||||
- Error message in log file in case camera error during startup
|
- Error message in log file in case camera error during startup
|
||||||
- Upgrade analog CNN to v9.1.0
|
- Upgrade analog CNN to v9.1.0
|
||||||
- Upgrade digital CNN to v13.3.0 (added new images)
|
- Upgrade digit CNN to v13.3.0 (added new images)
|
||||||
- html: support of different ports
|
- html: support of different ports
|
||||||
|
|
||||||
## [9.1.1] - External Illumination (2021-11-16)
|
## [9.1.1] - External Illumination (2021-11-16)
|
||||||
@@ -688,7 +717,7 @@ External Illumination
|
|||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Upgrade digital CNN to v13.1.0 (added new images)
|
- Upgrade digit CNN to v13.1.0 (added new images)
|
||||||
- bug fix: wlan password with space, double digit output
|
- bug fix: wlan password with space, double digit output
|
||||||
|
|
||||||
## [8.4.0] - Multi Meter Support (2021-09-25)
|
## [8.4.0] - Multi Meter Support (2021-09-25)
|
||||||
@@ -718,7 +747,7 @@ External Illumination
|
|||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Upgrade digital CNN to v12.1.0 (added new images)
|
- Upgrade digit CNN to v12.1.0 (added new images)
|
||||||
- Dedicated NaN handling, internal refactoring (CNN-Handling)
|
- Dedicated NaN handling, internal refactoring (CNN-Handling)
|
||||||
- HTML: confirmation after config.ini update
|
- HTML: confirmation after config.ini update
|
||||||
- Bug fixing
|
- Bug fixing
|
||||||
@@ -740,7 +769,7 @@ External Illumination
|
|||||||
- GPIO: using the general mqtt main topic for GPIO
|
- GPIO: using the general mqtt main topic for GPIO
|
||||||
|
|
||||||
|
|
||||||
- Upgrade digital CNN to v12.0.0 (added new images)
|
- Upgrade digit CNN to v12.0.0 (added new images)
|
||||||
- Update tfmicro to new master (2021-08-07)
|
- Update tfmicro to new master (2021-08-07)
|
||||||
- Bug fix: remove text in mqtt value, remove connect limit in wlan reconnet
|
- Bug fix: remove text in mqtt value, remove connect limit in wlan reconnet
|
||||||
|
|
||||||
@@ -776,7 +805,7 @@ External Illumination
|
|||||||
|
|
||||||
- Update wlan handling to esp-idf 4.1
|
- Update wlan handling to esp-idf 4.1
|
||||||
|
|
||||||
- Upgrade digital CNN to v8.7.0 (added new images)
|
- Upgrade digit CNN to v8.7.0 (added new images)
|
||||||
|
|
||||||
- Bug fix: MQTT, WLAN, LED-Controll, GPIO usage, fixed IP, calculation flow rate
|
- Bug fix: MQTT, WLAN, LED-Controll, GPIO usage, fixed IP, calculation flow rate
|
||||||
|
|
||||||
@@ -787,7 +816,7 @@ External Illumination
|
|||||||
- NEW: 7.0.1: bug fix wlan password with "="
|
- NEW: 7.0.1: bug fix wlan password with "="
|
||||||
|
|
||||||
|
|
||||||
- Upgrade digital CNN to v8.5.0 (added new images)
|
- Upgrade digit CNN to v8.5.0 (added new images)
|
||||||
|
|
||||||
- New MQTT topics: flow rate (units/minute), time stamp (last correct read readout)
|
- New MQTT topics: flow rate (units/minute), time stamp (last correct read readout)
|
||||||
|
|
||||||
@@ -804,7 +833,7 @@ External Illumination
|
|||||||
|
|
||||||
- NEW 6.7.1: Improved stability of camera (back to v6.6.1) - remove black strips and areas
|
- NEW 6.7.1: Improved stability of camera (back to v6.6.1) - remove black strips and areas
|
||||||
|
|
||||||
- Upgrade digital CNN to v8.3.0 (added new type of digits)
|
- Upgrade digit CNN to v8.3.0 (added new type of digits)
|
||||||
|
|
||||||
- Internal update: TFlite (v2.5), esp32cam, startup sequence
|
- Internal update: TFlite (v2.5), esp32cam, startup sequence
|
||||||
|
|
||||||
@@ -825,7 +854,7 @@ External Illumination
|
|||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Upgrade digital CNN to v8.2.0 (added new type of digits)
|
- Upgrade digit CNN to v8.2.0 (added new type of digits)
|
||||||
|
|
||||||
|
|
||||||
- Supporting alignment structures in ROI definition
|
- Supporting alignment structures in ROI definition
|
||||||
@@ -861,7 +890,7 @@ External Illumination
|
|||||||
|
|
||||||
- Determination of fixed illumination settings during startup - speed up of 5s in each run
|
- Determination of fixed illumination settings during startup - speed up of 5s in each run
|
||||||
|
|
||||||
- Update digital CNN to v8.1.1 (additional digital images trained)
|
- Update digit CNN to v8.1.1 (additional digit images trained)
|
||||||
|
|
||||||
- Extended error message in MQTT error message
|
- Extended error message in MQTT error message
|
||||||
|
|
||||||
@@ -873,7 +902,7 @@ External Illumination
|
|||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Disabling of analog / digital counters in configuration
|
- Disabling of analog / digit counters in configuration
|
||||||
|
|
||||||
|
|
||||||
- Improved Alignment Algorithm (`AlignmentAlgo` = `Default`, `Accurate` , `Fast`)
|
- Improved Alignment Algorithm (`AlignmentAlgo` = `Default`, `Accurate` , `Fast`)
|
||||||
@@ -893,7 +922,7 @@ External Illumination
|
|||||||
|
|
||||||
- MQTT: Last Will Testament (LWT) implemented: "connection lost" in case of connection lost to `TopicError`
|
- MQTT: Last Will Testament (LWT) implemented: "connection lost" in case of connection lost to `TopicError`
|
||||||
- Disabled `CheckDigitIncreaseConsistency` in default configuration - must now be explicit enabled if needed
|
- Disabled `CheckDigitIncreaseConsistency` in default configuration - must now be explicit enabled if needed
|
||||||
- Update digital CNN to v7.2.1 (additional digital images trained)
|
- Update digit CNN to v7.2.1 (additional digit images trained)
|
||||||
- Setting of arbitrary time server in `config.ini`
|
- Setting of arbitrary time server in `config.ini`
|
||||||
- Option for fixed IP-, DNS-Settings in `wlan.ini`
|
- Option for fixed IP-, DNS-Settings in `wlan.ini`
|
||||||
- Increased stability (internal image and camera handling)
|
- Increased stability (internal image and camera handling)
|
||||||
@@ -927,7 +956,7 @@ External Illumination
|
|||||||
|
|
||||||
- standardized access to current logfile via `http://IP-ADRESS/logfileact`
|
- standardized access to current logfile via `http://IP-ADRESS/logfileact`
|
||||||
|
|
||||||
- Update digital CNN to v7.2.0, analog CNN to 6.3.0
|
- Update digit CNN to v7.2.0, analog CNN to 6.3.0
|
||||||
|
|
||||||
- Bug fixing: truncation error, CheckDigitConsistency & PreValue implementation
|
- Bug fixing: truncation error, CheckDigitConsistency & PreValue implementation
|
||||||
|
|
||||||
@@ -946,7 +975,7 @@ External Illumination
|
|||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Update digital CNN to v6.5.0 and HTML (Info to hostname, IP, ssid)
|
- Update digit CNN to v6.5.0 and HTML (Info to hostname, IP, ssid)
|
||||||
|
|
||||||
- New implementation of "checkDigitConsistency" also for digits
|
- New implementation of "checkDigitConsistency" also for digits
|
||||||
|
|
||||||
|
|||||||
Submodule code/components/esp-tflite-micro updated: 13f26b8294...0032f1734e
File diff suppressed because it is too large
Load Diff
@@ -15,66 +15,99 @@
|
|||||||
#include "CImageBasis.h"
|
#include "CImageBasis.h"
|
||||||
#include "../../include/defines.h"
|
#include "../../include/defines.h"
|
||||||
|
|
||||||
class CCamera {
|
typedef struct
|
||||||
protected:
|
{
|
||||||
int ActualQuality;
|
uint16_t CamSensor_id;
|
||||||
framesize_t ActualResolution;
|
|
||||||
int brightness, contrast, saturation, autoExposureLevel;
|
|
||||||
bool isFixedExposure;
|
|
||||||
int waitbeforepicture_org;
|
|
||||||
int led_intensity = 4095;
|
|
||||||
|
|
||||||
|
framesize_t ImageFrameSize = FRAMESIZE_VGA; // 0 - 10
|
||||||
|
gainceiling_t ImageGainceiling; // Image gain (GAINCEILING_x2, x4, x8, x16, x32, x64 or x128)
|
||||||
|
|
||||||
|
int ImageQuality; // 0 - 63
|
||||||
|
int ImageBrightness; // (-2 to 2) - set brightness
|
||||||
|
int ImageContrast; //-2 - 2
|
||||||
|
int ImageSaturation; //-2 - 2
|
||||||
|
int ImageSharpness; //-2 - 2
|
||||||
|
bool ImageAutoSharpness;
|
||||||
|
int ImageSpecialEffect; // 0 - 6
|
||||||
|
int ImageWbMode; // 0 to 4 - if awb_gain enabled (0 - Auto, 1 - Sunny, 2 - Cloudy, 3 - Office, 4 - Home)
|
||||||
|
int ImageAwb; // white balance enable (0 or 1)
|
||||||
|
int ImageAwbGain; // Auto White Balance enable (0 or 1)
|
||||||
|
int ImageAec; // auto exposure off (1 or 0)
|
||||||
|
int ImageAec2; // automatic exposure sensor (0 or 1)
|
||||||
|
int ImageAeLevel; // auto exposure levels (-2 to 2)
|
||||||
|
int ImageAecValue; // set exposure manually (0-1200)
|
||||||
|
int ImageAgc; // auto gain off (1 or 0)
|
||||||
|
int ImageAgcGain; // set gain manually (0 - 30)
|
||||||
|
int ImageBpc; // black pixel correction
|
||||||
|
int ImageWpc; // white pixel correction
|
||||||
|
int ImageRawGma; // (1 or 0)
|
||||||
|
int ImageLenc; // lens correction (1 or 0)
|
||||||
|
int ImageHmirror; // (0 or 1) flip horizontally
|
||||||
|
int ImageVflip; // Invert image (0 or 1)
|
||||||
|
int ImageDcw; // downsize enable (1 or 0)
|
||||||
|
|
||||||
|
int ImageDenoiseLevel; // The OV2640 does not support it, OV3660 and OV5640 (0 to 8)
|
||||||
|
|
||||||
|
int ImageWidth;
|
||||||
|
int ImageHeight;
|
||||||
|
|
||||||
|
int ImageLedIntensity;
|
||||||
|
|
||||||
|
bool ImageZoomEnabled;
|
||||||
|
int ImageZoomOffsetX;
|
||||||
|
int ImageZoomOffsetY;
|
||||||
|
int ImageZoomSize;
|
||||||
|
|
||||||
|
int WaitBeforePicture;
|
||||||
|
bool isImageSize;
|
||||||
|
|
||||||
|
bool CameraInitSuccessful;
|
||||||
|
bool changedCameraSettings;
|
||||||
|
bool DemoMode;
|
||||||
|
bool SaveAllFiles;
|
||||||
|
} camera_controll_config_temp_t;
|
||||||
|
|
||||||
|
extern camera_controll_config_temp_t CCstatus;
|
||||||
|
|
||||||
|
class CCamera
|
||||||
|
{
|
||||||
|
protected:
|
||||||
void ledc_init(void);
|
void ledc_init(void);
|
||||||
bool CameraInitSuccessful = false;
|
|
||||||
bool demoMode = false;
|
|
||||||
|
|
||||||
bool loadNextDemoImage(camera_fb_t *fb);
|
bool loadNextDemoImage(camera_fb_t *fb);
|
||||||
long GetFileSize(std::string filename);
|
long GetFileSize(std::string filename);
|
||||||
|
void SetCamWindow(sensor_t *s, int frameSizeX, int frameSizeY, int xOffset, int yOffset, int xTotal, int yTotal, int xOutput, int yOutput, int imageVflip);
|
||||||
void SetCamWindow(sensor_t *s, int resolution, int xOffset, int yOffset, int xLength, int yLength);
|
|
||||||
void SetImageWidthHeightFromResolution(framesize_t resol);
|
void SetImageWidthHeightFromResolution(framesize_t resol);
|
||||||
|
void SanitizeZoomParams(int imageSize, int frameSizeX, int frameSizeY, int &imageWidth, int &imageHeight, int &zoomOffsetX, int &zoomOffsetY);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int image_height, image_width;
|
CCamera(void);
|
||||||
bool imageZoomEnabled = false;
|
esp_err_t InitCam(void);
|
||||||
int imageZoomMode = 0;
|
|
||||||
int imageZoomOffsetX = 0;
|
|
||||||
int imageZoomOffsetY = 0;
|
|
||||||
bool imageNegative = false;
|
|
||||||
bool imageAec2 = false;
|
|
||||||
bool imageAutoSharpness = false;
|
|
||||||
int imageSharpnessLevel = 0;
|
|
||||||
#ifdef GRAYSCALE_AS_DEFAULT
|
|
||||||
bool imageGrayscale = true;
|
|
||||||
#else
|
|
||||||
bool imageGrayscale = false;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
CCamera();
|
|
||||||
esp_err_t InitCam();
|
|
||||||
|
|
||||||
void LightOnOff(bool status);
|
void LightOnOff(bool status);
|
||||||
void LEDOnOff(bool status);
|
void LEDOnOff(bool status);
|
||||||
|
|
||||||
|
esp_err_t setSensorDatenFromCCstatus(void);
|
||||||
|
esp_err_t getSensorDatenToCCstatus(void);
|
||||||
|
|
||||||
|
int ov5640_set_gainceiling(sensor_t *s, gainceiling_t level);
|
||||||
|
|
||||||
esp_err_t CaptureToHTTP(httpd_req_t *req, int delay = 0);
|
esp_err_t CaptureToHTTP(httpd_req_t *req, int delay = 0);
|
||||||
esp_err_t CaptureToStream(httpd_req_t *req, bool FlashlightOn);
|
esp_err_t CaptureToStream(httpd_req_t *req, bool FlashlightOn);
|
||||||
void SetQualitySize(int qual, framesize_t resol, bool zoomEnabled, int zoomMode, int zoomOffsetX, int zoomOffsetY);
|
|
||||||
bool SetBrightnessContrastSaturation(int _brightness, int _contrast, int _saturation, int _autoExposureLevel, bool _grayscale, bool _negative, bool _aec2, int _sharpnessLevel);
|
void SetQualityZoomSize(int qual, framesize_t resol, bool zoomEnabled, int zoomOffsetX, int zoomOffsetY, int imageSize, int imageVflip);
|
||||||
void SetZoom(bool zoomEnabled, int zoomMode, int zoomOffsetX, int zoomOffsetY);
|
void SetZoomSize(bool zoomEnabled, int zoomOffsetX, int zoomOffsetY, int imageSize, int imageVflip);
|
||||||
void GetCameraParameter(httpd_req_t *req, int &qual, framesize_t &resol, bool &zoomEnabled, int &zoomMode, int &zoomOffsetX, int &zoomOffsetY);
|
void SetCamSharpness(bool _autoSharpnessEnabled, int _sharpnessLevel);
|
||||||
|
|
||||||
void SetLEDIntensity(float _intrel);
|
void SetLEDIntensity(float _intrel);
|
||||||
bool testCamera(void);
|
bool testCamera(void);
|
||||||
void EnableAutoExposure(int flash_duration);
|
bool getCameraInitSuccessful(void);
|
||||||
bool getCameraInitSuccessful();
|
|
||||||
void useDemoMode(void);
|
void useDemoMode(void);
|
||||||
|
|
||||||
|
framesize_t TextToFramesize(const char *text);
|
||||||
framesize_t TextToFramesize(const char * text);
|
|
||||||
|
|
||||||
esp_err_t CaptureToFile(std::string nm, int delay = 0);
|
esp_err_t CaptureToFile(std::string nm, int delay = 0);
|
||||||
esp_err_t CaptureToBasisImage(CImageBasis *_Image, int delay = 0);
|
esp_err_t CaptureToBasisImage(CImageBasis *_Image, int delay = 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
extern CCamera Camera;
|
extern CCamera Camera;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -3,71 +3,78 @@
|
|||||||
#include "ov2640_sharpness.h"
|
#include "ov2640_sharpness.h"
|
||||||
|
|
||||||
|
|
||||||
#define OV2640_MAXLEVEL_SHARPNESS 6
|
|
||||||
|
|
||||||
const static uint8_t OV2640_SHARPNESS_AUTO[]=
|
const static uint8_t OV2640_SHARPNESS_AUTO[]=
|
||||||
{
|
{
|
||||||
0xFF, 0x00, 0xff,
|
//reg, val, mask
|
||||||
0x92, 0x01, 0xff,
|
0xFF, 0x00, 0xFF,
|
||||||
|
0x92, 0x01, 0xFF,
|
||||||
0x93, 0x20, 0x20,
|
0x93, 0x20, 0x20,
|
||||||
0x00, 0x00, 0x00
|
0x00, 0x00, 0x00
|
||||||
};
|
};
|
||||||
|
|
||||||
const static uint8_t OV2640_SHARPNESS_MANUAL[]=
|
const static uint8_t OV2640_SHARPNESS_MANUAL[]=
|
||||||
{
|
{
|
||||||
0xFF, 0x00, 0xff,
|
//reg, val, mask
|
||||||
0x92, 0x01, 0xff,
|
0xFF, 0x00, 0xFF,
|
||||||
|
0x92, 0x01, 0xFF,
|
||||||
0x93, 0x00, 0x20,
|
0x93, 0x00, 0x20,
|
||||||
0x00, 0x00, 0x00
|
0x00, 0x00, 0x00
|
||||||
};
|
};
|
||||||
|
|
||||||
const static uint8_t OV2640_SHARPNESS_LEVEL0[]=
|
const static uint8_t OV2640_SHARPNESS_LEVEL0[]=
|
||||||
{
|
{
|
||||||
0xFF, 0x00, 0xff,
|
//reg, val, mask
|
||||||
0x92, 0x01, 0xff,
|
0xFF, 0x00, 0xFF,
|
||||||
0x93, 0xc0, 0x1f,
|
0x92, 0x01, 0xFF,
|
||||||
|
0x93, 0xC0, 0x1F,
|
||||||
0x00, 0x00, 0x00
|
0x00, 0x00, 0x00
|
||||||
};
|
};
|
||||||
const static uint8_t OV2640_SHARPNESS_LEVEL1[]=
|
const static uint8_t OV2640_SHARPNESS_LEVEL1[]=
|
||||||
{
|
{
|
||||||
0xFF, 0x00, 0xff,
|
//reg, val, mask
|
||||||
0x92, 0x01, 0xff,
|
0xFF, 0x00, 0xFF,
|
||||||
0x93, 0xc1, 0x1f,
|
0x92, 0x01, 0xFF,
|
||||||
|
0x93, 0xC1, 0x1F,
|
||||||
0x00, 0x00, 0x00
|
0x00, 0x00, 0x00
|
||||||
};
|
};
|
||||||
const static uint8_t OV2640_SHARPNESS_LEVEL2[]=
|
const static uint8_t OV2640_SHARPNESS_LEVEL2[]=
|
||||||
{
|
{
|
||||||
0xFF, 0x00, 0xff,
|
//reg, val, mask
|
||||||
0x92, 0x01, 0xff,
|
0xFF, 0x00, 0xFF,
|
||||||
0x93, 0xc2, 0x1f,
|
0x92, 0x01, 0xFF,
|
||||||
|
0x93, 0xC2, 0x1F,
|
||||||
0x00, 0x00, 0x00
|
0x00, 0x00, 0x00
|
||||||
};
|
};
|
||||||
const static uint8_t OV2640_SHARPNESS_LEVEL3[]=
|
const static uint8_t OV2640_SHARPNESS_LEVEL3[]=
|
||||||
{
|
{
|
||||||
0xFF, 0x00, 0xff,
|
//reg, val, mask
|
||||||
0x92, 0x01, 0xff,
|
0xFF, 0x00, 0xFF,
|
||||||
0x93, 0xc4, 0x1f,
|
0x92, 0x01, 0xFF,
|
||||||
|
0x93, 0xC4, 0x1F,
|
||||||
0x00, 0x00, 0x00
|
0x00, 0x00, 0x00
|
||||||
};
|
};
|
||||||
const static uint8_t OV2640_SHARPNESS_LEVEL4[]=
|
const static uint8_t OV2640_SHARPNESS_LEVEL4[]=
|
||||||
{
|
{
|
||||||
0xFF, 0x00, 0xff,
|
//reg, val, mask
|
||||||
0x92, 0x01, 0xff,
|
0xFF, 0x00, 0xFF,
|
||||||
0x93, 0xc8, 0x1f,
|
0x92, 0x01, 0xFF,
|
||||||
|
0x93, 0xC8, 0x1F,
|
||||||
0x00, 0x00, 0x00
|
0x00, 0x00, 0x00
|
||||||
};
|
};
|
||||||
const static uint8_t OV2640_SHARPNESS_LEVEL5[]=
|
const static uint8_t OV2640_SHARPNESS_LEVEL5[]=
|
||||||
{
|
{
|
||||||
0xFF, 0x00, 0xff,
|
//reg, val, mask
|
||||||
0x92, 0x01, 0xff,
|
0xFF, 0x00, 0xFF,
|
||||||
0x93, 0xd0, 0x1f,
|
0x92, 0x01, 0xFF,
|
||||||
|
0x93, 0xD0, 0x1F,
|
||||||
0x00, 0x00, 0x00
|
0x00, 0x00, 0x00
|
||||||
};
|
};
|
||||||
const static uint8_t OV2640_SHARPNESS_LEVEL6[]=
|
const static uint8_t OV2640_SHARPNESS_LEVEL6[]=
|
||||||
{
|
{
|
||||||
0xFF, 0x00, 0xff,
|
//reg, val, mask
|
||||||
0x92, 0x01, 0xff,
|
0xFF, 0x00, 0xFF,
|
||||||
0x93, 0xdf, 0x1f,
|
0x92, 0x01, 0xFF,
|
||||||
|
0x93, 0xDF, 0x1F,
|
||||||
0x00, 0x00, 0x00
|
0x00, 0x00, 0x00
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -82,6 +89,9 @@ const static uint8_t *OV2640_SETTING_SHARPNESS[]=
|
|||||||
OV2640_SHARPNESS_LEVEL6 // +3 sharpness
|
OV2640_SHARPNESS_LEVEL6 // +3 sharpness
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define OV2640_MAXLEVEL_SHARPNESS 6
|
||||||
|
|
||||||
|
|
||||||
static int table_mask_write(sensor_t *sensor, const uint8_t* ptab)
|
static int table_mask_write(sensor_t *sensor, const uint8_t* ptab)
|
||||||
{
|
{
|
||||||
uint8_t address;
|
uint8_t address;
|
||||||
@@ -91,34 +101,52 @@ static int table_mask_write(sensor_t *sensor, const uint8_t* ptab)
|
|||||||
const uint8_t *pdata = ptab;
|
const uint8_t *pdata = ptab;
|
||||||
|
|
||||||
if (pdata == NULL)
|
if (pdata == NULL)
|
||||||
|
{
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
address = *pdata++;
|
address = *pdata++;
|
||||||
value = *pdata++;
|
value = *pdata++;
|
||||||
mask = *pdata++;
|
mask = *pdata++;
|
||||||
|
|
||||||
if ((address == 0) && (value == 0) && (mask == 0))
|
if ((address == 0) && (value == 0) && (mask == 0))
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
sensor->set_reg(sensor, address, mask, value);
|
sensor->set_reg(sensor, address, mask, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int ov2640_enable_auto_sharpness(sensor_t *sensor)
|
int ov2640_enable_auto_sharpness(sensor_t *sensor)
|
||||||
{
|
{
|
||||||
table_mask_write(sensor, OV2640_SHARPNESS_AUTO);
|
table_mask_write(sensor, OV2640_SHARPNESS_AUTO);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int ov2640_set_sharpness(sensor_t *sensor, int sharpness)
|
int ov2640_set_sharpness(sensor_t *sensor, int sharpness)
|
||||||
{
|
{
|
||||||
if ((sharpness < -3) || (sharpness > OV2640_MAXLEVEL_SHARPNESS - 3))
|
int sharpness_temp = 0;
|
||||||
return -1;
|
|
||||||
|
if (sharpness < -3)
|
||||||
|
{
|
||||||
|
sharpness_temp = -3;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sharpness > OV2640_MAXLEVEL_SHARPNESS - 3)
|
||||||
|
{
|
||||||
|
sharpness_temp = OV2640_MAXLEVEL_SHARPNESS - 3;
|
||||||
|
}
|
||||||
|
|
||||||
table_mask_write(sensor, OV2640_SHARPNESS_MANUAL);
|
table_mask_write(sensor, OV2640_SHARPNESS_MANUAL);
|
||||||
table_mask_write(sensor, OV2640_SETTING_SHARPNESS[sharpness + 3]);
|
table_mask_write(sensor, OV2640_SETTING_SHARPNESS[sharpness_temp + 3]);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
#include "esp_camera.h"
|
#include "esp_camera.h"
|
||||||
#include "ClassControllCamera.h"
|
#include "ClassControllCamera.h"
|
||||||
|
#include "MainFlowControl.h"
|
||||||
|
|
||||||
#include "ClassLogFile.h"
|
#include "ClassLogFile.h"
|
||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
@@ -13,37 +14,39 @@
|
|||||||
|
|
||||||
static const char *TAG = "server_cam";
|
static const char *TAG = "server_cam";
|
||||||
|
|
||||||
|
void PowerResetCamera()
|
||||||
void PowerResetCamera(){
|
{
|
||||||
|
#if CAM_PIN_PWDN == GPIO_NUM_NC // Use reset only if pin is available
|
||||||
|
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "No power down pin availbale to reset camera");
|
||||||
|
#else
|
||||||
ESP_LOGD(TAG, "Resetting camera by power down line");
|
ESP_LOGD(TAG, "Resetting camera by power down line");
|
||||||
gpio_config_t conf;
|
gpio_config_t conf;
|
||||||
conf.intr_type = GPIO_INTR_DISABLE;
|
conf.intr_type = GPIO_INTR_DISABLE;
|
||||||
conf.pin_bit_mask = 1LL << GPIO_NUM_32;
|
conf.pin_bit_mask = 1LL << CAM_PIN_PWDN;
|
||||||
conf.mode = GPIO_MODE_OUTPUT;
|
conf.mode = GPIO_MODE_OUTPUT;
|
||||||
conf.pull_down_en = GPIO_PULLDOWN_DISABLE;
|
conf.pull_down_en = GPIO_PULLDOWN_DISABLE;
|
||||||
conf.pull_up_en = GPIO_PULLUP_DISABLE;
|
conf.pull_up_en = GPIO_PULLUP_DISABLE;
|
||||||
gpio_config(&conf);
|
gpio_config(&conf);
|
||||||
|
|
||||||
// carefull, logic is inverted compared to reset pin
|
// carefull, logic is inverted compared to reset pin
|
||||||
gpio_set_level(GPIO_NUM_32, 1);
|
gpio_set_level(CAM_PIN_PWDN, 1);
|
||||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||||
gpio_set_level(GPIO_NUM_32, 0);
|
gpio_set_level(CAM_PIN_PWDN, 0);
|
||||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
esp_err_t handler_lightOn(httpd_req_t *req)
|
esp_err_t handler_lightOn(httpd_req_t *req)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_DETAIL_ON
|
#ifdef DEBUG_DETAIL_ON
|
||||||
LogFile.WriteHeapInfo("handler_lightOn - Start");
|
LogFile.WriteHeapInfo("handler_lightOn - Start");
|
||||||
ESP_LOGD(TAG, "handler_lightOn uri: %s", req->uri);
|
ESP_LOGD(TAG, "handler_lightOn uri: %s", req->uri);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (Camera.getCameraInitSuccessful())
|
if (Camera.getCameraInitSuccessful())
|
||||||
{
|
{
|
||||||
Camera.LightOnOff(true);
|
Camera.LightOnOff(true);
|
||||||
const char* resp_str = (const char*) req->user_ctx;
|
const char *resp_str = (const char *)req->user_ctx;
|
||||||
httpd_resp_send(req, resp_str, strlen(resp_str));
|
httpd_resp_send(req, resp_str, strlen(resp_str));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -52,25 +55,24 @@ esp_err_t handler_lightOn(httpd_req_t *req)
|
|||||||
return ESP_ERR_NOT_FOUND;
|
return ESP_ERR_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_DETAIL_ON
|
#ifdef DEBUG_DETAIL_ON
|
||||||
LogFile.WriteHeapInfo("handler_lightOn - Done");
|
LogFile.WriteHeapInfo("handler_lightOn - Done");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
esp_err_t handler_lightOff(httpd_req_t *req)
|
esp_err_t handler_lightOff(httpd_req_t *req)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_DETAIL_ON
|
#ifdef DEBUG_DETAIL_ON
|
||||||
LogFile.WriteHeapInfo("handler_lightOff - Start");
|
LogFile.WriteHeapInfo("handler_lightOff - Start");
|
||||||
ESP_LOGD(TAG, "handler_lightOff uri: %s", req->uri);
|
ESP_LOGD(TAG, "handler_lightOff uri: %s", req->uri);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (Camera.getCameraInitSuccessful())
|
if (Camera.getCameraInitSuccessful())
|
||||||
{
|
{
|
||||||
Camera.LightOnOff(false);
|
Camera.LightOnOff(false);
|
||||||
const char* resp_str = (const char*) req->user_ctx;
|
const char *resp_str = (const char *)req->user_ctx;
|
||||||
httpd_resp_send(req, resp_str, strlen(resp_str));
|
httpd_resp_send(req, resp_str, strlen(resp_str));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -79,43 +81,39 @@ esp_err_t handler_lightOff(httpd_req_t *req)
|
|||||||
return ESP_ERR_NOT_FOUND;
|
return ESP_ERR_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_DETAIL_ON
|
#ifdef DEBUG_DETAIL_ON
|
||||||
LogFile.WriteHeapInfo("handler_lightOff - Done");
|
LogFile.WriteHeapInfo("handler_lightOff - Done");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
esp_err_t handler_capture(httpd_req_t *req)
|
esp_err_t handler_capture(httpd_req_t *req)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_DETAIL_ON
|
#ifdef DEBUG_DETAIL_ON
|
||||||
LogFile.WriteHeapInfo("handler_capture - Start");
|
LogFile.WriteHeapInfo("handler_capture - Start");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (Camera.getCameraInitSuccessful())
|
if (Camera.getCameraInitSuccessful())
|
||||||
{
|
{
|
||||||
int quality;
|
// If the camera settings were changed by creating a new reference image, they must be reset
|
||||||
framesize_t res;
|
if (CFstatus.changedCameraSettings)
|
||||||
bool zoomEnabled;
|
{
|
||||||
int zoomMode;
|
Camera.setSensorDatenFromCCstatus(); // CCstatus >>> Kamera
|
||||||
int zoomOffsetX;
|
Camera.SetQualityZoomSize(CCstatus.ImageQuality, CCstatus.ImageFrameSize, CCstatus.ImageZoomEnabled, CCstatus.ImageZoomOffsetX, CCstatus.ImageZoomOffsetY, CCstatus.ImageZoomSize, CCstatus.ImageVflip);
|
||||||
int zoomOffsetY;
|
CFstatus.changedCameraSettings = false;
|
||||||
|
}
|
||||||
|
|
||||||
Camera.GetCameraParameter(req, quality, res, zoomEnabled, zoomMode, zoomOffsetX, zoomOffsetY);
|
#ifdef DEBUG_DETAIL_ON
|
||||||
|
ESP_LOGD(TAG, "Size: %d, Quality: %d", CCstatus.ImageFrameSize, CCstatus.ImageQuality);
|
||||||
#ifdef DEBUG_DETAIL_ON
|
#endif
|
||||||
ESP_LOGD(TAG, "Size: %d, Quality: %d", res, quality);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Camera.SetQualitySize(quality, res, zoomEnabled, zoomMode, zoomOffsetX, zoomOffsetY);
|
|
||||||
|
|
||||||
esp_err_t result;
|
esp_err_t result;
|
||||||
result = Camera.CaptureToHTTP(req);
|
result = Camera.CaptureToHTTP(req);
|
||||||
|
|
||||||
#ifdef DEBUG_DETAIL_ON
|
#ifdef DEBUG_DETAIL_ON
|
||||||
LogFile.WriteHeapInfo("handler_capture - Done");
|
LogFile.WriteHeapInfo("handler_capture - Done");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -126,60 +124,60 @@ esp_err_t handler_capture(httpd_req_t *req)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
esp_err_t handler_capture_with_light(httpd_req_t *req)
|
esp_err_t handler_capture_with_light(httpd_req_t *req)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_DETAIL_ON
|
#ifdef DEBUG_DETAIL_ON
|
||||||
LogFile.WriteHeapInfo("handler_capture_with_light - Start");
|
LogFile.WriteHeapInfo("handler_capture_with_light - Start");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (Camera.getCameraInitSuccessful())
|
if (Camera.getCameraInitSuccessful())
|
||||||
{
|
{
|
||||||
char _query[100];
|
char _query[100];
|
||||||
char _delay[10];
|
char _delay[10];
|
||||||
|
|
||||||
int quality;
|
|
||||||
framesize_t res;
|
|
||||||
bool zoomEnabled;
|
|
||||||
int zoomMode;
|
|
||||||
int zoomOffsetX;
|
|
||||||
int zoomOffsetY;
|
|
||||||
int delay = 2500;
|
int delay = 2500;
|
||||||
|
|
||||||
if (httpd_req_get_url_query_str(req, _query, 100) == ESP_OK)
|
if (httpd_req_get_url_query_str(req, _query, 100) == ESP_OK)
|
||||||
{
|
{
|
||||||
ESP_LOGD(TAG, "Query: %s", _query);
|
ESP_LOGD(TAG, "Query: %s", _query);
|
||||||
|
|
||||||
if (httpd_query_key_value(_query, "delay", _delay, 10) == ESP_OK)
|
if (httpd_query_key_value(_query, "delay", _delay, 10) == ESP_OK)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_DETAIL_ON
|
#ifdef DEBUG_DETAIL_ON
|
||||||
ESP_LOGD(TAG, "Delay: %s", _delay);
|
ESP_LOGD(TAG, "Delay: %s", _delay);
|
||||||
#endif
|
#endif
|
||||||
delay = atoi(_delay);
|
delay = atoi(_delay);
|
||||||
|
|
||||||
if (delay < 0)
|
if (delay < 0)
|
||||||
|
{
|
||||||
delay = 0;
|
delay = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Camera.GetCameraParameter(req, quality, res, zoomEnabled, zoomMode, zoomOffsetX, zoomOffsetY);
|
// If the camera settings were changed by creating a new reference image, they must be reset
|
||||||
|
if (CFstatus.changedCameraSettings)
|
||||||
|
{
|
||||||
|
Camera.setSensorDatenFromCCstatus(); // CCstatus >>> Kamera
|
||||||
|
Camera.SetQualityZoomSize(CCstatus.ImageQuality, CCstatus.ImageFrameSize, CCstatus.ImageZoomEnabled, CCstatus.ImageZoomOffsetX, CCstatus.ImageZoomOffsetY, CCstatus.ImageZoomSize, CCstatus.ImageVflip);
|
||||||
|
CFstatus.changedCameraSettings = false;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_DETAIL_ON
|
#ifdef DEBUG_DETAIL_ON
|
||||||
ESP_LOGD(TAG, "Size: %d, Quality: %d", res, quality);
|
ESP_LOGD(TAG, "Size: %d, Quality: %d", CCstatus.ImageFrameSize, CCstatus.ImageQuality);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Camera.SetQualitySize(quality, res, zoomEnabled, zoomMode, zoomOffsetX, zoomOffsetY);
|
|
||||||
Camera.LightOnOff(true);
|
Camera.LightOnOff(true);
|
||||||
const TickType_t xDelay = delay / portTICK_PERIOD_MS;
|
const TickType_t xDelay = delay / portTICK_PERIOD_MS;
|
||||||
vTaskDelay( xDelay );
|
vTaskDelay(xDelay);
|
||||||
|
|
||||||
esp_err_t result;
|
esp_err_t result;
|
||||||
result = Camera.CaptureToHTTP(req);
|
result = Camera.CaptureToHTTP(req);
|
||||||
|
|
||||||
Camera.LightOnOff(false);
|
Camera.LightOnOff(false);
|
||||||
|
|
||||||
#ifdef DEBUG_DETAIL_ON
|
#ifdef DEBUG_DETAIL_ON
|
||||||
LogFile.WriteHeapInfo("handler_capture_with_light - Done");
|
LogFile.WriteHeapInfo("handler_capture_with_light - Done");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -190,12 +188,11 @@ esp_err_t handler_capture_with_light(httpd_req_t *req)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
esp_err_t handler_capture_save_to_file(httpd_req_t *req)
|
esp_err_t handler_capture_save_to_file(httpd_req_t *req)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_DETAIL_ON
|
#ifdef DEBUG_DETAIL_ON
|
||||||
LogFile.WriteHeapInfo("handler_capture_save_to_file - Start");
|
LogFile.WriteHeapInfo("handler_capture_save_to_file - Start");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (Camera.getCameraInitSuccessful())
|
if (Camera.getCameraInitSuccessful())
|
||||||
{
|
{
|
||||||
@@ -205,56 +202,61 @@ esp_err_t handler_capture_save_to_file(httpd_req_t *req)
|
|||||||
char filename[100];
|
char filename[100];
|
||||||
std::string fn = "/sdcard/";
|
std::string fn = "/sdcard/";
|
||||||
|
|
||||||
|
|
||||||
int quality;
|
|
||||||
framesize_t res;
|
|
||||||
bool zoomEnabled;
|
|
||||||
int zoomMode;
|
|
||||||
int zoomOffsetX;
|
|
||||||
int zoomOffsetY;
|
|
||||||
|
|
||||||
if (httpd_req_get_url_query_str(req, _query, 100) == ESP_OK)
|
if (httpd_req_get_url_query_str(req, _query, 100) == ESP_OK)
|
||||||
{
|
{
|
||||||
ESP_LOGD(TAG, "Query: %s", _query);
|
ESP_LOGD(TAG, "Query: %s", _query);
|
||||||
|
|
||||||
if (httpd_query_key_value(_query, "filename", filename, 100) == ESP_OK)
|
if (httpd_query_key_value(_query, "filename", filename, 100) == ESP_OK)
|
||||||
{
|
{
|
||||||
fn.append(filename);
|
fn.append(filename);
|
||||||
#ifdef DEBUG_DETAIL_ON
|
#ifdef DEBUG_DETAIL_ON
|
||||||
ESP_LOGD(TAG, "Filename: %s", fn.c_str());
|
ESP_LOGD(TAG, "Filename: %s", fn.c_str());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
fn.append("noname.jpg");
|
fn.append("noname.jpg");
|
||||||
|
}
|
||||||
|
|
||||||
if (httpd_query_key_value(_query, "delay", _delay, 10) == ESP_OK)
|
if (httpd_query_key_value(_query, "delay", _delay, 10) == ESP_OK)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_DETAIL_ON
|
#ifdef DEBUG_DETAIL_ON
|
||||||
ESP_LOGD(TAG, "Delay: %s", _delay);
|
ESP_LOGD(TAG, "Delay: %s", _delay);
|
||||||
#endif
|
#endif
|
||||||
delay = atoi(_delay);
|
delay = atoi(_delay);
|
||||||
|
|
||||||
if (delay < 0)
|
if (delay < 0)
|
||||||
|
{
|
||||||
delay = 0;
|
delay = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
fn.append("noname.jpg");
|
fn.append("noname.jpg");
|
||||||
|
}
|
||||||
|
|
||||||
Camera.GetCameraParameter(req, quality, res, zoomEnabled, zoomMode, zoomOffsetX, zoomOffsetY);
|
// If the camera settings were changed by creating a new reference image, they must be reset
|
||||||
#ifdef DEBUG_DETAIL_ON
|
if (CFstatus.changedCameraSettings)
|
||||||
ESP_LOGD(TAG, "Size: %d, Quality: %d", res, quality);
|
{
|
||||||
#endif
|
Camera.setSensorDatenFromCCstatus(); // CCstatus >>> Kamera
|
||||||
Camera.SetQualitySize(quality, res, zoomEnabled, zoomMode, zoomOffsetX, zoomOffsetY);
|
Camera.SetQualityZoomSize(CCstatus.ImageQuality, CCstatus.ImageFrameSize, CCstatus.ImageZoomEnabled, CCstatus.ImageZoomOffsetX, CCstatus.ImageZoomOffsetY, CCstatus.ImageZoomSize, CCstatus.ImageVflip);
|
||||||
|
CFstatus.changedCameraSettings = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef DEBUG_DETAIL_ON
|
||||||
|
ESP_LOGD(TAG, "Size: %d, Quality: %d", CCstatus.ImageFrameSize, CCstatus.ImageQuality);
|
||||||
|
#endif
|
||||||
|
|
||||||
esp_err_t result;
|
esp_err_t result;
|
||||||
result = Camera.CaptureToFile(fn, delay);
|
result = Camera.CaptureToFile(fn, delay);
|
||||||
|
|
||||||
const char* resp_str = (const char*) fn.c_str();
|
const char *resp_str = (const char *)fn.c_str();
|
||||||
httpd_resp_send(req, resp_str, strlen(resp_str));
|
httpd_resp_send(req, resp_str, strlen(resp_str));
|
||||||
|
|
||||||
#ifdef DEBUG_DETAIL_ON
|
#ifdef DEBUG_DETAIL_ON
|
||||||
LogFile.WriteHeapInfo("handler_capture_save_to_file - Done");
|
LogFile.WriteHeapInfo("handler_capture_save_to_file - Done");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -265,24 +267,23 @@ esp_err_t handler_capture_save_to_file(httpd_req_t *req)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void register_server_camera_uri(httpd_handle_t server)
|
void register_server_camera_uri(httpd_handle_t server)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_DETAIL_ON
|
#ifdef DEBUG_DETAIL_ON
|
||||||
ESP_LOGI(TAG, "server_part_camera - Registering URI handlers");
|
ESP_LOGI(TAG, "server_part_camera - Registering URI handlers");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
httpd_uri_t camuri = { };
|
httpd_uri_t camuri = {};
|
||||||
camuri.method = HTTP_GET;
|
camuri.method = HTTP_GET;
|
||||||
|
|
||||||
camuri.uri = "/lighton";
|
camuri.uri = "/lighton";
|
||||||
camuri.handler = handler_lightOn;
|
camuri.handler = handler_lightOn;
|
||||||
camuri.user_ctx = (void*) "Light On";
|
camuri.user_ctx = (void *)"Light On";
|
||||||
httpd_register_uri_handler(server, &camuri);
|
httpd_register_uri_handler(server, &camuri);
|
||||||
|
|
||||||
camuri.uri = "/lightoff";
|
camuri.uri = "/lightoff";
|
||||||
camuri.handler = handler_lightOff;
|
camuri.handler = handler_lightOff;
|
||||||
camuri.user_ctx = (void*) "Light Off";
|
camuri.user_ctx = (void *)"Light Off";
|
||||||
httpd_register_uri_handler(server, &camuri);
|
httpd_register_uri_handler(server, &camuri);
|
||||||
|
|
||||||
camuri.uri = "/capture";
|
camuri.uri = "/capture";
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
//#include "ClassControllCamera.h"
|
//#include "ClassControllCamera.h"
|
||||||
|
|
||||||
void register_server_camera_uri(httpd_handle_t server);
|
void register_server_camera_uri(httpd_handle_t server);
|
||||||
|
|
||||||
void PowerResetCamera();
|
void PowerResetCamera();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -4,5 +4,5 @@ It should be possible to include the repo directly as a submodule, how ever it c
|
|||||||
- https://github.com/richgel999/miniz/issues/145
|
- https://github.com/richgel999/miniz/issues/145
|
||||||
- https://github.com/espressif/esptool/pull/500#issuecomment-574879468
|
- https://github.com/espressif/esptool/pull/500#issuecomment-574879468
|
||||||
|
|
||||||
For sumplicity we therefore use the release files as suggested in the readme.
|
For simplicity we therefore use the release files as suggested in the readme.
|
||||||
Additionally we added the CMakeLists.txt and this readme.
|
Additionally we added the CMakeLists.txt and this readme.
|
||||||
@@ -2,6 +2,6 @@ FILE(GLOB_RECURSE app_sources ${CMAKE_CURRENT_SOURCE_DIR}/*.*)
|
|||||||
|
|
||||||
idf_component_register(SRCS ${app_sources}
|
idf_component_register(SRCS ${app_sources}
|
||||||
INCLUDE_DIRS "."
|
INCLUDE_DIRS "."
|
||||||
REQUIRES esp_timer esp_wifi jomjol_tfliteclass jomjol_helper jomjol_controlcamera jomjol_mqtt jomjol_influxdb jomjol_fileserver_ota jomjol_image_proc jomjol_wlan)
|
REQUIRES esp_timer esp_wifi jomjol_tfliteclass jomjol_helper jomjol_controlcamera jomjol_mqtt jomjol_influxdb jomjol_webhook jomjol_fileserver_ota jomjol_image_proc jomjol_wlan openmetrics)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -67,11 +67,6 @@ string ClassFlow::getHTMLSingleStep(string host){
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
string ClassFlow::getReadout()
|
|
||||||
{
|
|
||||||
return string();
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string ClassFlow::GetParameterName(std::string _input)
|
std::string ClassFlow::GetParameterName(std::string _input)
|
||||||
{
|
{
|
||||||
string _param;
|
string _param;
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ public:
|
|||||||
virtual bool ReadParameter(FILE* pfile, string &aktparamgraph);
|
virtual bool ReadParameter(FILE* pfile, string &aktparamgraph);
|
||||||
virtual bool doFlow(string time);
|
virtual bool doFlow(string time);
|
||||||
virtual string getHTMLSingleStep(string host);
|
virtual string getHTMLSingleStep(string host);
|
||||||
virtual string getReadout();
|
|
||||||
virtual string name(){return "ClassFlow";};
|
virtual string name(){return "ClassFlow";};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -6,22 +6,18 @@
|
|||||||
#include "CRotateImage.h"
|
#include "CRotateImage.h"
|
||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
|
|
||||||
|
|
||||||
#include "ClassLogFile.h"
|
#include "ClassLogFile.h"
|
||||||
#include "psram.h"
|
#include "psram.h"
|
||||||
#include "../../include/defines.h"
|
#include "../../include/defines.h"
|
||||||
|
|
||||||
|
|
||||||
static const char *TAG = "ALIGN";
|
static const char *TAG = "ALIGN";
|
||||||
|
|
||||||
// #define DEBUG_DETAIL_ON
|
// #define DEBUG_DETAIL_ON
|
||||||
|
|
||||||
|
|
||||||
void ClassFlowAlignment::SetInitialParameter(void)
|
void ClassFlowAlignment::SetInitialParameter(void)
|
||||||
{
|
{
|
||||||
initialrotate = 0;
|
initialrotate = 0;
|
||||||
anz_ref = 0;
|
anz_ref = 0;
|
||||||
initialmirror = false;
|
|
||||||
use_antialiasing = false;
|
use_antialiasing = false;
|
||||||
initialflip = false;
|
initialflip = false;
|
||||||
SaveAllFiles = false;
|
SaveAllFiles = false;
|
||||||
@@ -31,133 +27,136 @@ void ClassFlowAlignment::SetInitialParameter(void)
|
|||||||
AlignAndCutImage = NULL;
|
AlignAndCutImage = NULL;
|
||||||
ImageBasis = NULL;
|
ImageBasis = NULL;
|
||||||
ImageTMP = NULL;
|
ImageTMP = NULL;
|
||||||
#ifdef ALGROI_LOAD_FROM_MEM_AS_JPG
|
#ifdef ALGROI_LOAD_FROM_MEM_AS_JPG
|
||||||
AlgROI = (ImageData*)malloc_psram_heap(std::string(TAG) + "->AlgROI", sizeof(ImageData), MALLOC_CAP_8BIT | MALLOC_CAP_SPIRAM);
|
AlgROI = (ImageData *)malloc_psram_heap(std::string(TAG) + "->AlgROI", sizeof(ImageData), MALLOC_CAP_8BIT | MALLOC_CAP_SPIRAM);
|
||||||
#endif
|
#endif
|
||||||
previousElement = NULL;
|
previousElement = NULL;
|
||||||
disabled = false;
|
disabled = false;
|
||||||
SAD_criteria = 0.05;
|
SAD_criteria = 0.05;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ClassFlowAlignment::ClassFlowAlignment(std::vector<ClassFlow *> *lfc)
|
||||||
ClassFlowAlignment::ClassFlowAlignment(std::vector<ClassFlow*>* lfc)
|
|
||||||
{
|
{
|
||||||
SetInitialParameter();
|
SetInitialParameter();
|
||||||
ListFlowControll = lfc;
|
ListFlowControll = lfc;
|
||||||
|
|
||||||
for (int i = 0; i < ListFlowControll->size(); ++i)
|
for (int i = 0; i < ListFlowControll->size(); ++i) {
|
||||||
{
|
if (((*ListFlowControll)[i])->name().compare("ClassFlowTakeImage") == 0) {
|
||||||
if (((*ListFlowControll)[i])->name().compare("ClassFlowTakeImage") == 0)
|
ImageBasis = ((ClassFlowTakeImage *)(*ListFlowControll)[i])->rawImage;
|
||||||
{
|
|
||||||
ImageBasis = ((ClassFlowTakeImage*) (*ListFlowControll)[i])->rawImage;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ImageBasis) // the function take pictures does not exist --> must be created first ONLY FOR TEST PURPOSES
|
// the function take pictures does not exist --> must be created first ONLY FOR TEST PURPOSES
|
||||||
{
|
if (!ImageBasis) {
|
||||||
ESP_LOGD(TAG, "CImageBasis had to be created");
|
ESP_LOGD(TAG, "CImageBasis had to be created");
|
||||||
ImageBasis = new CImageBasis("ImageBasis", namerawimage);
|
ImageBasis = new CImageBasis("ImageBasis", namerawimage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ClassFlowAlignment::ReadParameter(FILE *pfile, string &aktparamgraph)
|
||||||
bool ClassFlowAlignment::ReadParameter(FILE* pfile, string& aktparamgraph)
|
|
||||||
{
|
{
|
||||||
std::vector<string> splitted;
|
std::vector<string> splitted;
|
||||||
int suchex = 40;
|
int suchex = 40;
|
||||||
int suchey = 40;
|
int suchey = 40;
|
||||||
int alg_algo = 0; //default=0; 1 =HIGHACCURACY; 2= FAST; 3= OFF //add disable aligment algo |01.2023
|
int alg_algo = 0; // default=0; 1 =HIGHACCURACY; 2= FAST; 3= OFF //add disable aligment algo |01.2023
|
||||||
|
|
||||||
|
|
||||||
aktparamgraph = trim(aktparamgraph);
|
aktparamgraph = trim(aktparamgraph);
|
||||||
|
|
||||||
if (aktparamgraph.size() == 0)
|
if (aktparamgraph.size() == 0)
|
||||||
if (!this->GetNextParagraph(pfile, aktparamgraph))
|
{
|
||||||
|
if (!this->GetNextParagraph(pfile, aktparamgraph)) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (aktparamgraph.compare("[Alignment]") != 0) //Paragraph does not fit Alignment
|
if (aktparamgraph.compare("[Alignment]") != 0)
|
||||||
|
{
|
||||||
|
// Paragraph does not fit Alignment
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
while (this->getNextLine(pfile, &aktparamgraph) && !this->isNewParagraph(aktparamgraph))
|
while (this->getNextLine(pfile, &aktparamgraph) && !this->isNewParagraph(aktparamgraph))
|
||||||
{
|
{
|
||||||
splitted = ZerlegeZeile(aktparamgraph);
|
splitted = ZerlegeZeile(aktparamgraph);
|
||||||
if ((toUpper(splitted[0]) == "FLIPIMAGESIZE") && (splitted.size() > 1))
|
|
||||||
{
|
if ((toUpper(splitted[0]) == "FLIPIMAGESIZE") && (splitted.size() > 1)) {
|
||||||
if (toUpper(splitted[1]) == "TRUE")
|
initialflip = alphanumericToBoolean(splitted[1]);
|
||||||
initialflip = true;
|
|
||||||
}
|
}
|
||||||
if ((toUpper(splitted[0]) == "INITIALMIRROR") && (splitted.size() > 1))
|
else if (((toUpper(splitted[0]) == "initialrotate") || (toUpper(splitted[0]) == "INITIALROTATE")) && (splitted.size() > 1)) {
|
||||||
{
|
if (isStringNumeric(splitted[1])) {
|
||||||
if (toUpper(splitted[1]) == "TRUE")
|
|
||||||
initialmirror = true;
|
|
||||||
}
|
|
||||||
if (((toUpper(splitted[0]) == "initialrotate") || (toUpper(splitted[0]) == "INITIALROTATE")) && (splitted.size() > 1))
|
|
||||||
{
|
|
||||||
this->initialrotate = std::stod(splitted[1]);
|
this->initialrotate = std::stod(splitted[1]);
|
||||||
}
|
}
|
||||||
if ((toUpper(splitted[0]) == "SEARCHFIELDX") && (splitted.size() > 1))
|
}
|
||||||
{
|
else if ((toUpper(splitted[0]) == "SEARCHFIELDX") && (splitted.size() > 1)) {
|
||||||
|
if (isStringNumeric(splitted[1])) {
|
||||||
suchex = std::stod(splitted[1]);
|
suchex = std::stod(splitted[1]);
|
||||||
}
|
}
|
||||||
if ((toUpper(splitted[0]) == "SEARCHFIELDY") && (splitted.size() > 1))
|
}
|
||||||
{
|
else if ((toUpper(splitted[0]) == "SEARCHFIELDY") && (splitted.size() > 1)) {
|
||||||
|
if (isStringNumeric(splitted[1])) {
|
||||||
suchey = std::stod(splitted[1]);
|
suchey = std::stod(splitted[1]);
|
||||||
}
|
}
|
||||||
if ((toUpper(splitted[0]) == "ANTIALIASING") && (splitted.size() > 1))
|
|
||||||
{
|
|
||||||
if (toUpper(splitted[1]) == "TRUE")
|
|
||||||
use_antialiasing = true;
|
|
||||||
}
|
}
|
||||||
if ((splitted.size() == 3) && (anz_ref < 2))
|
else if ((toUpper(splitted[0]) == "ANTIALIASING") && (splitted.size() > 1)) {
|
||||||
|
use_antialiasing = alphanumericToBoolean(splitted[1]);
|
||||||
|
}
|
||||||
|
else if ((splitted.size() == 3) && (anz_ref < 2)) {
|
||||||
|
if ((isStringNumeric(splitted[1])) && (isStringNumeric(splitted[2])))
|
||||||
{
|
{
|
||||||
References[anz_ref].image_file = FormatFileName("/sdcard" + splitted[0]);
|
References[anz_ref].image_file = FormatFileName("/sdcard" + splitted[0]);
|
||||||
References[anz_ref].target_x = std::stod(splitted[1]);
|
References[anz_ref].target_x = std::stod(splitted[1]);
|
||||||
References[anz_ref].target_y = std::stod(splitted[2]);
|
References[anz_ref].target_y = std::stod(splitted[2]);
|
||||||
anz_ref++;
|
anz_ref++;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
if ((toUpper(splitted[0]) == "SAVEALLFILES") && (splitted.size() > 1))
|
|
||||||
{
|
{
|
||||||
if (toUpper(splitted[1]) == "TRUE")
|
References[anz_ref].image_file = FormatFileName("/sdcard" + splitted[0]);
|
||||||
SaveAllFiles = true;
|
References[anz_ref].target_x = 10;
|
||||||
|
References[anz_ref].target_y = 10;
|
||||||
|
anz_ref++;
|
||||||
}
|
}
|
||||||
if ((toUpper(splitted[0]) == "ALIGNMENTALGO") && (splitted.size() > 1))
|
}
|
||||||
{
|
|
||||||
#ifdef DEBUG_DETAIL_ON
|
else if ((toUpper(splitted[0]) == "SAVEALLFILES") && (splitted.size() > 1)) {
|
||||||
|
SaveAllFiles = alphanumericToBoolean(splitted[1]);
|
||||||
|
}
|
||||||
|
else if ((toUpper(splitted[0]) == "ALIGNMENTALGO") && (splitted.size() > 1)) {
|
||||||
|
#ifdef DEBUG_DETAIL_ON
|
||||||
std::string zw2 = "Alignment mode selected: " + splitted[1];
|
std::string zw2 = "Alignment mode selected: " + splitted[1];
|
||||||
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, zw2);
|
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, zw2);
|
||||||
#endif
|
#endif
|
||||||
if (toUpper(splitted[1]) == "HIGHACCURACY")
|
if (toUpper(splitted[1]) == "HIGHACCURACY") {
|
||||||
alg_algo = 1;
|
alg_algo = 1;
|
||||||
if (toUpper(splitted[1]) == "FAST")
|
}
|
||||||
|
if (toUpper(splitted[1]) == "FAST") {
|
||||||
alg_algo = 2;
|
alg_algo = 2;
|
||||||
if (toUpper(splitted[1]) == "OFF") //no align algo if set to 3 = off => no draw ref //add disable aligment algo |01.2023
|
}
|
||||||
|
if (toUpper(splitted[1]) == "OFF") {
|
||||||
|
// no align algo if set to 3 = off => no draw ref //add disable aligment algo |01.2023
|
||||||
alg_algo = 3;
|
alg_algo = 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < anz_ref; ++i)
|
for (int i = 0; i < anz_ref; ++i) {
|
||||||
{
|
|
||||||
References[i].search_x = suchex;
|
References[i].search_x = suchex;
|
||||||
References[i].search_y = suchey;
|
References[i].search_y = suchey;
|
||||||
References[i].fastalg_SAD_criteria = SAD_criteria;
|
References[i].fastalg_SAD_criteria = SAD_criteria;
|
||||||
References[i].alignment_algo = alg_algo;
|
References[i].alignment_algo = alg_algo;
|
||||||
#ifdef DEBUG_DETAIL_ON
|
#ifdef DEBUG_DETAIL_ON
|
||||||
std::string zw2 = "Alignment mode written: " + std::to_string(alg_algo);
|
std::string zw2 = "Alignment mode written: " + std::to_string(alg_algo);
|
||||||
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, zw2);
|
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, zw2);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//no align algo if set to 3 = off => no draw ref //add disable aligment algo |01.2023
|
// no align algo if set to 3 = off => no draw ref //add disable aligment algo |01.2023
|
||||||
if(References[0].alignment_algo != 3){
|
if (References[0].alignment_algo != 3) {
|
||||||
LoadReferenceAlignmentValues();
|
return LoadReferenceAlignmentValues();
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string ClassFlowAlignment::getHTMLSingleStep(string host)
|
string ClassFlowAlignment::getHTMLSingleStep(string host)
|
||||||
{
|
{
|
||||||
string result;
|
string result;
|
||||||
@@ -168,31 +167,28 @@ string ClassFlowAlignment::getHTMLSingleStep(string host)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool ClassFlowAlignment::doFlow(string time)
|
bool ClassFlowAlignment::doFlow(string time)
|
||||||
{
|
{
|
||||||
#ifdef ALGROI_LOAD_FROM_MEM_AS_JPG
|
#ifdef ALGROI_LOAD_FROM_MEM_AS_JPG
|
||||||
if (!AlgROI) // AlgROI needs to be allocated before ImageTMP to avoid heap fragmentation
|
// AlgROI needs to be allocated before ImageTMP to avoid heap fragmentation
|
||||||
{
|
if (!AlgROI) {
|
||||||
AlgROI = (ImageData*)heap_caps_realloc(AlgROI, sizeof(ImageData), MALLOC_CAP_8BIT | MALLOC_CAP_SPIRAM);
|
AlgROI = (ImageData *)heap_caps_realloc(AlgROI, sizeof(ImageData), MALLOC_CAP_8BIT | MALLOC_CAP_SPIRAM);
|
||||||
if (!AlgROI)
|
|
||||||
{
|
if (!AlgROI) {
|
||||||
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Can't allocate AlgROI");
|
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Can't allocate AlgROI");
|
||||||
LogFile.WriteHeapInfo("ClassFlowAlignment-doFlow");
|
LogFile.WriteHeapInfo("ClassFlowAlignment-doFlow");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AlgROI)
|
if (AlgROI) {
|
||||||
{
|
ImageBasis->writeToMemoryAsJPG((ImageData *)AlgROI, 90);
|
||||||
ImageBasis->writeToMemoryAsJPG((ImageData*)AlgROI, 90);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!ImageTMP)
|
if (!ImageTMP) {
|
||||||
{
|
|
||||||
ImageTMP = new CImageBasis("tmpImage", ImageBasis); // Make sure the name does not get change, it is relevant for the PSRAM allocation!
|
ImageTMP = new CImageBasis("tmpImage", ImageBasis); // Make sure the name does not get change, it is relevant for the PSRAM allocation!
|
||||||
if (!ImageTMP)
|
|
||||||
{
|
if (!ImageTMP) {
|
||||||
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Can't allocate tmpImage -> Exec this round aborted!");
|
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Can't allocate tmpImage -> Exec this round aborted!");
|
||||||
LogFile.WriteHeapInfo("ClassFlowAlignment-doFlow");
|
LogFile.WriteHeapInfo("ClassFlowAlignment-doFlow");
|
||||||
return false;
|
return false;
|
||||||
@@ -201,16 +197,16 @@ bool ClassFlowAlignment::doFlow(string time)
|
|||||||
|
|
||||||
delete AlignAndCutImage;
|
delete AlignAndCutImage;
|
||||||
AlignAndCutImage = new CAlignAndCutImage("AlignAndCutImage", ImageBasis, ImageTMP);
|
AlignAndCutImage = new CAlignAndCutImage("AlignAndCutImage", ImageBasis, ImageTMP);
|
||||||
if (!AlignAndCutImage)
|
|
||||||
{
|
if (!AlignAndCutImage) {
|
||||||
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Can't allocate AlignAndCutImage -> Exec this round aborted!");
|
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Can't allocate AlignAndCutImage -> Exec this round aborted!");
|
||||||
LogFile.WriteHeapInfo("ClassFlowAlignment-doFlow");
|
LogFile.WriteHeapInfo("ClassFlowAlignment-doFlow");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
CRotateImage rt("rawImage", AlignAndCutImage, ImageTMP, initialflip);
|
CRotateImage rt("rawImage", AlignAndCutImage, ImageTMP, initialflip);
|
||||||
if (initialflip)
|
|
||||||
{
|
if (initialflip) {
|
||||||
int _zw = ImageBasis->height;
|
int _zw = ImageBasis->height;
|
||||||
ImageBasis->height = ImageBasis->width;
|
ImageBasis->height = ImageBasis->width;
|
||||||
ImageBasis->width = _zw;
|
ImageBasis->width = _zw;
|
||||||
@@ -220,50 +216,40 @@ bool ClassFlowAlignment::doFlow(string time)
|
|||||||
ImageTMP->height = _zw;
|
ImageTMP->height = _zw;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (initialmirror)
|
if ((initialrotate != 0) || initialflip) {
|
||||||
{
|
if (use_antialiasing) {
|
||||||
ESP_LOGD(TAG, "do mirror");
|
rt.RotateAntiAliasing(initialrotate);
|
||||||
rt.Mirror();
|
}
|
||||||
|
else {
|
||||||
if (SaveAllFiles)
|
rt.Rotate(initialrotate);
|
||||||
AlignAndCutImage->SaveToFile(FormatFileName("/sdcard/img_tmp/mirror.jpg"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((initialrotate != 0) || initialflip)
|
if (SaveAllFiles) {
|
||||||
{
|
|
||||||
if (use_antialiasing)
|
|
||||||
rt.RotateAntiAliasing(initialrotate);
|
|
||||||
else
|
|
||||||
rt.Rotate(initialrotate);
|
|
||||||
|
|
||||||
if (SaveAllFiles)
|
|
||||||
AlignAndCutImage->SaveToFile(FormatFileName("/sdcard/img_tmp/rot.jpg"));
|
AlignAndCutImage->SaveToFile(FormatFileName("/sdcard/img_tmp/rot.jpg"));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// no align algo if set to 3 = off //add disable aligment algo |01.2023
|
||||||
//no align algo if set to 3 = off //add disable aligment algo |01.2023
|
if (References[0].alignment_algo != 3) {
|
||||||
if(References[0].alignment_algo != 3){
|
if (!AlignAndCutImage->Align(&References[0], &References[1])) {
|
||||||
if (!AlignAndCutImage->Align(&References[0], &References[1]))
|
|
||||||
{
|
|
||||||
SaveReferenceAlignmentValues();
|
SaveReferenceAlignmentValues();
|
||||||
}
|
}
|
||||||
}// no align
|
} // no align
|
||||||
|
|
||||||
|
#ifdef ALGROI_LOAD_FROM_MEM_AS_JPG
|
||||||
#ifdef ALGROI_LOAD_FROM_MEM_AS_JPG
|
|
||||||
if (AlgROI) {
|
if (AlgROI) {
|
||||||
//no align algo if set to 3 = off => no draw ref //add disable aligment algo |01.2023
|
// no align algo if set to 3 = off => no draw ref //add disable aligment algo |01.2023
|
||||||
if(References[0].alignment_algo != 3){
|
if (References[0].alignment_algo != 3) {
|
||||||
DrawRef(ImageTMP);
|
DrawRef(ImageTMP);
|
||||||
}
|
}
|
||||||
flowctrl.DigitalDrawROI(ImageTMP);
|
|
||||||
flowctrl.AnalogDrawROI(ImageTMP);
|
|
||||||
ImageTMP->writeToMemoryAsJPG((ImageData*)AlgROI, 90);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (SaveAllFiles)
|
flowctrl.DigitDrawROI(ImageTMP);
|
||||||
{
|
flowctrl.AnalogDrawROI(ImageTMP);
|
||||||
|
ImageTMP->writeToMemoryAsJPG((ImageData *)AlgROI, 90);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (SaveAllFiles) {
|
||||||
AlignAndCutImage->SaveToFile(FormatFileName("/sdcard/img_tmp/alg.jpg"));
|
AlignAndCutImage->SaveToFile(FormatFileName("/sdcard/img_tmp/alg.jpg"));
|
||||||
ImageTMP->SaveToFile(FormatFileName("/sdcard/img_tmp/alg_roi.jpg"));
|
ImageTMP->SaveToFile(FormatFileName("/sdcard/img_tmp/alg_roi.jpg"));
|
||||||
}
|
}
|
||||||
@@ -272,26 +258,24 @@ bool ClassFlowAlignment::doFlow(string time)
|
|||||||
delete ImageTMP;
|
delete ImageTMP;
|
||||||
ImageTMP = NULL;
|
ImageTMP = NULL;
|
||||||
|
|
||||||
//no align algo if set to 3 = off => no draw ref //add disable aligment algo |01.2023
|
// no align algo if set to 3 = off => no draw ref //add disable aligment algo |01.2023
|
||||||
if(References[0].alignment_algo != 3){
|
if (References[0].alignment_algo != 3) {
|
||||||
LoadReferenceAlignmentValues();
|
return LoadReferenceAlignmentValues();
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ClassFlowAlignment::SaveReferenceAlignmentValues()
|
void ClassFlowAlignment::SaveReferenceAlignmentValues()
|
||||||
{
|
{
|
||||||
FILE* pFile;
|
FILE *pFile;
|
||||||
std::string zwtime, zwvalue;
|
std::string zwtime, zwvalue;
|
||||||
|
|
||||||
pFile = fopen(FileStoreRefAlignment.c_str(), "w");
|
pFile = fopen(FileStoreRefAlignment.c_str(), "w");
|
||||||
|
|
||||||
if (strlen(zwtime.c_str()) == 0)
|
if (strlen(zwtime.c_str()) == 0) {
|
||||||
{
|
|
||||||
time_t rawtime;
|
time_t rawtime;
|
||||||
struct tm* timeinfo;
|
struct tm *timeinfo;
|
||||||
char buffer[80];
|
char buffer[80];
|
||||||
|
|
||||||
time(&rawtime);
|
time(&rawtime);
|
||||||
@@ -305,40 +289,40 @@ void ClassFlowAlignment::SaveReferenceAlignmentValues()
|
|||||||
fputs("\n", pFile);
|
fputs("\n", pFile);
|
||||||
|
|
||||||
zwvalue = std::to_string(References[0].fastalg_x) + "\t" + std::to_string(References[0].fastalg_y);
|
zwvalue = std::to_string(References[0].fastalg_x) + "\t" + std::to_string(References[0].fastalg_y);
|
||||||
zwvalue = zwvalue + "\t" +std::to_string(References[0].fastalg_SAD)+ "\t" +std::to_string(References[0].fastalg_min);
|
zwvalue = zwvalue + "\t" + std::to_string(References[0].fastalg_SAD) + "\t" + std::to_string(References[0].fastalg_min);
|
||||||
zwvalue = zwvalue + "\t" +std::to_string(References[0].fastalg_max)+ "\t" +std::to_string(References[0].fastalg_avg);
|
zwvalue = zwvalue + "\t" + std::to_string(References[0].fastalg_max) + "\t" + std::to_string(References[0].fastalg_avg);
|
||||||
fputs(zwvalue.c_str(), pFile);
|
fputs(zwvalue.c_str(), pFile);
|
||||||
fputs("\n", pFile);
|
fputs("\n", pFile);
|
||||||
|
|
||||||
zwvalue = std::to_string(References[1].fastalg_x) + "\t" + std::to_string(References[1].fastalg_y);
|
zwvalue = std::to_string(References[1].fastalg_x) + "\t" + std::to_string(References[1].fastalg_y);
|
||||||
zwvalue = zwvalue + "\t" +std::to_string(References[1].fastalg_SAD)+ "\t" +std::to_string(References[1].fastalg_min);
|
zwvalue = zwvalue + "\t" + std::to_string(References[1].fastalg_SAD) + "\t" + std::to_string(References[1].fastalg_min);
|
||||||
zwvalue = zwvalue + "\t" +std::to_string(References[1].fastalg_max)+ "\t" +std::to_string(References[1].fastalg_avg);
|
zwvalue = zwvalue + "\t" + std::to_string(References[1].fastalg_max) + "\t" + std::to_string(References[1].fastalg_avg);
|
||||||
fputs(zwvalue.c_str(), pFile);
|
fputs(zwvalue.c_str(), pFile);
|
||||||
fputs("\n", pFile);
|
fputs("\n", pFile);
|
||||||
|
|
||||||
fclose(pFile);
|
fclose(pFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool ClassFlowAlignment::LoadReferenceAlignmentValues(void)
|
bool ClassFlowAlignment::LoadReferenceAlignmentValues(void)
|
||||||
{
|
{
|
||||||
FILE* pFile;
|
FILE *pFile;
|
||||||
char zw[1024];
|
char zw[1024];
|
||||||
string zwvalue;
|
string zwvalue;
|
||||||
std::vector<string> splitted;
|
std::vector<string> splitted;
|
||||||
|
|
||||||
|
|
||||||
pFile = fopen(FileStoreRefAlignment.c_str(), "r");
|
pFile = fopen(FileStoreRefAlignment.c_str(), "r");
|
||||||
if (pFile == NULL)
|
|
||||||
|
if (pFile == NULL) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
fgets(zw, 1024, pFile);
|
fgets(zw, 1024, pFile);
|
||||||
ESP_LOGD(TAG, "%s", zw);
|
ESP_LOGD(TAG, "%s", zw);
|
||||||
|
|
||||||
fgets(zw, 1024, pFile);
|
fgets(zw, 1024, pFile);
|
||||||
splitted = ZerlegeZeile(std::string(zw), " \t");
|
splitted = ZerlegeZeile(std::string(zw), " \t");
|
||||||
if (splitted.size() < 6)
|
|
||||||
{
|
if (splitted.size() < 6) {
|
||||||
fclose(pFile);
|
fclose(pFile);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -352,8 +336,8 @@ bool ClassFlowAlignment::LoadReferenceAlignmentValues(void)
|
|||||||
|
|
||||||
fgets(zw, 1024, pFile);
|
fgets(zw, 1024, pFile);
|
||||||
splitted = ZerlegeZeile(std::string(zw));
|
splitted = ZerlegeZeile(std::string(zw));
|
||||||
if (splitted.size() < 6)
|
|
||||||
{
|
if (splitted.size() < 6) {
|
||||||
fclose(pFile);
|
fclose(pFile);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -367,7 +351,6 @@ bool ClassFlowAlignment::LoadReferenceAlignmentValues(void)
|
|||||||
|
|
||||||
fclose(pFile);
|
fclose(pFile);
|
||||||
|
|
||||||
|
|
||||||
/*#ifdef DEBUG_DETAIL_ON
|
/*#ifdef DEBUG_DETAIL_ON
|
||||||
std::string _zw = "\tLoadReferences[0]\tx,y:\t" + std::to_string(References[0].fastalg_x) + "\t" + std::to_string(References[0].fastalg_x);
|
std::string _zw = "\tLoadReferences[0]\tx,y:\t" + std::to_string(References[0].fastalg_x) + "\t" + std::to_string(References[0].fastalg_x);
|
||||||
_zw = _zw + "\tSAD, min, max, avg:\t" + std::to_string(References[0].fastalg_SAD) + "\t" + std::to_string(References[0].fastalg_min);
|
_zw = _zw + "\tSAD, min, max, avg:\t" + std::to_string(References[0].fastalg_SAD) + "\t" + std::to_string(References[0].fastalg_min);
|
||||||
@@ -382,11 +365,9 @@ bool ClassFlowAlignment::LoadReferenceAlignmentValues(void)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ClassFlowAlignment::DrawRef(CImageBasis *_zw)
|
void ClassFlowAlignment::DrawRef(CImageBasis *_zw)
|
||||||
{
|
{
|
||||||
if (_zw->ImageOkay())
|
if (_zw->ImageOkay()) {
|
||||||
{
|
|
||||||
_zw->drawRect(References[0].target_x, References[0].target_y, References[0].width, References[0].height, 255, 0, 0, 2);
|
_zw->drawRect(References[0].target_x, References[0].target_y, References[0].width, References[0].height, 255, 0, 0, 2);
|
||||||
_zw->drawRect(References[1].target_x, References[1].target_y, References[1].width, References[1].height, 255, 0, 0, 2);
|
_zw->drawRect(References[1].target_x, References[1].target_y, References[1].width, References[1].height, 255, 0, 0, 2);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,12 +12,10 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
class ClassFlowAlignment :
|
class ClassFlowAlignment : public ClassFlow
|
||||||
public ClassFlow
|
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
float initialrotate;
|
float initialrotate;
|
||||||
bool initialmirror;
|
|
||||||
bool initialflip;
|
bool initialflip;
|
||||||
bool use_antialiasing;
|
bool use_antialiasing;
|
||||||
RefInfo References[2];
|
RefInfo References[2];
|
||||||
@@ -34,21 +32,20 @@ protected:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
CImageBasis *ImageBasis, *ImageTMP;
|
CImageBasis *ImageBasis, *ImageTMP;
|
||||||
#ifdef ALGROI_LOAD_FROM_MEM_AS_JPG
|
#ifdef ALGROI_LOAD_FROM_MEM_AS_JPG
|
||||||
ImageData *AlgROI;
|
ImageData *AlgROI;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ClassFlowAlignment(std::vector<ClassFlow*>* lfc);
|
ClassFlowAlignment(std::vector<ClassFlow *> *lfc);
|
||||||
|
|
||||||
CAlignAndCutImage* GetAlignAndCutImage(){return AlignAndCutImage;};
|
CAlignAndCutImage *GetAlignAndCutImage() { return AlignAndCutImage; };
|
||||||
|
|
||||||
void DrawRef(CImageBasis *_zw);
|
void DrawRef(CImageBasis *_zw);
|
||||||
|
|
||||||
bool ReadParameter(FILE* pfile, string& aktparamgraph);
|
bool ReadParameter(FILE *pfile, string &aktparamgraph);
|
||||||
bool doFlow(string time);
|
bool doFlow(string time);
|
||||||
string getHTMLSingleStep(string host);
|
string getHTMLSingleStep(string host);
|
||||||
string name(){return "ClassFlowAlignment";};
|
string name() { return "ClassFlowAlignment"; };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif // CLASSFLOWALIGNMENT_H
|
||||||
#endif //CLASSFLOWALIGNMENT_H
|
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ static const char* TAG = "CNN";
|
|||||||
static heap_trace_record_t trace_record[NUM_RECORDS]; // This buffer must be in internal RAM
|
static heap_trace_record_t trace_record[NUM_RECORDS]; // This buffer must be in internal RAM
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
ClassFlowCNNGeneral::ClassFlowCNNGeneral(ClassFlowAlignment *_flowalign, t_CNNType _cnntype) : ClassFlowImage(NULL, TAG) {
|
ClassFlowCNNGeneral::ClassFlowCNNGeneral(ClassFlowAlignment *_flowalign, t_CNNType _cnntype) : ClassFlowImage(NULL, TAG) {
|
||||||
string cnnmodelfile = "";
|
string cnnmodelfile = "";
|
||||||
modelxsize = 1;
|
modelxsize = 1;
|
||||||
@@ -36,8 +35,7 @@ ClassFlowCNNGeneral::ClassFlowCNNGeneral(ClassFlowAlignment *_flowalign, t_CNNTy
|
|||||||
imagesRetention = 5;
|
imagesRetention = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string ClassFlowCNNGeneral::getReadout(int _analog = 0, bool _extendedResolution, int prev, float _before_narrow_Analog, float AnalogToDigitTransitionStart) {
|
||||||
string ClassFlowCNNGeneral::getReadout(int _analog = 0, bool _extendedResolution, int prev, float _before_narrow_Analog, float analogDigitalTransitionStart) {
|
|
||||||
string result = "";
|
string result = "";
|
||||||
|
|
||||||
if (GENERAL[_analog]->ROI.size() == 0) {
|
if (GENERAL[_analog]->ROI.size() == 0) {
|
||||||
@@ -65,7 +63,7 @@ string ClassFlowCNNGeneral::getReadout(int _analog = 0, bool _extendedResolution
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CNNType == Digital) {
|
if (CNNType == Digit) {
|
||||||
for (int i = 0; i < GENERAL[_analog]->ROI.size(); ++i) {
|
for (int i = 0; i < GENERAL[_analog]->ROI.size(); ++i) {
|
||||||
if (GENERAL[_analog]->ROI[i]->result_klasse >= 10) {
|
if (GENERAL[_analog]->ROI[i]->result_klasse >= 10) {
|
||||||
result = result + "N";
|
result = result + "N";
|
||||||
@@ -77,7 +75,7 @@ string ClassFlowCNNGeneral::getReadout(int _analog = 0, bool _extendedResolution
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((CNNType == DoubleHyprid10) || (CNNType == Digital100)) {
|
if ((CNNType == DoubleHyprid10) || (CNNType == Digit100)) {
|
||||||
float number = GENERAL[_analog]->ROI[GENERAL[_analog]->ROI.size() - 1]->result_float;
|
float number = GENERAL[_analog]->ROI[GENERAL[_analog]->ROI.size() - 1]->result_float;
|
||||||
// NaN?
|
// NaN?
|
||||||
if (number >= 0) {
|
if (number >= 0) {
|
||||||
@@ -92,7 +90,7 @@ string ClassFlowCNNGeneral::getReadout(int _analog = 0, bool _extendedResolution
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (_before_narrow_Analog >= 0) {
|
if (_before_narrow_Analog >= 0) {
|
||||||
prev = PointerEvalHybridNew(GENERAL[_analog]->ROI[GENERAL[_analog]->ROI.size() - 1]->result_float, _before_narrow_Analog, prev, true, analogDigitalTransitionStart);
|
prev = PointerEvalHybridNew(GENERAL[_analog]->ROI[GENERAL[_analog]->ROI.size() - 1]->result_float, _before_narrow_Analog, prev, true, AnalogToDigitTransitionStart);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
prev = PointerEvalHybridNew(GENERAL[_analog]->ROI[GENERAL[_analog]->ROI.size() - 1]->result_float, prev, prev);
|
prev = PointerEvalHybridNew(GENERAL[_analog]->ROI[GENERAL[_analog]->ROI.size() - 1]->result_float, prev, prev);
|
||||||
@@ -103,7 +101,7 @@ string ClassFlowCNNGeneral::getReadout(int _analog = 0, bool _extendedResolution
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
result = "N";
|
result = "N";
|
||||||
if (_extendedResolution && (CNNType != Digital)) {
|
if (_extendedResolution && (CNNType != Digit)) {
|
||||||
result = "NN";
|
result = "NN";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -137,13 +135,13 @@ string ClassFlowCNNGeneral::getReadout(int _analog = 0, bool _extendedResolution
|
|||||||
* 0.1 => 0 (eval_predecessors)
|
* 0.1 => 0 (eval_predecessors)
|
||||||
* The 0 makes a 9.9 to 0 (eval_predecessors)
|
* The 0 makes a 9.9 to 0 (eval_predecessors)
|
||||||
* The 0 makes a 9.8 to 0
|
* The 0 makes a 9.8 to 0
|
||||||
* @param Analog_Predecessors false/true if the last ROI is an analog or digital ROI (default=false)
|
* @param Analog_Predecessors false/true if the last ROI is an analog or digit ROI (default=false)
|
||||||
* runs in special handling because analog is much less precise
|
* runs in special handling because analog is much less precise
|
||||||
* @param digitalAnalogTransitionStart start of the transitionlogic begins on number_of_predecessor (default=9.2)
|
* @param digitAnalogTransitionStart start of the transitionlogic begins on number_of_predecessor (default=9.2)
|
||||||
*
|
*
|
||||||
* @return int the determined number of the current ROI
|
* @return int the determined number of the current ROI
|
||||||
*/
|
*/
|
||||||
int ClassFlowCNNGeneral::PointerEvalHybridNew(float number, float number_of_predecessors, int eval_predecessors, bool Analog_Predecessors, float digitalAnalogTransitionStart) {
|
int ClassFlowCNNGeneral::PointerEvalHybridNew(float number, float number_of_predecessors, int eval_predecessors, bool Analog_Predecessors, float digitAnalogTransitionStart) {
|
||||||
int result;
|
int result;
|
||||||
int result_after_decimal_point = ((int) floor(number * 10)) % 10;
|
int result_after_decimal_point = ((int) floor(number * 10)) % 10;
|
||||||
int result_before_decimal_point = ((int) floor(number) + 10) % 10;
|
int result_before_decimal_point = ((int) floor(number) + 10) % 10;
|
||||||
@@ -155,21 +153,21 @@ int ClassFlowCNNGeneral::PointerEvalHybridNew(float number, float number_of_pred
|
|||||||
result = (int) ((int) trunc(round((number+10 % 10)*100)) ) / 100;
|
result = (int) ((int) trunc(round((number+10 % 10)*100)) ) / 100;
|
||||||
|
|
||||||
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "PointerEvalHybridNew - No predecessor - Result = " + std::to_string(result) +
|
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "PointerEvalHybridNew - No predecessor - Result = " + std::to_string(result) +
|
||||||
" number: " + std::to_string(number) + " number_of_predecessors = " + std::to_string(number_of_predecessors)+ " eval_predecessors = " + std::to_string(eval_predecessors) + " Digital_Uncertainty = " + std::to_string(Digital_Uncertainty));
|
" number: " + std::to_string(number) + " number_of_predecessors = " + std::to_string(number_of_predecessors)+ " eval_predecessors = " + std::to_string(eval_predecessors) + " Digit_Uncertainty = " + std::to_string(Digit_Uncertainty));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Analog_Predecessors) {
|
if (Analog_Predecessors) {
|
||||||
result = PointerEvalAnalogToDigitNew(number, number_of_predecessors, eval_predecessors, digitalAnalogTransitionStart);
|
result = PointerEvalAnalogToDigitNew(number, number_of_predecessors, eval_predecessors, digitAnalogTransitionStart);
|
||||||
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "PointerEvalHybridNew - Analog predecessor, evaluation over PointerEvalAnalogNew = " + std::to_string(result) +
|
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "PointerEvalHybridNew - Analog predecessor, evaluation over PointerEvalAnalogNew = " + std::to_string(result) +
|
||||||
" number: " + std::to_string(number) + " number_of_predecessors = " + std::to_string(number_of_predecessors)+ " eval_predecessors = " + std::to_string(eval_predecessors) + " Digital_Uncertainty = " + std::to_string(Digital_Uncertainty));
|
" number: " + std::to_string(number) + " number_of_predecessors = " + std::to_string(number_of_predecessors)+ " eval_predecessors = " + std::to_string(eval_predecessors) + " Digit_Uncertainty = " + std::to_string(Digit_Uncertainty));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((number_of_predecessors >= Digital_Transition_Area_Predecessor ) && (number_of_predecessors <= (10.0 - Digital_Transition_Area_Predecessor))) {
|
if ((number_of_predecessors >= Digit_Transition_Area_Predecessor ) && (number_of_predecessors <= (10.0 - Digit_Transition_Area_Predecessor))) {
|
||||||
// no digit change, because predecessor is far enough away (0+/-DigitalTransitionRangePredecessor) --> number is rounded
|
// no digit change, because predecessor is far enough away (0+/-DigitTransitionRangePredecessor) --> number is rounded
|
||||||
// Band around the digit --> Round off, as digit reaches inaccuracy in the frame
|
// Band around the digit --> Round off, as digit reaches inaccuracy in the frame
|
||||||
if ((result_after_decimal_point <= DigitalBand) || (result_after_decimal_point >= (10-DigitalBand))) {
|
if ((result_after_decimal_point <= DigitBand) || (result_after_decimal_point >= (10-DigitBand))) {
|
||||||
result = ((int) round(number) + 10) % 10;
|
result = ((int) round(number) + 10) % 10;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -177,7 +175,7 @@ int ClassFlowCNNGeneral::PointerEvalHybridNew(float number, float number_of_pred
|
|||||||
}
|
}
|
||||||
|
|
||||||
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "PointerEvalHybridNew - NO analogue predecessor, no change of digits, as pre-decimal point far enough away = " + std::to_string(result) +
|
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "PointerEvalHybridNew - NO analogue predecessor, no change of digits, as pre-decimal point far enough away = " + std::to_string(result) +
|
||||||
" number: " + std::to_string(number) + " number_of_predecessors = " + std::to_string(number_of_predecessors)+ " eval_predecessors = " + std::to_string(eval_predecessors) + " Digital_Uncertainty = " + std::to_string(Digital_Uncertainty));
|
" number: " + std::to_string(number) + " number_of_predecessors = " + std::to_string(number_of_predecessors)+ " eval_predecessors = " + std::to_string(eval_predecessors) + " Digit_Uncertainty = " + std::to_string(Digit_Uncertainty));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,17 +192,16 @@ int ClassFlowCNNGeneral::PointerEvalHybridNew(float number, float number_of_pred
|
|||||||
result = result_before_decimal_point % 10;
|
result = result_before_decimal_point % 10;
|
||||||
}
|
}
|
||||||
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "PointerEvalHybridNew - NO analogue predecessor, zero crossing has taken placen = " + std::to_string(result) +
|
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "PointerEvalHybridNew - NO analogue predecessor, zero crossing has taken placen = " + std::to_string(result) +
|
||||||
" number: " + std::to_string(number) + " number_of_predecessors = " + std::to_string(number_of_predecessors)+ " eval_predecessors = " + std::to_string(eval_predecessors) + " Digital_Uncertainty = " + std::to_string(Digital_Uncertainty));
|
" number: " + std::to_string(number) + " number_of_predecessors = " + std::to_string(number_of_predecessors)+ " eval_predecessors = " + std::to_string(eval_predecessors) + " Digit_Uncertainty = " + std::to_string(Digit_Uncertainty));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// remains only >= 9.x --> no zero crossing yet --> 2.8 --> 2,
|
// remains only >= 9.x --> no zero crossing yet --> 2.8 --> 2,
|
||||||
// and from 9.7(DigitalTransitionRangeLead) 3.1 --> 2
|
// and from 9.7(DigitTransitionRangeLead) 3.1 --> 2
|
||||||
// everything >=x.4 can be considered as current number in transition. With 9.x predecessor the current
|
// everything >=x.4 can be considered as current number in transition. With 9.x predecessor the current
|
||||||
// number can still be x.6 - x.7.
|
// number can still be x.6 - x.7.
|
||||||
// Preceding (else - branch) does not already happen from 9.
|
// Preceding (else - branch) does not already happen from 9.
|
||||||
if (Digital_Transition_Area_Forward>=number_of_predecessors || result_after_decimal_point >= 4) {
|
if (Digit_Transition_Area_Forward>=number_of_predecessors || result_after_decimal_point >= 4) {
|
||||||
// The current digit, like the previous digit, does not yet have a zero crossing.
|
// The current digit, like the previous digit, does not yet have a zero crossing.
|
||||||
result = result_before_decimal_point % 10;
|
result = result_before_decimal_point % 10;
|
||||||
}
|
}
|
||||||
@@ -215,40 +212,39 @@ int ClassFlowCNNGeneral::PointerEvalHybridNew(float number, float number_of_pred
|
|||||||
}
|
}
|
||||||
|
|
||||||
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "PointerEvalHybridNew - O analogue predecessor, >= 9.5 --> no zero crossing yet = " + std::to_string(result) +
|
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "PointerEvalHybridNew - O analogue predecessor, >= 9.5 --> no zero crossing yet = " + std::to_string(result) +
|
||||||
" number: " + std::to_string(number) + " number_of_predecessors = " + std::to_string(number_of_predecessors)+ " eval_predecessors = " + std::to_string(eval_predecessors) + " Digital_Uncertainty = " + std::to_string(Digital_Uncertainty) + " result_after_decimal_point = " + std::to_string(result_after_decimal_point));
|
" number: " + std::to_string(number) + " number_of_predecessors = " + std::to_string(number_of_predecessors)+ " eval_predecessors = " + std::to_string(eval_predecessors) + " Digit_Uncertainty = " + std::to_string(Digit_Uncertainty) + " result_after_decimal_point = " + std::to_string(result_after_decimal_point));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ClassFlowCNNGeneral::PointerEvalAnalogToDigitNew(float number, float numeral_preceder, int eval_predecessors, float AnalogToDigitTransitionStart) {
|
||||||
int ClassFlowCNNGeneral::PointerEvalAnalogToDigitNew(float number, float numeral_preceder, int eval_predecessors, float analogDigitalTransitionStart) {
|
|
||||||
int result;
|
int result;
|
||||||
int result_after_decimal_point = ((int) floor(number * 10)) % 10;
|
int result_after_decimal_point = ((int) floor(number * 10)) % 10;
|
||||||
int result_before_decimal_point = ((int) floor(number) + 10) % 10;
|
int result_before_decimal_point = ((int) floor(number) + 10) % 10;
|
||||||
bool roundedUp = false;
|
bool roundedUp = false;
|
||||||
|
|
||||||
// Within the digital inequalities
|
// Within the digit inequalities
|
||||||
if ((result_after_decimal_point >= (10-Digital_Uncertainty * 10)) // Band around the digit --> Round off, as digit reaches inaccuracy in the frame
|
if ((result_after_decimal_point >= (10-Digit_Uncertainty * 10)) // Band around the digit --> Round off, as digit reaches inaccuracy in the frame
|
||||||
|| (eval_predecessors <= 4 && result_after_decimal_point>=6)) { // or digit runs after (analogue =0..4, digit >=6)
|
|| (eval_predecessors <= 4 && result_after_decimal_point>=6)) { // or digit runs after (analogue =0..4, digit >=6)
|
||||||
result = (int) (round(number) + 10) % 10;
|
result = (int) (round(number) + 10) % 10;
|
||||||
roundedUp = true;
|
roundedUp = true;
|
||||||
// before/ after decimal point, because we adjust the number based on the uncertainty.
|
// before/ after decimal point, because we adjust the number based on the uncertainty.
|
||||||
result_after_decimal_point = ((int) floor(result * 10)) % 10;
|
result_after_decimal_point = ((int) floor(result * 10)) % 10;
|
||||||
result_before_decimal_point = ((int) floor(result) + 10) % 10;
|
result_before_decimal_point = ((int) floor(result) + 10) % 10;
|
||||||
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "PointerEvalAnalogToDigitNew - Digital Uncertainty - Result = " + std::to_string(result) +
|
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "PointerEvalAnalogToDigitNew - Digit Uncertainty - Result = " + std::to_string(result) +
|
||||||
" number: " + std::to_string(number) + " numeral_preceder: " + std::to_string(numeral_preceder) +
|
" number: " + std::to_string(number) + " numeral_preceder: " + std::to_string(numeral_preceder) +
|
||||||
" erg before comma: " + std::to_string(result_before_decimal_point) +
|
" erg before comma: " + std::to_string(result_before_decimal_point) +
|
||||||
" erg after comma: " + std::to_string(result_after_decimal_point));
|
" erg after comma: " + std::to_string(result_after_decimal_point));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
result = (int) ((int) trunc(number) + 10) % 10;
|
result = (int) ((int) trunc(number) + 10) % 10;
|
||||||
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "PointerEvalAnalogToDigitNew - NO digital Uncertainty - Result = " + std::to_string(result) +
|
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "PointerEvalAnalogToDigitNew - NO digit Uncertainty - Result = " + std::to_string(result) +
|
||||||
" number: " + std::to_string(number) + " numeral_preceder = " + std::to_string(numeral_preceder));
|
" number: " + std::to_string(number) + " numeral_preceder = " + std::to_string(numeral_preceder));
|
||||||
}
|
}
|
||||||
|
|
||||||
// No zero crossing has taken place.
|
// No zero crossing has taken place.
|
||||||
// Only eval_predecessors used because numeral_preceder could be wrong here.
|
// Only eval_predecessors used because numeral_preceder could be wrong here.
|
||||||
// numeral_preceder<=0.1 & eval_predecessors=9 corresponds to analogue was reset because of previous analogue that are not yet at 0.
|
// numeral_preceder<=0.1 & eval_predecessors=9 corresponds to analogue was reset because of previous analogue that are not yet at 0.
|
||||||
if ((eval_predecessors>=6 && (numeral_preceder>analogDigitalTransitionStart || numeral_preceder<=0.2) && roundedUp)) {
|
if ((eval_predecessors>=6 && (numeral_preceder>AnalogToDigitTransitionStart || numeral_preceder<=0.2) && roundedUp)) {
|
||||||
result = ((result_before_decimal_point+10) - 1) % 10;
|
result = ((result_before_decimal_point+10) - 1) % 10;
|
||||||
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "PointerEvalAnalogToDigitNew - Nulldurchgang noch nicht stattgefunden = " + std::to_string(result) +
|
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "PointerEvalAnalogToDigitNew - Nulldurchgang noch nicht stattgefunden = " + std::to_string(result) +
|
||||||
" number: " + std::to_string(number) +
|
" number: " + std::to_string(number) +
|
||||||
@@ -259,7 +255,6 @@ int ClassFlowCNNGeneral::PointerEvalAnalogToDigitNew(float number, float numeral
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int ClassFlowCNNGeneral::PointerEvalAnalogNew(float number, int numeral_preceder) {
|
int ClassFlowCNNGeneral::PointerEvalAnalogNew(float number, int numeral_preceder) {
|
||||||
float number_min, number_max;
|
float number_min, number_max;
|
||||||
int result;
|
int result;
|
||||||
@@ -296,7 +291,6 @@ int ClassFlowCNNGeneral::PointerEvalAnalogNew(float number, int numeral_preceder
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool ClassFlowCNNGeneral::ReadParameter(FILE* pfile, string& aktparamgraph) {
|
bool ClassFlowCNNGeneral::ReadParameter(FILE* pfile, string& aktparamgraph) {
|
||||||
std::vector<string> splitted;
|
std::vector<string> splitted;
|
||||||
|
|
||||||
@@ -322,7 +316,6 @@ bool ClassFlowCNNGeneral::ReadParameter(FILE* pfile, string& aktparamgraph) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
while (this->getNextLine(pfile, &aktparamgraph) && !this->isNewParagraph(aktparamgraph)) {
|
while (this->getNextLine(pfile, &aktparamgraph) && !this->isNewParagraph(aktparamgraph)) {
|
||||||
splitted = ZerlegeZeile(aktparamgraph);
|
splitted = ZerlegeZeile(aktparamgraph);
|
||||||
if ((toUpper(splitted[0]) == "ROIIMAGESLOCATION") && (splitted.size() > 1)) {
|
if ((toUpper(splitted[0]) == "ROIIMAGESLOCATION") && (splitted.size() > 1)) {
|
||||||
@@ -336,16 +329,20 @@ bool ClassFlowCNNGeneral::ReadParameter(FILE* pfile, string& aktparamgraph) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((toUpper(splitted[0]) == "ROIIMAGESRETENTION") && (splitted.size() > 1)) {
|
if ((toUpper(splitted[0]) == "ROIIMAGESRETENTION") && (splitted.size() > 1)) {
|
||||||
|
if (isStringNumeric(splitted[1])) {
|
||||||
this->imagesRetention = std::stoi(splitted[1]);
|
this->imagesRetention = std::stoi(splitted[1]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ((toUpper(splitted[0]) == "MODEL") && (splitted.size() > 1)) {
|
if ((toUpper(splitted[0]) == "MODEL") && (splitted.size() > 1)) {
|
||||||
this->cnnmodelfile = splitted[1];
|
this->cnnmodelfile = splitted[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((toUpper(splitted[0]) == "CNNGOODTHRESHOLD") && (splitted.size() > 1)) {
|
if ((toUpper(splitted[0]) == "CNNGOODTHRESHOLD") && (splitted.size() > 1)) {
|
||||||
|
if (isStringNumeric(splitted[1])) {
|
||||||
CNNGoodThreshold = std::stof(splitted[1]);
|
CNNGoodThreshold = std::stof(splitted[1]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (splitted.size() >= 5) {
|
if (splitted.size() >= 5) {
|
||||||
general* _analog = GetGENERAL(splitted[0], true);
|
general* _analog = GetGENERAL(splitted[0], true);
|
||||||
@@ -366,9 +363,7 @@ bool ClassFlowCNNGeneral::ReadParameter(FILE* pfile, string& aktparamgraph) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((toUpper(splitted[0]) == "SAVEALLFILES") && (splitted.size() > 1)) {
|
if ((toUpper(splitted[0]) == "SAVEALLFILES") && (splitted.size() > 1)) {
|
||||||
if (toUpper(splitted[1]) == "TRUE") {
|
SaveAllFiles = alphanumericToBoolean(splitted[1]);
|
||||||
SaveAllFiles = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -378,7 +373,6 @@ bool ClassFlowCNNGeneral::ReadParameter(FILE* pfile, string& aktparamgraph) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for (int _ana = 0; _ana < GENERAL.size(); ++_ana) {
|
for (int _ana = 0; _ana < GENERAL.size(); ++_ana) {
|
||||||
for (int i = 0; i < GENERAL[_ana]->ROI.size(); ++i) {
|
for (int i = 0; i < GENERAL[_ana]->ROI.size(); ++i) {
|
||||||
GENERAL[_ana]->ROI[i]->image = new CImageBasis("ROI " + GENERAL[_ana]->ROI[i]->name,
|
GENERAL[_ana]->ROI[i]->image = new CImageBasis("ROI " + GENERAL[_ana]->ROI[i]->name,
|
||||||
@@ -391,7 +385,6 @@ bool ClassFlowCNNGeneral::ReadParameter(FILE* pfile, string& aktparamgraph) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
general* ClassFlowCNNGeneral::FindGENERAL(string _name_number) {
|
general* ClassFlowCNNGeneral::FindGENERAL(string _name_number) {
|
||||||
for (int i = 0; i < GENERAL.size(); ++i) {
|
for (int i = 0; i < GENERAL.size(); ++i) {
|
||||||
if (GENERAL[i]->name == _name_number) {
|
if (GENERAL[i]->name == _name_number) {
|
||||||
@@ -402,7 +395,6 @@ general* ClassFlowCNNGeneral::FindGENERAL(string _name_number) {
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
general* ClassFlowCNNGeneral::GetGENERAL(string _name, bool _create = true) {
|
general* ClassFlowCNNGeneral::GetGENERAL(string _name, bool _create = true) {
|
||||||
string _analog, _roi;
|
string _analog, _roi;
|
||||||
int _pospunkt = _name.find_first_of(".");
|
int _pospunkt = _name.find_first_of(".");
|
||||||
@@ -445,7 +437,6 @@ general* ClassFlowCNNGeneral::GetGENERAL(string _name, bool _create = true) {
|
|||||||
return _ret;
|
return _ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string ClassFlowCNNGeneral::getHTMLSingleStep(string host) {
|
string ClassFlowCNNGeneral::getHTMLSingleStep(string host) {
|
||||||
string result, zw;
|
string result, zw;
|
||||||
std::vector<HTMLInfo*> htmlinfo;
|
std::vector<HTMLInfo*> htmlinfo;
|
||||||
@@ -469,7 +460,6 @@ string ClassFlowCNNGeneral::getHTMLSingleStep(string host) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool ClassFlowCNNGeneral::doFlow(string time) {
|
bool ClassFlowCNNGeneral::doFlow(string time) {
|
||||||
#ifdef HEAP_TRACING_CLASS_FLOW_CNN_GENERAL_DO_ALING_AND_CUT
|
#ifdef HEAP_TRACING_CLASS_FLOW_CNN_GENERAL_DO_ALING_AND_CUT
|
||||||
//register a buffer to record the memory trace
|
//register a buffer to record the memory trace
|
||||||
@@ -500,7 +490,6 @@ bool ClassFlowCNNGeneral::doFlow(string time) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool ClassFlowCNNGeneral::doAlignAndCut(string time) {
|
bool ClassFlowCNNGeneral::doAlignAndCut(string time) {
|
||||||
if (disabled) {
|
if (disabled) {
|
||||||
return true;
|
return true;
|
||||||
@@ -537,7 +526,6 @@ bool ClassFlowCNNGeneral::doAlignAndCut(string time) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ClassFlowCNNGeneral::DrawROI(CImageBasis *_zw) {
|
void ClassFlowCNNGeneral::DrawROI(CImageBasis *_zw) {
|
||||||
if (_zw->ImageOkay()) {
|
if (_zw->ImageOkay()) {
|
||||||
if (CNNType == Analogue || CNNType == Analogue100) {
|
if (CNNType == Analogue || CNNType == Analogue100) {
|
||||||
@@ -564,7 +552,6 @@ void ClassFlowCNNGeneral::DrawROI(CImageBasis *_zw) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool ClassFlowCNNGeneral::getNetworkParameter() {
|
bool ClassFlowCNNGeneral::getNetworkParameter() {
|
||||||
if (disabled) {
|
if (disabled) {
|
||||||
return true;
|
return true;
|
||||||
@@ -606,17 +593,17 @@ bool ClassFlowCNNGeneral::getNetworkParameter() {
|
|||||||
ESP_LOGD(TAG, "TFlite-Type set to DoubleHyprid10");
|
ESP_LOGD(TAG, "TFlite-Type set to DoubleHyprid10");
|
||||||
break;
|
break;
|
||||||
case 11:
|
case 11:
|
||||||
CNNType = Digital;
|
CNNType = Digit;
|
||||||
ESP_LOGD(TAG, "TFlite-Type set to Digital");
|
ESP_LOGD(TAG, "TFlite-Type set to Digit");
|
||||||
break;
|
break;
|
||||||
/* case 20:
|
/* case 20:
|
||||||
CNNType = DigitalHyprid10;
|
CNNType = DigitHyprid10;
|
||||||
ESP_LOGD(TAG, "TFlite-Type set to DigitalHyprid10");
|
ESP_LOGD(TAG, "TFlite-Type set to DigitHyprid10");
|
||||||
break;
|
break;
|
||||||
*/
|
*/
|
||||||
// case 22:
|
// case 22:
|
||||||
// CNNType = DigitalHyprid;
|
// CNNType = DigitHyprid;
|
||||||
// ESP_LOGD(TAG, "TFlite-Type set to DigitalHyprid");
|
// ESP_LOGD(TAG, "TFlite-Type set to DigitHyprid");
|
||||||
// break;
|
// break;
|
||||||
case 100:
|
case 100:
|
||||||
if (modelxsize==32 && modelysize == 32) {
|
if (modelxsize==32 && modelysize == 32) {
|
||||||
@@ -624,8 +611,8 @@ bool ClassFlowCNNGeneral::getNetworkParameter() {
|
|||||||
ESP_LOGD(TAG, "TFlite-Type set to Analogue100");
|
ESP_LOGD(TAG, "TFlite-Type set to Analogue100");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
CNNType = Digital100;
|
CNNType = Digit100;
|
||||||
ESP_LOGD(TAG, "TFlite-Type set to Digital");
|
ESP_LOGD(TAG, "TFlite-Type set to Digit");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -637,7 +624,6 @@ bool ClassFlowCNNGeneral::getNetworkParameter() {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool ClassFlowCNNGeneral::doNeuralNetwork(string time) {
|
bool ClassFlowCNNGeneral::doNeuralNetwork(string time) {
|
||||||
if (disabled) {
|
if (disabled) {
|
||||||
return true;
|
return true;
|
||||||
@@ -700,8 +686,8 @@ bool ClassFlowCNNGeneral::doNeuralNetwork(string time) {
|
|||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case Digital:
|
case Digit:
|
||||||
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "CNN Type: Digital");
|
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "CNN Type: Digit");
|
||||||
{
|
{
|
||||||
GENERAL[n]->ROI[roi]->result_klasse = 0;
|
GENERAL[n]->ROI[roi]->result_klasse = 0;
|
||||||
GENERAL[n]->ROI[roi]->result_klasse = tflite->GetClassFromImageBasis(GENERAL[n]->ROI[roi]->image);
|
GENERAL[n]->ROI[roi]->result_klasse = tflite->GetClassFromImageBasis(GENERAL[n]->ROI[roi]->image);
|
||||||
@@ -792,10 +778,10 @@ bool ClassFlowCNNGeneral::doNeuralNetwork(string time) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case Digital100:
|
case Digit100:
|
||||||
case Analogue100:
|
case Analogue100:
|
||||||
{
|
{
|
||||||
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "CNN Type: Digital100 or Analogue100");
|
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "CNN Type: Digit100 or Analogue100");
|
||||||
int _num;
|
int _num;
|
||||||
float _result_save_file;
|
float _result_save_file;
|
||||||
|
|
||||||
@@ -842,16 +828,14 @@ bool ClassFlowCNNGeneral::doNeuralNetwork(string time) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool ClassFlowCNNGeneral::isExtendedResolution(int _number) {
|
bool ClassFlowCNNGeneral::isExtendedResolution(int _number) {
|
||||||
if (CNNType == Digital) {
|
if (CNNType == Digit) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::vector<HTMLInfo*> ClassFlowCNNGeneral::GetHTMLInfo() {
|
std::vector<HTMLInfo*> ClassFlowCNNGeneral::GetHTMLInfo() {
|
||||||
std::vector<HTMLInfo*> result;
|
std::vector<HTMLInfo*> result;
|
||||||
|
|
||||||
@@ -877,7 +861,7 @@ std::vector<HTMLInfo*> ClassFlowCNNGeneral::GetHTMLInfo() {
|
|||||||
zw->filename_org = GENERAL[_ana]->name + "_" + GENERAL[_ana]->ROI[i]->name + ".jpg";
|
zw->filename_org = GENERAL[_ana]->name + "_" + GENERAL[_ana]->ROI[i]->name + ".jpg";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CNNType == Digital) {
|
if (CNNType == Digit) {
|
||||||
zw->val = GENERAL[_ana]->ROI[i]->result_klasse;
|
zw->val = GENERAL[_ana]->ROI[i]->result_klasse;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -894,12 +878,10 @@ std::vector<HTMLInfo*> ClassFlowCNNGeneral::GetHTMLInfo() {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int ClassFlowCNNGeneral::getNumberGENERAL() {
|
int ClassFlowCNNGeneral::getNumberGENERAL() {
|
||||||
return GENERAL.size();
|
return GENERAL.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string ClassFlowCNNGeneral::getNameGENERAL(int _analog) {
|
string ClassFlowCNNGeneral::getNameGENERAL(int _analog) {
|
||||||
if (_analog < GENERAL.size()) {
|
if (_analog < GENERAL.size()) {
|
||||||
return GENERAL[_analog]->name;
|
return GENERAL[_analog]->name;
|
||||||
@@ -908,7 +890,6 @@ string ClassFlowCNNGeneral::getNameGENERAL(int _analog) {
|
|||||||
return "GENERAL DOES NOT EXIST";
|
return "GENERAL DOES NOT EXIST";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
general* ClassFlowCNNGeneral::GetGENERAL(int _analog) {
|
general* ClassFlowCNNGeneral::GetGENERAL(int _analog) {
|
||||||
if (_analog < GENERAL.size()) {
|
if (_analog < GENERAL.size()) {
|
||||||
return GENERAL[_analog];
|
return GENERAL[_analog];
|
||||||
@@ -917,7 +898,6 @@ general* ClassFlowCNNGeneral::GetGENERAL(int _analog) {
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ClassFlowCNNGeneral::UpdateNameNumbers(std::vector<std::string> *_name_numbers) {
|
void ClassFlowCNNGeneral::UpdateNameNumbers(std::vector<std::string> *_name_numbers) {
|
||||||
for (int _dig = 0; _dig < GENERAL.size(); _dig++) {
|
for (int _dig = 0; _dig < GENERAL.size(); _dig++) {
|
||||||
std::string _name = GENERAL[_dig]->name;
|
std::string _name = GENERAL[_dig]->name;
|
||||||
@@ -934,7 +914,6 @@ void ClassFlowCNNGeneral::UpdateNameNumbers(std::vector<std::string> *_name_numb
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string ClassFlowCNNGeneral::getReadoutRawString(int _analog)
|
string ClassFlowCNNGeneral::getReadoutRawString(int _analog)
|
||||||
{
|
{
|
||||||
string rt = "";
|
string rt = "";
|
||||||
@@ -948,7 +927,7 @@ string ClassFlowCNNGeneral::getReadoutRawString(int _analog)
|
|||||||
rt = rt + "," + RundeOutput(GENERAL[_analog]->ROI[i]->result_float, 1);
|
rt = rt + "," + RundeOutput(GENERAL[_analog]->ROI[i]->result_float, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CNNType == Digital) {
|
if (CNNType == Digit) {
|
||||||
if (GENERAL[_analog]->ROI[i]->result_klasse >= 10) {
|
if (GENERAL[_analog]->ROI[i]->result_klasse >= 10) {
|
||||||
rt = rt + ",N";
|
rt = rt + ",N";
|
||||||
}
|
}
|
||||||
@@ -957,10 +936,9 @@ string ClassFlowCNNGeneral::getReadoutRawString(int _analog)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((CNNType == DoubleHyprid10) || (CNNType == Digital100)) {
|
if ((CNNType == DoubleHyprid10) || (CNNType == Digit100)) {
|
||||||
rt = rt + "," + RundeOutput(GENERAL[_analog]->ROI[i]->result_float, 1);
|
rt = rt + "," + RundeOutput(GENERAL[_analog]->ROI[i]->result_float, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return rt;
|
return rt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,10 +11,10 @@ enum t_CNNType {
|
|||||||
AutoDetect,
|
AutoDetect,
|
||||||
Analogue,
|
Analogue,
|
||||||
Analogue100,
|
Analogue100,
|
||||||
Digital,
|
Digit,
|
||||||
DigitalHyprid10,
|
DigitHyprid10,
|
||||||
DoubleHyprid10,
|
DoubleHyprid10,
|
||||||
Digital100,
|
Digit100,
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -26,15 +26,6 @@ protected:
|
|||||||
std::vector<general*> GENERAL;
|
std::vector<general*> GENERAL;
|
||||||
float CNNGoodThreshold;
|
float CNNGoodThreshold;
|
||||||
|
|
||||||
//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;
|
string cnnmodelfile;
|
||||||
int modelxsize, modelysize, modelchannel;
|
int modelxsize, modelysize, modelchannel;
|
||||||
bool isLogImageSelect;
|
bool isLogImageSelect;
|
||||||
@@ -44,8 +35,8 @@ protected:
|
|||||||
bool SaveAllFiles;
|
bool SaveAllFiles;
|
||||||
|
|
||||||
int PointerEvalAnalogNew(float zahl, int numeral_preceder);
|
int PointerEvalAnalogNew(float zahl, int numeral_preceder);
|
||||||
int PointerEvalAnalogToDigitNew(float zahl, float numeral_preceder, int eval_predecessors, float analogDigitalTransitionStart);
|
int PointerEvalAnalogToDigitNew(float zahl, float numeral_preceder, int eval_predecessors, float AnalogToDigitTransitionStart);
|
||||||
int PointerEvalHybridNew(float zahl, float number_of_predecessors, int eval_predecessors, bool Analog_Predecessors = false, float analogDigitalTransitionStart=9.2);
|
int PointerEvalHybridNew(float zahl, float number_of_predecessors, int eval_predecessors, bool Analog_Predecessors = false, float AnalogToDigitTransitionStart=9.2);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -61,7 +52,7 @@ public:
|
|||||||
bool doFlow(string time);
|
bool doFlow(string time);
|
||||||
|
|
||||||
string getHTMLSingleStep(string host);
|
string getHTMLSingleStep(string host);
|
||||||
string getReadout(int _analog, bool _extendedResolution = false, int prev = -1, float _before_narrow_Analog = -1, float analogDigitalTransitionStart=9.2);
|
string getReadout(int _analog, bool _extendedResolution = false, int prev = -1, float _before_narrow_Analog = -1, float AnalogToDigitTransitionStart=9.2);
|
||||||
|
|
||||||
string getReadoutRawString(int _analog);
|
string getReadoutRawString(int _analog);
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ static const char* TAG = "FLOWCTRL";
|
|||||||
|
|
||||||
//#define DEBUG_DETAIL_ON
|
//#define DEBUG_DETAIL_ON
|
||||||
|
|
||||||
|
|
||||||
std::string ClassFlowControll::doSingleStep(std::string _stepname, std::string _host){
|
std::string ClassFlowControll::doSingleStep(std::string _stepname, std::string _host){
|
||||||
std::string _classname = "";
|
std::string _classname = "";
|
||||||
std::string result = "";
|
std::string result = "";
|
||||||
@@ -65,11 +64,19 @@ std::string ClassFlowControll::doSingleStep(std::string _stepname, std::string _
|
|||||||
_classname = "ClassFlowInfluxDBv2";
|
_classname = "ClassFlowInfluxDBv2";
|
||||||
}
|
}
|
||||||
#endif //ENABLE_INFLUXDB
|
#endif //ENABLE_INFLUXDB
|
||||||
|
#ifdef ENABLE_WEBHOOK
|
||||||
|
if ((_stepname.compare("[Webhook]") == 0) || (_stepname.compare(";[Webhook]") == 0)){
|
||||||
|
_classname = "ClassFlowWebhook";
|
||||||
|
}
|
||||||
|
#endif //ENABLE_WEBHOOK
|
||||||
|
|
||||||
for (int i = 0; i < FlowControll.size(); ++i)
|
for (int i = 0; i < FlowControll.size(); ++i)
|
||||||
if (FlowControll[i]->name().compare(_classname) == 0){
|
if (FlowControll[i]->name().compare(_classname) == 0){
|
||||||
if (!(FlowControll[i]->name().compare("ClassFlowTakeImage") == 0)) // if it is a TakeImage, the image does not need to be included, this happens automatically with the html query.
|
if (!(FlowControll[i]->name().compare("ClassFlowTakeImage") == 0)) {
|
||||||
|
// if it is a TakeImage, the image does not need to be included, this happens automatically with the html query.
|
||||||
FlowControll[i]->doFlow("");
|
FlowControll[i]->doFlow("");
|
||||||
|
}
|
||||||
|
|
||||||
result = FlowControll[i]->getHTMLSingleStep(_host);
|
result = FlowControll[i]->getHTMLSingleStep(_host);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,37 +85,51 @@ std::string ClassFlowControll::doSingleStep(std::string _stepname, std::string _
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::string ClassFlowControll::TranslateAktstatus(std::string _input)
|
std::string ClassFlowControll::TranslateAktstatus(std::string _input)
|
||||||
{
|
{
|
||||||
if (_input.compare("ClassFlowTakeImage") == 0)
|
if (_input.compare("ClassFlowTakeImage") == 0) {
|
||||||
return ("Take Image");
|
return ("Take Image");
|
||||||
if (_input.compare("ClassFlowAlignment") == 0)
|
}
|
||||||
|
|
||||||
|
if (_input.compare("ClassFlowAlignment") == 0) {
|
||||||
return ("Aligning");
|
return ("Aligning");
|
||||||
if (_input.compare("ClassFlowCNNGeneral") == 0)
|
}
|
||||||
return ("Digitalization of ROIs");
|
|
||||||
|
if (_input.compare("ClassFlowCNNGeneral") == 0) {
|
||||||
|
return ("Digitization of ROIs");
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_MQTT
|
#ifdef ENABLE_MQTT
|
||||||
if (_input.compare("ClassFlowMQTT") == 0)
|
if (_input.compare("ClassFlowMQTT") == 0) {
|
||||||
return ("Sending MQTT");
|
return ("Sending MQTT");
|
||||||
|
}
|
||||||
#endif //ENABLE_MQTT
|
#endif //ENABLE_MQTT
|
||||||
|
|
||||||
#ifdef ENABLE_INFLUXDB
|
#ifdef ENABLE_INFLUXDB
|
||||||
if (_input.compare("ClassFlowInfluxDB") == 0)
|
if (_input.compare("ClassFlowInfluxDB") == 0) {
|
||||||
return ("Sending InfluxDB");
|
return ("Sending InfluxDB");
|
||||||
if (_input.compare("ClassFlowInfluxDBv2") == 0)
|
}
|
||||||
|
|
||||||
|
if (_input.compare("ClassFlowInfluxDBv2") == 0) {
|
||||||
return ("Sending InfluxDBv2");
|
return ("Sending InfluxDBv2");
|
||||||
|
}
|
||||||
#endif //ENABLE_INFLUXDB
|
#endif //ENABLE_INFLUXDB
|
||||||
if (_input.compare("ClassFlowPostProcessing") == 0)
|
#ifdef ENABLE_WEBHOOK
|
||||||
|
if (_input.compare("ClassFlowWebhook") == 0) {
|
||||||
|
return ("Sending Webhook");
|
||||||
|
}
|
||||||
|
#endif //ENABLE_WEBHOOK
|
||||||
|
if (_input.compare("ClassFlowPostProcessing") == 0) {
|
||||||
return ("Post-Processing");
|
return ("Post-Processing");
|
||||||
|
}
|
||||||
|
|
||||||
return "Unkown Status";
|
return "Unkown Status";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<HTMLInfo*> ClassFlowControll::GetAllDigit()
|
||||||
std::vector<HTMLInfo*> ClassFlowControll::GetAllDigital()
|
|
||||||
{
|
{
|
||||||
if (flowdigit)
|
if (flowdigit) {
|
||||||
{
|
ESP_LOGD(TAG, "ClassFlowControll::GetAllDigit - flowdigit != NULL");
|
||||||
ESP_LOGD(TAG, "ClassFlowControll::GetAllDigital - flowdigit != NULL");
|
|
||||||
return flowdigit->GetHTMLInfo();
|
return flowdigit->GetHTMLInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,51 +137,50 @@ std::vector<HTMLInfo*> ClassFlowControll::GetAllDigital()
|
|||||||
return empty;
|
return empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::vector<HTMLInfo*> ClassFlowControll::GetAllAnalog()
|
std::vector<HTMLInfo*> ClassFlowControll::GetAllAnalog()
|
||||||
{
|
{
|
||||||
if (flowanalog)
|
if (flowanalog) {
|
||||||
return flowanalog->GetHTMLInfo();
|
return flowanalog->GetHTMLInfo();
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<HTMLInfo*> empty;
|
std::vector<HTMLInfo*> empty;
|
||||||
return empty;
|
return empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
t_CNNType ClassFlowControll::GetTypeDigit()
|
||||||
t_CNNType ClassFlowControll::GetTypeDigital()
|
|
||||||
{
|
{
|
||||||
if (flowdigit)
|
if (flowdigit) {
|
||||||
return flowdigit->getCNNType();
|
return flowdigit->getCNNType();
|
||||||
|
}
|
||||||
|
|
||||||
return t_CNNType::None;
|
return t_CNNType::None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
t_CNNType ClassFlowControll::GetTypeAnalog()
|
t_CNNType ClassFlowControll::GetTypeAnalog()
|
||||||
{
|
{
|
||||||
if (flowanalog)
|
if (flowanalog) {
|
||||||
return flowanalog->getCNNType();
|
return flowanalog->getCNNType();
|
||||||
|
}
|
||||||
|
|
||||||
return t_CNNType::None;
|
return t_CNNType::None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef ALGROI_LOAD_FROM_MEM_AS_JPG
|
#ifdef ALGROI_LOAD_FROM_MEM_AS_JPG
|
||||||
void ClassFlowControll::DigitalDrawROI(CImageBasis *_zw)
|
void ClassFlowControll::DigitDrawROI(CImageBasis *_zw)
|
||||||
{
|
{
|
||||||
if (flowdigit)
|
if (flowdigit) {
|
||||||
flowdigit->DrawROI(_zw);
|
flowdigit->DrawROI(_zw);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ClassFlowControll::AnalogDrawROI(CImageBasis *_zw)
|
void ClassFlowControll::AnalogDrawROI(CImageBasis *_zw)
|
||||||
{
|
{
|
||||||
if (flowanalog)
|
if (flowanalog) {
|
||||||
flowanalog->DrawROI(_zw);
|
flowanalog->DrawROI(_zw);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef ENABLE_MQTT
|
#ifdef ENABLE_MQTT
|
||||||
bool ClassFlowControll::StartMQTTService()
|
bool ClassFlowControll::StartMQTTService()
|
||||||
{
|
{
|
||||||
@@ -174,7 +194,6 @@ bool ClassFlowControll::StartMQTTService()
|
|||||||
}
|
}
|
||||||
#endif //ENABLE_MQTT
|
#endif //ENABLE_MQTT
|
||||||
|
|
||||||
|
|
||||||
void ClassFlowControll::SetInitialParameter(void)
|
void ClassFlowControll::SetInitialParameter(void)
|
||||||
{
|
{
|
||||||
AutoStart = false;
|
AutoStart = false;
|
||||||
@@ -189,7 +208,6 @@ void ClassFlowControll::SetInitialParameter(void)
|
|||||||
aktstatusWithTime = aktstatus;
|
aktstatusWithTime = aktstatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool ClassFlowControll::getIsAutoStart(void)
|
bool ClassFlowControll::getIsAutoStart(void)
|
||||||
{
|
{
|
||||||
return AutoStart;
|
return AutoStart;
|
||||||
@@ -201,69 +219,81 @@ void ClassFlowControll::setAutoStartInterval(long &_interval)
|
|||||||
_interval = AutoInterval * 60 * 1000; // AutoInterval: minutes -> ms
|
_interval = AutoInterval * 60 * 1000; // AutoInterval: minutes -> ms
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ClassFlow* ClassFlowControll::CreateClassFlow(std::string _type)
|
ClassFlow* ClassFlowControll::CreateClassFlow(std::string _type)
|
||||||
{
|
{
|
||||||
ClassFlow* cfc = NULL;
|
ClassFlow* cfc = NULL;
|
||||||
|
|
||||||
_type = trim(_type);
|
_type = trim(_type);
|
||||||
|
|
||||||
if (toUpper(_type).compare("[TAKEIMAGE]") == 0)
|
if (toUpper(_type).compare("[TAKEIMAGE]") == 0) {
|
||||||
{
|
|
||||||
cfc = new ClassFlowTakeImage(&FlowControll);
|
cfc = new ClassFlowTakeImage(&FlowControll);
|
||||||
flowtakeimage = (ClassFlowTakeImage*) cfc;
|
flowtakeimage = (ClassFlowTakeImage*) cfc;
|
||||||
}
|
}
|
||||||
if (toUpper(_type).compare("[ALIGNMENT]") == 0)
|
|
||||||
{
|
if (toUpper(_type).compare("[ALIGNMENT]") == 0) {
|
||||||
cfc = new ClassFlowAlignment(&FlowControll);
|
cfc = new ClassFlowAlignment(&FlowControll);
|
||||||
flowalignment = (ClassFlowAlignment*) cfc;
|
flowalignment = (ClassFlowAlignment*) cfc;
|
||||||
}
|
}
|
||||||
if (toUpper(_type).compare("[ANALOG]") == 0)
|
|
||||||
{
|
if (toUpper(_type).compare("[ANALOG]") == 0) {
|
||||||
cfc = new ClassFlowCNNGeneral(flowalignment);
|
cfc = new ClassFlowCNNGeneral(flowalignment);
|
||||||
flowanalog = (ClassFlowCNNGeneral*) cfc;
|
flowanalog = (ClassFlowCNNGeneral*) cfc;
|
||||||
}
|
}
|
||||||
if (toUpper(_type).compare(0, 7, "[DIGITS") == 0)
|
|
||||||
{
|
if (toUpper(_type).compare(0, 7, "[DIGITS") == 0) {
|
||||||
cfc = new ClassFlowCNNGeneral(flowalignment);
|
cfc = new ClassFlowCNNGeneral(flowalignment);
|
||||||
flowdigit = (ClassFlowCNNGeneral*) cfc;
|
flowdigit = (ClassFlowCNNGeneral*) cfc;
|
||||||
}
|
}
|
||||||
#ifdef ENABLE_MQTT
|
|
||||||
if (toUpper(_type).compare("[MQTT]") == 0)
|
|
||||||
cfc = new ClassFlowMQTT(&FlowControll);
|
|
||||||
#endif //ENABLE_MQTT
|
|
||||||
#ifdef ENABLE_INFLUXDB
|
|
||||||
if (toUpper(_type).compare("[INFLUXDB]") == 0)
|
|
||||||
cfc = new ClassFlowInfluxDB(&FlowControll);
|
|
||||||
if (toUpper(_type).compare("[INFLUXDBV2]") == 0)
|
|
||||||
cfc = new ClassFlowInfluxDBv2(&FlowControll);
|
|
||||||
#endif //ENABLE_INFLUXDB
|
|
||||||
|
|
||||||
if (toUpper(_type).compare("[POSTPROCESSING]") == 0)
|
#ifdef ENABLE_MQTT
|
||||||
{
|
if (toUpper(_type).compare("[MQTT]") == 0) {
|
||||||
|
cfc = new ClassFlowMQTT(&FlowControll);
|
||||||
|
}
|
||||||
|
#endif //ENABLE_MQTT
|
||||||
|
|
||||||
|
#ifdef ENABLE_INFLUXDB
|
||||||
|
if (toUpper(_type).compare("[INFLUXDB]") == 0) {
|
||||||
|
cfc = new ClassFlowInfluxDB(&FlowControll);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (toUpper(_type).compare("[INFLUXDBV2]") == 0) {
|
||||||
|
cfc = new ClassFlowInfluxDBv2(&FlowControll);
|
||||||
|
}
|
||||||
|
#endif //ENABLE_INFLUXDB
|
||||||
|
#ifdef ENABLE_WEBHOOK
|
||||||
|
if (toUpper(_type).compare("[WEBHOOK]") == 0)
|
||||||
|
cfc = new ClassFlowWebhook(&FlowControll);
|
||||||
|
#endif //ENABLE_WEBHOOK
|
||||||
|
|
||||||
|
if (toUpper(_type).compare("[POSTPROCESSING]") == 0) {
|
||||||
cfc = new ClassFlowPostProcessing(&FlowControll, flowanalog, flowdigit);
|
cfc = new ClassFlowPostProcessing(&FlowControll, flowanalog, flowdigit);
|
||||||
flowpostprocessing = (ClassFlowPostProcessing*) cfc;
|
flowpostprocessing = (ClassFlowPostProcessing*) cfc;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cfc) // Attached only if it is not [AutoTimer], because this is for FlowControll
|
if (cfc) {
|
||||||
|
// Attached only if it is not [AutoTimer], because this is for FlowControll
|
||||||
FlowControll.push_back(cfc);
|
FlowControll.push_back(cfc);
|
||||||
|
}
|
||||||
|
|
||||||
if (toUpper(_type).compare("[AUTOTIMER]") == 0)
|
if (toUpper(_type).compare("[AUTOTIMER]") == 0) {
|
||||||
cfc = this;
|
cfc = this;
|
||||||
|
}
|
||||||
|
|
||||||
if (toUpper(_type).compare("[DATALOGGING]") == 0)
|
if (toUpper(_type).compare("[DATALOGGING]") == 0) {
|
||||||
cfc = this;
|
cfc = this;
|
||||||
|
}
|
||||||
|
|
||||||
if (toUpper(_type).compare("[DEBUG]") == 0)
|
if (toUpper(_type).compare("[DEBUG]") == 0) {
|
||||||
cfc = this;
|
cfc = this;
|
||||||
|
}
|
||||||
|
|
||||||
if (toUpper(_type).compare("[SYSTEM]") == 0)
|
if (toUpper(_type).compare("[SYSTEM]") == 0) {
|
||||||
cfc = this;
|
cfc = this;
|
||||||
|
}
|
||||||
|
|
||||||
return cfc;
|
return cfc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ClassFlowControll::InitFlow(std::string config)
|
void ClassFlowControll::InitFlow(std::string config)
|
||||||
{
|
{
|
||||||
aktstatus = "Initialization";
|
aktstatus = "Initialization";
|
||||||
@@ -284,27 +314,25 @@ void ClassFlowControll::InitFlow(std::string config)
|
|||||||
line = "";
|
line = "";
|
||||||
|
|
||||||
char zw[1024];
|
char zw[1024];
|
||||||
if (pFile != NULL)
|
|
||||||
{
|
if (pFile != NULL) {
|
||||||
fgets(zw, 1024, pFile);
|
fgets(zw, 1024, pFile);
|
||||||
ESP_LOGD(TAG, "%s", zw);
|
ESP_LOGD(TAG, "%s", zw);
|
||||||
line = std::string(zw);
|
line = std::string(zw);
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((line.size() > 0) && !(feof(pFile)))
|
while ((line.size() > 0) && !(feof(pFile))) {
|
||||||
{
|
|
||||||
cfc = CreateClassFlow(line);
|
cfc = CreateClassFlow(line);
|
||||||
// printf("Name: %s\n", cfc->name().c_str());
|
// printf("Name: %s\n", cfc->name().c_str());
|
||||||
if (cfc)
|
|
||||||
{
|
if (cfc) {
|
||||||
ESP_LOGD(TAG, "Start ReadParameter (%s)", line.c_str());
|
ESP_LOGE(TAG, "Start ReadParameter (%s)", line.c_str());
|
||||||
cfc->ReadParameter(pFile, line);
|
cfc->ReadParameter(pFile, line);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
line = "";
|
line = "";
|
||||||
if (fgets(zw, 1024, pFile) && !feof(pFile))
|
|
||||||
{
|
if (fgets(zw, 1024, pFile) && !feof(pFile)) {
|
||||||
ESP_LOGD(TAG, "Read: %s", zw);
|
ESP_LOGD(TAG, "Read: %s", zw);
|
||||||
line = std::string(zw);
|
line = std::string(zw);
|
||||||
}
|
}
|
||||||
@@ -314,32 +342,27 @@ void ClassFlowControll::InitFlow(std::string config)
|
|||||||
fclose(pFile);
|
fclose(pFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::string* ClassFlowControll::getActStatusWithTime()
|
std::string* ClassFlowControll::getActStatusWithTime()
|
||||||
{
|
{
|
||||||
return &aktstatusWithTime;
|
return &aktstatusWithTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::string* ClassFlowControll::getActStatus()
|
std::string* ClassFlowControll::getActStatus()
|
||||||
{
|
{
|
||||||
return &aktstatus;
|
return &aktstatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ClassFlowControll::setActStatus(std::string _aktstatus)
|
void ClassFlowControll::setActStatus(std::string _aktstatus)
|
||||||
{
|
{
|
||||||
aktstatus = _aktstatus;
|
aktstatus = _aktstatus;
|
||||||
aktstatusWithTime = aktstatus;
|
aktstatusWithTime = aktstatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ClassFlowControll::doFlowTakeImageOnly(string time)
|
void ClassFlowControll::doFlowTakeImageOnly(string time)
|
||||||
{
|
{
|
||||||
std::string zw_time;
|
std::string zw_time;
|
||||||
|
|
||||||
for (int i = 0; i < FlowControll.size(); ++i)
|
for (int i = 0; i < FlowControll.size(); ++i) {
|
||||||
{
|
|
||||||
if (FlowControll[i]->name() == "ClassFlowTakeImage") {
|
if (FlowControll[i]->name() == "ClassFlowTakeImage") {
|
||||||
zw_time = getCurrentTimeString("%H:%M:%S");
|
zw_time = getCurrentTimeString("%H:%M:%S");
|
||||||
aktstatus = TranslateAktstatus(FlowControll[i]->name());
|
aktstatus = TranslateAktstatus(FlowControll[i]->name());
|
||||||
@@ -353,7 +376,6 @@ void ClassFlowControll::doFlowTakeImageOnly(string time)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool ClassFlowControll::doFlow(string time)
|
bool ClassFlowControll::doFlow(string time)
|
||||||
{
|
{
|
||||||
bool result = true;
|
bool result = true;
|
||||||
@@ -373,8 +395,7 @@ bool ClassFlowControll::doFlow(string time)
|
|||||||
|
|
||||||
//checkNtpStatus(0);
|
//checkNtpStatus(0);
|
||||||
|
|
||||||
for (int i = 0; i < FlowControll.size(); ++i)
|
for (int i = 0; i < FlowControll.size(); ++i) {
|
||||||
{
|
|
||||||
zw_time = getCurrentTimeString("%H:%M:%S");
|
zw_time = getCurrentTimeString("%H:%M:%S");
|
||||||
aktstatus = TranslateAktstatus(FlowControll[i]->name());
|
aktstatus = TranslateAktstatus(FlowControll[i]->name());
|
||||||
aktstatusWithTime = aktstatus + " (" + zw_time + ")";
|
aktstatusWithTime = aktstatus + " (" + zw_time + ")";
|
||||||
@@ -391,7 +412,7 @@ bool ClassFlowControll::doFlow(string time)
|
|||||||
if (!FlowControll[i]->doFlow(time)){
|
if (!FlowControll[i]->doFlow(time)){
|
||||||
repeat++;
|
repeat++;
|
||||||
LogFile.WriteToFile(ESP_LOG_WARN, TAG, "Fehler im vorheriger Schritt - wird zum " + to_string(repeat) + ". Mal wiederholt");
|
LogFile.WriteToFile(ESP_LOG_WARN, TAG, "Fehler im vorheriger Schritt - wird zum " + to_string(repeat) + ". Mal wiederholt");
|
||||||
if (i) i -= 1; // vPrevious step must be repeated (probably take pictures)
|
if (i) { i -= 1; } // vPrevious step must be repeated (probably take pictures)
|
||||||
result = false;
|
result = false;
|
||||||
if (repeat > 5) {
|
if (repeat > 5) {
|
||||||
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Wiederholung 5x nicht erfolgreich --> reboot");
|
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Wiederholung 5x nicht erfolgreich --> reboot");
|
||||||
@@ -399,8 +420,7 @@ bool ClassFlowControll::doFlow(string time)
|
|||||||
//Step was repeated 5x --> reboot
|
//Step was repeated 5x --> reboot
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -424,27 +444,29 @@ bool ClassFlowControll::doFlow(string time)
|
|||||||
string ClassFlowControll::getReadoutAll(int _type)
|
string ClassFlowControll::getReadoutAll(int _type)
|
||||||
{
|
{
|
||||||
std::string out = "";
|
std::string out = "";
|
||||||
if (flowpostprocessing)
|
|
||||||
{
|
if (flowpostprocessing) {
|
||||||
std::vector<NumberPost*> *numbers = flowpostprocessing->GetNumbers();
|
std::vector<NumberPost*> *numbers = flowpostprocessing->GetNumbers();
|
||||||
|
|
||||||
for (int i = 0; i < (*numbers).size(); ++i)
|
for (int i = 0; i < (*numbers).size(); ++i) {
|
||||||
{
|
|
||||||
out = out + (*numbers)[i]->name + "\t";
|
out = out + (*numbers)[i]->name + "\t";
|
||||||
|
|
||||||
switch (_type) {
|
switch (_type) {
|
||||||
case READOUT_TYPE_VALUE:
|
case READOUT_TYPE_VALUE:
|
||||||
out = out + (*numbers)[i]->ReturnValue;
|
out = out + (*numbers)[i]->ReturnValue;
|
||||||
break;
|
break;
|
||||||
case READOUT_TYPE_PREVALUE:
|
case READOUT_TYPE_PREVALUE:
|
||||||
if (flowpostprocessing->PreValueUse)
|
if (flowpostprocessing->PreValueUse) {
|
||||||
{
|
if ((*numbers)[i]->PreValueOkay) {
|
||||||
if ((*numbers)[i]->PreValueOkay)
|
|
||||||
out = out + (*numbers)[i]->ReturnPreValue;
|
out = out + (*numbers)[i]->ReturnPreValue;
|
||||||
else
|
}
|
||||||
|
else {
|
||||||
out = out + "PreValue too old";
|
out = out + "PreValue too old";
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
|
else {
|
||||||
out = out + "PreValue deactivated";
|
out = out + "PreValue deactivated";
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case READOUT_TYPE_RAWVALUE:
|
case READOUT_TYPE_RAWVALUE:
|
||||||
out = out + (*numbers)[i]->ReturnRawValue;
|
out = out + (*numbers)[i]->ReturnRawValue;
|
||||||
@@ -453,51 +475,34 @@ string ClassFlowControll::getReadoutAll(int _type)
|
|||||||
out = out + (*numbers)[i]->ErrorMessageText;
|
out = out + (*numbers)[i]->ErrorMessageText;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (i < (*numbers).size()-1)
|
|
||||||
|
if (i < (*numbers).size()-1) {
|
||||||
out = out + "\r\n";
|
out = out + "\r\n";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// ESP_LOGD(TAG, "OUT: %s", out.c_str());
|
// ESP_LOGD(TAG, "OUT: %s", out.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string ClassFlowControll::getReadout(bool _rawvalue = false, bool _noerror = false, int _number = 0)
|
string ClassFlowControll::getReadout(bool _rawvalue = false, bool _noerror = false, int _number = 0)
|
||||||
{
|
{
|
||||||
if (flowpostprocessing)
|
if (flowpostprocessing) {
|
||||||
return flowpostprocessing->getReadoutParam(_rawvalue, _noerror, _number);
|
return flowpostprocessing->getReadoutParam(_rawvalue, _noerror, _number);
|
||||||
|
|
||||||
string zw = "";
|
|
||||||
string result = "";
|
|
||||||
|
|
||||||
for (int i = 0; i < FlowControll.size(); ++i)
|
|
||||||
{
|
|
||||||
zw = FlowControll[i]->getReadout();
|
|
||||||
if (zw.length() > 0)
|
|
||||||
{
|
|
||||||
if (result.length() == 0)
|
|
||||||
result = zw;
|
|
||||||
else
|
|
||||||
result = result + "\t" + zw;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
string ClassFlowControll::GetPrevalue(std::string _number)
|
|
||||||
{
|
|
||||||
if (flowpostprocessing)
|
|
||||||
{
|
|
||||||
return flowpostprocessing->GetPreValue(_number);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return std::string("");
|
return std::string("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string ClassFlowControll::GetPrevalue(std::string _number)
|
||||||
|
{
|
||||||
|
if (flowpostprocessing) {
|
||||||
|
return flowpostprocessing->GetPreValue(_number);
|
||||||
|
}
|
||||||
|
|
||||||
|
return std::string("");
|
||||||
|
}
|
||||||
|
|
||||||
bool ClassFlowControll::UpdatePrevalue(std::string _newvalue, std::string _numbers, bool _extern)
|
bool ClassFlowControll::UpdatePrevalue(std::string _newvalue, std::string _numbers, bool _extern)
|
||||||
{
|
{
|
||||||
@@ -519,104 +524,98 @@ bool ClassFlowControll::UpdatePrevalue(std::string _newvalue, std::string _numbe
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (flowpostprocessing) {
|
if (flowpostprocessing) {
|
||||||
if (flowpostprocessing->SetPreValue(newvalueAsDouble, _numbers, _extern))
|
if (flowpostprocessing->SetPreValue(newvalueAsDouble, _numbers, _extern)) {
|
||||||
return true;
|
return true;
|
||||||
else
|
}
|
||||||
|
else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "UpdatePrevalue: ERROR - Class Post-Processing not initialized");
|
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "UpdatePrevalue: ERROR - Class Post-Processing not initialized");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool ClassFlowControll::ReadParameter(FILE* pfile, string& aktparamgraph)
|
bool ClassFlowControll::ReadParameter(FILE* pfile, string& aktparamgraph)
|
||||||
{
|
{
|
||||||
std::vector<string> splitted;
|
std::vector<string> splitted;
|
||||||
|
|
||||||
aktparamgraph = trim(aktparamgraph);
|
aktparamgraph = trim(aktparamgraph);
|
||||||
|
|
||||||
if (aktparamgraph.size() == 0)
|
if (aktparamgraph.size() == 0) {
|
||||||
if (!this->GetNextParagraph(pfile, aktparamgraph))
|
if (!this->GetNextParagraph(pfile, aktparamgraph)) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ((toUpper(aktparamgraph).compare("[AUTOTIMER]") != 0) && (toUpper(aktparamgraph).compare("[DEBUG]") != 0) &&
|
if ((toUpper(aktparamgraph).compare("[AUTOTIMER]") != 0) && (toUpper(aktparamgraph).compare("[DEBUG]") != 0) &&
|
||||||
(toUpper(aktparamgraph).compare("[SYSTEM]") != 0 && (toUpper(aktparamgraph).compare("[DATALOGGING]") != 0))) // Paragraph passt nicht zu Debug oder DataLogging
|
(toUpper(aktparamgraph).compare("[SYSTEM]") != 0 && (toUpper(aktparamgraph).compare("[DATALOGGING]") != 0))) {
|
||||||
|
// Paragraph passt nicht zu Debug oder DataLogging
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
while (this->getNextLine(pfile, &aktparamgraph) && !this->isNewParagraph(aktparamgraph))
|
while (this->getNextLine(pfile, &aktparamgraph) && !this->isNewParagraph(aktparamgraph)) {
|
||||||
{
|
|
||||||
splitted = ZerlegeZeile(aktparamgraph, " =");
|
splitted = ZerlegeZeile(aktparamgraph, " =");
|
||||||
if ((toUpper(splitted[0]) == "AUTOSTART") && (splitted.size() > 1))
|
|
||||||
{
|
if ((toUpper(splitted[0]) == "AUTOSTART") && (splitted.size() > 1)) {
|
||||||
if (toUpper(splitted[1]) == "TRUE")
|
AutoStart = alphanumericToBoolean(splitted[1]);
|
||||||
{
|
|
||||||
AutoStart = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((toUpper(splitted[0]) == "INTERVAL") && (splitted.size() > 1))
|
if ((toUpper(splitted[0]) == "INTERVAL") && (splitted.size() > 1)) {
|
||||||
|
if (isStringNumeric(splitted[1]))
|
||||||
{
|
{
|
||||||
AutoInterval = std::stof(splitted[1]);
|
AutoInterval = std::stof(splitted[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((toUpper(splitted[0]) == "DATALOGACTIVE") && (splitted.size() > 1))
|
|
||||||
{
|
|
||||||
if (toUpper(splitted[1]) == "TRUE")
|
|
||||||
{
|
|
||||||
LogFile.SetDataLogToSD(true);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
LogFile.SetDataLogToSD(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((toUpper(splitted[0]) == "DATAFILESRETENTION") && (splitted.size() > 1))
|
if ((toUpper(splitted[0]) == "DATALOGACTIVE") && (splitted.size() > 1)) {
|
||||||
|
LogFile.SetDataLogToSD(alphanumericToBoolean(splitted[1]));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((toUpper(splitted[0]) == "DATAFILESRETENTION") && (splitted.size() > 1)) {
|
||||||
|
if (isStringNumeric(splitted[1]))
|
||||||
{
|
{
|
||||||
LogFile.SetDataLogRetention(std::stoi(splitted[1]));
|
LogFile.SetDataLogRetention(std::stoi(splitted[1]));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ((toUpper(splitted[0]) == "LOGLEVEL") && (splitted.size() > 1))
|
if ((toUpper(splitted[0]) == "LOGLEVEL") && (splitted.size() > 1)) {
|
||||||
{
|
|
||||||
/* matches esp_log_level_t */
|
/* matches esp_log_level_t */
|
||||||
if ((toUpper(splitted[1]) == "TRUE") || (toUpper(splitted[1]) == "2"))
|
if ((toUpper(splitted[1]) == "TRUE") || (toUpper(splitted[1]) == "2")) {
|
||||||
{
|
|
||||||
LogFile.setLogLevel(ESP_LOG_WARN);
|
LogFile.setLogLevel(ESP_LOG_WARN);
|
||||||
}
|
}
|
||||||
else if ((toUpper(splitted[1]) == "FALSE") || (toUpper(splitted[1]) == "0") || (toUpper(splitted[1]) == "1"))
|
else if ((toUpper(splitted[1]) == "FALSE") || (toUpper(splitted[1]) == "0") || (toUpper(splitted[1]) == "1")) {
|
||||||
{
|
|
||||||
LogFile.setLogLevel(ESP_LOG_ERROR);
|
LogFile.setLogLevel(ESP_LOG_ERROR);
|
||||||
}
|
}
|
||||||
else if (toUpper(splitted[1]) == "3")
|
else if (toUpper(splitted[1]) == "3") {
|
||||||
{
|
|
||||||
LogFile.setLogLevel(ESP_LOG_INFO);
|
LogFile.setLogLevel(ESP_LOG_INFO);
|
||||||
}
|
}
|
||||||
else if (toUpper(splitted[1]) == "4")
|
else if (toUpper(splitted[1]) == "4") {
|
||||||
{
|
|
||||||
LogFile.setLogLevel(ESP_LOG_DEBUG);
|
LogFile.setLogLevel(ESP_LOG_DEBUG);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If system reboot was not triggered by user and reboot was caused by execption -> keep log level to DEBUG */
|
/* If system reboot was not triggered by user and reboot was caused by execption -> keep log level to DEBUG */
|
||||||
if (!getIsPlannedReboot() && (esp_reset_reason() == ESP_RST_PANIC))
|
if (!getIsPlannedReboot() && (esp_reset_reason() == ESP_RST_PANIC)) {
|
||||||
LogFile.setLogLevel(ESP_LOG_DEBUG);
|
LogFile.setLogLevel(ESP_LOG_DEBUG);
|
||||||
}
|
}
|
||||||
if ((toUpper(splitted[0]) == "LOGFILESRETENTION") && (splitted.size() > 1))
|
}
|
||||||
|
|
||||||
|
if ((toUpper(splitted[0]) == "LOGFILESRETENTION") && (splitted.size() > 1)) {
|
||||||
|
if (isStringNumeric(splitted[1]))
|
||||||
{
|
{
|
||||||
LogFile.SetLogFileRetention(std::stoi(splitted[1]));
|
LogFile.SetLogFileRetention(std::stoi(splitted[1]));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* TimeServer and TimeZone got already read from the config, see setupTime () */
|
/* TimeServer and TimeZone got already read from the config, see setupTime () */
|
||||||
|
|
||||||
#if (defined WLAN_USE_ROAMING_BY_SCANNING || (defined WLAN_USE_MESH_ROAMING && defined WLAN_USE_MESH_ROAMING_ACTIVATE_CLIENT_TRIGGERED_QUERIES))
|
#if (defined WLAN_USE_ROAMING_BY_SCANNING || (defined WLAN_USE_MESH_ROAMING && defined WLAN_USE_MESH_ROAMING_ACTIVATE_CLIENT_TRIGGERED_QUERIES))
|
||||||
if ((toUpper(splitted[0]) == "RSSITHRESHOLD") && (splitted.size() > 1))
|
if ((toUpper(splitted[0]) == "RSSITHRESHOLD") && (splitted.size() > 1)) {
|
||||||
{
|
|
||||||
int RSSIThresholdTMP = atoi(splitted[1].c_str());
|
int RSSIThresholdTMP = atoi(splitted[1].c_str());
|
||||||
RSSIThresholdTMP = min(0, max(-100, RSSIThresholdTMP)); // Verify input limits (-100 - 0)
|
RSSIThresholdTMP = min(0, max(-100, RSSIThresholdTMP)); // Verify input limits (-100 - 0)
|
||||||
|
|
||||||
if (ChangeRSSIThreshold(WLAN_CONFIG_FILE, RSSIThresholdTMP))
|
if (ChangeRSSIThreshold(WLAN_CONFIG_FILE, RSSIThresholdTMP)) {
|
||||||
{
|
|
||||||
// reboot necessary so that the new wlan.ini is also used !!!
|
// reboot necessary so that the new wlan.ini is also used !!!
|
||||||
fclose(pfile);
|
fclose(pfile);
|
||||||
LogFile.WriteToFile(ESP_LOG_WARN, TAG, "Rebooting to activate new RSSITHRESHOLD ...");
|
LogFile.WriteToFile(ESP_LOG_WARN, TAG, "Rebooting to activate new RSSITHRESHOLD ...");
|
||||||
@@ -625,10 +624,8 @@ bool ClassFlowControll::ReadParameter(FILE* pfile, string& aktparamgraph)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ((toUpper(splitted[0]) == "HOSTNAME") && (splitted.size() > 1))
|
if ((toUpper(splitted[0]) == "HOSTNAME") && (splitted.size() > 1)) {
|
||||||
{
|
if (ChangeHostName(WLAN_CONFIG_FILE, splitted[1])) {
|
||||||
if (ChangeHostName(WLAN_CONFIG_FILE, splitted[1]))
|
|
||||||
{
|
|
||||||
// reboot necessary so that the new wlan.ini is also used !!!
|
// reboot necessary so that the new wlan.ini is also used !!!
|
||||||
fclose(pfile);
|
fclose(pfile);
|
||||||
LogFile.WriteToFile(ESP_LOG_WARN, TAG, "Rebooting to activate new HOSTNAME...");
|
LogFile.WriteToFile(ESP_LOG_WARN, TAG, "Rebooting to activate new HOSTNAME...");
|
||||||
@@ -636,23 +633,19 @@ bool ClassFlowControll::ReadParameter(FILE* pfile, string& aktparamgraph)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((toUpper(splitted[0]) == "SETUPMODE") && (splitted.size() > 1))
|
if ((toUpper(splitted[0]) == "SETUPMODE") && (splitted.size() > 1)) {
|
||||||
{
|
SetupModeActive = alphanumericToBoolean(splitted[1]);
|
||||||
if (toUpper(splitted[1]) == "TRUE")
|
|
||||||
{
|
|
||||||
SetupModeActive = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int ClassFlowControll::CleanTempFolder() {
|
int ClassFlowControll::CleanTempFolder() {
|
||||||
const char* folderPath = "/sdcard/img_tmp";
|
const char* folderPath = "/sdcard/img_tmp";
|
||||||
|
|
||||||
ESP_LOGD(TAG, "Clean up temporary folder to avoid damage of sdcard sectors: %s", folderPath);
|
ESP_LOGD(TAG, "Clean up temporary folder to avoid damage of sdcard sectors: %s", folderPath);
|
||||||
DIR *dir = opendir(folderPath);
|
DIR *dir = opendir(folderPath);
|
||||||
|
|
||||||
if (!dir) {
|
if (!dir) {
|
||||||
ESP_LOGE(TAG, "Failed to stat dir: %s", folderPath);
|
ESP_LOGE(TAG, "Failed to stat dir: %s", folderPath);
|
||||||
return -1;
|
return -1;
|
||||||
@@ -660,31 +653,33 @@ int ClassFlowControll::CleanTempFolder() {
|
|||||||
|
|
||||||
struct dirent *entry;
|
struct dirent *entry;
|
||||||
int deleted = 0;
|
int deleted = 0;
|
||||||
|
|
||||||
while ((entry = readdir(dir)) != NULL) {
|
while ((entry = readdir(dir)) != NULL) {
|
||||||
std::string path = string(folderPath) + "/" + entry->d_name;
|
std::string path = string(folderPath) + "/" + entry->d_name;
|
||||||
if (entry->d_type == DT_REG) {
|
if (entry->d_type == DT_REG) {
|
||||||
if (unlink(path.c_str()) == 0) {
|
if (unlink(path.c_str()) == 0) {
|
||||||
deleted ++;
|
deleted ++;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
ESP_LOGE(TAG, "can't delete file: %s", path.c_str());
|
ESP_LOGE(TAG, "can't delete file: %s", path.c_str());
|
||||||
}
|
}
|
||||||
} else if (entry->d_type == DT_DIR) {
|
}
|
||||||
|
else if (entry->d_type == DT_DIR) {
|
||||||
deleted += removeFolder(path.c_str(), TAG);
|
deleted += removeFolder(path.c_str(), TAG);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
closedir(dir);
|
closedir(dir);
|
||||||
ESP_LOGD(TAG, "%d files deleted", deleted);
|
ESP_LOGD(TAG, "%d files deleted", deleted);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
esp_err_t ClassFlowControll::SendRawJPG(httpd_req_t *req)
|
esp_err_t ClassFlowControll::SendRawJPG(httpd_req_t *req)
|
||||||
{
|
{
|
||||||
return flowtakeimage != NULL ? flowtakeimage->SendRawJPG(req) : ESP_FAIL;
|
return flowtakeimage != NULL ? flowtakeimage->SendRawJPG(req) : ESP_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
esp_err_t ClassFlowControll::GetJPGStream(std::string _fn, httpd_req_t *req)
|
esp_err_t ClassFlowControll::GetJPGStream(std::string _fn, httpd_req_t *req)
|
||||||
{
|
{
|
||||||
ESP_LOGD(TAG, "ClassFlowControll::GetJPGStream %s", _fn.c_str());
|
ESP_LOGD(TAG, "ClassFlowControll::GetJPGStream %s", _fn.c_str());
|
||||||
@@ -846,8 +841,8 @@ esp_err_t ClassFlowControll::GetJPGStream(std::string _fn, httpd_req_t *req)
|
|||||||
else {
|
else {
|
||||||
std::vector<HTMLInfo*> htmlinfo;
|
std::vector<HTMLInfo*> htmlinfo;
|
||||||
|
|
||||||
htmlinfo = GetAllDigital();
|
htmlinfo = GetAllDigit();
|
||||||
ESP_LOGD(TAG, "After getClassFlowControll::GetAllDigital");
|
ESP_LOGD(TAG, "After getClassFlowControll::GetAllDigit");
|
||||||
|
|
||||||
for (int i = 0; i < htmlinfo.size(); ++i)
|
for (int i = 0; i < htmlinfo.size(); ++i)
|
||||||
{
|
{
|
||||||
@@ -916,14 +911,20 @@ esp_err_t ClassFlowControll::GetJPGStream(std::string _fn, httpd_req_t *req)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string ClassFlowControll::getNumbersName()
|
string ClassFlowControll::getNumbersName()
|
||||||
{
|
{
|
||||||
return flowpostprocessing->getNumbersName();
|
return flowpostprocessing->getNumbersName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string ClassFlowControll::getJSON()
|
string ClassFlowControll::getJSON()
|
||||||
{
|
{
|
||||||
return flowpostprocessing->GetJSON();
|
return flowpostprocessing->GetJSON();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @returns a vector of all current sequences
|
||||||
|
**/
|
||||||
|
const std::vector<NumberPost*> &ClassFlowControll::getNumbers()
|
||||||
|
{
|
||||||
|
return *flowpostprocessing->GetNumbers();
|
||||||
|
}
|
||||||
|
|||||||
@@ -17,6 +17,9 @@
|
|||||||
#include "ClassFlowInfluxDB.h"
|
#include "ClassFlowInfluxDB.h"
|
||||||
#include "ClassFlowInfluxDBv2.h"
|
#include "ClassFlowInfluxDBv2.h"
|
||||||
#endif //ENABLE_INFLUXDB
|
#endif //ENABLE_INFLUXDB
|
||||||
|
#ifdef ENABLE_WEBHOOK
|
||||||
|
#include "ClassFlowWebhook.h"
|
||||||
|
#endif //ENABLE_WEBHOOK
|
||||||
#include "ClassFlowCNNGeneral.h"
|
#include "ClassFlowCNNGeneral.h"
|
||||||
|
|
||||||
class ClassFlowControll :
|
class ClassFlowControll :
|
||||||
@@ -52,12 +55,13 @@ public:
|
|||||||
string GetPrevalue(std::string _number = "");
|
string GetPrevalue(std::string _number = "");
|
||||||
bool ReadParameter(FILE* pfile, string& aktparamgraph);
|
bool ReadParameter(FILE* pfile, string& aktparamgraph);
|
||||||
string getJSON();
|
string getJSON();
|
||||||
|
const std::vector<NumberPost*> &getNumbers();
|
||||||
string getNumbersName();
|
string getNumbersName();
|
||||||
|
|
||||||
string TranslateAktstatus(std::string _input);
|
string TranslateAktstatus(std::string _input);
|
||||||
|
|
||||||
#ifdef ALGROI_LOAD_FROM_MEM_AS_JPG
|
#ifdef ALGROI_LOAD_FROM_MEM_AS_JPG
|
||||||
void DigitalDrawROI(CImageBasis *_zw);
|
void DigitDrawROI(CImageBasis *_zw);
|
||||||
void AnalogDrawROI(CImageBasis *_zw);
|
void AnalogDrawROI(CImageBasis *_zw);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -73,10 +77,10 @@ public:
|
|||||||
std::string* getActStatus();
|
std::string* getActStatus();
|
||||||
void setActStatus(std::string _aktstatus);
|
void setActStatus(std::string _aktstatus);
|
||||||
|
|
||||||
std::vector<HTMLInfo*> GetAllDigital();
|
std::vector<HTMLInfo*> GetAllDigit();
|
||||||
std::vector<HTMLInfo*> GetAllAnalog();
|
std::vector<HTMLInfo*> GetAllAnalog();
|
||||||
|
|
||||||
t_CNNType GetTypeDigital();
|
t_CNNType GetTypeDigit();
|
||||||
t_CNNType GetTypeAnalog();
|
t_CNNType GetTypeAnalog();
|
||||||
|
|
||||||
#ifdef ENABLE_MQTT
|
#ifdef ENABLE_MQTT
|
||||||
|
|||||||
@@ -5,6 +5,10 @@
|
|||||||
|
|
||||||
#include "ClassFlowImage.h"
|
#include "ClassFlowImage.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Properties of one ROI
|
||||||
|
* FIXME: naming of members could use some refactoring to comply with common C++ coding style guidelines
|
||||||
|
*/
|
||||||
struct roi {
|
struct roi {
|
||||||
int posx, posy, deltax, deltay;
|
int posx, posy, deltax, deltay;
|
||||||
float result_float;
|
float result_float;
|
||||||
@@ -14,56 +18,66 @@ struct roi {
|
|||||||
CImageBasis *image, *image_org;
|
CImageBasis *image, *image_org;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* FIXME: Why is this additional layer needed?
|
||||||
|
*/
|
||||||
struct general {
|
struct general {
|
||||||
string name;
|
string name;
|
||||||
std::vector<roi*> ROI;
|
std::vector<roi*> ROI;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum t_RateType {
|
enum t_RateType {
|
||||||
AbsoluteChange,
|
AbsoluteChange, // ignores the time difference; only the value difference is used comparison with NumberPost.maxRate
|
||||||
RateChange
|
RateChange // time difference is considered and a normalized rate is used for comparison with NumberPost.maxRate
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Holds all properties and settings of a sequence. A sequence is a set of digit and/or analog ROIs that are combined to
|
||||||
|
* provide one meter reading (value).
|
||||||
|
* FIXME: can be renamed to `Sequence`
|
||||||
|
*/
|
||||||
struct NumberPost {
|
struct NumberPost {
|
||||||
float MaxRateValue;
|
float MaxRateValue; // maxRate; upper bound for the difference between two consecutive readings; affected by maxRateType;
|
||||||
bool useMaxRateValue;
|
bool useMaxRateValue; // consistencyChecksEnabled; enables consistency checks; uses maxRate and maxRateType
|
||||||
t_RateType RateType;
|
t_RateType MaxRateType; // maxRateType; affects how the value of maxRate is used for comparing the current and previous value
|
||||||
bool ErrorMessage;
|
bool ErrorMessage; // FIXME: not used; can be removed
|
||||||
bool PreValueOkay;
|
int ChangeRateThreshold; // threshold parameter for negative rate detection
|
||||||
bool AllowNegativeRates;
|
bool PreValueOkay; // previousValueValid; indicates that the reading of the previous round has no errors
|
||||||
bool checkDigitIncreaseConsistency;
|
bool AllowNegativeRates; // allowNegativeRate; defines if the consistency checks allow negative rates between consecutive meter readings.
|
||||||
time_t lastvalue;
|
bool checkDigitIncreaseConsistency; // extendedConsistencyCheck; performs an additional consistency check to avoid wrong readings
|
||||||
time_t timeStampTimeUTC;
|
time_t timeStampLastValue; // Timestamp for the last read value; is used for the log
|
||||||
string timeStamp;
|
time_t timeStampLastPreValue; // Timestamp for the last PreValue set; is used for useMaxRateValue
|
||||||
double FlowRateAct; // m3 / min
|
time_t timeStampTimeUTC; // FIXME: not used; can be removed.
|
||||||
double PreValue; // last value that was read out well
|
string timeStamp; // localTimeStr; timestamp of last valid reading formatted as local time
|
||||||
double Value; // last value read out, incl. corrections
|
double FlowRateAct; // currentRate; ΔValue/min; since usage is not limited to water meters, the physical unit is not known.
|
||||||
string ReturnRateValue; // return value rate
|
double PreValue; // lastValidValue; most recent value that could be read w/o any errors
|
||||||
string ReturnChangeAbsolute; // return value rate
|
double Value; // value; most recent readout; may include corrections
|
||||||
string ReturnRawValue; // Raw value (with N & leading 0)
|
string ReturnRateValue; // currentRateStr; current normalized rate; ΔValue/min
|
||||||
string ReturnValue; // corrected return value, if necessary with error message
|
string ReturnChangeAbsolute; // currentChangeStr; absolute difference between current and previous measurement
|
||||||
string ReturnPreValue; // corrected return value without error message
|
string ReturnRawValue; // rawValueStr; Raw value (with N & leading 0)
|
||||||
string ErrorMessageText; // Error message for consistency check
|
string ReturnValue; // valueStr; corrected return value, if necessary with error message
|
||||||
int AnzahlAnalog;
|
string ReturnPreValue; // lastValidValueStr; corrected return value without error message
|
||||||
int AnzahlDigital;
|
string ErrorMessageText; // errorMessage; Error message for consistency checks
|
||||||
int DecimalShift;
|
int AnzahlAnalog; // numAnalogRoi; number of analog ROIs used in this sequence
|
||||||
int DecimalShiftInitial;
|
int AnzahlDigit; // numDigitRoi; number of digit ROIs used in this sequence
|
||||||
float AnalogDigitalTransitionStart; // When is the digit > x.1, i.e. when does it start to tilt?
|
int DecimalShift; // decimalShift; each increment shifts the decimal separator by one digit; value=value*10^decimalShift; pos. value shifts to the right
|
||||||
int Nachkomma;
|
int DecimalShiftInitial; // decimalShiftInitial; same as decimalShift but is a const to reset decimalShift after calculations
|
||||||
|
float AnalogToDigitTransitionStart; // AnalogToDigitTransitionStartValue; FIXME: need a better description; When is the digit > x.1, i.e. when does it start to tilt?
|
||||||
|
int Nachkomma; // decimalPlaces; usually defined by the number of analog ROIs; affected by DecimalShift
|
||||||
|
|
||||||
string FieldV1; // Fieldname in InfluxDBv1
|
string FieldV1; // influxdbFieldName_v1; Name of the Field in InfluxDBv1
|
||||||
string MeasurementV1; // Measurement in InfluxDBv1
|
string MeasurementV1; // influxdbMeasurementName_v1; Name of the Measurement in InfluxDBv1
|
||||||
|
|
||||||
string FieldV2; // Fieldname in InfluxDBv2
|
string FieldV2; // influxdbFieldName_v2; Name of the Field in InfluxDBv2
|
||||||
string MeasurementV2; // Measurement in InfluxDBv2
|
string MeasurementV2; // influxdbMeasurementName_v2; Name of the Measurement in InfluxDBv2
|
||||||
|
|
||||||
bool isExtendedResolution;
|
bool isExtendedResolution; // extendResolution; Adds the decimal place of the least significant analog ROI to the value
|
||||||
|
|
||||||
general *digit_roi;
|
general *digit_roi; // digitRoi; set of digit ROIs for the sequence
|
||||||
general *analog_roi;
|
general *analog_roi; // analogRoi; set of analog ROIs for the sequence
|
||||||
|
|
||||||
string name;
|
string name; // name; Designation for the sequence
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -286,7 +286,7 @@ bool ClassFlowMQTT::doFlow(string zwtime)
|
|||||||
|
|
||||||
if (resultchangabs.length() > 0) {
|
if (resultchangabs.length() > 0) {
|
||||||
success |= MQTTPublish(namenumber + "changeabsolut", resultchangabs, qos, SetRetainFlag); // Legacy API
|
success |= MQTTPublish(namenumber + "changeabsolut", resultchangabs, qos, SetRetainFlag); // Legacy API
|
||||||
success |= MQTTPublish(namenumber + "rate_per_digitalization_round", resultchangabs, qos, SetRetainFlag);
|
success |= MQTTPublish(namenumber + "rate_per_Digitization_round", resultchangabs, qos, SetRetainFlag);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (resultraw.length() > 0)
|
if (resultraw.length() > 0)
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -21,11 +21,9 @@ protected:
|
|||||||
bool ErrorMessage;
|
bool ErrorMessage;
|
||||||
bool IgnoreLeadingNaN; // SPECIAL CASE for User Gustl ???
|
bool IgnoreLeadingNaN; // SPECIAL CASE for User Gustl ???
|
||||||
|
|
||||||
|
|
||||||
ClassFlowCNNGeneral* flowAnalog;
|
ClassFlowCNNGeneral* flowAnalog;
|
||||||
ClassFlowCNNGeneral* flowDigit;
|
ClassFlowCNNGeneral* flowDigit;
|
||||||
|
|
||||||
|
|
||||||
string FilePreValue;
|
string FilePreValue;
|
||||||
|
|
||||||
ClassFlowTakeImage *flowTakeImage;
|
ClassFlowTakeImage *flowTakeImage;
|
||||||
@@ -41,21 +39,18 @@ protected:
|
|||||||
void handleMaxRateValue(string _decsep, string _value);
|
void handleMaxRateValue(string _decsep, string _value);
|
||||||
void handleDecimalExtendedResolution(string _decsep, string _value);
|
void handleDecimalExtendedResolution(string _decsep, string _value);
|
||||||
void handleMaxRateType(string _decsep, string _value);
|
void handleMaxRateType(string _decsep, string _value);
|
||||||
void handleAnalogDigitalTransitionStart(string _decsep, string _value);
|
void handleAnalogToDigitTransitionStart(string _decsep, string _value);
|
||||||
void handleAllowNegativeRate(string _decsep, string _value);
|
void handleAllowNegativeRate(string _decsep, string _value);
|
||||||
|
void handleChangeRateThreshold(string _decsep, string _value);
|
||||||
|
|
||||||
std::string GetStringReadouts(general);
|
std::string GetStringReadouts(general);
|
||||||
|
|
||||||
void WriteDataLog(int _index);
|
void WriteDataLog(int _index);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
bool PreValueUse;
|
bool PreValueUse;
|
||||||
std::vector<NumberPost*> NUMBERS;
|
std::vector<NumberPost*> NUMBERS;
|
||||||
|
|
||||||
|
|
||||||
ClassFlowPostProcessing(std::vector<ClassFlow*>* lfc, ClassFlowCNNGeneral *_analog, ClassFlowCNNGeneral *_digit);
|
ClassFlowPostProcessing(std::vector<ClassFlow*>* lfc, ClassFlowCNNGeneral *_analog, ClassFlowCNNGeneral *_digit);
|
||||||
virtual ~ClassFlowPostProcessing(){};
|
virtual ~ClassFlowPostProcessing(){};
|
||||||
bool ReadParameter(FILE* pfile, string& aktparamgraph);
|
bool ReadParameter(FILE* pfile, string& aktparamgraph);
|
||||||
|
|||||||
@@ -1,9 +1,15 @@
|
|||||||
|
#include <iostream>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
#include <regex>
|
||||||
|
|
||||||
#include "ClassFlowTakeImage.h"
|
#include "ClassFlowTakeImage.h"
|
||||||
#include "Helper.h"
|
#include "Helper.h"
|
||||||
#include "ClassLogFile.h"
|
#include "ClassLogFile.h"
|
||||||
|
|
||||||
#include "CImageBasis.h"
|
#include "CImageBasis.h"
|
||||||
#include "ClassControllCamera.h"
|
#include "ClassControllCamera.h"
|
||||||
|
#include "MainFlowControl.h"
|
||||||
|
|
||||||
#include "esp_wifi.h"
|
#include "esp_wifi.h"
|
||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
@@ -13,12 +19,12 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
// #define DEBUG_DETAIL_ON
|
// #define DEBUG_DETAIL_ON
|
||||||
|
|
||||||
// #define WIFITURNOFF
|
// #define WIFITURNOFF
|
||||||
|
|
||||||
static const char* TAG = "TAKEIMAGE";
|
static const char *TAG = "TAKEIMAGE";
|
||||||
|
|
||||||
esp_err_t ClassFlowTakeImage::camera_capture(){
|
esp_err_t ClassFlowTakeImage::camera_capture(void)
|
||||||
|
{
|
||||||
string nm = namerawimage;
|
string nm = namerawimage;
|
||||||
Camera.CaptureToFile(nm);
|
Camera.CaptureToFile(nm);
|
||||||
time(&TimeImageTaken);
|
time(&TimeImageTaken);
|
||||||
@@ -30,204 +36,499 @@ esp_err_t ClassFlowTakeImage::camera_capture(){
|
|||||||
void ClassFlowTakeImage::takePictureWithFlash(int flash_duration)
|
void ClassFlowTakeImage::takePictureWithFlash(int flash_duration)
|
||||||
{
|
{
|
||||||
// in case the image is flipped, it must be reset here //
|
// in case the image is flipped, it must be reset here //
|
||||||
rawImage->width = image_width;
|
rawImage->width = CCstatus.ImageWidth;
|
||||||
rawImage->height = image_height;
|
rawImage->height = CCstatus.ImageHeight;
|
||||||
/////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
ESP_LOGD(TAG, "flash_duration: %d", flash_duration);
|
ESP_LOGD(TAG, "flash_duration: %d", flash_duration);
|
||||||
|
|
||||||
Camera.CaptureToBasisImage(rawImage, flash_duration);
|
Camera.CaptureToBasisImage(rawImage, flash_duration);
|
||||||
|
|
||||||
time(&TimeImageTaken);
|
time(&TimeImageTaken);
|
||||||
localtime(&TimeImageTaken);
|
localtime(&TimeImageTaken);
|
||||||
|
|
||||||
if (SaveAllFiles) rawImage->SaveToFile(namerawimage);
|
if (CCstatus.SaveAllFiles)
|
||||||
|
{
|
||||||
|
rawImage->SaveToFile(namerawimage);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClassFlowTakeImage::SetInitialParameter(void)
|
void ClassFlowTakeImage::SetInitialParameter(void)
|
||||||
{
|
{
|
||||||
waitbeforepicture = 5;
|
|
||||||
isImageSize = false;
|
|
||||||
ImageQuality = -1;
|
|
||||||
TimeImageTaken = 0;
|
TimeImageTaken = 0;
|
||||||
ImageQuality = 5;
|
|
||||||
rawImage = NULL;
|
rawImage = NULL;
|
||||||
ImageSize = FRAMESIZE_VGA;
|
|
||||||
ZoomEnabled = false;
|
|
||||||
ZoomMode = 0;
|
|
||||||
zoomOffsetX = 0;
|
|
||||||
zoomOffsetY = 0;
|
|
||||||
ImageNegative = false;
|
|
||||||
ImageAec2 = false;
|
|
||||||
#ifdef GRAYSCALE_AS_DEFAULT
|
|
||||||
ImageGrayscale = true;
|
|
||||||
#else
|
|
||||||
ImageGrayscale = false;
|
|
||||||
#endif
|
|
||||||
SaveAllFiles = false;
|
|
||||||
disabled = false;
|
disabled = false;
|
||||||
FixedExposure = false;
|
|
||||||
namerawimage = "/sdcard/img_tmp/raw.jpg";
|
namerawimage = "/sdcard/img_tmp/raw.jpg";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// auslesen der Kameraeinstellungen aus der config.ini
|
||||||
ClassFlowTakeImage::ClassFlowTakeImage(std::vector<ClassFlow*>* lfc) : ClassFlowImage(lfc, TAG)
|
// wird beim Start aufgerufen
|
||||||
|
bool ClassFlowTakeImage::ReadParameter(FILE *pfile, string &aktparamgraph)
|
||||||
{
|
{
|
||||||
imagesLocation = "/log/source";
|
Camera.getSensorDatenToCCstatus(); // Kamera >>> CCstatus
|
||||||
imagesRetention = 5;
|
|
||||||
SetInitialParameter();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool ClassFlowTakeImage::ReadParameter(FILE* pfile, string& aktparamgraph)
|
|
||||||
{
|
|
||||||
std::vector<string> splitted;
|
std::vector<string> splitted;
|
||||||
|
|
||||||
aktparamgraph = trim(aktparamgraph);
|
aktparamgraph = trim(aktparamgraph);
|
||||||
int _brightness = 0;
|
|
||||||
int _contrast = 0;
|
|
||||||
int _saturation = 0;
|
|
||||||
int _sharpness = 0;
|
|
||||||
int _autoExposureLevel = 0;
|
|
||||||
|
|
||||||
if (aktparamgraph.size() == 0)
|
if (aktparamgraph.size() == 0)
|
||||||
|
{
|
||||||
if (!this->GetNextParagraph(pfile, aktparamgraph))
|
if (!this->GetNextParagraph(pfile, aktparamgraph))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (aktparamgraph.compare("[TakeImage]") != 0) // Paragraph does not fit TakeImage
|
if (aktparamgraph.compare("[TakeImage]") != 0)
|
||||||
|
{
|
||||||
|
// Paragraph does not fit TakeImage
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
while (this->getNextLine(pfile, &aktparamgraph) && !this->isNewParagraph(aktparamgraph))
|
while (this->getNextLine(pfile, &aktparamgraph) && !this->isNewParagraph(aktparamgraph))
|
||||||
{
|
{
|
||||||
splitted = ZerlegeZeile(aktparamgraph);
|
splitted = ZerlegeZeile(aktparamgraph);
|
||||||
|
|
||||||
if ((toUpper(splitted[0]) == "RAWIMAGESLOCATION") && (splitted.size() > 1))
|
if ((toUpper(splitted[0]) == "RAWIMAGESLOCATION") && (splitted.size() > 1))
|
||||||
{
|
{
|
||||||
imagesLocation = "/sdcard" + splitted[1];
|
imagesLocation = "/sdcard" + splitted[1];
|
||||||
isLogImage = true;
|
isLogImage = true;
|
||||||
}
|
}
|
||||||
if ((toUpper(splitted[0]) == "IMAGEQUALITY") && (splitted.size() > 1))
|
|
||||||
ImageQuality = std::stod(splitted[1]);
|
|
||||||
|
|
||||||
if ((toUpper(splitted[0]) == "ZOOM") && (splitted.size() > 1))
|
else if ((toUpper(splitted[0]) == "RAWIMAGESRETENTION") && (splitted.size() > 1))
|
||||||
{
|
{
|
||||||
if (toUpper(splitted[1]) == "TRUE")
|
if (isStringNumeric(splitted[1]))
|
||||||
ZoomEnabled = true;
|
{
|
||||||
else if (toUpper(splitted[1]) == "FALSE")
|
this->imagesRetention = std::stod(splitted[1]);
|
||||||
ZoomEnabled = false;
|
|
||||||
}
|
}
|
||||||
if ((toUpper(splitted[0]) == "ZOOMMODE") && (splitted.size() > 1))
|
|
||||||
ZoomMode = std::stod(splitted[1]);
|
|
||||||
if ((toUpper(splitted[0]) == "ZOOMOFFSETX") && (splitted.size() > 1))
|
|
||||||
zoomOffsetX = std::stod(splitted[1]);
|
|
||||||
if ((toUpper(splitted[0]) == "ZOOMOFFSETY") && (splitted.size() > 1))
|
|
||||||
zoomOffsetY = std::stod(splitted[1]);
|
|
||||||
if ((toUpper(splitted[0]) == "GRAYSCALE") && (splitted.size() > 1))
|
|
||||||
{
|
|
||||||
if (toUpper(splitted[1]) == "TRUE")
|
|
||||||
ImageGrayscale = true;
|
|
||||||
else if (toUpper(splitted[1]) == "FALSE")
|
|
||||||
ImageGrayscale = false;
|
|
||||||
}
|
|
||||||
if ((toUpper(splitted[0]) == "NEGATIVE") && (splitted.size() > 1))
|
|
||||||
{
|
|
||||||
if (toUpper(splitted[1]) == "TRUE")
|
|
||||||
ImageNegative = true;
|
|
||||||
else if (toUpper(splitted[1]) == "FALSE")
|
|
||||||
ImageNegative = false;
|
|
||||||
}
|
|
||||||
if ((toUpper(splitted[0]) == "AEC2") && (splitted.size() > 1))
|
|
||||||
{
|
|
||||||
if (toUpper(splitted[1]) == "TRUE")
|
|
||||||
ImageAec2 = true;
|
|
||||||
else if (toUpper(splitted[1]) == "FALSE")
|
|
||||||
ImageAec2 = false;
|
|
||||||
}
|
|
||||||
if ((toUpper(splitted[0]) == "AUTOEXPOSURELEVEL") && (splitted.size() > 1))
|
|
||||||
_autoExposureLevel = std::stod(splitted[1]);
|
|
||||||
|
|
||||||
if ((toUpper(splitted[0]) == "IMAGESIZE") && (splitted.size() > 1))
|
|
||||||
{
|
|
||||||
ImageSize = Camera.TextToFramesize(splitted[1].c_str());
|
|
||||||
isImageSize = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((toUpper(splitted[0]) == "SAVEALLFILES") && (splitted.size() > 1))
|
else if ((toUpper(splitted[0]) == "SAVEALLFILES") && (splitted.size() > 1))
|
||||||
{
|
{
|
||||||
if (toUpper(splitted[1]) == "TRUE")
|
CCstatus.SaveAllFiles = alphanumericToBoolean(splitted[1]);
|
||||||
SaveAllFiles = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((toUpper(splitted[0]) == "WAITBEFORETAKINGPICTURE") && (splitted.size() > 1))
|
else if ((toUpper(splitted[0]) == "WAITBEFORETAKINGPICTURE") && (splitted.size() > 1))
|
||||||
{
|
{
|
||||||
waitbeforepicture = stoi(splitted[1]);
|
if (isStringNumeric(splitted[1]))
|
||||||
|
{
|
||||||
|
int _WaitBeforePicture = std::stoi(splitted[1]);
|
||||||
|
if (_WaitBeforePicture != 0)
|
||||||
|
{
|
||||||
|
CCstatus.WaitBeforePicture = _WaitBeforePicture;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CCstatus.WaitBeforePicture = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((toUpper(splitted[0]) == "RAWIMAGESRETENTION") && (splitted.size() > 1))
|
else if ((toUpper(splitted[0]) == "CAMGAINCEILING") && (splitted.size() > 1))
|
||||||
{
|
{
|
||||||
this->imagesRetention = std::stoi(splitted[1]);
|
std::string _ImageGainceiling = toUpper(splitted[1]);
|
||||||
|
|
||||||
|
if (isStringNumeric(_ImageGainceiling))
|
||||||
|
{
|
||||||
|
int _ImageGainceiling_ = std::stoi(_ImageGainceiling);
|
||||||
|
switch (_ImageGainceiling_)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
CFstatus.ImageGainceiling = GAINCEILING_4X;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
CFstatus.ImageGainceiling = GAINCEILING_8X;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
CFstatus.ImageGainceiling = GAINCEILING_16X;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
CFstatus.ImageGainceiling = GAINCEILING_32X;
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
CFstatus.ImageGainceiling = GAINCEILING_64X;
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
CFstatus.ImageGainceiling = GAINCEILING_128X;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
CFstatus.ImageGainceiling = GAINCEILING_2X;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (_ImageGainceiling == "X4")
|
||||||
|
{
|
||||||
|
CCstatus.ImageGainceiling = GAINCEILING_4X;
|
||||||
|
}
|
||||||
|
else if (_ImageGainceiling == "X8")
|
||||||
|
{
|
||||||
|
CCstatus.ImageGainceiling = GAINCEILING_8X;
|
||||||
|
}
|
||||||
|
else if (_ImageGainceiling == "X16")
|
||||||
|
{
|
||||||
|
CCstatus.ImageGainceiling = GAINCEILING_16X;
|
||||||
|
}
|
||||||
|
else if (_ImageGainceiling == "X32")
|
||||||
|
{
|
||||||
|
CCstatus.ImageGainceiling = GAINCEILING_32X;
|
||||||
|
}
|
||||||
|
else if (_ImageGainceiling == "X64")
|
||||||
|
{
|
||||||
|
CCstatus.ImageGainceiling = GAINCEILING_64X;
|
||||||
|
}
|
||||||
|
else if (_ImageGainceiling == "X128")
|
||||||
|
{
|
||||||
|
CCstatus.ImageGainceiling = GAINCEILING_128X;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CCstatus.ImageGainceiling = GAINCEILING_2X;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((toUpper(splitted[0]) == "BRIGHTNESS") && (splitted.size() > 1))
|
else if ((toUpper(splitted[0]) == "CAMQUALITY") && (splitted.size() > 1))
|
||||||
{
|
{
|
||||||
_brightness = stoi(splitted[1]);
|
if (isStringNumeric(splitted[1]))
|
||||||
|
{
|
||||||
|
int _ImageQuality = std::stoi(splitted[1]);
|
||||||
|
CCstatus.ImageQuality = clipInt(_ImageQuality, 63, 6);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((toUpper(splitted[0]) == "CONTRAST") && (splitted.size() > 1))
|
else if ((toUpper(splitted[0]) == "CAMBRIGHTNESS") && (splitted.size() > 1))
|
||||||
{
|
{
|
||||||
_contrast = stoi(splitted[1]);
|
if (isStringNumeric(splitted[1]))
|
||||||
|
{
|
||||||
|
int _ImageBrightness = std::stoi(splitted[1]);
|
||||||
|
CCstatus.ImageBrightness = clipInt(_ImageBrightness, 2, -2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((toUpper(splitted[0]) == "SATURATION") && (splitted.size() > 1))
|
else if ((toUpper(splitted[0]) == "CAMCONTRAST") && (splitted.size() > 1))
|
||||||
{
|
{
|
||||||
_saturation = stoi(splitted[1]);
|
if (isStringNumeric(splitted[1]))
|
||||||
|
{
|
||||||
|
int _ImageContrast = std::stoi(splitted[1]);
|
||||||
|
CCstatus.ImageContrast = clipInt(_ImageContrast, 2, -2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((toUpper(splitted[0]) == "SHARPNESS") && (splitted.size() > 1))
|
else if ((toUpper(splitted[0]) == "CAMSATURATION") && (splitted.size() > 1))
|
||||||
{
|
{
|
||||||
_sharpness = stoi(splitted[1]);
|
if (isStringNumeric(splitted[1]))
|
||||||
|
{
|
||||||
|
int _ImageSaturation = std::stoi(splitted[1]);
|
||||||
|
CCstatus.ImageSaturation = clipInt(_ImageSaturation, 2, -2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((toUpper(splitted[0]) == "FIXEDEXPOSURE") && (splitted.size() > 1))
|
else if ((toUpper(splitted[0]) == "CAMSHARPNESS") && (splitted.size() > 1))
|
||||||
{
|
{
|
||||||
if (toUpper(splitted[1]) == "TRUE")
|
if (isStringNumeric(splitted[1]))
|
||||||
FixedExposure = true;
|
{
|
||||||
|
int _ImageSharpness = std::stoi(splitted[1]);
|
||||||
|
if (CCstatus.CamSensor_id == OV2640_PID)
|
||||||
|
{
|
||||||
|
CCstatus.ImageSharpness = clipInt(_ImageSharpness, 2, -2);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CCstatus.ImageSharpness = clipInt(_ImageSharpness, 3, -3);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((toUpper(splitted[0]) == "LEDINTENSITY") && (splitted.size() > 1))
|
else if ((toUpper(splitted[0]) == "CAMAUTOSHARPNESS") && (splitted.size() > 1))
|
||||||
{
|
{
|
||||||
float ledintensity = stof(splitted[1]);
|
CCstatus.ImageAutoSharpness = alphanumericToBoolean(splitted[1]);
|
||||||
ledintensity = min((float) 100, ledintensity);
|
}
|
||||||
ledintensity = max((float) 0, ledintensity);
|
|
||||||
|
else if ((toUpper(splitted[0]) == "CAMSPECIALEFFECT") && (splitted.size() > 1))
|
||||||
|
{
|
||||||
|
std::string _ImageSpecialEffect = toUpper(splitted[1]);
|
||||||
|
|
||||||
|
if (isStringNumeric(_ImageSpecialEffect))
|
||||||
|
{
|
||||||
|
int _ImageSpecialEffect_ = std::stoi(_ImageSpecialEffect);
|
||||||
|
CFstatus.ImageSpecialEffect = clipInt(_ImageSpecialEffect_, 6, 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (_ImageSpecialEffect == "NEGATIVE")
|
||||||
|
{
|
||||||
|
CCstatus.ImageSpecialEffect = 1;
|
||||||
|
}
|
||||||
|
else if (_ImageSpecialEffect == "GRAYSCALE")
|
||||||
|
{
|
||||||
|
CCstatus.ImageSpecialEffect = 2;
|
||||||
|
}
|
||||||
|
else if (_ImageSpecialEffect == "RED")
|
||||||
|
{
|
||||||
|
CCstatus.ImageSpecialEffect = 3;
|
||||||
|
}
|
||||||
|
else if (_ImageSpecialEffect == "GREEN")
|
||||||
|
{
|
||||||
|
CCstatus.ImageSpecialEffect = 4;
|
||||||
|
}
|
||||||
|
else if (_ImageSpecialEffect == "BLUE")
|
||||||
|
{
|
||||||
|
CCstatus.ImageSpecialEffect = 5;
|
||||||
|
}
|
||||||
|
else if (_ImageSpecialEffect == "RETRO")
|
||||||
|
{
|
||||||
|
CCstatus.ImageSpecialEffect = 6;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CCstatus.ImageSpecialEffect = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ((toUpper(splitted[0]) == "CAMWBMODE") && (splitted.size() > 1))
|
||||||
|
{
|
||||||
|
std::string _ImageWbMode = toUpper(splitted[1]);
|
||||||
|
|
||||||
|
if (isStringNumeric(_ImageWbMode))
|
||||||
|
{
|
||||||
|
int _ImageWbMode_ = std::stoi(_ImageWbMode);
|
||||||
|
CFstatus.ImageWbMode = clipInt(_ImageWbMode_, 4, 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (_ImageWbMode == "SUNNY")
|
||||||
|
{
|
||||||
|
CCstatus.ImageWbMode = 1;
|
||||||
|
}
|
||||||
|
else if (_ImageWbMode == "CLOUDY")
|
||||||
|
{
|
||||||
|
CCstatus.ImageWbMode = 2;
|
||||||
|
}
|
||||||
|
else if (_ImageWbMode == "OFFICE")
|
||||||
|
{
|
||||||
|
CCstatus.ImageWbMode = 3;
|
||||||
|
}
|
||||||
|
else if (_ImageWbMode == "HOME")
|
||||||
|
{
|
||||||
|
CCstatus.ImageWbMode = 4;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CCstatus.ImageWbMode = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ((toUpper(splitted[0]) == "CAMAWB") && (splitted.size() > 1))
|
||||||
|
{
|
||||||
|
CCstatus.ImageAwb = alphanumericToBoolean(splitted[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ((toUpper(splitted[0]) == "CAMAWBGAIN") && (splitted.size() > 1))
|
||||||
|
{
|
||||||
|
CCstatus.ImageAwbGain = alphanumericToBoolean(splitted[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ((toUpper(splitted[0]) == "CAMAEC") && (splitted.size() > 1))
|
||||||
|
{
|
||||||
|
CCstatus.ImageAec = alphanumericToBoolean(splitted[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ((toUpper(splitted[0]) == "CAMAEC2") && (splitted.size() > 1))
|
||||||
|
{
|
||||||
|
CCstatus.ImageAec2 = alphanumericToBoolean(splitted[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ((toUpper(splitted[0]) == "CAMAELEVEL") && (splitted.size() > 1))
|
||||||
|
{
|
||||||
|
if (isStringNumeric(splitted[1]))
|
||||||
|
{
|
||||||
|
int _ImageAeLevel = std::stoi(splitted[1]);
|
||||||
|
if (CCstatus.CamSensor_id == OV2640_PID)
|
||||||
|
{
|
||||||
|
CCstatus.ImageAeLevel = clipInt(_ImageAeLevel, 2, -2);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CCstatus.ImageAeLevel = clipInt(_ImageAeLevel, 5, -5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ((toUpper(splitted[0]) == "CAMAECVALUE") && (splitted.size() > 1))
|
||||||
|
{
|
||||||
|
if (isStringNumeric(splitted[1]))
|
||||||
|
{
|
||||||
|
int _ImageAecValue = std::stoi(splitted[1]);
|
||||||
|
CCstatus.ImageAecValue = clipInt(_ImageAecValue, 1200, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ((toUpper(splitted[0]) == "CAMAGC") && (splitted.size() > 1))
|
||||||
|
{
|
||||||
|
CCstatus.ImageAgc = alphanumericToBoolean(splitted[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ((toUpper(splitted[0]) == "CAMAGCGAIN") && (splitted.size() > 1))
|
||||||
|
{
|
||||||
|
if (isStringNumeric(splitted[1]))
|
||||||
|
{
|
||||||
|
int _ImageAgcGain = std::stoi(splitted[1]);
|
||||||
|
CCstatus.ImageAgcGain = clipInt(_ImageAgcGain, 30, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ((toUpper(splitted[0]) == "CAMBPC") && (splitted.size() > 1))
|
||||||
|
{
|
||||||
|
CCstatus.ImageBpc = alphanumericToBoolean(splitted[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ((toUpper(splitted[0]) == "CAMWPC") && (splitted.size() > 1))
|
||||||
|
{
|
||||||
|
CCstatus.ImageWpc = alphanumericToBoolean(splitted[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ((toUpper(splitted[0]) == "CAMRAWGMA") && (splitted.size() > 1))
|
||||||
|
{
|
||||||
|
CCstatus.ImageRawGma = alphanumericToBoolean(splitted[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ((toUpper(splitted[0]) == "CAMLENC") && (splitted.size() > 1))
|
||||||
|
{
|
||||||
|
CCstatus.ImageLenc = alphanumericToBoolean(splitted[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ((toUpper(splitted[0]) == "CAMHMIRROR") && (splitted.size() > 1))
|
||||||
|
{
|
||||||
|
CCstatus.ImageHmirror = alphanumericToBoolean(splitted[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ((toUpper(splitted[0]) == "CAMVFLIP") && (splitted.size() > 1))
|
||||||
|
{
|
||||||
|
CCstatus.ImageVflip = alphanumericToBoolean(splitted[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ((toUpper(splitted[0]) == "CAMDCW") && (splitted.size() > 1))
|
||||||
|
{
|
||||||
|
CCstatus.ImageDcw = alphanumericToBoolean(splitted[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ((toUpper(splitted[0]) == "CAMDENOISE") && (splitted.size() > 1))
|
||||||
|
{
|
||||||
|
if (isStringNumeric(splitted[1]))
|
||||||
|
{
|
||||||
|
int _ImageDenoiseLevel = std::stoi(splitted[1]);
|
||||||
|
if (CCstatus.CamSensor_id == OV2640_PID)
|
||||||
|
{
|
||||||
|
CCstatus.ImageDenoiseLevel = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CCstatus.ImageDenoiseLevel = clipInt(_ImageDenoiseLevel, 8, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ((toUpper(splitted[0]) == "CAMZOOM") && (splitted.size() > 1))
|
||||||
|
{
|
||||||
|
CCstatus.ImageZoomEnabled = alphanumericToBoolean(splitted[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ((toUpper(splitted[0]) == "CAMZOOMOFFSETX") && (splitted.size() > 1))
|
||||||
|
{
|
||||||
|
if (isStringNumeric(splitted[1]))
|
||||||
|
{
|
||||||
|
int _ImageZoomOffsetX = std::stoi(splitted[1]);
|
||||||
|
if (CCstatus.CamSensor_id == OV2640_PID)
|
||||||
|
{
|
||||||
|
CCstatus.ImageZoomOffsetX = clipInt(_ImageZoomOffsetX, 480, -480);
|
||||||
|
}
|
||||||
|
else if (CCstatus.CamSensor_id == OV3660_PID)
|
||||||
|
{
|
||||||
|
CCstatus.ImageZoomOffsetX = clipInt(_ImageZoomOffsetX, 704, -704);
|
||||||
|
}
|
||||||
|
else if (CCstatus.CamSensor_id == OV5640_PID)
|
||||||
|
{
|
||||||
|
CCstatus.ImageZoomOffsetX = clipInt(_ImageZoomOffsetX, 960, -960);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ((toUpper(splitted[0]) == "CAMZOOMOFFSETY") && (splitted.size() > 1))
|
||||||
|
{
|
||||||
|
if (isStringNumeric(splitted[1]))
|
||||||
|
{
|
||||||
|
int _ImageZoomOffsetY = std::stoi(splitted[1]);
|
||||||
|
if (CCstatus.CamSensor_id == OV2640_PID)
|
||||||
|
{
|
||||||
|
CCstatus.ImageZoomOffsetY = clipInt(_ImageZoomOffsetY, 360, -360);
|
||||||
|
}
|
||||||
|
else if (CCstatus.CamSensor_id == OV3660_PID)
|
||||||
|
{
|
||||||
|
CCstatus.ImageZoomOffsetY = clipInt(_ImageZoomOffsetY, 528, -528);
|
||||||
|
}
|
||||||
|
else if (CCstatus.CamSensor_id == OV5640_PID)
|
||||||
|
{
|
||||||
|
CCstatus.ImageZoomOffsetY = clipInt(_ImageZoomOffsetY, 720, -720);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ((toUpper(splitted[0]) == "CAMZOOMSIZE") && (splitted.size() > 1))
|
||||||
|
{
|
||||||
|
if (isStringNumeric(splitted[1]))
|
||||||
|
{
|
||||||
|
int _ImageZoomSize = std::stoi(splitted[1]);
|
||||||
|
if (CCstatus.CamSensor_id == OV2640_PID)
|
||||||
|
{
|
||||||
|
CCstatus.ImageZoomSize = clipInt(_ImageZoomSize, 29, 0);
|
||||||
|
}
|
||||||
|
else if (CCstatus.CamSensor_id == OV3660_PID)
|
||||||
|
{
|
||||||
|
CCstatus.ImageZoomSize = clipInt(_ImageZoomSize, 43, 0);
|
||||||
|
}
|
||||||
|
else if (CCstatus.CamSensor_id == OV5640_PID)
|
||||||
|
{
|
||||||
|
CCstatus.ImageZoomSize = clipInt(_ImageZoomSize, 59, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ((toUpper(splitted[0]) == "LEDINTENSITY") && (splitted.size() > 1))
|
||||||
|
{
|
||||||
|
if (isStringNumeric(splitted[1]))
|
||||||
|
{
|
||||||
|
float ledintensity = std::stof(splitted[1]);
|
||||||
Camera.SetLEDIntensity(ledintensity);
|
Camera.SetLEDIntensity(ledintensity);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ((toUpper(splitted[0]) == "DEMO") && (splitted.size() > 1))
|
else if ((toUpper(splitted[0]) == "DEMO") && (splitted.size() > 1))
|
||||||
|
{
|
||||||
|
CCstatus.DemoMode = alphanumericToBoolean(splitted[1]);
|
||||||
|
if (CCstatus.DemoMode == true)
|
||||||
{
|
{
|
||||||
if (toUpper(splitted[1]) == "TRUE")
|
|
||||||
Camera.useDemoMode();
|
Camera.useDemoMode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Camera.SetBrightnessContrastSaturation(_brightness, _contrast, _saturation, _autoExposureLevel, ImageGrayscale, ImageNegative, ImageAec2, _sharpness);
|
|
||||||
Camera.SetQualitySize(ImageQuality, ImageSize, ZoomEnabled, ZoomMode, zoomOffsetX, zoomOffsetY);
|
|
||||||
|
|
||||||
image_width = Camera.image_width;
|
|
||||||
image_height = Camera.image_height;
|
|
||||||
rawImage = new CImageBasis("rawImage");
|
|
||||||
rawImage->CreateEmptyImage(image_width, image_height, 3);
|
|
||||||
|
|
||||||
waitbeforepicture_store = waitbeforepicture;
|
|
||||||
if (FixedExposure && (waitbeforepicture > 0))
|
|
||||||
{
|
|
||||||
// ESP_LOGD(TAG, "Fixed Exposure enabled!");
|
|
||||||
int flash_duration = (int) (waitbeforepicture * 1000);
|
|
||||||
Camera.EnableAutoExposure(flash_duration);
|
|
||||||
waitbeforepicture = 0.2;
|
|
||||||
// flash_duration = (int) (waitbeforepicture * 1000);
|
|
||||||
// takePictureWithFlash(flash_duration);
|
|
||||||
// rawImage->SaveToFile("/sdcard/init2.jpg");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Camera.setSensorDatenFromCCstatus(); // CCstatus >>> Kamera
|
||||||
|
Camera.SetQualityZoomSize(CCstatus.ImageQuality, CCstatus.ImageFrameSize, CCstatus.ImageZoomEnabled, CCstatus.ImageZoomOffsetX, CCstatus.ImageZoomOffsetY, CCstatus.ImageZoomSize, CCstatus.ImageVflip);
|
||||||
|
|
||||||
|
rawImage = new CImageBasis("rawImage");
|
||||||
|
rawImage->CreateEmptyImage(CCstatus.ImageWidth, CCstatus.ImageHeight, 3);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ClassFlowTakeImage::ClassFlowTakeImage(std::vector<ClassFlow *> *lfc) : ClassFlowImage(lfc, TAG)
|
||||||
|
{
|
||||||
|
imagesLocation = "/log/source";
|
||||||
|
imagesRetention = 5;
|
||||||
|
SetInitialParameter();
|
||||||
|
}
|
||||||
|
|
||||||
string ClassFlowTakeImage::getHTMLSingleStep(string host)
|
string ClassFlowTakeImage::getHTMLSingleStep(string host)
|
||||||
{
|
{
|
||||||
@@ -236,64 +537,68 @@ string ClassFlowTakeImage::getHTMLSingleStep(string host)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// wird bei jeder Auswertrunde aufgerufen
|
||||||
bool ClassFlowTakeImage::doFlow(string zwtime)
|
bool ClassFlowTakeImage::doFlow(string zwtime)
|
||||||
{
|
{
|
||||||
psram_init_shared_memory_for_take_image_step();
|
psram_init_shared_memory_for_take_image_step();
|
||||||
|
|
||||||
string logPath = CreateLogFolder(zwtime);
|
string logPath = CreateLogFolder(zwtime);
|
||||||
|
|
||||||
int flash_duration = (int) (waitbeforepicture * 1000);
|
int flash_duration = (int)(CCstatus.WaitBeforePicture * 1000);
|
||||||
|
|
||||||
#ifdef DEBUG_DETAIL_ON
|
#ifdef DEBUG_DETAIL_ON
|
||||||
LogFile.WriteHeapInfo("ClassFlowTakeImage::doFlow - Before takePictureWithFlash");
|
LogFile.WriteHeapInfo("ClassFlowTakeImage::doFlow - Before takePictureWithFlash");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef WIFITURNOFF
|
||||||
#ifdef WIFITURNOFF
|
|
||||||
esp_wifi_stop(); // to save power usage and
|
esp_wifi_stop(); // to save power usage and
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// wenn die Kameraeinstellungen durch Erstellen eines neuen Referenzbildes verändert wurden, müssen sie neu gesetzt werden
|
||||||
|
if (CFstatus.changedCameraSettings)
|
||||||
|
{
|
||||||
|
Camera.setSensorDatenFromCCstatus(); // CCstatus >>> Kamera
|
||||||
|
Camera.SetQualityZoomSize(CCstatus.ImageQuality, CCstatus.ImageFrameSize, CCstatus.ImageZoomEnabled, CCstatus.ImageZoomOffsetX, CCstatus.ImageZoomOffsetY, CCstatus.ImageZoomSize, CCstatus.ImageVflip);
|
||||||
|
CFstatus.changedCameraSettings = false;
|
||||||
|
}
|
||||||
|
|
||||||
takePictureWithFlash(flash_duration);
|
takePictureWithFlash(flash_duration);
|
||||||
|
|
||||||
#ifdef WIFITURNOFF
|
#ifdef WIFITURNOFF
|
||||||
esp_wifi_start();
|
esp_wifi_start();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef DEBUG_DETAIL_ON
|
||||||
#ifdef DEBUG_DETAIL_ON
|
|
||||||
LogFile.WriteHeapInfo("ClassFlowTakeImage::doFlow - After takePictureWithFlash");
|
LogFile.WriteHeapInfo("ClassFlowTakeImage::doFlow - After takePictureWithFlash");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
LogImage(logPath, "raw", NULL, NULL, zwtime, rawImage);
|
LogImage(logPath, "raw", NULL, NULL, zwtime, rawImage);
|
||||||
|
|
||||||
RemoveOldLogs();
|
RemoveOldLogs();
|
||||||
|
|
||||||
#ifdef DEBUG_DETAIL_ON
|
#ifdef DEBUG_DETAIL_ON
|
||||||
LogFile.WriteHeapInfo("ClassFlowTakeImage::doFlow - After RemoveOldLogs");
|
LogFile.WriteHeapInfo("ClassFlowTakeImage::doFlow - After RemoveOldLogs");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
psram_deinit_shared_memory_for_take_image_step();
|
psram_deinit_shared_memory_for_take_image_step();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
esp_err_t ClassFlowTakeImage::SendRawJPG(httpd_req_t *req)
|
esp_err_t ClassFlowTakeImage::SendRawJPG(httpd_req_t *req)
|
||||||
{
|
{
|
||||||
int flash_duration = (int) (waitbeforepicture * 1000);
|
int flash_duration = (int)(CCstatus.WaitBeforePicture * 1000);
|
||||||
time(&TimeImageTaken);
|
time(&TimeImageTaken);
|
||||||
localtime(&TimeImageTaken);
|
localtime(&TimeImageTaken);
|
||||||
|
|
||||||
return Camera.CaptureToHTTP(req, flash_duration);
|
return Camera.CaptureToHTTP(req, flash_duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImageData *ClassFlowTakeImage::SendRawImage(void)
|
||||||
ImageData* ClassFlowTakeImage::SendRawImage()
|
|
||||||
{
|
{
|
||||||
CImageBasis *zw = new CImageBasis("SendRawImage", rawImage);
|
CImageBasis *zw = new CImageBasis("SendRawImage", rawImage);
|
||||||
ImageData *id;
|
ImageData *id;
|
||||||
int flash_duration = (int) (waitbeforepicture * 1000);
|
int flash_duration = (int)(CCstatus.WaitBeforePicture * 1000);
|
||||||
Camera.CaptureToBasisImage(zw, flash_duration);
|
Camera.CaptureToBasisImage(zw, flash_duration);
|
||||||
time(&TimeImageTaken);
|
time(&TimeImageTaken);
|
||||||
localtime(&TimeImageTaken);
|
localtime(&TimeImageTaken);
|
||||||
@@ -303,7 +608,7 @@ ImageData* ClassFlowTakeImage::SendRawImage()
|
|||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
time_t ClassFlowTakeImage::getTimeImageTaken()
|
time_t ClassFlowTakeImage::getTimeImageTaken(void)
|
||||||
{
|
{
|
||||||
return TimeImageTaken;
|
return TimeImageTaken;
|
||||||
}
|
}
|
||||||
@@ -312,4 +617,3 @@ ClassFlowTakeImage::~ClassFlowTakeImage(void)
|
|||||||
{
|
{
|
||||||
delete rawImage;
|
delete rawImage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,54 +9,32 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
class ClassFlowTakeImage :
|
class ClassFlowTakeImage : public ClassFlowImage
|
||||||
public ClassFlowImage
|
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
float waitbeforepicture;
|
|
||||||
float waitbeforepicture_store;
|
|
||||||
framesize_t ImageSize;
|
|
||||||
bool isImageSize;
|
|
||||||
bool ZoomEnabled = false;
|
|
||||||
int ZoomMode = 0;
|
|
||||||
int zoomOffsetX = 0;
|
|
||||||
int zoomOffsetY = 0;
|
|
||||||
bool ImageGrayscale;
|
|
||||||
bool ImageNegative;
|
|
||||||
bool ImageAec2;
|
|
||||||
int ImageQuality;
|
|
||||||
time_t TimeImageTaken;
|
time_t TimeImageTaken;
|
||||||
string namerawimage;
|
string namerawimage;
|
||||||
int image_height, image_width;
|
|
||||||
bool SaveAllFiles;
|
|
||||||
bool FixedExposure;
|
|
||||||
|
|
||||||
|
esp_err_t camera_capture(void);
|
||||||
|
|
||||||
void CopyFile(string input, string output);
|
|
||||||
|
|
||||||
esp_err_t camera_capture();
|
|
||||||
void takePictureWithFlash(int flash_duration);
|
void takePictureWithFlash(int flash_duration);
|
||||||
|
|
||||||
|
|
||||||
void SetInitialParameter(void);
|
void SetInitialParameter(void);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CImageBasis *rawImage;
|
CImageBasis *rawImage;
|
||||||
|
|
||||||
ClassFlowTakeImage(std::vector<ClassFlow*>* lfc);
|
ClassFlowTakeImage(std::vector<ClassFlow *> *lfc);
|
||||||
|
|
||||||
bool ReadParameter(FILE* pfile, string& aktparamgraph);
|
bool ReadParameter(FILE *pfile, string &aktparamgraph);
|
||||||
bool doFlow(string time);
|
bool doFlow(string time);
|
||||||
string getHTMLSingleStep(string host);
|
string getHTMLSingleStep(string host);
|
||||||
time_t getTimeImageTaken();
|
time_t getTimeImageTaken(void);
|
||||||
string name(){return "ClassFlowTakeImage";};
|
string name() { return "ClassFlowTakeImage"; };
|
||||||
|
|
||||||
ImageData* SendRawImage();
|
ImageData *SendRawImage(void);
|
||||||
esp_err_t SendRawJPG(httpd_req_t *req);
|
esp_err_t SendRawJPG(httpd_req_t *req);
|
||||||
|
|
||||||
~ClassFlowTakeImage(void);
|
~ClassFlowTakeImage(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif // CLASSFFLOWTAKEIMAGE_H
|
||||||
#endif //CLASSFFLOWTAKEIMAGE_H
|
|
||||||
171
code/components/jomjol_flowcontroll/ClassFlowWebhook.cpp
Normal file
171
code/components/jomjol_flowcontroll/ClassFlowWebhook.cpp
Normal file
@@ -0,0 +1,171 @@
|
|||||||
|
#ifdef ENABLE_WEBHOOK
|
||||||
|
#include <sstream>
|
||||||
|
#include "ClassFlowWebhook.h"
|
||||||
|
#include "Helper.h"
|
||||||
|
#include "connect_wlan.h"
|
||||||
|
|
||||||
|
#include "time_sntp.h"
|
||||||
|
#include "interface_webhook.h"
|
||||||
|
|
||||||
|
#include "ClassFlowPostProcessing.h"
|
||||||
|
#include "ClassFlowAlignment.h"
|
||||||
|
#include "esp_log.h"
|
||||||
|
#include "../../include/defines.h"
|
||||||
|
|
||||||
|
#include "ClassLogFile.h"
|
||||||
|
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
static const char* TAG = "WEBHOOK";
|
||||||
|
|
||||||
|
void ClassFlowWebhook::SetInitialParameter(void)
|
||||||
|
{
|
||||||
|
uri = "";
|
||||||
|
flowpostprocessing = NULL;
|
||||||
|
flowAlignment = NULL;
|
||||||
|
previousElement = NULL;
|
||||||
|
ListFlowControll = NULL;
|
||||||
|
disabled = false;
|
||||||
|
WebhookEnable = false;
|
||||||
|
WebhookUploadImg = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ClassFlowWebhook::ClassFlowWebhook()
|
||||||
|
{
|
||||||
|
SetInitialParameter();
|
||||||
|
}
|
||||||
|
|
||||||
|
ClassFlowWebhook::ClassFlowWebhook(std::vector<ClassFlow*>* lfc)
|
||||||
|
{
|
||||||
|
SetInitialParameter();
|
||||||
|
|
||||||
|
ListFlowControll = lfc;
|
||||||
|
for (int i = 0; i < ListFlowControll->size(); ++i)
|
||||||
|
{
|
||||||
|
if (((*ListFlowControll)[i])->name().compare("ClassFlowPostProcessing") == 0)
|
||||||
|
{
|
||||||
|
flowpostprocessing = (ClassFlowPostProcessing*) (*ListFlowControll)[i];
|
||||||
|
}
|
||||||
|
if (((*ListFlowControll)[i])->name().compare("ClassFlowAlignment") == 0)
|
||||||
|
{
|
||||||
|
flowAlignment = (ClassFlowAlignment*) (*ListFlowControll)[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ClassFlowWebhook::ClassFlowWebhook(std::vector<ClassFlow*>* lfc, ClassFlow *_prev)
|
||||||
|
{
|
||||||
|
SetInitialParameter();
|
||||||
|
|
||||||
|
previousElement = _prev;
|
||||||
|
ListFlowControll = lfc;
|
||||||
|
|
||||||
|
for (int i = 0; i < ListFlowControll->size(); ++i)
|
||||||
|
{
|
||||||
|
if (((*ListFlowControll)[i])->name().compare("ClassFlowPostProcessing") == 0)
|
||||||
|
{
|
||||||
|
flowpostprocessing = (ClassFlowPostProcessing*) (*ListFlowControll)[i];
|
||||||
|
}
|
||||||
|
if (((*ListFlowControll)[i])->name().compare("ClassFlowAlignment") == 0)
|
||||||
|
{
|
||||||
|
flowAlignment = (ClassFlowAlignment*) (*ListFlowControll)[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool ClassFlowWebhook::ReadParameter(FILE* pfile, string& aktparamgraph)
|
||||||
|
{
|
||||||
|
std::vector<string> splitted;
|
||||||
|
|
||||||
|
aktparamgraph = trim(aktparamgraph);
|
||||||
|
printf("akt param: %s\n", aktparamgraph.c_str());
|
||||||
|
|
||||||
|
if (aktparamgraph.size() == 0)
|
||||||
|
if (!this->GetNextParagraph(pfile, aktparamgraph))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (toUpper(aktparamgraph).compare("[WEBHOOK]") != 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
while (this->getNextLine(pfile, &aktparamgraph) && !this->isNewParagraph(aktparamgraph))
|
||||||
|
{
|
||||||
|
ESP_LOGD(TAG, "while loop reading line: %s", aktparamgraph.c_str());
|
||||||
|
splitted = ZerlegeZeile(aktparamgraph);
|
||||||
|
std::string _param = GetParameterName(splitted[0]);
|
||||||
|
|
||||||
|
if ((toUpper(_param) == "URI") && (splitted.size() > 1))
|
||||||
|
{
|
||||||
|
this->uri = splitted[1];
|
||||||
|
}
|
||||||
|
if (((toUpper(_param) == "APIKEY")) && (splitted.size() > 1))
|
||||||
|
{
|
||||||
|
this->apikey = splitted[1];
|
||||||
|
}
|
||||||
|
if (((toUpper(_param) == "UPLOADIMG")) && (splitted.size() > 1))
|
||||||
|
{
|
||||||
|
if (toUpper(splitted[1]) == "1")
|
||||||
|
{
|
||||||
|
this->WebhookUploadImg = 1;
|
||||||
|
} else if (toUpper(splitted[1]) == "2")
|
||||||
|
{
|
||||||
|
this->WebhookUploadImg = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
WebhookInit(uri,apikey);
|
||||||
|
WebhookEnable = true;
|
||||||
|
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "Webhook Enabled for Uri " + uri);
|
||||||
|
|
||||||
|
printf("uri: %s\n", uri.c_str());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ClassFlowWebhook::handleMeasurement(string _decsep, string _value)
|
||||||
|
{
|
||||||
|
string _digit, _decpos;
|
||||||
|
int _pospunkt = _decsep.find_first_of(".");
|
||||||
|
// ESP_LOGD(TAG, "Name: %s, Pospunkt: %d", _decsep.c_str(), _pospunkt);
|
||||||
|
if (_pospunkt > -1)
|
||||||
|
_digit = _decsep.substr(0, _pospunkt);
|
||||||
|
else
|
||||||
|
_digit = "default";
|
||||||
|
for (int j = 0; j < flowpostprocessing->NUMBERS.size(); ++j)
|
||||||
|
{
|
||||||
|
if (_digit == "default") // Set to default first (if nothing else is set)
|
||||||
|
{
|
||||||
|
flowpostprocessing->NUMBERS[j]->MeasurementV2 = _value;
|
||||||
|
}
|
||||||
|
if (flowpostprocessing->NUMBERS[j]->name == _digit)
|
||||||
|
{
|
||||||
|
flowpostprocessing->NUMBERS[j]->MeasurementV2 = _value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool ClassFlowWebhook::doFlow(string zwtime)
|
||||||
|
{
|
||||||
|
if (!WebhookEnable)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (flowpostprocessing)
|
||||||
|
{
|
||||||
|
printf("vor sende WebHook");
|
||||||
|
bool numbersWithError = WebhookPublish(flowpostprocessing->GetNumbers());
|
||||||
|
|
||||||
|
#ifdef ALGROI_LOAD_FROM_MEM_AS_JPG
|
||||||
|
if ((WebhookUploadImg == 1 || (WebhookUploadImg != 0 && numbersWithError)) && flowAlignment && flowAlignment->AlgROI) {
|
||||||
|
WebhookUploadPic(flowAlignment->AlgROI);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
#endif //ENABLE_WEBHOOK
|
||||||
43
code/components/jomjol_flowcontroll/ClassFlowWebhook.h
Normal file
43
code/components/jomjol_flowcontroll/ClassFlowWebhook.h
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
#ifdef ENABLE_WEBHOOK
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef CLASSFWEBHOOK_H
|
||||||
|
#define CLASSFWEBHOOK_H
|
||||||
|
|
||||||
|
#include "ClassFlow.h"
|
||||||
|
|
||||||
|
#include "ClassFlowPostProcessing.h"
|
||||||
|
#include "ClassFlowAlignment.h"
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
class ClassFlowWebhook :
|
||||||
|
public ClassFlow
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
std::string uri, apikey;
|
||||||
|
ClassFlowPostProcessing* flowpostprocessing;
|
||||||
|
ClassFlowAlignment* flowAlignment;
|
||||||
|
|
||||||
|
bool WebhookEnable;
|
||||||
|
int WebhookUploadImg;
|
||||||
|
|
||||||
|
void SetInitialParameter(void);
|
||||||
|
|
||||||
|
void handleFieldname(string _decsep, string _value);
|
||||||
|
void handleMeasurement(string _decsep, string _value);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
ClassFlowWebhook();
|
||||||
|
ClassFlowWebhook(std::vector<ClassFlow*>* lfc);
|
||||||
|
ClassFlowWebhook(std::vector<ClassFlow*>* lfc, ClassFlow *_prev);
|
||||||
|
|
||||||
|
bool ReadParameter(FILE* pfile, string& aktparamgraph);
|
||||||
|
bool doFlow(string time);
|
||||||
|
string name(){return "ClassFlowWebhook";};
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //CLASSFWEBHOOK_H
|
||||||
|
#endif //ENABLE_WEBHOOK
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -9,26 +9,83 @@
|
|||||||
#include <esp_http_server.h>
|
#include <esp_http_server.h>
|
||||||
#include "CImageBasis.h"
|
#include "CImageBasis.h"
|
||||||
#include "ClassFlowControll.h"
|
#include "ClassFlowControll.h"
|
||||||
|
#include "openmetrics.h"
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
uint16_t CamSensor_id;
|
||||||
|
|
||||||
|
framesize_t ImageFrameSize = FRAMESIZE_VGA; // 0 - 10
|
||||||
|
gainceiling_t ImageGainceiling; // Image gain (GAINCEILING_x2, x4, x8, x16, x32, x64 or x128)
|
||||||
|
|
||||||
|
int ImageQuality; // 0 - 63
|
||||||
|
int ImageBrightness; // (-2 to 2) - set brightness
|
||||||
|
int ImageContrast; //-2 - 2
|
||||||
|
int ImageSaturation; //-2 - 2
|
||||||
|
int ImageSharpness; //-2 - 2
|
||||||
|
bool ImageAutoSharpness;
|
||||||
|
int ImageSpecialEffect; // 0 - 6
|
||||||
|
int ImageWbMode; // 0 to 4 - if awb_gain enabled (0 - Auto, 1 - Sunny, 2 - Cloudy, 3 - Office, 4 - Home)
|
||||||
|
int ImageAwb; // white balance enable (0 or 1)
|
||||||
|
int ImageAwbGain; // Auto White Balance enable (0 or 1)
|
||||||
|
int ImageAec; // auto exposure off (1 or 0)
|
||||||
|
int ImageAec2; // automatic exposure sensor (0 or 1)
|
||||||
|
int ImageAeLevel; // auto exposure levels (-2 to 2)
|
||||||
|
int ImageAecValue; // set exposure manually (0-1200)
|
||||||
|
int ImageAgc; // auto gain off (1 or 0)
|
||||||
|
int ImageAgcGain; // set gain manually (0 - 30)
|
||||||
|
int ImageBpc; // black pixel correction
|
||||||
|
int ImageWpc; // white pixel correction
|
||||||
|
int ImageRawGma; // (1 or 0)
|
||||||
|
int ImageLenc; // lens correction (1 or 0)
|
||||||
|
int ImageHmirror; // (0 or 1) flip horizontally
|
||||||
|
int ImageVflip; // Invert image (0 or 1)
|
||||||
|
int ImageDcw; // downsize enable (1 or 0)
|
||||||
|
|
||||||
|
int ImageDenoiseLevel; // The OV2640 does not support it, OV3660 and OV5640 (0 to 8)
|
||||||
|
|
||||||
|
int ImageWidth;
|
||||||
|
int ImageHeight;
|
||||||
|
|
||||||
|
int ImageLedIntensity;
|
||||||
|
|
||||||
|
bool ImageZoomEnabled;
|
||||||
|
int ImageZoomOffsetX;
|
||||||
|
int ImageZoomOffsetY;
|
||||||
|
int ImageZoomSize;
|
||||||
|
|
||||||
|
int WaitBeforePicture;
|
||||||
|
bool isImageSize;
|
||||||
|
|
||||||
|
bool CameraInitSuccessful;
|
||||||
|
bool changedCameraSettings;
|
||||||
|
bool DemoMode;
|
||||||
|
bool SaveAllFiles;
|
||||||
|
} camera_flow_config_temp_t;
|
||||||
|
|
||||||
|
extern camera_flow_config_temp_t CFstatus;
|
||||||
extern ClassFlowControll flowctrl;
|
extern ClassFlowControll flowctrl;
|
||||||
|
|
||||||
|
esp_err_t setCCstatusToCFstatus(void); // CCstatus >>> CFstatus
|
||||||
|
esp_err_t setCFstatusToCCstatus(void); // CFstatus >>> CCstatus
|
||||||
|
esp_err_t setCFstatusToCam(void); // CFstatus >>> Kamera
|
||||||
|
|
||||||
void register_server_main_flow_task_uri(httpd_handle_t server);
|
void register_server_main_flow_task_uri(httpd_handle_t server);
|
||||||
|
|
||||||
void CheckIsPlannedReboot();
|
void CheckIsPlannedReboot(void);
|
||||||
bool getIsPlannedReboot();
|
bool getIsPlannedReboot(void);
|
||||||
|
|
||||||
void InitializeFlowTask();
|
void InitializeFlowTask(void);
|
||||||
void DeleteMainFlowTask();
|
void DeleteMainFlowTask(void);
|
||||||
bool isSetupModusActive();
|
bool isSetupModusActive(void);
|
||||||
|
|
||||||
int getCountFlowRounds();
|
int getCountFlowRounds(void);
|
||||||
|
|
||||||
#ifdef ENABLE_MQTT
|
#ifdef ENABLE_MQTT
|
||||||
esp_err_t MQTTCtrlFlowStart(std::string _topic);
|
esp_err_t MQTTCtrlFlowStart(std::string _topic);
|
||||||
#endif //ENABLE_MQTT
|
#endif // ENABLE_MQTT
|
||||||
|
|
||||||
esp_err_t GetRawJPG(httpd_req_t *req);
|
esp_err_t GetRawJPG(httpd_req_t *req);
|
||||||
esp_err_t GetJPG(std::string _filename, httpd_req_t *req);
|
esp_err_t GetJPG(std::string _filename, httpd_req_t *req);
|
||||||
|
|
||||||
#endif //MAINFLOWCONTROL_H
|
#endif // MAINFLOWCONTROL_H
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -21,7 +21,6 @@ bool RenameFile(string from, string to);
|
|||||||
bool MakeDir(std::string _what);
|
bool MakeDir(std::string _what);
|
||||||
bool FileExists(string filename);
|
bool FileExists(string filename);
|
||||||
|
|
||||||
|
|
||||||
string RundeOutput(double _in, int _anzNachkomma);
|
string RundeOutput(double _in, int _anzNachkomma);
|
||||||
|
|
||||||
size_t findDelimiterPos(string input, string delimiter);
|
size_t findDelimiterPos(string input, string delimiter);
|
||||||
@@ -33,7 +32,6 @@ string getFileType(string filename);
|
|||||||
string getFileFullFileName(string filename);
|
string getFileFullFileName(string filename);
|
||||||
string getDirectory(string filename);
|
string getDirectory(string filename);
|
||||||
|
|
||||||
|
|
||||||
int mkdir_r(const char *dir, const mode_t mode);
|
int mkdir_r(const char *dir, const mode_t mode);
|
||||||
int removeFolder(const char* folderPath, const char* logTag);
|
int removeFolder(const char* folderPath, const char* logTag);
|
||||||
|
|
||||||
@@ -68,7 +66,6 @@ string getSDCardSectorSize();
|
|||||||
|
|
||||||
string getMac(void);
|
string getMac(void);
|
||||||
|
|
||||||
|
|
||||||
/* Error bit fields
|
/* Error bit fields
|
||||||
One bit per error
|
One bit per error
|
||||||
Make sure it matches https://jomjol.github.io/AI-on-the-edge-device-docs/Error-Codes */
|
Make sure it matches https://jomjol.github.io/AI-on-the-edge-device-docs/Error-Codes */
|
||||||
@@ -98,8 +95,18 @@ const char* get404(void);
|
|||||||
|
|
||||||
std::string UrlDecode(const std::string& value);
|
std::string UrlDecode(const std::string& value);
|
||||||
|
|
||||||
|
void replaceAll(std::string& s, const std::string& toReplace, const std::string& replaceWith);
|
||||||
bool replaceString(std::string& s, std::string const& toReplace, std::string const& replaceWith);
|
bool replaceString(std::string& s, std::string const& toReplace, std::string const& replaceWith);
|
||||||
bool replaceString(std::string& s, std::string const& toReplace, std::string const& replaceWith, bool logIt);
|
bool replaceString(std::string& s, std::string const& toReplace, std::string const& replaceWith, bool logIt);
|
||||||
bool isInString(std::string& s, std::string const& toFind);
|
bool isInString(std::string& s, std::string const& toFind);
|
||||||
|
|
||||||
|
bool isStringNumeric(std::string &input);
|
||||||
|
bool isStringAlphabetic(std::string &input);
|
||||||
|
bool isStringAlphanumeric(std::string &input);
|
||||||
|
bool alphanumericToBoolean(std::string &input);
|
||||||
|
|
||||||
|
int clipInt(int input, int high, int low);
|
||||||
|
bool numericStrToBool(std::string input);
|
||||||
|
bool stringToBoolean(std::string input);
|
||||||
|
|
||||||
#endif //HELPER_H
|
#endif //HELPER_H
|
||||||
|
|||||||
@@ -120,15 +120,15 @@ void psram_free_shared_temp_image_memory(void) {
|
|||||||
|
|
||||||
|
|
||||||
/*******************************************************************
|
/*******************************************************************
|
||||||
* Memory used in Digitalization Steps
|
* Memory used in Digitization Steps
|
||||||
* During this step we only use the shared part of the PSRAM for the
|
* During this step we only use the shared part of the PSRAM for the
|
||||||
* Tensor Arena and one of the Models.
|
* Tensor Arena and one of the Models.
|
||||||
* The shared memory is large enough for the largest model and the
|
* The shared memory is large enough for the largest model and the
|
||||||
* Tensor Arena. Therefore we do not need to monitor the usage.
|
* Tensor Arena. Therefore we do not need to monitor the usage.
|
||||||
*******************************************************************/
|
*******************************************************************/
|
||||||
void *psram_get_shared_tensor_arena_memory(void) {
|
void *psram_get_shared_tensor_arena_memory(void) {
|
||||||
if ((sharedMemoryInUseFor == "") || (sharedMemoryInUseFor == "Digitalization_Model")) {
|
if ((sharedMemoryInUseFor == "") || (sharedMemoryInUseFor == "Digitization_Model")) {
|
||||||
sharedMemoryInUseFor = "Digitalization_Tensor";
|
sharedMemoryInUseFor = "Digitization_Tensor";
|
||||||
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "Allocating Tensor Arena (" + std::to_string(TENSOR_ARENA_SIZE) + " bytes, use shared memory in PSRAM)...");
|
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "Allocating Tensor Arena (" + std::to_string(TENSOR_ARENA_SIZE) + " bytes, use shared memory in PSRAM)...");
|
||||||
return shared_region; // Use 1th part of the shared memory for Tensor
|
return shared_region; // Use 1th part of the shared memory for Tensor
|
||||||
}
|
}
|
||||||
@@ -140,8 +140,8 @@ void *psram_get_shared_tensor_arena_memory(void) {
|
|||||||
|
|
||||||
|
|
||||||
void *psram_get_shared_model_memory(void) {
|
void *psram_get_shared_model_memory(void) {
|
||||||
if ((sharedMemoryInUseFor == "") || (sharedMemoryInUseFor == "Digitalization_Tensor")) {
|
if ((sharedMemoryInUseFor == "") || (sharedMemoryInUseFor == "Digitization_Tensor")) {
|
||||||
sharedMemoryInUseFor = "Digitalization_Model";
|
sharedMemoryInUseFor = "Digitization_Model";
|
||||||
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "Allocating Model memory (" + std::to_string(MAX_MODEL_SIZE) + " bytes, use shared memory in PSRAM)...");
|
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "Allocating Model memory (" + std::to_string(MAX_MODEL_SIZE) + " bytes, use shared memory in PSRAM)...");
|
||||||
return (uint8_t *)shared_region + TENSOR_ARENA_SIZE; // Use 2nd part of the shared memory (after Tensor Arena) for the model
|
return (uint8_t *)shared_region + TENSOR_ARENA_SIZE; // Use 2nd part of the shared memory (after Tensor Arena) for the model
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ void psram_free_shared_stbi_memory(void *p);
|
|||||||
void *psram_reserve_shared_tmp_image_memory(void);
|
void *psram_reserve_shared_tmp_image_memory(void);
|
||||||
void psram_free_shared_temp_image_memory(void);
|
void psram_free_shared_temp_image_memory(void);
|
||||||
|
|
||||||
/* Memory used in Digitalization Steps */
|
/* Memory used in Digitization Steps */
|
||||||
void *psram_get_shared_tensor_arena_memory(void);
|
void *psram_get_shared_tensor_arena_memory(void);
|
||||||
void *psram_get_shared_model_memory(void);
|
void *psram_get_shared_model_memory(void);
|
||||||
void psram_free_shared_tensor_arena_and_model_memory(void);
|
void psram_free_shared_tensor_arena_and_model_memory(void);
|
||||||
|
|||||||
@@ -35,15 +35,15 @@ static const char* TAG = "sdcard_init";
|
|||||||
} \
|
} \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
typedef struct vfs_fat_sd_ctx_t {
|
typedef struct mh_vfs_fat_sd_ctx_t {
|
||||||
BYTE pdrv; //Drive number that is mounted
|
BYTE pdrv; //Drive number that is mounted
|
||||||
esp_vfs_fat_mount_config_t mount_config; //Mount configuration
|
esp_vfs_fat_mount_config_t mount_config; //Mount configuration
|
||||||
FATFS *fs; //FAT structure pointer that is registered
|
FATFS *fs; //FAT structure pointer that is registered
|
||||||
sdmmc_card_t *card; //Card info
|
sdmmc_card_t *card; //Card info
|
||||||
char *base_path; //Path where partition is registered
|
char *base_path; //Path where partition is registered
|
||||||
} vfs_fat_sd_ctx_t;
|
} mh_vfs_fat_sd_ctx_t;
|
||||||
|
|
||||||
static vfs_fat_sd_ctx_t *s_ctx[FF_VOLUMES] = {};
|
static mh_vfs_fat_sd_ctx_t *s_ctx[FF_VOLUMES] = {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This `s_saved_ctx_id` is only used by `esp_vfs_fat_sdmmc_unmount`, which is deprecated.
|
* This `s_saved_ctx_id` is only used by `esp_vfs_fat_sdmmc_unmount`, which is deprecated.
|
||||||
@@ -185,14 +185,9 @@ BYTE ff_diskio_get_pdrv_card_mh(const sdmmc_card_t* card)
|
|||||||
return 0xff;
|
return 0xff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static bool s_get_context_id_by_card_mh(const sdmmc_card_t *card, uint32_t *out_id)
|
static bool s_get_context_id_by_card_mh(const sdmmc_card_t *card, uint32_t *out_id)
|
||||||
{
|
{
|
||||||
vfs_fat_sd_ctx_t *p_ctx = NULL;
|
mh_vfs_fat_sd_ctx_t *p_ctx = NULL;
|
||||||
for (int i = 0; i < FF_VOLUMES; i++) {
|
for (int i = 0; i < FF_VOLUMES; i++) {
|
||||||
p_ctx = s_ctx[i];
|
p_ctx = s_ctx[i];
|
||||||
if (p_ctx) {
|
if (p_ctx) {
|
||||||
@@ -378,7 +373,7 @@ static esp_err_t init_sdmmc_host_mh(int slot, const void *slot_config, int *out_
|
|||||||
esp_err_t esp_vfs_fat_sdmmc_mount_mh(const char* base_path, const sdmmc_host_t* host_config, const void* slot_config, const esp_vfs_fat_mount_config_t* mount_config, sdmmc_card_t** out_card)
|
esp_err_t esp_vfs_fat_sdmmc_mount_mh(const char* base_path, const sdmmc_host_t* host_config, const void* slot_config, const esp_vfs_fat_mount_config_t* mount_config, sdmmc_card_t** out_card)
|
||||||
{
|
{
|
||||||
esp_err_t err;
|
esp_err_t err;
|
||||||
vfs_fat_sd_ctx_t *ctx = NULL;
|
mh_vfs_fat_sd_ctx_t *ctx = NULL;
|
||||||
uint32_t ctx_id = FF_VOLUMES;
|
uint32_t ctx_id = FF_VOLUMES;
|
||||||
FATFS *fs = NULL;
|
FATFS *fs = NULL;
|
||||||
int card_handle = -1; //uninitialized
|
int card_handle = -1; //uninitialized
|
||||||
@@ -419,7 +414,7 @@ esp_err_t esp_vfs_fat_sdmmc_mount_mh(const char* base_path, const sdmmc_host_t*
|
|||||||
s_saved_ctx_id = 0;
|
s_saved_ctx_id = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx = calloc(sizeof(vfs_fat_sd_ctx_t), 1);
|
ctx = calloc(sizeof(mh_vfs_fat_sd_ctx_t), 1);
|
||||||
|
|
||||||
if (!ctx) {
|
if (!ctx) {
|
||||||
CHECK_EXECUTE_RESULT(ESP_ERR_NO_MEM, "no mem");
|
CHECK_EXECUTE_RESULT(ESP_ERR_NO_MEM, "no mem");
|
||||||
@@ -462,7 +457,7 @@ esp_err_t esp_vfs_fat_sdspi_mount_mh(const char* base_path, const sdmmc_host_t*
|
|||||||
{
|
{
|
||||||
const sdmmc_host_t* host_config = host_config_input;
|
const sdmmc_host_t* host_config = host_config_input;
|
||||||
esp_err_t err;
|
esp_err_t err;
|
||||||
vfs_fat_sd_ctx_t *ctx = NULL;
|
mh_vfs_fat_sd_ctx_t *ctx = NULL;
|
||||||
uint32_t ctx_id = FF_VOLUMES;
|
uint32_t ctx_id = FF_VOLUMES;
|
||||||
FATFS *fs = NULL;
|
FATFS *fs = NULL;
|
||||||
int card_handle = -1; //uninitialized
|
int card_handle = -1; //uninitialized
|
||||||
@@ -514,7 +509,7 @@ esp_err_t esp_vfs_fat_sdspi_mount_mh(const char* base_path, const sdmmc_host_t*
|
|||||||
s_saved_ctx_id = 0;
|
s_saved_ctx_id = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx = calloc(sizeof(vfs_fat_sd_ctx_t), 1);
|
ctx = calloc(sizeof(mh_vfs_fat_sd_ctx_t), 1);
|
||||||
|
|
||||||
if (!ctx) {
|
if (!ctx) {
|
||||||
CHECK_EXECUTE_RESULT(ESP_ERR_NO_MEM, "no mem");
|
CHECK_EXECUTE_RESULT(ESP_ERR_NO_MEM, "no mem");
|
||||||
|
|||||||
@@ -18,50 +18,6 @@ CRotateImage::CRotateImage(std::string _name, CImageBasis *_org, CImageBasis *_t
|
|||||||
doflip = _flip;
|
doflip = _flip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CRotateImage::Mirror(){
|
|
||||||
int memsize = width * height * channels;
|
|
||||||
uint8_t* odata;
|
|
||||||
if (ImageTMP)
|
|
||||||
{
|
|
||||||
odata = ImageTMP->RGBImageLock();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
odata = (unsigned char*)malloc_psram_heap(std::string(TAG) + "->odata", memsize, MALLOC_CAP_SPIRAM);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int x_source, y_source;
|
|
||||||
stbi_uc* p_target;
|
|
||||||
stbi_uc* p_source;
|
|
||||||
|
|
||||||
RGBImageLock();
|
|
||||||
|
|
||||||
for (int x = 0; x < width; ++x)
|
|
||||||
for (int y = 0; y < height; ++y)
|
|
||||||
{
|
|
||||||
p_target = odata + (channels * (y * width + x));
|
|
||||||
|
|
||||||
x_source = width - x;
|
|
||||||
y_source = y;
|
|
||||||
|
|
||||||
p_source = rgb_image + (channels * (y_source * width + x_source));
|
|
||||||
for (int _channels = 0; _channels < channels; ++_channels)
|
|
||||||
p_target[_channels] = p_source[_channels];
|
|
||||||
}
|
|
||||||
|
|
||||||
// memcpy(rgb_image, odata, memsize);
|
|
||||||
memCopy(odata, rgb_image, memsize);
|
|
||||||
if (!ImageTMP)
|
|
||||||
free_psram_heap(std::string(TAG) + "->odata", odata);
|
|
||||||
|
|
||||||
if (ImageTMP)
|
|
||||||
ImageTMP->RGBImageRelease();
|
|
||||||
|
|
||||||
RGBImageRelease();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CRotateImage::Rotate(float _angle, int _centerx, int _centery)
|
void CRotateImage::Rotate(float _angle, int _centerx, int _centery)
|
||||||
{
|
{
|
||||||
int org_width, org_height;
|
int org_width, org_height;
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ class CRotateImage: public CImageBasis
|
|||||||
void RotateAntiAliasing(float _angle, int _centerx, int _centery);
|
void RotateAntiAliasing(float _angle, int _centerx, int _centery);
|
||||||
|
|
||||||
void Translate(int _dx, int _dy);
|
void Translate(int _dx, int _dy);
|
||||||
void Mirror();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //CROTATEIMAGE_H
|
#endif //CROTATEIMAGE_H
|
||||||
@@ -32,7 +32,7 @@ void ClassLogFile::WriteHeapInfo(std::string _id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ClassLogFile::WriteToData(std::string _timestamp, std::string _name, std::string _ReturnRawValue, std::string _ReturnValue, std::string _ReturnPreValue, std::string _ReturnRateValue, std::string _ReturnChangeAbsolute, std::string _ErrorMessageText, std::string _digital, std::string _analog)
|
void ClassLogFile::WriteToData(std::string _timestamp, std::string _name, std::string _ReturnRawValue, std::string _ReturnValue, std::string _ReturnPreValue, std::string _ReturnRateValue, std::string _ReturnChangeAbsolute, std::string _ErrorMessageText, std::string _digit, std::string _analog)
|
||||||
{
|
{
|
||||||
ESP_LOGD(TAG, "Start WriteToData");
|
ESP_LOGD(TAG, "Start WriteToData");
|
||||||
time_t rawtime;
|
time_t rawtime;
|
||||||
@@ -67,7 +67,7 @@ void ClassLogFile::WriteToData(std::string _timestamp, std::string _name, std::s
|
|||||||
fputs(_ReturnChangeAbsolute.c_str(), pFile);
|
fputs(_ReturnChangeAbsolute.c_str(), pFile);
|
||||||
fputs(",", pFile);
|
fputs(",", pFile);
|
||||||
fputs(_ErrorMessageText.c_str(), pFile);
|
fputs(_ErrorMessageText.c_str(), pFile);
|
||||||
fputs(_digital.c_str(), pFile);
|
fputs(_digit.c_str(), pFile);
|
||||||
fputs(_analog.c_str(), pFile);
|
fputs(_analog.c_str(), pFile);
|
||||||
fputs("\n", pFile);
|
fputs("\n", pFile);
|
||||||
|
|
||||||
|
|||||||
@@ -39,8 +39,8 @@ public:
|
|||||||
void RemoveOldLogFile();
|
void RemoveOldLogFile();
|
||||||
void RemoveOldDataLog();
|
void RemoveOldDataLog();
|
||||||
|
|
||||||
// void WriteToData(std::string _ReturnRawValue, std::string _ReturnValue, std::string _ReturnPreValue, std::string _ErrorMessageText, std::string _digital, std::string _analog);
|
// void WriteToData(std::string _ReturnRawValue, std::string _ReturnValue, std::string _ReturnPreValue, std::string _ErrorMessageText, std::string _digit, std::string _analog);
|
||||||
void WriteToData(std::string _timestamp, std::string _name, std::string _ReturnRawValue, std::string _ReturnValue, std::string _ReturnPreValue, std::string _ReturnRateValue, std::string _ReturnChangeAbsolute, std::string _ErrorMessageText, std::string _digital, std::string _analog);
|
void WriteToData(std::string _timestamp, std::string _name, std::string _ReturnRawValue, std::string _ReturnValue, std::string _ReturnPreValue, std::string _ReturnRateValue, std::string _ReturnChangeAbsolute, std::string _ErrorMessageText, std::string _digit, std::string _analog);
|
||||||
|
|
||||||
|
|
||||||
std::string GetCurrentFileName();
|
std::string GetCurrentFileName();
|
||||||
|
|||||||
@@ -49,6 +49,15 @@ void mqttServer_setMeterType(std::string _meterType, std::string _valueUnit, std
|
|||||||
rateUnit = _rateUnit;
|
rateUnit = _rateUnit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Takes any multi-level MQTT-topic and returns the last topic level as nodeId
|
||||||
|
* see https://www.hivemq.com/blog/mqtt-essentials-part-5-mqtt-topics-best-practices/ for details about MQTT topics
|
||||||
|
*/
|
||||||
|
std::string createNodeId(std::string &topic) {
|
||||||
|
auto splitPos = topic.find_last_of('/');
|
||||||
|
return (splitPos == std::string::npos) ? topic : topic.substr(splitPos + 1);
|
||||||
|
}
|
||||||
|
|
||||||
bool sendHomeAssistantDiscoveryTopic(std::string group, std::string field,
|
bool sendHomeAssistantDiscoveryTopic(std::string group, std::string field,
|
||||||
std::string name, std::string icon, std::string unit, std::string deviceClass, std::string stateClass, std::string entityCategory,
|
std::string name, std::string icon, std::string unit, std::string deviceClass, std::string stateClass, std::string entityCategory,
|
||||||
int qos) {
|
int qos) {
|
||||||
@@ -69,11 +78,18 @@ bool sendHomeAssistantDiscoveryTopic(std::string group, std::string field,
|
|||||||
name = group + " " + name;
|
name = group + " " + name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* homeassistant needs the MQTT discovery topic according to the following structure:
|
||||||
|
* <discovery_prefix>/<component>/[<node_id>/]<object_id>/config
|
||||||
|
* if the main topic is embedded in a nested structure, we just use the last part as node_id
|
||||||
|
* This means a maintopic "home/test/watermeter" is transformed to the discovery topic "homeassistant/sensor/watermeter/..."
|
||||||
|
*/
|
||||||
|
std::string node_id = createNodeId(maintopic);
|
||||||
if (field == "problem") { // Special binary sensor which is based on error topic
|
if (field == "problem") { // Special binary sensor which is based on error topic
|
||||||
topicFull = "homeassistant/binary_sensor/" + maintopic + "/" + configTopic + "/config";
|
topicFull = "homeassistant/binary_sensor/" + node_id + "/" + configTopic + "/config";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
topicFull = "homeassistant/sensor/" + maintopic + "/" + configTopic + "/config";
|
topicFull = "homeassistant/sensor/" + node_id + "/" + configTopic + "/config";
|
||||||
}
|
}
|
||||||
|
|
||||||
/* See https://www.home-assistant.io/docs/mqtt/discovery/ */
|
/* See https://www.home-assistant.io/docs/mqtt/discovery/ */
|
||||||
@@ -172,10 +188,10 @@ bool MQTThomeassistantDiscovery(int qos) {
|
|||||||
allSendsSuccessed |= sendHomeAssistantDiscoveryTopic(group, "value", "Value", "gauge", valueUnit, meterType, "total_increasing", "", qos);
|
allSendsSuccessed |= sendHomeAssistantDiscoveryTopic(group, "value", "Value", "gauge", valueUnit, meterType, "total_increasing", "", qos);
|
||||||
allSendsSuccessed |= sendHomeAssistantDiscoveryTopic(group, "raw", "Raw Value", "raw", "", "", "", "diagnostic", qos);
|
allSendsSuccessed |= sendHomeAssistantDiscoveryTopic(group, "raw", "Raw Value", "raw", "", "", "", "diagnostic", qos);
|
||||||
allSendsSuccessed |= sendHomeAssistantDiscoveryTopic(group, "error", "Error", "alert-circle-outline", "", "", "", "diagnostic", qos);
|
allSendsSuccessed |= sendHomeAssistantDiscoveryTopic(group, "error", "Error", "alert-circle-outline", "", "", "", "diagnostic", qos);
|
||||||
/* Not announcing "rate" as it is better to use rate_per_time_unit resp. rate_per_digitalization_round */
|
/* Not announcing "rate" as it is better to use rate_per_time_unit resp. rate_per_Digitization_round */
|
||||||
// allSendsSuccessed |= sendHomeAssistantDiscoveryTopic(group, "rate", "Rate (Unit/Minute)", "swap-vertical", "", "", "", ""); // Legacy, always Unit per Minute
|
// allSendsSuccessed |= sendHomeAssistantDiscoveryTopic(group, "rate", "Rate (Unit/Minute)", "swap-vertical", "", "", "", ""); // Legacy, always Unit per Minute
|
||||||
allSendsSuccessed |= sendHomeAssistantDiscoveryTopic(group, "rate_per_time_unit", "Rate (" + rateUnit + ")", "swap-vertical", rateUnit, "", "measurement", "", qos);
|
allSendsSuccessed |= sendHomeAssistantDiscoveryTopic(group, "rate_per_time_unit", "Rate (" + rateUnit + ")", "swap-vertical", rateUnit, "", "measurement", "", qos);
|
||||||
allSendsSuccessed |= sendHomeAssistantDiscoveryTopic(group, "rate_per_digitalization_round", "Change since last digitalization round", "arrow-expand-vertical", valueUnit, "", "measurement", "", qos); // correctly the Unit is Unit/Interval!
|
allSendsSuccessed |= sendHomeAssistantDiscoveryTopic(group, "rate_per_Digitization_round", "Change since last Digitization round", "arrow-expand-vertical", valueUnit, "", "measurement", "", qos); // correctly the Unit is Unit/Interval!
|
||||||
allSendsSuccessed |= sendHomeAssistantDiscoveryTopic(group, "timestamp", "Timestamp", "clock-time-eight-outline", "", "timestamp", "", "diagnostic", qos);
|
allSendsSuccessed |= sendHomeAssistantDiscoveryTopic(group, "timestamp", "Timestamp", "clock-time-eight-outline", "", "timestamp", "", "diagnostic", qos);
|
||||||
allSendsSuccessed |= sendHomeAssistantDiscoveryTopic(group, "json", "JSON", "code-json", "", "", "", "diagnostic", qos);
|
allSendsSuccessed |= sendHomeAssistantDiscoveryTopic(group, "json", "JSON", "code-json", "", "", "", "diagnostic", qos);
|
||||||
allSendsSuccessed |= sendHomeAssistantDiscoveryTopic(group, "problem", "Problem", "alert-outline", "", "problem", "", "", qos); // Special binary sensor which is based on error topic
|
allSendsSuccessed |= sendHomeAssistantDiscoveryTopic(group, "problem", "Problem", "alert-outline", "", "problem", "", "", qos); // Special binary sensor which is based on error topic
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ std::string getTimeUnit(void);
|
|||||||
void GotConnected(std::string maintopic, bool SetRetainFlag);
|
void GotConnected(std::string maintopic, bool SetRetainFlag);
|
||||||
esp_err_t sendDiscovery_and_static_Topics(void);
|
esp_err_t sendDiscovery_and_static_Topics(void);
|
||||||
|
|
||||||
|
std::string createNodeId(std::string &topic);
|
||||||
|
|
||||||
#endif //SERVERMQTT_H
|
#endif //SERVERMQTT_H
|
||||||
#endif //ENABLE_MQTT
|
#endif //ENABLE_MQTT
|
||||||
@@ -206,6 +206,7 @@ bool CTfLiteClass::MakeAllocate()
|
|||||||
|
|
||||||
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "CTfLiteClass::MakeAllocate");
|
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "CTfLiteClass::MakeAllocate");
|
||||||
this->interpreter = new tflite::MicroInterpreter(this->model, resolver, this->tensor_arena, this->kTensorArenaSize);
|
this->interpreter = new tflite::MicroInterpreter(this->model, resolver, this->tensor_arena, this->kTensorArenaSize);
|
||||||
|
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "Trying to load the model. If it crashes here, it ist most likely due to a corrupted model!");
|
||||||
|
|
||||||
if (this->interpreter)
|
if (this->interpreter)
|
||||||
{
|
{
|
||||||
|
|||||||
7
code/components/jomjol_webhook/CMakeLists.txt
Normal file
7
code/components/jomjol_webhook/CMakeLists.txt
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
FILE(GLOB_RECURSE app_sources ${CMAKE_CURRENT_SOURCE_DIR}/*.*)
|
||||||
|
|
||||||
|
idf_component_register(SRCS ${app_sources}
|
||||||
|
INCLUDE_DIRS "."
|
||||||
|
REQUIRES esp_http_client jomjol_logfile jomjol_flowcontroll json)
|
||||||
|
|
||||||
|
|
||||||
170
code/components/jomjol_webhook/interface_webhook.cpp
Normal file
170
code/components/jomjol_webhook/interface_webhook.cpp
Normal file
@@ -0,0 +1,170 @@
|
|||||||
|
#ifdef ENABLE_WEBHOOK
|
||||||
|
#include "interface_webhook.h"
|
||||||
|
|
||||||
|
#include "esp_log.h"
|
||||||
|
#include <time.h>
|
||||||
|
#include "ClassLogFile.h"
|
||||||
|
#include "esp_http_client.h"
|
||||||
|
#include "time_sntp.h"
|
||||||
|
#include "../../include/defines.h"
|
||||||
|
#include <cJSON.h>
|
||||||
|
#include <ClassFlowDefineTypes.h>
|
||||||
|
|
||||||
|
|
||||||
|
static const char *TAG = "WEBHOOK";
|
||||||
|
|
||||||
|
std::string _webhookURI;
|
||||||
|
std::string _webhookApiKey;
|
||||||
|
long _lastTimestamp;
|
||||||
|
|
||||||
|
static esp_err_t http_event_handler(esp_http_client_event_t *evt);
|
||||||
|
|
||||||
|
void WebhookInit(std::string _uri, std::string _apiKey)
|
||||||
|
{
|
||||||
|
_webhookURI = _uri;
|
||||||
|
_webhookApiKey = _apiKey;
|
||||||
|
_lastTimestamp = 0L;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool WebhookPublish(std::vector<NumberPost*>* numbers)
|
||||||
|
{
|
||||||
|
bool numbersWithError = false;
|
||||||
|
cJSON *jsonArray = cJSON_CreateArray();
|
||||||
|
|
||||||
|
for (int i = 0; i < (*numbers).size(); ++i)
|
||||||
|
{
|
||||||
|
string timezw = "";
|
||||||
|
char buffer[80];
|
||||||
|
time_t &lastPreValue = (*numbers)[i]->timeStampLastPreValue;
|
||||||
|
struct tm* timeinfo = localtime(&lastPreValue);
|
||||||
|
_lastTimestamp = static_cast<long>(lastPreValue);
|
||||||
|
strftime(buffer, 80, PREVALUE_TIME_FORMAT_OUTPUT, timeinfo);
|
||||||
|
timezw = std::string(buffer);
|
||||||
|
|
||||||
|
cJSON *json = cJSON_CreateObject();
|
||||||
|
cJSON_AddStringToObject(json, "timestamp", timezw.c_str());
|
||||||
|
cJSON_AddStringToObject(json, "timestampLong", std::to_string(_lastTimestamp).c_str());
|
||||||
|
cJSON_AddStringToObject(json, "name", (*numbers)[i]->name.c_str());
|
||||||
|
cJSON_AddStringToObject(json, "rawValue", (*numbers)[i]->ReturnRawValue.c_str());
|
||||||
|
cJSON_AddStringToObject(json, "value", (*numbers)[i]->ReturnValue.c_str());
|
||||||
|
cJSON_AddStringToObject(json, "preValue", (*numbers)[i]->ReturnPreValue.c_str());
|
||||||
|
cJSON_AddStringToObject(json, "rate", (*numbers)[i]->ReturnRateValue.c_str());
|
||||||
|
cJSON_AddStringToObject(json, "changeAbsolute", (*numbers)[i]->ReturnChangeAbsolute.c_str());
|
||||||
|
cJSON_AddStringToObject(json, "error", (*numbers)[i]->ErrorMessageText.c_str());
|
||||||
|
|
||||||
|
cJSON_AddItemToArray(jsonArray, json);
|
||||||
|
|
||||||
|
if ((*numbers)[i]->ErrorMessage) {
|
||||||
|
numbersWithError = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
char *jsonString = cJSON_PrintUnformatted(jsonArray);
|
||||||
|
|
||||||
|
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "sending webhook");
|
||||||
|
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "sending JSON: " + std::string(jsonString));
|
||||||
|
|
||||||
|
char response_buffer[MAX_HTTP_OUTPUT_BUFFER] = {0};
|
||||||
|
esp_http_client_config_t http_config = {
|
||||||
|
.url = _webhookURI.c_str(),
|
||||||
|
.user_agent = "ESP32 Meter reader",
|
||||||
|
.method = HTTP_METHOD_POST,
|
||||||
|
.event_handler = http_event_handler,
|
||||||
|
.buffer_size = MAX_HTTP_OUTPUT_BUFFER,
|
||||||
|
.user_data = response_buffer
|
||||||
|
};
|
||||||
|
|
||||||
|
esp_http_client_handle_t http_client = esp_http_client_init(&http_config);
|
||||||
|
|
||||||
|
esp_http_client_set_header(http_client, "Content-Type", "application/json");
|
||||||
|
esp_http_client_set_header(http_client, "APIKEY", _webhookApiKey.c_str());
|
||||||
|
|
||||||
|
ESP_ERROR_CHECK(esp_http_client_set_post_field(http_client, jsonString, strlen(jsonString)));
|
||||||
|
|
||||||
|
esp_err_t err = ESP_ERROR_CHECK_WITHOUT_ABORT(esp_http_client_perform(http_client));
|
||||||
|
|
||||||
|
if(err == ESP_OK) {
|
||||||
|
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "HTTP request was performed");
|
||||||
|
int status_code = esp_http_client_get_status_code(http_client);
|
||||||
|
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "HTTP status code: " + std::to_string(status_code));
|
||||||
|
} else {
|
||||||
|
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "HTTP request failed");
|
||||||
|
}
|
||||||
|
|
||||||
|
esp_http_client_cleanup(http_client);
|
||||||
|
cJSON_Delete(jsonArray);
|
||||||
|
free(jsonString);
|
||||||
|
return numbersWithError;
|
||||||
|
}
|
||||||
|
|
||||||
|
void WebhookUploadPic(ImageData *Img) {
|
||||||
|
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "Starting WebhookUploadPic");
|
||||||
|
|
||||||
|
std::string fullURI = _webhookURI + "?timestamp=" + std::to_string(_lastTimestamp);
|
||||||
|
char response_buffer[MAX_HTTP_OUTPUT_BUFFER] = {0};
|
||||||
|
esp_http_client_config_t http_config = {
|
||||||
|
.url = fullURI.c_str(),
|
||||||
|
.user_agent = "ESP32 Meter reader",
|
||||||
|
.method = HTTP_METHOD_PUT,
|
||||||
|
.event_handler = http_event_handler,
|
||||||
|
.buffer_size = MAX_HTTP_OUTPUT_BUFFER,
|
||||||
|
.user_data = response_buffer
|
||||||
|
};
|
||||||
|
|
||||||
|
esp_http_client_handle_t http_client = esp_http_client_init(&http_config);
|
||||||
|
|
||||||
|
esp_http_client_set_header(http_client, "Content-Type", "image/jpeg");
|
||||||
|
esp_http_client_set_header(http_client, "APIKEY", _webhookApiKey.c_str());
|
||||||
|
|
||||||
|
esp_err_t err = ESP_ERROR_CHECK_WITHOUT_ABORT(esp_http_client_set_post_field(http_client, (const char *)Img->data, Img->size));
|
||||||
|
|
||||||
|
err = ESP_ERROR_CHECK_WITHOUT_ABORT(esp_http_client_perform(http_client));
|
||||||
|
|
||||||
|
if (err == ESP_OK) {
|
||||||
|
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "HTTP PUT request was performed successfully");
|
||||||
|
int status_code = esp_http_client_get_status_code(http_client);
|
||||||
|
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "HTTP status code: " + std::to_string(status_code));
|
||||||
|
} else {
|
||||||
|
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "HTTP PUT request failed");
|
||||||
|
}
|
||||||
|
|
||||||
|
esp_http_client_cleanup(http_client);
|
||||||
|
|
||||||
|
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "WebhookUploadPic finished");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static esp_err_t http_event_handler(esp_http_client_event_t *evt)
|
||||||
|
{
|
||||||
|
switch(evt->event_id)
|
||||||
|
{
|
||||||
|
case HTTP_EVENT_ERROR:
|
||||||
|
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "HTTP Client Error encountered");
|
||||||
|
break;
|
||||||
|
case HTTP_EVENT_ON_CONNECTED:
|
||||||
|
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "HTTP Client connected");
|
||||||
|
ESP_LOGI(TAG, "HTTP Client Connected");
|
||||||
|
break;
|
||||||
|
case HTTP_EVENT_HEADERS_SENT:
|
||||||
|
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "HTTP Client sent all request headers");
|
||||||
|
break;
|
||||||
|
case HTTP_EVENT_ON_HEADER:
|
||||||
|
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "Header: key=" + std::string(evt->header_key) + ", value=" + std::string(evt->header_value));
|
||||||
|
break;
|
||||||
|
case HTTP_EVENT_ON_DATA:
|
||||||
|
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "HTTP Client data recevied: len=" + std::to_string(evt->data_len));
|
||||||
|
break;
|
||||||
|
case HTTP_EVENT_ON_FINISH:
|
||||||
|
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "HTTP Client finished");
|
||||||
|
break;
|
||||||
|
case HTTP_EVENT_DISCONNECTED:
|
||||||
|
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "HTTP Client Disconnected");
|
||||||
|
break;
|
||||||
|
case HTTP_EVENT_REDIRECT:
|
||||||
|
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "HTTP Redirect");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return ESP_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //ENABLE_WEBHOOK
|
||||||
17
code/components/jomjol_webhook/interface_webhook.h
Normal file
17
code/components/jomjol_webhook/interface_webhook.h
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
#ifdef ENABLE_WEBHOOK
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#ifndef INTERFACE_WEBHOOK_H
|
||||||
|
#define INTERFACE_WEBHOOK_H
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <map>
|
||||||
|
#include <functional>
|
||||||
|
#include <ClassFlowDefineTypes.h>
|
||||||
|
|
||||||
|
void WebhookInit(std::string _webhookURI, std::string _apiKey);
|
||||||
|
bool WebhookPublish(std::vector<NumberPost*>* numbers);
|
||||||
|
void WebhookUploadPic(ImageData *Img);
|
||||||
|
|
||||||
|
#endif //INTERFACE_WEBHOOK_H
|
||||||
|
#endif //ENABLE_WEBHOOK
|
||||||
@@ -480,7 +480,8 @@ static void event_handler(void* arg, esp_event_base_t event_base, int32_t event_
|
|||||||
if (WIFIReconnectCnt >= 10) {
|
if (WIFIReconnectCnt >= 10) {
|
||||||
WIFIReconnectCnt = 0;
|
WIFIReconnectCnt = 0;
|
||||||
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Disconnected, multiple reconnect attempts failed (" +
|
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Disconnected, multiple reconnect attempts failed (" +
|
||||||
std::to_string(disconn->reason) + "), still retrying...");
|
std::to_string(disconn->reason) + "), retrying after 5s");
|
||||||
|
vTaskDelay(5000 / portTICK_PERIOD_MS); // Delay between the reconnections
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_CONNECTED)
|
else if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_CONNECTED)
|
||||||
|
|||||||
7
code/components/openmetrics/CMakeLists.txt
Normal file
7
code/components/openmetrics/CMakeLists.txt
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
FILE(GLOB_RECURSE app_sources ${CMAKE_CURRENT_SOURCE_DIR}/*.*)
|
||||||
|
|
||||||
|
idf_component_register(SRCS ${app_sources}
|
||||||
|
INCLUDE_DIRS "."
|
||||||
|
REQUIRES jomjol_image_proc)
|
||||||
|
|
||||||
|
|
||||||
43
code/components/openmetrics/openmetrics.cpp
Normal file
43
code/components/openmetrics/openmetrics.cpp
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
#include "openmetrics.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* create a singe metric from the given input
|
||||||
|
**/
|
||||||
|
std::string createMetric(const std::string &metricName, const std::string &help, const std::string &type, const std::string &value)
|
||||||
|
{
|
||||||
|
return "# HELP " + metricName + " " + help + "\n" +
|
||||||
|
"# TYPE " + metricName + " " + type + "\n" +
|
||||||
|
metricName + " " + value + "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate the MetricFamily from all available sequences
|
||||||
|
* @returns the string containing the text wire format of the MetricFamily
|
||||||
|
**/
|
||||||
|
std::string createSequenceMetrics(std::string prefix, const std::vector<NumberPost *> &numbers)
|
||||||
|
{
|
||||||
|
std::string res;
|
||||||
|
|
||||||
|
for (const auto &number : numbers)
|
||||||
|
{
|
||||||
|
// only valid data is reported (https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#missing-data)
|
||||||
|
if (number->ReturnValue.length() > 0)
|
||||||
|
{
|
||||||
|
auto label = number->name;
|
||||||
|
|
||||||
|
// except newline, double quote, and backslash (https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#abnf)
|
||||||
|
// to keep it simple, these characters are just removed from the label
|
||||||
|
replaceAll(label, "\\", "");
|
||||||
|
replaceAll(label, "\"", "");
|
||||||
|
replaceAll(label, "\n", "");
|
||||||
|
res += prefix + "_flow_value{sequence=\"" + label + "\"} " + number->ReturnValue + "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// prepend metadata if a valid metric was created
|
||||||
|
if (res.length() > 0)
|
||||||
|
{
|
||||||
|
res = "# HELP " + prefix + "_flow_value current value of meter readout\n# TYPE " + prefix + "_flow_value gauge\n" + res;
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
15
code/components/openmetrics/openmetrics.h
Normal file
15
code/components/openmetrics/openmetrics.h
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef OPENMETRICS_H
|
||||||
|
#define OPENMETRICS_H
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <fstream>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "ClassFlowDefineTypes.h"
|
||||||
|
|
||||||
|
std::string createMetric(const std::string &metricName, const std::string &help, const std::string &type, const std::string &value);
|
||||||
|
std::string createSequenceMetrics(std::string prefix, const std::vector<NumberPost *> &numbers);
|
||||||
|
|
||||||
|
#endif // OPENMETRICS_H
|
||||||
@@ -1,3 +1,16 @@
|
|||||||
manifest_hash: 63f5c6c9f0bcebc7b9ca12d2aa8b26b2c5f5218d377dc4b2375d9b9ca1df7815
|
dependencies:
|
||||||
|
espressif/esp-nn:
|
||||||
|
component_hash: b32869798bdb40dec6bc99caca48cd65d42f8a9f506b9ab9c598a076f891ede9
|
||||||
|
source:
|
||||||
|
pre_release: true
|
||||||
|
service_url: https://api.components.espressif.com/
|
||||||
|
type: service
|
||||||
|
version: 1.0.2
|
||||||
|
idf:
|
||||||
|
component_hash: null
|
||||||
|
source:
|
||||||
|
type: idf
|
||||||
|
version: 5.3.0
|
||||||
|
manifest_hash: 6995555b9b41e897235448c868ca92c0c3401fd2ff90df084be9bb8629958f2c
|
||||||
target: esp32
|
target: esp32
|
||||||
version: 1.0.0
|
version: 1.0.0
|
||||||
@@ -58,22 +58,11 @@
|
|||||||
//#define CONFIG_IDF_TARGET_ARCH_XTENSA //not needed with platformio/espressif32 @ 5.2.0
|
//#define CONFIG_IDF_TARGET_ARCH_XTENSA //not needed with platformio/espressif32 @ 5.2.0
|
||||||
|
|
||||||
|
|
||||||
//Statusled + ClassControllCamera
|
|
||||||
#define BLINK_GPIO GPIO_NUM_33 // PIN for red board LED
|
|
||||||
|
|
||||||
|
|
||||||
//ClassControllCamera
|
//ClassControllCamera
|
||||||
#define FLASH_GPIO GPIO_NUM_4 // PIN for flashlight LED
|
|
||||||
#define USE_PWM_LEDFLASH // if __LEDGLOBAL is defined, a global variable is used for LED control, otherwise locally and each time a new
|
|
||||||
#define CAM_LIVESTREAM_REFRESHRATE 500 // Camera livestream feature: Waiting time in milliseconds to refresh image
|
#define CAM_LIVESTREAM_REFRESHRATE 500 // Camera livestream feature: Waiting time in milliseconds to refresh image
|
||||||
// #define GRAYSCALE_AS_DEFAULT
|
// #define GRAYSCALE_AS_DEFAULT
|
||||||
|
|
||||||
|
|
||||||
//ClassControllCamera + ClassFlowTakeImage
|
|
||||||
#define CAMERA_MODEL_AI_THINKER
|
|
||||||
#define BOARD_ESP32CAM_AITHINKER
|
|
||||||
|
|
||||||
|
|
||||||
//server_GPIO
|
//server_GPIO
|
||||||
#define __LEDGLOBAL
|
#define __LEDGLOBAL
|
||||||
|
|
||||||
@@ -105,7 +94,7 @@
|
|||||||
#define LOGFILE_LAST_PART_BYTES 80 * 1024 // 80 kBytes // Size of partial log file to return
|
#define LOGFILE_LAST_PART_BYTES 80 * 1024 // 80 kBytes // Size of partial log file to return
|
||||||
|
|
||||||
#define SERVER_FILER_SCRATCH_BUFSIZE 4096
|
#define SERVER_FILER_SCRATCH_BUFSIZE 4096
|
||||||
#define SERVER_HELPER_SCRATCH_BUFSIZE 8192
|
#define SERVER_HELPER_SCRATCH_BUFSIZE 4096
|
||||||
#define SERVER_OTA_SCRATCH_BUFSIZE 1024
|
#define SERVER_OTA_SCRATCH_BUFSIZE 1024
|
||||||
|
|
||||||
|
|
||||||
@@ -187,15 +176,13 @@
|
|||||||
|
|
||||||
//ClassFlowCNNGeneral
|
//ClassFlowCNNGeneral
|
||||||
#define Analog_error 3
|
#define Analog_error 3
|
||||||
|
|
||||||
#define AnalogToDigtalFehler 0.8
|
#define AnalogToDigtalFehler 0.8
|
||||||
#define Digital_Uncertainty 0.2
|
#define Digit_Uncertainty 0.2
|
||||||
#define DigitalBand 3
|
#define DigitBand 3
|
||||||
#define Digital_Transition_Range_Predecessor 2
|
#define Digit_Transition_Range_Predecessor 2
|
||||||
#define Digital_Transition_Area_Predecessor 0.7 // 9.3 - 0.7
|
#define Digit_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 Digit_Transition_Area_Forward 9.7 // Pre-run zero crossing only happens from approx. 9.7 onwards
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//#define DEBUG_DETAIL_ON
|
//#define DEBUG_DETAIL_ON
|
||||||
|
|
||||||
@@ -210,117 +197,124 @@
|
|||||||
//// Conditionnal definitions ////
|
//// 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
|
// ******* Board type
|
||||||
#ifdef BOARD_WROVER_KIT // WROVER-KIT PIN Map
|
#if defined(BOARD_WROVER_KIT) // WROVER-KIT PIN Map
|
||||||
|
// SD card (operated with SDMMC peripheral)
|
||||||
|
//-------------------------------------------------
|
||||||
|
#define GPIO_SDCARD_CLK GPIO_NUM_14
|
||||||
|
#define GPIO_SDCARD_CMD GPIO_NUM_15
|
||||||
|
#define GPIO_SDCARD_D0 GPIO_NUM_2
|
||||||
|
#ifndef __SD_USE_ONE_LINE_MODE__
|
||||||
|
#define GPIO_SDCARD_D1 GPIO_NUM_4
|
||||||
|
#define GPIO_SDCARD_D2 GPIO_NUM_12
|
||||||
|
#define GPIO_SDCARD_D3 GPIO_NUM_13
|
||||||
|
#else
|
||||||
|
#define GPIO_SDCARD_D1 GPIO_NUM_NC
|
||||||
|
#define GPIO_SDCARD_D2 GPIO_NUM_NC
|
||||||
|
#define GPIO_SDCARD_D3 GPIO_NUM_13
|
||||||
|
#endif
|
||||||
|
|
||||||
#define CAM_PIN_PWDN -1 //power down is not used
|
#define CAM_PIN_PWDN GPIO_NUM_NC //power down is not used
|
||||||
#define CAM_PIN_RESET -1 //software reset will be performed
|
#define CAM_PIN_RESET GPIO_NUM_NC //software reset will be performed
|
||||||
#define CAM_PIN_XCLK 21
|
#define CAM_PIN_XCLK GPIO_NUM_21
|
||||||
#define CAM_PIN_SIOD 26
|
#define CAM_PIN_SIOD GPIO_NUM_26
|
||||||
#define CAM_PIN_SIOC 27
|
#define CAM_PIN_SIOC GPIO_NUM_27
|
||||||
|
|
||||||
#define CAM_PIN_D7 35
|
#define CAM_PIN_D7 GPIO_NUM_35
|
||||||
#define CAM_PIN_D6 34
|
#define CAM_PIN_D6 GPIO_NUM_34
|
||||||
#define CAM_PIN_D5 39
|
#define CAM_PIN_D5 GPIO_NUM_39
|
||||||
#define CAM_PIN_D4 36
|
#define CAM_PIN_D4 GPIO_NUM_36
|
||||||
#define CAM_PIN_D3 19
|
#define CAM_PIN_D3 GPIO_NUM_19
|
||||||
#define CAM_PIN_D2 18
|
#define CAM_PIN_D2 GPIO_NUM_18
|
||||||
#define CAM_PIN_D1 5
|
#define CAM_PIN_D1 GPIO_NUM_5
|
||||||
#define CAM_PIN_D0 4
|
#define CAM_PIN_D0 GPIO_NUM_4
|
||||||
#define CAM_PIN_VSYNC 25
|
#define CAM_PIN_VSYNC GPIO_NUM_25
|
||||||
#define CAM_PIN_HREF 23
|
#define CAM_PIN_HREF GPIO_NUM_23
|
||||||
#define CAM_PIN_PCLK 22
|
#define CAM_PIN_PCLK GPIO_NUM_22
|
||||||
|
|
||||||
#endif //// WROVER-KIT PIN Map
|
//Statusled + ClassControllCamera
|
||||||
|
#define BLINK_GPIO GPIO_NUM_33 // PIN for red board LED, On the board the LED is on the IO2, but it is used for the SD
|
||||||
|
|
||||||
|
//ClassControllCamera
|
||||||
|
#define FLASH_GPIO GPIO_NUM_12 // PIN for flashlight LED
|
||||||
|
#define USE_PWM_LEDFLASH // if __LEDGLOBAL is defined, a global variable is used for LED control, otherwise locally and each time a new
|
||||||
|
|
||||||
|
#elif defined(BOARD_M5STACK_PSRAM) // M5STACK PSRAM PIN Map
|
||||||
|
#define CAM_PIN_PWDN GPIO_NUM_NC
|
||||||
|
#define CAM_PIN_RESET GPIO_NUM_15
|
||||||
|
#define CAM_PIN_XCLK GPIO_NUM_27
|
||||||
|
#define CAM_PIN_SIOD GPIO_NUM_25
|
||||||
|
#define CAM_PIN_SIOC GPIO_NUM_23
|
||||||
|
|
||||||
|
#define CAM_PIN_D7 GPIO_NUM_19
|
||||||
|
#define CAM_PIN_D6 GPIO_NUM_36
|
||||||
|
#define CAM_PIN_D5 GPIO_NUM_18
|
||||||
|
#define CAM_PIN_D4 GPIO_NUM_39
|
||||||
|
#define CAM_PIN_D3 GPIO_NUM_5
|
||||||
|
#define CAM_PIN_D2 GPIO_NUM_34
|
||||||
|
#define CAM_PIN_D1 GPIO_NUM_35
|
||||||
|
#define CAM_PIN_D0 GPIO_NUM_32
|
||||||
|
#define CAM_PIN_VSYNC GPIO_NUM_22
|
||||||
|
#define CAM_PIN_HREF GPIO_NUM_26
|
||||||
|
#define CAM_PIN_PCLK GPIO_NUM_21
|
||||||
|
|
||||||
|
//Statusled + ClassControllCamera
|
||||||
|
#define BLINK_GPIO GPIO_NUM_33 // PIN for red board LED
|
||||||
|
|
||||||
|
//ClassControllCamera
|
||||||
|
#define FLASH_GPIO GPIO_NUM_4 // PIN for flashlight LED
|
||||||
|
#define USE_PWM_LEDFLASH // if __LEDGLOBAL is defined, a global variable is used for LED control, otherwise locally and each time a new
|
||||||
|
|
||||||
|
|
||||||
#ifdef BOARD_ESP32CAM_AITHINKER // ESP32Cam (AiThinker) PIN Map
|
#elif defined(BOARD_ESP32CAM_AITHINKER) // ESP32Cam (AiThinker) PIN Map
|
||||||
|
// SD card (operated with SDMMC peripheral)
|
||||||
|
//-------------------------------------------------
|
||||||
|
#define GPIO_SDCARD_CLK GPIO_NUM_14
|
||||||
|
#define GPIO_SDCARD_CMD GPIO_NUM_15
|
||||||
|
#define GPIO_SDCARD_D0 GPIO_NUM_2
|
||||||
|
#ifndef __SD_USE_ONE_LINE_MODE__
|
||||||
|
#define GPIO_SDCARD_D1 GPIO_NUM_4
|
||||||
|
#define GPIO_SDCARD_D2 GPIO_NUM_12
|
||||||
|
#define GPIO_SDCARD_D3 GPIO_NUM_13
|
||||||
|
#else
|
||||||
|
#define GPIO_SDCARD_D1 GPIO_NUM_NC
|
||||||
|
#define GPIO_SDCARD_D2 GPIO_NUM_NC
|
||||||
|
#define GPIO_SDCARD_D3 GPIO_NUM_13
|
||||||
|
#endif
|
||||||
|
|
||||||
#define CAM_PIN_PWDN 32
|
#define CAM_PIN_PWDN GPIO_NUM_32
|
||||||
#define CAM_PIN_RESET -1 //software reset will be performed
|
#define CAM_PIN_RESET GPIO_NUM_NC //software reset will be performed
|
||||||
#define CAM_PIN_XCLK 0
|
#define CAM_PIN_XCLK GPIO_NUM_0
|
||||||
#define CAM_PIN_SIOD 26
|
#define CAM_PIN_SIOD GPIO_NUM_26
|
||||||
#define CAM_PIN_SIOC 27
|
#define CAM_PIN_SIOC GPIO_NUM_27
|
||||||
|
|
||||||
#define CAM_PIN_D7 35
|
#define CAM_PIN_D7 GPIO_NUM_35
|
||||||
#define CAM_PIN_D6 34
|
#define CAM_PIN_D6 GPIO_NUM_34
|
||||||
#define CAM_PIN_D5 39
|
#define CAM_PIN_D5 GPIO_NUM_39
|
||||||
#define CAM_PIN_D4 36
|
#define CAM_PIN_D4 GPIO_NUM_36
|
||||||
#define CAM_PIN_D3 21
|
#define CAM_PIN_D3 GPIO_NUM_21
|
||||||
#define CAM_PIN_D2 19
|
#define CAM_PIN_D2 GPIO_NUM_19
|
||||||
#define CAM_PIN_D1 18
|
#define CAM_PIN_D1 GPIO_NUM_18
|
||||||
#define CAM_PIN_D0 5
|
#define CAM_PIN_D0 GPIO_NUM_5
|
||||||
#define CAM_PIN_VSYNC 25
|
#define CAM_PIN_VSYNC GPIO_NUM_25
|
||||||
#define CAM_PIN_HREF 23
|
#define CAM_PIN_HREF GPIO_NUM_23
|
||||||
#define CAM_PIN_PCLK 22
|
#define CAM_PIN_PCLK GPIO_NUM_22
|
||||||
|
|
||||||
|
//Statusled + ClassControllCamera
|
||||||
|
#define BLINK_GPIO GPIO_NUM_33 // PIN for red board LED
|
||||||
|
|
||||||
|
//ClassControllCamera
|
||||||
|
#define FLASH_GPIO GPIO_NUM_4 // PIN for flashlight LED
|
||||||
|
#define USE_PWM_LEDFLASH // if __LEDGLOBAL is defined, a global variable is used for LED control, otherwise locally and each time a new
|
||||||
|
|
||||||
|
#else
|
||||||
|
#error "Board not selected"
|
||||||
|
#endif //Board PIN Map
|
||||||
|
|
||||||
#endif // ESP32Cam (AiThinker) PIN Map
|
|
||||||
|
|
||||||
// ******* LED definition
|
// ******* LED definition
|
||||||
#ifdef USE_PWM_LEDFLASH
|
#ifdef USE_PWM_LEDFLASH
|
||||||
|
|
||||||
//// PWM für Flash-LED
|
//// PWM für Flash-LED
|
||||||
#define LEDC_TIMER LEDC_TIMER_1 // LEDC_TIMER_0
|
#define LEDC_TIMER LEDC_TIMER_1 // LEDC_TIMER_0
|
||||||
#define LEDC_MODE LEDC_LOW_SPEED_MODE
|
#define LEDC_MODE LEDC_LOW_SPEED_MODE
|
||||||
@@ -332,6 +326,7 @@
|
|||||||
|
|
||||||
#endif //USE_PWM_LEDFLASH
|
#endif //USE_PWM_LEDFLASH
|
||||||
|
|
||||||
|
|
||||||
//softAP
|
//softAP
|
||||||
#ifdef ENABLE_SOFTAP
|
#ifdef ENABLE_SOFTAP
|
||||||
#define EXAMPLE_ESP_WIFI_SSID "AI-on-the-Edge"
|
#define EXAMPLE_ESP_WIFI_SSID "AI-on-the-Edge"
|
||||||
|
|||||||
@@ -11,10 +11,13 @@
|
|||||||
#include "esp_chip_info.h"
|
#include "esp_chip_info.h"
|
||||||
|
|
||||||
// SD-Card ////////////////////
|
// SD-Card ////////////////////
|
||||||
#include "sdcard_init.h"
|
|
||||||
#include "esp_vfs_fat.h"
|
#include "esp_vfs_fat.h"
|
||||||
#include "ffconf.h"
|
#include "ffconf.h"
|
||||||
#include "driver/sdmmc_host.h"
|
#include "driver/sdmmc_host.h"
|
||||||
|
|
||||||
|
#if (ESP_IDF_VERSION <= ESP_IDF_VERSION_VAL(5, 1, 2))
|
||||||
|
#include "sdcard_init.h"
|
||||||
|
#endif
|
||||||
///////////////////////////////
|
///////////////////////////////
|
||||||
|
|
||||||
#include "ClassLogFile.h"
|
#include "ClassLogFile.h"
|
||||||
@@ -91,10 +94,10 @@ static const char *TAG = "MAIN";
|
|||||||
|
|
||||||
#define MOUNT_POINT "/sdcard"
|
#define MOUNT_POINT "/sdcard"
|
||||||
|
|
||||||
|
|
||||||
bool Init_NVS_SDCard()
|
bool Init_NVS_SDCard()
|
||||||
{
|
{
|
||||||
esp_err_t ret = nvs_flash_init();
|
esp_err_t ret = nvs_flash_init();
|
||||||
|
|
||||||
if (ret == ESP_ERR_NVS_NO_FREE_PAGES) {
|
if (ret == ESP_ERR_NVS_NO_FREE_PAGES) {
|
||||||
ESP_ERROR_CHECK(nvs_flash_erase());
|
ESP_ERROR_CHECK(nvs_flash_erase());
|
||||||
ret = nvs_flash_init();
|
ret = nvs_flash_init();
|
||||||
@@ -109,11 +112,22 @@ bool Init_NVS_SDCard()
|
|||||||
sdmmc_slot_config_t slot_config = SDMMC_SLOT_CONFIG_DEFAULT();
|
sdmmc_slot_config_t slot_config = SDMMC_SLOT_CONFIG_DEFAULT();
|
||||||
|
|
||||||
// Set bus width to use:
|
// Set bus width to use:
|
||||||
#ifdef __SD_USE_ONE_LINE_MODE__
|
#ifdef __SD_USE_ONE_LINE_MODE__
|
||||||
slot_config.width = 1;
|
slot_config.width = 1;
|
||||||
#else
|
#ifdef SOC_SDMMC_USE_GPIO_MATRIX
|
||||||
|
slot_config.clk = GPIO_SDCARD_CLK;
|
||||||
|
slot_config.cmd = GPIO_SDCARD_CMD;
|
||||||
|
slot_config.d0 = GPIO_SDCARD_D0;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#else
|
||||||
slot_config.width = 4;
|
slot_config.width = 4;
|
||||||
#endif
|
#ifdef SOC_SDMMC_USE_GPIO_MATRIX
|
||||||
|
slot_config.d1 = GPIO_SDCARD_D1;
|
||||||
|
slot_config.d2 = GPIO_SDCARD_D2;
|
||||||
|
slot_config.d3 = GPIO_SDCARD_D3;
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
// Enable internal pullups on enabled pins. The internal pullups
|
// Enable internal pullups on enabled pins. The internal pullups
|
||||||
// are insufficient however, please make sure 10k external pullups are
|
// are insufficient however, please make sure 10k external pullups are
|
||||||
@@ -125,7 +139,7 @@ bool Init_NVS_SDCard()
|
|||||||
// dies führt jedoch bei schlechten Kopien des AI_THINKER Boards
|
// dies führt jedoch bei schlechten Kopien des AI_THINKER Boards
|
||||||
// zu Problemen mit der SD Initialisierung und eventuell sogar zur reboot-loops.
|
// zu Problemen mit der SD Initialisierung und eventuell sogar zur reboot-loops.
|
||||||
// Um diese Probleme zu kompensieren, wird der PullUp manuel gesetzt.
|
// Um diese Probleme zu kompensieren, wird der PullUp manuel gesetzt.
|
||||||
gpio_set_pull_mode(GPIO_NUM_13, GPIO_PULLUP_ONLY); // HS2_D3
|
gpio_set_pull_mode(GPIO_SDCARD_D3, GPIO_PULLUP_ONLY); // HS2_D3
|
||||||
|
|
||||||
// Options for mounting the filesystem.
|
// Options for mounting the filesystem.
|
||||||
// If format_if_mount_failed is set to true, SD card will be partitioned and
|
// If format_if_mount_failed is set to true, SD card will be partitioned and
|
||||||
@@ -144,7 +158,11 @@ bool Init_NVS_SDCard()
|
|||||||
// Note: esp_vfs_fat_sdmmc_mount is an all-in-one convenience function.
|
// Note: esp_vfs_fat_sdmmc_mount is an all-in-one convenience function.
|
||||||
// Please check its source code and implement error recovery when developing
|
// Please check its source code and implement error recovery when developing
|
||||||
// production applications.
|
// production applications.
|
||||||
|
#if (ESP_IDF_VERSION <= ESP_IDF_VERSION_VAL(5, 1, 2))
|
||||||
ret = esp_vfs_fat_sdmmc_mount_mh(mount_point, &host, &slot_config, &mount_config, &card);
|
ret = esp_vfs_fat_sdmmc_mount_mh(mount_point, &host, &slot_config, &mount_config, &card);
|
||||||
|
#else
|
||||||
|
ret = esp_vfs_fat_sdmmc_mount(mount_point, &host, &slot_config, &mount_config, &card);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (ret != ESP_OK) {
|
if (ret != ESP_OK) {
|
||||||
if (ret == ESP_FAIL) {
|
if (ret == ESP_FAIL) {
|
||||||
@@ -167,7 +185,6 @@ bool Init_NVS_SDCard()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
extern "C" void app_main(void)
|
extern "C" void app_main(void)
|
||||||
{
|
{
|
||||||
//#ifdef CONFIG_HEAP_TRACING_STANDALONE
|
//#ifdef CONFIG_HEAP_TRACING_STANDALONE
|
||||||
@@ -191,7 +208,6 @@ extern "C" void app_main(void)
|
|||||||
// ********************************************
|
// ********************************************
|
||||||
ESP_LOGI(TAG, "\n\n\n\n================ Start app_main =================");
|
ESP_LOGI(TAG, "\n\n\n\n================ Start app_main =================");
|
||||||
|
|
||||||
|
|
||||||
// Init SD card
|
// Init SD card
|
||||||
// ********************************************
|
// ********************************************
|
||||||
if (!Init_NVS_SDCard())
|
if (!Init_NVS_SDCard())
|
||||||
@@ -212,7 +228,6 @@ extern "C" void app_main(void)
|
|||||||
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "==================== Start ======================");
|
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "==================== Start ======================");
|
||||||
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "=================================================");
|
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "=================================================");
|
||||||
|
|
||||||
|
|
||||||
// Init external PSRAM
|
// Init external PSRAM
|
||||||
// ********************************************
|
// ********************************************
|
||||||
esp_err_t PSRAMStatus = esp_psram_init();
|
esp_err_t PSRAMStatus = esp_psram_init();
|
||||||
@@ -261,7 +276,6 @@ extern "C" void app_main(void)
|
|||||||
ESP_LOGD(TAG, "After camera initialization: sleep for: %ldms", (long) xDelay * CONFIG_FREERTOS_HZ/portTICK_PERIOD_MS);
|
ESP_LOGD(TAG, "After camera initialization: sleep for: %ldms", (long) xDelay * CONFIG_FREERTOS_HZ/portTICK_PERIOD_MS);
|
||||||
vTaskDelay( xDelay );
|
vTaskDelay( xDelay );
|
||||||
|
|
||||||
|
|
||||||
// Check camera init
|
// Check camera init
|
||||||
// ********************************************
|
// ********************************************
|
||||||
if (camStatus != ESP_OK) { // Camera init failed, retry to init
|
if (camStatus != ESP_OK) { // Camera init failed, retry to init
|
||||||
@@ -310,7 +324,6 @@ extern "C" void app_main(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// SD card: basic R/W check
|
// SD card: basic R/W check
|
||||||
// ********************************************
|
// ********************************************
|
||||||
int iSDCardStatus = SDCardCheckRW();
|
int iSDCardStatus = SDCardCheckRW();
|
||||||
@@ -335,12 +348,10 @@ extern "C" void app_main(void)
|
|||||||
// ********************************************
|
// ********************************************
|
||||||
setupTime(); // NTP time service: Status of time synchronization will be checked after every round (server_tflite.cpp)
|
setupTime(); // NTP time service: Status of time synchronization will be checked after every round (server_tflite.cpp)
|
||||||
|
|
||||||
|
|
||||||
// Set CPU Frequency
|
// Set CPU Frequency
|
||||||
// ********************************************
|
// ********************************************
|
||||||
setCpuFrequency();
|
setCpuFrequency();
|
||||||
|
|
||||||
|
|
||||||
// SD card: Create further mandatory directories (if not already existing)
|
// SD card: Create further mandatory directories (if not already existing)
|
||||||
// Correct creation of these folders will be checked with function "SDCardCheckFolderFilePresence"
|
// Correct creation of these folders will be checked with function "SDCardCheckFolderFilePresence"
|
||||||
// ********************************************
|
// ********************************************
|
||||||
@@ -432,7 +443,6 @@ extern "C" void app_main(void)
|
|||||||
ESP_LOGD(TAG, "main: sleep for: %ldms", (long) xDelay * CONFIG_FREERTOS_HZ/portTICK_PERIOD_MS);
|
ESP_LOGD(TAG, "main: sleep for: %ldms", (long) xDelay * CONFIG_FREERTOS_HZ/portTICK_PERIOD_MS);
|
||||||
vTaskDelay( xDelay );
|
vTaskDelay( xDelay );
|
||||||
|
|
||||||
|
|
||||||
// manual reset the time
|
// manual reset the time
|
||||||
// ********************************************
|
// ********************************************
|
||||||
if (!time_manual_reset_sync())
|
if (!time_manual_reset_sync())
|
||||||
@@ -440,8 +450,6 @@ extern "C" void app_main(void)
|
|||||||
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "Manual Time Sync failed during startup" );
|
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "Manual Time Sync failed during startup" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Set log level for wifi component to WARN level (default: INFO; only relevant for serial console)
|
// Set log level for wifi component to WARN level (default: INFO; only relevant for serial console)
|
||||||
// ********************************************
|
// ********************************************
|
||||||
esp_log_level_set("wifi", ESP_LOG_WARN);
|
esp_log_level_set("wifi", ESP_LOG_WARN);
|
||||||
@@ -465,8 +473,6 @@ extern "C" void app_main(void)
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Print Device info
|
// Print Device info
|
||||||
// ********************************************
|
// ********************************************
|
||||||
esp_chip_info_t chipInfo;
|
esp_chip_info_t chipInfo;
|
||||||
@@ -522,7 +528,7 @@ extern "C" void app_main(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME: needs to be revised or removed!!!
|
||||||
void migrateConfiguration(void) {
|
void migrateConfiguration(void) {
|
||||||
bool migrated = false;
|
bool migrated = false;
|
||||||
|
|
||||||
@@ -569,16 +575,19 @@ void migrateConfiguration(void) {
|
|||||||
migrated = migrated | replaceString(configLines[i], ";Demo = true", ";Demo = false"); // Set it to its default value
|
migrated = migrated | replaceString(configLines[i], ";Demo = true", ";Demo = false"); // Set it to its default value
|
||||||
migrated = migrated | replaceString(configLines[i], ";Demo", "Demo"); // Enable it
|
migrated = migrated | replaceString(configLines[i], ";Demo", "Demo"); // Enable it
|
||||||
|
|
||||||
migrated = migrated | replaceString(configLines[i], ";FixedExposure = true", ";FixedExposure = false"); // Set it to its default value
|
// Parameter is no longer used
|
||||||
migrated = migrated | replaceString(configLines[i], ";FixedExposure", "FixedExposure"); // Enable it
|
// migrated = migrated | replaceString(configLines[i], ";FixedExposure = true", ";FixedExposure = false"); // Set it to its default value
|
||||||
|
// migrated = migrated | replaceString(configLines[i], ";FixedExposure", "FixedExposure"); // Enable it
|
||||||
}
|
}
|
||||||
|
|
||||||
if (section == "[Alignment]") {
|
if (section == "[Alignment]") {
|
||||||
migrated = migrated | replaceString(configLines[i], ";InitialMirror = true", ";InitialMirror = false"); // Set it to its default value
|
// Parameter is no longer used
|
||||||
migrated = migrated | replaceString(configLines[i], ";InitialMirror", "InitialMirror"); // Enable it
|
// migrated = migrated | replaceString(configLines[i], ";InitialMirror = true", ";InitialMirror = false"); // Set it to its default value
|
||||||
|
// migrated = migrated | replaceString(configLines[i], ";InitialMirror", "InitialMirror"); // Enable it
|
||||||
|
|
||||||
migrated = migrated | replaceString(configLines[i], ";FlipImageSize = true", ";FlipImageSize = false"); // Set it to its default value
|
// Parameter is no longer used
|
||||||
migrated = migrated | replaceString(configLines[i], ";FlipImageSize", "FlipImageSize"); // Enable it
|
// migrated = migrated | replaceString(configLines[i], ";FlipImageSize = true", ";FlipImageSize = false"); // Set it to its default value
|
||||||
|
// migrated = migrated | replaceString(configLines[i], ";FlipImageSize", "FlipImageSize"); // Enable it
|
||||||
}
|
}
|
||||||
|
|
||||||
if (section == "[Digits]") {
|
if (section == "[Digits]") {
|
||||||
@@ -593,6 +602,7 @@ void migrateConfiguration(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (section == "[PostProcessing]") {
|
if (section == "[PostProcessing]") {
|
||||||
|
migrated = migrated | replaceString(configLines[i], "AnalogDigitalTransitionStart", "AnalogToDigitTransitionStart"); // Rename it
|
||||||
migrated = migrated | replaceString(configLines[i], ";PreValueUse = true", ";PreValueUse = false"); // Set it to its default value
|
migrated = migrated | replaceString(configLines[i], ";PreValueUse = true", ";PreValueUse = false"); // Set it to its default value
|
||||||
migrated = migrated | replaceString(configLines[i], ";PreValueUse", "PreValueUse"); // Enable it
|
migrated = migrated | replaceString(configLines[i], ";PreValueUse", "PreValueUse"); // Enable it
|
||||||
|
|
||||||
@@ -705,7 +715,6 @@ void migrateConfiguration(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::vector<std::string> splitString(const std::string& str) {
|
std::vector<std::string> splitString(const std::string& str) {
|
||||||
std::vector<std::string> tokens;
|
std::vector<std::string> tokens;
|
||||||
|
|
||||||
@@ -719,8 +728,6 @@ std::vector<std::string> splitString(const std::string& str) {
|
|||||||
return tokens;
|
return tokens;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*bool replace_all(std::string& s, std::string const& toReplace, std::string const& replaceWith) {
|
/*bool replace_all(std::string& s, std::string const& toReplace, std::string const& replaceWith) {
|
||||||
std::string buf;
|
std::string buf;
|
||||||
std::size_t pos = 0;
|
std::size_t pos = 0;
|
||||||
@@ -748,11 +755,10 @@ std::vector<std::string> splitString(const std::string& str) {
|
|||||||
return found;
|
return found;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
|
||||||
bool setCpuFrequency(void) {
|
bool setCpuFrequency(void) {
|
||||||
ConfigFile configFile = ConfigFile(CONFIG_FILE);
|
ConfigFile configFile = ConfigFile(CONFIG_FILE);
|
||||||
string cpuFrequency = "160";
|
string cpuFrequency = "160";
|
||||||
esp_pm_config_esp32_t pm_config;
|
esp_pm_config_t pm_config;
|
||||||
|
|
||||||
if (!configFile.ConfigFileExists()){
|
if (!configFile.ConfigFileExists()){
|
||||||
LogFile.WriteToFile(ESP_LOG_WARN, TAG, "No ConfigFile defined - exit setCpuFrequency()!");
|
LogFile.WriteToFile(ESP_LOG_WARN, TAG, "No ConfigFile defined - exit setCpuFrequency()!");
|
||||||
@@ -764,7 +770,6 @@ bool setCpuFrequency(void) {
|
|||||||
bool disabledLine = false;
|
bool disabledLine = false;
|
||||||
bool eof = false;
|
bool eof = false;
|
||||||
|
|
||||||
|
|
||||||
/* Load config from config file */
|
/* Load config from config file */
|
||||||
while ((!configFile.GetNextParagraph(line, disabledLine, eof) ||
|
while ((!configFile.GetNextParagraph(line, disabledLine, eof) ||
|
||||||
(line.compare("[System]") != 0)) && !eof) {}
|
(line.compare("[System]") != 0)) && !eof) {}
|
||||||
|
|||||||
@@ -357,7 +357,7 @@ esp_err_t img_tmp_virtual_handler(httpd_req_t *req)
|
|||||||
if (filetosend == "raw.jpg")
|
if (filetosend == "raw.jpg")
|
||||||
return GetRawJPG(req);
|
return GetRawJPG(req);
|
||||||
|
|
||||||
// Serve alg.jpg, alg_roi.jpg or digital and analog ROIs
|
// Serve alg.jpg, alg_roi.jpg or digit and analog ROIs
|
||||||
if (ESP_OK == GetJPG(filetosend, req))
|
if (ESP_OK == GetJPG(filetosend, req))
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
|
|
||||||
@@ -451,7 +451,7 @@ void register_server_main_uri(httpd_handle_t server, const char *base_path)
|
|||||||
httpd_handle_t start_webserver(void)
|
httpd_handle_t start_webserver(void)
|
||||||
{
|
{
|
||||||
httpd_handle_t server = NULL;
|
httpd_handle_t server = NULL;
|
||||||
httpd_config_t config = { };
|
httpd_config_t config = HTTPD_DEFAULT_CONFIG();
|
||||||
|
|
||||||
config.task_priority = tskIDLE_PRIORITY+3; // previously -> 2022-12-11: tskIDLE_PRIORITY+1; 2021-09-24: tskIDLE_PRIORITY+5
|
config.task_priority = tskIDLE_PRIORITY+3; // previously -> 2022-12-11: tskIDLE_PRIORITY+1; 2021-09-24: tskIDLE_PRIORITY+5
|
||||||
config.stack_size = 12288; // previously -> 2023-01-02: 32768
|
config.stack_size = 12288; // previously -> 2023-01-02: 32768
|
||||||
@@ -459,7 +459,7 @@ httpd_handle_t start_webserver(void)
|
|||||||
config.server_port = 80;
|
config.server_port = 80;
|
||||||
config.ctrl_port = 32768;
|
config.ctrl_port = 32768;
|
||||||
config.max_open_sockets = 5; //20210921 --> previously 7
|
config.max_open_sockets = 5; //20210921 --> previously 7
|
||||||
config.max_uri_handlers = 39; // previously 24, 20220511: 35, 20221220: 37, 2023-01-02:38
|
config.max_uri_handlers = 40; // Make sure this fits all URI handlers. Memory usage in bytes: 6*max_uri_handlers
|
||||||
config.max_resp_headers = 8;
|
config.max_resp_headers = 8;
|
||||||
config.backlog_conn = 5;
|
config.backlog_conn = 5;
|
||||||
config.lru_purge_enable = true; // this cuts old connections if new ones are needed.
|
config.lru_purge_enable = true; // this cuts old connections if new ones are needed.
|
||||||
|
|||||||
@@ -19,7 +19,8 @@
|
|||||||
|
|
||||||
[common:esp32-idf]
|
[common:esp32-idf]
|
||||||
extends = common:idf
|
extends = common:idf
|
||||||
platform = platformio/espressif32 @ 6.5.0
|
; PlatformIO releases, see https://github.com/platformio/platform-espressif32/releases
|
||||||
|
platform = platformio/espressif32 @ 6.9.0
|
||||||
framework = espidf
|
framework = espidf
|
||||||
lib_deps =
|
lib_deps =
|
||||||
${common:idf.lib_deps}
|
${common:idf.lib_deps}
|
||||||
@@ -29,7 +30,6 @@
|
|||||||
-DUSE_ESP32
|
-DUSE_ESP32
|
||||||
-DUSE_ESP32_FRAMEWORK_ESP_IDF
|
-DUSE_ESP32_FRAMEWORK_ESP_IDF
|
||||||
|
|
||||||
|
|
||||||
[flags:runtime]
|
[flags:runtime]
|
||||||
build_flags =
|
build_flags =
|
||||||
-Wno-nonnull-compare
|
-Wno-nonnull-compare
|
||||||
@@ -46,6 +46,7 @@
|
|||||||
;-Wshadow-compatible-local
|
;-Wshadow-compatible-local
|
||||||
-fno-exceptions
|
-fno-exceptions
|
||||||
|
|
||||||
|
|
||||||
; The main env - default
|
; The main env - default
|
||||||
[env:esp32cam]
|
[env:esp32cam]
|
||||||
extends = common:esp32-idf
|
extends = common:esp32-idf
|
||||||
@@ -56,13 +57,14 @@ build_flags =
|
|||||||
${common:esp32-idf.build_flags}
|
${common:esp32-idf.build_flags}
|
||||||
${flags:runtime.build_flags}
|
${flags:runtime.build_flags}
|
||||||
; ### Sofware options : (can be set in defines.h)
|
; ### Sofware options : (can be set in defines.h)
|
||||||
|
-D BOARD_ESP32CAM_AITHINKER
|
||||||
-D ENABLE_MQTT
|
-D ENABLE_MQTT
|
||||||
-D ENABLE_INFLUXDB
|
-D ENABLE_INFLUXDB
|
||||||
|
-D ENABLE_WEBHOOK
|
||||||
-D ENABLE_SOFTAP
|
-D ENABLE_SOFTAP
|
||||||
board_build.partitions = partitions.csv
|
board_build.partitions = partitions.csv
|
||||||
monitor_speed = 115200
|
monitor_speed = 115200
|
||||||
monitor_rts = 0
|
|
||||||
monitor_dtr = 0
|
|
||||||
|
|
||||||
; full standalone dev mode
|
; full standalone dev mode
|
||||||
; As sample, the board is nod32s instead of esp32cam (do not change nothing in fact :)
|
; As sample, the board is nod32s instead of esp32cam (do not change nothing in fact :)
|
||||||
@@ -77,8 +79,10 @@ build_flags =
|
|||||||
${common:esp32-idf.build_flags}
|
${common:esp32-idf.build_flags}
|
||||||
${flags:clangtidy.build_flags}
|
${flags:clangtidy.build_flags}
|
||||||
; ### Sofware options : (can be set in defines.h)
|
; ### Sofware options : (can be set in defines.h)
|
||||||
|
-D BOARD_ESP32CAM_AITHINKER
|
||||||
-D ENABLE_MQTT
|
-D ENABLE_MQTT
|
||||||
-D ENABLE_INFLUXDB
|
-D ENABLE_INFLUXDB
|
||||||
|
-D ENABLE_WEBHOOK
|
||||||
;-D ENABLE_SOFTAP
|
;-D ENABLE_SOFTAP
|
||||||
; ### Debug options :
|
; ### Debug options :
|
||||||
;-D DEBUG_DETAIL_ON
|
;-D DEBUG_DETAIL_ON
|
||||||
@@ -121,8 +125,6 @@ platform_packages =
|
|||||||
;;;;espressif/toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5
|
;;;;espressif/toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5
|
||||||
board_build.partitions = partitions.csv
|
board_build.partitions = partitions.csv
|
||||||
monitor_speed = 115200
|
monitor_speed = 115200
|
||||||
monitor_rts = 0
|
|
||||||
monitor_dtr = 0
|
|
||||||
|
|
||||||
|
|
||||||
; Activate all debug mode
|
; Activate all debug mode
|
||||||
@@ -211,4 +213,5 @@ build_flags =
|
|||||||
; ### Sofware options :
|
; ### Sofware options :
|
||||||
-D ENABLE_MQTT
|
-D ENABLE_MQTT
|
||||||
-D ENABLE_INFLUXDB
|
-D ENABLE_INFLUXDB
|
||||||
|
-D ENABLE_WEBHOOK
|
||||||
;-D ENABLE_SOFTAP ; disabled
|
;-D ENABLE_SOFTAP ; disabled
|
||||||
|
|||||||
@@ -135,7 +135,8 @@ CONFIG_OV7670_SUPPORT=n
|
|||||||
CONFIG_OV7725_SUPPORT=n
|
CONFIG_OV7725_SUPPORT=n
|
||||||
CONFIG_NT99141_SUPPORT=n
|
CONFIG_NT99141_SUPPORT=n
|
||||||
CONFIG_OV3660_SUPPORT=n
|
CONFIG_OV3660_SUPPORT=n
|
||||||
CONFIG_OV5640_SUPPORT=n
|
CONFIG_OV2640_SUPPORT=y
|
||||||
|
CONFIG_OV5640_SUPPORT=y
|
||||||
CONFIG_GC2145_SUPPORT=n
|
CONFIG_GC2145_SUPPORT=n
|
||||||
CONFIG_GC032A_SUPPORT=n
|
CONFIG_GC032A_SUPPORT=n
|
||||||
CONFIG_GC0308_SUPPORT=n
|
CONFIG_GC0308_SUPPORT=n
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ class UnderTestCNNGeneral : public ClassFlowCNNGeneral {
|
|||||||
*/
|
*/
|
||||||
void test_analogToDigit_Standard() {
|
void test_analogToDigit_Standard() {
|
||||||
|
|
||||||
UnderTestCNNGeneral* undertest = new UnderTestCNNGeneral(nullptr, Digital100);
|
UnderTestCNNGeneral* undertest = new UnderTestCNNGeneral(nullptr, Digit100);
|
||||||
|
|
||||||
// 4.8 is a "hanging" 5, i.e. it has not jumped over to 5.0.
|
// 4.8 is a "hanging" 5, i.e. it has not jumped over to 5.0.
|
||||||
// A "hanging digit" should still be rounded from Transition.
|
// A "hanging digit" should still be rounded from Transition.
|
||||||
@@ -59,7 +59,7 @@ void test_analogToDigit_Standard() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void test_analogToDigit_Transition() {
|
void test_analogToDigit_Transition() {
|
||||||
UnderTestCNNGeneral* undertest = new UnderTestCNNGeneral(nullptr, Digital100);
|
UnderTestCNNGeneral* undertest = new UnderTestCNNGeneral(nullptr, Digit100);
|
||||||
|
|
||||||
// https://github.com/jomjol/AI-on-the-edge-device/issues/921#issuecomment-1222672175
|
// https://github.com/jomjol/AI-on-the-edge-device/issues/921#issuecomment-1222672175
|
||||||
// Default: dig=3.9, ana=9.7 => erg=3
|
// Default: dig=3.9, ana=9.7 => erg=3
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ class UnderTestCNN : public ClassFlowCNNGeneral {
|
|||||||
*/
|
*/
|
||||||
void test_ZeigerEval()
|
void test_ZeigerEval()
|
||||||
{
|
{
|
||||||
UnderTestCNN undertest = UnderTestCNN(nullptr, Digital100);
|
UnderTestCNN undertest = UnderTestCNN(nullptr, Digit100);
|
||||||
|
|
||||||
// the 5.2 is already above 5.0 and the previous digit too (3)
|
// the 5.2 is already above 5.0 and the previous digit too (3)
|
||||||
printf("Test 5.2, 3\n");
|
printf("Test 5.2, 3\n");
|
||||||
@@ -29,11 +29,11 @@ void test_ZeigerEval()
|
|||||||
TEST_ASSERT_EQUAL(4, undertest.PointerEvalAnalogNew(5.2, 9));
|
TEST_ASSERT_EQUAL(4, undertest.PointerEvalAnalogNew(5.2, 9));
|
||||||
|
|
||||||
printf("Test 4.4, 9\n");
|
printf("Test 4.4, 9\n");
|
||||||
// the 4.4 (digital100) is not above 5 and the previous digit (analog) too (9.3)
|
// the 4.4 (Digit100) is not above 5 and the previous digit (analog) too (9.3)
|
||||||
TEST_ASSERT_EQUAL(4, undertest.PointerEvalAnalogNew(4.4, 9));
|
TEST_ASSERT_EQUAL(4, undertest.PointerEvalAnalogNew(4.4, 9));
|
||||||
|
|
||||||
printf("Test 4.5, 0\n");
|
printf("Test 4.5, 0\n");
|
||||||
// the 4.5 (digital100) is not above 5 and the previous digit (analog) too (9.6)
|
// the 4.5 (Digit100) is not above 5 and the previous digit (analog) too (9.6)
|
||||||
TEST_ASSERT_EQUAL(4, undertest.PointerEvalAnalogNew(4.5, 0));
|
TEST_ASSERT_EQUAL(4, undertest.PointerEvalAnalogNew(4.5, 0));
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -42,7 +42,7 @@ void test_ZeigerEval()
|
|||||||
* @brief test if all combinations of digit
|
* @brief test if all combinations of digit
|
||||||
* evaluation are running correctly
|
* evaluation are running correctly
|
||||||
*
|
*
|
||||||
* Desciption on call undertest.PointerEvalHybridNew(float number, float number_of_predecessors, int eval_predecessors, bool Analog_Predecessors, float digitalAnalogTransitionStart)
|
* Desciption on call undertest.PointerEvalHybridNew(float number, float number_of_predecessors, int eval_predecessors, bool Analog_Predecessors, float digitAnalogTransitionStart)
|
||||||
* @param number: is the current ROI as float value from recognition
|
* @param number: is the current ROI as float value from recognition
|
||||||
* @param number_of_predecessors: is the last (lower) ROI as float from recognition
|
* @param number_of_predecessors: is the last (lower) ROI as float from recognition
|
||||||
* @param eval_predecessors: is the evaluated number. Sometimes a much lower value can change higer values
|
* @param eval_predecessors: is the evaluated number. Sometimes a much lower value can change higer values
|
||||||
@@ -50,16 +50,16 @@ void test_ZeigerEval()
|
|||||||
* 0.1 => 0 (eval_predecessors)
|
* 0.1 => 0 (eval_predecessors)
|
||||||
* The 0 makes a 9.9 to 0 (eval_predecessors)
|
* The 0 makes a 9.9 to 0 (eval_predecessors)
|
||||||
* The 0 makes a 9.8 to 0
|
* The 0 makes a 9.8 to 0
|
||||||
* @param Analog_Predecessors false/true if the last ROI is an analog or digital ROI (default=false)
|
* @param Analog_Predecessors false/true if the last ROI is an analog or digit ROI (default=false)
|
||||||
* runs in special handling because analog is much less precise
|
* runs in special handling because analog is much less precise
|
||||||
* @param digitalAnalogTransitionStart start of the transitionlogic begins on number_of_predecessor (default=9.2)
|
* @param digitAnalogTransitionStart start of the transitionlogic begins on number_of_predecessor (default=9.2)
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void test_ZeigerEvalHybrid() {
|
void test_ZeigerEvalHybrid() {
|
||||||
UnderTestCNN undertest = UnderTestCNN(nullptr, Digital100);
|
UnderTestCNN undertest = UnderTestCNN(nullptr, Digit100);
|
||||||
|
|
||||||
// the 5.2 and no previous should round down
|
// the 5.2 and no previous should round down
|
||||||
printf("PointerEvalHybridNew(5.2, 0, -1)\n");
|
printf("PointerEvalHybridNew(5.2, 0, -1)\n");
|
||||||
@@ -93,17 +93,17 @@ void test_ZeigerEvalHybrid() {
|
|||||||
// the 5.7 with previous and the previous >=9.5 should trunc to 5
|
// the 5.7 with previous and the previous >=9.5 should trunc to 5
|
||||||
TEST_ASSERT_EQUAL(5, undertest.PointerEvalHybridNew(5.7, 9.6, 9));
|
TEST_ASSERT_EQUAL(5, undertest.PointerEvalHybridNew(5.7, 9.6, 9));
|
||||||
|
|
||||||
// the 4.5 (digital100) is not above 5 and the previous digit (analog) not over Zero (9.6)
|
// the 4.5 (Digit100) is not above 5 and the previous digit (analog) not over Zero (9.6)
|
||||||
TEST_ASSERT_EQUAL(4, undertest.PointerEvalHybridNew(4.5, 9.6, 0));
|
TEST_ASSERT_EQUAL(4, undertest.PointerEvalHybridNew(4.5, 9.6, 0));
|
||||||
|
|
||||||
// the 4.5 (digital100) is not above 5 and the previous digit (analog) not over Zero (9.6)
|
// the 4.5 (Digit100) is not above 5 and the previous digit (analog) not over Zero (9.6)
|
||||||
TEST_ASSERT_EQUAL(4, undertest.PointerEvalHybridNew(4.5, 9.6, 9));
|
TEST_ASSERT_EQUAL(4, undertest.PointerEvalHybridNew(4.5, 9.6, 9));
|
||||||
// the 4.5 (digital100) is not above 5 and the previous digit (analog) not over Zero (9.5)
|
// the 4.5 (Digit100) is not above 5 and the previous digit (analog) not over Zero (9.5)
|
||||||
TEST_ASSERT_EQUAL(4, undertest.PointerEvalHybridNew(4.5, 9.5, 9));
|
TEST_ASSERT_EQUAL(4, undertest.PointerEvalHybridNew(4.5, 9.5, 9));
|
||||||
|
|
||||||
// 59.96889 - Pre: 58.94888
|
// 59.96889 - Pre: 58.94888
|
||||||
// 8.6 : 9.8 : 6.7
|
// 8.6 : 9.8 : 6.7
|
||||||
// the 4.4 (digital100) is not above 5 and the previous digit (analog) not over Zero (9.5)
|
// the 4.4 (Digit100) is not above 5 and the previous digit (analog) not over Zero (9.5)
|
||||||
TEST_ASSERT_EQUAL(8, undertest.PointerEvalHybridNew(8.6, 9.8, 9));
|
TEST_ASSERT_EQUAL(8, undertest.PointerEvalHybridNew(8.6, 9.8, 9));
|
||||||
|
|
||||||
// pre = 9.9 (0.0 raw)
|
// pre = 9.9 (0.0 raw)
|
||||||
@@ -111,7 +111,7 @@ void test_ZeigerEvalHybrid() {
|
|||||||
TEST_ASSERT_EQUAL(2, undertest.PointerEvalHybridNew(1.8, 9.0, 9));
|
TEST_ASSERT_EQUAL(2, undertest.PointerEvalHybridNew(1.8, 9.0, 9));
|
||||||
|
|
||||||
// if a digit have an early transition and the pointer is < 9.0
|
// if a digit have an early transition and the pointer is < 9.0
|
||||||
// prev (pointer) = 6.2, but on digital readout = 6.0 (prev is int parameter)
|
// prev (pointer) = 6.2, but on digit readout = 6.0 (prev is int parameter)
|
||||||
// zahl = 4.6
|
// zahl = 4.6
|
||||||
TEST_ASSERT_EQUAL(4, undertest.PointerEvalHybridNew(4.6, 6.0, 6));
|
TEST_ASSERT_EQUAL(4, undertest.PointerEvalHybridNew(4.6, 6.0, 6));
|
||||||
|
|
||||||
|
|||||||
@@ -37,9 +37,9 @@ std::string process_doFlow(UnderTestPost* _underTestPost) {
|
|||||||
* @brief setup flow like it runs after recognition.
|
* @brief setup flow like it runs after recognition.
|
||||||
*
|
*
|
||||||
* @param analog the analog recognitions as array begins with the highest ROI
|
* @param analog the analog recognitions as array begins with the highest ROI
|
||||||
* @param digits the digital regocnitions as array begins with the highest ROI
|
* @param digits the digit regocnitions as array begins with the highest ROI
|
||||||
* @param digType type of the model defaults do Digital100
|
* @param digType type of the model defaults do Digit100
|
||||||
* @param checkConsistency for Digital type only. Not relvant for newer models
|
* @param checkConsistency for Digit type only. Not relvant for newer models
|
||||||
* @param extendedResolution the lowest ROI will directly used (9.7 => 9.7) if false 9.7 => 9
|
* @param extendedResolution the lowest ROI will directly used (9.7 => 9.7) if false 9.7 => 9
|
||||||
* @param decimal_shift the decimal point offset. -3 corresponds to x.yyy
|
* @param decimal_shift the decimal point offset. -3 corresponds to x.yyy
|
||||||
* @return std::string the value result
|
* @return std::string the value result
|
||||||
@@ -162,7 +162,7 @@ void setAnalogdigitTransistionStart(UnderTestPost* _underTestPost, float _analog
|
|||||||
std::vector<NumberPost*>* NUMBERS = _underTestPost->GetNumbers();
|
std::vector<NumberPost*>* NUMBERS = _underTestPost->GetNumbers();
|
||||||
for (int _n = 0; _n < (*NUMBERS).size(); ++_n) {
|
for (int _n = 0; _n < (*NUMBERS).size(); ++_n) {
|
||||||
ESP_LOGD(TAG, "Setting decimal shift on number: %d to %f", _n, _analogdigitTransistionStart);
|
ESP_LOGD(TAG, "Setting decimal shift on number: %d to %f", _n, _analogdigitTransistionStart);
|
||||||
(*NUMBERS)[_n]->AnalogDigitalTransitionStart = _analogdigitTransistionStart;
|
(*NUMBERS)[_n]->AnalogToDigitTransitionStart = _analogdigitTransistionStart;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,13 +33,13 @@ UnderTestPost* setUpClassFlowPostprocessing(t_CNNType digType, t_CNNType anaType
|
|||||||
*
|
*
|
||||||
* @param analog the analog recognitions
|
* @param analog the analog recognitions
|
||||||
* @param digits the digit recognitions
|
* @param digits the digit recognitions
|
||||||
* @param digType the digit model type (default Digital100)
|
* @param digType the digit model type (default Digit100)
|
||||||
* @param checkConsistency sets property checkConsistency (default = false)
|
* @param checkConsistency sets property checkConsistency (default = false)
|
||||||
* @param extendedResolution sets property extendedResolution (default = false)
|
* @param extendedResolution sets property extendedResolution (default = false)
|
||||||
* @param decimal_shift set property decimal_shift (Nachkommastellen, default = 0)
|
* @param decimal_shift set property decimal_shift (Nachkommastellen, default = 0)
|
||||||
* @return UnderTestPost* the created testobject
|
* @return UnderTestPost* the created testobject
|
||||||
*/
|
*/
|
||||||
UnderTestPost* init_do_flow(std::vector<float> analog, std::vector<float> digits, t_CNNType digType = Digital100,
|
UnderTestPost* init_do_flow(std::vector<float> analog, std::vector<float> digits, t_CNNType digType = Digit100,
|
||||||
bool checkConsistency=false, bool extendedResolution=false, int decimal_shift=0);
|
bool checkConsistency=false, bool extendedResolution=false, int decimal_shift=0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -47,13 +47,13 @@ UnderTestPost* init_do_flow(std::vector<float> analog, std::vector<float> digits
|
|||||||
*
|
*
|
||||||
* @param analog the analog recognitions
|
* @param analog the analog recognitions
|
||||||
* @param digits the digit recognitions
|
* @param digits the digit recognitions
|
||||||
* @param digType the digit model type (default Digital100)
|
* @param digType the digit model type (default Digit100)
|
||||||
* @param checkConsistency sets property checkConsistency (default = false)
|
* @param checkConsistency sets property checkConsistency (default = false)
|
||||||
* @param extendedResolution sets property extendedResolution (default = false)
|
* @param extendedResolution sets property extendedResolution (default = false)
|
||||||
* @param decimal_shift set property decimal_shift (Nachkommastellen, default = 0)
|
* @param decimal_shift set property decimal_shift (Nachkommastellen, default = 0)
|
||||||
* @return std::string the return value of do_Flow is the Value as string
|
* @return std::string the return value of do_Flow is the Value as string
|
||||||
*/
|
*/
|
||||||
std::string process_doFlow(std::vector<float> analog, std::vector<float> digits, t_CNNType digType = Digital100,
|
std::string process_doFlow(std::vector<float> analog, std::vector<float> digits, t_CNNType digType = Digit100,
|
||||||
bool checkConsistency=false, bool extendedResolution=false, int decimal_shift=0);
|
bool checkConsistency=false, bool extendedResolution=false, int decimal_shift=0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ void testNegative() {
|
|||||||
|
|
||||||
// extendResolution=false
|
// extendResolution=false
|
||||||
// da kein negativ, sollte kein Error auftreten
|
// da kein negativ, sollte kein Error auftreten
|
||||||
UnderTestPost* underTestPost = init_do_flow(analogs, digits, Digital100, false, false, 0);
|
UnderTestPost* underTestPost = init_do_flow(analogs, digits, Digit100, false, false, 0);
|
||||||
setAllowNegatives(underTestPost, false);
|
setAllowNegatives(underTestPost, false);
|
||||||
setPreValue(underTestPost, preValue);
|
setPreValue(underTestPost, preValue);
|
||||||
std::string result = process_doFlow(underTestPost);
|
std::string result = process_doFlow(underTestPost);
|
||||||
@@ -31,7 +31,7 @@ void testNegative() {
|
|||||||
// extendResolution=true
|
// extendResolution=true
|
||||||
// da negativ im Rahmen (letzte Stelle -0.2 > ergebnis), kein Error
|
// da negativ im Rahmen (letzte Stelle -0.2 > ergebnis), kein Error
|
||||||
// Aber der PreValue wird gesetzt
|
// Aber der PreValue wird gesetzt
|
||||||
underTestPost = init_do_flow(analogs, digits, Digital100, false, true, 0);
|
underTestPost = init_do_flow(analogs, digits, Digit100, false, true, 0);
|
||||||
setAllowNegatives(underTestPost, false);
|
setAllowNegatives(underTestPost, false);
|
||||||
setPreValue(underTestPost, preValue_extended);
|
setPreValue(underTestPost, preValue_extended);
|
||||||
result = process_doFlow(underTestPost);
|
result = process_doFlow(underTestPost);
|
||||||
@@ -42,7 +42,7 @@ void testNegative() {
|
|||||||
// extendResolution=true
|
// extendResolution=true
|
||||||
// Tolleranz überschritten, Error wird gesetzt, kein ReturnValue
|
// Tolleranz überschritten, Error wird gesetzt, kein ReturnValue
|
||||||
preValue_extended = 16.988; // zu groß
|
preValue_extended = 16.988; // zu groß
|
||||||
underTestPost = init_do_flow(analogs, digits, Digital100, false, true, 0);
|
underTestPost = init_do_flow(analogs, digits, Digit100, false, true, 0);
|
||||||
setAllowNegatives(underTestPost, false);
|
setAllowNegatives(underTestPost, false);
|
||||||
setPreValue(underTestPost, preValue_extended);
|
setPreValue(underTestPost, preValue_extended);
|
||||||
result = process_doFlow(underTestPost);
|
result = process_doFlow(underTestPost);
|
||||||
@@ -53,7 +53,7 @@ void testNegative() {
|
|||||||
// extendResolution=false
|
// extendResolution=false
|
||||||
// value < (preValue -.01)
|
// value < (preValue -.01)
|
||||||
preValue = 17.00; // zu groß
|
preValue = 17.00; // zu groß
|
||||||
underTestPost = init_do_flow(analogs, digits, Digital100, false, false, 0);
|
underTestPost = init_do_flow(analogs, digits, Digit100, false, false, 0);
|
||||||
setAllowNegatives(underTestPost, false);
|
setAllowNegatives(underTestPost, false);
|
||||||
setPreValue(underTestPost, preValue);
|
setPreValue(underTestPost, preValue);
|
||||||
result = process_doFlow(underTestPost);
|
result = process_doFlow(underTestPost);
|
||||||
@@ -65,7 +65,7 @@ void testNegative() {
|
|||||||
// value > (preValue -.01)
|
// value > (preValue -.01)
|
||||||
// ist im Rahmen der Ungenauigkeit (-1 auf letzter Stelle)
|
// ist im Rahmen der Ungenauigkeit (-1 auf letzter Stelle)
|
||||||
preValue = 16.99; // zu groß
|
preValue = 16.99; // zu groß
|
||||||
underTestPost = init_do_flow(analogs, digits, Digital100, false, false, 0);
|
underTestPost = init_do_flow(analogs, digits, Digit100, false, false, 0);
|
||||||
setAllowNegatives(underTestPost, false);
|
setAllowNegatives(underTestPost, false);
|
||||||
setPreValue(underTestPost, preValue);
|
setPreValue(underTestPost, preValue);
|
||||||
result = process_doFlow(underTestPost);
|
result = process_doFlow(underTestPost);
|
||||||
@@ -77,7 +77,7 @@ void testNegative() {
|
|||||||
// value < preValue
|
// value < preValue
|
||||||
// Aber Prüfung abgeschaltet => kein Fehler
|
// Aber Prüfung abgeschaltet => kein Fehler
|
||||||
preValue = 17.99; // zu groß
|
preValue = 17.99; // zu groß
|
||||||
underTestPost = init_do_flow(analogs, digits, Digital100, false, false, 0);
|
underTestPost = init_do_flow(analogs, digits, Digit100, false, false, 0);
|
||||||
setAllowNegatives(underTestPost, true);
|
setAllowNegatives(underTestPost, true);
|
||||||
setPreValue(underTestPost, preValue_extended);
|
setPreValue(underTestPost, preValue_extended);
|
||||||
result = process_doFlow(underTestPost);
|
result = process_doFlow(underTestPost);
|
||||||
@@ -105,11 +105,11 @@ void testNegative_Issues() {
|
|||||||
// value < preValue
|
// value < preValue
|
||||||
// Prüfung eingeschaltet => Fehler
|
// Prüfung eingeschaltet => Fehler
|
||||||
preValue = 22018.09; // zu groß
|
preValue = 22018.09; // zu groß
|
||||||
UnderTestPost* underTestPost = init_do_flow(analogs, digits, Digital100, false, false, -2);
|
UnderTestPost* underTestPost = init_do_flow(analogs, digits, Digit100, false, false, -2);
|
||||||
setAllowNegatives(underTestPost, false);
|
setAllowNegatives(underTestPost, false);
|
||||||
setPreValue(underTestPost, preValue_extended);
|
setPreValue(underTestPost, preValue_extended);
|
||||||
std::string result = process_doFlow(underTestPost);
|
std::string result = process_doFlow(underTestPost);
|
||||||
TEST_ASSERT_EQUAL_STRING("Neg. Rate - Read: - Raw: 22017.98 - Pre: 22018.08 ", underTestPost->getReadoutError().c_str());
|
TEST_ASSERT_EQUAL_STRING("Neg. Rate - Read: - Raw: 22017.98 - Pre: 22018.09 ", underTestPost->getReadoutError().c_str());
|
||||||
// if negativ no result any more
|
// if negativ no result any more
|
||||||
|
|
||||||
TEST_ASSERT_EQUAL_STRING("", result.c_str());
|
TEST_ASSERT_EQUAL_STRING("", result.c_str());
|
||||||
|
|||||||
@@ -178,7 +178,7 @@ void test_doFlowPP2() {
|
|||||||
std::vector<float> digits = { 1.0, 9.0, 9.0}; // Übergang wurde um 1 erhöht (200, statt 199)
|
std::vector<float> digits = { 1.0, 9.0, 9.0}; // Übergang wurde um 1 erhöht (200, statt 199)
|
||||||
std::vector<float> analogs = { 7.1, 4.8, 8.3};
|
std::vector<float> analogs = { 7.1, 4.8, 8.3};
|
||||||
const char* expected = "199.748";
|
const char* expected = "199.748";
|
||||||
std::string result = process_doFlow(analogs, digits, Digital);
|
std::string result = process_doFlow(analogs, digits, Digit);
|
||||||
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
||||||
|
|
||||||
// Fehler bei Rolling (2002-09-09)
|
// Fehler bei Rolling (2002-09-09)
|
||||||
@@ -191,15 +191,15 @@ void test_doFlowPP2() {
|
|||||||
// expected_extended= "32289.4198";
|
// expected_extended= "32289.4198";
|
||||||
|
|
||||||
// extendResolution=false, checkConsistency=false
|
// extendResolution=false, checkConsistency=false
|
||||||
result = process_doFlow(analogs, digits, Digital100, false, false, -3);
|
result = process_doFlow(analogs, digits, Digit100, false, false, -3);
|
||||||
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
||||||
|
|
||||||
// extendResolution=true
|
// extendResolution=true
|
||||||
result = process_doFlow(analogs, digits, Digital100, false, true, -3);
|
result = process_doFlow(analogs, digits, Digit100, false, true, -3);
|
||||||
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
|
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
|
||||||
|
|
||||||
// checkConsistency=true und extendResolution=true
|
// checkConsistency=true und extendResolution=true
|
||||||
result = process_doFlow(analogs, digits, Digital100, false, true, -3);
|
result = process_doFlow(analogs, digits, Digit100, false, true, -3);
|
||||||
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
|
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
|
||||||
|
|
||||||
// Fehler Rolling (2022-09-10)
|
// Fehler Rolling (2022-09-10)
|
||||||
@@ -210,20 +210,20 @@ void test_doFlowPP2() {
|
|||||||
expected_extended= "83.99401";
|
expected_extended= "83.99401";
|
||||||
|
|
||||||
// checkConsistency=false
|
// checkConsistency=false
|
||||||
result = process_doFlow(analogs, digits, Digital100, false);
|
result = process_doFlow(analogs, digits, Digit100, false);
|
||||||
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
||||||
|
|
||||||
|
|
||||||
// checkConsistency=true
|
// checkConsistency=true
|
||||||
result = process_doFlow(analogs, digits, Digital100, true);
|
result = process_doFlow(analogs, digits, Digit100, true);
|
||||||
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
||||||
|
|
||||||
// extendResolution=true
|
// extendResolution=true
|
||||||
result = process_doFlow(analogs, digits, Digital100, false, true);
|
result = process_doFlow(analogs, digits, Digit100, false, true);
|
||||||
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
|
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
|
||||||
|
|
||||||
// checkConsistency=true und extendResolution=true
|
// checkConsistency=true und extendResolution=true
|
||||||
result = process_doFlow(analogs, digits, Digital100, false, true);
|
result = process_doFlow(analogs, digits, Digit100, false, true);
|
||||||
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
|
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
|
||||||
|
|
||||||
// Fehler Rolling (2022-09-10)
|
// Fehler Rolling (2022-09-10)
|
||||||
@@ -234,16 +234,16 @@ void test_doFlowPP2() {
|
|||||||
expected_extended= "123235.6";
|
expected_extended= "123235.6";
|
||||||
|
|
||||||
// checkConsistency=true
|
// checkConsistency=true
|
||||||
result = process_doFlow(analogs, digits, Digital100, false, false);
|
result = process_doFlow(analogs, digits, Digit100, false, false);
|
||||||
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
||||||
|
|
||||||
|
|
||||||
// checkConsistency=true
|
// checkConsistency=true
|
||||||
result = process_doFlow(analogs, digits, Digital100, true, false);
|
result = process_doFlow(analogs, digits, Digit100, true, false);
|
||||||
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
||||||
|
|
||||||
// extendResolution=true
|
// extendResolution=true
|
||||||
result = process_doFlow(analogs, digits, Digital100, false, true);
|
result = process_doFlow(analogs, digits, Digit100, false, true);
|
||||||
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
|
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
|
||||||
|
|
||||||
// Fehler bei V11.2.0
|
// Fehler bei V11.2.0
|
||||||
@@ -254,11 +254,11 @@ void test_doFlowPP2() {
|
|||||||
expected_extended= "3249.4692";
|
expected_extended= "3249.4692";
|
||||||
|
|
||||||
// checkConsistency=true
|
// checkConsistency=true
|
||||||
result = process_doFlow(analogs, digits, Digital100, false, false, -3);
|
result = process_doFlow(analogs, digits, Digit100, false, false, -3);
|
||||||
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
||||||
|
|
||||||
// extendResolution=true
|
// extendResolution=true
|
||||||
result = process_doFlow(analogs, digits, Digital100, false, true, -3);
|
result = process_doFlow(analogs, digits, Digit100, false, true, -3);
|
||||||
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
|
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
|
||||||
|
|
||||||
// Fehler bei V11.2.0
|
// Fehler bei V11.2.0
|
||||||
@@ -269,11 +269,11 @@ void test_doFlowPP2() {
|
|||||||
expected_extended= "269.92272";
|
expected_extended= "269.92272";
|
||||||
|
|
||||||
// extendResolution=true
|
// extendResolution=true
|
||||||
result = process_doFlow(analogs, digits, Digital100, false, false);
|
result = process_doFlow(analogs, digits, Digit100, false, false);
|
||||||
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
||||||
|
|
||||||
// checkConsistency=false und extendResolution=true
|
// checkConsistency=false und extendResolution=true
|
||||||
result = process_doFlow(analogs, digits, Digital100, false, true);
|
result = process_doFlow(analogs, digits, Digit100, false, true);
|
||||||
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
|
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
|
||||||
|
|
||||||
// Fehler bei V11.3.1
|
// Fehler bei V11.3.1
|
||||||
@@ -284,11 +284,11 @@ void test_doFlowPP2() {
|
|||||||
expected_extended= "169.35935";
|
expected_extended= "169.35935";
|
||||||
|
|
||||||
// extendResolution=false
|
// extendResolution=false
|
||||||
result = process_doFlow(analogs, digits, Digital100, false, false, -3);
|
result = process_doFlow(analogs, digits, Digit100, false, false, -3);
|
||||||
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
||||||
|
|
||||||
// checkConsistency=false und extendResolution=true
|
// checkConsistency=false und extendResolution=true
|
||||||
result = process_doFlow(analogs, digits, Digital100, false, true, -3);
|
result = process_doFlow(analogs, digits, Digit100, false, true, -3);
|
||||||
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
|
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
|
||||||
|
|
||||||
// Fehler bei V12.0.1
|
// Fehler bei V12.0.1
|
||||||
@@ -299,11 +299,11 @@ void test_doFlowPP2() {
|
|||||||
expected_extended= "211.03555";
|
expected_extended= "211.03555";
|
||||||
|
|
||||||
// extendResolution=false
|
// extendResolution=false
|
||||||
result = process_doFlow(analogs, digits, Digital100, false, false, -3);
|
result = process_doFlow(analogs, digits, Digit100, false, false, -3);
|
||||||
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
||||||
|
|
||||||
// checkConsistency=false und extendResolution=true
|
// checkConsistency=false und extendResolution=true
|
||||||
result = process_doFlow(analogs, digits, Digital100, false, true, -3);
|
result = process_doFlow(analogs, digits, Digit100, false, true, -3);
|
||||||
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
|
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
|
||||||
|
|
||||||
// Fehler bei V12.0.1
|
// Fehler bei V12.0.1
|
||||||
@@ -314,11 +314,11 @@ void test_doFlowPP2() {
|
|||||||
expected_extended= "245.9386";
|
expected_extended= "245.9386";
|
||||||
|
|
||||||
// extendResolution=false
|
// extendResolution=false
|
||||||
result = process_doFlow(analogs, digits, Digital100, false, false, 0);
|
result = process_doFlow(analogs, digits, Digit100, false, false, 0);
|
||||||
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
||||||
|
|
||||||
// checkConsistency=false und extendResolution=true
|
// checkConsistency=false und extendResolution=true
|
||||||
result = process_doFlow(analogs, digits, Digital100, false, true, 0);
|
result = process_doFlow(analogs, digits, Digit100, false, true, 0);
|
||||||
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
|
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
|
||||||
|
|
||||||
// Fehler bei V12.0.1
|
// Fehler bei V12.0.1
|
||||||
@@ -329,11 +329,11 @@ void test_doFlowPP2() {
|
|||||||
expected_extended= "245.9386";
|
expected_extended= "245.9386";
|
||||||
|
|
||||||
// extendResolution=false
|
// extendResolution=false
|
||||||
result = process_doFlow(analogs, digits, Digital100, false, false, 0);
|
result = process_doFlow(analogs, digits, Digit100, false, false, 0);
|
||||||
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
||||||
|
|
||||||
// checkConsistency=false und extendResolution=true
|
// checkConsistency=false und extendResolution=true
|
||||||
result = process_doFlow(analogs, digits, Digital100, false, true, 0);
|
result = process_doFlow(analogs, digits, Digit100, false, true, 0);
|
||||||
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
|
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -346,11 +346,11 @@ void test_doFlowPP3() {
|
|||||||
const char* expected_extended= "247.2045";
|
const char* expected_extended= "247.2045";
|
||||||
|
|
||||||
// extendResolution=false
|
// extendResolution=false
|
||||||
std::string result = process_doFlow(analogs, digits, Digital100, false, false, 0);
|
std::string result = process_doFlow(analogs, digits, Digit100, false, false, 0);
|
||||||
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
||||||
|
|
||||||
// checkConsistency=false und extendResolution=true
|
// checkConsistency=false und extendResolution=true
|
||||||
result = process_doFlow(analogs, digits, Digital100, false, true, 0);
|
result = process_doFlow(analogs, digits, Digit100, false, true, 0);
|
||||||
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
|
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
|
||||||
|
|
||||||
|
|
||||||
@@ -362,11 +362,11 @@ void test_doFlowPP3() {
|
|||||||
expected_extended= "142.92690";
|
expected_extended= "142.92690";
|
||||||
|
|
||||||
// extendResolution=false
|
// extendResolution=false
|
||||||
result = process_doFlow(analogs, digits, Digital100, false, false, 0);
|
result = process_doFlow(analogs, digits, Digit100, false, false, 0);
|
||||||
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
||||||
|
|
||||||
// checkConsistency=false und extendResolution=true
|
// checkConsistency=false und extendResolution=true
|
||||||
result = process_doFlow(analogs, digits, Digital100, false, true, 0);
|
result = process_doFlow(analogs, digits, Digit100, false, true, 0);
|
||||||
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
|
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
|
||||||
|
|
||||||
|
|
||||||
@@ -379,14 +379,14 @@ void test_doFlowPP3() {
|
|||||||
expected_extended= "170.05287";
|
expected_extended= "170.05287";
|
||||||
|
|
||||||
// extendResolution=false
|
// extendResolution=false
|
||||||
UnderTestPost* undertestPost = init_do_flow(analogs, digits, Digital100, false, false, -3);
|
UnderTestPost* undertestPost = init_do_flow(analogs, digits, Digit100, false, false, -3);
|
||||||
setAnalogdigitTransistionStart(undertestPost, 7.7);
|
setAnalogdigitTransistionStart(undertestPost, 7.7);
|
||||||
result = process_doFlow(undertestPost);
|
result = process_doFlow(undertestPost);
|
||||||
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
||||||
delete undertestPost;
|
delete undertestPost;
|
||||||
|
|
||||||
// checkConsistency=false und extendResolution=true
|
// checkConsistency=false und extendResolution=true
|
||||||
undertestPost = init_do_flow(analogs, digits, Digital100, false, true, -3);
|
undertestPost = init_do_flow(analogs, digits, Digit100, false, true, -3);
|
||||||
setAnalogdigitTransistionStart(undertestPost, 7.7);
|
setAnalogdigitTransistionStart(undertestPost, 7.7);
|
||||||
result = process_doFlow(undertestPost);
|
result = process_doFlow(undertestPost);
|
||||||
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
|
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
|
||||||
@@ -400,11 +400,11 @@ void test_doFlowPP3() {
|
|||||||
expected_extended= "91.88174";
|
expected_extended= "91.88174";
|
||||||
|
|
||||||
// extendResolution=false
|
// extendResolution=false
|
||||||
result = process_doFlow(analogs, digits, Digital100, false, false, 0);
|
result = process_doFlow(analogs, digits, Digit100, false, false, 0);
|
||||||
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
||||||
|
|
||||||
// checkConsistency=false und extendResolution=true
|
// checkConsistency=false und extendResolution=true
|
||||||
result = process_doFlow(analogs, digits, Digital100, false, true, 0);
|
result = process_doFlow(analogs, digits, Digit100, false, true, 0);
|
||||||
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
|
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
|
||||||
|
|
||||||
|
|
||||||
@@ -416,11 +416,11 @@ void test_doFlowPP3() {
|
|||||||
expected_extended= "92.38320";
|
expected_extended= "92.38320";
|
||||||
|
|
||||||
// extendResolution=false
|
// extendResolution=false
|
||||||
result = process_doFlow(analogs, digits, Digital100, false, false, 0);
|
result = process_doFlow(analogs, digits, Digit100, false, false, 0);
|
||||||
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
||||||
|
|
||||||
// checkConsistency=false und extendResolution=true
|
// checkConsistency=false und extendResolution=true
|
||||||
result = process_doFlow(analogs, digits, Digital100, false, true, 0);
|
result = process_doFlow(analogs, digits, Digit100, false, true, 0);
|
||||||
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
|
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
|
||||||
|
|
||||||
// Fehler V11.3.0
|
// Fehler V11.3.0
|
||||||
@@ -431,11 +431,11 @@ void test_doFlowPP3() {
|
|||||||
expected_extended= "7472.7594";
|
expected_extended= "7472.7594";
|
||||||
|
|
||||||
// extendResolution=false
|
// extendResolution=false
|
||||||
result = process_doFlow(analogs, digits, Digital100, false, false, -3);
|
result = process_doFlow(analogs, digits, Digit100, false, false, -3);
|
||||||
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
||||||
|
|
||||||
// checkConsistency=false und extendResolution=true
|
// checkConsistency=false und extendResolution=true
|
||||||
result = process_doFlow(analogs, digits, Digital100, false, true, -3);
|
result = process_doFlow(analogs, digits, Digit100, false, true, -3);
|
||||||
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
|
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
|
||||||
|
|
||||||
// Fehler V12.0.1
|
// Fehler V12.0.1
|
||||||
@@ -446,11 +446,11 @@ void test_doFlowPP3() {
|
|||||||
expected_extended= "577.86490";
|
expected_extended= "577.86490";
|
||||||
|
|
||||||
// extendResolution=false
|
// extendResolution=false
|
||||||
result = process_doFlow(analogs, digits, Digital100, false, false, 0);
|
result = process_doFlow(analogs, digits, Digit100, false, false, 0);
|
||||||
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
||||||
|
|
||||||
// checkConsistency=false und extendResolution=true
|
// checkConsistency=false und extendResolution=true
|
||||||
result = process_doFlow(analogs, digits, Digital100, false, true, 0);
|
result = process_doFlow(analogs, digits, Digit100, false, true, 0);
|
||||||
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
|
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
|
||||||
|
|
||||||
|
|
||||||
@@ -462,11 +462,11 @@ void test_doFlowPP3() {
|
|||||||
expected_extended= "211.03580";
|
expected_extended= "211.03580";
|
||||||
|
|
||||||
// extendResolution=false
|
// extendResolution=false
|
||||||
result = process_doFlow(analogs, digits, Digital100, false, false, -3);
|
result = process_doFlow(analogs, digits, Digit100, false, false, -3);
|
||||||
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
||||||
|
|
||||||
// checkConsistency=false und extendResolution=true
|
// checkConsistency=false und extendResolution=true
|
||||||
result = process_doFlow(analogs, digits, Digital100, false, true, -3);
|
result = process_doFlow(analogs, digits, Digit100, false, true, -3);
|
||||||
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
|
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
|
||||||
|
|
||||||
// Fehler V12.0.1
|
// Fehler V12.0.1
|
||||||
@@ -477,11 +477,11 @@ void test_doFlowPP3() {
|
|||||||
expected_extended= "126.9231";
|
expected_extended= "126.9231";
|
||||||
|
|
||||||
// extendResolution=false
|
// extendResolution=false
|
||||||
result = process_doFlow(analogs, digits, Digital100, false, false, 0);
|
result = process_doFlow(analogs, digits, Digit100, false, false, 0);
|
||||||
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
||||||
|
|
||||||
// checkConsistency=false und extendResolution=true
|
// checkConsistency=false und extendResolution=true
|
||||||
result = process_doFlow(analogs, digits, Digital100, false, true, 0);
|
result = process_doFlow(analogs, digits, Digit100, false, true, 0);
|
||||||
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
|
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
|
||||||
|
|
||||||
// Fehler V12.0.1
|
// Fehler V12.0.1
|
||||||
@@ -492,11 +492,11 @@ void test_doFlowPP3() {
|
|||||||
expected_extended= "386.05672";
|
expected_extended= "386.05672";
|
||||||
|
|
||||||
// extendResolution=false
|
// extendResolution=false
|
||||||
result = process_doFlow(analogs, digits, Digital100, false, false, -3);
|
result = process_doFlow(analogs, digits, Digit100, false, false, -3);
|
||||||
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
||||||
|
|
||||||
// checkConsistency=false und extendResolution=true
|
// checkConsistency=false und extendResolution=true
|
||||||
result = process_doFlow(analogs, digits, Digital100, false, true, -3);
|
result = process_doFlow(analogs, digits, Digit100, false, true, -3);
|
||||||
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
|
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
|
||||||
|
|
||||||
// Fehler V12.0.1
|
// Fehler V12.0.1
|
||||||
@@ -508,14 +508,14 @@ void test_doFlowPP3() {
|
|||||||
expected_extended= "171.24178";
|
expected_extended= "171.24178";
|
||||||
|
|
||||||
// extendResolution=false
|
// extendResolution=false
|
||||||
undertestPost = init_do_flow(analogs, digits, Digital100, false, false, -3);
|
undertestPost = init_do_flow(analogs, digits, Digit100, false, false, -3);
|
||||||
setAnalogdigitTransistionStart(undertestPost, 7.7);
|
setAnalogdigitTransistionStart(undertestPost, 7.7);
|
||||||
result = process_doFlow(undertestPost);
|
result = process_doFlow(undertestPost);
|
||||||
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
||||||
delete undertestPost;
|
delete undertestPost;
|
||||||
|
|
||||||
// checkConsistency=false und extendResolution=true
|
// checkConsistency=false und extendResolution=true
|
||||||
undertestPost = init_do_flow(analogs, digits, Digital100, false, true, -3);
|
undertestPost = init_do_flow(analogs, digits, Digit100, false, true, -3);
|
||||||
setAnalogdigitTransistionStart(undertestPost, 7.7);
|
setAnalogdigitTransistionStart(undertestPost, 7.7);
|
||||||
result = process_doFlow(undertestPost);
|
result = process_doFlow(undertestPost);
|
||||||
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
|
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
|
||||||
@@ -533,11 +533,11 @@ void test_doFlowPP4() {
|
|||||||
const char* expected_extended= "717.01658";
|
const char* expected_extended= "717.01658";
|
||||||
|
|
||||||
// extendResolution=false
|
// extendResolution=false
|
||||||
std::string result = process_doFlow(analogs, digits, Digital100, false, false);
|
std::string result = process_doFlow(analogs, digits, Digit100, false, false);
|
||||||
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
||||||
|
|
||||||
// checkConsistency=false und extendResolution=true
|
// checkConsistency=false und extendResolution=true
|
||||||
result = process_doFlow(analogs, digits, Digital100, false, true);
|
result = process_doFlow(analogs, digits, Digit100, false, true);
|
||||||
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
|
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
void test_getReadoutRawString() {
|
void test_getReadoutRawString() {
|
||||||
|
|
||||||
// no ROIs setted up
|
// no ROIs setted up
|
||||||
UnderTestPost* _undertestPost = setUpClassFlowPostprocessing(Digital100, Analogue100);
|
UnderTestPost* _undertestPost = setUpClassFlowPostprocessing(Digit100, Analogue100);
|
||||||
|
|
||||||
string result = _undertestPost->flowAnalog->getReadoutRawString(0);
|
string result = _undertestPost->flowAnalog->getReadoutRawString(0);
|
||||||
TEST_ASSERT_EQUAL_STRING("", result.c_str());
|
TEST_ASSERT_EQUAL_STRING("", result.c_str());
|
||||||
|
|||||||
22
code/test/components/jomjol_mqtt/test_server_mqtt.cpp
Normal file
22
code/test/components/jomjol_mqtt/test_server_mqtt.cpp
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
#include <unity.h>
|
||||||
|
#include <server_mqtt.h>
|
||||||
|
|
||||||
|
void test_createNodeId()
|
||||||
|
{
|
||||||
|
std::string topic = "watermeter";
|
||||||
|
TEST_ASSERT_EQUAL_STRING("watermeter", createNodeId(topic).c_str());
|
||||||
|
|
||||||
|
topic = "/watermeter";
|
||||||
|
TEST_ASSERT_EQUAL_STRING("watermeter", createNodeId(topic).c_str());
|
||||||
|
|
||||||
|
topic = "home/test/watermeter";
|
||||||
|
TEST_ASSERT_EQUAL_STRING("watermeter", createNodeId(topic).c_str());
|
||||||
|
|
||||||
|
topic = "home/test/subtopic/something/test/watermeter";
|
||||||
|
TEST_ASSERT_EQUAL_STRING("watermeter", createNodeId(topic).c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
void test_mqtt()
|
||||||
|
{
|
||||||
|
test_createNodeId();
|
||||||
|
}
|
||||||
65
code/test/components/openmetrics/test_openmetrics.cpp
Normal file
65
code/test/components/openmetrics/test_openmetrics.cpp
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
#include <unity.h>
|
||||||
|
#include <openmetrics.h>
|
||||||
|
|
||||||
|
void test_createMetric()
|
||||||
|
{
|
||||||
|
// simple happy path
|
||||||
|
const char *expected = "# HELP metric_name short description\n# TYPE metric_name gauge\nmetric_name 123.456\n";
|
||||||
|
std::string result = createMetric("metric_name", "short description", "gauge", "123.456");
|
||||||
|
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* test the replaceString function as it's a dependency to sanitize sequence names
|
||||||
|
*/
|
||||||
|
void test_replaceString()
|
||||||
|
{
|
||||||
|
std::string sample = "hello\\world\\";
|
||||||
|
replaceAll(sample, "\\", "");
|
||||||
|
TEST_ASSERT_EQUAL_STRING("helloworld", sample.c_str());
|
||||||
|
|
||||||
|
sample = "hello\"world\"";
|
||||||
|
replaceAll(sample, "\"", "");
|
||||||
|
TEST_ASSERT_EQUAL_STRING("helloworld", sample.c_str());
|
||||||
|
|
||||||
|
sample = "hello\nworld\n";
|
||||||
|
replaceAll(sample, "\n", "");
|
||||||
|
TEST_ASSERT_EQUAL_STRING("helloworld", sample.c_str());
|
||||||
|
|
||||||
|
sample = "\\\\\\\\\\\\\\\\\\hello\\world\\\\\\\\\\\\\\\\\\\\";
|
||||||
|
replaceAll(sample, "\\", "");
|
||||||
|
TEST_ASSERT_EQUAL_STRING("helloworld", sample.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
void test_createSequenceMetrics()
|
||||||
|
{
|
||||||
|
std::vector<NumberPost *> NUMBERS;
|
||||||
|
NumberPost *number_1 = new NumberPost;
|
||||||
|
number_1->name = "main";
|
||||||
|
number_1->ReturnValue = "123.456";
|
||||||
|
NUMBERS.push_back(number_1);
|
||||||
|
|
||||||
|
const std::string metricNamePrefix = "ai_on_the_edge_device";
|
||||||
|
const std::string metricName = metricNamePrefix + "_flow_value";
|
||||||
|
|
||||||
|
std::string expected1 = "# HELP " + metricName + " current value of meter readout\n# TYPE " + metricName + " gauge\n" +
|
||||||
|
metricName + "{sequence=\"" + number_1->name + "\"} " + number_1->ReturnValue + "\n";
|
||||||
|
TEST_ASSERT_EQUAL_STRING(expected1.c_str(), createSequenceMetrics(metricNamePrefix, NUMBERS).c_str());
|
||||||
|
|
||||||
|
NumberPost *number_2 = new NumberPost;
|
||||||
|
number_2->name = "secondary";
|
||||||
|
number_2->ReturnValue = "1.0";
|
||||||
|
NUMBERS.push_back(number_2);
|
||||||
|
|
||||||
|
std::string expected2 = "# HELP " + metricName + " current value of meter readout\n# TYPE " + metricName + " gauge\n" +
|
||||||
|
metricName + "{sequence=\"" + number_1->name + "\"} " + number_1->ReturnValue + "\n" +
|
||||||
|
metricName + "{sequence=\"" + number_2->name + "\"} " + number_2->ReturnValue + "\n";
|
||||||
|
TEST_ASSERT_EQUAL_STRING(expected2.c_str(), createSequenceMetrics(metricNamePrefix, NUMBERS).c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
void test_openmetrics()
|
||||||
|
{
|
||||||
|
test_createMetric();
|
||||||
|
test_replaceString();
|
||||||
|
test_createSequenceMetrics();
|
||||||
|
}
|
||||||
@@ -20,7 +20,8 @@
|
|||||||
#include "components/jomjol-flowcontroll/test_PointerEvalAnalogToDigitNew.cpp"
|
#include "components/jomjol-flowcontroll/test_PointerEvalAnalogToDigitNew.cpp"
|
||||||
#include "components/jomjol-flowcontroll/test_getReadoutRawString.cpp"
|
#include "components/jomjol-flowcontroll/test_getReadoutRawString.cpp"
|
||||||
#include "components/jomjol-flowcontroll/test_cnnflowcontroll.cpp"
|
#include "components/jomjol-flowcontroll/test_cnnflowcontroll.cpp"
|
||||||
|
#include "components/openmetrics/test_openmetrics.cpp"
|
||||||
|
#include "components/jomjol_mqtt/test_server_mqtt.cpp"
|
||||||
|
|
||||||
bool Init_NVS_SDCard()
|
bool Init_NVS_SDCard()
|
||||||
{
|
{
|
||||||
@@ -151,12 +152,12 @@ extern "C" void app_main()
|
|||||||
{
|
{
|
||||||
initGPIO();
|
initGPIO();
|
||||||
Init_NVS_SDCard();
|
Init_NVS_SDCard();
|
||||||
esp_log_level_set("*", ESP_LOG_DEBUG); // set all components to ERROR level
|
esp_log_level_set("*", ESP_LOG_ERROR); // set all components to ERROR level
|
||||||
|
|
||||||
UNITY_BEGIN();
|
UNITY_BEGIN();
|
||||||
RUN_TEST(testNegative_Issues);
|
RUN_TEST(testNegative_Issues);
|
||||||
RUN_TEST(testNegative);
|
RUN_TEST(testNegative);
|
||||||
/*
|
|
||||||
RUN_TEST(test_analogToDigit_Standard);
|
RUN_TEST(test_analogToDigit_Standard);
|
||||||
RUN_TEST(test_analogToDigit_Transition);
|
RUN_TEST(test_analogToDigit_Transition);
|
||||||
RUN_TEST(test_doFlowPP);
|
RUN_TEST(test_doFlowPP);
|
||||||
@@ -167,6 +168,8 @@ extern "C" void app_main()
|
|||||||
|
|
||||||
// getReadoutRawString test
|
// getReadoutRawString test
|
||||||
RUN_TEST(test_getReadoutRawString);
|
RUN_TEST(test_getReadoutRawString);
|
||||||
*/
|
RUN_TEST(test_openmetrics);
|
||||||
|
RUN_TEST(test_mqtt);
|
||||||
|
|
||||||
UNITY_END();
|
UNITY_END();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,30 @@
|
|||||||
demo
|
|
||||||
WaitBeforeTakingPicture
|
WaitBeforeTakingPicture
|
||||||
ImageQuality
|
CamFrameSize
|
||||||
ImageSize
|
CamGainceiling
|
||||||
FixedExposure
|
CamQuality
|
||||||
|
CamAutoSharpness
|
||||||
|
CamSharpness
|
||||||
|
CamSpecialEffect
|
||||||
|
CamWbMode
|
||||||
|
CamAwb
|
||||||
|
CamAwbGain
|
||||||
|
CamAec
|
||||||
|
CamAec2
|
||||||
|
CamAeLevel
|
||||||
|
CamAecValue
|
||||||
|
CamAgc
|
||||||
|
CamAgcGain
|
||||||
|
CamBpc
|
||||||
|
CamWpc
|
||||||
|
CamRawGma
|
||||||
|
CamLenc
|
||||||
|
CamDcw
|
||||||
|
CamDenoise
|
||||||
|
CamZoom
|
||||||
|
CamZoomSize
|
||||||
|
CamZoomOffsetX
|
||||||
|
CamZoomOffsetY
|
||||||
|
demo
|
||||||
SearchFieldX
|
SearchFieldX
|
||||||
SearchFieldY
|
SearchFieldY
|
||||||
AlignmentAlgo
|
AlignmentAlgo
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
# Parameter `FlipImageSize`
|
|
||||||
Default Value: `false`
|
|
||||||
|
|
||||||
!!! Note
|
|
||||||
This parameter can also be set on the Reference Image configuration page!
|
|
||||||
|
|
||||||
!!! Note
|
|
||||||
After changing this parameter you need to update your reference image and alignment markers!
|
|
||||||
|
|
||||||
This parameter can be used to rotate the viewport together with the alignment rotation:
|
|
||||||

|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
# Parameter `InitialMirror`
|
|
||||||
Default Value: `false`
|
|
||||||
|
|
||||||
!!! Note
|
|
||||||
This parameter can also be set on the Reference Image configuration page!
|
|
||||||
|
|
||||||
!!! Note
|
|
||||||
After changing this parameter you need to update your reference image and alignment markers!
|
|
||||||
|
|
||||||
Option for initially mirroring the image on the original x-axis.
|
|
||||||
@@ -16,3 +16,6 @@ Usually there is a common RootCA certificate for the MQTT broker
|
|||||||
|
|
||||||
!!! Note
|
!!! Note
|
||||||
This also means that you might have to change the protocol and port in [uri](https://jomjol.github.io/AI-on-the-edge-device-docs/Parameters/#parameter-uri) to `mqtts://example.com:8883`!
|
This also means that you might have to change the protocol and port in [uri](https://jomjol.github.io/AI-on-the-edge-device-docs/Parameters/#parameter-uri) to `mqtts://example.com:8883`!
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
Only TLS 1.2 is supported!
|
||||||
|
|||||||
@@ -17,3 +17,6 @@ Usually there is a one pair of Client Certificate/Key for each client that conne
|
|||||||
!!! Note
|
!!! Note
|
||||||
If set, `ClientKey` must be set too
|
If set, `ClientKey` must be set too
|
||||||
This also means that you might have to change the protocol and port in [uri](https://jomjol.github.io/AI-on-the-edge-device-docs/Parameters/#parameter-uri) to `mqtts://example.com:8883`!
|
This also means that you might have to change the protocol and port in [uri](https://jomjol.github.io/AI-on-the-edge-device-docs/Parameters/#parameter-uri) to `mqtts://example.com:8883`!
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
Only TLS 1.2 is supported!
|
||||||
|
|||||||
@@ -17,3 +17,6 @@ Usually there is a one pair of Client Certificate/Key for each client that conne
|
|||||||
!!! Note
|
!!! Note
|
||||||
If set, `ClientCert` must be set too
|
If set, `ClientCert` must be set too
|
||||||
This also means that you might have to change the protocol and port in [uri](https://jomjol.github.io/AI-on-the-edge-device-docs/Parameters/#parameter-uri) to `mqtts://example.com:8883`!
|
This also means that you might have to change the protocol and port in [uri](https://jomjol.github.io/AI-on-the-edge-device-docs/Parameters/#parameter-uri) to `mqtts://example.com:8883`!
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
Only TLS 1.2 is supported!
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ The single value will be published with the following key: `MAINTOPIC/NUMBER/RES
|
|||||||
With:
|
With:
|
||||||
|
|
||||||
- `NUMBER`: The name of the value (a meter might have more than one value).
|
- `NUMBER`: The name of the value (a meter might have more than one value).
|
||||||
The names get defined in the analog and digital ROI configuration (defaults to `main`).
|
The names get defined in the analog and digit ROI configuration (defaults to `main`).
|
||||||
- `RESULT_TOPIC`: Automatically filled with the right name, eg. `value`, `rate`, `timestamp`, `error`, ....
|
- `RESULT_TOPIC`: Automatically filled with the right name, eg. `value`, `rate`, `timestamp`, `error`, ....
|
||||||
|
|
||||||
The general connection status can be found in `MAINTOPIC/CONNECTION`.
|
The general connection status can be found in `MAINTOPIC/CONNECTION`.
|
||||||
@@ -16,3 +16,5 @@ See [MQTT Result Topics](../MQTT-API#result) for a full list of topics.
|
|||||||
|
|
||||||
!!! Note
|
!!! Note
|
||||||
The main topic is allowed to contain `/` which can be used to split it into multiple levels, eg. `/basement/meters/watermeter/1/` if you have multiple water meters in your basement.
|
The main topic is allowed to contain `/` which can be used to split it into multiple levels, eg. `/basement/meters/watermeter/1/` if you have multiple water meters in your basement.
|
||||||
|
|
||||||
|
The nodeId for the Home Assistant MQTT Service Discovery must follow the schema `<discovery_prefix>/<component>/[<node_id>/]<object_id>/config`. The node_id is not configurable but derived from the `MainTopic` by stripping any but the last topic level. A `MainTopic` with the value `home/basement/watermeter` is transformed into the node_id `watermeter`, resulting in the discovery topic `homeassistant/sensor/watermeter/value/config` for the current value.
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
# Parameter `<NUMBER>.AnalogDigitalTransitionStart`
|
# Parameter `<NUMBER>.AnalogDigitTransitionStart`
|
||||||
Default Value: `9.2`
|
Default Value: `9.2`
|
||||||
|
|
||||||
This can be used if you have wrong values, but the recognition of the individual ROIs are correct.
|
This can be used if you have wrong values, but the recognition of the individual ROIs are correct.
|
||||||
Look for the start of changing of the first digit and note the analog pointer value behind.
|
Look for the start of changing of the first digit and note the analog pointer value behind.
|
||||||
Set it here. Only used on combination of digits and analog pointers.
|
Set it here. Only used on combination of digits and analog pointers.
|
||||||
See [here](../Watermeter-specific-analog---digital-transition) for details.
|
See [here](../Watermeter-specific-analog---digit-transition) for details.
|
||||||
|
|
||||||
Range: `6.0` .. `9.9`.
|
Range: `6.0` .. `9.9`.
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
# Parameter `<NUMBER>.ChangeRateThreshold`
|
||||||
|
Default Value: `2`
|
||||||
|
|
||||||
|
Range: `1` .. `9`.
|
||||||
|
|
||||||
|
Threshold parameter for change rate detection.<br>
|
||||||
|
This parameter is intended to compensate for small reading fluctuations that occur when the meter does not change its value for a long time (e.g. at night) or slightly turns backwards. This can eg. happen on watermeters.
|
||||||
|
|
||||||
|
It is only applied to the last digit of the read value (See example below).
|
||||||
|
If the read value is within PreValue +/- Threshold, no further calculation is carried out and the Value/Prevalue remains at the old value.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
Smallest ROI provides value for 0.000x
|
||||||
|
ChangeRateThreshold = 2
|
||||||
|
|
||||||
|
Extended Resolution disabled:
|
||||||
|
PreValue: 123.456'7 >>> Threshold = +/- 0.000'2
|
||||||
|
Comparative value >>> max = 123.456'9 and min = 123.456'5
|
||||||
|
|
||||||
|
Extended Resolution enabled:
|
||||||
|
PreValue: 123.456'78 >>> Threshold = +/- 0.000'02
|
||||||
|
Comparative value >>> max = 123.456'80 and min = 123.456'76
|
||||||
|
|
||||||
|

|
||||||
@@ -1,13 +0,0 @@
|
|||||||
# Parameter `Aec2`
|
|
||||||
Default Value: `false`
|
|
||||||
|
|
||||||
!!! Warning
|
|
||||||
This is an **Expert Parameter**! Only change it if you understand what it does!
|
|
||||||
|
|
||||||
!!! Note
|
|
||||||
This parameter can also be set on the Reference Image configuration page!
|
|
||||||
|
|
||||||
!!! Note
|
|
||||||
After changing this parameter you need to update your reference image and alignment markers!
|
|
||||||
|
|
||||||
Switch to "Auto-exposure Control 2" algorithm. This may resolve some over-exposure and under-exposure issues.
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
# Parameter `Brightness`
|
|
||||||
Default Value: `0`
|
|
||||||
|
|
||||||
!!! Note
|
|
||||||
This parameter can also be set on the Reference Image configuration page!
|
|
||||||
|
|
||||||
!!! Note
|
|
||||||
After changing this parameter you need to update your reference image and alignment markers!
|
|
||||||
|
|
||||||
Image Brightness (`-2` .. `2`)
|
|
||||||
22
param-docs/parameter-pages/TakeImage/CamAeLevel.md
Normal file
22
param-docs/parameter-pages/TakeImage/CamAeLevel.md
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
# Parameter `CamAeLevel`
|
||||||
|
|
||||||
|
**Auto-Exposure-Level**
|
||||||
|
|
||||||
|
range on OV2640 (`-2` .. `2`)<br>
|
||||||
|
range on OV3660 and OV5640 (`-5` .. `5`)
|
||||||
|
|
||||||
|
Default Value: `0`
|
||||||
|
|
||||||
|
See [here](../datasheets/Camera.ov2640_ds_1.8_.pdf) for the ov2640 camera datasheet.<br>
|
||||||
|
See [here](../datasheets/OV5640_datasheet.pdf) for the ov5640 camera datasheet.
|
||||||
|
|
||||||
|
!!! Warning
|
||||||
|
This is an **Expert Parameter**! Only change it if you understand what it does!
|
||||||
|
|
||||||
|
After changing this parameter you need to update your reference image and alignment markers!
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
The exposure offset for automatic exposure, lower values produce darker image.
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
This parameter can also be set on the Reference Image configuration page!
|
||||||
19
param-docs/parameter-pages/TakeImage/CamAec.md
Normal file
19
param-docs/parameter-pages/TakeImage/CamAec.md
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
# Parameter `CamAec`
|
||||||
|
|
||||||
|
**Auto-Exposure-Control**
|
||||||
|
|
||||||
|
- When **true**, the camera attempts to automatically control the exposure.
|
||||||
|
- When **false**, the **CamAecValue** setting is used instead.
|
||||||
|
|
||||||
|
Default Value: `true`
|
||||||
|
|
||||||
|
See [here](../datasheets/Camera.ov2640_ds_1.8_.pdf) for the ov2640 camera datasheet.<br>
|
||||||
|
See [here](../datasheets/OV5640_datasheet.pdf) for the ov5640 camera datasheet.
|
||||||
|
|
||||||
|
!!! Warning
|
||||||
|
This is an **Expert Parameter**! Only change it if you understand what it does!
|
||||||
|
|
||||||
|
After changing this parameter you need to update your reference image and alignment markers!
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
This parameter can also be set on the Reference Image configuration page!
|
||||||
22
param-docs/parameter-pages/TakeImage/CamAec2.md
Normal file
22
param-docs/parameter-pages/TakeImage/CamAec2.md
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
# Parameter `CamAec2`
|
||||||
|
|
||||||
|
**Auto-Exposure-Control2**
|
||||||
|
|
||||||
|
- When **true**, the sensor’s "night mode" is enabled, extending the range of automatic gain control.
|
||||||
|
- When **false**, the sensor’s "night mode" is disabled.
|
||||||
|
|
||||||
|
Default Value: `true`
|
||||||
|
|
||||||
|
See [here](../datasheets/Camera.ov2640_ds_1.8_.pdf) for the ov2640 camera datasheet.<br>
|
||||||
|
See [here](../datasheets/OV5640_datasheet.pdf) for the ov5640 camera datasheet.
|
||||||
|
|
||||||
|
!!! Warning
|
||||||
|
This is an **Expert Parameter**! Only change it if you understand what it does!
|
||||||
|
|
||||||
|
After changing this parameter you need to update your reference image and alignment markers!
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
This may resolve some over-exposure and under-exposure issues.
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
This parameter can also be set on the Reference Image configuration page!
|
||||||
21
param-docs/parameter-pages/TakeImage/CamAecValue.md
Normal file
21
param-docs/parameter-pages/TakeImage/CamAecValue.md
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
# Parameter `CamAecValue`
|
||||||
|
|
||||||
|
**Auto-Exposure-Value**
|
||||||
|
|
||||||
|
Range (`0` .. `1200`)
|
||||||
|
|
||||||
|
Default Value: `160`
|
||||||
|
|
||||||
|
See [here](../datasheets/Camera.ov2640_ds_1.8_.pdf) for the ov2640 camera datasheet.<br>
|
||||||
|
See [here](../datasheets/OV5640_datasheet.pdf) for the ov5640 camera datasheet.
|
||||||
|
|
||||||
|
!!! Warning
|
||||||
|
This is an **Expert Parameter**! Only change it if you understand what it does!
|
||||||
|
|
||||||
|
After changing this parameter you need to update your reference image and alignment markers!
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
Access the exposure value of the camera, higher values produce brighter images.
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
This parameter can also be set on the Reference Image configuration page!
|
||||||
16
param-docs/parameter-pages/TakeImage/CamAgc.md
Normal file
16
param-docs/parameter-pages/TakeImage/CamAgc.md
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
# Parameter `CamAgc`
|
||||||
|
|
||||||
|
**Auto-Gain-Control**
|
||||||
|
|
||||||
|
- When **true**, the camera attempts to automatically control the sensor gain, up to the value in the **CamGainceiling** property.
|
||||||
|
- When **false**, the **CamAgcGain** setting is used instead.
|
||||||
|
|
||||||
|
Default Value: `true`
|
||||||
|
|
||||||
|
See [here](../datasheets/Camera.ov2640_ds_1.8_.pdf) for the ov2640 camera datasheet.<br>
|
||||||
|
See [here](../datasheets/OV5640_datasheet.pdf) for the ov5640 camera datasheet.
|
||||||
|
|
||||||
|
!!! Warning
|
||||||
|
This is an **Expert Parameter**! Only change it if you understand what it does!
|
||||||
|
|
||||||
|
After changing this parameter you need to update your reference image and alignment markers!
|
||||||
21
param-docs/parameter-pages/TakeImage/CamAgcGain.md
Normal file
21
param-docs/parameter-pages/TakeImage/CamAgcGain.md
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
# Parameter `CamAgcGain`
|
||||||
|
|
||||||
|
**Auto-Gain-Control-Value**
|
||||||
|
|
||||||
|
Range (`0` .. `30`)
|
||||||
|
|
||||||
|
Default Value: `15`
|
||||||
|
|
||||||
|
See [here](../datasheets/Camera.ov2640_ds_1.8_.pdf) for the ov2640 camera datasheet.<br>
|
||||||
|
See [here](../datasheets/OV5640_datasheet.pdf) for the ov5640 camera datasheet.
|
||||||
|
|
||||||
|
!!! Warning
|
||||||
|
This is an **Expert Parameter**! Only change it if you understand what it does!
|
||||||
|
|
||||||
|
After changing this parameter you need to update your reference image and alignment markers!
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
This is used when **CamAgc** is off.
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
Access the gain level of the sensor, higher values produce brighter images.
|
||||||
22
param-docs/parameter-pages/TakeImage/CamAutoSharpness.md
Normal file
22
param-docs/parameter-pages/TakeImage/CamAutoSharpness.md
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
# Parameter `CamAutoSharpness`
|
||||||
|
|
||||||
|
**Auto-Sharpness**
|
||||||
|
|
||||||
|
- When **true**, the camera attempts to automatically adjusts the sharpness.
|
||||||
|
- When **false**, the **CamSharpness** setting is used instead.
|
||||||
|
|
||||||
|
Default Value: `false`
|
||||||
|
|
||||||
|
See [here](../datasheets/Camera.ov2640_ds_1.8_.pdf) for the ov2640 camera datasheet.<br>
|
||||||
|
See [here](../datasheets/OV5640_datasheet.pdf) for the ov5640 camera datasheet.
|
||||||
|
|
||||||
|
!!! Warning
|
||||||
|
This is an **Expert Parameter**! Only change it if you understand what it does!
|
||||||
|
|
||||||
|
After changing this parameter you need to update your reference image and alignment markers!
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
The OV2640 does not officially support auto sharpness, this is an experimental parameter!
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
This parameter can also be set on the Reference Image configuration page!
|
||||||
16
param-docs/parameter-pages/TakeImage/CamAwb.md
Normal file
16
param-docs/parameter-pages/TakeImage/CamAwb.md
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
# Parameter `CamAwb`
|
||||||
|
|
||||||
|
**Auto-White-Balance**
|
||||||
|
|
||||||
|
- When **true**, the camera attempts to automatically control white balance.
|
||||||
|
- When **false**, the **CamWbMode** setting is used instead.
|
||||||
|
|
||||||
|
Default Value: `true`
|
||||||
|
|
||||||
|
See [here](../datasheets/Camera.ov2640_ds_1.8_.pdf) for the ov2640 camera datasheet.<br>
|
||||||
|
See [here](../datasheets/OV5640_datasheet.pdf) for the ov5640 camera datasheet.
|
||||||
|
|
||||||
|
!!! Warning
|
||||||
|
This is an **Expert Parameter**! Only change it if you understand what it does!
|
||||||
|
|
||||||
|
After changing this parameter you need to update your reference image and alignment markers!
|
||||||
15
param-docs/parameter-pages/TakeImage/CamAwbGain.md
Normal file
15
param-docs/parameter-pages/TakeImage/CamAwbGain.md
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
# Parameter `CamAwbGain`
|
||||||
|
|
||||||
|
**Auto-White-Balance-Gain**
|
||||||
|
|
||||||
|
- Enable/Disable **CamAwbGain** control.
|
||||||
|
|
||||||
|
Default Value: `true`
|
||||||
|
|
||||||
|
See [here](../datasheets/Camera.ov2640_ds_1.8_.pdf) for the ov2640 camera datasheet.<br>
|
||||||
|
See [here](../datasheets/OV5640_datasheet.pdf) for the ov5640 camera datasheet.
|
||||||
|
|
||||||
|
!!! Warning
|
||||||
|
This is an **Expert Parameter**! Only change it if you understand what it does!
|
||||||
|
|
||||||
|
After changing this parameter you need to update your reference image and alignment markers!
|
||||||
15
param-docs/parameter-pages/TakeImage/CamBpc.md
Normal file
15
param-docs/parameter-pages/TakeImage/CamBpc.md
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
# Parameter `CamBpc`
|
||||||
|
|
||||||
|
**Black-Pixel-Correction**
|
||||||
|
|
||||||
|
- Enable/Disable **black point compensation**, this can make black parts of the image darker.
|
||||||
|
|
||||||
|
Default Value: `true`
|
||||||
|
|
||||||
|
See [here](../datasheets/Camera.ov2640_ds_1.8_.pdf) for the ov2640 camera datasheet.<br>
|
||||||
|
See [here](../datasheets/OV5640_datasheet.pdf) for the ov5640 camera datasheet.
|
||||||
|
|
||||||
|
!!! Warning
|
||||||
|
This is an **Expert Parameter**! Only change it if you understand what it does!
|
||||||
|
|
||||||
|
After changing this parameter you need to update your reference image and alignment markers!
|
||||||
16
param-docs/parameter-pages/TakeImage/CamBrightness.md
Normal file
16
param-docs/parameter-pages/TakeImage/CamBrightness.md
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
# Parameter `CamBrightness`
|
||||||
|
|
||||||
|
**Image-Brightness**
|
||||||
|
|
||||||
|
Range (`-2` .. `2`)
|
||||||
|
|
||||||
|
Default Value: `0`
|
||||||
|
|
||||||
|
See [here](../datasheets/Camera.ov2640_ds_1.8_.pdf) for the ov2640 camera datasheet.<br>
|
||||||
|
See [here](../datasheets/OV5640_datasheet.pdf) for the ov5640 camera datasheet.
|
||||||
|
|
||||||
|
!!! Warning
|
||||||
|
After changing this parameter you need to update your reference image and alignment markers!
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
This parameter can also be set on the Reference Image configuration page!
|
||||||
13
param-docs/parameter-pages/TakeImage/CamColorbar.md
Normal file
13
param-docs/parameter-pages/TakeImage/CamColorbar.md
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
# Parameter `CamColorbar`
|
||||||
|
|
||||||
|
**Colorbar**
|
||||||
|
|
||||||
|
currently not implemented.
|
||||||
|
|
||||||
|
Default Value: `false`
|
||||||
|
|
||||||
|
See [here](../datasheets/Camera.ov2640_ds_1.8_.pdf) for the ov2640 camera datasheet.<br>
|
||||||
|
See [here](../datasheets/OV5640_datasheet.pdf) for the ov5640 camera datasheet.
|
||||||
|
|
||||||
|
!!! Warning
|
||||||
|
This is an **Expert Parameter**! Only change it if you understand what it does!
|
||||||
@@ -1,15 +1,16 @@
|
|||||||
# Parameter `AutoExposureLevel`
|
# Parameter `CamContrast`
|
||||||
|
|
||||||
|
**Image-Contrast**
|
||||||
|
|
||||||
|
Range (`-2` .. `2`)
|
||||||
|
|
||||||
Default Value: `0`
|
Default Value: `0`
|
||||||
|
|
||||||
|
See [here](../datasheets/Camera.ov2640_ds_1.8_.pdf) for the ov2640 camera datasheet.<br>
|
||||||
|
See [here](../datasheets/OV5640_datasheet.pdf) for the ov5640 camera datasheet.
|
||||||
|
|
||||||
!!! Warning
|
!!! Warning
|
||||||
This is an **Expert Parameter**! Only change it if you understand what it does!
|
After changing this parameter you need to update your reference image and alignment markers!
|
||||||
|
|
||||||
!!! Note
|
!!! Note
|
||||||
This parameter can also be set on the Reference Image configuration page!
|
This parameter can also be set on the Reference Image configuration page!
|
||||||
|
|
||||||
!!! Note
|
|
||||||
After changing this parameter you need to update your reference image and alignment markers!
|
|
||||||
|
|
||||||
Exposure compensation. Lower values produce darker image.
|
|
||||||
|
|
||||||
Range (`-2` .. `2`)
|
|
||||||
21
param-docs/parameter-pages/TakeImage/CamDcw.md
Normal file
21
param-docs/parameter-pages/TakeImage/CamDcw.md
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
# Parameter `CamDcw`
|
||||||
|
|
||||||
|
**Image-Downsize**
|
||||||
|
|
||||||
|
- When **CamDcw** is on, the image that you receive will be the size that you requested (VGA, QQVGA, etc).
|
||||||
|
- When **CamDcw** is off, the image that you receive will be one of UXGA, SVGA, or CIF.
|
||||||
|
|
||||||
|
Default Value: `true`
|
||||||
|
|
||||||
|
See [here](../datasheets/Camera.ov2640_ds_1.8_.pdf) for the ov2640 camera datasheet.<br>
|
||||||
|
See [here](../datasheets/OV5640_datasheet.pdf) for the ov5640 camera datasheet.
|
||||||
|
|
||||||
|
!!! Warning
|
||||||
|
This is an **Expert Parameter**! Only change it if you understand what it does!
|
||||||
|
|
||||||
|
After changing this parameter you need to update your reference image and alignment markers!
|
||||||
|
|
||||||
|
If **CamZoom** is used, this must be activated.
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
If **CamDcw** is off, and you pick a different image size, this implicitly turns **CamDcw** back on again.
|
||||||
15
param-docs/parameter-pages/TakeImage/CamDenoise.md
Normal file
15
param-docs/parameter-pages/TakeImage/CamDenoise.md
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
# Parameter `CamDenoise`
|
||||||
|
|
||||||
|
**Image-Denoise**
|
||||||
|
|
||||||
|
- Denoise Image, is only supported by OV3660 and OV5640
|
||||||
|
|
||||||
|
range on OV3660 and OV5640 (0 .. 8)
|
||||||
|
|
||||||
|
Default Value: `true`
|
||||||
|
|
||||||
|
See [here](../datasheets/Camera.ov2640_ds_1.8_.pdf) for the ov2640 camera datasheet.<br>
|
||||||
|
See [here](../datasheets/OV5640_datasheet.pdf) for the ov5640 camera datasheet.
|
||||||
|
|
||||||
|
!!! Warning
|
||||||
|
This is an **Expert Parameter**! Only change it if you understand what it does!
|
||||||
33
param-docs/parameter-pages/TakeImage/CamGainceiling.md
Normal file
33
param-docs/parameter-pages/TakeImage/CamGainceiling.md
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
# Parameter `CamGainceiling`
|
||||||
|
|
||||||
|
**Gain-Ceiling**
|
||||||
|
|
||||||
|
Available options:
|
||||||
|
|
||||||
|
- `x2`
|
||||||
|
- `x4`
|
||||||
|
- `x8`
|
||||||
|
- `x16`
|
||||||
|
- `x32`
|
||||||
|
- `x64`
|
||||||
|
- `x128`
|
||||||
|
|
||||||
|
Default Value for ov2640: `x4`<br>
|
||||||
|
Default Value for ov5640: `x8`
|
||||||
|
|
||||||
|
See [here](../datasheets/Camera.ov2640_ds_1.8_.pdf) for the ov2640 camera datasheet.<br>
|
||||||
|
See [here](../datasheets/OV5640_datasheet.pdf) for the ov5640 camera datasheet.
|
||||||
|
|
||||||
|
!!! Warning
|
||||||
|
This is an **Expert Parameter**! Only change it if you understand what it does!
|
||||||
|
|
||||||
|
After changing this parameter you need to update your reference image and alignment markers!
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
A higher gain means that the sensor has a greater response to light, but also makes sensor noise more visible.
|
||||||
|
|
||||||
|
This is used when **CamAgc** is on.
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
The **Gain** is an analog multiplier applied to the raw sensor data.<br>
|
||||||
|
The **Ceiling** is the maximum gain value that the sensor will use.
|
||||||
16
param-docs/parameter-pages/TakeImage/CamHmirror.md
Normal file
16
param-docs/parameter-pages/TakeImage/CamHmirror.md
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
# Parameter `CamHmirror`
|
||||||
|
|
||||||
|
**Mirror-Image**
|
||||||
|
|
||||||
|
- When **true**, the camera image is mirrored left-to-right.
|
||||||
|
|
||||||
|
Default Value: `false`
|
||||||
|
|
||||||
|
See [here](../datasheets/Camera.ov2640_ds_1.8_.pdf) for the ov2640 camera datasheet.<br>
|
||||||
|
See [here](../datasheets/OV5640_datasheet.pdf) for the ov5640 camera datasheet.
|
||||||
|
|
||||||
|
!!! Warning
|
||||||
|
After changing this parameter you need to update your reference image and alignment markers!
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
This parameter can also be set on the Reference Image configuration page!
|
||||||
18
param-docs/parameter-pages/TakeImage/CamLenc.md
Normal file
18
param-docs/parameter-pages/TakeImage/CamLenc.md
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
# Parameter `CamLenc`
|
||||||
|
|
||||||
|
**Lens-Correction**
|
||||||
|
|
||||||
|
- Enable/Disable lens correction.
|
||||||
|
|
||||||
|
Default Value: `true`
|
||||||
|
|
||||||
|
See [here](../datasheets/Camera.ov2640_ds_1.8_.pdf) for the ov2640 camera datasheet.<br>
|
||||||
|
See [here](../datasheets/OV5640_datasheet.pdf) for the ov5640 camera datasheet.
|
||||||
|
|
||||||
|
!!! Warning
|
||||||
|
This is an **Expert Parameter**! Only change it if you understand what it does!
|
||||||
|
|
||||||
|
After changing this parameter you need to update your reference image and alignment markers!
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
This can help compensate for light fall-off at the edge of the sensor area.
|
||||||
22
param-docs/parameter-pages/TakeImage/CamQuality.md
Normal file
22
param-docs/parameter-pages/TakeImage/CamQuality.md
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
# Parameter `CamQuality`
|
||||||
|
|
||||||
|
**Image-Quality**
|
||||||
|
|
||||||
|
Range (`8` .. `63`)
|
||||||
|
|
||||||
|
Default Value: `10`
|
||||||
|
|
||||||
|
See [here](../datasheets/Camera.ov2640_ds_1.8_.pdf) for the ov2640 camera datasheet.<br>
|
||||||
|
See [here](../datasheets/OV5640_datasheet.pdf) for the ov5640 camera datasheet.
|
||||||
|
|
||||||
|
!!! Warning
|
||||||
|
This is an **Expert Parameter**! Only change it if you understand what it does!
|
||||||
|
|
||||||
|
After changing this parameter you need to update your reference image and alignment markers!
|
||||||
|
|
||||||
|
Value below 10 could result in system instabilities!
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
Quality index for pictures: `8` (highest quality) ... `63` (lowest quality)
|
||||||
|
|
||||||
|
This is similar to the quality setting when exporting a jpeg image from photo editing software.
|
||||||
21
param-docs/parameter-pages/TakeImage/CamRawGma.md
Normal file
21
param-docs/parameter-pages/TakeImage/CamRawGma.md
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
# Parameter `CamRawGma`
|
||||||
|
|
||||||
|
**Raw-Gamma**
|
||||||
|
|
||||||
|
- Enable/Disable raw gamma mode.
|
||||||
|
|
||||||
|
Default Value: `true`
|
||||||
|
|
||||||
|
See [here](../datasheets/Camera.ov2640_ds_1.8_.pdf) for the ov2640 camera datasheet.<br>
|
||||||
|
See [here](../datasheets/OV5640_datasheet.pdf) for the ov5640 camera datasheet.
|
||||||
|
|
||||||
|
!!! Warning
|
||||||
|
This is an **Expert Parameter**! Only change it if you understand what it does!
|
||||||
|
|
||||||
|
After changing this parameter you need to update your reference image and alignment markers!
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
The main purpose of the Gamma (GMA) function is to compensate for the non-linear characteristics of the sensor.
|
||||||
|
GMA converts the pixel values according to the Gamma curve to compensate the sensor output under different light strengths.
|
||||||
|
The non-linear gamma curve is approximately constructed with different linear functions. Raw gamma compensates the
|
||||||
|
image in the RAW domain.
|
||||||
19
param-docs/parameter-pages/TakeImage/CamSaturation.md
Normal file
19
param-docs/parameter-pages/TakeImage/CamSaturation.md
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
# Parameter `CamSaturation`
|
||||||
|
|
||||||
|
**Image-Saturation**
|
||||||
|
|
||||||
|
Range (`-2` .. `2`)
|
||||||
|
|
||||||
|
Default Value: `0`
|
||||||
|
|
||||||
|
See [here](../datasheets/Camera.ov2640_ds_1.8_.pdf) for the ov2640 camera datasheet.<br>
|
||||||
|
See [here](../datasheets/OV5640_datasheet.pdf) for the ov5640 camera datasheet.
|
||||||
|
|
||||||
|
!!! Warning
|
||||||
|
After changing this parameter you need to update your reference image and alignment markers!
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
Positive values increase saturation (more vibrant colors), negative values lower it (more muted colors).
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
This parameter can also be set on the Reference Image configuration page!
|
||||||
26
param-docs/parameter-pages/TakeImage/CamSharpness.md
Normal file
26
param-docs/parameter-pages/TakeImage/CamSharpness.md
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
# Parameter `CamSharpness`
|
||||||
|
|
||||||
|
**Image-Sharpness**
|
||||||
|
|
||||||
|
Range (`-2` .. `2`)
|
||||||
|
|
||||||
|
Default Value: `0`
|
||||||
|
|
||||||
|
See [here](../datasheets/Camera.ov2640_ds_1.8_.pdf) for the ov2640 camera datasheet.<br>
|
||||||
|
See [here](../datasheets/OV5640_datasheet.pdf) for the ov5640 camera datasheet.
|
||||||
|
|
||||||
|
!!! Warning
|
||||||
|
This is an **Expert Parameter**! Only change it if you understand what it does!
|
||||||
|
|
||||||
|
After changing this parameter you need to update your reference image and alignment markers!
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
The OV2640 does not officially support sharpness, this is an experimental parameter!
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
Positive values increase sharpness (more defined edges), negative values lower it (softer edges).
|
||||||
|
|
||||||
|
This is used when **CamAutoSharpness** is off.
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
This parameter can also be set on the Reference Image configuration page!
|
||||||
26
param-docs/parameter-pages/TakeImage/CamSpecialEffect.md
Normal file
26
param-docs/parameter-pages/TakeImage/CamSpecialEffect.md
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
# Parameter `CamSpecialEffect`
|
||||||
|
|
||||||
|
**Image-Special-Effect**
|
||||||
|
|
||||||
|
Available options:
|
||||||
|
|
||||||
|
- `no_effect`
|
||||||
|
- `negative`
|
||||||
|
- `grayscale`
|
||||||
|
- `red`
|
||||||
|
- `green`
|
||||||
|
- `blue`
|
||||||
|
- `retro`
|
||||||
|
|
||||||
|
Default Value: `no_effect`
|
||||||
|
|
||||||
|
See [here](../datasheets/Camera.ov2640_ds_1.8_.pdf) for the ov2640 camera datasheet.<br>
|
||||||
|
See [here](../datasheets/OV5640_datasheet.pdf) for the ov5640 camera datasheet.
|
||||||
|
|
||||||
|
!!! Warning
|
||||||
|
This is an **Expert Parameter**! Only change it if you understand what it does!
|
||||||
|
|
||||||
|
After changing this parameter you need to update your reference image and alignment markers!
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
This parameter can also be set on the Reference Image configuration page!
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user