Compare commits

...

533 Commits

Author SHA1 Message Date
SybexXx
f3e3ce504e setup_fix (#3906)
* Update edit_config_template.html

* Update edit_config_template.html
2025-09-07 17:47:40 +02:00
SybexXx
ba03a7dc38 Migration fix (#3900)
* Update main.cpp

During migration, the messages was issued as errors, although this should be information/should serve for information.

* Update main.cpp

* Update Helper.cpp
2025-09-02 22:06:07 +02:00
Rick Auch
73afc07652 Add option for gal/min rate for Home Assistant MQTT Autodiscovery (#3868)
Add gal/min as an option
2025-08-17 15:27:21 +02:00
Bruns8234
c320e4c921 Update SDCard Manufacturer List (#3730)
Update 1 and added 5 entries
2025-05-05 23:55:10 +02:00
CaCO3
43b29f3408 clarify the parameter prefix (#3717)
Co-authored-by: CaCO3 <caco@ruinelli.ch>
2025-04-23 00:01:37 +02:00
SybexX
b1c65c0a71 Update MeterType.md 2025-04-20 22:03:40 +02:00
CaCO3
00091fc3f9 Update NUMBER.ChangeRateThreshold.md 2025-04-16 23:31:19 +02:00
CaCO3
69a43fb068 Update reply-bot.yaml 2025-04-16 20:43:49 +02:00
CaCO3
82f28cb5bc Fix webinstaller update (#3697)
* Update build.yaml

* Update build.yaml

* Update build.yaml

* Update build.yaml
2025-04-09 23:43:50 +02:00
Frank Haverland
34818c0dc1 new model dig-class100-0180-s2-q (#3684)
* new model dig-class100-0180-s2-q

Model updated to Tensorflow 2.17
new images, now 24300

* Revert "new model dig-class100-0180-s2-q"

This reverts commit 7ac771e4b6.

* new model
2025-04-08 20:22:24 +02:00
jomjol
0b3a6e1057 Update tflite (#3687) 2025-04-06 09:45:48 +02:00
CaCO3
f06ef7b80e remove msg_id in the log, it is of no use (#3678) 2025-03-30 20:58:20 +02:00
Erik
962a674058 Refine Home Assistant MQTT Auto Discovery (#3659)
Add a proper device_class (duration) to "uptime"
2025-03-29 13:28:23 +01:00
SybexX
c57cd83948 Update README.md 2025-03-26 23:07:37 +01:00
The Random DIY
6991c41060 README updated with missed English translation (#3673)
* README updated with missed English translation

* Readme updated
2025-03-26 22:53:16 +01:00
SybexX
8bb274cd84 Merge pull request #3668 from nechry/main
Update NUMBER.ChangeRateThreshold.md
2025-03-24 03:19:41 +01:00
SybexX
168ec5b485 Update edit_config_template.html 2025-03-22 18:07:56 +01:00
Jean-François Auger
7a0a34e32e Update NUMBER.ChangeRateThreshold.md 2025-03-22 17:28:45 +01:00
CaCO3
64bf79b288 Update config.ini in demo folder 2025-03-18 22:36:53 +01:00
CaCO3
61085d3861 webinstaller: remove broken email link (#3639) 2025-03-16 18:32:27 +01:00
CaCO3
8494f36069 Rename webinstaller folder and add readme's (#3637) 2025-03-16 18:25:41 +01:00
CaCO3
3e67aeec0d Add note to sd card folder (#3635) to make people aware that the HTML folder only contains templates
* Create Readme.md

* Update Readme.md

* Update build.yaml

* Update Readme.md
2025-03-16 18:24:16 +01:00
CaCO3
e85e92762e Fix webinstaller-imgs 2025-03-15 22:56:33 +01:00
CaCO3
eb9bf3c7c1 Update index.html (#3636) 2025-03-15 22:52:53 +01:00
CaCO3
f542d842cf Update changelog (consolidate all RC changes into one) (#3614)
* Update changelog (consolidate all RC changes into one)

* Update Changelog.md

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>
Co-authored-by: jomjol <mueller.josef@gmail.com>
2025-03-15 14:24:06 +01:00
SybexX
5bbc2f3da5 Update ClassFlowPostProcessing.cpp
fix for: ChangeRateThreshold could not be deactivated
2025-03-02 13:26:07 +01:00
SybexX
2831478e02 Update edit_config_template.html
fix for: ChangeRateThreshold could not be deactivated
2025-03-02 13:25:49 +01:00
CaCO3
1e0cdfaba1 Remove unused config template page and empty, unused folder in zip files (#3599)
* Update build.yaml

* Update build.yaml

* remove empty folder in sd-card.zip in manual package
2025-03-02 08:31:22 +01:00
SybexX
bfebcd5d15 Update config.ini 2025-03-01 18:21:40 +01:00
CaCO3
cf96d49bd0 Release preparations (#3598)
* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md
2025-03-01 00:34:39 +01:00
CaCO3
94a53b38b8 Update Homeassistant discovery (#3580)
* use "total" for Homeassistant discovery topic "raw" if AllowNegativeRates is activ (same as for "value")

* update webUI

* .

* .

* .

* formating

* use state class "measurement" in case of a thermometer

* Update edit_config_template.html

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>
2025-03-01 00:28:38 +01:00
CaCO3
00ac2130c2 Calculate and validate MD5 on upload (#3590)
* added md5 library

* added MD5 calculation of uploaded file. And return JSON string instead of fileserver

* .

* .

* .

* .

* .

* .

* .

* .

* .

* Add fallback for older firmware

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>
2025-03-01 00:25:48 +01:00
SybexX
cd1165e547 IgnoreLeadingNaN fix (#3547)
* test1

* test2

* Update edit_config_template.html

* fix

* Update NUMBER.CheckDigitIncreaseConsistency.md

---------

Co-authored-by: CaCO3 <caco3@ruinelli.ch>
2025-03-01 00:09:11 +01:00
jomjol
c587ca3224 Update Changelog.md 2025-02-28 20:46:08 +01:00
CaCO3
76f45a5927 Remove html directory on update (#3584)
* delete HTML directory on an update

* delete HTML directory on an update

* rename html folder

* swap HTML folders after extracting

* .

* .

* .

* .

* .

* .

* move SD card check, SD card directories setup and update to before the PSRAM init.
The update should be as early as possible to allow updates even if the PSRAM or cam fails.

* .

* .

* Update Helper.cpp

* Update Helper.h

* .

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>
Co-authored-by: SybexX <Heinrich-Tuning@web.de>
2025-02-26 23:56:49 +01:00
jomjol
063c4827d0 Merge branch 'main' of https://github.com/jomjol/AI-on-the-edge-device 2025-02-26 22:00:27 +01:00
jomjol
c6b8823417 Update Changelog.md 2025-02-26 22:00:20 +01:00
github-actions[bot]
bb5e693077 docs(contributor): contrib-readme-action has updated readme 2025-02-25 18:31:30 +00:00
fsck-block
424df641cc openmetrics endpoint extension (#3521)
* added pre-value and raw-value to openmetrics endpoint

* added flow_error to openmentrics endpoint
2025-02-24 23:07:29 +01:00
CaCO3
8ddbda16bf consolidated reboot and save buttons (#3581)
* config page: consolidated reboot and save button

* various pages: consolidated reboot and save button

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>
2025-02-24 23:05:32 +01:00
CaCO3
8f5bf209d9 Gz html files fix missing file server.html (#3582)
* Add files via upload

* Delete sd-card/html/file_server.html

* Update server_file.cpp

* Update server_file.cpp

---------

Co-authored-by: SybexX <Heinrich-Tuning@web.de>
2025-02-24 21:55:16 +01:00
CaCO3
ec639d4236 revert unwanted removal of Autotimer title in config page
Revert removal of title. It got removed in 708fd68cf5 but should have stayed
2025-02-24 21:39:31 +01:00
CaCO3
5304981733 Fix thermometer config (#3578)
* fix thermometer config

* update note

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>
2025-02-23 21:12:20 +01:00
SybexX
7a9955477a add data export (CSV files) (#3537)
* Update backup.html

* Add files via upload

* Update data_export.html

---------

Co-authored-by: CaCO3 <caco3@ruinelli.ch>
2025-02-23 17:38:32 +01:00
SybexX
04fe25e875 Update timezones.html
fix missing searchicon.png
2025-02-20 19:23:33 +01:00
SybexX
02dcd584bf Add files via upload 2025-02-20 19:19:59 +01:00
SybexX
68a262ef22 Update ClassFlowControll.cpp
fix .gz in GetJPGStream(std::string _fn, httpd_req_t *req)
2025-02-18 00:54:00 +01:00
SybexX
f2b6b4f819 Update sdcard_check.cpp
fix .gz in SDCardCheckFolderFilePresence()
2025-02-17 22:23:55 +01:00
CaCO3
6b672ff9a5 compress all HTML files (#3568)
* compress all HTML files

* remove gz files, they get zipped in the build pipeline

* Update build.yaml

* removed flipImageSize.png, it is not used anywhere anymore

* Update build.yaml
2025-02-16 19:11:09 +01:00
SybexX
26770d877e Update main.cpp
If the camera could only be initialized on the second attempt, "Camera Framebuffer Check" and "Print camera infos" was skipped.
2025-02-16 12:01:30 +01:00
jomjol
e60c12b25d Create Licence.md 2025-02-16 10:56:52 +01:00
CaCO3
b10336b59c Add thermometer (#3454)
* add thermometer

* .

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>
2025-02-16 10:34:10 +01:00
SybexX
dadb004e85 add .gz (#3538)
* Update server_help.cpp

* Add files via upload

* Add files via upload

* Update server_help.cpp
2025-02-16 10:28:06 +01:00
CaCO3
e2f3e3d05b corrected enable/disable texts to make it more intuitive (#3565) 2025-02-16 09:59:52 +01:00
CaCO3
8c5a6528d9 Update RetainMessages.md 2025-02-15 22:43:14 +01:00
CaCO3
69024adac7 updated param doc 2025-02-15 22:11:27 +01:00
CaCO3
9f1b7c9ef7 updated param doc 2025-02-15 21:55:57 +01:00
CaCO3
15fd7a6a33 Update webinstaller job (#3563)
* Update manual-update-webinstaller.yaml

* Update build.yaml
2025-02-15 00:28:30 +01:00
SybexX
9c3fbb4aff Update main.cpp 2025-02-14 21:41:28 +01:00
SybexX
eb4c9276d5 Merge pull request #3455 from jomjol/mqtt-add-ValidateServerCert-Parameter
MQTT add validate server cert parameter
2025-02-14 21:28:29 +01:00
SybexX
842229ea98 Merge branch 'main' into mqtt-add-ValidateServerCert-Parameter 2025-02-14 21:20:37 +01:00
jomjol
b83717aece Update manual-update-webinstaller.yaml 2025-02-14 20:21:43 +01:00
jomjol
b01e42b893 Revert to old version 2025-02-14 20:19:37 +01:00
jomjol
902f1bc2a8 Revert "Update manual-update-webinstaller.yaml"
This reverts commit 71f31dc841.
2025-02-14 20:13:51 +01:00
jomjol
5c51990b40 Merge branch 'main' of https://github.com/jomjol/AI-on-the-edge-device 2025-02-14 20:12:18 +01:00
jomjol
55cbbf02cb Revert "Update manual-update-webinstaller.yaml"
This reverts commit 20a0d8530a.
2025-02-14 20:11:39 +01:00
jomjol
e37817e3e2 Update manual-update-webinstaller.yaml 2025-02-14 19:57:53 +01:00
jomjol
a78ca53d60 Update manual-update-webinstaller.yaml 2025-02-14 19:55:10 +01:00
jomjol
20a0d8530a Update manual-update-webinstaller.yaml 2025-02-14 19:47:27 +01:00
jomjol
af1e3257be Update manual-update-webinstaller.yaml 2025-02-14 19:45:03 +01:00
jomjol
93c21d30a1 Update manual-update-webinstaller.yaml 2025-02-14 19:39:11 +01:00
jomjol
7111a7fdcd Update manual-update-webinstaller.yaml 2025-02-14 19:37:57 +01:00
jomjol
bd541ede60 Update manual-update-webinstaller.yaml 2025-02-14 19:25:58 +01:00
jomjol
52aab2f8a6 Update manual-update-webinstaller.yaml 2025-02-14 19:24:08 +01:00
jomjol
a1aee5b346 Update manual-update-webinstaller.yaml 2025-02-14 19:19:24 +01:00
jomjol
71f31dc841 Update manual-update-webinstaller.yaml 2025-02-14 19:18:03 +01:00
jomjol
f6a363a871 Update WebInstaller 2025-02-14 18:35:54 +01:00
SybexX
7de18753d9 Update smartled driver (#3500)
* update-SmartLeds

* Update sdkconfig.defaults
2025-02-14 18:07:55 +01:00
michael
fea0c1b859 TOOLTIPs_revised 2025-02-02 22:14:58 +01:00
SybexX
603fcfef33 fix 2025-01-31 11:49:46 +01:00
SybexX
be3312e912 fix 2025-01-31 11:49:34 +01:00
jomjol
ff657ebb5c Documentation of intreace_influxdb 2025-01-26 16:58:28 +01:00
jomjol
42d4916cb8 Rewrite InfluxDB Interfache (#3520)
* Replace influxdb interface

* Implement InfluxDBV2

* Update interface_influxdb.cpp

* Cleanup new InfluxDB interface
2025-01-25 23:01:32 +01:00
SybexX
a73cd97629 Update sdkconfig.defaults 2025-01-25 17:17:56 +01:00
SybexX
636d816727 Update main.cpp 2025-01-25 00:16:23 +01:00
SybexX
c6f6341c87 Update sdkconfig.defaults 2025-01-24 06:47:13 +01:00
SybexX
ad886898a8 Update ClassFlowMQTT.cpp 2025-01-24 06:43:52 +01:00
SybexX
f16cf1406c Update interface_mqtt.cpp 2025-01-24 06:41:38 +01:00
SybexX
5dfd9a7db0 Update interface_mqtt.cpp 2025-01-21 05:50:34 +01:00
SybexX
89dc941d40 Update platformio.ini 2025-01-21 05:36:50 +01:00
SybexX
3f3c845e9f Update sdkconfig.defaults 2025-01-21 05:34:22 +01:00
fsck-block
1e60d839b7 added and activated espressif mDNS service (#3494)
* added and activated espressif mDNS service

* moved esp-protocols to code/components
2025-01-17 23:16:55 +01:00
jomjol
6e474441f6 Create License-DRAFT.md 2025-01-05 20:06:09 +01:00
jomjol
bf2a2f553f Create dig-class11_1910_s2_q.tflite 2025-01-05 19:53:25 +01:00
jomjol
21ab5cb203 additional tflite v0810 2025-01-05 19:20:48 +01:00
SybexX
1af1796ee0 Update ClassControllCamera.cpp
.jpeg_quality = 6 can cause problems with some cameras
2025-01-04 13:30:25 +01:00
michael
095cf984c4 remove_soc_temperature_for_s3_support 2025-01-03 18:36:11 +01:00
michael
b72d809e59 fix_soc_sdmmc_and_add_soc_temperature_for_s3_support 2025-01-02 16:39:26 +01:00
SybexX
c6a593ba0d fix for incorrect decimal shift? (#3446)
* Update ClassFlowCNNGeneral.cpp

* Update ClassFlowCNNGeneral.cpp

* Update ClassFlowCNNGeneral.cpp

* Update ClassFlowCNNGeneral.cpp

* Update code/components/jomjol_flowcontroll/ClassFlowCNNGeneral.cpp

* Update code/components/jomjol_flowcontroll/ClassFlowCNNGeneral.cpp

* Update code/components/jomjol_flowcontroll/ClassFlowCNNGeneral.cpp

* Update ClassFlowCNNGeneral.cpp

---------

Co-authored-by: CaCO3 <caco3@ruinelli.ch>
2024-12-31 12:01:02 +01:00
SybexX
c41a0a476d Update sdkconfig.defaults 2024-12-28 13:21:53 +01:00
jomjol
c68463359b Update tflite 2024-12-27 16:52:03 +01:00
CaCO3
a1c2145e77 Update Changelog.md 2024-12-25 20:53:25 +01:00
CaCO3
2986c6122d Add Web Interface and REST auth (#3436)
* Ported https://github.com/jomjol/AI-on-the-edge-device/pull/2241 to latest main and extended it for all REST APIs

* .

* fix compile errors

* .

* .

* Update Changelog.md

* Update Changelog.md

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>
Co-authored-by: michael <Heinrich-Tuning@web.de>
2024-12-25 20:49:47 +01:00
CaCO3
a348a51f14 Update NUMBER.ChangeRateThreshold.md 2024-12-25 10:27:47 +01:00
michael
6da894142e test3 2024-12-24 14:07:59 +01:00
michael
4846a52d45 test2 2024-12-24 13:14:19 +01:00
michael
4d74d0c522 test1 2024-12-24 12:14:53 +01:00
michael
53e818186a test 2024-12-24 04:27:12 +01:00
CaCO3
26ca15e18a fix crash fue to empty CAM parameters in migration (#3450)
Co-authored-by: CaCO3 <caco@ruinelli.ch>
2024-12-22 22:12:49 +01:00
CaCO3
f4dccc1d52 Update Interval.md 2024-12-05 23:21:01 +01:00
CaCO3
a07c2cf46d Update AutoStart.md 2024-12-05 23:20:30 +01:00
CaCO3
2f39d9bdd4 Update Interval.md 2024-12-05 23:14:02 +01:00
CaCO3
7836323fbc Prepare RC5 (#3422)
* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md
2024-12-05 01:05:38 +01:00
CaCO3
708fd68cf5 Remove Autostart parameter and make the flow to be always enabled (#3423)
* removed Autostart parameter and make it enabled by default

* .

* show menu entry in UI

* cleanup migration

* .

* .

* .

* .

* .

* .

* .

* .
2024-12-05 01:04:24 +01:00
github-actions[bot]
1b5ff2ef1a docs(contributor): contrib-readme-action has updated readme 2024-12-04 22:40:54 +00:00
CaCO3
1701aaed42 Update README.md (#3421) 2024-12-04 23:40:24 +01:00
CaCO3
c07e5a740a Add files via upload 2024-12-04 23:36:29 +01:00
SURYANSH RAI
3868cf98f6 Better Footer with social links #3311 (#3361)
* Added footer

* Update README.md

* Update index.html

* Update index.html

* Add files via upload

* Delete images/mail.jpg

* Update README.md

* Update sd-card/html/index.html

* Update docs/index.html

---------

Co-authored-by: CaCO3 <caco3@ruinelli.ch>
2024-12-04 23:33:58 +01:00
CaCO3
179005f4ce Extend Homeassistant discovery with button for flow start (#3415)
* feat(homeassistant discovery): Add button for flow start

* Update

* Update

* Allow Flow Start MQTT topic to have a zero-length payload

* remove unused payload

---------

Co-authored-by: Slider0007 <jobbelle@gmx.net>
2024-12-04 23:17:06 +01:00
SybexX
50ada0a5a8 fix (#3418) 2024-12-04 22:57:43 +01:00
SybexX
be7146c886 fix (#3417) 2024-12-03 21:12:19 +01:00
CaCO3
8f89a396f8 typo 2024-12-02 23:03:48 +01:00
SybexX
9e84d28ee9 overview_add_date_and_time (#3398)
* overview_add_date_and_time

* Update overview.html

---------

Co-authored-by: CaCO3 <caco3@ruinelli.ch>
2024-12-02 00:26:54 +01:00
CaCO3
3f4aaf303f Revert ec00e94
See https://github.com/jomjol/AI-on-the-edge-device/issues/3305#issuecomment-2510295853
2024-12-02 00:14:52 +01:00
gneluka
08baf1824c Add support for Domoticz MQTT integration (#3359)
* initial changes to add domoticz support

* error correction

* further changes

* further changes

* Refactoring

* further refactoring

* further refactoring

* Update DomoticzTopicIn.md

* Update NUMBER.DomoticzIDX.md

* Update DomoticzTopicIn.md

* Update NUMBER.DomoticzIDX.md

* Update config.ini

* Update edit_config_template.html

* Update edit_config_template.html

* Update edit_config_template.html

* Update DomoticzTopicIn.md

---------

Co-authored-by: CaCO3 <caco3@ruinelli.ch>
2024-12-02 00:07:02 +01:00
SybexX
2c7740ec16 Update CTfLiteClass.cpp (#3397) 2024-11-21 22:01:57 +01:00
SybexX
3ee32d8cf0 Merge pull request #3393 from tkopczuk/patch-1
Fix 'AnalogToDigitTransitionStart' always using 9.2 regardless of the configured value.
2024-11-20 03:33:23 +01:00
Tomek Kopczuk
25ae0465d8 Fix 'AnalogToDigitTransitionStart' always using 9.2 regardless of the configured value.
After the recent parameter rename we're trying to compare the toUpper version of the config parameter against "AnalogToDigitTransitionStart" - which will always fail - hence always using the default value of 9.2.
2024-11-19 23:14:24 +01:00
CaCO3
14e9d6a9cc renamed issue templates 2024-11-15 17:45:40 +01:00
CaCO3
94c2de1c2a Rename blank.yaml to x_blank.yaml 2024-11-15 17:27:48 +01:00
CaCO3
541e9841c2 Rename x_plain.yaml to blank.yaml 2024-11-15 17:27:23 +01:00
jomjol
fc3c70c63a Update dig-cont tlite to v712
Minor errata in quantization
2024-11-01 18:23:17 +01:00
github-actions[bot]
bfde8316ce docs(contributor): contrib-readme-action has updated readme 2024-10-19 08:36:57 +00:00
Bilal Mirza
fe0fec7fac Allow to Add a Move to Top button to enhance the ease of navigation for README readers. (#3344)
* Allow to Add a Move to Top button to enhance the ease of navigation for README readers.

* totally top of readme

* .

* Update README.md

* Update README.md

---------

Co-authored-by: CaCO3 <caco3@ruinelli.ch>
2024-10-19 10:36:19 +02:00
jomjol
56abefe3df Update esp-nn and tflite to newest version (#3346)
* Pulled down update esp-nn

* Pulled tflite to master

* Update from main
2024-10-18 21:48:59 +02:00
CaCO3
43f15fcba3 Fix HA menu entry (#3342)
* Fix HA menu entry

* Update index.html

* Update index.html

* Update index.html

* Update index.html

* Update index.html
2024-10-18 10:45:05 +02:00
Bilal Mirza
dadf18f5c9 Fix: Broken Links i.e 404 page not found #3335 (#3336)
* Fix: Broken Links

* Update README.md

---------

Co-authored-by: CaCO3 <caco3@ruinelli.ch>
2024-10-14 22:07:14 +02:00
CaCO3
c448ece680 Update the Homeasistant Discovery topics (#3332)
Update the Homeassistant Discovery topics
2024-10-13 23:04:28 +02:00
CaCO3
07d6eca456 Update README.md 2024-10-13 16:12:24 +02:00
CaCO3
4083d35b61 Update README.md 2024-10-13 15:55:30 +02:00
CaCO3
2319f8d302 Update README.md 2024-10-13 14:51:24 +02:00
Ranjana761
224e4380a8 Add batches to README.md (#3330)
* Update README.md

* Update README.md
2024-10-13 12:00:24 +02:00
jomjol
14d0c88a28 Update dig-cont_0711_s3_q.tflite
Error corrected version ov 0710 (adjusted quantization)
2024-10-13 10:13:06 +02:00
Farookh Zaheer Siddiqui
3c9b2c46c8 Update FeatureRequest.md (#3328) 2024-10-09 21:29:12 +02:00
jomjol
0752694600 Return vo v0700 2024-10-09 21:28:58 +02:00
github-actions[bot]
cf0ed268dd docs(contributor): contrib-readme-action has updated readme 2024-10-08 22:14:26 +00:00
CaCO3
f1979a142e Manual update of contributors list (#3325)
* Create manually-update-contributors-list

* Update and rename manually-update-contributors-list to manual-update-contributors-li.yamlst

* Update build.yaml

* Rename manual-update-contributors-li.yamlst to manual-update-contributors-li.yaml

* Rename manual-update-contributors-li.yaml to manual-update-contributors-list.yaml

* Update README.md
2024-10-09 00:13:43 +02:00
Austin Drenski
2a4f0f4a2d Update softAP.cpp (#3324) 2024-10-08 23:34:25 +02:00
KrishCode
45269bf45b Fixed docs README.md (#3323)
* Fixed docs README.md

I improved the file and enhanced its readability

* Update README.md

* Update README.md

* Update README.md

---------

Co-authored-by: CaCO3 <caco3@ruinelli.ch>
2024-10-08 23:33:14 +02:00
Naman Tyagi
57db60fee4 fix: corrected grammatical and typographical errors in changelog (#3321) 2024-10-07 21:40:11 +02:00
Naman Tyagi
e1c49f39f0 Update README.md (#3322) 2024-10-07 21:39:09 +02:00
jomjol
7bebae3776 Clean up of old tflite files 2024-10-07 19:52:18 +02:00
CaCO3
0a4560ea95 Update Changelog.md 2024-10-07 00:21:07 +02:00
CaCO3
b44db21714 Update esp32-camera submodule to v2.0.13 (#3316)
Co-authored-by: CaCO3 <caco@ruinelli.ch>
2024-10-07 00:20:38 +02:00
CaCO3
34796ed091 Update build.yaml 2024-10-07 00:19:47 +02:00
CaCO3
a46dfd1c23 Add demo files (#3315)
* updated changelog

* add demo files

* Update build.yaml

* Update build.yaml

* Update build.yaml

* added missing files

* .

* .

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>
2024-10-07 00:06:03 +02:00
CaCO3
32eb583036 Add contributor list (#3317)
* feat: #3310 Automatically Update Contributor List  (#3312)

* Create main.yml

* Update README.md

* docs(contributor): contrib-readme-action has updated readme

* Update main.yml

* docs(contributor): contrib-readme-action has updated readme

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update build.yaml

* docs(contributor): contrib-readme-action has updated readme

* Delete .github/workflows/main.yml

* Update README.md

* docs(contributor): contrib-readme-action has updated readme

* Update README.md

* docs(contributor): contrib-readme-action has updated readme

* Update build.yaml

* Update README.md

---------

Co-authored-by: Ayush Jhawar <111112495+Ayushjhawar8@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-10-06 23:25:19 +02:00
michael
6ee83b8413 Update ClassControllCamera.cpp (#3313)
https://github.com/jomjol/AI-on-the-edge-device/issues/3300#issuecomment-2395561022
2024-10-06 22:42:27 +02:00
CaCO3
f034232f36 Update config.ini 2024-10-06 22:33:24 +02:00
CaCO3
b80e43dfe9 Update config.ini 2024-10-06 22:31:56 +02:00
CaCO3
40c7c253ea Update config.ini 2024-10-06 22:29:06 +02:00
CaCO3
d11b312a96 Typos (#3309)
* Update edit_reference.html

* Update edit_config_template.html

* Update edit_config_template.html

* Update edit_reference.html
2024-10-06 16:57:26 +02:00
Naman Tyagi
2c1e531ed2 Fix grammar and typos in README.md for clarity and consistency (#3308) 2024-10-06 16:53:16 +02:00
CaCO3
c352e539bc Update build.yaml 2024-10-05 23:15:38 +02:00
CaCO3
a0333d906f use lower case for MQTT topic rate_per_digitization_round 2024-10-05 22:32:50 +02:00
CaCO3
ec00e943da Allow earlier start for AnalogToDigitTransitionStart 2024-10-05 22:26:26 +02:00
CaCO3
6175471a00 typo 2024-10-05 22:20:24 +02:00
CaCO3
948e76876f revert TFlite submodule update as certain modules crash with it, see #3269 (2nd attempt) 2024-10-05 22:18:37 +02:00
CaCO3
f4edb206d8 Master (#3297)
* fix pipeline (#3294)

* 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 in 33893eb566 but 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 commit cc9297d483.

* not using platformio 6.1.16

* Revert "not using platformio 6.1.16"

This reverts commit ef18e4fae7.

* 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

* Prepare next release (#3267) (#3270)

* 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

---------



* 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

---------



* 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).

---------



* 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.



* 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

---------



* 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 in 33893eb566 but 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

---------




* 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

---------



* 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

---------



* 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

---------



* 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 commit cc9297d483.

* not using platformio 6.1.16

* Revert "not using platformio 6.1.16"

This reverts commit ef18e4fae7.

* 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*

---------



* 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>

* revert TFlite submodule update as certain modules crash with it, see https://github.com/jomjol/AI-on-the-edge-device/issues/3269

* Rename NUMBER.AnalogDigitTransitionStart.md to NUMBER.AnalogToDigitTransitionStart.md

* Update NUMBER.AnalogToDigitTransitionStart.md

* Update edit_config_template.html

* changed the webhook UploadImg to false

* changed the webhook UploadImg to false (#3279)

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Show boolean option in settings page (#3285)

* changed the webhook UploadImg to false

* show boolean value on boolean drop down boxes

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* changed default value from boolean to numeric value in parameter camDenoise documentation

* Update edit_explain_7.html

https://github.com/jomjol/AI-on-the-edge-device/issues/3284?notification_referrer_id=NT_kwDOAAj1wbIxMjY3MDI1Njk3MDo1ODcyMDE#issuecomment-2387102786

* docs: update README.md (#3290)

prefered -> preferred

* rename/remove unused parameters (#3291)

* migrate-cam-parameters (#3288)

* Update main.cpp

* remove commented out code

---------

Co-authored-by: CaCO3 <caco3@ruinelli.ch>

* Update Changelog.md

* cleanup

* Skip release jobs on non-release changes

* Update build.yaml

* Update build.yaml

* Update build.yaml

* Update build.yaml

* Update build.yaml

---------

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>
Co-authored-by: Ikko Eltociear Ashimine <eltociear@gmail.com>

* update pipeline (#3296)

* 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 in 33893eb566 but 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 commit cc9297d483.

* not using platformio 6.1.16

* Revert "not using platformio 6.1.16"

This reverts commit ef18e4fae7.

* 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

* Prepare next release (#3267) (#3270)

* 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

---------



* 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

---------



* 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).

---------



* 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.



* 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

---------



* 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 in 33893eb566 but 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

---------




* 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

---------



* 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

---------



* 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

---------



* 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 commit cc9297d483.

* not using platformio 6.1.16

* Revert "not using platformio 6.1.16"

This reverts commit ef18e4fae7.

* 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*

---------



* 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>

* revert TFlite submodule update as certain modules crash with it, see https://github.com/jomjol/AI-on-the-edge-device/issues/3269

* Rename NUMBER.AnalogDigitTransitionStart.md to NUMBER.AnalogToDigitTransitionStart.md

* Update NUMBER.AnalogToDigitTransitionStart.md

* Update edit_config_template.html

* changed the webhook UploadImg to false

* changed the webhook UploadImg to false (#3279)

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Show boolean option in settings page (#3285)

* changed the webhook UploadImg to false

* show boolean value on boolean drop down boxes

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* changed default value from boolean to numeric value in parameter camDenoise documentation

* Update edit_explain_7.html

https://github.com/jomjol/AI-on-the-edge-device/issues/3284?notification_referrer_id=NT_kwDOAAj1wbIxMjY3MDI1Njk3MDo1ODcyMDE#issuecomment-2387102786

* docs: update README.md (#3290)

prefered -> preferred

* rename/remove unused parameters (#3291)

* migrate-cam-parameters (#3288)

* Update main.cpp

* remove commented out code

---------

Co-authored-by: CaCO3 <caco3@ruinelli.ch>

* Update Changelog.md

* cleanup

* Skip release jobs on non-release changes

* Update build.yaml

* Update build.yaml

* Update build.yaml

* Update build.yaml

* Update build.yaml

* fix pipeline

* Update build.yaml

---------

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>
Co-authored-by: Ikko Eltociear Ashimine <eltociear@gmail.com>

---------

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>
Co-authored-by: Ikko Eltociear Ashimine <eltociear@gmail.com>
2024-10-04 23:25:59 +02:00
CaCO3
a9db769595 Update build.yaml 2024-10-04 23:19:24 +02:00
CaCO3
f0497eb924 fix pipeline 2024-10-04 23:07:36 +02:00
CaCO3
e53af6de0d Merge branch 'master' into rolling 2024-10-04 23:06:44 +02:00
CaCO3
3b7fe93d02 Update build.yaml 2024-10-04 23:05:46 +02:00
CaCO3
2f1d7e577c updated pipeline (#3293)
* 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 in 33893eb566 but 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 commit cc9297d483.

* not using platformio 6.1.16

* Revert "not using platformio 6.1.16"

This reverts commit ef18e4fae7.

* 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

* Prepare next release (#3267) (#3270)

* 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

---------



* 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

---------



* 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).

---------



* 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.



* 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

---------



* 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 in 33893eb566 but 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

---------




* 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

---------



* 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

---------



* 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

---------



* 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 commit cc9297d483.

* not using platformio 6.1.16

* Revert "not using platformio 6.1.16"

This reverts commit ef18e4fae7.

* 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*

---------



* 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>

* revert TFlite submodule update as certain modules crash with it, see https://github.com/jomjol/AI-on-the-edge-device/issues/3269

* Rename NUMBER.AnalogDigitTransitionStart.md to NUMBER.AnalogToDigitTransitionStart.md

* Update NUMBER.AnalogToDigitTransitionStart.md

* Update edit_config_template.html

* changed the webhook UploadImg to false

* changed the webhook UploadImg to false (#3279)

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Show boolean option in settings page (#3285)

* changed the webhook UploadImg to false

* show boolean value on boolean drop down boxes

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* changed default value from boolean to numeric value in parameter camDenoise documentation

* Update edit_explain_7.html

https://github.com/jomjol/AI-on-the-edge-device/issues/3284?notification_referrer_id=NT_kwDOAAj1wbIxMjY3MDI1Njk3MDo1ODcyMDE#issuecomment-2387102786

* docs: update README.md (#3290)

prefered -> preferred

* rename/remove unused parameters (#3291)

* migrate-cam-parameters (#3288)

* Update main.cpp

* remove commented out code

---------

Co-authored-by: CaCO3 <caco3@ruinelli.ch>

* Update Changelog.md

* cleanup

* Skip release jobs on non-release changes

* Update build.yaml

* Update build.yaml

* Update build.yaml

* Update build.yaml

---------

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>
Co-authored-by: Ikko Eltociear Ashimine <eltociear@gmail.com>
2024-10-04 22:59:44 +02:00
CaCO3
2a7247abfe Update build.yaml 2024-10-04 22:55:07 +02:00
CaCO3
37ba85717f Update build.yaml 2024-10-04 22:54:11 +02:00
CaCO3
97656114b6 Update build.yaml 2024-10-04 22:36:58 +02:00
CaCO3
6cf1d5ad98 Update build.yaml 2024-10-04 22:22:53 +02:00
CaCO3
fed729bcee Skip release jobs on non-release changes 2024-10-04 22:20:38 +02:00
CaCO3
89c36374b3 RC2 preparations (#3292)
* 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 in 33893eb566 but 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 commit cc9297d483.

* not using platformio 6.1.16

* Revert "not using platformio 6.1.16"

This reverts commit ef18e4fae7.

* 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

* Prepare next release (#3267) (#3270)

* 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

---------



* 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

---------



* 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).

---------



* 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.



* 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

---------



* 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 in 33893eb566 but 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

---------




* 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

---------



* 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

---------



* 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

---------



* 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 commit cc9297d483.

* not using platformio 6.1.16

* Revert "not using platformio 6.1.16"

This reverts commit ef18e4fae7.

* 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*

---------



* 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>

* revert TFlite submodule update as certain modules crash with it, see https://github.com/jomjol/AI-on-the-edge-device/issues/3269

* Rename NUMBER.AnalogDigitTransitionStart.md to NUMBER.AnalogToDigitTransitionStart.md

* Update NUMBER.AnalogToDigitTransitionStart.md

* Update edit_config_template.html

* changed the webhook UploadImg to false

* changed the webhook UploadImg to false (#3279)

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Show boolean option in settings page (#3285)

* changed the webhook UploadImg to false

* show boolean value on boolean drop down boxes

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* changed default value from boolean to numeric value in parameter camDenoise documentation

* Update edit_explain_7.html

https://github.com/jomjol/AI-on-the-edge-device/issues/3284?notification_referrer_id=NT_kwDOAAj1wbIxMjY3MDI1Njk3MDo1ODcyMDE#issuecomment-2387102786

* docs: update README.md (#3290)

prefered -> preferred

* rename/remove unused parameters (#3291)

* migrate-cam-parameters (#3288)

* Update main.cpp

* remove commented out code

---------

Co-authored-by: CaCO3 <caco3@ruinelli.ch>

* Update Changelog.md

* cleanup

---------

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>
Co-authored-by: Ikko Eltociear Ashimine <eltociear@gmail.com>
2024-10-04 22:05:15 +02:00
CaCO3
bb69929247 cleanup 2024-10-04 22:03:41 +02:00
CaCO3
e1ea09c501 Merge branch 'master' into rolling 2024-10-04 22:00:28 +02:00
CaCO3
39a827258d Update Changelog.md 2024-10-04 21:55:45 +02:00
michael
1d8c6fa257 migrate-cam-parameters (#3288)
* Update main.cpp

* remove commented out code

---------

Co-authored-by: CaCO3 <caco3@ruinelli.ch>
2024-10-04 21:43:06 +02:00
CaCO3
a9aadbdb06 rename/remove unused parameters (#3291) 2024-10-04 21:31:57 +02:00
Ikko Eltociear Ashimine
a5927f98d2 docs: update README.md (#3290)
prefered -> preferred
2024-10-04 21:14:47 +02:00
michael
c708e2374a Update edit_explain_7.html
https://github.com/jomjol/AI-on-the-edge-device/issues/3284?notification_referrer_id=NT_kwDOAAj1wbIxMjY3MDI1Njk3MDo1ODcyMDE#issuecomment-2387102786
2024-10-02 01:43:50 +02:00
CaCO3
4c3dcd8c29 changed default value from boolean to numeric value in parameter camDenoise documentation 2024-10-02 00:43:32 +02:00
CaCO3
be93567956 Merge branch 'rolling' of https://github.com/jomjol/AI-on-the-edge-device into rolling 2024-10-02 00:40:35 +02:00
CaCO3
d4406f47ea Show boolean option in settings page (#3285)
* changed the webhook UploadImg to false

* show boolean value on boolean drop down boxes

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>
2024-10-02 00:38:59 +02:00
CaCO3
52efedcfa0 Merge branch 'rolling' of https://github.com/jomjol/AI-on-the-edge-device into rolling 2024-10-01 18:52:19 +02:00
CaCO3
28d93253f0 changed the webhook UploadImg to false (#3279)
Co-authored-by: CaCO3 <caco@ruinelli.ch>
2024-09-30 21:16:22 +02:00
CaCO3
c7fdc46df2 changed the webhook UploadImg to false 2024-09-30 21:08:48 +02:00
CaCO3
74491e9bde Update edit_config_template.html 2024-09-30 20:50:20 +02:00
CaCO3
a092142c65 Update NUMBER.AnalogToDigitTransitionStart.md 2024-09-30 20:46:29 +02:00
CaCO3
f6a3dc5851 Rename NUMBER.AnalogDigitTransitionStart.md to NUMBER.AnalogToDigitTransitionStart.md 2024-09-30 20:40:02 +02:00
CaCO3
d027adf006 revert TFlite submodule update as certain modules crash with it, see https://github.com/jomjol/AI-on-the-edge-device/issues/3269 2024-09-30 19:48:49 +02:00
CaCO3
bd5be5c5ec Prepare next release (#3267) (#3270)
* 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

---------



* 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

---------



* 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).

---------



* 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.



* 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

---------



* 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 in 33893eb566 but 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

---------




* 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

---------



* 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

---------



* 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

---------



* 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 commit cc9297d483.

* not using platformio 6.1.16

* Revert "not using platformio 6.1.16"

This reverts commit ef18e4fae7.

* 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*

---------



* 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>
2024-09-29 23:22:55 +02:00
CaCO3
ca01f5a38f 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 in 33893eb566 but 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 commit cc9297d483.

* not using platformio 6.1.16

* Revert "not using platformio 6.1.16"

This reverts commit ef18e4fae7.

* 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>
2024-09-29 23:22:33 +02:00
CaCO3
3b3a3ebcc9 Update Changelog.md 2024-09-29 23:20:15 +02:00
CaCO3
7d62cf67fe Update Changelog.md 2024-09-29 23:00:30 +02:00
CaCO3
f6bdd48bca 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>
2024-09-29 22:10:10 +02:00
CaCO3
5496573369 added note about only TLS 1.2 is supported (#3213) 2024-09-29 22:01:38 +02:00
kalwados
4522ba087f 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.
2024-09-29 21:08:45 +02:00
Frank Haverland
d370ba5fe6 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 commit cc9297d483.

* not using platformio 6.1.16

* Revert "not using platformio 6.1.16"

This reverts commit ef18e4fae7.
2024-09-28 15:40:24 +02:00
CaCO3
f39dacc1c5 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>
2024-09-28 15:29:15 +02:00
michael
aad1a0e78d Update platformIO to 6.9.0 (Contains ESP IDF 5.3.1) 2024-09-26 21:22:22 +02:00
michael
276efef783 cleanup 2024-09-26 17:34:12 +02:00
michael
79476a8458 cleanup 2024-09-26 16:29:31 +02:00
michael
2b7da5b44e Update edit_alignment.html 2024-09-26 14:41:25 +02:00
michael
ebcec97d1d cleanup 2024-09-24 03:12:27 +02:00
michael
85375b6505 cleanup 2024-09-24 02:53:36 +02:00
michael
085c47b651 cleanup 2024-09-23 15:44:30 +02:00
Francesco Carnielli
20a04b888f 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
2024-09-22 21:50:38 +02:00
jomjol
098b1bd025 Update digital CNN 2024-09-17 20:47:13 +02:00
CaCO3
d1c815ce69 Update text on recognition page 2024-09-03 23:10:15 +02:00
michael
67c3020d7d Update ClassFlowDefineTypes.h
RateType renamed to MaxRateType
2024-09-01 16:36:51 +02:00
michael
61bca4ebb8 Update ClassFlowPostProcessing.cpp
deleted some unnecessary double entries
RateType renamed to MaxRateType
2024-09-01 16:36:40 +02:00
michael
3219202c53 Add files via upload (#3207) 2024-09-01 08:34:29 +02:00
Raphael Hehl
cd29690b96 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>
2024-09-01 08:33:46 +02:00
michael
3a34564ee2 Update readconfigparam.js
Adjusted camera settings to make the image brighter.
2024-08-31 16:09:29 +02:00
michael
174743ae7f Update config.ini
Adjusted camera settings to make the image brighter.
2024-08-31 16:08:48 +02:00
michael
e5eca6a53f Update main.cpp 2024-08-31 15:33:06 +02:00
michael
d8e37dce48 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>
2024-08-30 19:29:57 +02:00
michael
822753bb4f Update MainFlowControl.cpp 2024-08-30 00:18:35 +02:00
jasaw
7225792b4b 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
2024-08-29 21:57:26 +02:00
michael
b4f6b1a4fb Update MainFlowControl.cpp 2024-08-29 18:45:35 +02:00
CaCO3
21ec58daa0 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>
2024-08-28 22:26:44 +02:00
CaCO3
2c69e90fac fix svg favicon
The svg one got added in 33893eb566 but does not work on Firefox
2024-08-27 21:01:56 +02:00
michael
5c57522b71 Update readconfigcommon.js
fix for: The same message("Image Contrast got enhanced") came up with "Update Marker" and "Enhance Image Contrast".
2024-08-27 16:56:23 +02:00
michael
f8eb4db171 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
2024-08-24 13:19:21 +02:00
Raphael Hehl
c9a3df4eec 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>
2024-08-24 00:05:16 +02:00
CaCO3
acf669900f typo 2024-08-20 23:00:24 +02:00
michael
cb3f082218 CamParameter documentation update
https://github.com/jomjol/AI-on-the-edge-device/issues/3185
2024-08-19 00:42:33 +02:00
michael
20980b2bcd Delete param-docs/parameter-pages/Alignment/InitialMirror.md
has been replaced by CamHmirror.md
2024-08-18 04:39:21 +02:00
michael
773d21a875 Delete param-docs/parameter-pages/Alignment/FlipImageSize.md
has been replaced by CamVflip.md
2024-08-18 04:38:07 +02:00
michael
3a9c9ac2a4 Delete param-docs/parameter-pages/TakeImage/FixedExposure.md
has been replaced by CamAec.md
2024-08-18 04:36:01 +02:00
michael
c7e340d3a5 Delete param-docs/parameter-pages/TakeImage/ImageSize.md
has been replaced by CamZoomSize.md
2024-08-18 04:29:11 +02:00
michael
0441753a33 Delete param-docs/parameter-pages/TakeImage/ZoomOffsetY.md
has been replaced by CamZoomOffsetY.md
2024-08-18 04:27:18 +02:00
michael
fb6cb44728 Delete param-docs/parameter-pages/TakeImage/ZoomOffsetX.md
has been replaced by CamZoomOffsetX.md
2024-08-18 04:26:32 +02:00
michael
ae69942dd9 Delete param-docs/parameter-pages/TakeImage/ZoomMode.md
has been replaced by CamZoomSize.md
2024-08-18 04:25:47 +02:00
michael
65437727f7 Delete param-docs/parameter-pages/TakeImage/Zoom.md
has been replaced by CamZoom.md
2024-08-18 04:24:42 +02:00
michael
ccefe57795 Delete param-docs/parameter-pages/TakeImage/ImageQuality.md
has been replaced by CamQuality.md
2024-08-18 04:22:49 +02:00
michael
e3ff049720 Delete param-docs/parameter-pages/TakeImage/Sharpness.md
has been replaced by CamSharpness.md
2024-08-18 04:21:41 +02:00
michael
39e84baf8b Delete param-docs/parameter-pages/TakeImage/Saturation.md
has been replaced by CamSaturation.md
2024-08-18 04:20:44 +02:00
michael
eb7d078a1a Delete param-docs/parameter-pages/TakeImage/Negative.md
has been replaced by CamSpecialEffect.md
2024-08-18 04:19:42 +02:00
michael
b6c6805a08 Delete param-docs/parameter-pages/TakeImage/Grayscale.md
has been replaced by CamSpecialEffect.md
2024-08-18 04:19:22 +02:00
michael
d567a5d7f2 Delete param-docs/parameter-pages/TakeImage/Contrast.md
has been replaced by CamContrast.md
2024-08-18 04:17:35 +02:00
michael
6922970185 Delete param-docs/parameter-pages/TakeImage/Brightness.md
has been replaced by CamBrightness.md
2024-08-18 04:16:33 +02:00
michael
9a4b51d6de Delete param-docs/parameter-pages/TakeImage/AutoExposureLevel.md
has been replaced by CamAeLevel.md
2024-08-18 04:15:42 +02:00
michael
2546ab81ff Delete param-docs/parameter-pages/TakeImage/Aec2.md
has been replaced by CamAec2.md
2024-08-18 04:14:09 +02:00
michael
7b7544079f Bugfix for boot loop (#3175)
* Add files via upload

* Add files via upload

* Add files via upload
2024-08-17 23:02:21 +02:00
Sebastian Lövdahl
17fe87b349 Handle empty prevalue.ini gracefully (#3162)
Fixes #2149.
2024-08-09 01:01:58 +02:00
Sebastian Lövdahl
f99dc8fdfc 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>
2024-08-09 01:00:38 +02:00
michael
cce992754c Update ClassFlowAlignment.cpp 2024-08-06 00:59:39 +02:00
michael
eefccf6e11 Update ClassFlowPostProcessing.cpp 2024-08-06 00:56:55 +02:00
michael
64bb4f0ff6 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
2024-08-05 23:57:17 +02:00
Henry Thasler
f534741205 proposal for renaming and documentation (#3115) 2024-07-21 14:09:51 +02:00
michael
ee38bc7dc6 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!
2024-07-20 15:53:16 +02:00
michael
132834c3fd Update Helper.cpp 2024-07-17 16:07:23 +02:00
michael
d3d9c64f3b Update Helper.h 2024-07-17 13:14:00 +02:00
michael
aa2a4edf7e Update Helper.cpp 2024-07-17 13:12:15 +02:00
CaCO3
8012b7f43e Fix actions-label-commenter 2024-06-09 23:20:13 +02:00
CaCO3
009ab4c896 Update reply-bot.yaml (#3107) 2024-06-09 23:13:34 +02:00
CaCO3
c54ca18e4e 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>
2024-06-03 23:36:14 +02:00
CaCO3
beb09593eb Typo 2024-06-02 23:04:42 +02:00
Henry Thasler
1a76ae121c 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>
2024-06-02 21:13:15 +02:00
Henry Thasler
1300242d4a 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
2024-06-02 21:00:44 +02:00
CaCO3
79543df23b Update reply-bot.yaml 2024-05-07 23:57:02 +02:00
michael
4049d752ba Update overview.html
CamFrameSize is no longer needed/used for zoom
2024-04-27 00:03:26 +02:00
michael
dc90972659 Update info.html
function loadWLANSSID() was present three times
2024-04-24 07:25:14 +02:00
michael
32282ecfe2 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.
2024-04-16 13:14:27 +02:00
michael
ae6a94544b fix readconfigparam.js
Unfortunately, I didn't take out some entries from other experiments because I overlooked/forgot them^^
2024-04-16 04:26:35 +02:00
michael
70b031eacc fix edit_config_template.html
Unfortunately, I didn't take out some entries from other experiments because I overlooked/forgot them^^
2024-04-16 04:25:51 +02:00
michael
c3fadf5c2a Source code formatting, ClassFlowPostProcessing.cpp 2024-04-15 22:12:02 +02:00
Marco H
7e5f6bf4a5 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>
2024-04-11 21:28:33 +02:00
michael
88b531ae8b 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
2024-04-11 21:12:40 +02:00
jomjol
8481cc4b26 Update tflite 2024-03-30 14:47:26 +01:00
jomjol
ecaed38c1d Update tflite 2024-03-30 09:07:42 +01:00
jomjol
d6a1838d47 Create dig-class11_1701_s2.tflite 2024-03-25 08:25:47 +01:00
kub3let
5194c466be always reset change absolute (#2956) 2024-03-22 21:55:11 +01:00
Frank Haverland
043de9265a Fix test (#2933) 2024-03-20 19:22:33 +01:00
CaCO3
08a350172d renamed model file to make naming consistent 2024-03-13 22:28:41 +01:00
CaCO3
7e806df64d Renamed menu entry Alignment -> References 2024-02-18 09:52:24 +01:00
CaCO3
dccfb5e91e The parameter "negative" is processed on the MCU 2024-02-17 22:01:31 +01:00
michael
fbe4609bb9 Update edit_config_template.html (#2925)
Zoom-Einstellungen ausblenden, wenn zoom deaktiviert ist +
Kameraeinstellungen nicht nur in der config.ini speichern, sondern auch setzen
2024-02-17 10:17:08 +01:00
michael
3e85cfb456 Update edit_reference.html (#2924)
Zoom-Einstellungen ausblenden, wenn zoom deaktiviert ist
2024-02-17 10:17:00 +01:00
jomjol
5dff4ca8cf Create dig-cont_0640_s3_q.tflite 2024-02-17 08:25:12 +01:00
CaCO3
0d0b0187f4 Update index.html 2024-02-17 01:13:17 +01:00
CaCO3
4cf9ea6c45 updated changelog 2024-02-17 00:51:10 +01:00
CaCO3
1b76e0f449 restructure menu 2024-02-17 00:50:41 +01:00
CaCO3
d4a0ad20ff Restructure menus (#2921)
* renamed config pages
* restructured menu
2024-02-17 00:40:46 +01:00
CaCO3
df72445e79 show note a bit longer 2024-02-16 22:45:32 +01:00
CaCO3
456cb93809 Update reply-bot.yaml 2024-02-16 22:36:16 +01:00
CaCO3
d968a7adc6 Update reply-bot.yaml 2024-02-16 22:33:38 +01:00
CaCO3
9a52b8b2f3 Update reply-bot.yaml 2024-02-16 22:30:15 +01:00
CaCO3
8caa852bbf Update info.html 2024-02-16 22:27:00 +01:00
michael
4faca4c46c Update edit_reference.html (#2914)
On the ref image page, when a cam setting gets changed, disable the save button to enforce creating a new image first
2024-02-16 22:16:38 +01:00
michael
238fc5fae3 Update edit_config_param_template.html (#2915)
Show Warning when changing camera settings in edit config param
2024-02-16 22:13:09 +01:00
CaCO3
c32ca5a23c the yaml files must have the file extention yaml. If they are called yml, they are threated slightly different in the actions section 2024-02-16 00:03:24 +01:00
CaCO3
827d9d1700 updated param doc: added note that the ref image and alignment marks need to be updated as well (#2916)
param-doc: added note that the ref image and alignment marks need to be updated as well
2024-02-15 23:49:14 +01:00
CaCO3
0ea4b3b3ce Update Changelog.md 2024-02-15 23:28:50 +01:00
CaCO3
3e26c6c743 restructured ROI pages 2024-02-15 22:16:18 +01:00
michael
fa5c99b3cb Button to hide other red Digit Frames (#2907)
Button to hide other red Digit Frames for easier setup, implements #2680
2024-02-15 21:55:01 +01:00
CaCO3
6feae4e239 Use valid default values 2024-02-15 00:12:37 +01:00
CaCO3
ef64be3888 Enhance ref image page (#2910)
Enhanced Reference Image page
2024-02-14 23:49:35 +01:00
CaCO3
cc89d625f2 Enhance ref image page2 (#2908)
minor fixes
2024-02-14 21:02:08 +01:00
CaCO3
08ba754b88 Restructure reference image page (#2905) 2024-02-14 16:54:31 +01:00
michael
6b38e44d7f Loading alignment page faster (#2868)
Da es Probleme mit param_temp gab (mal ging es, mal nicht), habe ich extra Parameter angelegt (_rotate_temp, _mirror_temp, _isize_temp, _grayscale_temp, _negative_temp, _aec2_temp, _FixedExposure_temp, _zoom_temp, _zm_temp, _x_temp, _y_temp, _intensity_temp, _brightness_temp, _contrast_temp, _saturation_temp, _sharpness_temp, _ae_temp).
Bei den bisherigen Tests, hat alles so funktioniert wie es soll.
2024-02-14 16:24:29 +01:00
CaCO3
141aea7fa7 Revert "Implemented late analog / digital transition (#2778)"
This reverts commit b5a4cfed96.
2024-02-12 22:41:56 +01:00
CaCO3
bcd07761b6 . 2024-02-12 22:37:46 +01:00
CaCO3
fe4d861e15 . 2024-02-12 22:37:46 +01:00
CaCO3
71322c9fbe fixed review findings 2024-02-12 22:37:46 +01:00
CaCO3
f8b4881a50 . 2024-02-12 22:37:46 +01:00
CaCO3
438d5696e4 . 2024-02-12 22:37:46 +01:00
CaCO3
0d391c8780 . 2024-02-12 22:37:46 +01:00
CaCO3
59de6319a1 . 2024-02-12 22:37:46 +01:00
CaCO3
3805687219 . 2024-02-12 22:37:46 +01:00
CaCO3
c6a789dc45 . 2024-02-12 22:37:46 +01:00
CaCO3
246f9cfc31 . 2024-02-12 22:37:46 +01:00
CaCO3
b2d8c60bb1 . 2024-02-12 22:37:46 +01:00
CaCO3
1d573cd18a . 2024-02-12 22:37:46 +01:00
CaCO3
b2e5cdd8a3 . 2024-02-12 22:37:46 +01:00
CaCO3
f7fde7c430 . 2024-02-12 22:37:46 +01:00
CaCO3
2c19080a66 . 2024-02-12 22:37:46 +01:00
CaCO3
35663c5fd4 add tooltip css 2024-02-12 22:37:46 +01:00
CaCO3
5b449d5c45 update param doc 2024-02-12 22:37:46 +01:00
CaCO3
3a5f3496d5 fix typo in variable name 2024-02-12 22:37:46 +01:00
CaCO3
00434d01c3 update action 2024-02-12 22:37:46 +01:00
CaCO3
3e0bb81e32 added tooltips to reference image page 2024-02-12 22:37:46 +01:00
CaCO3
4f57f9eafd add spacing 2024-02-12 22:37:46 +01:00
CaCO3
f24ec581e6 Added FixedExposure to reference image page 2024-02-12 22:37:46 +01:00
CaCO3
0d78bb78ea corrected default 2024-02-12 22:37:46 +01:00
CaCO3
47aea007b3 Added param InitialMirror to config page 2024-02-12 22:37:46 +01:00
CaCO3
284b3f428e on reference image page, hide expert params and add checkbox to unhide them 2024-02-12 22:37:46 +01:00
CaCO3
92d45c7971 Moved 6 Reference Impage Parameters from expert to normal level 2024-02-12 22:37:46 +01:00
CaCO3
ff1d9d3b4f prepare table row IDs to be removed as tehy seem unused 2024-02-12 22:37:46 +01:00
CaCO3
2b57dd0853 . 2024-02-12 22:37:46 +01:00
CaCO3
dd8f5eea22 Added parameters to config page 2024-02-12 22:37:46 +01:00
Joo Aun Saw
60c5305378 Fix up Zoom option documentation 2024-02-12 22:37:46 +01:00
Joo Aun Saw
8b1c65a38a add documentation for new TakeImage options 2024-02-12 22:37:46 +01:00
Joo Aun Saw
4f5933c4f2 add default values for new TakeImage options in config.ini 2024-02-12 22:37:46 +01:00
Joo Aun Saw
06c9bfb0de html: fix negative not applied correctly after saving reference 2024-02-12 22:37:46 +01:00
Joo Aun Saw
69f1a99b55 ov2640: support sharpness control 2024-02-12 22:37:46 +01:00
Joo Aun Saw
a8fb88a35d Support negative photo effect and auto exposure control 2 2024-02-12 22:37:46 +01:00
Joo Aun Saw
d418d22155 removed redundant changes 2024-02-12 22:37:46 +01:00
Joo Aun Saw
53e8cf49f9 limit auto exposure values to range -2 to +2 2024-02-12 22:37:46 +01:00
Joo Aun Saw
ac4f823cbf Support crop image on sensor, grayscale, auto exposure level 2024-02-12 22:37:46 +01:00
CaCO3
444dc0fa39 add missing image 2024-02-11 22:14:57 +01:00
CaCO3
5053a31245 renaming 2024-02-11 22:10:41 +01:00
CaCO3
44cf8933d4 . 2024-02-11 22:10:41 +01:00
CaCO3
35de56be04 Add Firmware Version to MQTT 2024-02-11 22:10:41 +01:00
CaCO3
80a6fc1dc3 Update edit_config_param_template.html (#2881) 2024-02-09 23:02:10 +01:00
CaCO3
d2c47fcde2 Fix pipeline 2024-02-09 14:43:22 +01:00
CaCO3
7b3a493587 v15.6.0 (#2876) (#2877)
* Fix pipeline (#2860)

fix action

* ATA-Trim support (#2864)

Fix issues with the SD-Card initialization

* Update Changelog.md

---------

Co-authored-by: michael <Heinrich-Tuning@web.de>
2024-02-09 14:00:40 +01:00
CaCO3
217f543578 Update Changelog.md 2024-02-09 13:59:23 +01:00
michael
797fc5e764 ATA-Trim support (#2864)
Fix issues with the SD-Card initialization
2024-02-09 13:56:25 +01:00
CaCO3
7a4e82a44e Fix pipeline (#2860)
fix action
2024-02-03 23:16:15 +01:00
CaCO3
019069cd16 v15.5.0 (#2850) (#2851)
* update

* Revert "v15.4.0"

This reverts commit 74d4f20858.

* Revert "prepare v15.4.0 versuch 2"

This reverts commit e790a14caa.

* revert submnodules (#2768)



* Update submodules (#2769)

- Update `esp-nn` to v1.0.2
- Update `esp32-camera` to v2.0.6
- Updated `tflite-micro-esp-examples` (The repo got renamed to `esp-tflite-micro ` and the folder structure got cleaned up).

* fix(unity-test): Run unity tests in dedicated task
Avoid running out of heap

* Add delay

* Update

* Update

* Enhance busy notification (#2774)

* on marker updating, show message and retry until round got completed

* same for contrast enhancement

---------



* Fix negatives on extended resolution false #2744 (#2772)

* not extended resolution allows -1 on the lowest digit

* not extended resolution allows -1 on the lowest number

* negatives on last value digit with -1 will set to prevalue and is not an error  #2744

---------



* Implemented late analog / digital transition (#2778)

* Implemented late transition

Complete rewrite of analog / digital transition

Two tests is still failing, which need to be discussed.

* Allow wider range of transition values to support late transition

* Added documentation

* Fix testings (#2783)

* fix all tests and more description

* The decimal point offset. -3 corresponds to x.yyy

---------



* Bugfix InfluxDB shifting times (#2785)

* Modify time_sntp

* Update time_sntp.cpp

* Update time_sntp.cpp

* update

* Update interface_influxdb.cpp

* Update interface_influxdb.cpp

* Update time_sntp.cpp

* Upload

* Update interface_influxdb.cpp

* Update interface_influxdb.cpp

* Update interface_influxdb.cpp

* Remove Time Convert vom influx Interface

* Update platform-espressif32 to 6.5.0 (#2770)

* Update ESP IDF to 6.5.0

* Migration to new IDF

* Correct smtp vor v5.1

---------




* ATA-Trim support (#2781)

* Add files via upload

* Update main.cpp

* Update main.cpp

* Update main.cpp

* Update Helper.cpp

* Update Helper.h

* Update CMakeLists.txt

* Update CMakeLists.txt

* Update diskio_sdmmc_mh.c

* Update diskio_sdmmc_mh.h

* Update ff_mh.c

* Update vfs_fat_sdmmc_mh.c

* Update sdmmc_common_mh.h

* Update sdmmc_common_mh.c

* Update Helper.cpp

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update ff_mh.c

---------



* Update Changelog.md

* Add device info info page (#2789)



* fix chip information REST API

* Update pipelines to fix warnings (#2841)

Update actions

* Move param doc (#2843)

moved param doc from docs repo to here

* fix(tflite): Fix memory leaks in tflite integration (#2842)

* Update Changelog.md (#2849)

---------

Signed-off-by: Florian Grabmeier <flo.grabmeier@gmail.com>
Co-authored-by: jomjol <30766535+jomjol@users.noreply.github.com>
Co-authored-by: CaCO3 <caco@ruinelli.ch>
Co-authored-by: Slider0007 <jobbelle@gmx.net>
Co-authored-by: Frank Haverland <fspapaping@googlemail.com>
Co-authored-by: Martin Siggel <martin.siggel@dlr.de>
Co-authored-by: michael <Heinrich-Tuning@web.de>
Co-authored-by: flox_x <93255373+flooxo@users.noreply.github.com>
Co-authored-by: Slider0007 <115730895+Slider0007@users.noreply.github.com>
2024-02-02 13:52:05 +01:00
CaCO3
4de1152cf3 Update Changelog.md (#2849) 2024-02-02 13:46:42 +01:00
Slider0007
0e0fb459dc fix(tflite): Fix memory leaks in tflite integration (#2842) 2024-02-02 13:23:51 +01:00
CaCO3
8410df6144 Move param doc (#2843)
moved param doc from docs repo to here
2024-01-31 21:53:56 +01:00
CaCO3
4990858101 Update pipelines to fix warnings (#2841)
Update actions
2024-01-31 20:53:41 +01:00
CaCO3
fc1f8ee242 fix chip information REST API 2024-01-08 23:41:48 +01:00
flox_x
252c399a76 Add device info info page (#2789)
Signed-off-by: Florian Grabmeier <flo.grabmeier@gmail.com>
2024-01-08 23:23:57 +01:00
jomjol
eb7f2b3705 Update Changelog.md 2024-01-02 09:04:15 +01:00
michael
2ed6fb0f0d ATA-Trim support (#2781)
* Add files via upload

* Update main.cpp

* Update main.cpp

* Update main.cpp

* Update Helper.cpp

* Update Helper.h

* Update CMakeLists.txt

* Update CMakeLists.txt

* Update diskio_sdmmc_mh.c

* Update diskio_sdmmc_mh.h

* Update ff_mh.c

* Update vfs_fat_sdmmc_mh.c

* Update sdmmc_common_mh.h

* Update sdmmc_common_mh.c

* Update Helper.cpp

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update ff_mh.c

---------

Co-authored-by: CaCO3 <caco3@ruinelli.ch>
2024-01-02 08:56:46 +01:00
CaCO3
b5213b01af Update platform-espressif32 to 6.5.0 (#2770)
* Update ESP IDF to 6.5.0

* Migration to new IDF

* Correct smtp vor v5.1

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>
Co-authored-by: jomjol <30766535+jomjol@users.noreply.github.com>
2024-01-01 22:00:23 +01:00
jomjol
473e458b85 Bugfix InfluxDB shifting times (#2785)
* Modify time_sntp

* Update time_sntp.cpp

* Update time_sntp.cpp

* update

* Update interface_influxdb.cpp

* Update interface_influxdb.cpp

* Update time_sntp.cpp

* Upload

* Update interface_influxdb.cpp

* Update interface_influxdb.cpp

* Update interface_influxdb.cpp

* Remove Time Convert vom influx Interface
2024-01-01 10:41:12 +01:00
Frank Haverland
4f3f3d9af2 Fix testings (#2783)
* fix all tests and more description

* The decimal point offset. -3 corresponds to x.yyy

---------

Co-authored-by: jomjol <30766535+jomjol@users.noreply.github.com>
2023-12-31 14:43:08 +01:00
Martin Siggel
b5a4cfed96 Implemented late analog / digital transition (#2778)
* Implemented late transition

Complete rewrite of analog / digital transition

Two tests is still failing, which need to be discussed.

* Allow wider range of transition values to support late transition

* Added documentation
2023-12-31 12:04:09 +01:00
Frank Haverland
6fca4d8d95 Fix negatives on extended resolution false #2744 (#2772)
* not extended resolution allows -1 on the lowest digit

* not extended resolution allows -1 on the lowest number

* negatives on last value digit with -1 will set to prevalue and is not an error  #2744

---------

Co-authored-by: jomjol <30766535+jomjol@users.noreply.github.com>
2023-12-31 12:03:52 +01:00
CaCO3
a11e19fb0c Enhance busy notification (#2774)
* on marker updating, show message and retry until round got completed

* same for contrast enhancement

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>
2023-12-31 11:47:28 +01:00
Frank Haverland
09fa94c95f Merge pull request #2777 from Slider0007/unity-test-rolling
chore(unity-test): Run unity tests in dedicated task
2023-12-30 11:55:22 +01:00
Slider0007
f01b4dbd13 Update 2023-12-29 09:57:59 +01:00
Slider0007
dbf1770016 Update 2023-12-29 09:56:47 +01:00
Slider0007
006f3aa063 Add delay 2023-12-29 09:47:37 +01:00
Slider0007
24c46c38b4 fix(unity-test): Run unity tests in dedicated task
Avoid running out of heap
2023-12-28 21:32:43 +01:00
CaCO3
9ced147d9c Update submodules (#2769)
- Update `esp-nn` to v1.0.2
- Update `esp32-camera` to v2.0.6
- Updated `tflite-micro-esp-examples` (The repo got renamed to `esp-tflite-micro ` and the folder structure got cleaned up).
2023-12-28 12:13:57 +01:00
CaCO3
0808895bd6 revert submnodules (#2768)
Co-authored-by: CaCO3 <caco@ruinelli.ch>
2023-12-28 09:27:42 +01:00
jomjol
d2dec9fa59 Revert "prepare v15.4.0 versuch 2"
This reverts commit e790a14caa.
2023-12-22 23:50:56 +01:00
jomjol
7e7bc3dd68 Revert "v15.4.0"
This reverts commit 74d4f20858.
2023-12-22 23:48:43 +01:00
jomjol
5b09cd0d59 update 2023-12-22 23:47:17 +01:00
jomjol
74d4f20858 v15.4.0 2023-12-22 23:38:31 +01:00
jomjol
e790a14caa prepare v15.4.0 versuch 2 2023-12-22 23:31:13 +01:00
jomjol
f023a6b739 Revert "v15.4.0"
This reverts commit 374462a7d8.
2023-12-22 23:22:57 +01:00
jomjol
1e463188ea Revert "Update Changelog.md"
This reverts commit 9991196961.
2023-12-22 23:22:08 +01:00
jomjol
9991196961 Update Changelog.md 2023-12-22 23:04:52 +01:00
jomjol
ecece0f7fc Update dependencies.lock 2023-12-22 22:55:54 +01:00
jomjol
1b3b7595c1 Merge branch 'rolling' 2023-12-22 22:46:36 +01:00
jomjol
6d10f712d1 Update Changelog.md 2023-12-22 22:46:16 +01:00
jomjol
b84a2db050 Update config.ini 2023-12-22 22:45:32 +01:00
jomjol
374462a7d8 v15.4.0 2023-12-22 22:43:08 +01:00
Frank Haverland
4facd7be05 new images on analog and digits (#2756)
* new images on dig-class100, older ana-class100 removed

* new images on analog and digits
2023-12-22 22:42:33 +01:00
jomjol
3baf5865ad Prepare 15.4.0 2023-12-21 19:21:22 +01:00
CaCO3
02138c44ac rename InfluxDBv2 parameter Database to Bucket (#2704)
* rename InfluxDBv2 parameter Database to Basket

* only enable the field if it is a boolean

* corrected "Basket" to "Bucket"

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>
2023-11-22 23:43:23 +01:00
Slider0007
1094c8a0a8 fix(influxdb): Consider DST setting for UTC time conversion (#2679)
* fix(influxdb): Consider DST setting for UTC time conversion

* Update
2023-11-12 12:04:18 +01:00
LordGuilly
75b15b8e9d added config entries for MQTT TLS (#2651)
3 new entries in the config section, for setting file paths for
        - Root CA
        - Client Certificate
        - Client Private Key
 (all set as expert parameters)

- logging cert filenames

added config entries for MQTT TLS

 3 new entries in the config section, for setting file paths for
        - Root CA
        - Client Certificate
        - Client Private Key

- logging cert filenames

MQTT-TLS: Updates for the PR comments

- config.ini now has default values closer to "real" life filenames
- MQTT cert entries are hidden as Expert parameters
- Fixed debug logging at MQTT interface for unhandled messages
2023-11-07 22:58:16 +01:00
CaCO3
36c12b400b rework test-domain check 2023-11-07 22:42:15 +01:00
CaCO3
35d90cd0ee update readme 2023-10-21 22:39:21 +02:00
CaCO3
999a8d9374 updated readme 2023-10-21 22:35:13 +02:00
CaCO3
8a4269c6a0 Add files via upload 2023-10-21 22:32:25 +02:00
CaCO3
8f5579cca5 updated readme 2023-10-21 22:30:29 +02:00
CaCO3
e58b3a2cf8 update webinstaller 2023-10-21 22:23:08 +02:00
CaCO3
222ee0921c udpate webinstaller 2023-10-21 22:19:07 +02:00
CaCO3
e2bfcd26c9 update web installer 2023-10-21 22:15:47 +02:00
CaCO3
18917b2d82 Delete docs/manifest_template.json 2023-10-21 01:06:52 +02:00
CaCO3
f0dea3abcb Delete docs/binary/firmware.bin 2023-10-21 01:06:42 +02:00
CaCO3
bd2d8b4a15 Update manual-update-webinstaller.yml 2023-10-21 01:06:15 +02:00
CaCO3
80e3f50a5b Update manifest.json 2023-10-21 01:05:19 +02:00
CaCO3
f6ca32d69f Update manual-update-webinstaller.yml 2023-10-21 01:03:00 +02:00
CaCO3
49e919c481 Update manual-update-webinstaller.yml 2023-10-21 01:00:21 +02:00
CaCO3
de768c4f44 Delete releases/download directory 2023-10-21 00:49:24 +02:00
CaCO3
002fc033aa Delete firmware directory 2023-10-21 00:47:05 +02:00
CaCO3
f4af8de699 fix paypal button (#2666)
* Add files via upload

* Update README.md

* Update README.md

* Update README.md

* Update README.md
2023-10-21 00:43:36 +02:00
CaCO3
e4d6707a0b Update README.md 2023-10-21 00:27:52 +02:00
CaCO3
9f03e68690 Update README.md 2023-10-21 00:27:32 +02:00
CaCO3
b1df7df580 added label action 2023-10-20 23:35:07 +02:00
CaCO3
ebc9be4a28 added label action 2023-10-20 23:27:10 +02:00
jomjol
5d0fc73c13 Updated feature request 2023-09-03 15:48:00 +02:00
jomjol
40a1aa0430 Update submodules, include only needed layers of tflite (#2586)
* Initial version

* Working Version

* Update

* Update main.cpp

* Updated Docu
2023-08-20 21:49:28 +02:00
TheDubliner
d7a733512f 📚 Fix minor typos, grammar and formatting issues. (#2575) 2023-08-15 21:37:22 +02:00
Frank Haverland
dc9f1aad27 new images on dig-class100, older ana-class100 removed (#2545) 2023-08-02 21:46:00 +02:00
Frank Haverland
cd3e641bcc #2540 fix trunc of first with imprecise precision (#2543)
* added more debug for #2447

* new model on new images dig-class100-0165_s2

* #2465 fix first digit with extended_Resolution=false

* fix #2491

* #2540 fix trunc of first with imprecise precision
2023-07-30 18:25:56 +02:00
Slider0007
ad72ffa37c mqtt_handler_set_prevalue: fix memory leak (#2544) 2023-07-30 18:25:35 +02:00
Giel van Schijndel
2d45a0ed26 fix: provide proper error messages for invalid /info?type= query parameter (#2533) 2023-07-24 21:44:06 +02:00
Giel van Schijndel
e8065ef414 fix(fileserver): avoid sending *two* "last-chunk" sequences (#2532)
Because a zero-sized chunk indicates the end of a HTTP response sending
another such zero-sized chunk is not interpretable by the HTTP client.

See [RFC2616 3.6.1] "Chunked Transfer Encoding" for details.

[RFC2616 3.6.1]: https://datatracker.ietf.org/doc/html/rfc2616#section-3.6.1
2023-07-24 21:43:56 +02:00
pfeifferch
33893eb566 Shortcut Icon hinzugefügt (#2530)
* Add files via upload

Shortcut icon

* Update index.html

Shortcut icon
2023-07-23 20:33:04 +02:00
jomjol
3fbff0ad33 Merge branch 'rolling' 2023-07-22 11:41:24 +02:00
jomjol
28cabea7f2 Prepare v15.3.0 2023-07-22 09:53:24 +02:00
CaCO3
5d06130a88 enable RSSI roaming by default and set it to -75 dBm (#2504) 2023-07-10 19:50:28 +02:00
LordGuilly
3497a86084 fixed build issues when enabling DEBUG_DETAIL_ON (#2509)
fixed build issues when enabling DEBUG_DETAIL_ON

added missing header when DEBUG_DETAIL_ON is enabled
2023-07-09 22:59:34 +02:00
Frank Haverland
84707fb27a fix #2491 - missing </li> (#2495)
* added more debug for #2447

* new model on new images dig-class100-0165_s2

* #2465 fix first digit with extended_Resolution=false

* fix #2491
2023-07-01 21:16:00 +02:00
CaCO3
0b81af7cb8 Update PlatformIO to 6.3.2 (#2499) 2023-06-30 00:11:56 +02:00
Frank Haverland
61efe1a6ef #2465 Fix first digit on extended_Resolution=false (#2466)
* added more debug for #2447

* new model on new images dig-class100-0165_s2

* #2465 fix first digit with extended_Resolution=false
2023-06-12 20:14:30 +02:00
Frank Haverland
09ecd722cc new model dig-class_0165_s2 on new images (#2455)
* added more debug for #2447

* new model on new images dig-class100-0165_s2
2023-06-06 20:17:27 +02:00
Frank Haverland
5615fd8137 added more debug for #2447 (#2450) 2023-06-03 07:24:14 +02:00
Slider0007
7ebf68411f Analog ROI: Fix wrong multiplier view - only analog ROI, no digit ROI (#2440)
* Fix multiplier view with only analog ROIs

* Refactor multiplier view for digit ROI
2023-06-01 20:46:34 +02:00
Frank Haverland
34835dca84 new version of dig-class100 (#2437) 2023-06-01 20:45:56 +02:00
CaCO3
697ff4c4b6 Update platformio to 6.3.1 2023-05-26 13:31:11 +02:00
CaCO3
0f7c685933 Update PlatformIO to 6.3.0 (#2420)
* Update WebUI

* Initial rotate default to 0.0

* Process related file update: no folder content redirect

* Try to clear cache after intial setup

* Update

* Reference image: remove updatepage

* Update

* Hide "manual flow start"

* Update

* Update

* Update text

* BugFix Make Reference

* Update MainFlowControl.cpp

* Update platformio.ini

* Fix #2393

* Update platformio.ini

---------

Co-authored-by: Slider0007 <jobbelle@gmx.net>
Co-authored-by: jomjol <30766535+jomjol@users.noreply.github.com>
Co-authored-by: CaCO3 <caco@ruinelli.ch>
2023-05-23 21:29:19 +02:00
CaCO3
3ace5aeff1 . 2023-05-23 00:02:18 +02:00
CaCO3
d47ed060b0 Enhance web UI 2023-05-22 23:43:33 +02:00
jomjol
e7dbebffa1 Fix #2393 2023-05-21 13:26:48 +02:00
jomjol
def13d46af Update MainFlowControl.cpp 2023-05-19 22:23:05 +02:00
jomjol
f82a6bf513 Merge branch 'rolling' into update-webui 2023-05-19 22:08:05 +02:00
jomjol
05deecee00 BugFix Make Reference 2023-05-19 21:53:56 +02:00
jomjol
8339b6788f Bug Fix #2403 2023-05-19 21:14:51 +02:00
CaCO3
4e5b084932 SHow correct message in log. Fixes https://github.com/jomjol/AI-on-the-edge-device/issues/2411 2023-05-17 22:16:12 +02:00
jomjol
62fcefee78 Update config.ini 2023-05-09 22:11:07 +02:00
Frank Haverland
14128ca3a7 new models ana-cont, ana-class100, dig-class100 2023-05-09 20:29:33 +02:00
CaCO3
431551fb45 speed up deletion of files (#2389)
* speed up deletion of files

* .

* .

* .

* .

* .

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>
2023-05-05 18:43:46 +02:00
Slider0007
ff52d785cd Update text 2023-05-03 08:50:19 +02:00
Slider0007
f5a7c082d6 Update 2023-05-03 08:46:33 +02:00
Slider0007
f3e90c6293 Update 2023-05-02 23:29:38 +02:00
CaCO3
cbd14a267f v15.2.4 (#2385)
* Testcase for #2145 and debug-log (#2151)

* new models ana-cont-11.0.5, ana-class100-1.5.7, dig-class100-1.6.0

* Testcase for #2145
Added debug log, if allowNegativeRates is handeled

* Fix timezone config parser (#2169)

* make sure to parse the whole config line

* fix crash on empty timezone parameter

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Enhance ROI pages (#2161)

* Check if the ROIs are equidistant. Only if not, untick the checkbox

* renaming

* Check if the ROIs have same y, dy and dx. If so, tick the sync checkbox

* only allow editing space when box is checked

* fix sync check

* show inner frame on all ROIs

* cleanup

* Check if the ROIs have same dy and dx. If so, tick the sync checkbox

* checkbox position

* renaming

* renaming

* show inner frame and cross hairs on all ROIs

* update ROIs on ticking checkboxes

* show timezone hint

* fix deleting last ROI

* cleanup

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* restart timeout on progress, catch error (#2170)

* restart timeout on progress, catch error

* .

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* BugFix #2167

* Release 15.1 preparations (#2171)

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update changelog

* Fix links to PR

* Formating

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

---------

Co-authored-by: Slider0007 <jobbelle@gmx.net>
Co-authored-by: Slider0007 <115730895+Slider0007@users.noreply.github.com>

* fix typo

* Replace relative documentation links with absolute ones pointing to the external documentation (#2180)

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Sort model files in configuration combobox (#2189)

* new models ana-cont-11.0.5, ana-class100-1.5.7, dig-class100-1.6.0

* Testcase for #2145
Added debug log, if allowNegativeRates is handeled

* Sort model files in combobox

* reboot task - increase stack size (#2201)

Avoid stack overflow

* Update interface_influxdb.cpp

* Update Changelog.md

* Show PSRAM usage (#2206)

* centralize PSRAM usage (application code only)

* update logging

* update logging

* fix use after free

* initialize buffer

* free rgb_image before ussing it for new allocation

* use wrapper function

* switch log level to debug

* .

* undo adding free() calls

* .

* add names to all CImage instances

* .

* .

* .

* revert changes of stbi_image_free() with free_psram_heap() on the places where is is not in PSRAM

* .

* typos

* typo

* Added MQTT Outbox explanation/warning

* added CONFIG_SPIRAM_USE_MEMMAP explanation

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Disable custom MQTT Outbox. This also moves the MQTT Publishing memory usage back to the internal RAM!

* log MQTT connection refused reasons (#2216)

* Revert PSRAM usage as it lead to memory fragmentation.
See https://github.com/jomjol/AI-on-the-edge-device/issues/2200 for details

* fix missing value data

* Revert PSRAM usage as it lead to memory fragmentation. (#2224)

See https://github.com/jomjol/AI-on-the-edge-device/issues/2200 for details

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Fix missing value data in graph (#2230)

* fix missing value data

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Update Changelog.md (#2231)

* Update interface_influxdb.cpp (#2233)

* update copyright year

* Cleanup

* Set prevalue using MQTT + set prevalue to RAW value (REST+MQTT) (#2252)

* Use double instead of float

* Error handling + set to RAW if newvalue < 0

* REST SetPrevalue: Set to RAW if newvalue < 0

* set prevalue with MQTT

* removed the stb_image files and re-add them as a submodule. (#2223)

- stb_image.h: Version update 2.25 -> 2.28
- stb_resize.h: Version update 0.96 -> 0.97
- stb_write.h: Version update 1.14 -> 1.16

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Remove obsolete ClassFlowWriteList (#2264)

* Renaming & cleanup of some modules / functions in source code (#2265)

* Rename module tag name

* Rename server_tflite.cpp -> MainFlowControl.cpp

* Remove redundandant MQTTMainTopic function

* Update

* Remove obsolete GetMQTTMainTopic

* Fix last element missing in digit model drop down (#2282)

* Debug influxdb (#2283)

* Fix time offset issues in InfluxDB component. (#2278)

Closes #2273
Closes #2150

* Update interface_influxdb.cpp

* Update interface_influxdb.cpp

* Improve Logging

* Implement TimeSync at beginning

* Update time_sntp.cpp

* Update time_sntp.cpp

* Set Time After WLAN Init

---------

Co-authored-by: Antonin Delpeuch <antonin@delpeuch.eu>

* Implement a camera livestream handler (#2286)

* fix leading NaN (#2310)

* analogROI: Activate save button after ROI creation (#2326)

* Migration of PlatformIO 5.2.0 to 6.1.0 (resp. ESP IDF from 4.4.2 to 5.0.1) (#2305)

* Migration to PlatformIO 6.1.0

* Disable RMTMEM usage as it is no longer allowed -> Smart LEDs not functional!

* moved miniz into subfolder of jomjol_fileserver_ota, else it does not build anymore.

* cleanup

* fix leading NaN (#2310)

* Migration to PlatformIO 6.1.0

* Disable RMTMEM usage as it is no longer allowed -> Smart LEDs not functional!

* moved miniz into subfolder of jomjol_fileserver_ota, else it does not build anymore.

* cleanup

* Task watchdog has new config name

* Fix return value check. It must be something else than ESP_FAIL, but it does not need to be ESP_OK!

* add missing strucures to work around new RMTMEM restriction (untested)

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Keep MainFlowTask alive to handle reboot (#2325)

* Shared PSRAM memory (#2285)

* enable PSRAM logging

* add extra functions for psram shared memroy handling

* CImageBasis objects still should used dynamic memory (eg. rawImage), haw ever tmpImage must be placed inside the shared memory

* Place all STBI allocs inside the shared memory

* The models are placed in the shared PSRAM reagion and must be allocated through the dedicated functions

* .

* renaming

* fix cast warning

* add flag to switch STBI PSRAM usage

* improve PSRAM shared handling

* reserve shared PSRAM as early as possible

* init logging eralier so we can use it in PSRAM shared alloc

* move Wifi_LWIP, BSS_SEG and MQTT Outbox into PSRAM to ffree internal memory

* Check if model fits into reserved shared memory

* Update code/components/jomjol_tfliteclass/CTfLiteClass.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_flowcontroll/ClassFlowControll.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_image_proc/CImageBasis.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* .

* .

* .

* .

* Korrektur Merge Conflict in main.cpp

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>
Co-authored-by: jomjol <30766535+jomjol@users.noreply.github.com>

* fix PSRAM init return value check

* Extend InfluxDBv1 with individual topic names (#2319)

* Implement individual influx topic

* Update interface_influxdb.cpp

* Update interface_influxdb.cpp

* Update FieldName

* analogROI: Activate save button after ROI creation (#2326)

* Migration of PlatformIO 5.2.0 to 6.1.0 (resp. ESP IDF from 4.4.2 to 5.0.1) (#2305)

* Migration to PlatformIO 6.1.0

* Disable RMTMEM usage as it is no longer allowed -> Smart LEDs not functional!

* moved miniz into subfolder of jomjol_fileserver_ota, else it does not build anymore.

* cleanup

* fix leading NaN (#2310)

* Migration to PlatformIO 6.1.0

* Disable RMTMEM usage as it is no longer allowed -> Smart LEDs not functional!

* moved miniz into subfolder of jomjol_fileserver_ota, else it does not build anymore.

* cleanup

* Task watchdog has new config name

* Fix return value check. It must be something else than ESP_FAIL, but it does not need to be ESP_OK!

* add missing strucures to work around new RMTMEM restriction (untested)

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Keep MainFlowTask alive to handle reboot (#2325)

* Shared PSRAM memory (#2285)

* enable PSRAM logging

* add extra functions for psram shared memroy handling

* CImageBasis objects still should used dynamic memory (eg. rawImage), haw ever tmpImage must be placed inside the shared memory

* Place all STBI allocs inside the shared memory

* The models are placed in the shared PSRAM reagion and must be allocated through the dedicated functions

* .

* renaming

* fix cast warning

* add flag to switch STBI PSRAM usage

* improve PSRAM shared handling

* reserve shared PSRAM as early as possible

* init logging eralier so we can use it in PSRAM shared alloc

* move Wifi_LWIP, BSS_SEG and MQTT Outbox into PSRAM to ffree internal memory

* Check if model fits into reserved shared memory

* Update code/components/jomjol_tfliteclass/CTfLiteClass.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_flowcontroll/ClassFlowControll.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_image_proc/CImageBasis.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* .

* .

* .

* .

* Korrektur Merge Conflict in main.cpp

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>
Co-authored-by: jomjol <30766535+jomjol@users.noreply.github.com>

* fix PSRAM init return value check

* Extend incl. indiv. Measurement

* Implement UX

* Update ClassFlowInfluxDBv2.cpp

* Implement individual influx topic

* Update interface_influxdb.cpp

* Update interface_influxdb.cpp

* Update FieldName

* Extend incl. indiv. Measurement

* Implement UX

* Update ClassFlowInfluxDBv2.cpp

* Update main.cpp

---------

Co-authored-by: Slider0007 <115730895+Slider0007@users.noreply.github.com>
Co-authored-by: CaCO3 <caco3@ruinelli.ch>
Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Update Changelog.md (#2344)

* Update Changelog.md

* Update Changelog.md

* merge conflicts

* merge conflicts

* update changelog

* Update Changelog.md

* Fix alignment mark PSRAM issue (#2357)

* Add lock for shared PSRAM memory, use it for the relevant round steps and the Alignment Mark Task

* only allow taking a new image for the Alignment Mark while round got completed

* show success/denial of Alignment Mark Update Request

* .

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Update Changelog.md (#2360)

* Update platformio.ini (#2368)

* Allow the Alignment Mark step while status is "Initializing" or "Initialization (delayed)" or while in setup mode (#2373)

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Improve logging if Autostart is not enabled. Renamed/splitted functions (#2376)

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Cleanup web UI (#2378)

* fix wrong index on backup log

* remove no longer used files/functions

* improve logging on Alignment Mark Update

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Update Changelog.md

* fix broken sysinfo (#2381)

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Update Changelog.md

* Update Changelog.md

* Update sdcard_check.cpp (#2384)

* Update Changelog.md

---------

Co-authored-by: Frank Haverland <fspapaping@googlemail.com>
Co-authored-by: CaCO3 <caco@ruinelli.ch>
Co-authored-by: jomjol <30766535+jomjol@users.noreply.github.com>
Co-authored-by: Slider0007 <jobbelle@gmx.net>
Co-authored-by: Slider0007 <115730895+Slider0007@users.noreply.github.com>
Co-authored-by: Antonin Delpeuch <antonin@delpeuch.eu>
2023-05-02 07:54:28 +02:00
CaCO3
ba7d6b3621 Merge branch 'master' into rolling 2023-05-02 07:53:10 +02:00
CaCO3
d4a492463b Update Changelog.md 2023-05-02 07:51:25 +02:00
CaCO3
46589288e7 Update sdcard_check.cpp (#2384) 2023-05-02 07:49:44 +02:00
CaCO3
81a57d32a8 v15.2.3 (#2382)
* Testcase for #2145 and debug-log (#2151)

* new models ana-cont-11.0.5, ana-class100-1.5.7, dig-class100-1.6.0

* Testcase for #2145
Added debug log, if allowNegativeRates is handeled

* Fix timezone config parser (#2169)

* make sure to parse the whole config line

* fix crash on empty timezone parameter

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Enhance ROI pages (#2161)

* Check if the ROIs are equidistant. Only if not, untick the checkbox

* renaming

* Check if the ROIs have same y, dy and dx. If so, tick the sync checkbox

* only allow editing space when box is checked

* fix sync check

* show inner frame on all ROIs

* cleanup

* Check if the ROIs have same dy and dx. If so, tick the sync checkbox

* checkbox position

* renaming

* renaming

* show inner frame and cross hairs on all ROIs

* update ROIs on ticking checkboxes

* show timezone hint

* fix deleting last ROI

* cleanup

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* restart timeout on progress, catch error (#2170)

* restart timeout on progress, catch error

* .

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* BugFix #2167

* Release 15.1 preparations (#2171)

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update changelog

* Fix links to PR

* Formating

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

---------

Co-authored-by: Slider0007 <jobbelle@gmx.net>
Co-authored-by: Slider0007 <115730895+Slider0007@users.noreply.github.com>

* fix typo

* Replace relative documentation links with absolute ones pointing to the external documentation (#2180)

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Sort model files in configuration combobox (#2189)

* new models ana-cont-11.0.5, ana-class100-1.5.7, dig-class100-1.6.0

* Testcase for #2145
Added debug log, if allowNegativeRates is handeled

* Sort model files in combobox

* reboot task - increase stack size (#2201)

Avoid stack overflow

* Update interface_influxdb.cpp

* Update Changelog.md

* Show PSRAM usage (#2206)

* centralize PSRAM usage (application code only)

* update logging

* update logging

* fix use after free

* initialize buffer

* free rgb_image before ussing it for new allocation

* use wrapper function

* switch log level to debug

* .

* undo adding free() calls

* .

* add names to all CImage instances

* .

* .

* .

* revert changes of stbi_image_free() with free_psram_heap() on the places where is is not in PSRAM

* .

* typos

* typo

* Added MQTT Outbox explanation/warning

* added CONFIG_SPIRAM_USE_MEMMAP explanation

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Disable custom MQTT Outbox. This also moves the MQTT Publishing memory usage back to the internal RAM!

* log MQTT connection refused reasons (#2216)

* Revert PSRAM usage as it lead to memory fragmentation.
See https://github.com/jomjol/AI-on-the-edge-device/issues/2200 for details

* fix missing value data

* Revert PSRAM usage as it lead to memory fragmentation. (#2224)

See https://github.com/jomjol/AI-on-the-edge-device/issues/2200 for details

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Fix missing value data in graph (#2230)

* fix missing value data

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Update Changelog.md (#2231)

* Update interface_influxdb.cpp (#2233)

* update copyright year

* Cleanup

* Set prevalue using MQTT + set prevalue to RAW value (REST+MQTT) (#2252)

* Use double instead of float

* Error handling + set to RAW if newvalue < 0

* REST SetPrevalue: Set to RAW if newvalue < 0

* set prevalue with MQTT

* removed the stb_image files and re-add them as a submodule. (#2223)

- stb_image.h: Version update 2.25 -> 2.28
- stb_resize.h: Version update 0.96 -> 0.97
- stb_write.h: Version update 1.14 -> 1.16

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Remove obsolete ClassFlowWriteList (#2264)

* Renaming & cleanup of some modules / functions in source code (#2265)

* Rename module tag name

* Rename server_tflite.cpp -> MainFlowControl.cpp

* Remove redundandant MQTTMainTopic function

* Update

* Remove obsolete GetMQTTMainTopic

* Fix last element missing in digit model drop down (#2282)

* Debug influxdb (#2283)

* Fix time offset issues in InfluxDB component. (#2278)

Closes #2273
Closes #2150

* Update interface_influxdb.cpp

* Update interface_influxdb.cpp

* Improve Logging

* Implement TimeSync at beginning

* Update time_sntp.cpp

* Update time_sntp.cpp

* Set Time After WLAN Init

---------

Co-authored-by: Antonin Delpeuch <antonin@delpeuch.eu>

* Implement a camera livestream handler (#2286)

* fix leading NaN (#2310)

* analogROI: Activate save button after ROI creation (#2326)

* Migration of PlatformIO 5.2.0 to 6.1.0 (resp. ESP IDF from 4.4.2 to 5.0.1) (#2305)

* Migration to PlatformIO 6.1.0

* Disable RMTMEM usage as it is no longer allowed -> Smart LEDs not functional!

* moved miniz into subfolder of jomjol_fileserver_ota, else it does not build anymore.

* cleanup

* fix leading NaN (#2310)

* Migration to PlatformIO 6.1.0

* Disable RMTMEM usage as it is no longer allowed -> Smart LEDs not functional!

* moved miniz into subfolder of jomjol_fileserver_ota, else it does not build anymore.

* cleanup

* Task watchdog has new config name

* Fix return value check. It must be something else than ESP_FAIL, but it does not need to be ESP_OK!

* add missing strucures to work around new RMTMEM restriction (untested)

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Keep MainFlowTask alive to handle reboot (#2325)

* Shared PSRAM memory (#2285)

* enable PSRAM logging

* add extra functions for psram shared memroy handling

* CImageBasis objects still should used dynamic memory (eg. rawImage), haw ever tmpImage must be placed inside the shared memory

* Place all STBI allocs inside the shared memory

* The models are placed in the shared PSRAM reagion and must be allocated through the dedicated functions

* .

* renaming

* fix cast warning

* add flag to switch STBI PSRAM usage

* improve PSRAM shared handling

* reserve shared PSRAM as early as possible

* init logging eralier so we can use it in PSRAM shared alloc

* move Wifi_LWIP, BSS_SEG and MQTT Outbox into PSRAM to ffree internal memory

* Check if model fits into reserved shared memory

* Update code/components/jomjol_tfliteclass/CTfLiteClass.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_flowcontroll/ClassFlowControll.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_image_proc/CImageBasis.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* .

* .

* .

* .

* Korrektur Merge Conflict in main.cpp

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>
Co-authored-by: jomjol <30766535+jomjol@users.noreply.github.com>

* fix PSRAM init return value check

* Extend InfluxDBv1 with individual topic names (#2319)

* Implement individual influx topic

* Update interface_influxdb.cpp

* Update interface_influxdb.cpp

* Update FieldName

* analogROI: Activate save button after ROI creation (#2326)

* Migration of PlatformIO 5.2.0 to 6.1.0 (resp. ESP IDF from 4.4.2 to 5.0.1) (#2305)

* Migration to PlatformIO 6.1.0

* Disable RMTMEM usage as it is no longer allowed -> Smart LEDs not functional!

* moved miniz into subfolder of jomjol_fileserver_ota, else it does not build anymore.

* cleanup

* fix leading NaN (#2310)

* Migration to PlatformIO 6.1.0

* Disable RMTMEM usage as it is no longer allowed -> Smart LEDs not functional!

* moved miniz into subfolder of jomjol_fileserver_ota, else it does not build anymore.

* cleanup

* Task watchdog has new config name

* Fix return value check. It must be something else than ESP_FAIL, but it does not need to be ESP_OK!

* add missing strucures to work around new RMTMEM restriction (untested)

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Keep MainFlowTask alive to handle reboot (#2325)

* Shared PSRAM memory (#2285)

* enable PSRAM logging

* add extra functions for psram shared memroy handling

* CImageBasis objects still should used dynamic memory (eg. rawImage), haw ever tmpImage must be placed inside the shared memory

* Place all STBI allocs inside the shared memory

* The models are placed in the shared PSRAM reagion and must be allocated through the dedicated functions

* .

* renaming

* fix cast warning

* add flag to switch STBI PSRAM usage

* improve PSRAM shared handling

* reserve shared PSRAM as early as possible

* init logging eralier so we can use it in PSRAM shared alloc

* move Wifi_LWIP, BSS_SEG and MQTT Outbox into PSRAM to ffree internal memory

* Check if model fits into reserved shared memory

* Update code/components/jomjol_tfliteclass/CTfLiteClass.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_flowcontroll/ClassFlowControll.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_image_proc/CImageBasis.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* .

* .

* .

* .

* Korrektur Merge Conflict in main.cpp

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>
Co-authored-by: jomjol <30766535+jomjol@users.noreply.github.com>

* fix PSRAM init return value check

* Extend incl. indiv. Measurement

* Implement UX

* Update ClassFlowInfluxDBv2.cpp

* Implement individual influx topic

* Update interface_influxdb.cpp

* Update interface_influxdb.cpp

* Update FieldName

* Extend incl. indiv. Measurement

* Implement UX

* Update ClassFlowInfluxDBv2.cpp

* Update main.cpp

---------

Co-authored-by: Slider0007 <115730895+Slider0007@users.noreply.github.com>
Co-authored-by: CaCO3 <caco3@ruinelli.ch>
Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Update Changelog.md (#2344)

* Update Changelog.md

* Update Changelog.md

* merge conflicts

* merge conflicts

* update changelog

* Update Changelog.md

* Fix alignment mark PSRAM issue (#2357)

* Add lock for shared PSRAM memory, use it for the relevant round steps and the Alignment Mark Task

* only allow taking a new image for the Alignment Mark while round got completed

* show success/denial of Alignment Mark Update Request

* .

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Update Changelog.md (#2360)

* Update platformio.ini (#2368)

* Allow the Alignment Mark step while status is "Initializing" or "Initialization (delayed)" or while in setup mode (#2373)

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Improve logging if Autostart is not enabled. Renamed/splitted functions (#2376)

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Cleanup web UI (#2378)

* fix wrong index on backup log

* remove no longer used files/functions

* improve logging on Alignment Mark Update

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Update Changelog.md

* fix broken sysinfo (#2381)

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Update Changelog.md

* Update Changelog.md

---------

Co-authored-by: Frank Haverland <fspapaping@googlemail.com>
Co-authored-by: CaCO3 <caco@ruinelli.ch>
Co-authored-by: jomjol <30766535+jomjol@users.noreply.github.com>
Co-authored-by: Slider0007 <jobbelle@gmx.net>
Co-authored-by: Slider0007 <115730895+Slider0007@users.noreply.github.com>
Co-authored-by: Antonin Delpeuch <antonin@delpeuch.eu>
2023-05-01 23:39:12 +02:00
CaCO3
17994494c9 Merge branch 'master' into rolling 2023-05-01 23:38:47 +02:00
CaCO3
c581d64a26 Update Changelog.md 2023-05-01 23:37:58 +02:00
CaCO3
70c2b88f8a Update Changelog.md 2023-05-01 23:37:36 +02:00
CaCO3
13d01a6c96 fix broken sysinfo (#2381)
Co-authored-by: CaCO3 <caco@ruinelli.ch>
2023-05-01 23:34:55 +02:00
CaCO3
331e3533cc v15.2.2 (#2379)
* Testcase for #2145 and debug-log (#2151)

* new models ana-cont-11.0.5, ana-class100-1.5.7, dig-class100-1.6.0

* Testcase for #2145
Added debug log, if allowNegativeRates is handeled

* Fix timezone config parser (#2169)

* make sure to parse the whole config line

* fix crash on empty timezone parameter

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Enhance ROI pages (#2161)

* Check if the ROIs are equidistant. Only if not, untick the checkbox

* renaming

* Check if the ROIs have same y, dy and dx. If so, tick the sync checkbox

* only allow editing space when box is checked

* fix sync check

* show inner frame on all ROIs

* cleanup

* Check if the ROIs have same dy and dx. If so, tick the sync checkbox

* checkbox position

* renaming

* renaming

* show inner frame and cross hairs on all ROIs

* update ROIs on ticking checkboxes

* show timezone hint

* fix deleting last ROI

* cleanup

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* restart timeout on progress, catch error (#2170)

* restart timeout on progress, catch error

* .

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* BugFix #2167

* Release 15.1 preparations (#2171)

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update changelog

* Fix links to PR

* Formating

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

---------

Co-authored-by: Slider0007 <jobbelle@gmx.net>
Co-authored-by: Slider0007 <115730895+Slider0007@users.noreply.github.com>

* fix typo

* Replace relative documentation links with absolute ones pointing to the external documentation (#2180)

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Sort model files in configuration combobox (#2189)

* new models ana-cont-11.0.5, ana-class100-1.5.7, dig-class100-1.6.0

* Testcase for #2145
Added debug log, if allowNegativeRates is handeled

* Sort model files in combobox

* reboot task - increase stack size (#2201)

Avoid stack overflow

* Update interface_influxdb.cpp

* Update Changelog.md

* Show PSRAM usage (#2206)

* centralize PSRAM usage (application code only)

* update logging

* update logging

* fix use after free

* initialize buffer

* free rgb_image before ussing it for new allocation

* use wrapper function

* switch log level to debug

* .

* undo adding free() calls

* .

* add names to all CImage instances

* .

* .

* .

* revert changes of stbi_image_free() with free_psram_heap() on the places where is is not in PSRAM

* .

* typos

* typo

* Added MQTT Outbox explanation/warning

* added CONFIG_SPIRAM_USE_MEMMAP explanation

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Disable custom MQTT Outbox. This also moves the MQTT Publishing memory usage back to the internal RAM!

* log MQTT connection refused reasons (#2216)

* Revert PSRAM usage as it lead to memory fragmentation.
See https://github.com/jomjol/AI-on-the-edge-device/issues/2200 for details

* fix missing value data

* Revert PSRAM usage as it lead to memory fragmentation. (#2224)

See https://github.com/jomjol/AI-on-the-edge-device/issues/2200 for details

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Fix missing value data in graph (#2230)

* fix missing value data

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Update Changelog.md (#2231)

* Update interface_influxdb.cpp (#2233)

* update copyright year

* Cleanup

* Set prevalue using MQTT + set prevalue to RAW value (REST+MQTT) (#2252)

* Use double instead of float

* Error handling + set to RAW if newvalue < 0

* REST SetPrevalue: Set to RAW if newvalue < 0

* set prevalue with MQTT

* removed the stb_image files and re-add them as a submodule. (#2223)

- stb_image.h: Version update 2.25 -> 2.28
- stb_resize.h: Version update 0.96 -> 0.97
- stb_write.h: Version update 1.14 -> 1.16

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Remove obsolete ClassFlowWriteList (#2264)

* Renaming & cleanup of some modules / functions in source code (#2265)

* Rename module tag name

* Rename server_tflite.cpp -> MainFlowControl.cpp

* Remove redundandant MQTTMainTopic function

* Update

* Remove obsolete GetMQTTMainTopic

* Fix last element missing in digit model drop down (#2282)

* Debug influxdb (#2283)

* Fix time offset issues in InfluxDB component. (#2278)

Closes #2273
Closes #2150

* Update interface_influxdb.cpp

* Update interface_influxdb.cpp

* Improve Logging

* Implement TimeSync at beginning

* Update time_sntp.cpp

* Update time_sntp.cpp

* Set Time After WLAN Init

---------

Co-authored-by: Antonin Delpeuch <antonin@delpeuch.eu>

* Implement a camera livestream handler (#2286)

* fix leading NaN (#2310)

* analogROI: Activate save button after ROI creation (#2326)

* Migration of PlatformIO 5.2.0 to 6.1.0 (resp. ESP IDF from 4.4.2 to 5.0.1) (#2305)

* Migration to PlatformIO 6.1.0

* Disable RMTMEM usage as it is no longer allowed -> Smart LEDs not functional!

* moved miniz into subfolder of jomjol_fileserver_ota, else it does not build anymore.

* cleanup

* fix leading NaN (#2310)

* Migration to PlatformIO 6.1.0

* Disable RMTMEM usage as it is no longer allowed -> Smart LEDs not functional!

* moved miniz into subfolder of jomjol_fileserver_ota, else it does not build anymore.

* cleanup

* Task watchdog has new config name

* Fix return value check. It must be something else than ESP_FAIL, but it does not need to be ESP_OK!

* add missing strucures to work around new RMTMEM restriction (untested)

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Keep MainFlowTask alive to handle reboot (#2325)

* Shared PSRAM memory (#2285)

* enable PSRAM logging

* add extra functions for psram shared memroy handling

* CImageBasis objects still should used dynamic memory (eg. rawImage), haw ever tmpImage must be placed inside the shared memory

* Place all STBI allocs inside the shared memory

* The models are placed in the shared PSRAM reagion and must be allocated through the dedicated functions

* .

* renaming

* fix cast warning

* add flag to switch STBI PSRAM usage

* improve PSRAM shared handling

* reserve shared PSRAM as early as possible

* init logging eralier so we can use it in PSRAM shared alloc

* move Wifi_LWIP, BSS_SEG and MQTT Outbox into PSRAM to ffree internal memory

* Check if model fits into reserved shared memory

* Update code/components/jomjol_tfliteclass/CTfLiteClass.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_flowcontroll/ClassFlowControll.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_image_proc/CImageBasis.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* .

* .

* .

* .

* Korrektur Merge Conflict in main.cpp

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>
Co-authored-by: jomjol <30766535+jomjol@users.noreply.github.com>

* fix PSRAM init return value check

* Extend InfluxDBv1 with individual topic names (#2319)

* Implement individual influx topic

* Update interface_influxdb.cpp

* Update interface_influxdb.cpp

* Update FieldName

* analogROI: Activate save button after ROI creation (#2326)

* Migration of PlatformIO 5.2.0 to 6.1.0 (resp. ESP IDF from 4.4.2 to 5.0.1) (#2305)

* Migration to PlatformIO 6.1.0

* Disable RMTMEM usage as it is no longer allowed -> Smart LEDs not functional!

* moved miniz into subfolder of jomjol_fileserver_ota, else it does not build anymore.

* cleanup

* fix leading NaN (#2310)

* Migration to PlatformIO 6.1.0

* Disable RMTMEM usage as it is no longer allowed -> Smart LEDs not functional!

* moved miniz into subfolder of jomjol_fileserver_ota, else it does not build anymore.

* cleanup

* Task watchdog has new config name

* Fix return value check. It must be something else than ESP_FAIL, but it does not need to be ESP_OK!

* add missing strucures to work around new RMTMEM restriction (untested)

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Keep MainFlowTask alive to handle reboot (#2325)

* Shared PSRAM memory (#2285)

* enable PSRAM logging

* add extra functions for psram shared memroy handling

* CImageBasis objects still should used dynamic memory (eg. rawImage), haw ever tmpImage must be placed inside the shared memory

* Place all STBI allocs inside the shared memory

* The models are placed in the shared PSRAM reagion and must be allocated through the dedicated functions

* .

* renaming

* fix cast warning

* add flag to switch STBI PSRAM usage

* improve PSRAM shared handling

* reserve shared PSRAM as early as possible

* init logging eralier so we can use it in PSRAM shared alloc

* move Wifi_LWIP, BSS_SEG and MQTT Outbox into PSRAM to ffree internal memory

* Check if model fits into reserved shared memory

* Update code/components/jomjol_tfliteclass/CTfLiteClass.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_flowcontroll/ClassFlowControll.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_image_proc/CImageBasis.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* .

* .

* .

* .

* Korrektur Merge Conflict in main.cpp

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>
Co-authored-by: jomjol <30766535+jomjol@users.noreply.github.com>

* fix PSRAM init return value check

* Extend incl. indiv. Measurement

* Implement UX

* Update ClassFlowInfluxDBv2.cpp

* Implement individual influx topic

* Update interface_influxdb.cpp

* Update interface_influxdb.cpp

* Update FieldName

* Extend incl. indiv. Measurement

* Implement UX

* Update ClassFlowInfluxDBv2.cpp

* Update main.cpp

---------

Co-authored-by: Slider0007 <115730895+Slider0007@users.noreply.github.com>
Co-authored-by: CaCO3 <caco3@ruinelli.ch>
Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Update Changelog.md (#2344)

* Update Changelog.md

* Update Changelog.md

* merge conflicts

* merge conflicts

* update changelog

* Update Changelog.md

* Fix alignment mark PSRAM issue (#2357)

* Add lock for shared PSRAM memory, use it for the relevant round steps and the Alignment Mark Task

* only allow taking a new image for the Alignment Mark while round got completed

* show success/denial of Alignment Mark Update Request

* .

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Update Changelog.md (#2360)

* Update platformio.ini (#2368)

* Allow the Alignment Mark step while status is "Initializing" or "Initialization (delayed)" or while in setup mode (#2373)

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Improve logging if Autostart is not enabled. Renamed/splitted functions (#2376)

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Cleanup web UI (#2378)

* fix wrong index on backup log

* remove no longer used files/functions

* improve logging on Alignment Mark Update

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Update Changelog.md

---------

Co-authored-by: Frank Haverland <fspapaping@googlemail.com>
Co-authored-by: CaCO3 <caco@ruinelli.ch>
Co-authored-by: jomjol <30766535+jomjol@users.noreply.github.com>
Co-authored-by: Slider0007 <jobbelle@gmx.net>
Co-authored-by: Slider0007 <115730895+Slider0007@users.noreply.github.com>
Co-authored-by: Antonin Delpeuch <antonin@delpeuch.eu>
2023-05-01 22:54:10 +02:00
CaCO3
5a00bdd7f6 Update Changelog.md 2023-05-01 22:53:49 +02:00
CaCO3
db7ffb30c4 Merge branch 'master' into rolling 2023-05-01 22:48:39 +02:00
CaCO3
9a07f271ff Cleanup web UI (#2378)
* fix wrong index on backup log

* remove no longer used files/functions

* improve logging on Alignment Mark Update

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>
2023-05-01 22:38:30 +02:00
CaCO3
6a45ab7693 Improve logging if Autostart is not enabled. Renamed/splitted functions (#2376)
Co-authored-by: CaCO3 <caco@ruinelli.ch>
2023-05-01 22:16:48 +02:00
CaCO3
9fc876853b Allow the Alignment Mark step while status is "Initializing" or "Initialization (delayed)" or while in setup mode (#2373)
Co-authored-by: CaCO3 <caco@ruinelli.ch>
2023-05-01 21:28:23 +02:00
Slider0007
c30881f73c Hide "manual flow start" 2023-05-01 20:00:41 +02:00
Slider0007
e75e720869 Update 2023-05-01 19:23:01 +02:00
CaCO3
43aae5a3cd Update platformio.ini (#2368) 2023-05-01 16:19:38 +02:00
Slider0007
54cd7e511a Reference image: remove updatepage 2023-05-01 14:45:47 +02:00
Slider0007
c5a82e839f Update 2023-05-01 14:44:56 +02:00
Slider0007
9f97a2b223 Try to clear cache after intial setup 2023-05-01 14:23:14 +02:00
Slider0007
8d06de5792 Process related file update: no folder content redirect 2023-05-01 14:22:15 +02:00
Slider0007
1326585a33 Initial rotate default to 0.0 2023-05-01 14:20:05 +02:00
Slider0007
d7a507ca05 Update WebUI 2023-05-01 14:19:31 +02:00
CaCO3
b24b7d5ce2 v15.2.1 (#2361)
* Testcase for #2145 and debug-log (#2151)

* new models ana-cont-11.0.5, ana-class100-1.5.7, dig-class100-1.6.0

* Testcase for #2145
Added debug log, if allowNegativeRates is handeled

* Fix timezone config parser (#2169)

* make sure to parse the whole config line

* fix crash on empty timezone parameter

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Enhance ROI pages (#2161)

* Check if the ROIs are equidistant. Only if not, untick the checkbox

* renaming

* Check if the ROIs have same y, dy and dx. If so, tick the sync checkbox

* only allow editing space when box is checked

* fix sync check

* show inner frame on all ROIs

* cleanup

* Check if the ROIs have same dy and dx. If so, tick the sync checkbox

* checkbox position

* renaming

* renaming

* show inner frame and cross hairs on all ROIs

* update ROIs on ticking checkboxes

* show timezone hint

* fix deleting last ROI

* cleanup

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* restart timeout on progress, catch error (#2170)

* restart timeout on progress, catch error

* .

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* BugFix #2167

* Release 15.1 preparations (#2171)

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update changelog

* Fix links to PR

* Formating

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

---------

Co-authored-by: Slider0007 <jobbelle@gmx.net>
Co-authored-by: Slider0007 <115730895+Slider0007@users.noreply.github.com>

* fix typo

* Replace relative documentation links with absolute ones pointing to the external documentation (#2180)

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Sort model files in configuration combobox (#2189)

* new models ana-cont-11.0.5, ana-class100-1.5.7, dig-class100-1.6.0

* Testcase for #2145
Added debug log, if allowNegativeRates is handeled

* Sort model files in combobox

* reboot task - increase stack size (#2201)

Avoid stack overflow

* Update interface_influxdb.cpp

* Update Changelog.md

* Show PSRAM usage (#2206)

* centralize PSRAM usage (application code only)

* update logging

* update logging

* fix use after free

* initialize buffer

* free rgb_image before ussing it for new allocation

* use wrapper function

* switch log level to debug

* .

* undo adding free() calls

* .

* add names to all CImage instances

* .

* .

* .

* revert changes of stbi_image_free() with free_psram_heap() on the places where is is not in PSRAM

* .

* typos

* typo

* Added MQTT Outbox explanation/warning

* added CONFIG_SPIRAM_USE_MEMMAP explanation

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Disable custom MQTT Outbox. This also moves the MQTT Publishing memory usage back to the internal RAM!

* log MQTT connection refused reasons (#2216)

* Revert PSRAM usage as it lead to memory fragmentation.
See https://github.com/jomjol/AI-on-the-edge-device/issues/2200 for details

* fix missing value data

* Revert PSRAM usage as it lead to memory fragmentation. (#2224)

See https://github.com/jomjol/AI-on-the-edge-device/issues/2200 for details

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Fix missing value data in graph (#2230)

* fix missing value data

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Update Changelog.md (#2231)

* Update interface_influxdb.cpp (#2233)

* update copyright year

* Cleanup

* Set prevalue using MQTT + set prevalue to RAW value (REST+MQTT) (#2252)

* Use double instead of float

* Error handling + set to RAW if newvalue < 0

* REST SetPrevalue: Set to RAW if newvalue < 0

* set prevalue with MQTT

* removed the stb_image files and re-add them as a submodule. (#2223)

- stb_image.h: Version update 2.25 -> 2.28
- stb_resize.h: Version update 0.96 -> 0.97
- stb_write.h: Version update 1.14 -> 1.16

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Remove obsolete ClassFlowWriteList (#2264)

* Renaming & cleanup of some modules / functions in source code (#2265)

* Rename module tag name

* Rename server_tflite.cpp -> MainFlowControl.cpp

* Remove redundandant MQTTMainTopic function

* Update

* Remove obsolete GetMQTTMainTopic

* Fix last element missing in digit model drop down (#2282)

* Debug influxdb (#2283)

* Fix time offset issues in InfluxDB component. (#2278)

Closes #2273
Closes #2150

* Update interface_influxdb.cpp

* Update interface_influxdb.cpp

* Improve Logging

* Implement TimeSync at beginning

* Update time_sntp.cpp

* Update time_sntp.cpp

* Set Time After WLAN Init

---------

Co-authored-by: Antonin Delpeuch <antonin@delpeuch.eu>

* Implement a camera livestream handler (#2286)

* fix leading NaN (#2310)

* analogROI: Activate save button after ROI creation (#2326)

* Migration of PlatformIO 5.2.0 to 6.1.0 (resp. ESP IDF from 4.4.2 to 5.0.1) (#2305)

* Migration to PlatformIO 6.1.0

* Disable RMTMEM usage as it is no longer allowed -> Smart LEDs not functional!

* moved miniz into subfolder of jomjol_fileserver_ota, else it does not build anymore.

* cleanup

* fix leading NaN (#2310)

* Migration to PlatformIO 6.1.0

* Disable RMTMEM usage as it is no longer allowed -> Smart LEDs not functional!

* moved miniz into subfolder of jomjol_fileserver_ota, else it does not build anymore.

* cleanup

* Task watchdog has new config name

* Fix return value check. It must be something else than ESP_FAIL, but it does not need to be ESP_OK!

* add missing strucures to work around new RMTMEM restriction (untested)

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Keep MainFlowTask alive to handle reboot (#2325)

* Shared PSRAM memory (#2285)

* enable PSRAM logging

* add extra functions for psram shared memroy handling

* CImageBasis objects still should used dynamic memory (eg. rawImage), haw ever tmpImage must be placed inside the shared memory

* Place all STBI allocs inside the shared memory

* The models are placed in the shared PSRAM reagion and must be allocated through the dedicated functions

* .

* renaming

* fix cast warning

* add flag to switch STBI PSRAM usage

* improve PSRAM shared handling

* reserve shared PSRAM as early as possible

* init logging eralier so we can use it in PSRAM shared alloc

* move Wifi_LWIP, BSS_SEG and MQTT Outbox into PSRAM to ffree internal memory

* Check if model fits into reserved shared memory

* Update code/components/jomjol_tfliteclass/CTfLiteClass.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_flowcontroll/ClassFlowControll.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_image_proc/CImageBasis.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* .

* .

* .

* .

* Korrektur Merge Conflict in main.cpp

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>
Co-authored-by: jomjol <30766535+jomjol@users.noreply.github.com>

* fix PSRAM init return value check

* Extend InfluxDBv1 with individual topic names (#2319)

* Implement individual influx topic

* Update interface_influxdb.cpp

* Update interface_influxdb.cpp

* Update FieldName

* analogROI: Activate save button after ROI creation (#2326)

* Migration of PlatformIO 5.2.0 to 6.1.0 (resp. ESP IDF from 4.4.2 to 5.0.1) (#2305)

* Migration to PlatformIO 6.1.0

* Disable RMTMEM usage as it is no longer allowed -> Smart LEDs not functional!

* moved miniz into subfolder of jomjol_fileserver_ota, else it does not build anymore.

* cleanup

* fix leading NaN (#2310)

* Migration to PlatformIO 6.1.0

* Disable RMTMEM usage as it is no longer allowed -> Smart LEDs not functional!

* moved miniz into subfolder of jomjol_fileserver_ota, else it does not build anymore.

* cleanup

* Task watchdog has new config name

* Fix return value check. It must be something else than ESP_FAIL, but it does not need to be ESP_OK!

* add missing strucures to work around new RMTMEM restriction (untested)

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Keep MainFlowTask alive to handle reboot (#2325)

* Shared PSRAM memory (#2285)

* enable PSRAM logging

* add extra functions for psram shared memroy handling

* CImageBasis objects still should used dynamic memory (eg. rawImage), haw ever tmpImage must be placed inside the shared memory

* Place all STBI allocs inside the shared memory

* The models are placed in the shared PSRAM reagion and must be allocated through the dedicated functions

* .

* renaming

* fix cast warning

* add flag to switch STBI PSRAM usage

* improve PSRAM shared handling

* reserve shared PSRAM as early as possible

* init logging eralier so we can use it in PSRAM shared alloc

* move Wifi_LWIP, BSS_SEG and MQTT Outbox into PSRAM to ffree internal memory

* Check if model fits into reserved shared memory

* Update code/components/jomjol_tfliteclass/CTfLiteClass.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_flowcontroll/ClassFlowControll.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_image_proc/CImageBasis.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* .

* .

* .

* .

* Korrektur Merge Conflict in main.cpp

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>
Co-authored-by: jomjol <30766535+jomjol@users.noreply.github.com>

* fix PSRAM init return value check

* Extend incl. indiv. Measurement

* Implement UX

* Update ClassFlowInfluxDBv2.cpp

* Implement individual influx topic

* Update interface_influxdb.cpp

* Update interface_influxdb.cpp

* Update FieldName

* Extend incl. indiv. Measurement

* Implement UX

* Update ClassFlowInfluxDBv2.cpp

* Update main.cpp

---------

Co-authored-by: Slider0007 <115730895+Slider0007@users.noreply.github.com>
Co-authored-by: CaCO3 <caco3@ruinelli.ch>
Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Update Changelog.md (#2344)

* Update Changelog.md

* Update Changelog.md

* merge conflicts

* merge conflicts

* update changelog

* Update Changelog.md

* Fix alignment mark PSRAM issue (#2357)

* Add lock for shared PSRAM memory, use it for the relevant round steps and the Alignment Mark Task

* only allow taking a new image for the Alignment Mark while round got completed

* show success/denial of Alignment Mark Update Request

* .

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Update Changelog.md (#2360)

---------

Co-authored-by: Frank Haverland <fspapaping@googlemail.com>
Co-authored-by: CaCO3 <caco@ruinelli.ch>
Co-authored-by: jomjol <30766535+jomjol@users.noreply.github.com>
Co-authored-by: Slider0007 <jobbelle@gmx.net>
Co-authored-by: Slider0007 <115730895+Slider0007@users.noreply.github.com>
Co-authored-by: Antonin Delpeuch <antonin@delpeuch.eu>
2023-04-27 22:41:08 +02:00
CaCO3
fc719da0ae Update Changelog.md (#2360) 2023-04-27 22:34:04 +02:00
CaCO3
9b1a83c8b4 Fix alignment mark PSRAM issue (#2357)
* Add lock for shared PSRAM memory, use it for the relevant round steps and the Alignment Mark Task

* only allow taking a new image for the Alignment Mark while round got completed

* show success/denial of Alignment Mark Update Request

* .

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>
2023-04-27 22:30:12 +02:00
CaCO3
6defcf8d4c Update Changelog.md 2023-04-23 17:27:06 +02:00
CaCO3
c2a55e7c86 v15.2.0 (#2345)
* Testcase for #2145 and debug-log (#2151)

* new models ana-cont-11.0.5, ana-class100-1.5.7, dig-class100-1.6.0

* Testcase for #2145
Added debug log, if allowNegativeRates is handeled

* Fix timezone config parser (#2169)

* make sure to parse the whole config line

* fix crash on empty timezone parameter

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Enhance ROI pages (#2161)

* Check if the ROIs are equidistant. Only if not, untick the checkbox

* renaming

* Check if the ROIs have same y, dy and dx. If so, tick the sync checkbox

* only allow editing space when box is checked

* fix sync check

* show inner frame on all ROIs

* cleanup

* Check if the ROIs have same dy and dx. If so, tick the sync checkbox

* checkbox position

* renaming

* renaming

* show inner frame and cross hairs on all ROIs

* update ROIs on ticking checkboxes

* show timezone hint

* fix deleting last ROI

* cleanup

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* restart timeout on progress, catch error (#2170)

* restart timeout on progress, catch error

* .

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* BugFix #2167

* Release 15.1 preparations (#2171)

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update changelog

* Fix links to PR

* Formating

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

---------

Co-authored-by: Slider0007 <jobbelle@gmx.net>
Co-authored-by: Slider0007 <115730895+Slider0007@users.noreply.github.com>

* fix typo

* Replace relative documentation links with absolute ones pointing to the external documentation (#2180)

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Sort model files in configuration combobox (#2189)

* new models ana-cont-11.0.5, ana-class100-1.5.7, dig-class100-1.6.0

* Testcase for #2145
Added debug log, if allowNegativeRates is handeled

* Sort model files in combobox

* reboot task - increase stack size (#2201)

Avoid stack overflow

* Update interface_influxdb.cpp

* Update Changelog.md

* Show PSRAM usage (#2206)

* centralize PSRAM usage (application code only)

* update logging

* update logging

* fix use after free

* initialize buffer

* free rgb_image before ussing it for new allocation

* use wrapper function

* switch log level to debug

* .

* undo adding free() calls

* .

* add names to all CImage instances

* .

* .

* .

* revert changes of stbi_image_free() with free_psram_heap() on the places where is is not in PSRAM

* .

* typos

* typo

* Added MQTT Outbox explanation/warning

* added CONFIG_SPIRAM_USE_MEMMAP explanation

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Disable custom MQTT Outbox. This also moves the MQTT Publishing memory usage back to the internal RAM!

* log MQTT connection refused reasons (#2216)

* Revert PSRAM usage as it lead to memory fragmentation.
See https://github.com/jomjol/AI-on-the-edge-device/issues/2200 for details

* fix missing value data

* Revert PSRAM usage as it lead to memory fragmentation. (#2224)

See https://github.com/jomjol/AI-on-the-edge-device/issues/2200 for details

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Fix missing value data in graph (#2230)

* fix missing value data

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Update Changelog.md (#2231)

* Update interface_influxdb.cpp (#2233)

* update copyright year

* Cleanup

* Set prevalue using MQTT + set prevalue to RAW value (REST+MQTT) (#2252)

* Use double instead of float

* Error handling + set to RAW if newvalue < 0

* REST SetPrevalue: Set to RAW if newvalue < 0

* set prevalue with MQTT

* removed the stb_image files and re-add them as a submodule. (#2223)

- stb_image.h: Version update 2.25 -> 2.28
- stb_resize.h: Version update 0.96 -> 0.97
- stb_write.h: Version update 1.14 -> 1.16

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Remove obsolete ClassFlowWriteList (#2264)

* Renaming & cleanup of some modules / functions in source code (#2265)

* Rename module tag name

* Rename server_tflite.cpp -> MainFlowControl.cpp

* Remove redundandant MQTTMainTopic function

* Update

* Remove obsolete GetMQTTMainTopic

* Fix last element missing in digit model drop down (#2282)

* Debug influxdb (#2283)

* Fix time offset issues in InfluxDB component. (#2278)

Closes #2273
Closes #2150

* Update interface_influxdb.cpp

* Update interface_influxdb.cpp

* Improve Logging

* Implement TimeSync at beginning

* Update time_sntp.cpp

* Update time_sntp.cpp

* Set Time After WLAN Init

---------

Co-authored-by: Antonin Delpeuch <antonin@delpeuch.eu>

* Implement a camera livestream handler (#2286)

* fix leading NaN (#2310)

* analogROI: Activate save button after ROI creation (#2326)

* Migration of PlatformIO 5.2.0 to 6.1.0 (resp. ESP IDF from 4.4.2 to 5.0.1) (#2305)

* Migration to PlatformIO 6.1.0

* Disable RMTMEM usage as it is no longer allowed -> Smart LEDs not functional!

* moved miniz into subfolder of jomjol_fileserver_ota, else it does not build anymore.

* cleanup

* fix leading NaN (#2310)

* Migration to PlatformIO 6.1.0

* Disable RMTMEM usage as it is no longer allowed -> Smart LEDs not functional!

* moved miniz into subfolder of jomjol_fileserver_ota, else it does not build anymore.

* cleanup

* Task watchdog has new config name

* Fix return value check. It must be something else than ESP_FAIL, but it does not need to be ESP_OK!

* add missing strucures to work around new RMTMEM restriction (untested)

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Keep MainFlowTask alive to handle reboot (#2325)

* Shared PSRAM memory (#2285)

* enable PSRAM logging

* add extra functions for psram shared memroy handling

* CImageBasis objects still should used dynamic memory (eg. rawImage), haw ever tmpImage must be placed inside the shared memory

* Place all STBI allocs inside the shared memory

* The models are placed in the shared PSRAM reagion and must be allocated through the dedicated functions

* .

* renaming

* fix cast warning

* add flag to switch STBI PSRAM usage

* improve PSRAM shared handling

* reserve shared PSRAM as early as possible

* init logging eralier so we can use it in PSRAM shared alloc

* move Wifi_LWIP, BSS_SEG and MQTT Outbox into PSRAM to ffree internal memory

* Check if model fits into reserved shared memory

* Update code/components/jomjol_tfliteclass/CTfLiteClass.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_flowcontroll/ClassFlowControll.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_image_proc/CImageBasis.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* .

* .

* .

* .

* Korrektur Merge Conflict in main.cpp

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>
Co-authored-by: jomjol <30766535+jomjol@users.noreply.github.com>

* fix PSRAM init return value check

* Extend InfluxDBv1 with individual topic names (#2319)

* Implement individual influx topic

* Update interface_influxdb.cpp

* Update interface_influxdb.cpp

* Update FieldName

* analogROI: Activate save button after ROI creation (#2326)

* Migration of PlatformIO 5.2.0 to 6.1.0 (resp. ESP IDF from 4.4.2 to 5.0.1) (#2305)

* Migration to PlatformIO 6.1.0

* Disable RMTMEM usage as it is no longer allowed -> Smart LEDs not functional!

* moved miniz into subfolder of jomjol_fileserver_ota, else it does not build anymore.

* cleanup

* fix leading NaN (#2310)

* Migration to PlatformIO 6.1.0

* Disable RMTMEM usage as it is no longer allowed -> Smart LEDs not functional!

* moved miniz into subfolder of jomjol_fileserver_ota, else it does not build anymore.

* cleanup

* Task watchdog has new config name

* Fix return value check. It must be something else than ESP_FAIL, but it does not need to be ESP_OK!

* add missing strucures to work around new RMTMEM restriction (untested)

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Keep MainFlowTask alive to handle reboot (#2325)

* Shared PSRAM memory (#2285)

* enable PSRAM logging

* add extra functions for psram shared memroy handling

* CImageBasis objects still should used dynamic memory (eg. rawImage), haw ever tmpImage must be placed inside the shared memory

* Place all STBI allocs inside the shared memory

* The models are placed in the shared PSRAM reagion and must be allocated through the dedicated functions

* .

* renaming

* fix cast warning

* add flag to switch STBI PSRAM usage

* improve PSRAM shared handling

* reserve shared PSRAM as early as possible

* init logging eralier so we can use it in PSRAM shared alloc

* move Wifi_LWIP, BSS_SEG and MQTT Outbox into PSRAM to ffree internal memory

* Check if model fits into reserved shared memory

* Update code/components/jomjol_tfliteclass/CTfLiteClass.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_flowcontroll/ClassFlowControll.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_image_proc/CImageBasis.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* .

* .

* .

* .

* Korrektur Merge Conflict in main.cpp

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>
Co-authored-by: jomjol <30766535+jomjol@users.noreply.github.com>

* fix PSRAM init return value check

* Extend incl. indiv. Measurement

* Implement UX

* Update ClassFlowInfluxDBv2.cpp

* Implement individual influx topic

* Update interface_influxdb.cpp

* Update interface_influxdb.cpp

* Update FieldName

* Extend incl. indiv. Measurement

* Implement UX

* Update ClassFlowInfluxDBv2.cpp

* Update main.cpp

---------

Co-authored-by: Slider0007 <115730895+Slider0007@users.noreply.github.com>
Co-authored-by: CaCO3 <caco3@ruinelli.ch>
Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Update Changelog.md (#2344)

* Update Changelog.md

* Update Changelog.md

* merge conflicts

* merge conflicts

* update changelog

---------

Co-authored-by: Frank Haverland <fspapaping@googlemail.com>
Co-authored-by: CaCO3 <caco@ruinelli.ch>
Co-authored-by: jomjol <30766535+jomjol@users.noreply.github.com>
Co-authored-by: Slider0007 <jobbelle@gmx.net>
Co-authored-by: Slider0007 <115730895+Slider0007@users.noreply.github.com>
Co-authored-by: Antonin Delpeuch <antonin@delpeuch.eu>
2023-04-23 17:13:18 +02:00
CaCO3
a636ce3679 update changelog 2023-04-23 16:58:25 +02:00
CaCO3
a20fec1094 merge conflicts 2023-04-23 16:50:04 +02:00
CaCO3
929796c87f merge conflicts 2023-04-23 16:45:20 +02:00
CaCO3
e40ceb54ce merge conflicts 2023-04-23 16:44:19 +02:00
CaCO3
eebdd7c6eb Update Changelog.md (#2344)
* Update Changelog.md

* Update Changelog.md
2023-04-23 16:37:12 +02:00
jomjol
2a7f3b33a3 Extend InfluxDBv1 with individual topic names (#2319)
* Implement individual influx topic

* Update interface_influxdb.cpp

* Update interface_influxdb.cpp

* Update FieldName

* analogROI: Activate save button after ROI creation (#2326)

* Migration of PlatformIO 5.2.0 to 6.1.0 (resp. ESP IDF from 4.4.2 to 5.0.1) (#2305)

* Migration to PlatformIO 6.1.0

* Disable RMTMEM usage as it is no longer allowed -> Smart LEDs not functional!

* moved miniz into subfolder of jomjol_fileserver_ota, else it does not build anymore.

* cleanup

* fix leading NaN (#2310)

* Migration to PlatformIO 6.1.0

* Disable RMTMEM usage as it is no longer allowed -> Smart LEDs not functional!

* moved miniz into subfolder of jomjol_fileserver_ota, else it does not build anymore.

* cleanup

* Task watchdog has new config name

* Fix return value check. It must be something else than ESP_FAIL, but it does not need to be ESP_OK!

* add missing strucures to work around new RMTMEM restriction (untested)

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Keep MainFlowTask alive to handle reboot (#2325)

* Shared PSRAM memory (#2285)

* enable PSRAM logging

* add extra functions for psram shared memroy handling

* CImageBasis objects still should used dynamic memory (eg. rawImage), haw ever tmpImage must be placed inside the shared memory

* Place all STBI allocs inside the shared memory

* The models are placed in the shared PSRAM reagion and must be allocated through the dedicated functions

* .

* renaming

* fix cast warning

* add flag to switch STBI PSRAM usage

* improve PSRAM shared handling

* reserve shared PSRAM as early as possible

* init logging eralier so we can use it in PSRAM shared alloc

* move Wifi_LWIP, BSS_SEG and MQTT Outbox into PSRAM to ffree internal memory

* Check if model fits into reserved shared memory

* Update code/components/jomjol_tfliteclass/CTfLiteClass.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_flowcontroll/ClassFlowControll.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_image_proc/CImageBasis.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* .

* .

* .

* .

* Korrektur Merge Conflict in main.cpp

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>
Co-authored-by: jomjol <30766535+jomjol@users.noreply.github.com>

* fix PSRAM init return value check

* Extend incl. indiv. Measurement

* Implement UX

* Update ClassFlowInfluxDBv2.cpp

* Implement individual influx topic

* Update interface_influxdb.cpp

* Update interface_influxdb.cpp

* Update FieldName

* Extend incl. indiv. Measurement

* Implement UX

* Update ClassFlowInfluxDBv2.cpp

* Update main.cpp

---------

Co-authored-by: Slider0007 <115730895+Slider0007@users.noreply.github.com>
Co-authored-by: CaCO3 <caco3@ruinelli.ch>
Co-authored-by: CaCO3 <caco@ruinelli.ch>
2023-04-20 22:00:13 +02:00
CaCO3
262d83ee6f fix PSRAM init return value check 2023-04-19 21:55:01 +02:00
CaCO3
de92c29245 Shared PSRAM memory (#2285)
* enable PSRAM logging

* add extra functions for psram shared memroy handling

* CImageBasis objects still should used dynamic memory (eg. rawImage), haw ever tmpImage must be placed inside the shared memory

* Place all STBI allocs inside the shared memory

* The models are placed in the shared PSRAM reagion and must be allocated through the dedicated functions

* .

* renaming

* fix cast warning

* add flag to switch STBI PSRAM usage

* improve PSRAM shared handling

* reserve shared PSRAM as early as possible

* init logging eralier so we can use it in PSRAM shared alloc

* move Wifi_LWIP, BSS_SEG and MQTT Outbox into PSRAM to ffree internal memory

* Check if model fits into reserved shared memory

* Update code/components/jomjol_tfliteclass/CTfLiteClass.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_flowcontroll/ClassFlowControll.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_image_proc/CImageBasis.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* Update code/components/jomjol_helper/psram.cpp

* .

* .

* .

* .

* Korrektur Merge Conflict in main.cpp

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>
Co-authored-by: jomjol <30766535+jomjol@users.noreply.github.com>
2023-04-19 21:17:41 +02:00
Slider0007
19158c998f Keep MainFlowTask alive to handle reboot (#2325) 2023-04-19 20:50:49 +02:00
CaCO3
17ffd28c05 Migration of PlatformIO 5.2.0 to 6.1.0 (resp. ESP IDF from 4.4.2 to 5.0.1) (#2305)
* Migration to PlatformIO 6.1.0

* Disable RMTMEM usage as it is no longer allowed -> Smart LEDs not functional!

* moved miniz into subfolder of jomjol_fileserver_ota, else it does not build anymore.

* cleanup

* fix leading NaN (#2310)

* Migration to PlatformIO 6.1.0

* Disable RMTMEM usage as it is no longer allowed -> Smart LEDs not functional!

* moved miniz into subfolder of jomjol_fileserver_ota, else it does not build anymore.

* cleanup

* Task watchdog has new config name

* Fix return value check. It must be something else than ESP_FAIL, but it does not need to be ESP_OK!

* add missing strucures to work around new RMTMEM restriction (untested)

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>
2023-04-19 20:44:30 +02:00
Slider0007
9ca02e0a7f analogROI: Activate save button after ROI creation (#2326) 2023-04-17 23:50:03 +02:00
CaCO3
7488d7bf23 fix leading NaN (#2310) 2023-04-14 12:26:25 +02:00
Slider0007
e7bfba4b01 Implement a camera livestream handler (#2286) 2023-04-04 22:06:53 +02:00
jomjol
63ac38a52d Debug influxdb (#2283)
* Fix time offset issues in InfluxDB component. (#2278)

Closes #2273
Closes #2150

* Update interface_influxdb.cpp

* Update interface_influxdb.cpp

* Improve Logging

* Implement TimeSync at beginning

* Update time_sntp.cpp

* Update time_sntp.cpp

* Set Time After WLAN Init

---------

Co-authored-by: Antonin Delpeuch <antonin@delpeuch.eu>
2023-04-02 17:39:36 +02:00
Slider0007
e2cf8337d4 Fix last element missing in digit model drop down (#2282) 2023-04-01 23:27:54 +02:00
Slider0007
e995d6c498 Renaming & cleanup of some modules / functions in source code (#2265)
* Rename module tag name

* Rename server_tflite.cpp -> MainFlowControl.cpp

* Remove redundandant MQTTMainTopic function

* Update

* Remove obsolete GetMQTTMainTopic
2023-03-30 21:56:45 +02:00
Slider0007
0e3a50d0c1 Remove obsolete ClassFlowWriteList (#2264) 2023-03-30 21:55:28 +02:00
CaCO3
df12deae00 removed the stb_image files and re-add them as a submodule. (#2223)
- stb_image.h: Version update 2.25 -> 2.28
- stb_resize.h: Version update 0.96 -> 0.97
- stb_write.h: Version update 1.14 -> 1.16

Co-authored-by: CaCO3 <caco@ruinelli.ch>
2023-03-30 21:54:44 +02:00
Slider0007
b6bfeea936 Set prevalue using MQTT + set prevalue to RAW value (REST+MQTT) (#2252)
* Use double instead of float

* Error handling + set to RAW if newvalue < 0

* REST SetPrevalue: Set to RAW if newvalue < 0

* set prevalue with MQTT
2023-03-28 20:41:25 +02:00
jomjol
f79e03faa2 Cleanup 2023-03-26 11:33:52 +02:00
CaCO3
de1dcc4d06 update copyright year 2023-03-25 21:04:30 +01:00
CaCO3
33bfef0af4 Merge branch 'rolling' of https://github.com/jomjol/AI-on-the-edge-device into rolling 2023-03-25 21:02:34 +01:00
CaCO3
727b871fc5 Update interface_influxdb.cpp (#2233) 2023-03-24 15:49:47 +01:00
CaCO3
03c84a1ff3 Release 15.1.1 (#2232)
* Testcase for #2145 and debug-log (#2151)

* new models ana-cont-11.0.5, ana-class100-1.5.7, dig-class100-1.6.0

* Testcase for #2145
Added debug log, if allowNegativeRates is handeled

* Fix timezone config parser (#2169)

* make sure to parse the whole config line

* fix crash on empty timezone parameter

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Enhance ROI pages (#2161)

* Check if the ROIs are equidistant. Only if not, untick the checkbox

* renaming

* Check if the ROIs have same y, dy and dx. If so, tick the sync checkbox

* only allow editing space when box is checked

* fix sync check

* show inner frame on all ROIs

* cleanup

* Check if the ROIs have same dy and dx. If so, tick the sync checkbox

* checkbox position

* renaming

* renaming

* show inner frame and cross hairs on all ROIs

* update ROIs on ticking checkboxes

* show timezone hint

* fix deleting last ROI

* cleanup

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* restart timeout on progress, catch error (#2170)

* restart timeout on progress, catch error

* .

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* BugFix #2167

* Release 15.1 preparations (#2171)

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update changelog

* Fix links to PR

* Formating

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

---------

Co-authored-by: Slider0007 <jobbelle@gmx.net>
Co-authored-by: Slider0007 <115730895+Slider0007@users.noreply.github.com>

* fix typo

* Replace relative documentation links with absolute ones pointing to the external documentation (#2180)

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Sort model files in configuration combobox (#2189)

* new models ana-cont-11.0.5, ana-class100-1.5.7, dig-class100-1.6.0

* Testcase for #2145
Added debug log, if allowNegativeRates is handeled

* Sort model files in combobox

* reboot task - increase stack size (#2201)

Avoid stack overflow

* Update interface_influxdb.cpp

* Update Changelog.md

* Show PSRAM usage (#2206)

* centralize PSRAM usage (application code only)

* update logging

* update logging

* fix use after free

* initialize buffer

* free rgb_image before ussing it for new allocation

* use wrapper function

* switch log level to debug

* .

* undo adding free() calls

* .

* add names to all CImage instances

* .

* .

* .

* revert changes of stbi_image_free() with free_psram_heap() on the places where is is not in PSRAM

* .

* typos

* typo

* Added MQTT Outbox explanation/warning

* added CONFIG_SPIRAM_USE_MEMMAP explanation

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Disable custom MQTT Outbox. This also moves the MQTT Publishing memory usage back to the internal RAM!

* log MQTT connection refused reasons (#2216)

* Revert PSRAM usage as it lead to memory fragmentation. (#2224)

See https://github.com/jomjol/AI-on-the-edge-device/issues/2200 for details

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Fix missing value data in graph (#2230)

* fix missing value data

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Update Changelog.md (#2231)

---------

Co-authored-by: Frank Haverland <fspapaping@googlemail.com>
Co-authored-by: CaCO3 <caco@ruinelli.ch>
Co-authored-by: jomjol <30766535+jomjol@users.noreply.github.com>
Co-authored-by: Slider0007 <jobbelle@gmx.net>
Co-authored-by: Slider0007 <115730895+Slider0007@users.noreply.github.com>
2023-03-23 21:38:43 +01:00
CaCO3
db36fe2522 Merge branch 'master' into rolling 2023-03-23 21:38:37 +01:00
CaCO3
9ffaf6e3f8 Update Changelog.md (#2231) 2023-03-23 21:37:30 +01:00
CaCO3
fa09680711 Fix missing value data in graph (#2230)
* fix missing value data

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>
2023-03-23 21:26:01 +01:00
CaCO3
e2b66aa73a Revert PSRAM usage as it lead to memory fragmentation. (#2224)
See https://github.com/jomjol/AI-on-the-edge-device/issues/2200 for details

Co-authored-by: CaCO3 <caco@ruinelli.ch>
2023-03-23 21:25:14 +01:00
CaCO3
c4b990ada0 fix missing value data 2023-03-23 21:24:15 +01:00
CaCO3
267782d083 Revert PSRAM usage as it lead to memory fragmentation.
See https://github.com/jomjol/AI-on-the-edge-device/issues/2200 for details
2023-03-22 23:27:55 +01:00
Slider0007
e4a6fd33fe log MQTT connection refused reasons (#2216) 2023-03-22 17:52:44 +01:00
CaCO3
5db20d3687 Disable custom MQTT Outbox. This also moves the MQTT Publishing memory usage back to the internal RAM! 2023-03-19 23:39:10 +01:00
CaCO3
58185a0569 Show PSRAM usage (#2206)
* centralize PSRAM usage (application code only)

* update logging

* update logging

* fix use after free

* initialize buffer

* free rgb_image before ussing it for new allocation

* use wrapper function

* switch log level to debug

* .

* undo adding free() calls

* .

* add names to all CImage instances

* .

* .

* .

* revert changes of stbi_image_free() with free_psram_heap() on the places where is is not in PSRAM

* .

* typos

* typo

* Added MQTT Outbox explanation/warning

* added CONFIG_SPIRAM_USE_MEMMAP explanation

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>
2023-03-19 23:28:06 +01:00
jomjol
b5e0d6ee66 Implement InfluxDBv1 and minor changes (#2211)
* Testcase for #2145 and debug-log (#2151)

* new models ana-cont-11.0.5, ana-class100-1.5.7, dig-class100-1.6.0

* Testcase for #2145
Added debug log, if allowNegativeRates is handeled

* Fix timezone config parser (#2169)

* make sure to parse the whole config line

* fix crash on empty timezone parameter

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Enhance ROI pages (#2161)

* Check if the ROIs are equidistant. Only if not, untick the checkbox

* renaming

* Check if the ROIs have same y, dy and dx. If so, tick the sync checkbox

* only allow editing space when box is checked

* fix sync check

* show inner frame on all ROIs

* cleanup

* Check if the ROIs have same dy and dx. If so, tick the sync checkbox

* checkbox position

* renaming

* renaming

* show inner frame and cross hairs on all ROIs

* update ROIs on ticking checkboxes

* show timezone hint

* fix deleting last ROI

* cleanup

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* restart timeout on progress, catch error (#2170)

* restart timeout on progress, catch error

* .

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* BugFix #2167

* Release 15.1 preparations (#2171)

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update changelog

* Fix links to PR

* Formating

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

---------

Co-authored-by: Slider0007 <jobbelle@gmx.net>
Co-authored-by: Slider0007 <115730895+Slider0007@users.noreply.github.com>

* fix typo

* Replace relative documentation links with absolute ones pointing to the external documentation (#2180)

Co-authored-by: CaCO3 <caco@ruinelli.ch>

* Sort model files in configuration combobox (#2189)

* new models ana-cont-11.0.5, ana-class100-1.5.7, dig-class100-1.6.0

* Testcase for #2145
Added debug log, if allowNegativeRates is handeled

* Sort model files in combobox

* reboot task - increase stack size (#2201)

Avoid stack overflow

* Update interface_influxdb.cpp

* Update Changelog.md

---------

Co-authored-by: Frank Haverland <fspapaping@googlemail.com>
Co-authored-by: CaCO3 <caco3@ruinelli.ch>
Co-authored-by: CaCO3 <caco@ruinelli.ch>
Co-authored-by: Slider0007 <jobbelle@gmx.net>
Co-authored-by: Slider0007 <115730895+Slider0007@users.noreply.github.com>
2023-03-19 18:31:01 +01:00
jomjol
d93c5daf14 Update Changelog.md 2023-03-19 18:26:41 +01:00
jomjol
6ff83445ac Merge branch 'correct-influxdbv1-bug' into rolling 2023-03-19 18:24:12 +01:00
jomjol
d944e8676b Update interface_influxdb.cpp 2023-03-19 17:54:48 +01:00
Slider0007
a8d7b29507 reboot task - increase stack size (#2201)
Avoid stack overflow
2023-03-17 07:46:40 +01:00
Frank Haverland
ab0fc72257 Sort model files in configuration combobox (#2189)
* new models ana-cont-11.0.5, ana-class100-1.5.7, dig-class100-1.6.0

* Testcase for #2145
Added debug log, if allowNegativeRates is handeled

* Sort model files in combobox
2023-03-14 22:57:00 +01:00
CaCO3
933215c116 Replace relative documentation links with absolute ones pointing to the external documentation (#2180)
Co-authored-by: CaCO3 <caco@ruinelli.ch>
2023-03-13 21:45:34 +01:00
CaCO3
e81a7eebe8 fix typo 2023-03-13 21:32:39 +01:00
CaCO3
863856ca5d Merge branch 'master' into rolling 2023-03-12 22:51:08 +01:00
CaCO3
eefc41d6ff Release 15.1 preparations (#2171)
* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update changelog

* Fix links to PR

* Formating

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

* Update Changelog.md

---------

Co-authored-by: Slider0007 <jobbelle@gmx.net>
Co-authored-by: Slider0007 <115730895+Slider0007@users.noreply.github.com>
2023-03-12 22:46:16 +01:00
jomjol
d1807a1b3d Merge branch 'rolling' of https://github.com/jomjol/AI-on-the-edge-device into rolling 2023-03-12 22:20:10 +01:00
jomjol
dfc45772b7 BugFix #2167 2023-03-12 22:19:30 +01:00
CaCO3
4dd41c486f restart timeout on progress, catch error (#2170)
* restart timeout on progress, catch error

* .

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>
2023-03-12 21:30:23 +01:00
CaCO3
ff81fcbd7f Enhance ROI pages (#2161)
* Check if the ROIs are equidistant. Only if not, untick the checkbox

* renaming

* Check if the ROIs have same y, dy and dx. If so, tick the sync checkbox

* only allow editing space when box is checked

* fix sync check

* show inner frame on all ROIs

* cleanup

* Check if the ROIs have same dy and dx. If so, tick the sync checkbox

* checkbox position

* renaming

* renaming

* show inner frame and cross hairs on all ROIs

* update ROIs on ticking checkboxes

* show timezone hint

* fix deleting last ROI

* cleanup

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>
2023-03-12 17:03:03 +01:00
CaCO3
5e5d2e2f72 Fix timezone config parser (#2169)
* make sure to parse the whole config line

* fix crash on empty timezone parameter

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>
2023-03-12 17:01:04 +01:00
Frank Haverland
512d7f95b4 Testcase for #2145 and debug-log (#2151)
* new models ana-cont-11.0.5, ana-class100-1.5.7, dig-class100-1.6.0

* Testcase for #2145
Added debug log, if allowNegativeRates is handeled
2023-03-11 11:19:29 +01:00
419 changed files with 27085 additions and 25307 deletions

View File

@@ -3,7 +3,32 @@
# Make sure to also add the response to .github/workflows/reply-bot.yml!
# Due to the way it works, you have to add each response twice, once for the issue, once for the discussions!
labels:
labels:
#######################################################################
# Bot Response: Documentation
#######################################################################
- name: bot-reply Documentation
labeled:
issue:
body: |
Please have a look on our documentation: https://jomjol.github.io/AI-on-the-edge-device-docs
discussion:
body: |
Please have a look on our documentation: https://jomjol.github.io/AI-on-the-edge-device-docs
#######################################################################
# Bot Response: ROI setup
#######################################################################
- name: bot-reply ROI Setup
labeled:
issue:
body: |
Make sure to setup your ROIs properly. Have a look on our documentation: https://jomjol.github.io/AI-on-the-edge-device-docs/ROI-Configuration/#how-to-setup-the-digit-rois-perfectly
discussion:
body: |
Make sure to setup your ROIs properly. Have a look on our documentation: https://jomjol.github.io/AI-on-the-edge-device-docs/ROI-Configuration/#how-to-setup-the-digit-rois-perfectly
#######################################################################
# Bot Response: Logfile
#######################################################################
@@ -90,9 +115,9 @@
labeled:
issue:
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/).
discussion:
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/).

View File

@@ -1,6 +1,10 @@
name: Build and Pack
on: [push, pull_request]
on:
push:
pull_request:
release:
types: [released] # Only trigger on published releases (not drafts or pre-released)
jobs:
#########################################################################################
@@ -14,8 +18,8 @@ jobs:
uses: fkirc/skip-duplicate-actions@v5
with:
concurrent_skipping: same_content_newer
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive
@@ -25,39 +29,40 @@ jobs:
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Update PIP cache on every commit
uses: actions/cache@v3.2.3
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: pip-${{ github.run_id }}
restore-keys: pip # This matches above key as it is only used as a prefix. it the restores the nearest cache, see https://github.com/restore-keys:/blob/main/tips-and-workarounds.md#update-a-cache
- name: Update PlatformIO cache on every commit
uses: actions/cache@v3.2.3
uses: actions/cache@v4
with:
path: ~/.platformio
key: platformio-${{ github.run_id }}
restore-keys: platformio # This matches above key as it is only used as a prefix. it the restores the nearest cache, see https://github.com/restore-keys:/blob/main/tips-and-workarounds.md#update-a-cache
- name: Update Build cache on every commit
uses: actions/cache@v3.2.3
uses: actions/cache@v4
with:
path: ./code/.pio/
key: build-${{ github.run_id }}
restore-keys: build # This matches above key as it is only used as a prefix. it the restores the nearest cache, see https://github.com/restore-keys:/blob/main/tips-and-workarounds.md#update-a-cache
- name: Update generated-files cache on every commit
uses: actions/cache@v3.2.3
uses: actions/cache@v4
with:
path: |
./code/.pio/build/esp32cam/firmware.bin
./code/.pio/build/esp32cam/partitions.bin
./code/.pio/build/esp32cam/bootloader.bin
./html/*
./demo/*
key: generated-files-${{ github.run_id }}
restore-keys: generated-files # This matches above key as it is only used as a prefix. it the restores the nearest cache, see https://github.com/restore-keys:/blob/main/tips-and-workarounds.md#update-a-cache
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.10'
@@ -70,7 +75,7 @@ jobs:
#run: echo "Testing... ${{ github.ref_name }}, ${{ steps.vars.outputs.sha_short }}" > ./sd-card/html/version.txt; mkdir -p ./code/.pio/build/esp32cam/; cd ./code/.pio/build/esp32cam/; echo "${{ steps.vars.outputs.sha_short }}" > firmware.bin; cp firmware.bin partitions.bin; cp firmware.bin bootloader.bin # Testing
run: cd code; platformio run --environment esp32cam
- name: Prepare Web UI (copy data from repo, generate tooltip pages and update hashes in all files)
- name: Prepare Web UI (generate tooltip pages and update hashes in all files)
run: |
rm -rf ./html
mkdir html
@@ -79,14 +84,29 @@ jobs:
python -m pip install markdown
mkdir html/param-tooltips
cd tools/parameter-tooltip-generator
bash generate-param-doc-tooltips.sh
python generate-param-doc-tooltips.py
cd ../..
cp -r ./sd-card/html/* ./html/
echo "Replacing variables..."
cd html; find . -type f -exec sed -i 's/$COMMIT_HASH/${{ steps.vars.outputs.sha_short }}/g' {} \;
rm -f ./html/edit_config_template.html # Remove the config page template, it is no longer needed
echo "Replacing variables..."
cd html
find . -type f -exec sed -i 's/$COMMIT_HASH/${{ steps.vars.outputs.sha_short }}/g' {} \;
echo "compressing all html files..."
find . -name "*.html" -type f -exec gzip {} \;
find . -name "*.css" -type f -exec gzip {} \;
find . -name "*.js" -type f -exec gzip {} \;
find . -name "*.jpg" -type f -exec gzip {} \;
find . -name "*.png" -type f -exec gzip {} \;
find . -name "*.svg" -type f -exec gzip {} \;
find . -name "*.map" -type f -exec gzip {} \;
- name: Prepare Demo mode files
run: |
rm -rf ./demo
mkdir demo
cp -r ./sd-card/demo/* ./demo/
#########################################################################################
## Pack for Update
@@ -97,30 +117,32 @@ jobs:
# - /firmware.bin
# - (optional) /html/* (inkl. subfolders)
# - (optional) /config/*.tfl
# - (optional) /demo/*
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Update generated-files cache on every commit
uses: actions/cache@v3.2.3
uses: actions/cache@v4
with:
path: |
./code/.pio/build/esp32cam/firmware.bin
./code/.pio/build/esp32cam/partitions.bin
./code/.pio/build/esp32cam/bootloader.bin
./html/*
./demo/*
key: generated-files-${{ github.run_id }}
restore-keys: generated-files # This matches above key as it is only used as a prefix. it the restores the nearest cache, see https://github.com/restore-keys:/blob/main/tips-and-workarounds.md#update-a-cache
- name: Update update cache on every commit
uses: actions/cache@v3.2.3
uses: actions/cache@v4
with:
path: update
key: update-${{ github.run_id }}
restore-keys: update # This matches above key as it is only used as a prefix. it the restores the nearest cache, see https://github.com/restore-keys:/blob/main/tips-and-workarounds.md#update-a-cache
- name: Set Variables
id: vars
run: |
@@ -135,6 +157,9 @@ jobs:
- name: Add Web UI to update
run: cp -r ./html ./update/
- name: Add Demo mode files to update
run: cp -r ./demo ./update/
- name: Add CNN to update
run: |
@@ -144,13 +169,12 @@ jobs:
cp ./sd-card/config/*.tflite ./update/config/ 2>/dev/null || true
- name: Upload update as update.zip artifact (Firmware + Web UI + CNN)
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: "AI-on-the-edge-device__update__${{ steps.vars.outputs.branch }}_(${{ steps.vars.outputs.sha_short }})"
path: ./update/*
#########################################################################################
## Pack for Remote Setup
#########################################################################################
@@ -159,26 +183,28 @@ jobs:
# remote_setup__version.zip file with following content:
# - /firmware.bin
# - /html/* (inkl. subfolders)
# - /demo/*
# - /config/*
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Update generated-files cache on every commit
uses: actions/cache@v3.2.3
uses: actions/cache@v4
with:
path: |
./code/.pio/build/esp32cam/firmware.bin
./code/.pio/build/esp32cam/partitions.bin
./code/.pio/build/esp32cam/bootloader.bin
./html/*
./demo/*
key: generated-files-${{ github.run_id }}
restore-keys: generated-files # This matches above key as it is only used as a prefix. it the restores the nearest cache, see https://github.com/restore-keys:/blob/main/tips-and-workarounds.md#update-a-cache
- name: Update remote_setup cache on every commit
uses: actions/cache@v3.2.3
uses: actions/cache@v4
with:
path: remote_setup
key: remote_setup-${{ github.run_id }}
@@ -198,6 +224,9 @@ jobs:
- name: Add Web UI to remote_setup
run: cp -r ./html ./remote_setup/
- name: Add Demo mode files to update
run: cp -r ./demo ./update/
- name: Add whole config folder to remote_setup
run: |
rm -rf ./remote_setup/config/
@@ -205,7 +234,7 @@ jobs:
cp ./sd-card/config/* ./remote_setup/config/ 2>/dev/null || true
- name: Upload remote_setup as remote_setup.zip artifact (Firmware + Web UI + Config)
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: "AI-on-the-edge-device__remote-setup__${{ steps.vars.outputs.branch }}_(${{ steps.vars.outputs.sha_short }})"
path: ./remote_setup/*
@@ -220,21 +249,22 @@ jobs:
needs: build
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Update generated-files cache on every commit
uses: actions/cache@v3.2.3
uses: actions/cache@v4
with:
path: |
./code/.pio/build/esp32cam/firmware.bin
./code/.pio/build/esp32cam/partitions.bin
./code/.pio/build/esp32cam/bootloader.bin
./html/*
./demo/*
key: generated-files-${{ github.run_id }}
restore-keys: generated-files # This matches above key as it is only used as a prefix. it the restores the nearest cache, see https://github.com/restore-keys:/blob/main/tips-and-workarounds.md#update-a-cache
- name: Update manual_setup cache on every commit
uses: actions/cache@v3.2.3
uses: actions/cache@v4
with:
path: manual_setup
key: manual_setup-${{ github.run_id }}
@@ -258,12 +288,15 @@ jobs:
cp -f "./code/.pio/build/esp32cam/bootloader.bin" "manual_setup/bootloader.bin"
cp -f "./code/.pio/build/esp32cam/partitions.bin" "manual_setup/partitions.bin"
rm -rf ./sd-card/html
rm -rf ./sd-card/demo
cp -r ./html ./sd-card/ # Overwrite the Web UI with the preprocessed files
cd sd-card; zip -r ../manual_setup/sd-card.zip *; cd ..
rm -f ./sd-card/Readme.md
cp -r ./demo ./sd-card/
cd sd-card; rm -rf html/param-tooltips; zip -r ../manual_setup/sd-card.zip *; cd ..
cd ./manual_setup
- name: Upload manual_setup.zip artifact (Firmware + Bootloader + Partitions + Web UI)
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: "AI-on-the-edge-device__manual-setup__${{ steps.vars.outputs.branch }}_(${{ steps.vars.outputs.sha_short }})"
path: ./manual_setup
@@ -272,10 +305,10 @@ jobs:
#########################################################################################
## Prepare and create release
#########################################################################################
release:
prepare-release:
runs-on: ubuntu-latest
needs: [pack-for-update, pack-for-manual_setup, pack-for-remote_setup]
if: startsWith(github.ref, 'refs/tags/')
if: github.event_name == 'release' # Only run when the trigger is a release
# Sets permissions of the GITHUB_TOKEN to allow updating the branches
permissions:
@@ -284,24 +317,24 @@ jobs:
id-token: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Update update cache on every commit
uses: actions/cache@v3.2.3
uses: actions/cache@v4
with:
path: update
key: update-${{ github.run_id }}
restore-keys: update # This matches above key as it is only used as a prefix. it the restores the nearest cache, see https://github.com/restore-keys:/blob/main/tips-and-workarounds.md#update-a-cache
- name: Update remote_setup cache on every commit
uses: actions/cache@v3.2.3
uses: actions/cache@v4
with:
path: remote_setup
key: remote_setup-${{ github.run_id }}
restore-keys: remote_setup # This matches above key as it is only used as a prefix. it the restores the nearest cache, see https://github.com/restore-keys:/blob/main/tips-and-workarounds.md#update-a-cache
- name: Update manual_setup cache on every commit
uses: actions/cache@v3.2.3
uses: actions/cache@v4
with:
path: manual_setup
key: manual_setup-${{ github.run_id }}
@@ -332,21 +365,18 @@ jobs:
# extract the version used in next step
- id: get_version
if: startsWith(github.ref, 'refs/tags/')
uses: Simply007/get-version-action@v2
uses: drewg13/get-version-action@98dda2a47a257e202c2e6c2ed2e6072ec23f448e
# # the changelog [unreleased] will now be changed to the release version
# - name: Update changelog
# uses: thomaseizinger/keep-a-changelog-new-release@v1
# if: startsWith(github.ref, 'refs/tags/')
# with:
# changelogPath: Changelog.md
# version: ${{ steps.get_version.outputs.version-without-v }}
# # the release notes will be extracted from changelog
# - name: Extract release notes
# id: extract-release-notes
# if: startsWith(github.ref, 'refs/tags/')
# uses: ffurrer2/extract-release-notes@v1
# with:
# changelog_file: Changelog.md
@@ -354,12 +384,11 @@ jobs:
# Releases should only be created on master by tagging the last commit.
# all artifacts in firmware folder pushed to the release
- name: Release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2.0.8
# Note:
# If you get the error "Resource not accessible by integration",
# The access rights are not sufficient, see
# https://github.com/softprops/action-gh-release/issues/232#issuecomment-1131379440
if: startsWith(github.ref, 'refs/tags/')
with:
name: ${{ steps.get_version.outputs.version-without-v }}
body: ${{ steps.extract-release-notes.outputs.release_notes }}
@@ -368,7 +397,6 @@ jobs:
# # Commit&Push Changelog to master branch. Must be manually merged back to rolling
# - name: Commit changes and push changes
# if: startsWith(github.ref, 'refs/tags/')
# run: |
# git config user.name github-actions
# git config user.email github-actions@github.com
@@ -380,9 +408,10 @@ jobs:
#########################################################################################
## Update the Web Installer on a release
#########################################################################################
# This is the same as in the update-webinstaller.yml
update-web-installer:
needs: [release]
# Make sure to also update update-webinstaller.yml!
update-web-installer:
if: github.event_name == 'release' # Only run when the trigger is a release
needs: [prepare-release]
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
@@ -396,32 +425,36 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Get version of last release
id: last_release
uses: mindojo/get-latest-release@0b8ef1434d7468d6bffcc8263baff5c777f72321
uses: joutvhu/get-release@v1
with:
myToken: ${{ github.token }}
exclude_types: "draft|prerelease"
view_top: 1
latest: true
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Add binary to Web Installer and update manifest
run: |
rm -f docs/binary/firmware.bin
wget https://github.com/jomjol/AI-on-the-edge-device/releases/download/${{ steps.last_release.outputs.tag_name }}/AI-on-the-edge-device__update__${{ steps.last_release.outputs.tag_name }}.zip
echo "Updating Web installer to use firmware from ${{ steps.last_release.outputs.tag_name }}..."
rm -f webinstaller/binary/firmware.bin
wget ${{ github.server_url }}/${{ github.repository }}/releases/download/${{ steps.last_release.outputs.tag_name }}/AI-on-the-edge-device__update__${{ steps.last_release.outputs.tag_name }}.zip
unzip AI-on-the-edge-device__update__${{ steps.last_release.outputs.tag_name }}.zip
cp -f firmware.bin docs/binary/firmware.bin
cp -f docs/manifest_template.json docs/manifest.json
sed -i 's/VERSION/${{ steps.last_release.outputs.tag_name }}/g' docs/manifest.json
cp -f firmware.bin webinstaller/binary/firmware.bin
echo "Updating index and manifest file..."
sed -i 's/$VERSION/${{ steps.last_release.outputs.tag_name }}/g' webinstaller/index.html
sed -i 's/$VERSION/${{ steps.last_release.outputs.tag_name }}/g' webinstaller/manifest.json
- name: Setup Pages
uses: actions/configure-pages@v2
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
uses: actions/upload-pages-artifact@v3
with:
path: 'docs'
path: 'webinstaller'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
uses: actions/deploy-pages@v4.0.5 # Note: v4 does not work!

View File

@@ -0,0 +1,21 @@
# This updates the Contributors list in the README.md
# it only gets run on:
# - Manually triggered
name: Manually update contributors list
on:
workflow_dispatch: # Run on manual trigger
jobs:
manually-update-contributors-list:
runs-on: ubuntu-latest
name: A job to automatically update the contributors list in the README.md
permissions:
contents: write
pull-requests: write
steps:
- name: Contribute List
uses: akhilmhdh/contributors-readme-action@v2.3.10
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -0,0 +1,63 @@
# This updates the Web Installer with the files from the webinstaller folder and the binary of the latest release
# it only gets run on:
# - Manually triggered
# Make sure to also update the lower part of build.yml!
name: Manual Web Installer Update
on:
workflow_dispatch: # Run on manual trigger
# push:
# branches:
# - rolling
# paths:
# - webinstaller # The path filter somehow does not work, so lets run it on every change to rolling
jobs:
manually-update-web-installer:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get version of last release
id: last_release
uses: joutvhu/get-release@v1
with:
latest: true
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Add binary to Web Installer and update manifest
run: |
echo "Updating Web installer to use firmware from ${{ steps.last_release.outputs.tag_name }}..."
rm -f webinstaller/binary/firmware.bin
wget ${{ github.server_url }}/${{ github.repository }}/releases/download/${{ steps.last_release.outputs.tag_name }}/AI-on-the-edge-device__update__${{ steps.last_release.outputs.tag_name }}.zip
unzip AI-on-the-edge-device__update__${{ steps.last_release.outputs.tag_name }}.zip
cp -f firmware.bin webinstaller/binary/firmware.bin
echo "Updating index and manifest file..."
sed -i 's/$VERSION/${{ steps.last_release.outputs.tag_name }}/g' webinstaller/index.html
sed -i 's/$VERSION/${{ steps.last_release.outputs.tag_name }}/g' webinstaller/manifest.json
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: 'webinstaller'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

View File

@@ -1,61 +0,0 @@
# This updates the Web Installer with the files from the docs folder and the binary of the latest release
# it only gets run on:
# - Changes to the docs folder in the `rolling` branch
# - On a release
name: Manual Web Installer Update
on:
workflow_dispatch: # Run on manual trigger
# push:
# branches:
# - rolling
# paths:
# - docs # The path filter somehow does not work, so lets run it on every change to rolling
jobs:
manually-update-web-installer:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get version of last release
id: last_release
uses: mindojo/get-latest-release@0b8ef1434d7468d6bffcc8263baff5c777f72321
with:
myToken: ${{ github.token }}
exclude_types: "draft|prerelease"
view_top: 1
- name: Add binary to Web Installer and update manifest
run: |
rm -f docs/binary/firmware.bin
wget https://github.com/jomjol/AI-on-the-edge-device/releases/download/${{ steps.last_release.outputs.tag_name }}/AI-on-the-edge-device__update__${{ steps.last_release.outputs.tag_name }}.zip
unzip AI-on-the-edge-device__update__${{ steps.last_release.outputs.tag_name }}.zip
cp -f firmware.bin docs/binary/firmware.bin
cp -f docs/manifest_template.json docs/manifest.json
sed -i 's/VERSION/${{ steps.last_release.outputs.tag_name }}/g' docs/manifest.json
- name: Setup Pages
uses: actions/configure-pages@v2
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: 'docs'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1

View File

@@ -1,5 +1,5 @@
# Reply Bot
# It uses the configuration in .github/label-commenter-config.yml
# It uses the configuration in .github/label-commenter-config.yaml
# See https://github.com/peaceiris/actions-label-commenter
name: Reply-Bot
@@ -18,14 +18,13 @@ permissions:
jobs:
comment:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
####################################################################
## Remove labels again (issues only)
## Make sure to also add the reply message to .github/label-commenter-config.yml!
## Make sure to also add the reply message to .github/label-commenter-config.yaml!
## This currently seems no longer to work due to changes on the actions-cool/issues-helper!
####################################################################
# - name: Remove 'Logfile' label again (issues only)
@@ -69,11 +68,12 @@ jobs:
# with:
# actions: 'remove-labels'
# labels: 'bot-reply Show Trained Digits/Pointers'
####################################################################
## Write the response
####################################################################
- name: Write Response
uses: peaceiris/actions-label-commenter@c2d00660c86f2b9ed0fb35b372c451558eba85b3
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
github_token: "${{ secrets.GITHUB_TOKEN }}"
config_file: .github/label-commenter-config.yaml

12
.gitmodules vendored
View File

@@ -4,6 +4,12 @@
[submodule "code/components/esp-nn"]
path = code/components/esp-nn
url = https://github.com/espressif/esp-nn.git
[submodule "code/components/tflite-micro-esp-examples"]
path = code/components/tflite-micro-esp-examples
url = https://github.com/espressif/tflite-micro-esp-examples.git
[submodule "code/components/esp-tflite-micro"]
path = code/components/esp-tflite-micro
url = https://github.com/espressif/esp-tflite-micro.git
[submodule "code/components/stb"]
path = code/components/stb
url = https://github.com/nothings/stb.git
[submodule "code/components/esp-protocols"]
path = code/components/esp-protocols
url = https://github.com/espressif/esp-protocols.git

File diff suppressed because it is too large Load Diff

View File

@@ -2,28 +2,54 @@
**There are a lot of ideas for further improvements, but only limited capacity on side of the developer.** Therefore I have created this page as a collection of ideas.
1. Who ever has a new idea can put it here, so it that it is not forgotten.
1. Whoever has a new idea can put it here, so that it is not forgotten.
2. Who ever has time, capacity and passion to support, can take any of the ideas and implement them.
I will support and help where ever I can!
2. Whoever has the time, capacity and passion to support the project can take any of the ideas and implement them. I will provide support and help wherever I can!
____
#### #40 Trigger with cron like exact time slot
* https://github.com/jomjol/AI-on-the-edge-device/issues/2470
#### #39 upnp implementation to auto detect the device
* https://github.com/jomjol/AI-on-the-edge-device/issues/2481
#### #38 Energy Saving
* Deep sleep between recognition
* https://github.com/jomjol/AI-on-the-edge-device/issues/2486
#### #37 Auto init SD card
* Fully implement the SD card handling (including formatting) into the firmware
* https://github.com/jomjol/AI-on-the-edge-device/issues/2488Demo
#### #36 Run demo without camera
Demo mode requires a working camera (if not, one receives a 'Cam bad' error). Would be nice to demo or play around on other ESP32 boards (or on ESP32-CAM boards when you broke the camera cable...).
#### #35 Use the same model, but provide the image from a Smartphone Camera
as reading the Electricity or Water meter every few minutues only delivers apparent accuracy (DE: "Scheingenauigkeit") you could just as well take a picture with your Smartphone evey so often (e.g. once a week when you are in the Basement anyway), then with some "semi clever" tricks pass this image to the model developed here, and the values then on to who ever needs them e.g. via MQTT.
as reading the Electricity or Water meter every few minutes only delivers apparent accuracy (DE: "Scheingenauigkeit") you could just as well take a picture with your Smartphone every so often (e.g. once a week when you are in the Basement anyway), then with some "semi clever" tricks pass this image to the model developed here, and the values than on to whoever needs them e.g. via MQTT.
IMO: It is not needed to have that many readings (datapoints) as our behaviour (Use of electricity or water) doesn't vary that much, say, over a weeks time. The interpolation between weekly readings will give sufficient information on the power and/or water usage.
#### #34 implement state and Roi for water leak detection
for example see Roi on the next picture..
for example see Roi in the next picture..
![grafik](https://user-images.githubusercontent.com/38385805/207858812-2a6ba41d-1a8c-4fa1-9b6a-53cdd113c106.png)
in case of position change between the measurments set this state to true, if there is no change set it back to false.
in case of position change between the measurements set this state to true, if there is no change set it back to false.
In a defined time window this movement can lead into an alarm state / water leak..
haveing this state in the mqtt broker can trigger functions like closing the ater pipe walve and so on...
having this state in the mqtt broker can trigger functions like closing the water pipe valve and so on...
@@ -39,7 +65,7 @@ haveing this state in the mqtt broker can trigger functions like closing the ate
#### #31 Implement InfluxDB v2.x interface
* Currently only InfluxDB v1.x is supportet, extend to v2.x
* Currently only InfluxDB v1.x is supported, extend to v2.x
* Remark: interface has changed
* see [#1160](https://github.com/jomjol/AI-on-the-edge-device/issues/1160)
@@ -51,12 +77,12 @@ haveing this state in the mqtt broker can trigger functions like closing the ate
#### ~~#29 Add favicon and use the hostname for the website~~- implemented v11.3.1
~~* https://github.com/jomjol/AI-on-the-edge-device/issues/927~~
* ~~https://github.com/jomjol/AI-on-the-edge-device/issues/927~~
#### #28 Improved error handling for ROIs
* In case a ROI is out of the image, there is no error message, but a non sense image is used
* Implement a error message for wrong configuratioin of ROI
* Implement a error message for wrong configuration of ROI
#### #27 Use Homie Spec for Mqtt binding
@@ -89,7 +115,7 @@ haveing this state in the mqtt broker can trigger functions like closing the ate
#### ~~#22 Direct hint to the different neural network files in the other repositories~~- implemented >v11.3.1
~~* https://github.com/jomjol/AI-on-the-edge-device/issues/644~~
* ~~https://github.com/jomjol/AI-on-the-edge-device/issues/644~~

68
Licence.md Normal file
View File

@@ -0,0 +1,68 @@
# **Dual Use License for AI-on-the-Edge Device**
Version: 1.0
Date: 2025-01-05 (5th January 2025)
## **Preamble**
This license allows individuals to use, modify, and share AI-on-the-Edge freely for private, non-commercial purposes. Any commercial use requires a separate licensing agreement with the rights holder.
------
## **1. Grant of License**
### 1.1 **Private Use**
The licensor grants the licensee a free, non-exclusive, worldwide license to use, modify, and distribute the software for private, non-commercial purposes.
### 1.2 **Commercial Use**
The use of the software or any derivative works in any commercial context (including, but not limited to, selling, renting, providing as a service, or integrating into commercial products) is prohibited without a separate commercial license.
------
## **2. Obligation to Private Derivatives**
In modified private versions of the software, the unchanged license as well as the reference to the original source and authors must always be stated (https://github.com/jomjol/AI-on-the-edge-device).
Modified versions of the software must be clearly marked as such and must not imply they are provided by the original licensor.
------
## **3. Commercial Licensing**
Companies, organizations, or individuals wishing to use the software for commercial purposes must obtain a separate commercial license. Please contact mueller.josef(@)gmail.com for further details.
------
## **4. Terms of Cooperation**
By contributing to the AI-on-the-Edge software, this license is considered accepted. This applies to, but is not limited to, code, error corrections, extensions, artwork, documentation, and new features. Any contribution, including libraries and sources, must comply with the terms of this license.
The contributor agrees that the added code and functionality may also be used in commercial versions without compensation to the contributor.
------
## **5. Disclaimer of Liability**
### 5.1 **General Disclaimer**
The software is provided "as is", without any express or implied warranties. The licensor is not liable for any damages resulting from the use of the software.
### 5.2 **No Usage in Safety or Security Environments**
The image processing uses neural networks, among other algorithms, whose results can produce incorrect or unexpected outcomes due to their functionality and the underlying training data. Therefore, this system must not be used or offered for safety-relevant systems or systems with high reliability requirements.
------
## **6. General Provisions**
### 6.1 **Severability Clause**
If any provision of this license is deemed invalid, the remaining provisions shall remain in full force and effect.
------
## **Acceptance**
By using this software, the licensee agrees to the terms of this license.

733
README.md
View File

@@ -1,102 +1,681 @@
# Welcome to the AI-on-the-edge-device
<img src="images/icon/watermeter.svg" width="100px">
<h1 align="center">AI on the Edge Device: Digitizing Your non-digital meters with an ESP32-CAM</h1>
<br>
<br>
Artificial intelligence based systems have been established in our every days live. Just think of speech or image recognition. Most of the systems relay on either powerful processors or a direct connection to the cloud for doing the calculations up there. With the increasing power of modern processors the AI systems are coming closer to the end user - which is usually called **edge computing**.
Here this edge computing is brought into a practical oriented example, where a AI network is implemented on a ESP32 device so: **AI on the edge**.
## Table of Contents
- [Key Features 🚀](#key-features-)
- [Workflow 🔧](#workflow-)
- [Impressions 📷](#impressions-)
- [AI-on-the-edge-device on a Water Meter 💧](#ai-on-the-edge-device-on-a-water-meter-)
- [Web Interface (Water Meter) 💻](#web-interface-water-meter-)
- [AI-on-the-edge-device on an Electrical Power Meter ⚡](#ai-on-the-edge-device-on-an-electrical-power-meter-)
- [Setup 🛠️](#setup-%EF%B8%8F)
- [Download 🔽](#download-)
- [Flashing the ESP32 💾](#flashing-the-esp32-)
- [Flashing the SD Card 💾](#flashing-the-sd-card-)
- [Casing 🛠️](#casing-%EF%B8%8F)
- [Donate ☕](#donate-)
- [Support 💬](#support-)
- [Changes and History 📜](#changes-and-history-)
- [Build It Yourself 🔨](#build-it-yourself-)
- [Tools 🛠️](#tools-%EF%B8%8F)
- [Additional Ideas 💡](#additional-ideas-)
- [Our Contributors ❤️](#our-contributors-%EF%B8%8F)
This projects allows you to digitalize your **analoge** water, gas, power and other meters using cheap and easily available hardware.
All you need is an [ESP32 board with a supported camera](https://jomjol.github.io/AI-on-the-edge-device-docs/Hardware-Compatibility/) and a bit of a practical hand.
<img src="images/esp32-cam.png" width="200px">
## Key features
- Tensorflow Lite (TFlite) integration - including easy to use wrapper
- Inline Image processing (feature detection, alignment, ROI extraction)
- **Small** and **cheap** device (3x4.5x2 cm³, < 10 EUR)
- camera and illumination integrated
- Web surface to administrate and control
- OTA-Interface to update directly through the web interface
- Full integration into Homeassistant
- Support for Influx DB 1
- MQTT
- REST API
## Workflow
The device takes a photo of your meter at a defined interval. It then extracts the Regions of Interest (ROI's) out of it and runs them through an artificial inteligence. As a result, you get the digitalized value of your meter.
There are several options what to do with that value. Either send it to a MQTT broker, write it to an InfluxDb or simply provide it throug a REST API.
<img src="https://raw.githubusercontent.com/jomjol/AI-on-the-edge-device/master/images/idea.jpg" width="600">
## Impressions
### AI-on-the-edge-device on a Water Meter
<img src="https://raw.githubusercontent.com/jomjol/AI-on-the-edge-device/master/images/watermeter_all.jpg" width="200"><img src="https://raw.githubusercontent.com/jomjol/AI-on-the-edge-device/master/images/main.jpg" width="200"><img src="https://raw.githubusercontent.com/jomjol/AI-on-the-edge-device/master/images/size.png" width="200">
### Web Interface (Water Meter)
<img src="https://raw.githubusercontent.com/jomjol/AI-on-the-edge-device/master/images/watermeter.jpg" width="600">
### AI-on-the-edge-device on a Electrical Power Meter
<img src="https://raw.githubusercontent.com/jomjol/AI-on-the-edge-device/master/images/powermeter.jpg" width="600">
<p align="center">
<a href="#top">
<img src="https://img.shields.io/badge/Back%20to%20Top-000000?style=for-the-badge&logo=github&logoColor=white" alt="Back to Top">
</a>
</p>
## Setup
There is a growing [documentation](https://jomjol.github.io/AI-on-the-edge-device-docs/) which provides you with a lot of information.
Head there to get a start, set it up and configure it.
There are also a articles in the German Heise magazine "make:" about the setup and the technical background (behind a paywall) : [DIY - Setup](https://www.heise.de/select/make/2021/2/2103513300897420296)
For further background information, head to [Neural Networks](https://www.heise.de/select/make/2021/6/2126410443385102621), [Training Neural Networks](https://www.heise.de/select/make/2022/1/2134114065999161585) and [Programming on the ESP32](https://www.heise.de/select/make/2022/2/2204010051597422030)
[![made-with-c++](https://img.shields.io/badge/Made%20with-C++-1f425f.svg)](https://github.com/jomjol/AI-on-the-edge-device/tree/main/code)
[![Doc](https://img.shields.io/badge/Doc-MkDocs-526CFE.svg)](https://jomjol.github.io/AI-on-the-edge-device-docs/)
[![Total downloads](https://img.shields.io/github/downloads/jomjol/AI-on-the-edge-device/total.svg)](https://GitHub.com/jomjol/AI-on-the-edge-device/releases/)
[![GitHub release](https://img.shields.io/github/release/jomjol/AI-on-the-edge-device.svg)](https://GitHub.com/jomjol/AI-on-the-edge-device/releases/)
[![GitHub forks](https://img.shields.io/github/forks/jomjol/AI-on-the-edge-device.svg?style=social&label=Fork&maxAge=2592000)](https://GitHub.com/jomjol/AI-on-the-edge-device/network/)
[![GitHub stars](https://img.shields.io/github/stars/jomjol/AI-on-the-edge-device.svg?style=social&label=Star&maxAge=2592000)](https://GitHub.com/jomjol/AI-on-the-edge-device/stargazers/)
### Download
The latest available version is available on the [Releases page](https://github.com/jomjol/AI-on-the-edge-device/releases).
<p align="center" id="top">
<img src="images/icon/watermeter.svg" width="150px">
</p>
### Flashing of the ESP32
Initially you will have to flash the ESP32 through an USB connection. Later an update is possible directly over the Air (OTA).
Artificial intelligence is everywhere, from speech to image recognition. While most AI systems rely on powerful processors or cloud computing, **edge computing** brings AI closer to the end user by utilizing the capabilities of modern processors.
This project demonstrates edge computing using the **ESP32**, a low-cost, AI-capable device, to digitize your analog meters—whether water, gas, or electricity. With affordable hardware and simple instructions, you can turn any standard meter into a smart device.
Let's explore how to make **AI on the Edge** a reality! 🌟
All you need is an [ESP32 board with a supported camera](https://jomjol.github.io/AI-on-the-edge-device-docs/Hardware-Compatibility/) and some practical skills. 🛠️
---
<br>
## Key Features 🚀
- 🔗 **Tensorflow Lite (TFLite) integration** including an easy-to-use wrapper.
- 📸 **Inline image processing** (feature detection, alignment, ROI extraction).
- 💡 **Small** and **affordable** device (3 x 4.5 x 2 cm³, less than 10 EUR).
- 📷 Integrated camera and illumination.
- 🌐 Web interface for administration and control.
- 🔄 OTA interface for updating directly via the web interface.
- 🏠 Full integration with Home Assistant.
- 📊 Support for **Influx DB 1** and **2**.
- 📡 **MQTT protocol** support.
- 📥 **REST API** available for data access.
<br>
## Workflow 🔧
The device captures a photo of your meter at set intervals. It then extracts the Regions of Interest (ROIs) from the image and runs them through artificial intelligence. As a result, you get the digitized value of your meter.
There are several options for what to do with that value:
- 📤 Send it to a **MQTT broker**.
- 📝 Write it to an **InfluxDb**.
- 🔗 Provide access via a **REST API**.
<p align="center">
<img src="images/idea.jpg" width="600">
</p>
---
<br>
## Impressions 📷
+ ### AI-on-the-edge-device on a Water Meter 💧
<p align="center">
<img src="images/watermeter_all.jpg" width="200"><img
src="images/main.jpg" width="200"><img
src="images/size.png" width="200">
</p>
+ ### Web Interface (Water Meter) 💻
<p align="center">
<img src="images/watermeter.jpg" width="600">
</p>
+ ### AI-on-the-edge-device on an Electrical Power Meter ⚡
<p align="center">
<img src="images/powermeter.jpg" width="600">
</p>
---
<br>
## Setup 🛠️
There is growing [documentation](https://jomjol.github.io/AI-on-the-edge-device-docs/) which provides you with a lot of information. Head there to get started, set it up, and configure it.
There are also articles in the German Heise magazine "make:" about the setup and technical background (behind a paywall): [DIY - Setup](https://www.heise.de/select/make/2021/2/2103513300897420296) 📰
A lot of people have created useful YouTube videos that might help you get started:
- 🎥 [youtube.com/watch?v=HKBofb1cnNc](https://www.youtube.com/watch?v=HKBofb1cnNc)
- 🎥 [youtube.com/watch?v=yyf0ORNLCk4](https://www.youtube.com/watch?v=yyf0ORNLCk4)
- 🎥 [youtube.com/watch?v=XxmTubGek6M](https://www.youtube.com/watch?v=XxmTubGek6M)
- 🎥 [youtube.com/watch?v=mDIJEyElkAU](https://www.youtube.com/watch?v=mDIJEyElkAU)
- 🎥 [youtube.com/watch?v=SssiPkyKVVs](https://www.youtube.com/watch?v=SssiPkyKVVs)
- 🎥 [youtube.com/watch?v=MAHE_QyHZFQ](https://www.youtube.com/watch?v=MAHE_QyHZFQ)
- 🎥 [youtube.com/watch?v=Uap_6bwtILQ](https://www.youtube.com/watch?v=Uap_6bwtILQ)
For further background information, head to:
- [Neural Networks](https://www.heise.de/select/make/2021/6/2126410443385102621)
- [Training Neural Networks](https://www.heise.de/select/make/2022/1/2134114065999161585)
- [Programming on the ESP32](https://www.heise.de/select/make/2022/2/2204010051597422030)
---
<br>
## Download 🔽
The latest available version can be found on the [Releases page](https://github.com/jomjol/AI-on-the-edge-device/releases).
---
<br>
## Flashing the ESP32 💾
Initially, you will have to flash the ESP32 via a USB connection. Later updates are possible directly over the air (OTA using Wi-Fi).
There are different ways to flash your ESP32:
- [Web Installer and Console](https://jomjol.github.io/AI-on-the-edge-device/index.html) (Webbrowser based tool to flash the ESP32 and extract the Log over USB)
- The preferred way is the [Web Installer and Console](https://jomjol.github.io/AI-on-the-edge-device/index.html), a browser-based tool to flash the ESP32 and extract the log over USB:
![](images/web-installer.png)
- Flash Tool from Espressif
- ESPtool (Command Line Tool)
- ESPtool (command-line tool)
See the [Docu](https://jomjol.github.io/AI-on-the-edge-device-docs/Installation/) for more information.
See the [documentation](https://jomjol.github.io/AI-on-the-edge-device-docs/Installation/) for more information.
### Flashing the SD-Card
The SD-Card must be flashed separately, see the [Docu](https://jomjol.github.io/AI-on-the-edge-device-docs/Installation/) for details.
---
## Casing
<br>
A 3d-printable housing can be found here:
- https://www.thingiverse.com/thing:4573481 (Water Meter)
- https://www.thingiverse.com/thing:5028229 (Power Meter)
- https://www.thingiverse.com/thing:5224101 (Gas Meter)
- https://www.thingiverse.com/thing:4571627 (ESP32-Cam housing only)
## Flashing the SD Card 💾
The SD card can be set up automatically after the firmware is installed. See the [documentation](https://jomjol.github.io/AI-on-the-edge-device-docs/Installation/#remote-setup-using-the-built-in-access-point) for details. For this to work, the SD card must be FAT formatted (which is the default on a new SD card).
## Build it yourself
See [Build Instructions](code/README.md).
Alternatively, the SD card can still be set up manually. See the [documentation](https://jomjol.github.io/AI-on-the-edge-device-docs/Installation/#3-sd-card) for details.
## Donate
If you would like to support the developer with a cup of coffee you can do that via [Paypal](https://www.paypal.com/donate?hosted_button_id=8TRSVYNYKDSWL).
---
<form action="https://www.paypal.com/donate" method="post" target="_top">
<input type="hidden" name="hosted_button_id" value="8TRSVYNYKDSWL" />
<input type="image" src="https://www.paypalobjects.com/en_US/DK/i/btn/btn_donateCC_LG.gif" border="0" name="submit" title="PayPal - The safer, easier way to pay online!" alt="Donate with PayPal button" />
<img alt="" border="0" src="https://www.paypal.com/en_DE/i/scr/pixel.gif" width="1" height="1" />
</form>
If you have any technical topics, you can create an [Issue](https://github.com/jomjol/AI-on-the-edge-device/issues).
<br>
In other cases you can contact the developer via email: <img src="https://raw.githubusercontent.com/jomjol/AI-on-the-edge-device/master/images/mail.jpg" height="25">
## Casing 🛠️
Various 3D-printable housings can be found here:
- 💧 [Water Meter](https://www.thingiverse.com/thing:4573481)
- ⚡ [Power Meter](https://www.thingiverse.com/thing:5028229)
- 🔥 [Gas Meter](https://www.thingiverse.com/thing:5224101)
- 📷 [ESP32-cam housing only](https://www.thingiverse.com/thing:4571627)
## Changes and History
See [Changelog](Changelog.md)
---
## Tools
<br>
* Logfile downloader and combiner (Thx to [reserve85](https://github.com/reserve85))
* Files see ['/tools/logfile-tool'](tbd), How-to see [Docu](https://jomjol.github.io/AI-on-the-edge-device-docs/outdated--Gasmeter-Log-Downloader/)
## Donate ☕
If you'd like to support the developer with a cup of coffee, you can do so via [PayPal](https://www.paypal.com/donate?hosted_button_id=8TRSVYNYKDSWL).
## Additional Ideas
There are some ideas and feature requests which are not followed currently - mainly due to capacity reasons on side of the developer. They are collected here: [FeatureRequest.md](FeatureRequest.md)
<p align="center">
<a href="https://www.paypal.com/donate?hosted_button_id=8TRSVYNYKDSWL"><img border="0" src="images/paypal.png" width="200px" target="_blank"></a>
</p>
------
---
<br>
## Support 💬
If you have any technical problems, please search the [discussions](https://github.com/jomjol/AI-on-the-edge-device/discussions). In case you find a bug or have a feature request, please open an [issue](https://github.com/jomjol/AI-on-the-edge-device/issues).
For any other issues, you can contact the developer via email:
<p align="center">
<img src="images/mail.jpg" height="25">
</p>
---
<br>
## Changes and History 📜
See the [Changelog](Changelog.md) for detailed information.
---
<br>
## Build It Yourself 🔨
See the [Build Instructions](code/README.md) for step-by-step guidance.
---
<br>
## Tools 🛠️
* Logfile downloader and combiner (Thanks to [reserve85](https://github.com/reserve85))
* It can be found at ['/tools/logfile-tool'](https://github.com/jomjol/AI-on-the-edge-device/tree/main/tools/logfile-tool).
---
<br>
## Additional Ideas 💡
There are some ideas and feature requests which are not currently being pursued—mainly due to capacity constraints on the part of the developers. These features are collected in the [issues](https://github.com/jomjol/AI-on-the-edge-device/issues) and in [FeatureRequest.md](FeatureRequest.md).
---
<br>
## Our Contributors ❤️
<!-- Do not manually edit this section! It should get updated using the Github action "Manually update contributors list" -->
<!-- readme: contributors -start -->
<table>
<tbody>
<tr>
<td align="center">
<a href="https://github.com/jomjol">
<img src="https://avatars.githubusercontent.com/u/30766535?v=4" width="100;" alt="jomjol"/>
<br />
<sub><b>jomjol</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/caco3">
<img src="https://avatars.githubusercontent.com/u/1783586?v=4" width="100;" alt="caco3"/>
<br />
<sub><b>CaCO3</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/haverland">
<img src="https://avatars.githubusercontent.com/u/412645?v=4" width="100;" alt="haverland"/>
<br />
<sub><b>Frank Haverland</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/SybexX">
<img src="https://avatars.githubusercontent.com/u/587201?v=4" width="100;" alt="SybexX"/>
<br />
<sub><b>michael</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/Slider0007">
<img src="https://avatars.githubusercontent.com/u/115730895?v=4" width="100;" alt="Slider0007"/>
<br />
<sub><b>Slider0007</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/nliaudat">
<img src="https://avatars.githubusercontent.com/u/6782613?v=4" width="100;" alt="nliaudat"/>
<br />
<sub><b>Nicolas Liaudat</b></sub>
</a>
</td>
</tr>
<tr>
<td align="center">
<a href="https://github.com/Zwer2k">
<img src="https://avatars.githubusercontent.com/u/10438794?v=4" width="100;" alt="Zwer2k"/>
<br />
<sub><b>Zwer2k</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/phlupp">
<img src="https://avatars.githubusercontent.com/u/6304863?v=4" width="100;" alt="phlupp"/>
<br />
<sub><b>phlupp</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/jasaw">
<img src="https://avatars.githubusercontent.com/u/721280?v=4" width="100;" alt="jasaw"/>
<br />
<sub><b>jasaw</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/dockSquadron">
<img src="https://avatars.githubusercontent.com/u/11964767?v=4" width="100;" alt="dockSquadron"/>
<br />
<sub><b>dockSquadron</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/rdmueller">
<img src="https://avatars.githubusercontent.com/u/1856308?v=4" width="100;" alt="rdmueller"/>
<br />
<sub><b>Ralf D. Müller</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/cristianmitran">
<img src="https://avatars.githubusercontent.com/u/36613624?v=4" width="100;" alt="cristianmitran"/>
<br />
<sub><b>cristianmitran</b></sub>
</a>
</td>
</tr>
<tr>
<td align="center">
<a href="https://github.com/michaeljoos72">
<img src="https://avatars.githubusercontent.com/u/20517474?v=4" width="100;" alt="michaeljoos72"/>
<br />
<sub><b>michaeljoos72</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/henrythasler">
<img src="https://avatars.githubusercontent.com/u/6277203?v=4" width="100;" alt="henrythasler"/>
<br />
<sub><b>Henry Thasler</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/amantyagiprojects">
<img src="https://avatars.githubusercontent.com/u/174239452?v=4" width="100;" alt="amantyagiprojects"/>
<br />
<sub><b>Naman Tyagi</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/pixeldoc2000">
<img src="https://avatars.githubusercontent.com/u/376715?v=4" width="100;" alt="pixeldoc2000"/>
<br />
<sub><b>pixel::doc</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/mad2xlc">
<img src="https://avatars.githubusercontent.com/u/37449746?v=4" width="100;" alt="mad2xlc"/>
<br />
<sub><b>Stefan</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/jochenchrist">
<img src="https://avatars.githubusercontent.com/u/2930448?v=4" width="100;" alt="jochenchrist"/>
<br />
<sub><b>jochenchrist</b></sub>
</a>
</td>
</tr>
<tr>
<td align="center">
<a href="https://github.com/parhedberg">
<img src="https://avatars.githubusercontent.com/u/13777521?v=4" width="100;" alt="parhedberg"/>
<br />
<sub><b>parhedberg</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/fsck-block">
<img src="https://avatars.githubusercontent.com/u/58307481?v=4" width="100;" alt="fsck-block"/>
<br />
<sub><b>fsck-block</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/slovdahl">
<img src="https://avatars.githubusercontent.com/u/1417619?v=4" width="100;" alt="slovdahl"/>
<br />
<sub><b>Sebastian Lövdahl</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/RaHehl">
<img src="https://avatars.githubusercontent.com/u/7577984?v=4" width="100;" alt="RaHehl"/>
<br />
<sub><b>Raphael Hehl</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/LordGuilly">
<img src="https://avatars.githubusercontent.com/u/13271835?v=4" width="100;" alt="LordGuilly"/>
<br />
<sub><b>LordGuilly</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/muggenhor">
<img src="https://avatars.githubusercontent.com/u/484066?v=4" width="100;" alt="muggenhor"/>
<br />
<sub><b>Giel van Schijndel</b></sub>
</a>
</td>
</tr>
<tr>
<td align="center">
<a href="https://github.com/bilalmirza74">
<img src="https://avatars.githubusercontent.com/u/84387676?v=4" width="100;" alt="bilalmirza74"/>
<br />
<sub><b>Bilal Mirza</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/AngryApostrophe">
<img src="https://avatars.githubusercontent.com/u/89547888?v=4" width="100;" alt="AngryApostrophe"/>
<br />
<sub><b>AngryApostrophe</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/ralf1307">
<img src="https://avatars.githubusercontent.com/u/46164027?v=4" width="100;" alt="ralf1307"/>
<br />
<sub><b>Ralf Rachinger</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/Ranjana761">
<img src="https://avatars.githubusercontent.com/u/129291313?v=4" width="100;" alt="Ranjana761"/>
<br />
<sub><b>Ranjana761</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/SURYANSH-RAI">
<img src="https://avatars.githubusercontent.com/u/79277130?v=4" width="100;" alt="SURYANSH-RAI"/>
<br />
<sub><b>SURYANSH RAI</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/SkylightXD">
<img src="https://avatars.githubusercontent.com/u/16561545?v=4" width="100;" alt="SkylightXD"/>
<br />
<sub><b>SkylightXD</b></sub>
</a>
</td>
</tr>
<tr>
<td align="center">
<a href="https://github.com/ottk3">
<img src="https://avatars.githubusercontent.com/u/5236802?v=4" width="100;" alt="ottk3"/>
<br />
<sub><b>Sven Rojek</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/Turbo87">
<img src="https://avatars.githubusercontent.com/u/141300?v=4" width="100;" alt="Turbo87"/>
<br />
<sub><b>Tobias Bieniek</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/tkopczuk">
<img src="https://avatars.githubusercontent.com/u/101632?v=4" width="100;" alt="tkopczuk"/>
<br />
<sub><b>Tomek Kopczuk</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/yonz2">
<img src="https://avatars.githubusercontent.com/u/13886257?v=4" width="100;" alt="yonz2"/>
<br />
<sub><b>Yonz</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/Yveaux">
<img src="https://avatars.githubusercontent.com/u/7716005?v=4" width="100;" alt="Yveaux"/>
<br />
<sub><b>Yveaux</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/flooxo">
<img src="https://avatars.githubusercontent.com/u/93255373?v=4" width="100;" alt="flooxo"/>
<br />
<sub><b>flox_x</b></sub>
</a>
</td>
</tr>
<tr>
<td align="center">
<a href="https://github.com/gneluka">
<img src="https://avatars.githubusercontent.com/u/32097881?v=4" width="100;" alt="gneluka"/>
<br />
<sub><b>gneluka</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/kalwados">
<img src="https://avatars.githubusercontent.com/u/11840444?v=4" width="100;" alt="kalwados"/>
<br />
<sub><b>kalwados</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/kub3let">
<img src="https://avatars.githubusercontent.com/u/95883234?v=4" width="100;" alt="kub3let"/>
<br />
<sub><b>kub3let</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/pfeifferch">
<img src="https://avatars.githubusercontent.com/u/73090220?v=4" width="100;" alt="pfeifferch"/>
<br />
<sub><b>pfeifferch</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/rstephan">
<img src="https://avatars.githubusercontent.com/u/8532364?v=4" width="100;" alt="rstephan"/>
<br />
<sub><b>rstephan</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/smartboart">
<img src="https://avatars.githubusercontent.com/u/38385805?v=4" width="100;" alt="smartboart"/>
<br />
<sub><b>smartboart</b></sub>
</a>
</td>
</tr>
<tr>
<td align="center">
<a href="https://github.com/wetneb">
<img src="https://avatars.githubusercontent.com/u/309908?v=4" width="100;" alt="wetneb"/>
<br />
<sub><b>Antonin Delpeuch</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/adarazs">
<img src="https://avatars.githubusercontent.com/u/6269603?v=4" width="100;" alt="adarazs"/>
<br />
<sub><b>Attila Darazs</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/austindrenski">
<img src="https://avatars.githubusercontent.com/u/21338699?v=4" width="100;" alt="austindrenski"/>
<br />
<sub><b>Austin Drenski</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/PLCHome">
<img src="https://avatars.githubusercontent.com/u/29116097?v=4" width="100;" alt="PLCHome"/>
<br />
<sub><b>PLCHome</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/CFenner">
<img src="https://avatars.githubusercontent.com/u/9592452?v=4" width="100;" alt="CFenner"/>
<br />
<sub><b>Christopher Fenner</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/dkneisz">
<img src="https://avatars.githubusercontent.com/u/43378003?v=4" width="100;" alt="dkneisz"/>
<br />
<sub><b>Dave</b></sub>
</a>
</td>
</tr>
<tr>
<td align="center">
<a href="https://github.com/FarukhS52">
<img src="https://avatars.githubusercontent.com/u/129654632?v=4" width="100;" alt="FarukhS52"/>
<br />
<sub><b>Farookh Zaheer Siddiqui</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/hex7c0">
<img src="https://avatars.githubusercontent.com/u/4419146?v=4" width="100;" alt="hex7c0"/>
<br />
<sub><b>Francesco Carnielli</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/040medien">
<img src="https://avatars.githubusercontent.com/u/115072?v=4" width="100;" alt="040medien"/>
<br />
<sub><b>Frederik Kemner</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/eltociear">
<img src="https://avatars.githubusercontent.com/u/22633385?v=4" width="100;" alt="eltociear"/>
<br />
<sub><b>Ikko Eltociear Ashimine</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/queeek">
<img src="https://avatars.githubusercontent.com/u/9533371?v=4" width="100;" alt="queeek"/>
<br />
<sub><b>Ina</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/joergrosenkranz">
<img src="https://avatars.githubusercontent.com/u/310438?v=4" width="100;" alt="joergrosenkranz"/>
<br />
<sub><b>Joerg Rosenkranz</b></sub>
</a>
</td>
</tr>
<tr>
<td align="center">
<a href="https://github.com/Innovatorcloudy">
<img src="https://avatars.githubusercontent.com/u/183274513?v=4" width="100;" alt="Innovatorcloudy"/>
<br />
<sub><b>KrishCode</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/myxor">
<img src="https://avatars.githubusercontent.com/u/1397377?v=4" width="100;" alt="myxor"/>
<br />
<sub><b>Marco H</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/rainman110">
<img src="https://avatars.githubusercontent.com/u/3213107?v=4" width="100;" alt="rainman110"/>
<br />
<sub><b>Martin Siggel</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/mkelley88">
<img src="https://avatars.githubusercontent.com/u/5567324?v=4" width="100;" alt="mkelley88"/>
<br />
<sub><b>Matthew T. Kelley</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/toolsfactory">
<img src="https://avatars.githubusercontent.com/u/7744975?v=4" width="100;" alt="toolsfactory"/>
<br />
<sub><b>Michael Geissler</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/ppisljar">
<img src="https://avatars.githubusercontent.com/u/13629809?v=4" width="100;" alt="ppisljar"/>
<br />
<sub><b>Peter Pisljar</b></sub>
</a>
</td>
</tr>
<tbody>
</table>
<!-- readme: contributors -end -->
---
<div align="center">
<a href="#top">
<img src="https://img.shields.io/badge/Back%20to%20Top-000000?style=for-the-badge&logo=github&logoColor=white" alt="Back to Top">
</a>
</div>

1
code/.gitignore vendored
View File

@@ -1,4 +1,5 @@
.pio
.idea
.vscode/.browse.c_cpp.db*
.vscode/c_cpp_properties.json
.vscode/launch.json

View File

@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.16.0)
list(APPEND EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common components/tflite-micro-esp-examples/components/tflite-lib)
list(APPEND EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common components/esp-tflite-micro components/esp-protocols/components/mdns)
ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/version.cpp

View File

@@ -4,10 +4,19 @@
```
git clone https://github.com/jomjol/AI-on-the-edge-device.git
cd AI-on-the-edge-device
git checkout rolling
git checkout main
git submodule update --init
```
## Update Submodules
```
cd /components/submodule-name (e.g. tflite-micro-example)
git checkout VERSION (e.g. HASH of latest tflite-micro-example build)
cd ../../ (at the code level)
git submodule update --init
```
You may need to manually delete some directories in the 'components' folder beforehand, as they were not deleted during checkout (before update -- init)
## Build and Flash within terminal
See further down to build it within an IDE.
### Compile
@@ -42,7 +51,7 @@ pio device monitor -p /dev/ttyUSB0
```
git clone https://github.com/jomjol/AI-on-the-edge-device.git
cd AI-on-the-edge-device
git checkout rolling
git checkout main
git submodule update --init
```
@@ -60,3 +69,6 @@ pio device monitor -p /dev/ttyUSB0
- `pio run --target erase` to erase the flash
- `pio run --target upload` this will upload the `bootloader.bin, partitions.bin,firmware.bin` from the `code/.pio/build/esp32cam/` folder.
- `pio device monitor` to observe the logs via uart
# Update Parameters
If you create or rename a parameter, make sure to update its documentation in `../param-docs/parameter-pages`! Check the `../param-docs/README.md` for more information.

View File

@@ -1,27 +1,53 @@
/********************************************************************************
* https://github.com/RoboticsBrno/SmartLeds
*
* MIT License
*
* Copyright (c) 2017 RoboticsBrno (RobotikaBrno)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*******************************************************************************/
#include "Color.h"
#include <algorithm>
#include <cmath>
#include <cassert>
#include <cmath>
namespace {
// Int -> fixed point
int up( int x ) { return x * 255; }
int up(int x) { return x * 255; }
} // namespace
int iRgbSqrt( int num ) {
int iRgbSqrt(int num) {
// https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Binary_numeral_system_.28base_2.29
assert( "sqrt input should be non-negative" && num >= 0 );
assert( "sqrt input should no exceed 16 bits" && num <= 0xFFFF );
assert("sqrt input should be non-negative" && num >= 0);
assert("sqrt input should no exceed 16 bits" && num <= 0xFFFF);
int res = 0;
int bit = 1 << 16;
while ( bit > num )
while (bit > num)
bit >>= 2;
while ( bit != 0 ) {
if ( num >= res + bit ) {
while (bit != 0) {
if (num >= res + bit) {
num -= res + bit;
res = ( res >> 1 ) + bit;
res = (res >> 1) + bit;
} else
res >>= 1;
bit >>= 2;
@@ -29,104 +55,133 @@ int iRgbSqrt( int num ) {
return res;
}
Rgb::Rgb( Hsv y ) {
Rgb::Rgb(const Hsv& y) {
// https://stackoverflow.com/questions/24152553/hsv-to-rgb-and-back-without-floating-point-math-in-python
// greyscale
if( y.s == 0 ) {
if (y.s == 0) {
r = g = b = y.v;
return;
}
const int region = y.h / 43;
const int remainder = ( y.h - ( region * 43 ) ) * 6;
const int remainder = (y.h - (region * 43)) * 6;
const int p = ( y.v * ( 255 - y.s ) ) >> 8;
const int q = ( y.v * ( 255 - ( ( y.s * remainder ) >> 8 ) ) ) >> 8;
const int t = ( y.v * ( 255 - ( ( y.s * (255 -remainder ) ) >> 8 ) ) ) >> 8;
const int p = (y.v * (255 - y.s)) >> 8;
const int q = (y.v * (255 - ((y.s * remainder) >> 8))) >> 8;
const int t = (y.v * (255 - ((y.s * (255 - remainder)) >> 8))) >> 8;
switch( region ) {
case 0: r = y.v; g = t; b = p; break;
case 1: r = q; g = y.v; b = p; break;
case 2: r = p; g = y.v; b = t; break;
case 3: r = p; g = q; b = y.v; break;
case 4: r = t; g = p; b = y.v; break;
case 5: r = y.v; g = p; b = q; break;
default: __builtin_trap();
switch (region) {
case 0:
r = y.v;
g = t;
b = p;
break;
case 1:
r = q;
g = y.v;
b = p;
break;
case 2:
r = p;
g = y.v;
b = t;
break;
case 3:
r = p;
g = q;
b = y.v;
break;
case 4:
r = t;
g = p;
b = y.v;
break;
case 5:
r = y.v;
g = p;
b = q;
break;
default:
__builtin_trap();
}
a = y.a;
}
Rgb& Rgb::operator=( Hsv hsv ) {
Rgb r{ hsv };
swap( r );
Rgb& Rgb::operator=(const Hsv& hsv) {
Rgb r { hsv };
swap(r);
return *this;
}
Rgb Rgb::operator+( Rgb in ) const {
Rgb Rgb::operator+(const Rgb& in) const {
auto copy = *this;
copy += in;
return copy;
}
Rgb& Rgb::operator+=( Rgb in ) {
Rgb& Rgb::operator+=(const Rgb& in) {
unsigned int red = r + in.r;
r = ( red < 255 ) ? red : 255;
r = (red < 255) ? red : 255;
unsigned int green = g + in.g;
g = ( green < 255 ) ? green : 255;
g = (green < 255) ? green : 255;
unsigned int blue = b + in.b;
b = ( blue < 255 ) ? blue : 255;
b = (blue < 255) ? blue : 255;
return *this;
}
Rgb& Rgb::blend( Rgb in ) {
unsigned int inAlpha = in.a * ( 255 - a );
Rgb Rgb::operator-(const Rgb& in) const {
auto copy = *this;
copy -= in;
return copy;
}
Rgb& Rgb::operator-=(const Rgb& in) {
r = (in.r > r) ? 0 : r - in.r;
g = (in.g > g) ? 0 : g - in.g;
b = (in.b > b) ? 0 : b - in.b;
return *this;
}
Rgb& Rgb::blend(const Rgb& in) {
unsigned int inAlpha = in.a * (255 - a);
unsigned int alpha = a + inAlpha;
r = iRgbSqrt( ( ( r * r * a ) + ( in.r * in.r * inAlpha ) ) / alpha );
g = iRgbSqrt( ( ( g * g * a ) + ( in.g * in.g * inAlpha ) ) / alpha );
b = iRgbSqrt( ( ( b * b * a ) + ( in.b * in.b * inAlpha ) ) / alpha );
r = iRgbSqrt(((r * r * a) + (in.r * in.r * inAlpha)) / alpha);
g = iRgbSqrt(((g * g * a) + (in.g * in.g * inAlpha)) / alpha);
b = iRgbSqrt(((b * b * a) + (in.b * in.b * inAlpha)) / alpha);
a = alpha;
return *this;
}
uint8_t IRAM_ATTR Rgb::getGrb( int idx ) {
switch ( idx ) {
case 0: return g;
case 1: return r;
case 2: return b;
}
__builtin_unreachable();
}
Hsv::Hsv( Rgb r ) {
int min = std::min( r.r, std::min( r.g, r.b ) );
int max = std::max( r.r, std::max( r.g, r.b ) );
Hsv::Hsv(const Rgb& r) {
int min = std::min(r.r, std::min(r.g, r.b));
int max = std::max(r.r, std::max(r.g, r.b));
int chroma = max - min;
v = max;
if ( chroma == 0 ) {
if (chroma == 0) {
h = s = 0;
return;
}
s = up( chroma ) / max;
s = up(chroma) / max;
int hh;
if ( max == r.r )
hh = ( up( int( r.g ) - int( r.b ) ) ) / chroma / 6;
else if ( max == r.g )
hh = 255 / 3 + ( up( int( r.b ) - int( r.r ) ) ) / chroma / 6;
if (max == r.r)
hh = (up(int(r.g) - int(r.b))) / chroma / 6;
else if (max == r.g)
hh = 255 / 3 + (up(int(r.b) - int(r.r))) / chroma / 6;
else
hh = 2 * 255 / 3 + ( up( int( r.r ) - int( r.g ) ) ) / chroma / 6;
hh = 2 * 255 / 3 + (up(int(r.r) - int(r.g))) / chroma / 6;
if ( hh < 0 )
if (hh < 0)
hh += 255;
h = hh;
a = r.a;
}
Hsv& Hsv::operator=( Rgb rgb ) {
Hsv h{ rgb };
swap( h );
Hsv& Hsv::operator=(const Rgb& rgb) {
Hsv h { rgb };
swap(h);
return *this;
}

View File

@@ -1,51 +1,90 @@
/********************************************************************************
* https://github.com/RoboticsBrno/SmartLeds
*
* MIT License
*
* Copyright (c) 2017 RoboticsBrno (RobotikaBrno)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*******************************************************************************/
#pragma once
#ifndef COLOR_H
#define COLOR_H
#include <cstdint>
#include "esp_attr.h"
#include <cstdint>
union Hsv;
union Rgb {
struct __attribute__ ((packed)) {
uint8_t r, g, b, a;
struct __attribute__((packed)) {
uint8_t g, r, b, a;
};
uint32_t value;
Rgb( uint8_t r = 0, uint8_t g = 0, uint8_t b = 0, uint8_t a = 255 ) : r( r ), g( g ), b( b ), a( a ) {}
Rgb( Hsv c );
Rgb& operator=( Rgb rgb ) { swap( rgb ); return *this; }
Rgb& operator=( Hsv hsv );
Rgb operator+( Rgb in ) const;
Rgb& operator+=( Rgb in );
bool operator==( Rgb in ) const { return in.value == value; }
Rgb& blend( Rgb in );
void swap( Rgb& o ) { value = o.value; }
Rgb(uint8_t r = 0, uint8_t g = 0, uint8_t b = 0, uint8_t a = 255)
: g(g)
, r(r)
, b(b)
, a(a) {}
Rgb(const Hsv& c);
Rgb(const Rgb&) = default;
Rgb& operator=(const Rgb& rgb) {
swap(rgb);
return *this;
}
Rgb& operator=(const Hsv& hsv);
Rgb operator+(const Rgb& in) const;
Rgb& operator+=(const Rgb& in);
Rgb operator-(const Rgb& in) const;
Rgb& operator-=(const Rgb& in);
bool operator==(const Rgb& in) const { return in.value == value; }
Rgb& blend(const Rgb& in);
void swap(const Rgb& o) { value = o.value; }
void linearize() {
r = channelGamma(r);
g = channelGamma(g);
b = channelGamma(b);
}
uint8_t IRAM_ATTR getGrb( int idx );
void stretchChannels( uint8_t maxR, uint8_t maxG, uint8_t maxB ) {
r = stretch( r, maxR );
g = stretch( g, maxG );
b = stretch( b, maxB );
inline uint8_t IRAM_ATTR getGrb(int idx) {
switch (idx) {
case 0:
return g;
case 1:
return r;
case 2:
return b;
}
__builtin_unreachable();
}
void stretchChannelsEvenly( uint8_t max ) {
stretchChannels( max, max, max );
void stretchChannels(uint8_t maxR, uint8_t maxG, uint8_t maxB) {
r = stretch(r, maxR);
g = stretch(g, maxG);
b = stretch(b, maxB);
}
void stretchChannelsEvenly(uint8_t max) { stretchChannels(max, max, max); }
private:
uint8_t stretch( int value, uint8_t max ) {
return ( value * max ) >> 8;
}
uint8_t stretch(int value, uint8_t max) { return (value * max) >> 8; }
uint8_t channelGamma( int channel ) {
uint8_t channelGamma(int channel) {
/* The optimal gamma correction is x^2.8. However, this is expensive to
* compute. Therefore, we use x^3 for gamma correction. Also, we add a
* bias as the WS2812 LEDs do not turn on for values less than 4. */
@@ -53,22 +92,27 @@ private:
return channel;
channel = channel * channel * channel * 251;
channel >>= 24;
return static_cast< uint8_t >( 4 + channel );
return static_cast<uint8_t>(4 + channel);
}
};
union Hsv {
struct __attribute__ ((packed)) {
struct __attribute__((packed)) {
uint8_t h, s, v, a;
};
uint32_t value;
Hsv( uint8_t h, uint8_t s = 0, uint8_t v = 0, uint8_t a = 255 ) : h( h ), s( s ), v( v ), a( a ) {}
Hsv( Rgb r );
Hsv& operator=( Hsv h ) { swap( h ); return *this; }
Hsv& operator=( Rgb rgb );
bool operator==( Hsv in ) const { return in.value == value; }
void swap( Hsv& o ) { value = o.value; }
Hsv(uint8_t h, uint8_t s = 0, uint8_t v = 0, uint8_t a = 255)
: h(h)
, s(s)
, v(v)
, a(a) {}
Hsv(const Rgb& r);
Hsv& operator=(const Hsv& h) {
swap(h);
return *this;
}
Hsv& operator=(const Rgb& rgb);
bool operator==(const Hsv& in) const { return in.value == value; }
void swap(const Hsv& o) { value = o.value; }
};
#endif //COLOR_H

View File

@@ -0,0 +1,60 @@
/********************************************************************************
* https://github.com/RoboticsBrno/SmartLeds
*
* MIT License
*
* Copyright (c) 2017 RoboticsBrno (RobotikaBrno)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*******************************************************************************/
#pragma once
#include <esp_system.h>
#include <stdint.h>
#if defined(ESP_IDF_VERSION)
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)
#define SMARTLEDS_NEW_RMT_DRIVER 1
#else
#define SMARTLEDS_NEW_RMT_DRIVER 0
#endif
#else
#define SMARTLEDS_NEW_RMT_DRIVER 0
#endif
namespace detail {
struct TimingParams {
uint32_t T0H;
uint32_t T1H;
uint32_t T0L;
uint32_t T1L;
uint32_t TRS;
};
using LedType = TimingParams;
} // namespace detail
#if SMARTLEDS_NEW_RMT_DRIVER
#include "RmtDriver5.h"
#else
#include "RmtDriver4.h"
#endif

View File

@@ -0,0 +1,143 @@
/********************************************************************************
* https://github.com/RoboticsBrno/SmartLeds
*
* MIT License
*
* Copyright (c) 2017 RoboticsBrno (RobotikaBrno)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*******************************************************************************/
#include "RmtDriver4.h"
#if !SMARTLEDS_NEW_RMT_DRIVER
#include "SmartLeds.h"
namespace detail {
// 8 still seems to work, but timings become marginal
static const int DIVIDER = 4;
// minimum time of a single RMT duration based on clock ns
static const double RMT_DURATION_NS = 12.5;
RmtDriver::RmtDriver(const LedType& timing, int count, int pin, int channel_num, SemaphoreHandle_t finishedFlag)
: _timing(timing)
, _count(count)
, _pin((gpio_num_t)pin)
, _finishedFlag(finishedFlag)
, _channel((rmt_channel_t)channel_num) {
_bitToRmt[0].level0 = 1;
_bitToRmt[0].level1 = 0;
_bitToRmt[0].duration0 = _timing.T0H / (RMT_DURATION_NS * DIVIDER);
_bitToRmt[0].duration1 = _timing.T0L / (RMT_DURATION_NS * DIVIDER);
_bitToRmt[1].level0 = 1;
_bitToRmt[1].level1 = 0;
_bitToRmt[1].duration0 = _timing.T1H / (RMT_DURATION_NS * DIVIDER);
_bitToRmt[1].duration1 = _timing.T1L / (RMT_DURATION_NS * DIVIDER);
}
esp_err_t RmtDriver::init() {
rmt_config_t config = RMT_DEFAULT_CONFIG_TX(_pin, _channel);
config.rmt_mode = RMT_MODE_TX;
config.clk_div = DIVIDER;
config.mem_block_num = 1;
return rmt_config(&config);
}
esp_err_t RmtDriver::registerIsr(bool isFirstRegisteredChannel) {
auto err = rmt_driver_install(_channel, 0,
#if defined(CONFIG_RMT_ISR_IRAM_SAFE)
ESP_INTR_FLAG_IRAM
#else
0
#endif
);
if (err != ESP_OK) {
return err;
}
if (isFirstRegisteredChannel) {
rmt_register_tx_end_callback(txEndCallback, NULL);
}
err = rmt_translator_init(_channel, translateSample);
if (err != ESP_OK) {
return err;
}
return rmt_translator_set_context(_channel, this);
}
esp_err_t RmtDriver::unregisterIsr() { return rmt_driver_uninstall(_channel); }
void IRAM_ATTR RmtDriver::txEndCallback(rmt_channel_t channel, void* arg) {
xSemaphoreGiveFromISR(SmartLed::ledForChannel(channel)->_finishedFlag, nullptr);
}
void IRAM_ATTR RmtDriver::translateSample(const void* src, rmt_item32_t* dest, size_t src_size,
size_t wanted_rmt_items_num, size_t* out_consumed_src_bytes, size_t* out_used_rmt_items) {
RmtDriver* self;
ESP_ERROR_CHECK(rmt_translator_get_context(out_used_rmt_items, (void**)&self));
const auto& _bitToRmt = self->_bitToRmt;
const auto src_offset = self->_translatorSourceOffset;
auto* src_components = (const uint8_t*)src;
size_t consumed_src_bytes = 0;
size_t used_rmt_items = 0;
while (consumed_src_bytes < src_size && used_rmt_items + 7 < wanted_rmt_items_num) {
uint8_t val = *src_components;
// each bit, from highest to lowest
for (uint8_t j = 0; j != 8; j++, val <<= 1) {
dest->val = _bitToRmt[val >> 7].val;
++dest;
}
used_rmt_items += 8;
++src_components;
++consumed_src_bytes;
// skip alpha byte
if (((src_offset + consumed_src_bytes) % 4) == 3) {
++src_components;
++consumed_src_bytes;
// TRST delay after last pixel in strip
if (consumed_src_bytes == src_size) {
(dest - 1)->duration1 = self->_timing.TRS / (detail::RMT_DURATION_NS * detail::DIVIDER);
}
}
}
self->_translatorSourceOffset = src_offset + consumed_src_bytes;
*out_consumed_src_bytes = consumed_src_bytes;
*out_used_rmt_items = used_rmt_items;
}
esp_err_t RmtDriver::transmit(const Rgb* buffer) {
static_assert(sizeof(Rgb) == 4); // The translator code above assumes RGB is 4 bytes
_translatorSourceOffset = 0;
return rmt_write_sample(_channel, (const uint8_t*)buffer, _count * 4, false);
}
};
#endif // !SMARTLEDS_NEW_RMT_DRIVER

View File

@@ -0,0 +1,68 @@
/********************************************************************************
* https://github.com/RoboticsBrno/SmartLeds
*
* MIT License
*
* Copyright (c) 2017 RoboticsBrno (RobotikaBrno)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*******************************************************************************/
#pragma once
#include "RmtDriver.h"
#if !SMARTLEDS_NEW_RMT_DRIVER
#include "Color.h"
#include <driver/rmt.h>
#include <freertos/FreeRTOS.h>
#include <freertos/semphr.h>
namespace detail {
constexpr const int CHANNEL_COUNT = RMT_CHANNEL_MAX;
class RmtDriver {
public:
RmtDriver(const LedType& timing, int count, int pin, int channel_num, SemaphoreHandle_t finishedFlag);
RmtDriver(const RmtDriver&) = delete;
esp_err_t init();
esp_err_t registerIsr(bool isFirstRegisteredChannel);
esp_err_t unregisterIsr();
esp_err_t transmit(const Rgb* buffer);
private:
static void IRAM_ATTR txEndCallback(rmt_channel_t channel, void* arg);
static void IRAM_ATTR translateSample(const void* src, rmt_item32_t* dest, size_t src_size,
size_t wanted_rmt_items_num, size_t* out_consumed_src_bytes, size_t* out_used_rmt_items);
const LedType& _timing;
int _count;
gpio_num_t _pin;
SemaphoreHandle_t _finishedFlag;
rmt_channel_t _channel;
rmt_item32_t _bitToRmt[2];
size_t _translatorSourceOffset;
};
};
#endif // !SMARTLEDS_NEW_RMT_DRIVER

View File

@@ -0,0 +1,202 @@
/********************************************************************************
* https://github.com/RoboticsBrno/SmartLeds
*
* MIT License
*
* Copyright (c) 2017 RoboticsBrno (RobotikaBrno)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*******************************************************************************/
#include "RmtDriver5.h"
#if SMARTLEDS_NEW_RMT_DRIVER
#include <cstddef>
#include "SmartLeds.h"
namespace detail {
static constexpr const uint32_t RMT_RESOLUTION_HZ = 20 * 1000 * 1000; // 20 MHz
static constexpr const uint32_t RMT_NS_PER_TICK = 1000000000LLU / RMT_RESOLUTION_HZ;
static RmtEncoderWrapper* IRAM_ATTR encSelf(rmt_encoder_t* encoder) {
return (RmtEncoderWrapper*)(((intptr_t)encoder) - offsetof(RmtEncoderWrapper, base));
}
static size_t IRAM_ATTR encEncode(rmt_encoder_t* encoder, rmt_channel_handle_t tx_channel, const void* primary_data,
size_t data_size, rmt_encode_state_t* ret_state) {
auto* self = encSelf(encoder);
// Delay after last pixel
if ((self->last_state & RMT_ENCODING_COMPLETE) && self->frame_idx == data_size) {
*ret_state = (rmt_encode_state_t)0;
return self->copy_encoder->encode(
self->copy_encoder, tx_channel, (const void*)&self->reset_code, sizeof(self->reset_code), ret_state);
}
if (self->last_state & RMT_ENCODING_COMPLETE) {
Rgb* pixel = ((Rgb*)primary_data) + self->frame_idx;
self->buffer_len = sizeof(self->buffer);
for (size_t i = 0; i < sizeof(self->buffer); ++i) {
self->buffer[i] = pixel->getGrb(self->component_idx);
if (++self->component_idx == 3) {
self->component_idx = 0;
if (++self->frame_idx == data_size) {
self->buffer_len = i + 1;
break;
}
++pixel;
}
}
}
self->last_state = (rmt_encode_state_t)0;
auto encoded_symbols = self->bytes_encoder->encode(
self->bytes_encoder, tx_channel, (const void*)&self->buffer, self->buffer_len, &self->last_state);
if (self->last_state & RMT_ENCODING_MEM_FULL) {
*ret_state = RMT_ENCODING_MEM_FULL;
} else {
*ret_state = (rmt_encode_state_t)0;
}
return encoded_symbols;
}
static esp_err_t encReset(rmt_encoder_t* encoder) {
auto* self = encSelf(encoder);
rmt_encoder_reset(self->bytes_encoder);
rmt_encoder_reset(self->copy_encoder);
self->last_state = RMT_ENCODING_COMPLETE;
self->frame_idx = 0;
self->component_idx = 0;
return ESP_OK;
}
static esp_err_t encDelete(rmt_encoder_t* encoder) {
auto* self = encSelf(encoder);
rmt_del_encoder(self->bytes_encoder);
rmt_del_encoder(self->copy_encoder);
return ESP_OK;
}
RmtDriver::RmtDriver(const LedType& timing, int count, int pin, int channel_num, SemaphoreHandle_t finishedFlag)
: _timing(timing)
, _count(count)
, _pin(pin)
, _finishedFlag(finishedFlag)
, _channel(nullptr)
, _encoder {} {}
esp_err_t RmtDriver::init() {
_encoder.base.encode = encEncode;
_encoder.base.reset = encReset;
_encoder.base.del = encDelete;
_encoder.reset_code.duration0 = _timing.TRS / RMT_NS_PER_TICK;
rmt_bytes_encoder_config_t bytes_cfg = {
.bit0 = {
.duration0 = uint16_t(_timing.T0H / RMT_NS_PER_TICK),
.level0 = 1,
.duration1 = uint16_t(_timing.T0L / RMT_NS_PER_TICK),
.level1 = 0,
},
.bit1 = {
.duration0 = uint16_t(_timing.T1H / RMT_NS_PER_TICK),
.level0 = 1,
.duration1 = uint16_t(_timing.T1L / RMT_NS_PER_TICK),
.level1 = 0,
},
.flags = {
.msb_first = 1,
},
};
auto err = rmt_new_bytes_encoder(&bytes_cfg, &_encoder.bytes_encoder);
if (err != ESP_OK) {
return err;
}
rmt_copy_encoder_config_t copy_cfg = {};
err = rmt_new_copy_encoder(&copy_cfg, &_encoder.copy_encoder);
if (err != ESP_OK) {
return err;
}
// The config must be in registerIsr, because rmt_new_tx_channel
// registers the ISR
return ESP_OK;
}
esp_err_t RmtDriver::registerIsr(bool isFirstRegisteredChannel) {
rmt_tx_channel_config_t conf = {
.gpio_num = (gpio_num_t)_pin,
.clk_src = RMT_CLK_SRC_DEFAULT, //.clk_src = RMT_CLK_SRC_APB,
.resolution_hz = RMT_RESOLUTION_HZ,
.mem_block_symbols = SOC_RMT_MEM_WORDS_PER_CHANNEL,
.trans_queue_depth = 1,
.flags = {},
};
auto err = rmt_new_tx_channel(&conf, &_channel);
if (err != ESP_OK) {
return err;
}
rmt_tx_event_callbacks_t callbacks_cfg = {};
callbacks_cfg.on_trans_done = txDoneCallback;
err = rmt_tx_register_event_callbacks(_channel, &callbacks_cfg, this);
if (err != ESP_OK) {
return err;
}
return rmt_enable(_channel);
}
esp_err_t RmtDriver::unregisterIsr() {
auto err = rmt_del_encoder(&_encoder.base);
if (err != ESP_OK) {
return err;
}
err = rmt_disable(_channel);
if (err != ESP_OK) {
return err;
}
return rmt_del_channel(_channel);
}
bool IRAM_ATTR RmtDriver::txDoneCallback(
rmt_channel_handle_t tx_chan, const rmt_tx_done_event_data_t* edata, void* user_ctx) {
auto* self = (RmtDriver*)user_ctx;
auto taskWoken = pdTRUE;
xSemaphoreGiveFromISR(self->_finishedFlag, &taskWoken);
return taskWoken == pdTRUE;
}
esp_err_t RmtDriver::transmit(const Rgb* buffer) {
rmt_encoder_reset(&_encoder.base);
rmt_transmit_config_t cfg = {};
return rmt_transmit(_channel, &_encoder.base, buffer, _count, &cfg);
}
};
#endif // !SMARTLEDS_NEW_RMT_DRIVER

View File

@@ -0,0 +1,91 @@
/********************************************************************************
* https://github.com/RoboticsBrno/SmartLeds
*
* MIT License
*
* Copyright (c) 2017 RoboticsBrno (RobotikaBrno)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*******************************************************************************/
#pragma once
#include "RmtDriver.h"
#if SMARTLEDS_NEW_RMT_DRIVER
#include <driver/rmt_tx.h>
#include <freertos/FreeRTOS.h>
#include <freertos/semphr.h>
#include <type_traits>
#include "Color.h"
#if !defined(CONFIG_RMT_ISR_IRAM_SAFE) && !defined(SMARTLEDS_DISABLE_IRAM_WARNING)
#warning "Please enable CONFIG_RMT_ISR_IRAM_SAFE IDF option." \
"without it, the IDF driver is not able to supply data fast enough."
#endif
namespace detail {
constexpr const int CHANNEL_COUNT = SOC_RMT_GROUPS * SOC_RMT_CHANNELS_PER_GROUP;
class RmtDriver;
// This is ridiculous
struct RmtEncoderWrapper {
struct rmt_encoder_t base;
struct rmt_encoder_t* bytes_encoder;
struct rmt_encoder_t* copy_encoder;
RmtDriver* driver;
rmt_symbol_word_t reset_code;
uint8_t buffer[SOC_RMT_MEM_WORDS_PER_CHANNEL / 8];
rmt_encode_state_t last_state;
size_t frame_idx;
uint8_t component_idx;
uint8_t buffer_len;
};
static_assert(std::is_standard_layout<RmtEncoderWrapper>::value == true);
class RmtDriver {
public:
RmtDriver(const LedType& timing, int count, int pin, int channel_num, SemaphoreHandle_t finishedFlag);
RmtDriver(const RmtDriver&) = delete;
esp_err_t init();
esp_err_t registerIsr(bool isFirstRegisteredChannel);
esp_err_t unregisterIsr();
esp_err_t transmit(const Rgb* buffer);
private:
static bool IRAM_ATTR txDoneCallback(
rmt_channel_handle_t tx_chan, const rmt_tx_done_event_data_t* edata, void* user_ctx);
const LedType& _timing;
int _count;
int _pin;
SemaphoreHandle_t _finishedFlag;
rmt_channel_handle_t _channel;
RmtEncoderWrapper _encoder;
};
};
#endif // !SMARTLEDS_NEW_RMT_DRIVER

View File

@@ -1,63 +1,35 @@
/********************************************************************************
* https://github.com/RoboticsBrno/SmartLeds
*
* MIT License
*
* Copyright (c) 2017 RoboticsBrno (RobotikaBrno)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*******************************************************************************/
#include "SmartLeds.h"
IsrCore SmartLed::_interruptCore = CoreCurrent;
intr_handle_t SmartLed::_interruptHandle = NULL;
SmartLed*& IRAM_ATTR SmartLed::ledForChannel( int channel ) {
static SmartLed* table[8] = { nullptr };
assert( channel < 8 );
return table[ channel ];
}
void IRAM_ATTR SmartLed::interruptHandler(void*) {
for (int channel = 0; channel != 8; channel++) {
auto self = ledForChannel( channel );
if ( RMT.int_st.val & (1 << (24 + channel ) ) ) { // tx_thr_event
if ( self )
self->copyRmtHalfBlock();
RMT.int_clr.val |= 1 << ( 24 + channel );
} else if ( RMT.int_st.val & ( 1 << (3 * channel ) ) ) { // tx_end
if ( self )
xSemaphoreGiveFromISR( self->_finishedFlag, nullptr );
RMT.int_clr.val |= 1 << ( 3 * channel );
}
}
}
void IRAM_ATTR SmartLed::copyRmtHalfBlock() {
int offset = detail::MAX_PULSES * _halfIdx;
_halfIdx = !_halfIdx;
int len = 3 - _componentPosition + 3 * ( _count - 1 );
len = std::min( len, detail::MAX_PULSES / 8 );
if ( !len ) {
for ( int i = 0; i < detail::MAX_PULSES; i++) {
RMTMEM.chan[ _channel].data32[i + offset ].val = 0;
}
}
int i;
for ( i = 0; i != len && _pixelPosition != _count; i++ ) {
uint8_t val = _buffer[ _pixelPosition ].getGrb( _componentPosition );
for ( int j = 0; j != 8; j++, val <<= 1 ) {
int bit = val >> 7;
int idx = i * 8 + offset + j;
RMTMEM.chan[ _channel ].data32[ idx ].val = _bitToRmt[ bit & 0x01 ].value;
}
if ( _pixelPosition == _count - 1 && _componentPosition == 2 ) {
RMTMEM.chan[ _channel ].data32[ i * 8 + offset + 7 ].duration1 =
_timing.TRS / ( detail::RMT_DURATION_NS * detail::DIVIDER );
}
_componentPosition++;
if ( _componentPosition == 3 ) {
_componentPosition = 0;
_pixelPosition++;
}
}
for ( i *= 8; i != detail::MAX_PULSES; i++ ) {
RMTMEM.chan[ _channel ].data32[ i + offset ].val = 0;
}
SmartLed*& IRAM_ATTR SmartLed::ledForChannel(int channel) {
static SmartLed* table[detail::CHANNEL_COUNT] = {};
assert(channel < detail::CHANNEL_COUNT);
return table[channel];
}

View File

@@ -1,7 +1,30 @@
#pragma once
/********************************************************************************
* https://github.com/RoboticsBrno/SmartLeds
*
* MIT License
*
* Copyright (c) 2017 RoboticsBrno (RobotikaBrno)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*******************************************************************************/
#ifndef SMARTLEDS_H
#define SMARTLEDS_H
#pragma once
/*
* A C++ driver for the WS2812 LEDs using the RMT peripheral on the ESP32.
@@ -31,270 +54,196 @@
* THE SOFTWARE.
*/
#include <memory>
#include <cassert>
#include <cstring>
#include <memory>
#if defined ( ARDUINO )
extern "C" { // ...someone forgot to put in the includes...
#include "esp32-hal.h"
#include "esp_intr_alloc.h"
#include "esp_ipc.h"
#include "driver/gpio.h"
#include "driver/periph_ctrl.h"
#include "freertos/semphr.h"
#include "soc/rmt_struct.h"
#include <driver/spi_master.h>
#include "esp_idf_version.h"
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL( 4, 0, 0 )
#include "soc/dport_reg.h"
#endif
}
#elif defined ( ESP_PLATFORM )
extern "C" { // ...someone forgot to put in the includes...
#include <esp_intr_alloc.h>
#include <esp_ipc.h>
#include <driver/gpio.h>
#include <freertos/FreeRTOS.h>
#include <freertos/semphr.h>
#include <soc/dport_reg.h>
#include <soc/gpio_sig_map.h>
#include <soc/rmt_struct.h>
#include <driver/spi_master.h>
}
#include <stdio.h>
#endif
#include <driver/gpio.h>
#include <driver/spi_master.h>
#include <esp_intr_alloc.h>
#include <esp_ipc.h>
#include <freertos/FreeRTOS.h>
#include <freertos/semphr.h>
#include "Color.h"
namespace detail {
struct TimingParams {
uint32_t T0H;
uint32_t T1H;
uint32_t T0L;
uint32_t T1L;
uint32_t TRS;
};
union RmtPulsePair {
struct {
int duration0:15;
int level0:1;
int duration1:15;
int level1:1;
};
uint32_t value;
};
static const int DIVIDER = 4; // 8 still seems to work, but timings become marginal
static const int MAX_PULSES = 32; // A channel has a 64 "pulse" buffer - we use half per pass
static const double RMT_DURATION_NS = 12.5; // minimum time of a single RMT duration based on clock ns
} // namespace detail
#include "RmtDriver.h"
using LedType = detail::TimingParams;
static const LedType LED_WS2812 = { 350, 700, 800, 600, 50000 };
static const LedType LED_WS2812B = { 400, 850, 850, 400, 50100 };
static const LedType LED_SK6812 = { 300, 600, 900, 600, 80000 };
static const LedType LED_WS2813 = { 350, 800, 350, 350, 300000 };
// Times are in nanoseconds,
// The RMT driver runs at 20MHz, so minimal representable time is 50 nanoseconds
static const LedType LED_WS2812 = { 350, 700, 800, 600, 50000 };
// longer reset time because https://blog.adafruit.com/2017/05/03/psa-the-ws2812b-rgb-led-has-been-revised-will-require-code-tweak/
static const LedType LED_WS2812B = { 400, 800, 850, 450, 300000 }; // universal
static const LedType LED_WS2812B_NEWVARIANT = { 200, 750, 750, 200, 300000 };
static const LedType LED_WS2812B_OLDVARIANT = { 400, 800, 850, 450, 50000 };
// This is timing from datasheet, but does not seem to actually work - try LED_WS2812B
static const LedType LED_WS2812C = { 250, 550, 550, 250, 280000 };
static const LedType LED_SK6812 = { 300, 600, 900, 600, 80000 };
static const LedType LED_WS2813 = { 350, 800, 350, 350, 300000 };
// Single buffer == can't touch the Rgbs between show() and wait()
enum BufferType { SingleBuffer = 0, DoubleBuffer };
enum IsrCore { CoreFirst = 0, CoreSecond = 1, CoreCurrent = 2};
enum IsrCore { CoreFirst = 0, CoreSecond = 1, CoreCurrent = 2 };
class SmartLed {
public:
friend class detail::RmtDriver;
// The RMT interrupt must not run on the same core as WiFi interrupts, otherwise SmartLeds
// can't fill the RMT buffer fast enough, resulting in rendering artifacts.
// Usually, that means you have to set isrCore == CoreSecond.
//
// If you use anything other than CoreCurrent, the FreeRTOS scheduler MUST be already running,
// so you can't use it if you define SmartLed as global variable.
SmartLed( const LedType& type, int count, int pin, int channel = 0, BufferType doubleBuffer = SingleBuffer, IsrCore isrCore = CoreCurrent)
: _timing( type ),
_channel( channel ),
_count( count ),
_firstBuffer( new Rgb[ count ] ),
_secondBuffer( doubleBuffer ? new Rgb[ count ] : nullptr ),
_finishedFlag( xSemaphoreCreateBinary() )
{
assert( channel >= 0 && channel < 8 );
assert( ledForChannel( channel ) == nullptr );
//
// Does nothing on chips that only have one core.
SmartLed(const LedType& type, int count, int pin, int channel = 0, BufferType doubleBuffer = DoubleBuffer,
IsrCore isrCore = CoreCurrent)
: _finishedFlag(xSemaphoreCreateBinary())
, _driver(type, count, pin, channel, _finishedFlag)
, _channel(channel)
, _count(count)
, _firstBuffer(new Rgb[count])
, _secondBuffer(doubleBuffer ? new Rgb[count] : nullptr) {
assert(channel >= 0 && channel < detail::CHANNEL_COUNT);
assert(ledForChannel(channel) == nullptr);
xSemaphoreGive( _finishedFlag );
xSemaphoreGive(_finishedFlag);
DPORT_SET_PERI_REG_MASK( DPORT_PERIP_CLK_EN_REG, DPORT_RMT_CLK_EN );
DPORT_CLEAR_PERI_REG_MASK( DPORT_PERIP_RST_EN_REG, DPORT_RMT_RST );
_driver.init();
PIN_FUNC_SELECT( GPIO_PIN_MUX_REG[ pin ], 2 );
gpio_set_direction( static_cast< gpio_num_t >( pin ), GPIO_MODE_OUTPUT );
gpio_matrix_out( static_cast< gpio_num_t >( pin ), RMT_SIG_OUT0_IDX + _channel, 0, 0 );
initChannel( _channel );
RMT.tx_lim_ch[ _channel ].limit = detail::MAX_PULSES;
RMT.int_ena.val |= 1 << ( 24 + _channel );
RMT.int_ena.val |= 1 << ( 3 * _channel );
_bitToRmt[ 0 ].level0 = 1;
_bitToRmt[ 0 ].level1 = 0;
_bitToRmt[ 0 ].duration0 = _timing.T0H / ( detail::RMT_DURATION_NS * detail::DIVIDER );
_bitToRmt[ 0 ].duration1 = _timing.T0L / ( detail::RMT_DURATION_NS * detail::DIVIDER );
_bitToRmt[ 1 ].level0 = 1;
_bitToRmt[ 1 ].level1 = 0;
_bitToRmt[ 1 ].duration0 = _timing.T1H / ( detail::RMT_DURATION_NS * detail::DIVIDER );
_bitToRmt[ 1 ].duration1 = _timing.T1L / ( detail::RMT_DURATION_NS * detail::DIVIDER );
if ( !anyAlive() ) {
#if !defined(SOC_CPU_CORES_NUM) || SOC_CPU_CORES_NUM > 1
if (!anyAlive() && isrCore != CoreCurrent) {
_interruptCore = isrCore;
if(isrCore != CoreCurrent) {
ESP_ERROR_CHECK(esp_ipc_call_blocking(isrCore, registerInterrupt, NULL));
} else {
registerInterrupt(NULL);
}
ESP_ERROR_CHECK(esp_ipc_call_blocking(isrCore, registerInterrupt, (void*)this));
} else
#endif
{
registerInterrupt((void*)this);
}
ledForChannel( channel ) = this;
ledForChannel(channel) = this;
}
~SmartLed() {
ledForChannel( _channel ) = nullptr;
if ( !anyAlive() ) {
if(_interruptCore != CoreCurrent) {
ESP_ERROR_CHECK(esp_ipc_call_blocking(_interruptCore, unregisterInterrupt, NULL));
} else {
unregisterInterrupt(NULL);
}
ledForChannel(_channel) = nullptr;
#if !defined(SOC_CPU_CORES_NUM) || SOC_CPU_CORES_NUM > 1
if (!anyAlive() && _interruptCore != CoreCurrent) {
ESP_ERROR_CHECK(esp_ipc_call_blocking(_interruptCore, unregisterInterrupt, (void*)this));
} else
#endif
{
unregisterInterrupt((void*)this);
}
vSemaphoreDelete( _finishedFlag );
vSemaphoreDelete(_finishedFlag);
}
Rgb& operator[]( int idx ) {
return _firstBuffer[ idx ];
}
Rgb& operator[](int idx) { return _firstBuffer[idx]; }
const Rgb& operator[]( int idx ) const {
return _firstBuffer[ idx ];
}
const Rgb& operator[](int idx) const { return _firstBuffer[idx]; }
void show() {
_buffer = _firstBuffer.get();
startTransmission();
esp_err_t show() {
esp_err_t err = startTransmission();
swapBuffers();
return err;
}
bool wait( TickType_t timeout = portMAX_DELAY ) {
if( xSemaphoreTake( _finishedFlag, timeout ) == pdTRUE ) {
xSemaphoreGive( _finishedFlag );
bool wait(TickType_t timeout = portMAX_DELAY) {
if (xSemaphoreTake(_finishedFlag, timeout) == pdTRUE) {
xSemaphoreGive(_finishedFlag);
return true;
}
return false;
}
int size() const {
return _count;
}
int size() const { return _count; }
int channel() const { return _channel; }
Rgb *begin() { return _firstBuffer.get(); }
const Rgb *begin() const { return _firstBuffer.get(); }
const Rgb *cbegin() const { return _firstBuffer.get(); }
Rgb* begin() { return _firstBuffer.get(); }
const Rgb* begin() const { return _firstBuffer.get(); }
const Rgb* cbegin() const { return _firstBuffer.get(); }
Rgb *end() { return _firstBuffer.get() + _count; }
const Rgb *end() const { return _firstBuffer.get() + _count; }
const Rgb *cend() const { return _firstBuffer.get() + _count; }
Rgb* end() { return _firstBuffer.get() + _count; }
const Rgb* end() const { return _firstBuffer.get() + _count; }
const Rgb* cend() const { return _firstBuffer.get() + _count; }
private:
static intr_handle_t _interruptHandle;
static IsrCore _interruptCore;
static void initChannel( int channel ) {
RMT.apb_conf.fifo_mask = 1; //enable memory access, instead of FIFO mode.
RMT.apb_conf.mem_tx_wrap_en = 1; //wrap around when hitting end of buffer
RMT.conf_ch[ channel ].conf0.div_cnt = detail::DIVIDER;
RMT.conf_ch[ channel ].conf0.mem_size = 1;
RMT.conf_ch[ channel ].conf0.carrier_en = 0;
RMT.conf_ch[ channel ].conf0.carrier_out_lv = 1;
RMT.conf_ch[ channel ].conf0.mem_pd = 0;
RMT.conf_ch[ channel ].conf1.rx_en = 0;
RMT.conf_ch[ channel ].conf1.mem_owner = 0;
RMT.conf_ch[ channel ].conf1.tx_conti_mode = 0; //loop back mode.
RMT.conf_ch[ channel ].conf1.ref_always_on = 1; // use apb clock: 80M
RMT.conf_ch[ channel ].conf1.idle_out_en = 1;
RMT.conf_ch[ channel ].conf1.idle_out_lv = 0;
static void registerInterrupt(void* selfVoid) {
auto* self = (SmartLed*)selfVoid;
ESP_ERROR_CHECK(self->_driver.registerIsr(!anyAlive()));
}
static void registerInterrupt(void *) {
ESP_ERROR_CHECK(esp_intr_alloc( ETS_RMT_INTR_SOURCE, 0, interruptHandler, nullptr, &_interruptHandle));
static void unregisterInterrupt(void* selfVoid) {
auto* self = (SmartLed*)selfVoid;
ESP_ERROR_CHECK(self->_driver.unregisterIsr());
}
static void unregisterInterrupt(void*) {
esp_intr_free( _interruptHandle );
}
static SmartLed*& IRAM_ATTR ledForChannel( int channel );
static void IRAM_ATTR interruptHandler( void* );
void IRAM_ATTR copyRmtHalfBlock();
void swapBuffers() {
if ( _secondBuffer )
_firstBuffer.swap( _secondBuffer );
}
void startTransmission() {
// Invalid use of the library
if( xSemaphoreTake( _finishedFlag, 0 ) != pdTRUE )
abort();
_pixelPosition = _componentPosition = _halfIdx = 0;
copyRmtHalfBlock();
if ( _pixelPosition < _count )
copyRmtHalfBlock();
RMT.conf_ch[ _channel ].conf1.mem_rd_rst = 1;
RMT.conf_ch[ _channel ].conf1.tx_start = 1;
}
static SmartLed*& IRAM_ATTR ledForChannel(int channel);
static bool anyAlive() {
for ( int i = 0; i != 8; i++ )
if ( ledForChannel( i ) != nullptr ) return true;
for (int i = 0; i != detail::CHANNEL_COUNT; i++)
if (ledForChannel(i) != nullptr)
return true;
return false;
}
const LedType& _timing;
void swapBuffers() {
if (_secondBuffer)
_firstBuffer.swap(_secondBuffer);
}
esp_err_t startTransmission() {
// Invalid use of the library, you must wait() fir previous frame to get processed first
if (xSemaphoreTake(_finishedFlag, 0) != pdTRUE)
abort();
auto err = _driver.transmit(_firstBuffer.get());
if (err != ESP_OK) {
return err;
}
return ESP_OK;
}
SemaphoreHandle_t _finishedFlag;
detail::RmtDriver _driver;
int _channel;
detail::RmtPulsePair _bitToRmt[ 2 ];
int _count;
std::unique_ptr< Rgb[] > _firstBuffer;
std::unique_ptr< Rgb[] > _secondBuffer;
Rgb *_buffer;
xSemaphoreHandle _finishedFlag;
int _pixelPosition;
int _componentPosition;
int _halfIdx;
std::unique_ptr<Rgb[]> _firstBuffer;
std::unique_ptr<Rgb[]> _secondBuffer;
};
#if defined(CONFIG_IDF_TARGET_ESP32S3) || defined(CONFIG_IDF_TARGET_ESP32C3)
#define _SMARTLEDS_SPI_HOST SPI2_HOST
#define _SMARTLEDS_SPI_DMA_CHAN SPI_DMA_CH_AUTO
#else
#define _SMARTLEDS_SPI_HOST HSPI_HOST
#define _SMARTLEDS_SPI_DMA_CHAN 1
#endif
class Apa102 {
public:
struct ApaRgb {
ApaRgb( uint8_t r = 0, uint8_t g = 0, uint32_t b = 0, uint32_t v = 0xFF )
: v( 0xE0 | v ), b( b ), g( g ), r( r )
{}
ApaRgb(uint8_t r = 0, uint8_t g = 0, uint32_t b = 0, uint32_t v = 0xFF)
: v(0xE0 | v)
, b(b)
, g(g)
, r(r) {}
ApaRgb& operator=( const Rgb& o ) {
ApaRgb& operator=(const Rgb& o) {
r = o.r;
g = o.g;
b = o.b;
return *this;
}
ApaRgb& operator=( const Hsv& o ) {
*this = Rgb{ o };
ApaRgb& operator=(const Hsv& o) {
*this = Rgb { o };
return *this;
}
@@ -304,14 +253,14 @@ public:
static const int FINAL_FRAME_SIZE = 4;
static const int TRANS_COUNT = 2 + 8;
Apa102( int count, int clkpin, int datapin, BufferType doubleBuffer = SingleBuffer )
: _count( count ),
_firstBuffer( new ApaRgb[ count ] ),
_secondBuffer( doubleBuffer ? new ApaRgb[ count ] : nullptr ),
_initFrame( 0 )
{
Apa102(int count, int clkpin, int datapin, BufferType doubleBuffer = SingleBuffer, int clock_speed_hz = 1000000)
: _count(count)
, _firstBuffer(new ApaRgb[count])
, _secondBuffer(doubleBuffer ? new ApaRgb[count] : nullptr)
, _transCount(0)
, _initFrame(0) {
spi_bus_config_t buscfg;
memset( &buscfg, 0, sizeof( buscfg ) );
memset(&buscfg, 0, sizeof(buscfg));
buscfg.mosi_io_num = datapin;
buscfg.miso_io_num = -1;
buscfg.sclk_io_num = clkpin;
@@ -320,33 +269,29 @@ public:
buscfg.max_transfer_sz = 65535;
spi_device_interface_config_t devcfg;
memset( &devcfg, 0, sizeof( devcfg ) );
devcfg.clock_speed_hz = 1000000;
memset(&devcfg, 0, sizeof(devcfg));
devcfg.clock_speed_hz = clock_speed_hz;
devcfg.mode = 0;
devcfg.spics_io_num = -1;
devcfg.queue_size = TRANS_COUNT;
devcfg.pre_cb = nullptr;
auto ret = spi_bus_initialize( HSPI_HOST, &buscfg, 1 );
assert( ret == ESP_OK );
auto ret = spi_bus_initialize(_SMARTLEDS_SPI_HOST, &buscfg, _SMARTLEDS_SPI_DMA_CHAN);
assert(ret == ESP_OK);
ret = spi_bus_add_device( HSPI_HOST, &devcfg, &_spi );
assert( ret == ESP_OK );
ret = spi_bus_add_device(_SMARTLEDS_SPI_HOST, &devcfg, &_spi);
assert(ret == ESP_OK);
std::fill_n( _finalFrame, FINAL_FRAME_SIZE, 0xFFFFFFFF );
std::fill_n(_finalFrame, FINAL_FRAME_SIZE, 0xFFFFFFFF);
}
~Apa102() {
// ToDo
}
ApaRgb& operator[]( int idx ) {
return _firstBuffer[ idx ];
}
ApaRgb& operator[](int idx) { return _firstBuffer[idx]; }
const ApaRgb& operator[]( int idx ) const {
return _firstBuffer[ idx ];
}
const ApaRgb& operator[](int idx) const { return _firstBuffer[idx]; }
void show() {
_buffer = _firstBuffer.get();
@@ -355,93 +300,95 @@ public:
}
void wait() {
for ( int i = 0; i != _transCount; i++ ) {
spi_transaction_t *t;
spi_device_get_trans_result( _spi, &t, portMAX_DELAY );
for (int i = 0; i != _transCount; i++) {
spi_transaction_t* t;
spi_device_get_trans_result(_spi, &t, portMAX_DELAY);
}
}
private:
void swapBuffers() {
if ( _secondBuffer )
_firstBuffer.swap( _secondBuffer );
if (_secondBuffer)
_firstBuffer.swap(_secondBuffer);
}
void startTransmission() {
for ( int i = 0; i != TRANS_COUNT; i++ ) {
_transactions[ i ].cmd = 0;
_transactions[ i ].addr = 0;
_transactions[ i ].flags = 0;
_transactions[ i ].rxlength = 0;
_transactions[ i ].rx_buffer = nullptr;
for (int i = 0; i != TRANS_COUNT; i++) {
_transactions[i].cmd = 0;
_transactions[i].addr = 0;
_transactions[i].flags = 0;
_transactions[i].rxlength = 0;
_transactions[i].rx_buffer = nullptr;
}
// Init frame
_transactions[ 0 ].length = 32;
_transactions[ 0 ].tx_buffer = &_initFrame;
spi_device_queue_trans( _spi, _transactions + 0, portMAX_DELAY );
_transactions[0].length = 32;
_transactions[0].tx_buffer = &_initFrame;
spi_device_queue_trans(_spi, _transactions + 0, portMAX_DELAY);
// Data
_transactions[ 1 ].length = 32 * _count;
_transactions[ 1 ].tx_buffer = _buffer;
spi_device_queue_trans( _spi, _transactions + 1, portMAX_DELAY );
_transactions[1].length = 32 * _count;
_transactions[1].tx_buffer = _buffer;
spi_device_queue_trans(_spi, _transactions + 1, portMAX_DELAY);
_transCount = 2;
// End frame
for ( int i = 0; i != 1 + _count / 32 / FINAL_FRAME_SIZE; i++ ) {
_transactions[ 2 + i ].length = 32 * FINAL_FRAME_SIZE;
_transactions[ 2 + i ].tx_buffer = _finalFrame;
spi_device_queue_trans( _spi, _transactions + 2 + i, portMAX_DELAY );
for (int i = 0; i != 1 + _count / 32 / FINAL_FRAME_SIZE; i++) {
_transactions[2 + i].length = 32 * FINAL_FRAME_SIZE;
_transactions[2 + i].tx_buffer = _finalFrame;
spi_device_queue_trans(_spi, _transactions + 2 + i, portMAX_DELAY);
_transCount++;
}
}
spi_device_handle_t _spi;
int _count;
std::unique_ptr< ApaRgb[] > _firstBuffer, _secondBuffer;
ApaRgb *_buffer;
std::unique_ptr<ApaRgb[]> _firstBuffer, _secondBuffer;
ApaRgb* _buffer;
spi_transaction_t _transactions[ TRANS_COUNT ];
spi_transaction_t _transactions[TRANS_COUNT];
int _transCount;
uint32_t _initFrame;
uint32_t _finalFrame[ FINAL_FRAME_SIZE ];
uint32_t _finalFrame[FINAL_FRAME_SIZE];
};
class LDP8806 {
public:
struct LDP8806_GRB {
LDP8806_GRB( uint8_t g_7bit = 0, uint8_t r_7bit = 0, uint32_t b_7bit = 0 )
: g( g_7bit ), r( r_7bit ), b( b_7bit )
{
}
LDP8806_GRB(uint8_t g_7bit = 0, uint8_t r_7bit = 0, uint32_t b_7bit = 0)
: g(g_7bit)
, r(r_7bit)
, b(b_7bit) {}
LDP8806_GRB& operator=( const Rgb& o ) {
LDP8806_GRB& operator=(const Rgb& o) {
//Convert 8->7bit colour
r = ( o.r * 127 / 256 ) | 0x80;
g = ( o.g * 127 / 256 ) | 0x80;
b = ( o.b * 127 / 256 ) | 0x80;
r = (o.r * 127 / 256) | 0x80;
g = (o.g * 127 / 256) | 0x80;
b = (o.b * 127 / 256) | 0x80;
return *this;
}
LDP8806_GRB& operator=( const Hsv& o ) {
*this = Rgb{ o };
LDP8806_GRB& operator=(const Hsv& o) {
*this = Rgb { o };
return *this;
}
uint8_t g, r, b;
};
static const int LED_FRAME_SIZE_BYTES = sizeof( LDP8806_GRB );
static const int LED_FRAME_SIZE_BYTES = sizeof(LDP8806_GRB);
static const int LATCH_FRAME_SIZE_BYTES = 3;
static const int TRANS_COUNT_MAX = 20;//Arbitrary, supports up to 600 LED
static const int TRANS_COUNT_MAX = 20; //Arbitrary, supports up to 600 LED
LDP8806( int count, int clkpin, int datapin, BufferType doubleBuffer = SingleBuffer, uint32_t clock_speed_hz = 2000000 )
: _count( count ),
_firstBuffer( new LDP8806_GRB[ count ] ),
_secondBuffer( doubleBuffer ? new LDP8806_GRB[ count ] : nullptr ),
// one 'latch'/start-of-data mark frame for every 32 leds
_latchFrames( ( count + 31 ) / 32 )
{
LDP8806(
int count, int clkpin, int datapin, BufferType doubleBuffer = SingleBuffer, uint32_t clock_speed_hz = 2000000)
: _count(count)
, _firstBuffer(new LDP8806_GRB[count])
, _secondBuffer(doubleBuffer ? new LDP8806_GRB[count] : nullptr)
,
// one 'latch'/start-of-data mark frame for every 32 leds
_latchFrames((count + 31) / 32) {
spi_bus_config_t buscfg;
memset( &buscfg, 0, sizeof( buscfg ) );
memset(&buscfg, 0, sizeof(buscfg));
buscfg.mosi_io_num = datapin;
buscfg.miso_io_num = -1;
buscfg.sclk_io_num = clkpin;
@@ -450,33 +397,29 @@ public:
buscfg.max_transfer_sz = 65535;
spi_device_interface_config_t devcfg;
memset( &devcfg, 0, sizeof( devcfg ) );
memset(&devcfg, 0, sizeof(devcfg));
devcfg.clock_speed_hz = clock_speed_hz;
devcfg.mode = 0;
devcfg.spics_io_num = -1;
devcfg.queue_size = TRANS_COUNT_MAX;
devcfg.pre_cb = nullptr;
auto ret = spi_bus_initialize( HSPI_HOST, &buscfg, 1 );
assert( ret == ESP_OK );
auto ret = spi_bus_initialize(_SMARTLEDS_SPI_HOST, &buscfg, _SMARTLEDS_SPI_DMA_CHAN);
assert(ret == ESP_OK);
ret = spi_bus_add_device( HSPI_HOST, &devcfg, &_spi );
assert( ret == ESP_OK );
ret = spi_bus_add_device(_SMARTLEDS_SPI_HOST, &devcfg, &_spi);
assert(ret == ESP_OK);
std::fill_n( _latchBuffer, LATCH_FRAME_SIZE_BYTES, 0x0 );
std::fill_n(_latchBuffer, LATCH_FRAME_SIZE_BYTES, 0x0);
}
~LDP8806() {
// noop
}
LDP8806_GRB& operator[]( int idx ) {
return _firstBuffer[ idx ];
}
LDP8806_GRB& operator[](int idx) { return _firstBuffer[idx]; }
const LDP8806_GRB& operator[]( int idx ) const {
return _firstBuffer[ idx ];
}
const LDP8806_GRB& operator[](int idx) const { return _firstBuffer[idx]; }
void show() {
_buffer = _firstBuffer.get();
@@ -485,51 +428,50 @@ public:
}
void wait() {
while ( _transCount-- ) {
spi_transaction_t *t;
spi_device_get_trans_result( _spi, &t, portMAX_DELAY );
while (_transCount--) {
spi_transaction_t* t;
spi_device_get_trans_result(_spi, &t, portMAX_DELAY);
}
}
private:
void swapBuffers() {
if ( _secondBuffer )
_firstBuffer.swap( _secondBuffer );
if (_secondBuffer)
_firstBuffer.swap(_secondBuffer);
}
void startTransmission() {
_transCount = 0;
for ( int i = 0; i != TRANS_COUNT_MAX; i++ ) {
_transactions[ i ].cmd = 0;
_transactions[ i ].addr = 0;
_transactions[ i ].flags = 0;
_transactions[ i ].rxlength = 0;
_transactions[ i ].rx_buffer = nullptr;
for (int i = 0; i != TRANS_COUNT_MAX; i++) {
_transactions[i].cmd = 0;
_transactions[i].addr = 0;
_transactions[i].flags = 0;
_transactions[i].rxlength = 0;
_transactions[i].rx_buffer = nullptr;
}
// LED Data
_transactions[ 0 ].length = ( LED_FRAME_SIZE_BYTES * 8 ) * _count;
_transactions[ 0 ].tx_buffer = _buffer;
spi_device_queue_trans( _spi, _transactions + _transCount, portMAX_DELAY );
_transactions[0].length = (LED_FRAME_SIZE_BYTES * 8) * _count;
_transactions[0].tx_buffer = _buffer;
spi_device_queue_trans(_spi, _transactions + _transCount, portMAX_DELAY);
_transCount++;
// 'latch'/start-of-data marker frames
for ( int i = 0; i < _latchFrames; i++ ) {
_transactions[ _transCount ].length = ( LATCH_FRAME_SIZE_BYTES * 8 );
_transactions[ _transCount ].tx_buffer = _latchBuffer;
spi_device_queue_trans( _spi, _transactions + _transCount, portMAX_DELAY );
for (int i = 0; i < _latchFrames; i++) {
_transactions[_transCount].length = (LATCH_FRAME_SIZE_BYTES * 8);
_transactions[_transCount].tx_buffer = _latchBuffer;
spi_device_queue_trans(_spi, _transactions + _transCount, portMAX_DELAY);
_transCount++;
}
}
spi_device_handle_t _spi;
int _count;
std::unique_ptr< LDP8806_GRB[] > _firstBuffer, _secondBuffer;
LDP8806_GRB *_buffer;
std::unique_ptr<LDP8806_GRB[]> _firstBuffer, _secondBuffer;
LDP8806_GRB* _buffer;
spi_transaction_t _transactions[ TRANS_COUNT_MAX ];
spi_transaction_t _transactions[TRANS_COUNT_MAX];
int _transCount;
int _latchFrames;
uint8_t _latchBuffer[ LATCH_FRAME_SIZE_BYTES ];
uint8_t _latchBuffer[LATCH_FRAME_SIZE_BYTES];
};
#endif //SMARTLEDS_H

View File

@@ -6,9 +6,6 @@
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_system.h"
#include "esp_event.h"
#include "server_tflite.h"
#include "esp_log.h"
@@ -22,10 +19,13 @@
#include "ClassLogFile.h"
#include "configFile.h"
#include "Helper.h"
#ifdef ENABLE_MQTT
#include "interface_mqtt.h"
#include "interface_mqtt.h"
#include "server_mqtt.h"
#endif //ENABLE_MQTT
#include "basic_auth.h"
static const char *TAG = "GPIO";
QueueHandle_t gpio_queue_handle = NULL;
@@ -331,7 +331,7 @@ bool GpioHandler::readConfig()
#ifdef ENABLE_MQTT
// std::string mainTopicMQTT = "";
std::string mainTopicMQTT = GetMQTTMainTopic();
std::string mainTopicMQTT = mqttServer_getMainTopic();
if (mainTopicMQTT.length() > 0)
{
mainTopicMQTT = mainTopicMQTT + "/GPIO";
@@ -459,7 +459,7 @@ void GpioHandler::registerGpioUri()
httpd_uri_t camuri = { };
camuri.method = HTTP_GET;
camuri.uri = "/GPIO";
camuri.handler = callHandleHttpRequest;
camuri.handler = APPLY_BASIC_AUTH_FILTER(callHandleHttpRequest);
camuri.user_ctx = (void*)this;
httpd_register_uri_handler(_httpServer, &camuri);
}

View File

@@ -4,6 +4,6 @@ list(APPEND EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/proto
idf_component_register(SRCS ${app_sources}
INCLUDE_DIRS "."
REQUIRES esp32-camera esp_http_server jomjol_logfile jomjol_image_proc nvs_flash jomjol_fileserver_ota jomjol_controlGPIO)
REQUIRES esp_timer esp32-camera esp_http_server jomjol_logfile jomjol_image_proc nvs_flash jomjol_fileserver_ota jomjol_controlGPIO)

File diff suppressed because it is too large Load Diff

View File

@@ -15,48 +15,103 @@
#include "CImageBasis.h"
#include "../../include/defines.h"
class CCamera {
protected:
int ActualQuality;
framesize_t ActualResolution;
int brightness, contrast, saturation;
bool isFixedExposure;
int waitbeforepicture_org;
int led_intensity = 4095;
typedef struct
{
uint16_t CamSensor_id;
void ledc_init(void);
bool CameraInitSuccessful = false;
bool demoMode = false;
framesize_t ImageFrameSize = FRAMESIZE_VGA; // 0 - 10
gainceiling_t ImageGainceiling; // Image gain (GAINCEILING_x2, x4, x8, x16, x32, x64 or x128)
bool loadNextDemoImage(camera_fb_t *fb);
long GetFileSize(std::string filename);
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)
public:
int image_height, image_width;
CCamera();
esp_err_t InitCam();
int ImageDenoiseLevel; // The OV2640 does not support it, OV3660 and OV5640 (0 to 8)
void LightOnOff(bool status);
void LEDOnOff(bool status);
esp_err_t CaptureToHTTP(httpd_req_t *req, int delay = 0);
void SetQualitySize(int qual, framesize_t resol);
bool SetBrightnessContrastSaturation(int _brightness, int _contrast, int _saturation);
void GetCameraParameter(httpd_req_t *req, int &qual, framesize_t &resol);
void SetLEDIntensity(float _intrel);
bool testCamera(void);
void EnableAutoExposure(int flash_duration);
bool getCameraInitSuccessful();
void useDemoMode(void);
int ImageWidth;
int ImageHeight;
framesize_t TextToFramesize(const char * text);
int ImageLedIntensity;
esp_err_t CaptureToFile(std::string nm, int delay = 0);
esp_err_t CaptureToBasisImage(CImageBasis *_Image, int delay = 0);
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);
bool loadNextDemoImage(camera_fb_t *fb);
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 SetImageWidthHeightFromResolution(framesize_t resol);
void SanitizeZoomParams(int imageSize, int frameSizeX, int frameSizeY, int &imageWidth, int &imageHeight, int &zoomOffsetX, int &zoomOffsetY);
public:
int LedIntensity = 4096;
CCamera(void);
esp_err_t InitCam(void);
void LightOnOff(bool status);
void LEDOnOff(bool status);
esp_err_t setSensorDatenFromCCstatus(void);
esp_err_t getSensorDatenToCCstatus(void);
int SetCamGainceiling(sensor_t *s, gainceiling_t gainceilingLevel);
void SetCamSharpness(bool autoSharpnessEnabled, int sharpnessLevel);
void SetCamSpecialEffect(sensor_t *s, int specialEffect);
void SetCamContrastBrightness(sensor_t *s, int _contrast, int _brightness);
esp_err_t CaptureToHTTP(httpd_req_t *req, int delay = 0);
esp_err_t CaptureToStream(httpd_req_t *req, bool FlashlightOn);
void SetQualityZoomSize(int qual, framesize_t resol, bool zoomEnabled, int zoomOffsetX, int zoomOffsetY, int imageSize, int imageVflip);
void SetZoomSize(bool zoomEnabled, int zoomOffsetX, int zoomOffsetY, int imageSize, int imageVflip);
int SetLEDIntensity(int _intrel);
bool testCamera(void);
bool getCameraInitSuccessful(void);
void useDemoMode(void);
framesize_t TextToFramesize(const char *text);
esp_err_t CaptureToFile(std::string nm, int delay = 0);
esp_err_t CaptureToBasisImage(CImageBasis *_Image, int delay = 0);
};
extern CCamera Camera;
#endif

View File

@@ -0,0 +1,88 @@
// Workaround - bug in cam library - enable bits are set without using bitwise OR logic -> only latest enable setting is used
// Reference: https://esp32.com/viewtopic.php?f=19&t=14376#p93178
/* The memory structure is as follows for
byte_0 = enable_bits
byte_0->bit0 = enable saturation and hue --> OK
byte_0->bit1 = enable saturation --> OK
byte_0->bit2 = enable brightness and contrast --> OK
byte_0->bit3 = enable green -> blue spitial effect (Antique and blunish and greenish and reddish and b&w) enable
byte_0->bit4 = anable gray -> red spitial effect (Antique and blunish and greenish and reddish and b&w) enable
byte_0->bit5 = remove (UV) in YUV color system
byte_0->bit6 = enable negative
byte_0->bit7 = remove (Y) in YUV color system
byte_1 = saturation1 0-255 --> ?
byte_2 = hue 0-255 --> OK
byte_3 = saturation2 0-255 --> OK
byte_4 = reenter saturation2 in documents --> ?
byte_5 = spital effect green -> blue 0-255 --> ?
byte_6 = spital effect gray -> red 0-255 --> ?
byte_7 = contrast lower byte 0-255 --> OK
byte_8 = contrast higher byte 0-255 --> OK
byte_9 = brightness 0-255 --> OK
byte_10 = if byte_10==4 contrast effective --> ?
*/
#include <stdint.h>
#include "esp_camera.h"
#include "ov2640_contrast_brightness.h"
static const uint8_t brightness_regs[6][5] = {
{0x7C, 0x7D, 0x7C, 0x7D, 0x7D },
{0x00, 0x04, 0x09, 0x00, 0x00 }, /* -2 */
{0x00, 0x04, 0x09, 0x10, 0x00 }, /* -1 */
{0x00, 0x04, 0x09, 0x20, 0x00 }, /* 0 */
{0x00, 0x04, 0x09, 0x30, 0x00 }, /* +1 */
{0x00, 0x04, 0x09, 0x40, 0x00 }, /* +2 */
};
static const uint8_t contrast_regs[6][7] = {
{0x7C, 0x7D, 0x7C, 0x7D, 0x7D, 0x7D, 0x7D },
{0x00, 0x04, 0x07, 0x20, 0x18, 0x34, 0x06 }, /* -2 */
{0x00, 0x04, 0x07, 0x20, 0x1c, 0x2a, 0x06 }, /* -1 */
{0x00, 0x04, 0x07, 0x20, 0x20, 0x20, 0x06 }, /* 0 */
{0x00, 0x04, 0x07, 0x20, 0x24, 0x16, 0x06 }, /* +1 */
{0x00, 0x04, 0x07, 0x20, 0x28, 0x0c, 0x06 }, /* +2 */
};
int ov2640_set_contrast_brightness(sensor_t *sensor, int _contrast, int _brightness)
{
int ret=0;
_contrast += 3;
if (_contrast <= 0) {
_contrast = 3;
}
else if (_contrast > 5)
{
_contrast = 5;
}
sensor->status.contrast = _contrast-3;
_brightness += 3;
if (_brightness <= 0) {
_brightness = 3;
}
else if (_brightness > 5)
{
_brightness = 5;
}
int brightness = brightness_regs[_brightness][3];
sensor->status.brightness = _brightness-3;
// sensor->set_reg(sensor, int reg, int mask, int value)
sensor->set_reg(sensor, 0xFF, 0x01, 0x00); // Select DSP bank
for (int i=0; i<7; i++)
{
if (i == 5)
{
sensor->set_reg(sensor, contrast_regs[0][i], 0xFF, (brightness | contrast_regs[_contrast][i]));
}
else
{
sensor->set_reg(sensor, contrast_regs[0][i], 0xFF, contrast_regs[_contrast][i]);
}
}
return ret;
}

View File

@@ -0,0 +1,10 @@
#pragma once
#ifndef OV2640_CONTRAST_BRIGHTNESS_H
#define OV2640_CONTRAST_BRIGHTNESS_H
#include "esp_camera.h"
int ov2640_set_contrast_brightness(sensor_t *sensor, int _contrast, int _brightness);
#endif

View File

@@ -0,0 +1,151 @@
#include <stdint.h>
#include "esp_camera.h"
#include "ov2640_sharpness.h"
const static uint8_t OV2640_SHARPNESS_AUTO[]=
{
//reg, val, mask
0xFF, 0x00, 0xFF,
0x92, 0x01, 0xFF,
0x93, 0x20, 0x20,
0x00, 0x00, 0x00
};
const static uint8_t OV2640_SHARPNESS_MANUAL[]=
{
//reg, val, mask
0xFF, 0x00, 0xFF,
0x92, 0x01, 0xFF,
0x93, 0x00, 0x20,
0x00, 0x00, 0x00
};
const static uint8_t OV2640_SHARPNESS_LEVEL0[]=
{
//reg, val, mask
0xFF, 0x00, 0xFF,
0x92, 0x01, 0xFF,
0x93, 0xC0, 0x1F,
0x00, 0x00, 0x00
};
const static uint8_t OV2640_SHARPNESS_LEVEL1[]=
{
//reg, val, mask
0xFF, 0x00, 0xFF,
0x92, 0x01, 0xFF,
0x93, 0xC1, 0x1F,
0x00, 0x00, 0x00
};
const static uint8_t OV2640_SHARPNESS_LEVEL2[]=
{
//reg, val, mask
0xFF, 0x00, 0xFF,
0x92, 0x01, 0xFF,
0x93, 0xC2, 0x1F,
0x00, 0x00, 0x00
};
const static uint8_t OV2640_SHARPNESS_LEVEL3[]=
{
//reg, val, mask
0xFF, 0x00, 0xFF,
0x92, 0x01, 0xFF,
0x93, 0xC4, 0x1F,
0x00, 0x00, 0x00
};
const static uint8_t OV2640_SHARPNESS_LEVEL4[]=
{
//reg, val, mask
0xFF, 0x00, 0xFF,
0x92, 0x01, 0xFF,
0x93, 0xC8, 0x1F,
0x00, 0x00, 0x00
};
const static uint8_t OV2640_SHARPNESS_LEVEL5[]=
{
//reg, val, mask
0xFF, 0x00, 0xFF,
0x92, 0x01, 0xFF,
0x93, 0xD0, 0x1F,
0x00, 0x00, 0x00
};
const static uint8_t OV2640_SHARPNESS_LEVEL6[]=
{
//reg, val, mask
0xFF, 0x00, 0xFF,
0x92, 0x01, 0xFF,
0x93, 0xDF, 0x1F,
0x00, 0x00, 0x00
};
const static uint8_t *OV2640_SETTING_SHARPNESS[]=
{
OV2640_SHARPNESS_LEVEL0, // -3 sharpness
OV2640_SHARPNESS_LEVEL1,
OV2640_SHARPNESS_LEVEL2,
OV2640_SHARPNESS_LEVEL3,
OV2640_SHARPNESS_LEVEL4,
OV2640_SHARPNESS_LEVEL5,
OV2640_SHARPNESS_LEVEL6 // +3 sharpness
};
#define OV2640_MAXLEVEL_SHARPNESS 6
static int table_mask_write(sensor_t *sensor, const uint8_t* ptab)
{
uint8_t address;
uint8_t value;
uint8_t orgval;
uint8_t mask;
const uint8_t *pdata = ptab;
if (pdata == NULL)
{
return -1;
}
while (1)
{
address = *pdata++;
value = *pdata++;
mask = *pdata++;
if ((address == 0) && (value == 0) && (mask == 0))
{
break;
}
sensor->set_reg(sensor, address, mask, value);
}
return 0;
}
int ov2640_enable_auto_sharpness(sensor_t *sensor)
{
table_mask_write(sensor, OV2640_SHARPNESS_AUTO);
sensor->status.sharpness = 0;
return 0;
}
int ov2640_set_sharpness(sensor_t *sensor, int sharpness)
{
int sharpness_temp = 0;
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_SETTING_SHARPNESS[sharpness_temp + 3]);
sensor->status.sharpness = sharpness;
return 0;
}

View File

@@ -0,0 +1,11 @@
#pragma once
#ifndef OV2640_SHARPNESS_H
#define OV2640_SHARPNESS_H
#include "esp_camera.h"
int ov2640_enable_auto_sharpness(sensor_t *sensor);
int ov2640_set_sharpness(sensor_t *sensor, int sharpness); // -3 to +3, -4 for auto-sharpness
#endif

View File

@@ -0,0 +1,66 @@
// Workaround - bug in cam library - enable bits are set without using bitwise OR logic -> only latest enable setting is used
// Reference: https://esp32.com/viewtopic.php?f=19&t=14376#p93178
/* The memory structure is as follows for
byte_0 = enable_bits
byte_0->bit0 = enable saturation and hue --> OK
byte_0->bit1 = enable saturation --> OK
byte_0->bit2 = enable brightness and contrast --> OK
byte_0->bit3 = enable green -> blue spitial effect (Antique and blunish and greenish and reddish and b&w) enable
byte_0->bit4 = anable gray -> red spitial effect (Antique and blunish and greenish and reddish and b&w) enable
byte_0->bit5 = remove (UV) in YUV color system
byte_0->bit6 = enable negative
byte_0->bit7 = remove (Y) in YUV color system
byte_1 = saturation1 0-255 --> ?
byte_2 = hue 0-255 --> OK
byte_3 = saturation2 0-255 --> OK
byte_4 = reenter saturation2 in documents --> ?
byte_5 = spital effect green -> blue 0-255 --> ?
byte_6 = spital effect gray -> red 0-255 --> ?
byte_7 = contrast lower byte 0-255 --> OK
byte_8 = contrast higher byte 0-255 --> OK
byte_9 = brightness 0-255 --> OK
byte_10 = if byte_10==4 contrast effective --> ?
*/
#include <stdint.h>
#include "esp_camera.h"
#include "ov2640_specialEffect.h"
static const uint8_t special_effects_regs[8][5] = {
{0x7C, 0x7D, 0x7C, 0x7D, 0x7D},
{0x00, 0X00, 0x05, 0X80, 0X80}, /* no effect */
{0x00, 0X40, 0x05, 0X80, 0X80}, /* negative */
{0x00, 0X18, 0x05, 0X80, 0X80}, /* black and white */
{0x00, 0X18, 0x05, 0X40, 0XC0}, /* reddish */
{0x00, 0X18, 0x05, 0X40, 0X40}, /* greenish */
{0x00, 0X18, 0x05, 0XA0, 0X40}, /* blue */
{0x00, 0X18, 0x05, 0X40, 0XA6}, /* retro */
};
int ov2640_set_special_effect(sensor_t *sensor, int effect)
{
int ret = 0;
effect++;
if (effect <= 0 || effect > 7)
{
effect = 1;
}
sensor->status.special_effect = effect - 1;
int registerValue = 0x06; // enable saturation, contrast, brightness
registerValue |= special_effects_regs[effect][1];
// sensor->set_reg(sensor, int reg, int mask, int value)
sensor->set_reg(sensor, 0xFF, 0x01, 0x00); // Select DSP bank
sensor->set_reg(sensor, special_effects_regs[0][0], 0xFF, 0x00);
sensor->set_reg(sensor, special_effects_regs[0][1], 0x5E, registerValue);
for (int i = 2; i < 5; i++)
{
sensor->set_reg(sensor, special_effects_regs[0][i], 0xFF, special_effects_regs[effect][i]);
}
return ret;
}

View File

@@ -0,0 +1,10 @@
#pragma once
#ifndef OV2640_SPECIALEFFECT_H
#define OV2640_SPECIALEFFECT_H
#include "esp_camera.h"
int ov2640_set_special_effect(sensor_t *sensor, int effect);
#endif

View File

@@ -5,191 +5,200 @@
#include "esp_camera.h"
#include "ClassControllCamera.h"
#include "MainFlowControl.h"
#include "ClassLogFile.h"
#include "esp_log.h"
#include "basic_auth.h"
#include "../../include/defines.h"
static const char *TAG = "server_cam";
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");
gpio_config_t conf;
conf.intr_type = GPIO_INTR_DISABLE;
conf.pin_bit_mask = 1LL << CAM_PIN_PWDN;
conf.mode = GPIO_MODE_OUTPUT;
conf.pull_down_en = GPIO_PULLDOWN_DISABLE;
conf.pull_up_en = GPIO_PULLUP_DISABLE;
gpio_config(&conf);
void PowerResetCamera(){
ESP_LOGD(TAG, "Resetting camera by power down line");
gpio_config_t conf;
conf.intr_type = GPIO_INTR_DISABLE;
conf.pin_bit_mask = 1LL << GPIO_NUM_32;
conf.mode = GPIO_MODE_OUTPUT;
conf.pull_down_en = GPIO_PULLDOWN_DISABLE;
conf.pull_up_en = GPIO_PULLUP_DISABLE;
gpio_config(&conf);
// carefull, logic is inverted compared to reset pin
gpio_set_level(GPIO_NUM_32, 1);
vTaskDelay(1000 / portTICK_PERIOD_MS);
gpio_set_level(GPIO_NUM_32, 0);
vTaskDelay(1000 / portTICK_PERIOD_MS);
// carefull, logic is inverted compared to reset pin
gpio_set_level(CAM_PIN_PWDN, 1);
vTaskDelay(1000 / portTICK_PERIOD_MS);
gpio_set_level(CAM_PIN_PWDN, 0);
vTaskDelay(1000 / portTICK_PERIOD_MS);
#endif
}
esp_err_t handler_lightOn(httpd_req_t *req)
{
#ifdef DEBUG_DETAIL_ON
LogFile.WriteHeapInfo("handler_lightOn - Start");
ESP_LOGD(TAG, "handler_lightOn uri: %s", req->uri);
#endif
#ifdef DEBUG_DETAIL_ON
LogFile.WriteHeapInfo("handler_lightOn - Start");
ESP_LOGD(TAG, "handler_lightOn uri: %s", req->uri);
#endif
if (Camera.getCameraInitSuccessful())
if (Camera.getCameraInitSuccessful())
{
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));
}
else
else
{
httpd_resp_send_err(req, HTTPD_403_FORBIDDEN, "Camera not initialized: REST API /lighton not available!");
return ESP_ERR_NOT_FOUND;
}
#ifdef DEBUG_DETAIL_ON
LogFile.WriteHeapInfo("handler_lightOn - Done");
#endif
#ifdef DEBUG_DETAIL_ON
LogFile.WriteHeapInfo("handler_lightOn - Done");
#endif
return ESP_OK;
}
esp_err_t handler_lightOff(httpd_req_t *req)
{
#ifdef DEBUG_DETAIL_ON
LogFile.WriteHeapInfo("handler_lightOff - Start");
ESP_LOGD(TAG, "handler_lightOff uri: %s", req->uri);
#endif
#ifdef DEBUG_DETAIL_ON
LogFile.WriteHeapInfo("handler_lightOff - Start");
ESP_LOGD(TAG, "handler_lightOff uri: %s", req->uri);
#endif
if (Camera.getCameraInitSuccessful())
if (Camera.getCameraInitSuccessful())
{
Camera.LightOnOff(false);
const char* resp_str = (const char*) req->user_ctx;
httpd_resp_send(req, resp_str, strlen(resp_str));
const char *resp_str = (const char *)req->user_ctx;
httpd_resp_send(req, resp_str, strlen(resp_str));
}
else
else
{
httpd_resp_send_err(req, HTTPD_403_FORBIDDEN, "Camera not initialized: REST API /lightoff not available!");
return ESP_ERR_NOT_FOUND;
}
#ifdef DEBUG_DETAIL_ON
LogFile.WriteHeapInfo("handler_lightOff - Done");
#endif
#ifdef DEBUG_DETAIL_ON
LogFile.WriteHeapInfo("handler_lightOff - Done");
#endif
return ESP_OK;
}
esp_err_t handler_capture(httpd_req_t *req)
{
#ifdef DEBUG_DETAIL_ON
LogFile.WriteHeapInfo("handler_capture - Start");
#endif
#ifdef DEBUG_DETAIL_ON
LogFile.WriteHeapInfo("handler_capture - Start");
#endif
if (Camera.getCameraInitSuccessful())
if (Camera.getCameraInitSuccessful())
{
int quality;
framesize_t res;
// 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);
Camera.LedIntensity = CCstatus.ImageLedIntensity;
CFstatus.changedCameraSettings = false;
}
Camera.GetCameraParameter(req, quality, res);
#ifdef DEBUG_DETAIL_ON
ESP_LOGD(TAG, "Size: %d, Quality: %d", res, quality);
#endif
Camera.SetQualitySize(quality, res);
#ifdef DEBUG_DETAIL_ON
ESP_LOGD(TAG, "Size: %d, Quality: %d", CCstatus.ImageFrameSize, CCstatus.ImageQuality);
#endif
esp_err_t result;
result = Camera.CaptureToHTTP(req);
#ifdef DEBUG_DETAIL_ON
LogFile.WriteHeapInfo("handler_capture - Done");
#endif
#ifdef DEBUG_DETAIL_ON
LogFile.WriteHeapInfo("handler_capture - Done");
#endif
return result;
}
else
else
{
httpd_resp_send_err(req, HTTPD_403_FORBIDDEN, "Camera not initialized: REST API /capture not available!");
return ESP_ERR_NOT_FOUND;
}
}
esp_err_t handler_capture_with_light(httpd_req_t *req)
{
#ifdef DEBUG_DETAIL_ON
LogFile.WriteHeapInfo("handler_capture_with_light - Start");
#endif
if (Camera.getCameraInitSuccessful())
#ifdef DEBUG_DETAIL_ON
LogFile.WriteHeapInfo("handler_capture_with_light - Start");
#endif
if (Camera.getCameraInitSuccessful())
{
char _query[100];
char _delay[10];
int quality;
framesize_t res;
int delay = 2500;
if (httpd_req_get_url_query_str(req, _query, 100) == ESP_OK)
{
ESP_LOGD(TAG, "Query: %s", _query);
if (httpd_query_key_value(_query, "delay", _delay, 10) == ESP_OK)
{
#ifdef DEBUG_DETAIL_ON
ESP_LOGD(TAG, "Delay: %s", _delay);
#endif
#ifdef DEBUG_DETAIL_ON
ESP_LOGD(TAG, "Delay: %s", _delay);
#endif
delay = atoi(_delay);
if (delay < 0)
{
delay = 0;
}
}
}
Camera.GetCameraParameter(req, quality, res);
// 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);
Camera.LedIntensity = CCstatus.ImageLedIntensity;
CFstatus.changedCameraSettings = false;
}
#ifdef DEBUG_DETAIL_ON
ESP_LOGD(TAG, "Size: %d, Quality: %d", res, quality);
#endif
#ifdef DEBUG_DETAIL_ON
ESP_LOGD(TAG, "Size: %d, Quality: %d", CCstatus.ImageFrameSize, CCstatus.ImageQuality);
#endif
Camera.SetQualitySize(quality, res);
Camera.LightOnOff(true);
const TickType_t xDelay = delay / portTICK_PERIOD_MS;
vTaskDelay( xDelay );
vTaskDelay(xDelay);
esp_err_t result;
result = Camera.CaptureToHTTP(req);
result = Camera.CaptureToHTTP(req);
Camera.LightOnOff(false);
#ifdef DEBUG_DETAIL_ON
LogFile.WriteHeapInfo("handler_capture_with_light - Done");
#endif
#ifdef DEBUG_DETAIL_ON
LogFile.WriteHeapInfo("handler_capture_with_light - Done");
#endif
return result;
}
else
else
{
httpd_resp_send_err(req, HTTPD_403_FORBIDDEN, "Camera not initialized: REST API /capture_with_flashlight not available!");
return ESP_ERR_NOT_FOUND;
}
}
esp_err_t handler_capture_save_to_file(httpd_req_t *req)
{
#ifdef DEBUG_DETAIL_ON
LogFile.WriteHeapInfo("handler_capture_save_to_file - Start");
#endif
#ifdef DEBUG_DETAIL_ON
LogFile.WriteHeapInfo("handler_capture_save_to_file - Start");
#endif
if (Camera.getCameraInitSuccessful())
if (Camera.getCameraInitSuccessful())
{
char _query[100];
char _delay[10];
@@ -197,94 +206,103 @@ esp_err_t handler_capture_save_to_file(httpd_req_t *req)
char filename[100];
std::string fn = "/sdcard/";
int quality;
framesize_t res;
if (httpd_req_get_url_query_str(req, _query, 100) == ESP_OK)
{
ESP_LOGD(TAG, "Query: %s", _query);
if (httpd_query_key_value(_query, "filename", filename, 100) == ESP_OK)
{
fn.append(filename);
#ifdef DEBUG_DETAIL_ON
ESP_LOGD(TAG, "Filename: %s", fn.c_str());
#endif
#ifdef DEBUG_DETAIL_ON
ESP_LOGD(TAG, "Filename: %s", fn.c_str());
#endif
}
else
{
fn.append("noname.jpg");
}
if (httpd_query_key_value(_query, "delay", _delay, 10) == ESP_OK)
{
#ifdef DEBUG_DETAIL_ON
ESP_LOGD(TAG, "Delay: %s", _delay);
#endif
#ifdef DEBUG_DETAIL_ON
ESP_LOGD(TAG, "Delay: %s", _delay);
#endif
delay = atoi(_delay);
if (delay < 0)
{
delay = 0;
}
}
}
else
{
fn.append("noname.jpg");
}
Camera.GetCameraParameter(req, quality, res);
#ifdef DEBUG_DETAIL_ON
ESP_LOGD(TAG, "Size: %d, Quality: %d", res, quality);
#endif
Camera.SetQualitySize(quality, res);
// 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);
Camera.LedIntensity = CCstatus.ImageLedIntensity;
CFstatus.changedCameraSettings = false;
}
#ifdef DEBUG_DETAIL_ON
ESP_LOGD(TAG, "Size: %d, Quality: %d", CCstatus.ImageFrameSize, CCstatus.ImageQuality);
#endif
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));
#ifdef DEBUG_DETAIL_ON
LogFile.WriteHeapInfo("handler_capture_save_to_file - Done");
#endif
#ifdef DEBUG_DETAIL_ON
LogFile.WriteHeapInfo("handler_capture_save_to_file - Done");
#endif
return result;
}
else
else
{
httpd_resp_send_err(req, HTTPD_403_FORBIDDEN, "Camera not initialized: REST API /save not available!");
return ESP_ERR_NOT_FOUND;
}
}
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");
#endif
httpd_uri_t camuri = { };
camuri.method = HTTP_GET;
httpd_uri_t camuri = {};
camuri.method = HTTP_GET;
camuri.uri = "/lighton";
camuri.handler = handler_lightOn;
camuri.user_ctx = (void*) "Light On";
camuri.uri = "/lighton";
camuri.handler = APPLY_BASIC_AUTH_FILTER(handler_lightOn);
camuri.user_ctx = (void *)"Light On";
httpd_register_uri_handler(server, &camuri);
camuri.uri = "/lightoff";
camuri.handler = handler_lightOff;
camuri.user_ctx = (void*) "Light Off";
httpd_register_uri_handler(server, &camuri);
camuri.uri = "/lightoff";
camuri.handler = APPLY_BASIC_AUTH_FILTER(handler_lightOff);
camuri.user_ctx = (void *)"Light Off";
httpd_register_uri_handler(server, &camuri);
camuri.uri = "/capture";
camuri.handler = handler_capture;
camuri.user_ctx = NULL;
httpd_register_uri_handler(server, &camuri);
camuri.uri = "/capture";
camuri.handler = APPLY_BASIC_AUTH_FILTER(handler_capture);
camuri.user_ctx = NULL;
httpd_register_uri_handler(server, &camuri);
camuri.uri = "/capture_with_flashlight";
camuri.handler = handler_capture_with_light;
camuri.user_ctx = NULL;
httpd_register_uri_handler(server, &camuri);
camuri.uri = "/capture_with_flashlight";
camuri.handler = APPLY_BASIC_AUTH_FILTER(handler_capture_with_light);
camuri.user_ctx = NULL;
httpd_register_uri_handler(server, &camuri);
camuri.uri = "/save";
camuri.handler = handler_capture_save_to_file;
camuri.user_ctx = NULL;
httpd_register_uri_handler(server, &camuri);
camuri.uri = "/save";
camuri.handler = APPLY_BASIC_AUTH_FILTER(handler_capture_save_to_file);
camuri.user_ctx = NULL;
httpd_register_uri_handler(server, &camuri);
}

View File

@@ -10,7 +10,6 @@
//#include "ClassControllCamera.h"
void register_server_camera_uri(httpd_handle_t server);
void PowerResetCamera();
#endif

View File

@@ -1,7 +1,7 @@
FILE(GLOB_RECURSE app_sources ${CMAKE_CURRENT_SOURCE_DIR}/*.*)
idf_component_register(SRCS ${app_sources}
INCLUDE_DIRS "." "../../include"
REQUIRES tflite-lib esp_http_server app_update esp_http_client nvs_flash jomjol_tfliteclass jomjol_flowcontroll spiffs jomjol_helper jomjol_controlGPIO miniz)
INCLUDE_DIRS "." "../../include" "miniz"
REQUIRES vfs esp_http_server app_update esp_http_client nvs_flash jomjol_tfliteclass jomjol_flowcontroll spiffs jomjol_helper jomjol_controlGPIO)

View File

@@ -0,0 +1,226 @@
/* Src: https://github.com/Zunawe/md5-c, commit: f3529b6
* License: Unlicense */
/*
* Derived from the RSA Data Security, Inc. MD5 Message-Digest Algorithm
* and modified slightly to be functionally identical but condensed into control structures.
*/
#include "md5.h"
/*
* Constants defined by the MD5 algorithm
*/
#define A 0x67452301
#define B 0xefcdab89
#define C 0x98badcfe
#define D 0x10325476
static uint32_t S[] = {7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22,
5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20,
4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23,
6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21};
static uint32_t K[] = {0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee,
0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501,
0x698098d8, 0x8b44f7af, 0xffff5bb1, 0x895cd7be,
0x6b901122, 0xfd987193, 0xa679438e, 0x49b40821,
0xf61e2562, 0xc040b340, 0x265e5a51, 0xe9b6c7aa,
0xd62f105d, 0x02441453, 0xd8a1e681, 0xe7d3fbc8,
0x21e1cde6, 0xc33707d6, 0xf4d50d87, 0x455a14ed,
0xa9e3e905, 0xfcefa3f8, 0x676f02d9, 0x8d2a4c8a,
0xfffa3942, 0x8771f681, 0x6d9d6122, 0xfde5380c,
0xa4beea44, 0x4bdecfa9, 0xf6bb4b60, 0xbebfbc70,
0x289b7ec6, 0xeaa127fa, 0xd4ef3085, 0x04881d05,
0xd9d4d039, 0xe6db99e5, 0x1fa27cf8, 0xc4ac5665,
0xf4292244, 0x432aff97, 0xab9423a7, 0xfc93a039,
0x655b59c3, 0x8f0ccc92, 0xffeff47d, 0x85845dd1,
0x6fa87e4f, 0xfe2ce6e0, 0xa3014314, 0x4e0811a1,
0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391};
/*
* Padding used to make the size (in bits) of the input congruent to 448 mod 512
*/
static uint8_t PADDING[] = {0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
/*
* Bit-manipulation functions defined by the MD5 algorithm
*/
#define F(X, Y, Z) ((X & Y) | (~X & Z))
#define G(X, Y, Z) ((X & Z) | (Y & ~Z))
#define H(X, Y, Z) (X ^ Y ^ Z)
#define I(X, Y, Z) (Y ^ (X | ~Z))
/*
* Rotates a 32-bit word left by n bits
*/
uint32_t rotateLeft(uint32_t x, uint32_t n){
return (x << n) | (x >> (32 - n));
}
/*
* Initialize a context
*/
void md5Init(MD5Context *ctx){
ctx->size = (uint64_t)0;
ctx->buffer[0] = (uint32_t)A;
ctx->buffer[1] = (uint32_t)B;
ctx->buffer[2] = (uint32_t)C;
ctx->buffer[3] = (uint32_t)D;
}
/*
* Add some amount of input to the context
*
* If the input fills out a block of 512 bits, apply the algorithm (md5Step)
* and save the result in the buffer. Also updates the overall size.
*/
void md5Update(MD5Context *ctx, uint8_t *input_buffer, size_t input_len){
uint32_t input[16];
unsigned int offset = ctx->size % 64;
ctx->size += (uint64_t)input_len;
// Copy each byte in input_buffer into the next space in our context input
for(unsigned int i = 0; i < input_len; ++i){
ctx->input[offset++] = (uint8_t)*(input_buffer + i);
// If we've filled our context input, copy it into our local array input
// then reset the offset to 0 and fill in a new buffer.
// Every time we fill out a chunk, we run it through the algorithm
// to enable some back and forth between cpu and i/o
if(offset % 64 == 0){
for(unsigned int j = 0; j < 16; ++j){
// Convert to little-endian
// The local variable `input` our 512-bit chunk separated into 32-bit words
// we can use in calculations
input[j] = (uint32_t)(ctx->input[(j * 4) + 3]) << 24 |
(uint32_t)(ctx->input[(j * 4) + 2]) << 16 |
(uint32_t)(ctx->input[(j * 4) + 1]) << 8 |
(uint32_t)(ctx->input[(j * 4)]);
}
md5Step(ctx->buffer, input);
offset = 0;
}
}
}
/*
* Pad the current input to get to 448 bytes, append the size in bits to the very end,
* and save the result of the final iteration into digest.
*/
void md5Finalize(MD5Context *ctx){
uint32_t input[16];
unsigned int offset = ctx->size % 64;
unsigned int padding_length = offset < 56 ? 56 - offset : (56 + 64) - offset;
// Fill in the padding and undo the changes to size that resulted from the update
md5Update(ctx, PADDING, padding_length);
ctx->size -= (uint64_t)padding_length;
// Do a final update (internal to this function)
// Last two 32-bit words are the two halves of the size (converted from bytes to bits)
for(unsigned int j = 0; j < 14; ++j){
input[j] = (uint32_t)(ctx->input[(j * 4) + 3]) << 24 |
(uint32_t)(ctx->input[(j * 4) + 2]) << 16 |
(uint32_t)(ctx->input[(j * 4) + 1]) << 8 |
(uint32_t)(ctx->input[(j * 4)]);
}
input[14] = (uint32_t)(ctx->size * 8);
input[15] = (uint32_t)((ctx->size * 8) >> 32);
md5Step(ctx->buffer, input);
// Move the result into digest (convert from little-endian)
for(unsigned int i = 0; i < 4; ++i){
ctx->digest[(i * 4) + 0] = (uint8_t)((ctx->buffer[i] & 0x000000FF));
ctx->digest[(i * 4) + 1] = (uint8_t)((ctx->buffer[i] & 0x0000FF00) >> 8);
ctx->digest[(i * 4) + 2] = (uint8_t)((ctx->buffer[i] & 0x00FF0000) >> 16);
ctx->digest[(i * 4) + 3] = (uint8_t)((ctx->buffer[i] & 0xFF000000) >> 24);
}
}
/*
* Step on 512 bits of input with the main MD5 algorithm.
*/
void md5Step(uint32_t *buffer, uint32_t *input){
uint32_t AA = buffer[0];
uint32_t BB = buffer[1];
uint32_t CC = buffer[2];
uint32_t DD = buffer[3];
uint32_t E;
unsigned int j;
for(unsigned int i = 0; i < 64; ++i){
switch(i / 16){
case 0:
E = F(BB, CC, DD);
j = i;
break;
case 1:
E = G(BB, CC, DD);
j = ((i * 5) + 1) % 16;
break;
case 2:
E = H(BB, CC, DD);
j = ((i * 3) + 5) % 16;
break;
default:
E = I(BB, CC, DD);
j = (i * 7) % 16;
break;
}
uint32_t temp = DD;
DD = CC;
CC = BB;
BB = BB + rotateLeft(AA + E + K[i] + input[j], S[i]);
AA = temp;
}
buffer[0] += AA;
buffer[1] += BB;
buffer[2] += CC;
buffer[3] += DD;
}
/*
* Functions that run the algorithm on the provided input and put the digest into result.
* result should be able to store 16 bytes.
*/
void md5String(char *input, uint8_t *result){
MD5Context ctx;
md5Init(&ctx);
md5Update(&ctx, (uint8_t *)input, strlen(input));
md5Finalize(&ctx);
memcpy(result, ctx.digest, 16);
}
void md5File(FILE *file, uint8_t *result){
void *input_buffer = malloc(1024);
size_t input_size = 0;
MD5Context ctx;
md5Init(&ctx);
while((input_size = fread(input_buffer, 1, 1024, file)) > 0){
md5Update(&ctx, (uint8_t *)input_buffer, input_size);
}
md5Finalize(&ctx);
free(input_buffer);
memcpy(result, ctx.digest, 16);
}

View File

@@ -0,0 +1,28 @@
/* Src: https://github.com/Zunawe/md5-c, commit: f3529b6
* License: Unlicense */
#pragma once
#ifndef MD5_H
#define MD5_H
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
typedef struct{
uint64_t size; // Size of input in bytes
uint32_t buffer[4]; // Current accumulation of hash
uint8_t input[64]; // Input to be used in the next step
uint8_t digest[16]; // Result of algorithm
}MD5Context;
void md5Init(MD5Context *ctx);
void md5Update(MD5Context *ctx, uint8_t *input, size_t input_len);
void md5Finalize(MD5Context *ctx);
void md5Step(uint32_t *buffer, uint32_t *input);
void md5String(char *input, uint8_t *result);
void md5File(FILE *file, uint8_t *result);
#endif // MD5_H

View File

@@ -153,7 +153,7 @@
/*#define MINIZ_NO_MALLOC */
#ifdef MINIZ_NO_INFLATE_APIS
#define MINIZ_NO_ARCHIVE_APIS
//#define MINIZ_NO_ARCHIVE_APIS
#endif
#ifdef MINIZ_NO_DEFLATE_APIS

View File

@@ -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/espressif/esptool/pull/500#issuecomment-574879468
For sumplicity we therefore use the release files as suggested in the readme.
Additionally we added the CMakeLists.txt and this readme.
For simplicity we therefore use the release files as suggested in the readme.
Additionally we added the CMakeLists.txt and this readme.

View File

@@ -6,11 +6,8 @@
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied.
*/
#include "server_file.h"
#include <stdio.h>
#include <string.h>
#include <string>
@@ -36,9 +33,10 @@ extern "C" {
#include "../../include/defines.h"
#include "ClassLogFile.h"
#include "server_tflite.h"
#include "MainFlowControl.h"
#include "server_help.h"
#include "md5.h"
#ifdef ENABLE_MQTT
#include "interface_mqtt.h"
#endif //ENABLE_MQTT
@@ -46,7 +44,7 @@ extern "C" {
#include "Helper.h"
#include "miniz.h"
#include "basic_auth.h"
static const char *TAG = "OTA FILE";
@@ -58,23 +56,20 @@ struct file_server_data {
char scratch[SERVER_FILER_SCRATCH_BUFSIZE];
};
#include <iostream>
#include <sys/types.h>
#include <dirent.h>
using namespace std;
string SUFFIX_ZW = "_0xge";
string SUFFIX_ZW = "_tmp";
static esp_err_t send_logfile(httpd_req_t *req, bool send_full_file);
static esp_err_t send_datafile(httpd_req_t *req, bool send_full_file);
esp_err_t get_numbers_file_handler(httpd_req_t *req)
{
std::string ret = tfliteflow.getNumbersName();
std::string ret = flowctrl.getNumbersName();
// ESP_LOGI(TAG, "Result get_numbers_file_handler: %s", ret.c_str());
@@ -87,7 +82,6 @@ esp_err_t get_numbers_file_handler(httpd_req_t *req)
return ESP_OK;
}
esp_err_t get_data_file_handler(httpd_req_t *req)
{
struct dirent *entry;
@@ -131,7 +125,6 @@ esp_err_t get_data_file_handler(httpd_req_t *req)
return ESP_OK;
}
esp_err_t get_tflite_file_handler(httpd_req_t *req)
{
struct dirent *entry;
@@ -175,12 +168,11 @@ esp_err_t get_tflite_file_handler(httpd_req_t *req)
return ESP_OK;
}
/* Send HTTP response with a run-time generated html consisting of
* a list of all files and folders under the requested path.
* In case of SPIFFS this returns empty list when path is any
* string other than '/', since SPIFFS doesn't support directories */
static esp_err_t http_resp_dir_html(httpd_req_t *req, const char *dirpath, const char* uripath, bool readonly)
static esp_err_t http_resp_dir_html(httpd_req_t *req, const char *dirpath, const char *uripath, bool readonly)
{
char entrypath[FILE_PATH_MAX];
char entrysize[16];
@@ -192,82 +184,85 @@ static esp_err_t http_resp_dir_html(httpd_req_t *req, const char *dirpath, const
char dirpath_corrected[FILE_PATH_MAX];
strcpy(dirpath_corrected, dirpath);
file_server_data * server_data = (file_server_data *) req->user_ctx;
if ((strlen(dirpath_corrected)-1) > strlen(server_data->base_path)) // if dirpath is not mountpoint, the last "\" needs to be removed
dirpath_corrected[strlen(dirpath_corrected)-1] = '\0';
file_server_data *server_data = (file_server_data *)req->user_ctx;
DIR *dir = opendir(dirpath_corrected);
if ((strlen(dirpath_corrected) - 1) > strlen(server_data->base_path)) {
// if dirpath is not mountpoint, the last "\" needs to be removed
dirpath_corrected[strlen(dirpath_corrected) - 1] = '\0';
}
DIR *pdir = opendir(dirpath_corrected);
const size_t dirpath_len = strlen(dirpath);
ESP_LOGD(TAG, "Dirpath: <%s>, Pathlength: %d", dirpath, dirpath_len);
/* Retrieve the base path of file storage to construct the full path */
// Retrieve the base path of file storage to construct the full path
strlcpy(entrypath, dirpath, sizeof(entrypath));
ESP_LOGD(TAG, "entrypath: <%s>", entrypath);
if (!dir) {
if (!pdir) {
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Failed to stat dir: " + std::string(dirpath) + "!");
/* Respond with 404 Not Found */
// Respond with 404 Not Found
httpd_resp_send_err(req, HTTPD_404_NOT_FOUND, get404());
return ESP_FAIL;
}
httpd_resp_set_hdr(req, "Access-Control-Allow-Origin", "*");
/* Send HTML file header */
httpd_resp_sendstr_chunk(req, "<!DOCTYPE html><html><body>");
// Send HTML file header
httpd_resp_sendstr_chunk(req, "<!DOCTYPE html><html lang=\"en\" xml:lang=\"en\"><head>");
httpd_resp_sendstr_chunk(req, "<link href=\"/file_server.css\" rel=\"stylesheet\">");
httpd_resp_sendstr_chunk(req, "<link href=\"/firework.css\" rel=\"stylesheet\">");
httpd_resp_sendstr_chunk(req, "<script type=\"text/javascript\" src=\"/jquery-3.6.0.min.js\"></script>");
httpd_resp_sendstr_chunk(req, "<script type=\"text/javascript\" src=\"/firework.js\"></script></head>");
/////////////////////////////////////////////////
if (!readonly) {
FILE *fd = fopen("/sdcard/html/file_server.html", "r");
char *chunk = ((struct file_server_data *)req->user_ctx)->scratch;
size_t chunksize;
do {
chunksize = fread(chunk, 1, SERVER_FILER_SCRATCH_BUFSIZE, fd);
// ESP_LOGD(TAG, "Chunksize %d", chunksize);
if (chunksize > 0){
if (httpd_resp_send_chunk(req, chunk, chunksize) != ESP_OK) {
fclose(fd);
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "File sending failed!");
return ESP_FAIL;
}
}
} while (chunksize != 0);
fclose(fd);
// ESP_LOGI(TAG, "File sending complete");
}
///////////////////////////////
httpd_resp_sendstr_chunk(req, "<body>");
httpd_resp_sendstr_chunk(req, "<table class=\"fixed\" border=\"0\" width=100% style=\"font-family: arial\">");
httpd_resp_sendstr_chunk(req, "<tr><td style=\"vertical-align: top;width: 300px;\"><h2>Fileserver</h2></td>"
"<td rowspan=\"2\"><table border=\"0\" style=\"width:100%\"><tr><td style=\"width:80px\">"
"<label for=\"newfile\">Source</label></td><td colspan=\"2\">"
"<input id=\"newfile\" type=\"file\" onchange=\"setpath()\" style=\"width:100%;\"></td></tr>"
"<tr><td><label for=\"filepath\">Destination</label></td><td>"
"<input id=\"filepath\" type=\"text\" style=\"width:94%;\"></td><td>"
"<button id=\"upload\" type=\"button\" class=\"button\" onclick=\"upload()\">Upload</button></td></tr>"
"</table></td></tr><tr></tr><tr><td colspan=\"2\">"
"<button style=\"font-size:16px; padding: 5px 10px\" id=\"dirup\" type=\"button\" onclick=\"dirup()\""
"disabled>&#129145; Directory up</button><span style=\"padding-left:15px\" id=\"currentpath\">"
"</span></td></tr>");
httpd_resp_sendstr_chunk(req, "</table>");
httpd_resp_sendstr_chunk(req, "<script type=\"text/javascript\" src=\"/file_server.js\"></script>");
httpd_resp_sendstr_chunk(req, "<script type=\"text/javascript\">initFileServer();</script>");
std::string _zw = std::string(dirpath);
_zw = _zw.substr(8, _zw.length() - 8);
_zw = "/delete/" + _zw + "?task=deldircontent";
_zw = "/delete/" + _zw + "?task=deldircontent";
// Send file-list table definition and column labels
httpd_resp_sendstr_chunk(req, "<table id=\"files_table\">"
"<col width=\"800px\"><col width=\"300px\"><col width=\"300px\"><col width=\"100px\">"
"<thead><tr><th>Name</th><th>Type</th><th>Size</th>");
/* Send file-list table definition and column labels */
httpd_resp_sendstr_chunk(req,
"<table id=\"files_table\">"
"<col width=\"800px\" /><col width=\"300px\" /><col width=\"300px\" /><col width=\"100px\" />"
"<thead><tr><th>Name</th><th>Type</th><th>Size</th>");
if (!readonly) {
httpd_resp_sendstr_chunk(req, "<th>"
"<form method=\"post\" action=\"");
httpd_resp_sendstr_chunk(req, "<th><form method=\"post\" action=\"");
httpd_resp_sendstr_chunk(req, _zw.c_str());
httpd_resp_sendstr_chunk(req,
"\"><button type=\"submit\">DELETE ALL!</button></form>"
"</th></tr>");
httpd_resp_sendstr_chunk(req, "\"><button type=\"submit\">DELETE ALL!</button></form></th></tr>");
}
httpd_resp_sendstr_chunk(req, "</thead><tbody>\n");
/* Iterate over all files / folders and fetch their names and sizes */
while ((entry = readdir(dir)) != NULL) {
if (strcmp("wlan.ini", entry->d_name) != 0 ) // wlan.ini soll nicht angezeigt werden!
{
// Iterate over all files / folders and fetch their names and sizes
while ((entry = readdir(pdir)) != NULL) {
// wlan.ini soll nicht angezeigt werden!
if (strcmp("wlan.ini", entry->d_name) != 0) {
entrytype = (entry->d_type == DT_DIR ? "directory" : "file");
strlcpy(entrypath + dirpath_len, entry->d_name, sizeof(entrypath) - dirpath_len);
ESP_LOGD(TAG, "Entrypath: %s", entrypath);
if (stat(entrypath, &entry_stat) == -1) {
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Failed to stat " + string(entrytype) + ": " + string(entry->d_name));
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Failed to stat " + std::string(entrytype) + ": " + std::string(entry->d_name));
continue;
}
@@ -283,22 +278,25 @@ static esp_err_t http_resp_dir_html(httpd_req_t *req, const char *dirpath, const
}
}
ESP_LOGI(TAG, "Found %s: %s (%s bytes)", entrytype, entry->d_name, entrysize);
ESP_LOGD(TAG, "Found %s: %s (%s bytes)", entrytype, entry->d_name, entrysize);
/* Send chunk of HTML file containing table entries with file name and size */
// Send chunk of HTML file containing table entries with file name and size
httpd_resp_sendstr_chunk(req, "<tr><td><a href=\"");
httpd_resp_sendstr_chunk(req, "/fileserver");
httpd_resp_sendstr_chunk(req, uripath);
httpd_resp_sendstr_chunk(req, entry->d_name);
if (entry->d_type == DT_DIR) {
httpd_resp_sendstr_chunk(req, "/");
}
httpd_resp_sendstr_chunk(req, "\">");
httpd_resp_sendstr_chunk(req, entry->d_name);
httpd_resp_sendstr_chunk(req, "</a></td><td>");
httpd_resp_sendstr_chunk(req, entrytype);
httpd_resp_sendstr_chunk(req, "</td><td>");
httpd_resp_sendstr_chunk(req, entrysize);
if (!readonly) {
httpd_resp_sendstr_chunk(req, "</td><td>");
httpd_resp_sendstr_chunk(req, "<form method=\"post\" action=\"/delete");
@@ -306,31 +304,28 @@ static esp_err_t http_resp_dir_html(httpd_req_t *req, const char *dirpath, const
httpd_resp_sendstr_chunk(req, entry->d_name);
httpd_resp_sendstr_chunk(req, "\"><button type=\"submit\">Delete</button></form>");
}
httpd_resp_sendstr_chunk(req, "</td></tr>\n");
}
}
closedir(dir);
/* Finish the file list table */
closedir(pdir);
// Finish the file list table
httpd_resp_sendstr_chunk(req, "</tbody></table>");
/* Send remaining chunk of HTML file to complete it */
// Send remaining chunk of HTML file to complete it
httpd_resp_sendstr_chunk(req, "</body></html>");
/* Send empty chunk to signal HTTP response completion */
// Send empty chunk to signal HTTP response completion
httpd_resp_sendstr_chunk(req, NULL);
return ESP_OK;
}
/*
#define IS_FILE_EXT(filename, ext) \
(strcasecmp(&filename[strlen(filename) - sizeof(ext) + 1], ext) == 0)
*/
static esp_err_t logfileact_get_full_handler(httpd_req_t *req) {
return send_logfile(req, true);
}
static esp_err_t logfileact_get_last_part_handler(httpd_req_t *req) {
return send_logfile(req, false);
}
@@ -339,7 +334,6 @@ static esp_err_t datafileact_get_full_handler(httpd_req_t *req) {
return send_datafile(req, true);
}
static esp_err_t datafileact_get_last_part_handler(httpd_req_t *req) {
return send_datafile(req, false);
}
@@ -424,7 +418,6 @@ static esp_err_t send_datafile(httpd_req_t *req, bool send_full_file)
return ESP_OK;
}
static esp_err_t send_logfile(httpd_req_t *req, bool send_full_file)
{
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "log_get_last_part_handler");
@@ -510,7 +503,6 @@ static esp_err_t send_logfile(httpd_req_t *req, bool send_full_file)
return ESP_OK;
}
/* Handler to download a file kept on the server */
static esp_err_t download_get_handler(httpd_req_t *req)
{
@@ -528,7 +520,6 @@ static esp_err_t download_get_handler(httpd_req_t *req)
// filename = get_path_from_uri(filepath, ((struct file_server_data *)req->user_ctx)->base_path,
// req->uri, sizeof(filepath));
if (!filename) {
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Filename is too long");
/* Respond with 414 Error */
@@ -548,7 +539,7 @@ static esp_err_t download_get_handler(httpd_req_t *req)
/* Get value of expected key from query string */
if (httpd_query_key_value(buf, "readonly", param, sizeof(param)) == ESP_OK) {
ESP_LOGI(TAG, "Found URL query parameter => readonly=%s", param);
readonly = param && strcmp(param,"true")==0;
readonly = (strcmp(param,"true") == 0);
}
}
}
@@ -589,7 +580,9 @@ static esp_err_t download_get_handler(httpd_req_t *req)
/* Read file in chunks into the scratch buffer */
chunksize = fread(chunk, 1, SERVER_FILER_SCRATCH_BUFSIZE, fd);
/* Send the buffer contents as HTTP response chunk */
/* Send buffer contents as HTTP chunk. If empty this functions as a
* last-chunk message, signaling end-of-response, to the HTTP client.
* See RFC 2616, section 3.6.1 for details on Chunked Transfer Encoding. */
if (httpd_resp_send_chunk(req, chunk, chunksize) != ESP_OK) {
fclose(fd);
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "File sending failed!");
@@ -607,8 +600,6 @@ static esp_err_t download_get_handler(httpd_req_t *req)
fclose(fd);
ESP_LOGD(TAG, "File successfully sent");
/* Respond with an empty chunk to signal HTTP response completion */
httpd_resp_send_chunk(req, NULL, 0);
return ESP_OK;
}
@@ -620,6 +611,8 @@ static esp_err_t upload_post_handler(httpd_req_t *req)
FILE *fd = NULL;
struct stat file_stat;
ESP_LOGI(TAG, "uri: %s", req->uri);
httpd_resp_set_hdr(req, "Access-Control-Allow-Origin", "*");
/* Skip leading "/upload" from URI to get filename */
@@ -718,40 +711,79 @@ static esp_err_t upload_post_handler(httpd_req_t *req)
/* Close file upon upload completion */
fclose(fd);
ESP_LOGI(TAG, "File reception complete");
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "File saved: " + string(filename));
ESP_LOGI(TAG, "File reception completed");
std::string directory = std::string(filepath);
size_t zw = directory.find("/");
size_t found = zw;
while (zw != std::string::npos)
{
zw = directory.find("/", found+1);
if (zw != std::string::npos)
found = zw;
}
string s = req->uri;
if (isInString(s, "?md5")) {
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "Calculate and return MD5 sum...");
fd = fopen(filepath, "r");
if (!fd) {
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Failed to open file for reading: " + string(filepath));
/* Respond with 500 Internal Server Error */
httpd_resp_send_err(req, HTTPD_500_INTERNAL_SERVER_ERROR, "Failed to open file for reading");
return ESP_FAIL;
}
int start_fn = strlen(((struct file_server_data *)req->user_ctx)->base_path);
ESP_LOGD(TAG, "Directory: %s, start_fn: %d, found: %d", directory.c_str(), start_fn, found);
directory = directory.substr(start_fn, found - start_fn + 1);
directory = "/fileserver" + directory;
// ESP_LOGD(TAG, "Directory danach 2: %s", directory.c_str());
uint8_t result[16];
string md5hex = "";
string response = "{\"md5\":";
char hex[3];
/* Redirect onto root to see the updated file list */
httpd_resp_set_status(req, "303 See Other");
httpd_resp_set_hdr(req, "Location", directory.c_str());
md5File(fd, result);
fclose(fd);
/* Redirect onto root to see the updated file list */
httpd_resp_set_status(req, "303 See Other");
httpd_resp_set_hdr(req, "Location", directory.c_str());
httpd_resp_sendstr(req, "File uploaded successfully");
for (int i = 0; i < sizeof(result); i++) {
snprintf(hex, sizeof(hex), "%02x", result[i]);
md5hex.append(hex);
}
/*
if (strcmp(filepath, CONFIG_FILE) == 0) {
ESP_LOGD(TAG, "New config found. Reload handler.");
gpio_handler_deinit();
MQTTdestroy();
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "MD5 of " + string(filepath) + ": " + md5hex);
response.append("\"" + md5hex + "\"");
response.append("}");
httpd_resp_sendstr(req, response.c_str());
}
else { // Return file server page
std::string directory = std::string(filepath);
size_t zw = directory.find("/");
size_t found = zw;
while (zw != std::string::npos)
{
zw = directory.find("/", found+1);
if (zw != std::string::npos)
found = zw;
}
int start_fn = strlen(((struct file_server_data *)req->user_ctx)->base_path);
ESP_LOGD(TAG, "Directory: %s, start_fn: %d, found: %d", directory.c_str(), start_fn, found);
directory = directory.substr(start_fn, found - start_fn + 1);
directory = "/fileserver" + directory;
// ESP_LOGD(TAG, "Directory danach 2: %s", directory.c_str());
/* Redirect onto root to see the updated file list */
if (strcmp(filename, "/config/config.ini") == 0 ||
strcmp(filename, "/config/ref0.jpg") == 0 ||
strcmp(filename, "/config/ref0_org.jpg") == 0 ||
strcmp(filename, "/config/ref1.jpg") == 0 ||
strcmp(filename, "/config/ref1_org.jpg") == 0 ||
strcmp(filename, "/config/reference.jpg") == 0 ||
strcmp(filename, "/img_tmp/ref0.jpg") == 0 ||
strcmp(filename, "/img_tmp/ref0_org.jpg") == 0 ||
strcmp(filename, "/img_tmp/ref1.jpg") == 0 ||
strcmp(filename, "/img_tmp/ref1_org.jpg") == 0 ||
strcmp(filename, "/img_tmp/reference.jpg") == 0 )
{
httpd_resp_set_status(req, HTTPD_200); // Avoid reloading of folder content
}
else {
httpd_resp_set_status(req, "303 See Other"); // Reload folder content after upload
}
httpd_resp_set_hdr(req, "Location", directory.c_str());
httpd_resp_sendstr(req, "File uploaded successfully");
}
*/
return ESP_OK;
}
@@ -763,7 +795,6 @@ static esp_err_t delete_post_handler(httpd_req_t *req)
char filepath[FILE_PATH_MAX];
struct stat file_stat;
//////////////////////////////////////////////////////////////
char _query[200];
char _valuechar[30];
@@ -838,16 +869,15 @@ static esp_err_t delete_post_handler(httpd_req_t *req)
return ESP_FAIL;
}
if (stat(filepath, &file_stat) == -1) {
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "File does not exist: " + string(filename));
/* Respond with 400 Bad Request */
httpd_resp_send_err(req, HTTPD_400_BAD_REQUEST, "File does not exist");
return ESP_FAIL;
if (stat(filepath, &file_stat) == -1) { // File does not exist
/* This is ok, we would delete it anyway */
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "File does not exist: " + string(filename));
}
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "Deleting file: " + string(filename));
/* Delete file */
unlink(filepath);
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "File deleted: " + string(filename));
ESP_LOGI(TAG, "File deletion completed");
directory = std::string(filepath);
size_t zw = directory.find("/");
@@ -864,22 +894,34 @@ static esp_err_t delete_post_handler(httpd_req_t *req)
directory = directory.substr(start_fn, found - start_fn + 1);
directory = "/fileserver" + directory;
ESP_LOGD(TAG, "Directory danach 4: %s", directory.c_str());
}
//////////////////////////////////////////////////////////////
/* Redirect onto root to see the updated file list */
if (strcmp(filename, "/config/config.ini") == 0 ||
strcmp(filename, "/config/ref0.jpg") == 0 ||
strcmp(filename, "/config/ref0_org.jpg") == 0 ||
strcmp(filename, "/config/ref1.jpg") == 0 ||
strcmp(filename, "/config/ref1_org.jpg") == 0 ||
strcmp(filename, "/config/reference.jpg") == 0 ||
strcmp(filename, "/img_tmp/ref0.jpg") == 0 ||
strcmp(filename, "/img_tmp/ref0_org.jpg") == 0 ||
strcmp(filename, "/img_tmp/ref1.jpg") == 0 ||
strcmp(filename, "/img_tmp/ref1_org.jpg") == 0 ||
strcmp(filename, "/img_tmp/reference.jpg") == 0 )
{
httpd_resp_set_status(req, HTTPD_200); // Avoid reloading of folder content
}
else {
httpd_resp_set_status(req, "303 See Other"); // Reload folder content after upload
}
}
//////////////////////////////////////////////////////////////
/* Redirect onto root to see the updated file list */
httpd_resp_set_status(req, "303 See Other");
httpd_resp_set_hdr(req, "Location", directory.c_str());
httpd_resp_sendstr(req, "File successfully deleted");
return ESP_OK;
}
void delete_all_in_directory(std::string _directory)
{
struct dirent *entry;
@@ -905,7 +947,7 @@ void delete_all_in_directory(std::string _directory)
closedir(dir);
}
std::string unzip_new(std::string _in_zip_file, std::string _target_zip, std::string _target_bin, std::string _main, bool _initial_setup)
std::string unzip_new(std::string _in_zip_file, std::string _html_tmp, std::string _html_final, std::string _target_bin, std::string _main, bool _initial_setup)
{
int i, sort_iter;
mz_bool status;
@@ -930,7 +972,7 @@ std::string unzip_new(std::string _in_zip_file, std::string _target_zip, std::st
// Get and print information about each file in the archive.
int numberoffiles = (int)mz_zip_reader_get_num_files(&zip_archive);
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "Numbers of files to be extracted: " + to_string(numberoffiles));
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "Files to be extracted: " + to_string(numberoffiles));
sort_iter = 0;
{
@@ -987,14 +1029,19 @@ std::string unzip_new(std::string _in_zip_file, std::string _target_zip, std::st
}
else
{
zw = _target_zip + zw;
zw = _html_tmp + zw;
}
}
// files in the html folder shall be redirected to the temporary html folder
if (zw.find(_html_final) == 0) {
FindReplace(zw, _html_final, _html_tmp);
}
string filename_zw = zw + SUFFIX_ZW;
ESP_LOGI(TAG, "Filename to extract: %s, Zwischenfilename: %s", zw.c_str(), filename_zw.c_str());
ESP_LOGI(TAG, "File to extract: %s, Temp. Filename: %s", zw.c_str(), filename_zw.c_str());
std::string folder = filename_zw.substr(0, filename_zw.find_last_of('/'));
MakeDir(folder);
@@ -1098,7 +1145,7 @@ void unzip(std::string _in_zip_file, std::string _target_directory){
// Save to File.
zw = std::string(archive_filename);
zw = _target_directory + zw;
ESP_LOGD(TAG, "Filename to extract: %s", zw.c_str());
ESP_LOGD(TAG, "File to extract: %s", zw.c_str());
FILE* fpTargetFile = fopen(zw.c_str(), "wb");
fwrite(p, 1, (uint)uncomp_size, fpTargetFile);
fclose(fpTargetFile);
@@ -1117,8 +1164,6 @@ void unzip(std::string _in_zip_file, std::string _target_directory){
ESP_LOGD(TAG, "Success.");
}
void register_server_file_uri(httpd_handle_t server, const char *base_path)
{
static struct file_server_data *server_data = NULL;
@@ -1144,8 +1189,6 @@ void register_server_file_uri(httpd_handle_t server, const char *base_path)
strlcpy(server_data->base_path, base_path,
sizeof(server_data->base_path));
/* URI handler for getting uploaded files */
// char zw[sizeof(serverprefix)+1];
// strcpy(zw, serverprefix);
@@ -1155,25 +1198,23 @@ void register_server_file_uri(httpd_handle_t server, const char *base_path)
httpd_uri_t file_download = {
.uri = "/fileserver*", // Match all URIs of type /path/to/file
.method = HTTP_GET,
.handler = download_get_handler,
.handler = APPLY_BASIC_AUTH_FILTER(download_get_handler),
.user_ctx = server_data // Pass server data as context
};
httpd_register_uri_handler(server, &file_download);
httpd_uri_t file_datafileact = {
.uri = "/datafileact", // Match all URIs of type /path/to/file
.method = HTTP_GET,
.handler = datafileact_get_full_handler,
.handler = APPLY_BASIC_AUTH_FILTER(datafileact_get_full_handler),
.user_ctx = server_data // Pass server data as context
};
httpd_register_uri_handler(server, &file_datafileact);
httpd_uri_t file_datafile_last_part_handle = {
.uri = "/data", // Match all URIs of type /path/to/file
.method = HTTP_GET,
.handler = datafileact_get_last_part_handler,
.handler = APPLY_BASIC_AUTH_FILTER(datafileact_get_last_part_handler),
.user_ctx = server_data // Pass server data as context
};
httpd_register_uri_handler(server, &file_datafile_last_part_handle);
@@ -1181,26 +1222,24 @@ void register_server_file_uri(httpd_handle_t server, const char *base_path)
httpd_uri_t file_logfileact = {
.uri = "/logfileact", // Match all URIs of type /path/to/file
.method = HTTP_GET,
.handler = logfileact_get_full_handler,
.handler = APPLY_BASIC_AUTH_FILTER(logfileact_get_full_handler),
.user_ctx = server_data // Pass server data as context
};
httpd_register_uri_handler(server, &file_logfileact);
httpd_uri_t file_logfile_last_part_handle = {
.uri = "/log", // Match all URIs of type /path/to/file
.method = HTTP_GET,
.handler = logfileact_get_last_part_handler,
.handler = APPLY_BASIC_AUTH_FILTER(logfileact_get_last_part_handler),
.user_ctx = server_data // Pass server data as context
};
httpd_register_uri_handler(server, &file_logfile_last_part_handle);
/* URI handler for uploading files to server */
httpd_uri_t file_upload = {
.uri = "/upload/*", // Match all URIs of type /upload/path/to/file
.method = HTTP_POST,
.handler = upload_post_handler,
.handler = APPLY_BASIC_AUTH_FILTER(upload_post_handler),
.user_ctx = server_data // Pass server data as context
};
httpd_register_uri_handler(server, &file_upload);
@@ -1209,9 +1248,8 @@ void register_server_file_uri(httpd_handle_t server, const char *base_path)
httpd_uri_t file_delete = {
.uri = "/delete/*", // Match all URIs of type /delete/path/to/file
.method = HTTP_POST,
.handler = delete_post_handler,
.handler = APPLY_BASIC_AUTH_FILTER(delete_post_handler),
.user_ctx = server_data // Pass server data as context
};
httpd_register_uri_handler(server, &file_delete);
}

View File

@@ -9,7 +9,7 @@
void register_server_file_uri(httpd_handle_t server, const char *base_path);
void unzip(std::string _in_zip_file, std::string _target_directory);
std::string unzip_new(std::string _in_zip_file, std::string _target_zip, std::string _target_bin, std::string _main = "/sdcard/", bool _initial_setup = false);
std::string unzip_new(std::string _in_zip_file, std::string _html_tmp, std::string _html_final, std::string _target_bin, std::string _main = "/sdcard/", bool _initial_setup = false);
void delete_all_in_directory(std::string _directory);

View File

@@ -16,71 +16,101 @@ extern "C" {
#include "esp_err.h"
#include "esp_log.h"
#include "Helper.h"
#include "esp_http_server.h"
#include "../../include/defines.h"
static const char *TAG = "SERVER HELP";
char scratch[SERVER_HELPER_SCRATCH_BUFSIZE];
bool endsWith(std::string const &str, std::string const &suffix) {
bool endsWith(std::string const &str, std::string const &suffix)
{
if (str.length() < suffix.length()) {
return false;
}
return str.compare(str.length() - suffix.length(), suffix.length(), suffix) == 0;
}
esp_err_t send_file(httpd_req_t *req, std::string filename)
{
std::string _filename_old = filename;
struct stat file_stat;
bool _gz_file_exists = false;
ESP_LOGD(TAG, "old filename: %s", filename.c_str());
std::string _filename_temp = std::string(filename) + ".gz";
// Checks whether the file is available as .gz
if (stat(_filename_temp.c_str(), &file_stat) == 0) {
filename = _filename_temp;
ESP_LOGD(TAG, "new filename: %s", filename.c_str());
_gz_file_exists = true;
}
FILE *fd = fopen(filename.c_str(), "r");
if (!fd) {
if (!fd) {
ESP_LOGE(TAG, "Failed to read file: %s", filename.c_str());
/* Respond with 404 Error */
httpd_resp_send_err(req, HTTPD_404_NOT_FOUND, get404());
return ESP_FAIL;
}
ESP_LOGD(TAG, "Sending file: %s ...", filename.c_str());
// httpd_resp_set_hdr(req, "Access-Control-Allow-Origin", "*");
/* For all files with the following file extention tell
the webbrowser to cache them for 24h */
/* For all files with the following file extention tell the webbrowser to cache them for 12h */
if (endsWith(filename, ".html") ||
endsWith(filename, ".htm") ||
endsWith(filename, ".xml") ||
endsWith(filename, ".css") ||
endsWith(filename, ".js") ||
endsWith(filename, ".map") ||
endsWith(filename, ".jpg") ||
endsWith(filename, ".jpeg") ||
endsWith(filename, ".ico") ||
endsWith(filename, ".png")) {
httpd_resp_set_hdr(req, "Cache-Control", "max-age=86400");
endsWith(filename, ".png") ||
endsWith(filename, ".gif") ||
// endsWith(filename, ".zip") ||
endsWith(filename, ".gz")) {
if (filename == "/sdcard/html/setup.html") {
httpd_resp_set_hdr(req, "Clear-Site-Data", "\"*\"");
set_content_type_from_file(req, filename.c_str());
}
else if (_gz_file_exists) {
httpd_resp_set_hdr(req, "Cache-Control", "max-age=43200");
httpd_resp_set_hdr(req, "Content-Encoding", "gzip");
set_content_type_from_file(req, _filename_old.c_str());
}
else {
httpd_resp_set_hdr(req, "Cache-Control", "max-age=43200");
set_content_type_from_file(req, filename.c_str());
}
}
else {
set_content_type_from_file(req, filename.c_str());
}
set_content_type_from_file(req, filename.c_str());
/* Retrieve the pointer to scratch buffer for temporary storage */
char *chunk = scratch;
size_t chunksize;
do {
do {
/* Read file in chunks into the scratch buffer */
chunksize = fread(chunk, 1, SERVER_HELPER_SCRATCH_BUFSIZE, fd);
/* Send the buffer contents as HTTP response chunk */
if (httpd_resp_send_chunk(req, chunk, chunksize) != ESP_OK) {
if (httpd_resp_send_chunk(req, chunk, chunksize) != ESP_OK) {
fclose(fd);
ESP_LOGE(TAG, "File sending failed!");
/* Abort sending file */
httpd_resp_sendstr_chunk(req, NULL);
/* Respond with 500 Internal Server Error */
httpd_resp_send_err(req, HTTPD_500_INTERNAL_SERVER_ERROR, "Failed to send file");
return ESP_FAIL;
}
@@ -89,13 +119,11 @@ esp_err_t send_file(httpd_req_t *req, std::string filename)
/* Close file after sending complete */
fclose(fd);
ESP_LOGD(TAG, "File sending complete");
ESP_LOGD(TAG, "File sending complete");
return ESP_OK;
}
/* Copies the full path into destination buffer and returns
* pointer to path (skipping the preceding base path) */
const char* get_path_from_uri(char *dest, const char *base_path, const char *uri, size_t destsize)
@@ -125,25 +153,49 @@ const char* get_path_from_uri(char *dest, const char *base_path, const char *uri
return dest + base_pathlen;
}
/* Set HTTP response content type according to file extension */
esp_err_t set_content_type_from_file(httpd_req_t *req, const char *filename)
{
if (IS_FILE_EXT(filename, ".pdf")) {
return httpd_resp_set_type(req, "application/pdf");
} else if (IS_FILE_EXT(filename, ".html")) {
return httpd_resp_set_type(req, "application/x-pdf");
}
else if (IS_FILE_EXT(filename, ".htm")) {
return httpd_resp_set_type(req, "text/html");
} else if (IS_FILE_EXT(filename, ".jpeg")) {
}
else if (IS_FILE_EXT(filename, ".html")) {
return httpd_resp_set_type(req, "text/html");
}
else if (IS_FILE_EXT(filename, ".jpeg")) {
return httpd_resp_set_type(req, "image/jpeg");
} else if (IS_FILE_EXT(filename, ".jpg")) {
}
else if (IS_FILE_EXT(filename, ".jpg")) {
return httpd_resp_set_type(req, "image/jpeg");
} else if (IS_FILE_EXT(filename, ".ico")) {
}
else if (IS_FILE_EXT(filename, ".gif")) {
return httpd_resp_set_type(req, "image/gif");
}
else if (IS_FILE_EXT(filename, ".png")) {
return httpd_resp_set_type(req, "image/png");
}
else if (IS_FILE_EXT(filename, ".ico")) {
return httpd_resp_set_type(req, "image/x-icon");
} else if (IS_FILE_EXT(filename, ".js")) {
return httpd_resp_set_type(req, "text/javascript");
} else if (IS_FILE_EXT(filename, ".css")) {
}
else if (IS_FILE_EXT(filename, ".js")) {
return httpd_resp_set_type(req, "application/javascript");
}
else if (IS_FILE_EXT(filename, ".css")) {
return httpd_resp_set_type(req, "text/css");
}
else if (IS_FILE_EXT(filename, ".xml")) {
return httpd_resp_set_type(req, "text/xml");
}
else if (IS_FILE_EXT(filename, ".zip")) {
return httpd_resp_set_type(req, "application/x-zip");
}
else if (IS_FILE_EXT(filename, ".gz")) {
return httpd_resp_set_type(req, "application/x-gzip");
}
/* This is a limited set only */
/* For any other type always set as plain text */
return httpd_resp_set_type(req, "text/plain");

View File

@@ -3,7 +3,10 @@
#include <string>
#include "string.h"
#include <esp_int_wdt.h>
/* TODO Rethink the usage of the int watchdog. It is no longer to be used, see
https://docs.espressif.com/projects/esp-idf/en/latest/esp32/migration-guides/release-5.x/5.0/system.html?highlight=esp_int_wdt */
#include "esp_private/esp_int_wdt.h"
#include <esp_task_wdt.h>
@@ -11,14 +14,13 @@
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_system.h"
#include "esp_event.h"
#include "esp_event.h"
#include "esp_log.h"
#include <esp_ota_ops.h>
#include "esp_http_client.h"
#include "esp_flash_partitions.h"
#include "esp_partition.h"
#include <nvs.h>
#include "esp_app_format.h"
#include "nvs_flash.h"
#include "driver/gpio.h"
// #include "protocol_examples_common.h"
@@ -26,7 +28,7 @@
#include <sys/stat.h>
#include "server_tflite.h"
#include "MainFlowControl.h"
#include "server_file.h"
#include "server_GPIO.h"
#ifdef ENABLE_MQTT
@@ -40,6 +42,7 @@
#include "Helper.h"
#include "statusled.h"
#include "basic_auth.h"
#include "../../include/defines.h"
/*an ota data write buffer ready to write to the flash*/
@@ -73,20 +76,35 @@ void task_do_Update_ZIP(void *pvParameter)
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "File: " + _file_name_update + " Filetype: " + filetype);
if (filetype == "ZIP")
{
std::string in, out, outbin, zw, retfirmware;
std::string in, outHtml, outHtmlTmp, outHtmlOld, outbin, zw, retfirmware;
out = "/sdcard/html";
outHtml = "/sdcard/html";
outHtmlTmp = "/sdcard/html_tmp";
outHtmlOld = "/sdcard/html_old";
outbin = "/sdcard/firmware";
retfirmware = unzip_new(_file_name_update, out+"/", outbin+"/", "/sdcard/", initial_setup);
/* Remove the old and tmp html folder in case they still exist */
removeFolder(outHtmlTmp.c_str(), TAG);
removeFolder(outHtmlOld.c_str(), TAG);
/* Extract the ZIP file. The content of the html folder gets extracted to the temporar folder html-temp. */
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "Extracting ZIP file " + _file_name_update + "...");
retfirmware = unzip_new(_file_name_update, outHtmlTmp+"/", outHtml+"/", outbin+"/", "/sdcard/", initial_setup);
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "Files unzipped.");
/* ZIP file got extracted, replace the old html folder with the new one */
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "Renaming folder " + outHtml + " to " + outHtmlOld + "...");
RenameFolder(outHtml, outHtmlOld);
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "Renaming folder " + outHtmlTmp + " to " + outHtml + "...");
RenameFolder(outHtmlTmp, outHtml);
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "Deleting folder " + outHtmlOld + "...");
removeFolder(outHtmlOld.c_str(), TAG);
if (retfirmware.length() > 0)
{
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "Found firmware.bin");
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "Found firmware.bin");
ota_update_task(retfirmware);
}
@@ -157,12 +175,12 @@ static bool ota_update_task(std::string fn)
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "(This can happen if either the OTA boot data or preferred boot image become somehow corrupted.)");
}
ESP_LOGI(TAG, "Running partition type %d subtype %d (offset 0x%08x)",
running->type, running->subtype, running->address);
running->type, running->subtype, (unsigned int)running->address);
update_partition = esp_ota_get_next_update_partition(NULL);
ESP_LOGI(TAG, "Writing to partition subtype %d at offset 0x%x",
update_partition->subtype, update_partition->address);
update_partition->subtype, (unsigned int)update_partition->address);
// assert(update_partition != NULL);
int binary_file_length = 0;
@@ -431,7 +449,6 @@ esp_err_t handler_ota_update(httpd_req_t *req)
return ESP_OK;
}
if ((filetype == "TFLITE") || (filetype == "TFL"))
{
std::string out = "/sdcard/config/" + getFileFullFileName(fn);
@@ -467,7 +484,7 @@ esp_err_t handler_ota_update(httpd_req_t *req)
{
const char* resp_str;
KillTFliteTasks();
DeleteMainFlowTask();
gpio_handler_deinit();
if (ota_update_task(fn))
{
@@ -546,7 +563,7 @@ esp_err_t handler_ota_update(httpd_req_t *req)
/*
const char* resp_str;
KillTFliteTasks();
DeleteMainFlowTask();
gpio_handler_deinit();
if (ota_update_task(fn))
{
@@ -570,13 +587,19 @@ esp_err_t handler_ota_update(httpd_req_t *req)
void hard_restart()
{
esp_task_wdt_init(1,true);
esp_task_wdt_config_t twdt_config = {
.timeout_ms = 1,
.idle_core_mask = (1 << portNUM_PROCESSORS) - 1, // Bitmask of all cores
.trigger_panic = true,
};
ESP_ERROR_CHECK(esp_task_wdt_init(&twdt_config));
esp_task_wdt_add(NULL);
while(true);
}
void task_reboot(void *KillAutoFlow)
void task_reboot(void *DeleteMainFlow)
{
// write a reboot, to identify a reboot by purpouse
FILE* pfile = fopen("/sdcard/reboot.txt", "w");
@@ -586,8 +609,8 @@ void task_reboot(void *KillAutoFlow)
vTaskDelay(3000 / portTICK_PERIOD_MS);
if ((bool)KillAutoFlow) {
KillTFliteTasks(); // Kill autoflow task if executed in extra task, if not don't kill parent task
if ((bool)DeleteMainFlow) {
DeleteMainFlowTask(); // Kill autoflow task if executed in extra task, if not don't kill parent task
}
Camera.LightOnOff(false);
@@ -617,7 +640,7 @@ void doReboot()
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "Reboot triggered by Software (5s)");
LogFile.WriteToFile(ESP_LOG_WARN, TAG, "Reboot in 5sec");
BaseType_t xReturned = xTaskCreate(&task_reboot, "task_reboot", configMINIMAL_STACK_SIZE * 3, (void*) true, 10, NULL);
BaseType_t xReturned = xTaskCreate(&task_reboot, "task_reboot", configMINIMAL_STACK_SIZE * 4, (void*) true, 10, NULL);
if( xReturned != pdPASS )
{
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "task_reboot not created -> force reboot without killing flow");
@@ -682,13 +705,13 @@ void register_server_ota_sdcard_uri(httpd_handle_t server)
httpd_uri_t camuri = { };
camuri.method = HTTP_GET;
camuri.uri = "/ota";
camuri.handler = handler_ota_update;
camuri.handler = APPLY_BASIC_AUTH_FILTER(handler_ota_update);
camuri.user_ctx = (void*) "Do OTA";
httpd_register_uri_handler(server, &camuri);
camuri.method = HTTP_GET;
camuri.uri = "/reboot";
camuri.handler = handler_reboot;
camuri.handler = APPLY_BASIC_AUTH_FILTER(handler_reboot);
camuri.user_ctx = (void*) "Reboot";
httpd_register_uri_handler(server, &camuri);

View File

@@ -2,6 +2,6 @@ FILE(GLOB_RECURSE app_sources ${CMAKE_CURRENT_SOURCE_DIR}/*.*)
idf_component_register(SRCS ${app_sources}
INCLUDE_DIRS "."
REQUIRES 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)

View File

@@ -67,11 +67,6 @@ string ClassFlow::getHTMLSingleStep(string host){
return "";
}
string ClassFlow::getReadout()
{
return string();
}
std::string ClassFlow::GetParameterName(std::string _input)
{
string _param;

View File

@@ -46,7 +46,6 @@ public:
virtual bool ReadParameter(FILE* pfile, string &aktparamgraph);
virtual bool doFlow(string time);
virtual string getHTMLSingleStep(string host);
virtual string getReadout();
virtual string name(){return "ClassFlow";};
};

View File

@@ -1,392 +1,374 @@
#include "ClassFlowAlignment.h"
#include "ClassFlowTakeImage.h"
#include "ClassFlow.h"
#include "server_tflite.h"
#include "CRotateImage.h"
#include "esp_log.h"
#include "ClassLogFile.h"
#include "../../include/defines.h"
static const char *TAG = "ALIGN";
// #define DEBUG_DETAIL_ON
void ClassFlowAlignment::SetInitialParameter(void)
{
initalrotate = 0;
anz_ref = 0;
initialmirror = false;
use_antialiasing = false;
initialflip = false;
SaveAllFiles = false;
namerawimage = "/sdcard/img_tmp/raw.jpg";
FileStoreRefAlignment = "/sdcard/config/align.txt";
ListFlowControll = NULL;
AlignAndCutImage = NULL;
ImageBasis = NULL;
ImageTMP = NULL;
#ifdef ALGROI_LOAD_FROM_MEM_AS_JPG
AlgROI = (ImageData*)heap_caps_malloc(sizeof(ImageData), MALLOC_CAP_8BIT | MALLOC_CAP_SPIRAM);
#endif
previousElement = NULL;
disabled = false;
SAD_criteria = 0.05;
}
ClassFlowAlignment::ClassFlowAlignment(std::vector<ClassFlow*>* lfc)
{
SetInitialParameter();
ListFlowControll = lfc;
for (int i = 0; i < ListFlowControll->size(); ++i)
{
if (((*ListFlowControll)[i])->name().compare("ClassFlowTakeImage") == 0)
{
ImageBasis = ((ClassFlowTakeImage*) (*ListFlowControll)[i])->rawImage;
}
}
if (!ImageBasis) // the function take pictures does not exist --> must be created first ONLY FOR TEST PURPOSES
{
ESP_LOGD(TAG, "CImageBasis had to be created");
ImageBasis = new CImageBasis(namerawimage);
}
}
bool ClassFlowAlignment::ReadParameter(FILE* pfile, string& aktparamgraph)
{
std::vector<string> splitted;
int suchex = 40;
int suchey = 40;
int alg_algo = 0; //default=0; 1 =HIGHACCURACY; 2= FAST; 3= OFF //add disable aligment algo |01.2023
aktparamgraph = trim(aktparamgraph);
if (aktparamgraph.size() == 0)
if (!this->GetNextParagraph(pfile, aktparamgraph))
return false;
if (aktparamgraph.compare("[Alignment]") != 0) //Paragraph does not fit Alignment
return false;
while (this->getNextLine(pfile, &aktparamgraph) && !this->isNewParagraph(aktparamgraph))
{
splitted = ZerlegeZeile(aktparamgraph);
if ((toUpper(splitted[0]) == "FLIPIMAGESIZE") && (splitted.size() > 1))
{
if (toUpper(splitted[1]) == "TRUE")
initialflip = true;
}
if ((toUpper(splitted[0]) == "INITIALMIRROR") && (splitted.size() > 1))
{
if (toUpper(splitted[1]) == "TRUE")
initialmirror = true;
}
if (((toUpper(splitted[0]) == "INITALROTATE") || (toUpper(splitted[0]) == "INITIALROTATE")) && (splitted.size() > 1))
{
this->initalrotate = std::stod(splitted[1]);
}
if ((toUpper(splitted[0]) == "SEARCHFIELDX") && (splitted.size() > 1))
{
suchex = std::stod(splitted[1]);
}
if ((toUpper(splitted[0]) == "SEARCHFIELDY") && (splitted.size() > 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))
{
References[anz_ref].image_file = FormatFileName("/sdcard" + splitted[0]);
References[anz_ref].target_x = std::stod(splitted[1]);
References[anz_ref].target_y = std::stod(splitted[2]);
anz_ref++;
}
if ((toUpper(splitted[0]) == "SAVEALLFILES") && (splitted.size() > 1))
{
if (toUpper(splitted[1]) == "TRUE")
SaveAllFiles = true;
}
if ((toUpper(splitted[0]) == "ALIGNMENTALGO") && (splitted.size() > 1))
{
#ifdef DEBUG_DETAIL_ON
std::string zw2 = "Alignment mode selected: " + splitted[1];
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, zw2);
#endif
if (toUpper(splitted[1]) == "HIGHACCURACY")
alg_algo = 1;
if (toUpper(splitted[1]) == "FAST")
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
alg_algo = 3;
}
}
for (int i = 0; i < anz_ref; ++i)
{
References[i].search_x = suchex;
References[i].search_y = suchey;
References[i].fastalg_SAD_criteria = SAD_criteria;
References[i].alignment_algo = alg_algo;
#ifdef DEBUG_DETAIL_ON
std::string zw2 = "Alignment mode written: " + std::to_string(alg_algo);
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, zw2);
#endif
}
//no align algo if set to 3 = off => no draw ref //add disable aligment algo |01.2023
if(References[0].alignment_algo != 3){
LoadReferenceAlignmentValues();
}
return true;
}
string ClassFlowAlignment::getHTMLSingleStep(string host)
{
string result;
result = "<p>Rotated Image: </p> <p><img src=\"" + host + "/img_tmp/rot.jpg\"></p>\n";
result = result + "<p>Found Alignment: </p> <p><img src=\"" + host + "/img_tmp/rot_roi.jpg\"></p>\n";
result = result + "<p>Aligned Image: </p> <p><img src=\"" + host + "/img_tmp/alg.jpg\"></p>\n";
return result;
}
bool ClassFlowAlignment::doFlow(string time)
{
#ifdef ALGROI_LOAD_FROM_MEM_AS_JPG
if (!AlgROI) // AlgROI needs to be allocated before ImageTMP to avoid heap fragmentation
{
AlgROI = (ImageData*)heap_caps_realloc(AlgROI, sizeof(ImageData), MALLOC_CAP_8BIT | MALLOC_CAP_SPIRAM);
if (!AlgROI)
{
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Can't allocate AlgROI");
LogFile.WriteHeapInfo("ClassFlowAlignment-doFlow");
}
}
if (AlgROI)
{
ImageBasis->writeToMemoryAsJPG((ImageData*)AlgROI, 90);
}
#endif
if (!ImageTMP)
{
ImageTMP = new CImageBasis(ImageBasis);
if (!ImageTMP)
{
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Can't allocate ImageTMP -> Exec this round aborted!");
LogFile.WriteHeapInfo("ClassFlowAlignment-doFlow");
return false;
}
}
delete AlignAndCutImage;
AlignAndCutImage = new CAlignAndCutImage(ImageBasis, ImageTMP);
if (!AlignAndCutImage)
{
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Can't allocate AlignAndCutImage -> Exec this round aborted!");
LogFile.WriteHeapInfo("ClassFlowAlignment-doFlow");
return false;
}
CRotateImage rt(AlignAndCutImage, ImageTMP, initialflip);
if (initialflip)
{
int _zw = ImageBasis->height;
ImageBasis->height = ImageBasis->width;
ImageBasis->width = _zw;
_zw = ImageTMP->width;
ImageTMP->width = ImageTMP->height;
ImageTMP->height = _zw;
}
if (initialmirror)
{
ESP_LOGD(TAG, "do mirror");
rt.Mirror();
if (SaveAllFiles)
AlignAndCutImage->SaveToFile(FormatFileName("/sdcard/img_tmp/mirror.jpg"));
}
if ((initalrotate != 0) || initialflip)
{
if (use_antialiasing)
rt.RotateAntiAliasing(initalrotate);
else
rt.Rotate(initalrotate);
if (SaveAllFiles)
AlignAndCutImage->SaveToFile(FormatFileName("/sdcard/img_tmp/rot.jpg"));
}
//no align algo if set to 3 = off //add disable aligment algo |01.2023
if(References[0].alignment_algo != 3){
if (!AlignAndCutImage->Align(&References[0], &References[1]))
{
SaveReferenceAlignmentValues();
}
}// no align
#ifdef ALGROI_LOAD_FROM_MEM_AS_JPG
if (AlgROI) {
//no align algo if set to 3 = off => no draw ref //add disable aligment algo |01.2023
if(References[0].alignment_algo != 3){
DrawRef(ImageTMP);
}
tfliteflow.DigitalDrawROI(ImageTMP);
tfliteflow.AnalogDrawROI(ImageTMP);
ImageTMP->writeToMemoryAsJPG((ImageData*)AlgROI, 90);
}
#endif
if (SaveAllFiles)
{
AlignAndCutImage->SaveToFile(FormatFileName("/sdcard/img_tmp/alg.jpg"));
ImageTMP->SaveToFile(FormatFileName("/sdcard/img_tmp/alg_roi.jpg"));
}
// must be deleted to have memory space for loading tflite
delete ImageTMP;
ImageTMP = NULL;
//no align algo if set to 3 = off => no draw ref //add disable aligment algo |01.2023
if(References[0].alignment_algo != 3){
LoadReferenceAlignmentValues();
}
return true;
}
void ClassFlowAlignment::SaveReferenceAlignmentValues()
{
FILE* pFile;
std::string zwtime, zwvalue;
pFile = fopen(FileStoreRefAlignment.c_str(), "w");
if (strlen(zwtime.c_str()) == 0)
{
time_t rawtime;
struct tm* timeinfo;
char buffer[80];
time(&rawtime);
timeinfo = localtime(&rawtime);
strftime(buffer, 80, "%Y-%m-%dT%H:%M:%S", timeinfo);
zwtime = std::string(buffer);
}
fputs(zwtime.c_str(), pFile);
fputs("\n", pFile);
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_max)+ "\t" +std::to_string(References[0].fastalg_avg);
fputs(zwvalue.c_str(), pFile);
fputs("\n", pFile);
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_max)+ "\t" +std::to_string(References[1].fastalg_avg);
fputs(zwvalue.c_str(), pFile);
fputs("\n", pFile);
fclose(pFile);
}
bool ClassFlowAlignment::LoadReferenceAlignmentValues(void)
{
FILE* pFile;
char zw[1024];
string zwvalue;
std::vector<string> splitted;
pFile = fopen(FileStoreRefAlignment.c_str(), "r");
if (pFile == NULL)
return false;
fgets(zw, 1024, pFile);
ESP_LOGD(TAG, "%s", zw);
fgets(zw, 1024, pFile);
splitted = ZerlegeZeile(std::string(zw), " \t");
if (splitted.size() < 6)
{
fclose(pFile);
return false;
}
References[0].fastalg_x = stoi(splitted[0]);
References[0].fastalg_y = stoi(splitted[1]);
References[0].fastalg_SAD = stof(splitted[2]);
References[0].fastalg_min = stoi(splitted[3]);
References[0].fastalg_max = stoi(splitted[4]);
References[0].fastalg_avg = stof(splitted[5]);
fgets(zw, 1024, pFile);
splitted = ZerlegeZeile(std::string(zw));
if (splitted.size() < 6)
{
fclose(pFile);
return false;
}
References[1].fastalg_x = stoi(splitted[0]);
References[1].fastalg_y = stoi(splitted[1]);
References[1].fastalg_SAD = stof(splitted[2]);
References[1].fastalg_min = stoi(splitted[3]);
References[1].fastalg_max = stoi(splitted[4]);
References[1].fastalg_avg = stof(splitted[5]);
fclose(pFile);
/*#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);
_zw = _zw + "\tSAD, min, max, avg:\t" + std::to_string(References[0].fastalg_SAD) + "\t" + std::to_string(References[0].fastalg_min);
_zw = _zw + "\t" + std::to_string(References[0].fastalg_max) + "\t" + std::to_string(References[0].fastalg_avg);
LogFile.WriteToDedicatedFile("/sdcard/alignment.txt", _zw);
_zw = "\tLoadReferences[1]\tx,y:\t" + std::to_string(References[1].fastalg_x) + "\t" + std::to_string(References[1].fastalg_x);
_zw = _zw + "\tSAD, min, max, avg:\t" + std::to_string(References[1].fastalg_SAD) + "\t" + std::to_string(References[1].fastalg_min);
_zw = _zw + "\t" + std::to_string(References[1].fastalg_max) + "\t" + std::to_string(References[1].fastalg_avg);
LogFile.WriteToDedicatedFile("/sdcard/alignment.txt", _zw);
#endif*/
return true;
}
void ClassFlowAlignment::DrawRef(CImageBasis *_zw)
{
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[1].target_x, References[1].target_y, References[1].width, References[1].height, 255, 0, 0, 2);
}
}
#include "ClassFlowAlignment.h"
#include "ClassFlowTakeImage.h"
#include "ClassFlow.h"
#include "MainFlowControl.h"
#include "CRotateImage.h"
#include "esp_log.h"
#include "ClassLogFile.h"
#include "psram.h"
#include "../../include/defines.h"
static const char *TAG = "ALIGN";
// #define DEBUG_DETAIL_ON
void ClassFlowAlignment::SetInitialParameter(void)
{
initialrotate = 0;
anz_ref = 0;
use_antialiasing = false;
initialflip = false;
SaveAllFiles = false;
namerawimage = "/sdcard/img_tmp/raw.jpg";
FileStoreRefAlignment = "/sdcard/config/align.txt";
ListFlowControll = NULL;
AlignAndCutImage = NULL;
ImageBasis = NULL;
ImageTMP = NULL;
#ifdef ALGROI_LOAD_FROM_MEM_AS_JPG
AlgROI = (ImageData *)malloc_psram_heap(std::string(TAG) + "->AlgROI", sizeof(ImageData), MALLOC_CAP_8BIT | MALLOC_CAP_SPIRAM);
#endif
previousElement = NULL;
disabled = false;
SAD_criteria = 0.05;
}
ClassFlowAlignment::ClassFlowAlignment(std::vector<ClassFlow *> *lfc)
{
SetInitialParameter();
ListFlowControll = lfc;
for (int i = 0; i < ListFlowControll->size(); ++i) {
if (((*ListFlowControll)[i])->name().compare("ClassFlowTakeImage") == 0) {
ImageBasis = ((ClassFlowTakeImage *)(*ListFlowControll)[i])->rawImage;
}
}
// 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");
ImageBasis = new CImageBasis("ImageBasis", namerawimage);
}
}
bool ClassFlowAlignment::ReadParameter(FILE *pfile, string &aktparamgraph)
{
std::vector<string> splitted;
int suchex = 40;
int suchey = 40;
int alg_algo = 0; // default=0; 1 =HIGHACCURACY; 2= FAST; 3= OFF //add disable aligment algo |01.2023
aktparamgraph = trim(aktparamgraph);
if (aktparamgraph.size() == 0)
{
if (!this->GetNextParagraph(pfile, aktparamgraph)) {
return false;
}
}
if (aktparamgraph.compare("[Alignment]") != 0)
{
// Paragraph does not fit Alignment
return false;
}
while (this->getNextLine(pfile, &aktparamgraph) && !this->isNewParagraph(aktparamgraph))
{
splitted = ZerlegeZeile(aktparamgraph);
if ((toUpper(splitted[0]) == "FLIPIMAGESIZE") && (splitted.size() > 1)) {
initialflip = alphanumericToBoolean(splitted[1]);
}
else if (((toUpper(splitted[0]) == "initialrotate") || (toUpper(splitted[0]) == "INITIALROTATE")) && (splitted.size() > 1)) {
if (isStringNumeric(splitted[1])) {
this->initialrotate = std::stod(splitted[1]);
}
}
else if ((toUpper(splitted[0]) == "SEARCHFIELDX") && (splitted.size() > 1)) {
if (isStringNumeric(splitted[1])) {
suchex = std::stod(splitted[1]);
}
}
else if ((toUpper(splitted[0]) == "SEARCHFIELDY") && (splitted.size() > 1)) {
if (isStringNumeric(splitted[1])) {
suchey = std::stod(splitted[1]);
}
}
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].target_x = std::stod(splitted[1]);
References[anz_ref].target_y = std::stod(splitted[2]);
anz_ref++;
}
else
{
References[anz_ref].image_file = FormatFileName("/sdcard" + splitted[0]);
References[anz_ref].target_x = 10;
References[anz_ref].target_y = 10;
anz_ref++;
}
}
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];
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, zw2);
#endif
if (toUpper(splitted[1]) == "HIGHACCURACY") {
alg_algo = 1;
}
if (toUpper(splitted[1]) == "FAST") {
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
alg_algo = 3;
}
}
}
for (int i = 0; i < anz_ref; ++i) {
References[i].search_x = suchex;
References[i].search_y = suchey;
References[i].fastalg_SAD_criteria = SAD_criteria;
References[i].alignment_algo = alg_algo;
#ifdef DEBUG_DETAIL_ON
std::string zw2 = "Alignment mode written: " + std::to_string(alg_algo);
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, zw2);
#endif
}
// no align algo if set to 3 = off => no draw ref //add disable aligment algo |01.2023
if (References[0].alignment_algo != 3) {
return LoadReferenceAlignmentValues();
}
return true;
}
string ClassFlowAlignment::getHTMLSingleStep(string host)
{
string result;
result = "<p>Rotated Image: </p> <p><img src=\"" + host + "/img_tmp/rot.jpg\"></p>\n";
result = result + "<p>Found Alignment: </p> <p><img src=\"" + host + "/img_tmp/rot_roi.jpg\"></p>\n";
result = result + "<p>Aligned Image: </p> <p><img src=\"" + host + "/img_tmp/alg.jpg\"></p>\n";
return result;
}
bool ClassFlowAlignment::doFlow(string time)
{
#ifdef ALGROI_LOAD_FROM_MEM_AS_JPG
// 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);
if (!AlgROI) {
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Can't allocate AlgROI");
LogFile.WriteHeapInfo("ClassFlowAlignment-doFlow");
}
}
if (AlgROI) {
ImageBasis->writeToMemoryAsJPG((ImageData *)AlgROI, 90);
}
#endif
if (!ImageTMP) {
ImageTMP = new CImageBasis("tmpImage", ImageBasis); // Make sure the name does not get change, it is relevant for the PSRAM allocation!
if (!ImageTMP) {
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Can't allocate tmpImage -> Exec this round aborted!");
LogFile.WriteHeapInfo("ClassFlowAlignment-doFlow");
return false;
}
}
delete AlignAndCutImage;
AlignAndCutImage = new CAlignAndCutImage("AlignAndCutImage", ImageBasis, ImageTMP);
if (!AlignAndCutImage) {
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Can't allocate AlignAndCutImage -> Exec this round aborted!");
LogFile.WriteHeapInfo("ClassFlowAlignment-doFlow");
return false;
}
CRotateImage rt("rawImage", AlignAndCutImage, ImageTMP, initialflip);
if (initialflip) {
int _zw = ImageBasis->height;
ImageBasis->height = ImageBasis->width;
ImageBasis->width = _zw;
_zw = ImageTMP->width;
ImageTMP->width = ImageTMP->height;
ImageTMP->height = _zw;
}
if ((initialrotate != 0) || initialflip) {
if (use_antialiasing) {
rt.RotateAntiAliasing(initialrotate);
}
else {
rt.Rotate(initialrotate);
}
if (SaveAllFiles) {
AlignAndCutImage->SaveToFile(FormatFileName("/sdcard/img_tmp/rot.jpg"));
}
}
// no align algo if set to 3 = off //add disable aligment algo |01.2023
if (References[0].alignment_algo != 3) {
if (!AlignAndCutImage->Align(&References[0], &References[1])) {
SaveReferenceAlignmentValues();
}
} // no align
#ifdef ALGROI_LOAD_FROM_MEM_AS_JPG
if (AlgROI) {
// no align algo if set to 3 = off => no draw ref //add disable aligment algo |01.2023
if (References[0].alignment_algo != 3) {
DrawRef(ImageTMP);
}
flowctrl.DigitDrawROI(ImageTMP);
flowctrl.AnalogDrawROI(ImageTMP);
ImageTMP->writeToMemoryAsJPG((ImageData *)AlgROI, 90);
}
#endif
if (SaveAllFiles) {
AlignAndCutImage->SaveToFile(FormatFileName("/sdcard/img_tmp/alg.jpg"));
ImageTMP->SaveToFile(FormatFileName("/sdcard/img_tmp/alg_roi.jpg"));
}
// must be deleted to have memory space for loading tflite
delete ImageTMP;
ImageTMP = NULL;
// no align algo if set to 3 = off => no draw ref //add disable aligment algo |01.2023
if (References[0].alignment_algo != 3) {
return LoadReferenceAlignmentValues();
}
return true;
}
void ClassFlowAlignment::SaveReferenceAlignmentValues()
{
FILE *pFile;
std::string zwtime, zwvalue;
pFile = fopen(FileStoreRefAlignment.c_str(), "w");
if (strlen(zwtime.c_str()) == 0) {
time_t rawtime;
struct tm *timeinfo;
char buffer[80];
time(&rawtime);
timeinfo = localtime(&rawtime);
strftime(buffer, 80, "%Y-%m-%dT%H:%M:%S", timeinfo);
zwtime = std::string(buffer);
}
fputs(zwtime.c_str(), pFile);
fputs("\n", pFile);
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_max) + "\t" + std::to_string(References[0].fastalg_avg);
fputs(zwvalue.c_str(), pFile);
fputs("\n", pFile);
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_max) + "\t" + std::to_string(References[1].fastalg_avg);
fputs(zwvalue.c_str(), pFile);
fputs("\n", pFile);
fclose(pFile);
}
bool ClassFlowAlignment::LoadReferenceAlignmentValues(void)
{
FILE *pFile;
char zw[1024];
string zwvalue;
std::vector<string> splitted;
pFile = fopen(FileStoreRefAlignment.c_str(), "r");
if (pFile == NULL) {
return false;
}
fgets(zw, 1024, pFile);
ESP_LOGD(TAG, "%s", zw);
fgets(zw, 1024, pFile);
splitted = ZerlegeZeile(std::string(zw), " \t");
if (splitted.size() < 6) {
fclose(pFile);
return false;
}
References[0].fastalg_x = stoi(splitted[0]);
References[0].fastalg_y = stoi(splitted[1]);
References[0].fastalg_SAD = stof(splitted[2]);
References[0].fastalg_min = stoi(splitted[3]);
References[0].fastalg_max = stoi(splitted[4]);
References[0].fastalg_avg = stof(splitted[5]);
fgets(zw, 1024, pFile);
splitted = ZerlegeZeile(std::string(zw));
if (splitted.size() < 6) {
fclose(pFile);
return false;
}
References[1].fastalg_x = stoi(splitted[0]);
References[1].fastalg_y = stoi(splitted[1]);
References[1].fastalg_SAD = stof(splitted[2]);
References[1].fastalg_min = stoi(splitted[3]);
References[1].fastalg_max = stoi(splitted[4]);
References[1].fastalg_avg = stof(splitted[5]);
fclose(pFile);
/*#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);
_zw = _zw + "\tSAD, min, max, avg:\t" + std::to_string(References[0].fastalg_SAD) + "\t" + std::to_string(References[0].fastalg_min);
_zw = _zw + "\t" + std::to_string(References[0].fastalg_max) + "\t" + std::to_string(References[0].fastalg_avg);
LogFile.WriteToDedicatedFile("/sdcard/alignment.txt", _zw);
_zw = "\tLoadReferences[1]\tx,y:\t" + std::to_string(References[1].fastalg_x) + "\t" + std::to_string(References[1].fastalg_x);
_zw = _zw + "\tSAD, min, max, avg:\t" + std::to_string(References[1].fastalg_SAD) + "\t" + std::to_string(References[1].fastalg_min);
_zw = _zw + "\t" + std::to_string(References[1].fastalg_max) + "\t" + std::to_string(References[1].fastalg_avg);
LogFile.WriteToDedicatedFile("/sdcard/alignment.txt", _zw);
#endif*/
return true;
}
void ClassFlowAlignment::DrawRef(CImageBasis *_zw)
{
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[1].target_x, References[1].target_y, References[1].width, References[1].height, 255, 0, 0, 2);
}
}

View File

@@ -1,54 +1,51 @@
#pragma once
#ifndef CLASSFLOWALIGNMENT_H
#define CLASSFLOWALIGNMENT_H
#include "ClassFlow.h"
#include "Helper.h"
#include "CAlignAndCutImage.h"
#include "CFindTemplate.h"
#include <string>
using namespace std;
class ClassFlowAlignment :
public ClassFlow
{
protected:
float initalrotate;
bool initialmirror;
bool initialflip;
bool use_antialiasing;
RefInfo References[2];
int anz_ref;
string namerawimage;
bool SaveAllFiles;
CAlignAndCutImage *AlignAndCutImage;
std::string FileStoreRefAlignment;
float SAD_criteria;
void SetInitialParameter(void);
bool LoadReferenceAlignmentValues(void);
void SaveReferenceAlignmentValues();
public:
CImageBasis *ImageBasis, *ImageTMP;
#ifdef ALGROI_LOAD_FROM_MEM_AS_JPG
ImageData *AlgROI;
#endif
ClassFlowAlignment(std::vector<ClassFlow*>* lfc);
CAlignAndCutImage* GetAlignAndCutImage(){return AlignAndCutImage;};
void DrawRef(CImageBasis *_zw);
bool ReadParameter(FILE* pfile, string& aktparamgraph);
bool doFlow(string time);
string getHTMLSingleStep(string host);
string name(){return "ClassFlowAlignment";};
};
#endif //CLASSFLOWALIGNMENT_H
#pragma once
#ifndef CLASSFLOWALIGNMENT_H
#define CLASSFLOWALIGNMENT_H
#include "ClassFlow.h"
#include "Helper.h"
#include "CAlignAndCutImage.h"
#include "CFindTemplate.h"
#include <string>
using namespace std;
class ClassFlowAlignment : public ClassFlow
{
protected:
float initialrotate;
bool initialflip;
bool use_antialiasing;
RefInfo References[2];
int anz_ref;
string namerawimage;
bool SaveAllFiles;
CAlignAndCutImage *AlignAndCutImage;
std::string FileStoreRefAlignment;
float SAD_criteria;
void SetInitialParameter(void);
bool LoadReferenceAlignmentValues(void);
void SaveReferenceAlignmentValues();
public:
CImageBasis *ImageBasis, *ImageTMP;
#ifdef ALGROI_LOAD_FROM_MEM_AS_JPG
ImageData *AlgROI;
#endif
ClassFlowAlignment(std::vector<ClassFlow *> *lfc);
CAlignAndCutImage *GetAlignAndCutImage() { return AlignAndCutImage; };
void DrawRef(CImageBasis *_zw);
bool ReadParameter(FILE *pfile, string &aktparamgraph);
bool doFlow(string time);
string getHTMLSingleStep(string host);
string name() { return "ClassFlowAlignment"; };
};
#endif // CLASSFLOWALIGNMENT_H

File diff suppressed because it is too large Load Diff

View File

@@ -11,10 +11,10 @@ enum t_CNNType {
AutoDetect,
Analogue,
Analogue100,
Digital,
DigitalHyprid10,
Digit,
DigitHyprid10,
DoubleHyprid10,
Digital100,
Digit100,
None
};
@@ -26,15 +26,6 @@ protected:
std::vector<general*> GENERAL;
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;
int modelxsize, modelysize, modelchannel;
bool isLogImageSelect;
@@ -44,8 +35,8 @@ protected:
bool SaveAllFiles;
int PointerEvalAnalogNew(float zahl, int numeral_preceder);
int PointerEvalAnalogToDigitNew(float zahl, float numeral_preceder, int eval_predecessors, float analogDigitalTransitionStart);
int PointerEvalHybridNew(float zahl, float number_of_predecessors, int eval_predecessors, bool Analog_Predecessors = false, float analogDigitalTransitionStart=9.2);
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 AnalogToDigitTransitionStart=9.2);
@@ -61,7 +52,7 @@ public:
bool doFlow(string time);
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);

File diff suppressed because it is too large Load Diff

View File

@@ -17,8 +17,10 @@
#include "ClassFlowInfluxDB.h"
#include "ClassFlowInfluxDBv2.h"
#endif //ENABLE_INFLUXDB
#ifdef ENABLE_WEBHOOK
#include "ClassFlowWebhook.h"
#endif //ENABLE_WEBHOOK
#include "ClassFlowCNNGeneral.h"
#include "ClassFlowWriteList.h"
class ClassFlowControll :
public ClassFlow
@@ -35,33 +37,31 @@ protected:
bool AutoStart;
float AutoInterval;
bool SetupModeActive;
void SetInitialParameter(void);
std::string aktstatusWithTime;
std::string aktstatus;
int aktRunNr;
public:
bool SetupModeActive;
void InitFlow(std::string config);
bool doFlow(string time);
void doFlowTakeImageOnly(string time);
bool getStatusSetupModus(){return SetupModeActive;};
string getReadout(bool _rawvalue, bool _noerror);
string getReadout(bool _rawvalue, bool _noerror, int _number);
string getReadoutAll(int _type);
string UpdatePrevalue(std::string _newvalue, std::string _numbers, bool _extern);
bool UpdatePrevalue(std::string _newvalue, std::string _numbers, bool _extern);
string GetPrevalue(std::string _number = "");
bool ReadParameter(FILE* pfile, string& aktparamgraph);
string getJSON();
const std::vector<NumberPost*> &getNumbers();
string getNumbersName();
string TranslateAktstatus(std::string _input);
#ifdef ENABLE_MQTT
string GetMQTTMainTopic();
#endif //ENABLE_MQTT
#ifdef ALGROI_LOAD_FROM_MEM_AS_JPG
void DigitalDrawROI(CImageBasis *_zw);
void DigitDrawROI(CImageBasis *_zw);
void AnalogDrawROI(CImageBasis *_zw);
#endif
@@ -70,16 +70,17 @@ public:
std::string doSingleStep(std::string _stepname, std::string _host);
bool isAutoStart(long &_interval);
bool getIsAutoStart();
void setAutoStartInterval(long &_interval);
std::string* getActStatusWithTime();
std::string* getActStatus();
void setActStatus(std::string _aktstatus);
std::vector<HTMLInfo*> GetAllDigital();
std::vector<HTMLInfo*> GetAllDigit();
std::vector<HTMLInfo*> GetAllAnalog();
t_CNNType GetTypeDigital();
t_CNNType GetTypeDigit();
t_CNNType GetTypeAnalog();
#ifdef ENABLE_MQTT

View File

@@ -5,6 +5,10 @@
#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 {
int posx, posy, deltax, deltay;
float result_float;
@@ -14,51 +18,68 @@ struct roi {
CImageBasis *image, *image_org;
};
/**
* FIXME: Why is this additional layer needed?
*/
struct general {
string name;
std::vector<roi*> ROI;
};
enum t_RateType {
AbsoluteChange,
RateChange
AbsoluteChange, // ignores the time difference; only the value difference is used comparison with NumberPost.maxRate
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 {
float MaxRateValue;
bool useMaxRateValue;
t_RateType RateType;
bool ErrorMessage;
bool PreValueOkay;
bool AllowNegativeRates;
bool checkDigitIncreaseConsistency;
time_t lastvalue;
string timeStamp;
double FlowRateAct; // m3 / min
double PreValue; // last value that was read out well
double Value; // last value read out, incl. corrections
string ReturnRateValue; // return value rate
string ReturnChangeAbsolute; // return value rate
string ReturnRawValue; // Raw value (with N & leading 0)
string ReturnValue; // corrected return value, if necessary with error message
string ReturnPreValue; // corrected return value without error message
string ErrorMessageText; // Error message for consistency check
int AnzahlAnalog;
int AnzahlDigital;
int DecimalShift;
int DecimalShiftInitial;
float AnalogDigitalTransitionStart; // When is the digit > x.1, i.e. when does it start to tilt?
int Nachkomma;
string Fieldname; // Fieldname in InfluxDB2
float MaxRateValue; // maxRate; upper bound for the difference between two consecutive readings; affected by maxRateType;
bool useMaxRateValue; // consistencyChecksEnabled; enables consistency checks; uses maxRate and maxRateType
t_RateType MaxRateType; // maxRateType; affects how the value of maxRate is used for comparing the current and previous value
bool ErrorMessage; // FIXME: not used; can be removed
int ChangeRateThreshold; // threshold parameter for negative rate detection
bool PreValueOkay; // previousValueValid; indicates that the reading of the previous round has no errors
bool AllowNegativeRates; // allowNegativeRate; defines if the consistency checks allow negative rates between consecutive meter readings.
bool IgnoreLeadingNaN;
bool checkDigitIncreaseConsistency; // extendedConsistencyCheck; performs an additional consistency check to avoid wrong readings
time_t timeStampLastValue; // Timestamp for the last read value; is used for the log
time_t timeStampLastPreValue; // Timestamp for the last PreValue set; is used for useMaxRateValue
time_t timeStampTimeUTC; // FIXME: not used; can be removed.
string timeStamp; // localTimeStr; timestamp of last valid reading formatted as local time
double FlowRateAct; // currentRate; ΔValue/min; since usage is not limited to water meters, the physical unit is not known.
double PreValue; // lastValidValue; most recent value that could be read w/o any errors
double Value; // value; most recent readout; may include corrections
string ReturnRateValue; // currentRateStr; current normalized rate; ΔValue/min
string ReturnChangeAbsolute; // currentChangeStr; absolute difference between current and previous measurement
string ReturnRawValue; // rawValueStr; Raw value (with N & leading 0)
string ReturnValue; // valueStr; corrected return value, if necessary with error message
string ReturnPreValue; // lastValidValueStr; corrected return value without error message
string ErrorMessageText; // errorMessage; Error message for consistency checks
int AnzahlAnalog; // numAnalogRoi; number of analog ROIs used in this sequence
int AnzahlDigit; // numDigitRoi; number of digit ROIs used in this sequence
int DecimalShift; // decimalShift; each increment shifts the decimal separator by one digit; value=value*10^decimalShift; pos. value shifts to the right
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
bool isExtendedResolution;
string DomoticzIdx; // Domoticz counter Idx
string FieldV1; // influxdbFieldName_v1; Name of the Field in InfluxDBv1
string MeasurementV1; // influxdbMeasurementName_v1; Name of the Measurement in InfluxDBv1
general *digit_roi;
general *analog_roi;
string FieldV2; // influxdbFieldName_v2; Name of the Field in InfluxDBv2
string MeasurementV2; // influxdbMeasurementName_v2; Name of the Measurement in InfluxDBv2
string name;
bool isExtendedResolution; // extendResolution; Adds the decimal place of the least significant analog ROI to the value
general *digit_roi; // digitRoi; set of digit ROIs for the sequence
general *analog_roi; // analogRoi; set of analog ROIs for the sequence
string name; // name; Designation for the sequence
};
#endif

View File

@@ -17,7 +17,8 @@ extern "C" {
#include "esp_log.h"
#include "../../include/defines.h"
static const char* TAG = "IMG";
static const char* TAG = "FLOWIMAGE";
ClassFlowImage::ClassFlowImage(const char* logTag)
{

View File

@@ -15,13 +15,12 @@
#include <time.h>
static const char* TAG = "class_flow_influxDb";
static const char* TAG = "INFLUXDB";
void ClassFlowInfluxDB::SetInitialParameter(void)
{
uri = "";
database = "";
measurement = "";
OldValue = "";
flowpostprocessing = NULL;
@@ -86,33 +85,44 @@ bool ClassFlowInfluxDB::ReadParameter(FILE* pfile, string& aktparamgraph)
{
ESP_LOGD(TAG, "while loop reading line: %s", aktparamgraph.c_str());
splitted = ZerlegeZeile(aktparamgraph);
if ((toUpper(splitted[0]) == "USER") && (splitted.size() > 1))
std::string _param = GetParameterName(splitted[0]);
if ((toUpper(_param) == "USER") && (splitted.size() > 1))
{
this->user = splitted[1];
}
if ((toUpper(splitted[0]) == "PASSWORD") && (splitted.size() > 1))
if ((toUpper(_param) == "PASSWORD") && (splitted.size() > 1))
{
this->password = splitted[1];
}
if ((toUpper(splitted[0]) == "URI") && (splitted.size() > 1))
if ((toUpper(_param) == "URI") && (splitted.size() > 1))
{
this->uri = splitted[1];
}
if (((toUpper(splitted[0]) == "MEASUREMENT")) && (splitted.size() > 1))
{
this->measurement = splitted[1];
}
if (((toUpper(splitted[0]) == "DATABASE")) && (splitted.size() > 1))
if (((toUpper(_param) == "DATABASE")) && (splitted.size() > 1))
{
this->database = splitted[1];
}
if (((toUpper(_param) == "MEASUREMENT")) && (splitted.size() > 1))
{
handleMeasurement(splitted[0], splitted[1]);
}
if (((toUpper(_param) == "FIELD")) && (splitted.size() > 1))
{
handleFieldname(splitted[0], splitted[1]);
}
}
if ((uri.length() > 0) && (database.length() > 0) && (measurement.length() > 0))
if ((uri.length() > 0) && (database.length() > 0))
{
// ESP_LOGD(TAG, "Init InfluxDB with uri: %s, measurement: %s, user: %s, password: %s", uri.c_str(), measurement.c_str(), user.c_str(), password.c_str());
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "Init InfluxDB with uri: " + uri + ", measurement: " + measurement + ", user: " + user + ", password: " + password);
InfluxDBInit(uri, database, measurement, user, password);
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "Init InfluxDB with uri: " + uri + ", user: " + user + ", password: " + password);
/////////////////////// NEW //////////////////////////
// InfluxDBInit(uri, database, user, password);
influxDB.InfluxDBInitV1(uri, database, user, password);
/////////////////////// NEW //////////////////////////
InfluxDBenable = true;
} else {
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "InfluxDB init skipped as we are missing some parameters");
@@ -121,23 +131,18 @@ bool ClassFlowInfluxDB::ReadParameter(FILE* pfile, string& aktparamgraph)
return true;
}
string ClassFlowInfluxDB::GetInfluxDBMeasurement()
{
return measurement;
}
bool ClassFlowInfluxDB::doFlow(string zwtime)
{
if (!InfluxDBenable)
return true;
std::string result;
std::string measurement;
std::string resulterror = "";
std::string resultraw = "";
std::string resultrate = "";
std::string resulttimestamp = "";
long int timeutc;
string zw = "";
string namenumber = "";
@@ -147,20 +152,34 @@ bool ClassFlowInfluxDB::doFlow(string zwtime)
for (int i = 0; i < (*NUMBERS).size(); ++i)
{
measurement = (*NUMBERS)[i]->MeasurementV1;
result = (*NUMBERS)[i]->ReturnValue;
resultraw = (*NUMBERS)[i]->ReturnRawValue;
resulterror = (*NUMBERS)[i]->ErrorMessageText;
resultrate = (*NUMBERS)[i]->ReturnRateValue;
resulttimestamp = (*NUMBERS)[i]->timeStamp;
timeutc = (*NUMBERS)[i]->timeStampTimeUTC;
namenumber = (*NUMBERS)[i]->name;
if (namenumber == "default")
namenumber = "value";
if ((*NUMBERS)[i]->FieldV1.length() > 0)
{
namenumber = (*NUMBERS)[i]->FieldV1;
}
else
namenumber = namenumber + "/value";
{
namenumber = (*NUMBERS)[i]->name;
if (namenumber == "default")
namenumber = "value";
else
namenumber = namenumber + "/value";
}
if (result.length() > 0)
//////////////////////// NEW //////////////////////////
// InfluxDBPublish(measurement, namenumber, result, timeutc);
influxDB.InfluxDBPublish(measurement, namenumber, result, timeutc);
//////////////////////// NEW //////////////////////////
if (result.length() > 0 && resulttimestamp.length() > 0)
InfluxDBPublish(namenumber, result, resulttimestamp);
}
}
@@ -169,4 +188,50 @@ bool ClassFlowInfluxDB::doFlow(string zwtime)
return true;
}
void ClassFlowInfluxDB::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]->MeasurementV1 = _value;
}
if (flowpostprocessing->NUMBERS[j]->name == _digit)
{
flowpostprocessing->NUMBERS[j]->MeasurementV1 = _value;
}
}
}
void ClassFlowInfluxDB::handleFieldname(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]->FieldV1 = _value;
}
if (flowpostprocessing->NUMBERS[j]->name == _digit)
{
flowpostprocessing->NUMBERS[j]->FieldV1 = _value;
}
}
}
#endif //ENABLE_INFLUXDB

View File

@@ -8,6 +8,7 @@
#include "ClassFlow.h"
#include "ClassFlowPostProcessing.h"
#include "interface_influxdb.h"
#include <string>
@@ -21,14 +22,21 @@ protected:
std::string user, password;
bool InfluxDBenable;
void SetInitialParameter(void);
InfluxDB influxDB;
void SetInitialParameter(void);
void handleFieldname(string _decsep, string _value);
void handleMeasurement(string _decsep, string _value);
public:
ClassFlowInfluxDB();
ClassFlowInfluxDB(std::vector<ClassFlow*>* lfc);
ClassFlowInfluxDB(std::vector<ClassFlow*>* lfc, ClassFlow *_prev);
string GetInfluxDBMeasurement();
// string GetInfluxDBMeasurement();
bool ReadParameter(FILE* pfile, string& aktparamgraph);
bool doFlow(string time);

View File

@@ -15,13 +15,12 @@
#include <time.h>
static const char* TAG = "class_flow_influxDbv2";
static const char* TAG = "INFLUXDBV2";
void ClassFlowInfluxDBv2::SetInitialParameter(void)
{
uri = "";
database = "";
measurement = "";
bucket = "";
dborg = "";
dbtoken = "";
// dbfield = "";
@@ -102,30 +101,36 @@ bool ClassFlowInfluxDBv2::ReadParameter(FILE* pfile, string& aktparamgraph)
{
this->uri = splitted[1];
}
if (((toUpper(_param) == "MEASUREMENT")) && (splitted.size() > 1))
{
this->measurement = splitted[1];
}
if (((toUpper(_param) == "FIELDNAME")) && (splitted.size() > 1))
if (((toUpper(_param) == "FIELD")) && (splitted.size() > 1))
{
handleFieldname(splitted[0], splitted[1]);
}
if (((toUpper(splitted[0]) == "DATABASE")) && (splitted.size() > 1))
if (((toUpper(_param) == "MEASUREMENT")) && (splitted.size() > 1))
{
this->database = splitted[1];
handleMeasurement(splitted[0], splitted[1]);
}
if (((toUpper(splitted[0]) == "BUCKET")) && (splitted.size() > 1))
{
this->bucket = splitted[1];
}
}
printf("uri: %s\n", uri.c_str());
printf("measurement: %s\n", measurement.c_str());
printf("org: %s\n", dborg.c_str());
printf("token: %s\n", dbtoken.c_str());
if ((uri.length() > 0) && (database.length() > 0) && (measurement.length() > 0) && (dbtoken.length() > 0) && (dborg.length() > 0))
if ((uri.length() > 0) && (bucket.length() > 0) && (dbtoken.length() > 0) && (dborg.length() > 0))
{
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "Init InfluxDB with uri: " + uri + ", measurement: " + measurement + ", org: " + dborg + ", token: *****");
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "Init InfluxDB with uri: " + uri + ", org: " + dborg + ", token: *****");
// printf("vor V2 Init\n");
InfluxDB_V2_Init(uri, database, measurement, dborg, dbtoken);
////////////////////////////////////////// NEW ////////////////////////////////////////////
// InfluxDB_V2_Init(uri, bucket, dborg, dbtoken);
// InfluxDB_V2_Init(uri, bucket, dborg, dbtoken);
influxdb.InfluxDBInitV2(uri, bucket, dborg, dbtoken);
////////////////////////////////////////// NEW ////////////////////////////////////////////
// printf("nach V2 Init\n");
InfluxDBenable = true;
} else {
@@ -135,11 +140,12 @@ bool ClassFlowInfluxDBv2::ReadParameter(FILE* pfile, string& aktparamgraph)
return true;
}
/*
string ClassFlowInfluxDBv2::GetInfluxDBMeasurement()
{
return measurement;
}
*/
void ClassFlowInfluxDBv2::handleFieldname(string _decsep, string _value)
{
@@ -154,15 +160,36 @@ void ClassFlowInfluxDBv2::handleFieldname(string _decsep, string _value)
{
if (_digit == "default") // Set to default first (if nothing else is set)
{
flowpostprocessing->NUMBERS[j]->Fieldname = _value;
flowpostprocessing->NUMBERS[j]->FieldV2 = _value;
}
if (flowpostprocessing->NUMBERS[j]->name == _digit)
{
flowpostprocessing->NUMBERS[j]->Fieldname = _value;
flowpostprocessing->NUMBERS[j]->FieldV2 = _value;
}
}
}
void ClassFlowInfluxDBv2::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 ClassFlowInfluxDBv2::doFlow(string zwtime)
@@ -170,29 +197,35 @@ bool ClassFlowInfluxDBv2::doFlow(string zwtime)
if (!InfluxDBenable)
return true;
std::string measurement;
std::string result;
std::string resulterror = "";
std::string resultraw = "";
std::string resultrate = "";
std::string resulttimestamp = "";
long int resulttimeutc = 0;
string zw = "";
string namenumber = "";
if (flowpostprocessing)
{
std::vector<NumberPost*>* NUMBERS = flowpostprocessing->GetNumbers();
for (int i = 0; i < (*NUMBERS).size(); ++i)
{
measurement = (*NUMBERS)[i]->MeasurementV2;
result = (*NUMBERS)[i]->ReturnValue;
resultraw = (*NUMBERS)[i]->ReturnRawValue;
resulterror = (*NUMBERS)[i]->ErrorMessageText;
resultrate = (*NUMBERS)[i]->ReturnRateValue;
resulttimestamp = (*NUMBERS)[i]->timeStamp;
resulttimeutc = (*NUMBERS)[i]->timeStampTimeUTC;
if ((*NUMBERS)[i]->Fieldname.length() > 0)
if ((*NUMBERS)[i]->FieldV2.length() > 0)
{
namenumber = (*NUMBERS)[i]->Fieldname;
namenumber = (*NUMBERS)[i]->FieldV2;
}
else
{
@@ -206,8 +239,8 @@ bool ClassFlowInfluxDBv2::doFlow(string zwtime)
printf("vor sende Influx_DB_V2 - namenumber. %s, result: %s, timestampt: %s", namenumber.c_str(), result.c_str(), resulttimestamp.c_str());
if (result.length() > 0)
InfluxDB_V2_Publish(namenumber, result, resulttimestamp);
// InfluxDB_V2_Publish(namenumber, result, resulttimestamp);
influxdb.InfluxDBPublish(measurement, namenumber, result, resulttimeutc);
// InfluxDB_V2_Publish(measurement, namenumber, result, resulttimeutc);
}
}

View File

@@ -9,28 +9,34 @@
#include "ClassFlowPostProcessing.h"
#include "interface_influxdb.h"
#include <string>
class ClassFlowInfluxDBv2 :
public ClassFlow
{
protected:
std::string uri, database, measurement;
std::string uri, bucket;
std::string dborg, dbtoken, dbfield;
std::string OldValue;
ClassFlowPostProcessing* flowpostprocessing;
bool InfluxDBenable;
InfluxDB influxdb;
void SetInitialParameter(void);
void handleFieldname(string _decsep, string _value);
void handleMeasurement(string _decsep, string _value);
public:
ClassFlowInfluxDBv2();
ClassFlowInfluxDBv2(std::vector<ClassFlow*>* lfc);
ClassFlowInfluxDBv2(std::vector<ClassFlow*>* lfc, ClassFlow *_prev);
string GetInfluxDBMeasurement();
// string GetInfluxDBMeasurement();
bool ReadParameter(FILE* pfile, string& aktparamgraph);
bool doFlow(string time);

View File

@@ -37,6 +37,10 @@ void ClassFlowMQTT::SetInitialParameter(void)
topicUptime = "";
topicFreeMem = "";
caCertFilename = "";
clientCertFilename = "";
clientKeyFilename = "";
validateServerCert = true;
clientname = wlan_config.hostname;
OldValue = "";
@@ -48,6 +52,7 @@ void ClassFlowMQTT::SetInitialParameter(void)
ListFlowControll = NULL;
disabled = false;
keepAlive = 25*60;
domoticzintopic = "";
}
ClassFlowMQTT::ClassFlowMQTT()
@@ -102,31 +107,46 @@ bool ClassFlowMQTT::ReadParameter(FILE* pfile, string& aktparamgraph)
while (this->getNextLine(pfile, &aktparamgraph) && !this->isNewParagraph(aktparamgraph))
{
splitted = ZerlegeZeile(aktparamgraph);
if ((toUpper(splitted[0]) == "USER") && (splitted.size() > 1))
std::string _param = GetParameterName(splitted[0]);
if ((toUpper(_param) == "CACERT") && (splitted.size() > 1))
{
this->caCertFilename = "/sdcard" + splitted[1];
}
if ((toUpper(_param) == "VALIDATESERVERCERT") && (splitted.size() > 1))
{
validateServerCert = alphanumericToBoolean(splitted[1]);
}
if ((toUpper(_param) == "CLIENTCERT") && (splitted.size() > 1))
{
this->clientCertFilename = "/sdcard" + splitted[1];
}
if ((toUpper(_param) == "CLIENTKEY") && (splitted.size() > 1))
{
this->clientKeyFilename = "/sdcard" + splitted[1];
}
if ((toUpper(_param) == "USER") && (splitted.size() > 1))
{
this->user = splitted[1];
}
if ((toUpper(splitted[0]) == "PASSWORD") && (splitted.size() > 1))
if ((toUpper(_param) == "PASSWORD") && (splitted.size() > 1))
{
this->password = splitted[1];
}
if ((toUpper(splitted[0]) == "URI") && (splitted.size() > 1))
if ((toUpper(_param) == "URI") && (splitted.size() > 1))
{
this->uri = splitted[1];
}
if ((toUpper(splitted[0]) == "RETAINMESSAGES") && (splitted.size() > 1))
if ((toUpper(_param) == "RETAINMESSAGES") && (splitted.size() > 1))
{
if (toUpper(splitted[1]) == "TRUE") {
SetRetainFlag = true;
setMqtt_Server_Retain(SetRetainFlag);
}
SetRetainFlag = alphanumericToBoolean(splitted[1]);
setMqtt_Server_Retain(SetRetainFlag);
}
if ((toUpper(splitted[0]) == "HOMEASSISTANTDISCOVERY") && (splitted.size() > 1))
if ((toUpper(_param) == "HOMEASSISTANTDISCOVERY") && (splitted.size() > 1))
{
if (toUpper(splitted[1]) == "TRUE")
SetHomeassistantDiscoveryEnabled(true);
}
if ((toUpper(splitted[0]) == "METERTYPE") && (splitted.size() > 1)) {
if ((toUpper(_param) == "METERTYPE") && (splitted.size() > 1)) {
/* Use meter type for the device class
Make sure it is a listed one on https://developers.home-assistant.io/docs/core/entity/sensor/#available-device-classes */
if (toUpper(splitted[1]) == "WATER_M3") {
@@ -136,16 +156,19 @@ bool ClassFlowMQTT::ReadParameter(FILE* pfile, string& aktparamgraph)
mqttServer_setMeterType("water", "L", "h", "L/h");
}
else if (toUpper(splitted[1]) == "WATER_FT3") {
mqttServer_setMeterType("water", "ft³", "m", "ft³/m"); // Minutes
mqttServer_setMeterType("water", "ft³", "min", "ft³/min"); // min = Minutes
}
else if (toUpper(splitted[1]) == "WATER_GAL") {
mqttServer_setMeterType("water", "gal", "h", "gal/h");
}
else if (toUpper(splitted[1]) == "WATER_GAL_MIN") {
mqttServer_setMeterType("water", "gal", "min", "gal/min"); // min = Minutes
}
else if (toUpper(splitted[1]) == "GAS_M3") {
mqttServer_setMeterType("gas", "", "h", "m³/h");
}
else if (toUpper(splitted[1]) == "GAS_FT3") {
mqttServer_setMeterType("gas", "ft³", "m", "ft³/m"); // Minutes
mqttServer_setMeterType("gas", "ft³", "min", "ft³/min"); // min = Minutes
}
else if (toUpper(splitted[1]) == "ENERGY_WH") {
mqttServer_setMeterType("energy", "Wh", "h", "W");
@@ -159,17 +182,37 @@ bool ClassFlowMQTT::ReadParameter(FILE* pfile, string& aktparamgraph)
else if (toUpper(splitted[1]) == "ENERGY_GJ") {
mqttServer_setMeterType("energy", "GJ", "h", "GJ/h");
}
else if (toUpper(splitted[1]) == "TEMPERATURE_C") {
mqttServer_setMeterType("temperature", "°C", "min", "°C/min"); // min = Minutes
}
else if (toUpper(splitted[1]) == "TEMPERATURE_F") {
mqttServer_setMeterType("temperature", "°F", "min", "°F/min"); // min = Minutes
}
else if (toUpper(splitted[1]) == "TEMPERATURE_K") {
mqttServer_setMeterType("temperature", "K", "min", "K/m"); // min = Minutes
}
}
if ((toUpper(splitted[0]) == "CLIENTID") && (splitted.size() > 1))
if ((toUpper(_param) == "CLIENTID") && (splitted.size() > 1))
{
this->clientname = splitted[1];
}
if (((toUpper(splitted[0]) == "TOPIC") || (toUpper(splitted[0]) == "MAINTOPIC")) && (splitted.size() > 1))
if (((toUpper(_param) == "TOPIC") || (toUpper(splitted[0]) == "MAINTOPIC")) && (splitted.size() > 1))
{
maintopic = splitted[1];
}
if (((toUpper(_param) == "DOMOTICZTOPICIN")) && (splitted.size() > 1))
{
this->domoticzintopic = splitted[1];
}
if (((toUpper(_param) == "DOMOTICZIDX")) && (splitted.size() > 1))
{
handleIdx(splitted[0], splitted[1]);
}
}
/* Note:
@@ -178,17 +221,12 @@ bool ClassFlowMQTT::ReadParameter(FILE* pfile, string& aktparamgraph)
* To work around this, we delay the start and trigger it from ClassFlowControll::ReadParameter() */
mqttServer_setMainTopic(maintopic);
mqttServer_setDmoticzInTopic(domoticzintopic);
return true;
}
string ClassFlowMQTT::GetMQTTMainTopic()
{
return maintopic;
}
bool ClassFlowMQTT::Start(float AutoInterval)
{
roundInterval = AutoInterval; // Minutes
@@ -201,8 +239,9 @@ bool ClassFlowMQTT::Start(float AutoInterval)
mqttServer_setParameter(flowpostprocessing->GetNumbers(), keepAlive, roundInterval);
bool MQTTConfigCheck = MQTT_Configure(uri, clientname, user, password, maintopic, LWT_TOPIC, LWT_CONNECTED,
LWT_DISCONNECTED, keepAlive, SetRetainFlag, (void *)&GotConnected);
bool MQTTConfigCheck = MQTT_Configure(uri, clientname, user, password, maintopic, domoticzintopic, LWT_TOPIC, LWT_CONNECTED,
LWT_DISCONNECTED, caCertFilename, validateServerCert, clientCertFilename, clientKeyFilename,
keepAlive, SetRetainFlag, (void *)&GotConnected);
if (!MQTTConfigCheck) {
return false;
@@ -225,6 +264,8 @@ bool ClassFlowMQTT::doFlow(string zwtime)
std::string resultchangabs = "";
string zw = "";
string namenumber = "";
string domoticzpayload = "";
string DomoticzIdx = "";
int qos = 1;
/* Send the the Homeassistant Discovery and the Static Topics in case they where scheduled */
@@ -248,16 +289,20 @@ bool ClassFlowMQTT::doFlow(string zwtime)
resultchangabs = (*NUMBERS)[i]->ReturnChangeAbsolute; // Units per round
resulttimestamp = (*NUMBERS)[i]->timeStamp;
DomoticzIdx = (*NUMBERS)[i]->DomoticzIdx;
domoticzpayload = "{\"command\":\"udevice\",\"idx\":" + DomoticzIdx + ",\"svalue\":\""+ result + "\"}";
namenumber = (*NUMBERS)[i]->name;
if (namenumber == "default")
namenumber = maintopic + "/";
else
namenumber = maintopic + "/" + namenumber + "/";
if ((domoticzintopic.length() > 0) && (result.length() > 0))
success |= MQTTPublish(domoticzintopic, domoticzpayload, qos, SetRetainFlag);
if (result.length() > 0)
if (result.length() > 0)
success |= MQTTPublish(namenumber + "value", result, qos, SetRetainFlag);
if (resulterror.length() > 0)
success |= MQTTPublish(namenumber + "error", resulterror, qos, SetRetainFlag);
@@ -276,7 +321,7 @@ bool ClassFlowMQTT::doFlow(string zwtime)
if (resultchangabs.length() > 0) {
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)
@@ -315,6 +360,26 @@ bool ClassFlowMQTT::doFlow(string zwtime)
return true;
}
void ClassFlowMQTT::handleIdx(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]->DomoticzIdx = _value;
}
if (flowpostprocessing->NUMBERS[j]->name == _digit)
{
flowpostprocessing->NUMBERS[j]->DomoticzIdx = _value;
}
}
}
#endif //ENABLE_MQTT
#endif //ENABLE_MQTT

View File

@@ -19,19 +19,20 @@ protected:
std::string OldValue;
ClassFlowPostProcessing* flowpostprocessing;
std::string user, password;
std::string caCertFilename, clientCertFilename, clientKeyFilename;
bool validateServerCert;
bool SetRetainFlag;
int keepAlive; // Seconds
float roundInterval; // Minutes
std::string maintopic;
std::string maintopic, domoticzintopic;
void SetInitialParameter(void);
void handleIdx(string _decsep, string _value);
public:
ClassFlowMQTT();
ClassFlowMQTT(std::vector<ClassFlow*>* lfc);
ClassFlowMQTT(std::vector<ClassFlow*>* lfc, ClassFlow *_prev);
string GetMQTTMainTopic();
bool Start(float AutoInterval);
bool ReadParameter(FILE* pfile, string& aktparamgraph);

File diff suppressed because it is too large Load Diff

View File

@@ -10,7 +10,6 @@
#include <string>
class ClassFlowPostProcessing :
public ClassFlow
{
@@ -19,13 +18,10 @@ protected:
int PreValueAgeStartup;
bool ErrorMessage;
bool IgnoreLeadingNaN; // SPECIAL CASE for User Gustl ???
ClassFlowCNNGeneral* flowAnalog;
ClassFlowCNNGeneral* flowDigit;
string FilePreValue;
ClassFlowTakeImage *flowTakeImage;
@@ -37,25 +33,23 @@ protected:
float checkDigitConsistency(double input, int _decilamshift, bool _isanalog, double _preValue);
void InitNUMBERS();
void handleDecimalSeparator(string _decsep, string _value);
void handleMaxRateValue(string _decsep, string _value);
void handleDecimalExtendedResolution(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);
std::string GetStringReadouts(general);
void handleIgnoreLeadingNaN(string _decsep, string _value);
void handleChangeRateThreshold(string _decsep, string _value);
void handlecheckDigitIncreaseConsistency(std::string _decsep, std::string _value);
void WriteDataLog(int _index);
public:
bool PreValueUse;
std::vector<NumberPost*> NUMBERS;
ClassFlowPostProcessing(std::vector<ClassFlow*>* lfc, ClassFlowCNNGeneral *_analog, ClassFlowCNNGeneral *_digit);
virtual ~ClassFlowPostProcessing(){};
bool ReadParameter(FILE* pfile, string& aktparamgraph);
@@ -68,7 +62,7 @@ public:
void SavePreValue();
string getJsonFromNumber(int i, std::string _lineend);
string GetPreValue(std::string _number = "");
void SetPreValue(double zw, string _numbers, bool _extern = false);
bool SetPreValue(double zw, string _numbers, bool _extern = false);
std::string GetJSON(std::string _lineend = "\n");
std::string getNumbersName();
@@ -80,5 +74,4 @@ public:
string name(){return "ClassFlowPostProcessing";};
};
#endif //CLASSFFLOWPOSTPROCESSING_H

View File

@@ -1,24 +1,31 @@
#include <iostream>
#include <string>
#include <vector>
#include <regex>
#include "ClassFlowTakeImage.h"
#include "Helper.h"
#include "ClassLogFile.h"
#include "CImageBasis.h"
#include "ClassControllCamera.h"
#include "MainFlowControl.h"
#include "esp_wifi.h"
#include "esp_log.h"
#include "../../include/defines.h"
#include "psram.h"
#include <time.h>
// #define DEBUG_DETAIL_ON
// #define DEBUG_DETAIL_ON
// #define WIFITURNOFF
static const char* TAG = "flow_make_image";
static const char *TAG = "TAKEIMAGE";
esp_err_t ClassFlowTakeImage::camera_capture(){
string nm = namerawimage;
esp_err_t ClassFlowTakeImage::camera_capture(void)
{
string nm = namerawimage;
Camera.CaptureToFile(nm);
time(&TimeImageTaken);
localtime(&TimeImageTaken);
@@ -29,150 +36,500 @@ esp_err_t ClassFlowTakeImage::camera_capture(){
void ClassFlowTakeImage::takePictureWithFlash(int flash_duration)
{
// in case the image is flipped, it must be reset here //
rawImage->width = image_width;
rawImage->height = image_height;
/////////////////////////////////////////////////////////////////////////////////////
rawImage->width = CCstatus.ImageWidth;
rawImage->height = CCstatus.ImageHeight;
ESP_LOGD(TAG, "flash_duration: %d", flash_duration);
Camera.CaptureToBasisImage(rawImage, flash_duration);
time(&TimeImageTaken);
localtime(&TimeImageTaken);
if (SaveAllFiles) rawImage->SaveToFile(namerawimage);
if (CCstatus.SaveAllFiles)
{
rawImage->SaveToFile(namerawimage);
}
}
void ClassFlowTakeImage::SetInitialParameter(void)
{
waitbeforepicture = 5;
isImageSize = false;
ImageQuality = -1;
TimeImageTaken = 0;
ImageQuality = 5;
rawImage = NULL;
ImageSize = FRAMESIZE_VGA;
SaveAllFiles = false;
disabled = false;
FixedExposure = false;
namerawimage = "/sdcard/img_tmp/raw.jpg";
}
}
// auslesen der Kameraeinstellungen aus der config.ini
// wird beim Start aufgerufen
bool ClassFlowTakeImage::ReadParameter(FILE *pfile, string &aktparamgraph)
{
Camera.getSensorDatenToCCstatus(); // Kamera >>> CCstatus
ClassFlowTakeImage::ClassFlowTakeImage(std::vector<ClassFlow*>* lfc) : ClassFlowImage(lfc, TAG)
std::vector<string> splitted;
aktparamgraph = trim(aktparamgraph);
if (aktparamgraph.size() == 0)
{
if (!this->GetNextParagraph(pfile, aktparamgraph))
{
return false;
}
}
if (aktparamgraph.compare("[TakeImage]") != 0)
{
// Paragraph does not fit TakeImage
return false;
}
while (this->getNextLine(pfile, &aktparamgraph) && !this->isNewParagraph(aktparamgraph))
{
splitted = ZerlegeZeile(aktparamgraph);
if ((toUpper(splitted[0]) == "RAWIMAGESLOCATION") && (splitted.size() > 1))
{
imagesLocation = "/sdcard" + splitted[1];
isLogImage = true;
}
else if ((toUpper(splitted[0]) == "RAWIMAGESRETENTION") && (splitted.size() > 1))
{
if (isStringNumeric(splitted[1]))
{
this->imagesRetention = std::stod(splitted[1]);
}
}
else if ((toUpper(splitted[0]) == "SAVEALLFILES") && (splitted.size() > 1))
{
CCstatus.SaveAllFiles = alphanumericToBoolean(splitted[1]);
}
else if ((toUpper(splitted[0]) == "WAITBEFORETAKINGPICTURE") && (splitted.size() > 1))
{
if (isStringNumeric(splitted[1]))
{
int _WaitBeforePicture = std::stoi(splitted[1]);
if (_WaitBeforePicture != 0)
{
CCstatus.WaitBeforePicture = _WaitBeforePicture;
}
else
{
CCstatus.WaitBeforePicture = 2;
}
}
}
else if ((toUpper(splitted[0]) == "CAMGAINCEILING") && (splitted.size() > 1))
{
std::string _ImageGainceiling = toUpper(splitted[1]);
if (isStringNumeric(_ImageGainceiling))
{
int _ImageGainceiling_ = std::stoi(_ImageGainceiling);
switch (_ImageGainceiling_)
{
case 1:
CCstatus.ImageGainceiling = GAINCEILING_4X;
break;
case 2:
CCstatus.ImageGainceiling = GAINCEILING_8X;
break;
case 3:
CCstatus.ImageGainceiling = GAINCEILING_16X;
break;
case 4:
CCstatus.ImageGainceiling = GAINCEILING_32X;
break;
case 5:
CCstatus.ImageGainceiling = GAINCEILING_64X;
break;
case 6:
CCstatus.ImageGainceiling = GAINCEILING_128X;
break;
default:
CCstatus.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;
}
}
}
else if ((toUpper(splitted[0]) == "CAMQUALITY") && (splitted.size() > 1))
{
if (isStringNumeric(splitted[1]))
{
int _ImageQuality = std::stoi(splitted[1]);
CCstatus.ImageQuality = clipInt(_ImageQuality, 63, 6);
}
}
else if ((toUpper(splitted[0]) == "CAMBRIGHTNESS") && (splitted.size() > 1))
{
if (isStringNumeric(splitted[1]))
{
int _ImageBrightness = std::stoi(splitted[1]);
CCstatus.ImageBrightness = clipInt(_ImageBrightness, 2, -2);
}
}
else if ((toUpper(splitted[0]) == "CAMCONTRAST") && (splitted.size() > 1))
{
if (isStringNumeric(splitted[1]))
{
int _ImageContrast = std::stoi(splitted[1]);
CCstatus.ImageContrast = clipInt(_ImageContrast, 2, -2);
}
}
else if ((toUpper(splitted[0]) == "CAMSATURATION") && (splitted.size() > 1))
{
if (isStringNumeric(splitted[1]))
{
int _ImageSaturation = std::stoi(splitted[1]);
CCstatus.ImageSaturation = clipInt(_ImageSaturation, 2, -2);
}
}
else if ((toUpper(splitted[0]) == "CAMSHARPNESS") && (splitted.size() > 1))
{
if (isStringNumeric(splitted[1]))
{
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);
}
}
}
else if ((toUpper(splitted[0]) == "CAMAUTOSHARPNESS") && (splitted.size() > 1))
{
CCstatus.ImageAutoSharpness = alphanumericToBoolean(splitted[1]);
}
else if ((toUpper(splitted[0]) == "CAMSPECIALEFFECT") && (splitted.size() > 1))
{
std::string _ImageSpecialEffect = toUpper(splitted[1]);
if (isStringNumeric(_ImageSpecialEffect))
{
int _ImageSpecialEffect_ = std::stoi(_ImageSpecialEffect);
CCstatus.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);
CCstatus.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]))
{
int ledintensity = std::stoi(splitted[1]);
CCstatus.ImageLedIntensity = Camera.SetLEDIntensity(ledintensity);
}
}
else if ((toUpper(splitted[0]) == "DEMO") && (splitted.size() > 1))
{
CCstatus.DemoMode = alphanumericToBoolean(splitted[1]);
if (CCstatus.DemoMode == true)
{
Camera.useDemoMode();
}
}
}
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;
}
ClassFlowTakeImage::ClassFlowTakeImage(std::vector<ClassFlow *> *lfc) : ClassFlowImage(lfc, TAG)
{
imagesLocation = "/log/source";
imagesRetention = 5;
SetInitialParameter();
}
bool ClassFlowTakeImage::ReadParameter(FILE* pfile, string& aktparamgraph)
{
std::vector<string> splitted;
aktparamgraph = trim(aktparamgraph);
int _brightness = -100;
int _contrast = -100;
int _saturation = -100;
if (aktparamgraph.size() == 0)
if (!this->GetNextParagraph(pfile, aktparamgraph))
return false;
if (aktparamgraph.compare("[TakeImage]") != 0) // Paragraph does not fit TakeImage
return false;
while (this->getNextLine(pfile, &aktparamgraph) && !this->isNewParagraph(aktparamgraph))
{
splitted = ZerlegeZeile(aktparamgraph);
if ((toUpper(splitted[0]) == "RAWIMAGESLOCATION") && (splitted.size() > 1))
{
imagesLocation = "/sdcard" + splitted[1];
isLogImage = true;
}
if ((toUpper(splitted[0]) == "IMAGEQUALITY") && (splitted.size() > 1))
ImageQuality = 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))
{
if (toUpper(splitted[1]) == "TRUE")
SaveAllFiles = true;
}
if ((toUpper(splitted[0]) == "WAITBEFORETAKINGPICTURE") && (splitted.size() > 1))
{
waitbeforepicture = stoi(splitted[1]);
}
if ((toUpper(splitted[0]) == "RAWIMAGESRETENTION") && (splitted.size() > 1))
{
this->imagesRetention = std::stoi(splitted[1]);
}
if ((toUpper(splitted[0]) == "BRIGHTNESS") && (splitted.size() > 1))
{
_brightness = stoi(splitted[1]);
}
if ((toUpper(splitted[0]) == "CONTRAST") && (splitted.size() > 1))
{
_contrast = stoi(splitted[1]);
}
if ((toUpper(splitted[0]) == "SATURATION") && (splitted.size() > 1))
{
_saturation = stoi(splitted[1]);
}
if ((toUpper(splitted[0]) == "FIXEDEXPOSURE") && (splitted.size() > 1))
{
if (toUpper(splitted[1]) == "TRUE")
FixedExposure = true;
}
if ((toUpper(splitted[0]) == "LEDINTENSITY") && (splitted.size() > 1))
{
float ledintensity = stof(splitted[1]);
ledintensity = min((float) 100, ledintensity);
ledintensity = max((float) 0, ledintensity);
Camera.SetLEDIntensity(ledintensity);
}
if ((toUpper(splitted[0]) == "DEMO") && (splitted.size() > 1))
{
if (toUpper(splitted[1]) == "TRUE")
Camera.useDemoMode();
}
}
Camera.SetBrightnessContrastSaturation(_brightness, _contrast, _saturation);
Camera.SetQualitySize(ImageQuality, ImageSize);
image_width = Camera.image_width;
image_height = Camera.image_height;
rawImage = new CImageBasis();
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");
}
return true;
}
string ClassFlowTakeImage::getHTMLSingleStep(string host)
{
string result;
@@ -180,70 +537,79 @@ string ClassFlowTakeImage::getHTMLSingleStep(string host)
return result;
}
// wird bei jeder Auswertrunde aufgerufen
bool ClassFlowTakeImage::doFlow(string zwtime)
{
psram_init_shared_memory_for_take_image_step();
string logPath = CreateLogFolder(zwtime);
int flash_duration = (int) (waitbeforepicture * 1000);
#ifdef DEBUG_DETAIL_ON
LogFile.WriteHeapInfo("ClassFlowTakeImage::doFlow - Before takePictureWithFlash");
#endif
int flash_duration = (int)(CCstatus.WaitBeforePicture * 1000);
#ifdef DEBUG_DETAIL_ON
LogFile.WriteHeapInfo("ClassFlowTakeImage::doFlow - Before takePictureWithFlash");
#endif
#ifdef WIFITURNOFF
esp_wifi_stop(); // to save power usage and
#endif
#ifdef WIFITURNOFF
esp_wifi_stop(); // to save power usage and
#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);
Camera.LedIntensity = CCstatus.ImageLedIntensity;
CFstatus.changedCameraSettings = false;
}
takePictureWithFlash(flash_duration);
#ifdef WIFITURNOFF
esp_wifi_start();
#endif
#ifdef WIFITURNOFF
esp_wifi_start();
#endif
#ifdef DEBUG_DETAIL_ON
LogFile.WriteHeapInfo("ClassFlowTakeImage::doFlow - After takePictureWithFlash");
#endif
#ifdef DEBUG_DETAIL_ON
LogFile.WriteHeapInfo("ClassFlowTakeImage::doFlow - After takePictureWithFlash");
#endif
LogImage(logPath, "raw", NULL, NULL, zwtime, rawImage);
RemoveOldLogs();
#ifdef DEBUG_DETAIL_ON
LogFile.WriteHeapInfo("ClassFlowTakeImage::doFlow - After RemoveOldLogs");
#endif
#ifdef DEBUG_DETAIL_ON
LogFile.WriteHeapInfo("ClassFlowTakeImage::doFlow - After RemoveOldLogs");
#endif
psram_deinit_shared_memory_for_take_image_step();
return true;
}
esp_err_t ClassFlowTakeImage::SendRawJPG(httpd_req_t *req)
{
int flash_duration = (int) (waitbeforepicture * 1000);
int flash_duration = (int)(CCstatus.WaitBeforePicture * 1000);
time(&TimeImageTaken);
localtime(&TimeImageTaken);
return Camera.CaptureToHTTP(req, flash_duration);
}
ImageData* ClassFlowTakeImage::SendRawImage()
ImageData *ClassFlowTakeImage::SendRawImage(void)
{
CImageBasis *zw = new CImageBasis(rawImage);
CImageBasis *zw = new CImageBasis("SendRawImage", rawImage);
ImageData *id;
int flash_duration = (int) (waitbeforepicture * 1000);
int flash_duration = (int)(CCstatus.WaitBeforePicture * 1000);
Camera.CaptureToBasisImage(zw, flash_duration);
time(&TimeImageTaken);
localtime(&TimeImageTaken);
id = zw->writeToMemoryAsJPG();
id = zw->writeToMemoryAsJPG();
delete zw;
return id;
return id;
}
time_t ClassFlowTakeImage::getTimeImageTaken()
time_t ClassFlowTakeImage::getTimeImageTaken(void)
{
return TimeImageTaken;
}
@@ -252,4 +618,3 @@ ClassFlowTakeImage::~ClassFlowTakeImage(void)
{
delete rawImage;
}

View File

@@ -9,47 +9,32 @@
#include <string>
class ClassFlowTakeImage :
public ClassFlowImage
class ClassFlowTakeImage : public ClassFlowImage
{
protected:
float waitbeforepicture;
float waitbeforepicture_store;
framesize_t ImageSize;
bool isImageSize;
int ImageQuality;
time_t TimeImageTaken;
string namerawimage;
int image_height, image_width;
bool SaveAllFiles;
bool FixedExposure;
void CopyFile(string input, string output);
esp_err_t camera_capture();
esp_err_t camera_capture(void);
void takePictureWithFlash(int flash_duration);
void SetInitialParameter(void);
void SetInitialParameter(void);
public:
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);
string getHTMLSingleStep(string host);
time_t getTimeImageTaken();
string name(){return "ClassFlowTakeImage";};
time_t getTimeImageTaken(void);
string name() { return "ClassFlowTakeImage"; };
ImageData* SendRawImage();
ImageData *SendRawImage(void);
esp_err_t SendRawJPG(httpd_req_t *req);
~ClassFlowTakeImage(void);
};
#endif //CLASSFFLOWTAKEIMAGE_H
#endif // CLASSFFLOWTAKEIMAGE_H

View 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

View 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

View File

@@ -1,91 +0,0 @@
#include <sstream>
#include "ClassFlowWriteList.h"
#include "Helper.h"
#include "time_sntp.h"
#include "../../include/defines.h"
#include <time.h>
void ClassFlowWriteList::SetInitialParameter(void)
{
flowpostprocessing = NULL;
previousElement = NULL;
ListFlowControll = NULL;
disabled = false;
}
ClassFlowWriteList::ClassFlowWriteList()
{
SetInitialParameter();
}
ClassFlowWriteList::ClassFlowWriteList(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];
}
}
}
bool ClassFlowWriteList::ReadParameter(FILE* pfile, string& aktparamgraph)
{
std::vector<string> splitted;
aktparamgraph = trim(aktparamgraph);
if (aktparamgraph.size() == 0)
if (!this->GetNextParagraph(pfile, aktparamgraph))
return false;
if (toUpper(aktparamgraph).compare("[MQTT]") != 0)
return false;
while (this->getNextLine(pfile, &aktparamgraph) && !this->isNewParagraph(aktparamgraph))
{
splitted = ZerlegeZeile(aktparamgraph);
}
return true;
}
bool ClassFlowWriteList::doFlow(string zwtime)
{
std::string line = "";
std::string result;
std::string resulterror = "";
std::string resultraw = "";
std::string resultrate = "";
std::string resulttimestamp = "";
string zw = "";
string namenumber = "";
if (flowpostprocessing)
{
std::vector<NumberPost*>* NUMBERS = flowpostprocessing->GetNumbers();
for (int i = 0; i < (*NUMBERS).size(); ++i)
{
result = (*NUMBERS)[i]->ReturnValue;
resultraw = (*NUMBERS)[i]->ReturnRawValue;
resulterror = (*NUMBERS)[i]->ErrorMessageText;
resultrate = (*NUMBERS)[i]->ReturnRateValue;
resulttimestamp = (*NUMBERS)[i]->timeStamp;
line = line + resulttimestamp + "\t" + resultraw + "\t" + result + "\t" + resultraw + "\t" + resultrate + "\t" + resulttimestamp + "\t";
}
}
return true;
}

View File

@@ -1,27 +0,0 @@
#pragma once
#ifndef CLASSFFLOWPWRITELIST_H
#define CLASSFFLOWPWRITELIST_H
#include "ClassFlow.h"
#include "ClassFlowPostProcessing.h"
#include <string>
class ClassFlowWriteList :
public ClassFlow
{
protected:
ClassFlowPostProcessing* flowpostprocessing;
void SetInitialParameter(void);
public:
ClassFlowWriteList();
ClassFlowWriteList(std::vector<ClassFlow*>* lfc);
bool ReadParameter(FILE* pfile, string& aktparamgraph);
bool doFlow(string time);
string name(){return "ClassFlowWriteList";};
};
#endif //CLASSFFLOWPWRITELIST_H

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,91 @@
#pragma once
#ifndef MAINFLOWCONTROL_H
#define MAINFLOWCONTROL_H
#include <esp_log.h>
#include <string>
#include <esp_http_server.h>
#include "CImageBasis.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;
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 CheckIsPlannedReboot(void);
bool getIsPlannedReboot(void);
void InitializeFlowTask(void);
void DeleteMainFlowTask(void);
bool isSetupModusActive(void);
int getCountFlowRounds(void);
#ifdef ENABLE_MQTT
esp_err_t MQTTCtrlFlowStart(std::string _topic);
#endif // ENABLE_MQTT
esp_err_t GetRawJPG(httpd_req_t *req);
esp_err_t GetJPG(std::string _filename, httpd_req_t *req);
#endif // MAINFLOWCONTROL_H

View File

@@ -2,6 +2,6 @@ FILE(GLOB_RECURSE app_sources ${CMAKE_CURRENT_SOURCE_DIR}/*.*)
idf_component_register(SRCS ${app_sources}
INCLUDE_DIRS "."
REQUIRES tflite-lib jomjol_logfile fatfs sdmmc)
REQUIRES esp_timer esp-tflite-micro jomjol_logfile fatfs sdmmc vfs)

File diff suppressed because it is too large Load Diff

View File

@@ -6,6 +6,7 @@
#include <string>
#include <fstream>
#include <vector>
#include "sdmmc_cmd.h"
using namespace std;
@@ -15,11 +16,12 @@ std::size_t file_size(const std::string& file_name);
void FindReplace(std::string& line, std::string& oldString, std::string& newString);
bool CopyFile(string input, string output);
bool DeleteFile(string fn);
bool DeleteFile(string filename);
bool RenameFile(string from, string to);
bool RenameFolder(string from, string to);
bool MakeDir(std::string _what);
bool FileExists(string filename);
bool FolderExists(string foldername);
string RundeOutput(double _in, int _anzNachkomma);
@@ -32,7 +34,6 @@ string getFileType(string filename);
string getFileFullFileName(string filename);
string getDirectory(string filename);
int mkdir_r(const char *dir, const mode_t mode);
int removeFolder(const char* folderPath, const char* logTag);
@@ -41,6 +42,7 @@ string toUpper(string in);
float temperatureRead();
std::string intToHexString(int _valueInt);
time_t addDays(time_t startTime, int days);
void memCopyGen(uint8_t* _source, uint8_t* _target, int _size);
@@ -67,7 +69,6 @@ string getSDCardSectorSize();
string getMac(void);
/* Error bit fields
One bit per error
Make sure it matches https://jomjol.github.io/AI-on-the-edge-device-docs/Error-Codes */
@@ -97,8 +98,18 @@ const char* get404(void);
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 logIt);
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

View File

@@ -3,6 +3,7 @@
#ifdef DEBUG_ENABLE_SYSINFO
#include "esp_sys.h"
#include "esp_chip_info.h"
#include <string>
@@ -121,7 +122,7 @@ std::string get_device_info()
}
#ifdef USE_HIMEM_IF_AVAILABLE
sprintf(aMsgBuf,"spiram size %u\n", esp_spiram_get_size());
sprintf(aMsgBuf,"spiram size %u\n", esp_psram_get_size());
espInfoResultStr += std::string(aMsgBuf);
sprintf(aMsgBuf,"himem free %u\n", esp_himem_get_free_size());
espInfoResultStr += std::string(aMsgBuf);

View File

@@ -16,9 +16,9 @@
#include <esp_spi_flash.h>
#include <esp_heap_caps.h>
// for esp_spiram_get_size
// for esp_psram_get_size
extern "C" {
#include <esp32/spiram.h>
#include "esp_psram.h"
#ifdef USE_HIMEM_IF_AVAILABLE
#include <esp32/himem.h>
#endif

View File

@@ -0,0 +1,211 @@
#include "ClassLogFile.h"
#include "../../include/defines.h"
#include "psram.h"
static const char* TAG = "PSRAM";
using namespace std;
void *shared_region = NULL;
uint32_t allocatedBytesForSTBI = 0;
std::string sharedMemoryInUseFor = "";
/** Reserve a large block in the PSRAM which will be shared between the different steps.
* Each step uses it differently but only wiuthin itself. */
bool reserve_psram_shared_region(void) {
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "Allocating shared PSRAM region (" +
std::to_string(TENSOR_ARENA_SIZE + MAX_MODEL_SIZE) + " bytes)...");
shared_region = malloc_psram_heap("Shared PSRAM region", TENSOR_ARENA_SIZE + MAX_MODEL_SIZE,
MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT);
if (shared_region == NULL) {
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Failed to allocating shared PSRAM region!");
return false;
}
else {
return true;
}
}
/*******************************************************************
* Memory used in Take Image (STBI)
*******************************************************************/
bool psram_init_shared_memory_for_take_image_step(void) {
if (sharedMemoryInUseFor != "") {
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Shared memory in PSRAM already in use for " + sharedMemoryInUseFor + "!");
return false;
}
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "Init shared memory for step 'Take Image' (STBI buffers)");
allocatedBytesForSTBI = 0;
sharedMemoryInUseFor = "TakeImage";
return true;
}
void psram_deinit_shared_memory_for_take_image_step(void) {
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "Deinit shared memory for step 'Take Image' (STBI buffers)");
allocatedBytesForSTBI = 0;
sharedMemoryInUseFor = "";
}
void *psram_reserve_shared_stbi_memory(size_t size) {
/* Only large buffers should be placed in the shared PSRAM
* If we also place all smaller STBI buffers here, we get artefacts for some reasons. */
if (size >= 100000) {
if ((allocatedBytesForSTBI + size) > TENSOR_ARENA_SIZE + MAX_MODEL_SIZE) { // Check if it still fits in the shared region
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Shared memory in PSRAM too small (STBI) to fit additional " +
std::to_string(size) + " bytes! Available: " + std::to_string(TENSOR_ARENA_SIZE + MAX_MODEL_SIZE - allocatedBytesForSTBI) + " bytes!");
return NULL;
}
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "Allocating memory (" + std::to_string(size) + " bytes) for STBI (use shared memory in PSRAM)...");
allocatedBytesForSTBI += size;
return (uint8_t *)shared_region + allocatedBytesForSTBI - size;
}
else { // Normal PSRAM
return malloc_psram_heap("STBI", size, MALLOC_CAP_SPIRAM);
}
}
void *psram_reallocate_shared_stbi_memory(void *ptr, size_t newsize) {
char buf[20];
sprintf(buf, "%p", ptr);
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "STBI requested realloc for " + std::string(buf) + " but this is currently unsupported!");
return NULL;
}
void psram_free_shared_stbi_memory(void *p) {
if ((p >= shared_region) && (p <= ((uint8_t *)shared_region + allocatedBytesForSTBI))) { // was allocated inside the shared memory
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "Part of shared memory used for STBI (PSRAM, part of shared memory) is free again");
}
else { // Normal PSRAM
free_psram_heap("STBI", p);
}
}
/*******************************************************************
* Memory used in Aligning Step
* During this step we only use the shared part of the PSRAM
* for the tmpImage.
*******************************************************************/
void *psram_reserve_shared_tmp_image_memory(void) {
if (sharedMemoryInUseFor != "") {
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Shared memory in PSRAM already in use for " + sharedMemoryInUseFor + "!");
return NULL;
}
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "Allocating tmpImage (" + std::to_string(IMAGE_SIZE) + " bytes, use shared memory in PSRAM)...");
sharedMemoryInUseFor = "Aligning";
return shared_region; // Use 1th part of the shared memory for the tmpImage (only user)
}
void psram_free_shared_temp_image_memory(void) {
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "Shared memory used for tmpImage (PSRAM, part of shared memory) is free again");
sharedMemoryInUseFor = "";
}
/*******************************************************************
* Memory used in Digitization Steps
* During this step we only use the shared part of the PSRAM for the
* Tensor Arena and one of the Models.
* The shared memory is large enough for the largest model and the
* Tensor Arena. Therefore we do not need to monitor the usage.
*******************************************************************/
void *psram_get_shared_tensor_arena_memory(void) {
if ((sharedMemoryInUseFor == "") || (sharedMemoryInUseFor == "Digitization_Model")) {
sharedMemoryInUseFor = "Digitization_Tensor";
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
}
else {
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Shared memory in PSRAM already in use for " + sharedMemoryInUseFor + "!");
return NULL;
}
}
void *psram_get_shared_model_memory(void) {
if ((sharedMemoryInUseFor == "") || (sharedMemoryInUseFor == "Digitization_Tensor")) {
sharedMemoryInUseFor = "Digitization_Model";
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
}
else {
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Shared memory in PSRAM already in use for " + sharedMemoryInUseFor + "!");
return NULL;
}
}
void psram_free_shared_tensor_arena_and_model_memory(void) {
sharedMemoryInUseFor = "";
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "Shared memory used for Tensor Arena and model (PSRAM, part of shared memory) is free again");
}
/*******************************************************************
* General
*******************************************************************/
void *malloc_psram_heap(std::string name, size_t size, uint32_t caps) {
void *ptr;
ptr = heap_caps_malloc(size, caps);
if (ptr != NULL) {
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "Allocated " + to_string(size) + " bytes in PSRAM for '" + name + "'");
}
else {
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Failed to allocate " + to_string(size) + " bytes in PSRAM for '" + name + "'!");
}
return ptr;
}
void *realloc_psram_heap(std::string name, void *ptr, size_t size, uint32_t caps) {
ptr = heap_caps_realloc(ptr, size, caps);
if (ptr != NULL) {
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "Reallocated " + to_string(size) + " bytes in PSRAM for '" + name + "'");
}
else {
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Failed to reallocate " + to_string(size) + " bytes in PSRAM for '" + name + "'!");
}
return ptr;
}
void *calloc_psram_heap(std::string name, size_t n, size_t size, uint32_t caps) {
void *ptr;
ptr = heap_caps_calloc(n, size, caps);
if (ptr != NULL) {
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "Allocated " + to_string(size) + " bytes in PSRAM for '" + name + "'");
}
else {
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Failed to allocate " + to_string(size) + " bytes in PSRAM for '" + name + "'!");
}
return ptr;
}
void free_psram_heap(std::string name, void *ptr) {
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "Freeing memory in PSRAM used for '" + name + "'...");
heap_caps_free(ptr);
}

View File

@@ -0,0 +1,35 @@
#pragma once
#ifndef PSRAM_h
#define PSRAM_h
#include "esp_heap_caps.h"
bool reserve_psram_shared_region(void);
/* Memory used in Take Image Step */
bool psram_init_shared_memory_for_take_image_step(void);
void psram_deinit_shared_memory_for_take_image_step(void);
void *psram_reserve_shared_stbi_memory(size_t size);
void *psram_reallocate_shared_stbi_memory(void *ptr, size_t newsize);
void psram_free_shared_stbi_memory(void *p);
/* Memory used in Aligning Step */
void *psram_reserve_shared_tmp_image_memory(void);
void psram_free_shared_temp_image_memory(void);
/* Memory used in Digitization Steps */
void *psram_get_shared_tensor_arena_memory(void);
void *psram_get_shared_model_memory(void);
void psram_free_shared_tensor_arena_and_model_memory(void);
/* General */
void *malloc_psram_heap(std::string name, size_t size, uint32_t caps);
void *realloc_psram_heap(std::string name, void *ptr, size_t size, uint32_t caps);
void *calloc_psram_heap(std::string name, size_t n, size_t size, uint32_t caps);
void free_psram_heap(std::string name, void *ptr);
#endif // PSRAM_h

View File

@@ -3,6 +3,7 @@
#include <stdio.h>
#include <stdbool.h>
#include <stdint.h>
#include <unistd.h>
#include <inttypes.h>
#include <sys/stat.h>
@@ -68,7 +69,6 @@ int SDCardCheckRW(void)
return 0;
}
bool SDCardCheckFolderFilePresence()
{
struct stat sb;
@@ -124,43 +124,38 @@ bool SDCardCheckFolderFilePresence()
}
/* check if file exists: index.html */
if (stat("/sdcard/html/index.html", &sb) != 0) {
if ((stat("/sdcard/html/index.html", &sb) != 0) && (stat("/sdcard/html/index.html.gz", &sb) != 0)) {
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Folder/file check: File /html/index.html not found");
bRetval = false;
}
/* check if file exists: ota.html */
if (stat("/sdcard/html/ota_page.html", &sb) != 0) {
if ((stat("/sdcard/html/ota_page.html", &sb) != 0) && (stat("/sdcard/html/ota_page.html.gz", &sb) != 0)) {
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Folder/file check: File /html/ota.html not found");
bRetval = false;
}
/* check if file exists: log.html */
if (stat("/sdcard/html/log.html", &sb) != 0) {
if ((stat("/sdcard/html/log.html", &sb) != 0) && (stat("/sdcard/html/log.html.gz", &sb) != 0)) {
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Folder/file check: File /html/log.html not found");
bRetval = false;
}
/* check if file exists: common.js */
if (stat("/sdcard/html/common.js", &sb) != 0) {
if ((stat("/sdcard/html/common.js", &sb) != 0) && (stat("/sdcard/html/common.js.gz", &sb) != 0)) {
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Folder/file check: File /html/common.js not found");
bRetval = false;
}
/* check if file exists: gethost.js */
if (stat("/sdcard/html/gethost.js", &sb) != 0) {
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Folder/file check: File /html/gethost.js not found");
bRetval = false;
}
/* check if file exists: version.txt */
if (stat("/sdcard/html/version.txt", &sb) != 0) {
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Folder/file check: File /html/version.txt not found");
bRetval = false;
}
if (bRetval)
if (bRetval) {
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "Folder/file presence check successful");
}
return bRetval;
}
}

View File

@@ -0,0 +1,646 @@
/*
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <stdlib.h>
#include <string.h>
#include "sdcard_init.h"
#include "esp_log.h"
#include "ffconf.h"
#include "esp_compiler.h"
#include "esp_vfs.h"
#include "vfs_fat_internal.h"
#include "diskio_impl.h"
#include "diskio_sdmmc.h"
#include "soc/soc_caps.h"
#include "driver/sdmmc_defs.h"
#if SOC_SDMMC_HOST_SUPPORTED
#include "driver/sdmmc_host.h"
#endif
static sdmmc_card_t* s_cards[FF_VOLUMES] = { NULL };
static bool s_disk_status_check_en[FF_VOLUMES] = { };
static const char* TAG = "sdcard_init";
#define CHECK_EXECUTE_RESULT(err, str) do { \
if ((err) !=ESP_OK) { \
ESP_LOGE(TAG, str" (0x%x).", err); \
goto cleanup; \
} \
} while(0)
typedef struct mh_vfs_fat_sd_ctx_t {
BYTE pdrv; //Drive number that is mounted
esp_vfs_fat_mount_config_t mount_config; //Mount configuration
FATFS *fs; //FAT structure pointer that is registered
sdmmc_card_t *card; //Card info
char *base_path; //Path where partition is registered
} mh_vfs_fat_sd_ctx_t;
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 variable together with `esp_vfs_fat_sdmmc_unmount` should be removed in next major version
*/
static uint32_t s_saved_ctx_id = FF_VOLUMES;
static void call_host_deinit_mh(const sdmmc_host_t *host_config);
static esp_err_t partition_card_mh(const esp_vfs_fat_mount_config_t *mount_config, const char *drv, sdmmc_card_t *card, BYTE pdrv);
//Check if SD/MMC card is present
static DSTATUS ff_sdmmc_card_available_mh(BYTE pdrv)
{
sdmmc_card_t* card = s_cards[pdrv];
assert(card);
esp_err_t err = sdmmc_get_status(card);
if (unlikely(err != ESP_OK)) {
ESP_LOGE(TAG, "Check status failed (0x%x)", err);
return STA_NOINIT;
}
return 0;
}
/**
* ff_sdmmc_status() and ff_sdmmc_initialize() return STA_NOINIT when sdmmc_get_status()
* fails. This error value is checked throughout the FATFS code.
* Both functions return 0 on success.
*/
DSTATUS ff_sdmmc_initialize_mh (BYTE pdrv)
{
return ff_sdmmc_card_available_mh(pdrv);
}
DSTATUS ff_sdmmc_status_mh(BYTE pdrv)
{
if (s_disk_status_check_en[pdrv]) {
return ff_sdmmc_card_available_mh(pdrv);
}
return 0;
}
DRESULT ff_sdmmc_read_mh (BYTE pdrv, BYTE* buff, DWORD sector, UINT count)
{
sdmmc_card_t* card = s_cards[pdrv];
assert(card);
esp_err_t err = sdmmc_read_sectors(card, buff, sector, count);
if (unlikely(err != ESP_OK)) {
ESP_LOGE(TAG, "sdmmc_read_blocks failed (%d)", err);
return RES_ERROR;
}
return RES_OK;
}
DRESULT ff_sdmmc_write_mh (BYTE pdrv, const BYTE* buff, DWORD sector, UINT count)
{
sdmmc_card_t* card = s_cards[pdrv];
assert(card);
esp_err_t err = sdmmc_write_sectors(card, buff, sector, count);
if (unlikely(err != ESP_OK)) {
ESP_LOGE(TAG, "sdmmc_write_blocks failed (%d)", err);
return RES_ERROR;
}
return RES_OK;
}
#if FF_USE_TRIM
DRESULT ff_sdmmc_trim_mh (BYTE pdrv, DWORD start_sector, DWORD sector_count)
{
sdmmc_card_t* card = s_cards[pdrv];
assert(card);
sdmmc_erase_arg_t arg;
arg = sdmmc_can_discard(card) == ESP_OK ? SDMMC_DISCARD_ARG : SDMMC_ERASE_ARG;
esp_err_t err = sdmmc_erase_sectors(card, start_sector, sector_count, arg);
if (unlikely(err != ESP_OK)) {
ESP_LOGE(TAG, "sdmmc_erase_sectors failed (%d)", err);
return RES_ERROR;
}
return RES_OK;
}
#endif //FF_USE_TRIM
DRESULT ff_sdmmc_ioctl_mh (BYTE pdrv, BYTE cmd, void* buff)
{
sdmmc_card_t* card = s_cards[pdrv];
assert(card);
switch(cmd) {
case CTRL_SYNC:
return RES_OK;
case GET_SECTOR_COUNT:
*((DWORD*) buff) = card->csd.capacity;
return RES_OK;
case GET_SECTOR_SIZE:
*((WORD*) buff) = card->csd.sector_size;
return RES_OK;
case GET_BLOCK_SIZE:
return RES_ERROR;
#if FF_USE_TRIM
case CTRL_TRIM:
if (sdmmc_can_trim(card) != ESP_OK) {
return RES_PARERR;
}
return ff_sdmmc_trim_mh (pdrv, *((DWORD*)buff), //start_sector
(*((DWORD*)buff + 1) - *((DWORD*)buff) + 1)); //sector_count
#endif //FF_USE_TRIM
}
return RES_ERROR;
}
void ff_sdmmc_set_disk_status_check_mh(BYTE pdrv, bool enable)
{
s_disk_status_check_en[pdrv] = enable;
}
void ff_diskio_register_sdmmc_mh(BYTE pdrv, sdmmc_card_t* card)
{
static const ff_diskio_impl_t sdmmc_impl = {
.init = &ff_sdmmc_initialize_mh,
.status = &ff_sdmmc_status_mh,
.read = &ff_sdmmc_read_mh,
.write = &ff_sdmmc_write_mh,
.ioctl = &ff_sdmmc_ioctl_mh
};
s_cards[pdrv] = card;
s_disk_status_check_en[pdrv] = false;
ff_diskio_register(pdrv, &sdmmc_impl);
}
BYTE ff_diskio_get_pdrv_card_mh(const sdmmc_card_t* card)
{
for (int i = 0; i < FF_VOLUMES; i++) {
if (card == s_cards[i]) {
return i;
}
}
return 0xff;
}
static bool s_get_context_id_by_card_mh(const sdmmc_card_t *card, uint32_t *out_id)
{
mh_vfs_fat_sd_ctx_t *p_ctx = NULL;
for (int i = 0; i < FF_VOLUMES; i++) {
p_ctx = s_ctx[i];
if (p_ctx) {
if (p_ctx->card == card) {
*out_id = i;
return true;
}
}
}
return false;
}
static uint32_t s_get_unused_context_id_mh(void)
{
for (uint32_t i = 0; i < FF_VOLUMES; i++) {
if (!s_ctx[i]) {
return i;
}
}
return FF_VOLUMES;
}
static esp_err_t mount_prepare_mem_mh(const char *base_path, BYTE *out_pdrv, char **out_dup_path, sdmmc_card_t** out_card)
{
esp_err_t err = ESP_OK;
char* dup_path = NULL;
sdmmc_card_t* card = NULL;
// connect SDMMC driver to FATFS
BYTE pdrv = FF_DRV_NOT_USED;
if (ff_diskio_get_drive(&pdrv) != ESP_OK || pdrv == FF_DRV_NOT_USED) {
ESP_LOGD(TAG, "the maximum count of volumes is already mounted");
return ESP_ERR_NO_MEM;
}
// not using ff_memalloc here, as allocation in internal RAM is preferred
card = (sdmmc_card_t*)malloc(sizeof(sdmmc_card_t));
if (card == NULL) {
ESP_LOGD(TAG, "could not locate new sdmmc_card_t");
err = ESP_ERR_NO_MEM;
goto cleanup;
}
dup_path = strdup(base_path);
if(!dup_path){
ESP_LOGD(TAG, "could not copy base_path");
err = ESP_ERR_NO_MEM;
goto cleanup;
}
*out_card = card;
*out_pdrv = pdrv;
*out_dup_path = dup_path;
return ESP_OK;
cleanup:
free(card);
free(dup_path);
return err;
}
static esp_err_t s_f_mount_mh(sdmmc_card_t *card, FATFS *fs, const char *drv, uint8_t pdrv, const esp_vfs_fat_mount_config_t *mount_config)
{
esp_err_t err = ESP_OK;
FRESULT res = f_mount(fs, drv, 1);
if (res != FR_OK) {
err = ESP_FAIL;
ESP_LOGW(TAG, "failed to mount card (%d)", res);
bool need_mount_again = (res == FR_NO_FILESYSTEM || res == FR_INT_ERR) && mount_config->format_if_mount_failed;
if (!need_mount_again) {
return ESP_FAIL;
}
err = partition_card_mh(mount_config, drv, card, pdrv);
if (err != ESP_OK) {
return err;
}
ESP_LOGW(TAG, "mounting again");
res = f_mount(fs, drv, 0);
if (res != FR_OK) {
err = ESP_FAIL;
ESP_LOGD(TAG, "f_mount failed after formatting (%d)", res);
return err;
}
}
return ESP_OK;
}
static esp_err_t mount_to_vfs_fat_mh(const esp_vfs_fat_mount_config_t *mount_config, sdmmc_card_t *card, uint8_t pdrv, const char *base_path, FATFS **out_fs)
{
FATFS *fs = NULL;
esp_err_t err;
ff_diskio_register_sdmmc_mh(pdrv, card);
ff_sdmmc_set_disk_status_check_mh(pdrv, mount_config->disk_status_check_enable);
ESP_LOGD(TAG, "using pdrv=%i", pdrv);
char drv[3] = {(char)('0' + pdrv), ':', 0};
// connect FATFS to VFS
err = esp_vfs_fat_register(base_path, drv, mount_config->max_files, &fs);
*out_fs = fs;
if (err == ESP_ERR_INVALID_STATE) {
// it's okay, already registered with VFS
} else if (err != ESP_OK) {
ESP_LOGD(TAG, "esp_vfs_fat_register failed 0x(%x)", err);
goto fail;
}
// Try to mount partition
err = s_f_mount_mh(card, fs, drv, pdrv, mount_config);
if (err != ESP_OK) {
goto fail;
}
return ESP_OK;
fail:
if (fs) {
f_mount(NULL, drv, 0);
}
esp_vfs_fat_unregister_path(base_path);
ff_diskio_unregister(pdrv);
return err;
}
static esp_err_t partition_card_mh(const esp_vfs_fat_mount_config_t *mount_config, const char *drv, sdmmc_card_t *card, BYTE pdrv)
{
FRESULT res = FR_OK;
esp_err_t err;
const size_t workbuf_size = 4096;
void* workbuf = NULL;
ESP_LOGW(TAG, "partitioning card");
workbuf = ff_memalloc(workbuf_size);
if (workbuf == NULL) {
return ESP_ERR_NO_MEM;
}
LBA_t plist[] = {100, 0, 0, 0};
res = f_fdisk(pdrv, plist, workbuf);
if (res != FR_OK) {
err = ESP_FAIL;
ESP_LOGD(TAG, "f_fdisk failed (%d)", res);
goto fail;
}
size_t alloc_unit_size = esp_vfs_fat_get_allocation_unit_size(card->csd.sector_size, mount_config->allocation_unit_size);
ESP_LOGW(TAG, "formatting card, allocation unit size=%d", alloc_unit_size);
const MKFS_PARM opt = {(BYTE)FM_ANY, 0, 0, 0, alloc_unit_size};
res = f_mkfs(drv, &opt, workbuf, workbuf_size);
if (res != FR_OK) {
err = ESP_FAIL;
ESP_LOGD(TAG, "f_mkfs failed (%d)", res);
goto fail;
}
free(workbuf);
return ESP_OK;
fail:
free(workbuf);
return err;
}
#if SOC_SDMMC_HOST_SUPPORTED
static esp_err_t init_sdmmc_host_mh(int slot, const void *slot_config, int *out_slot)
{
*out_slot = slot;
return sdmmc_host_init_slot(slot, (const sdmmc_slot_config_t*) slot_config);
}
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;
mh_vfs_fat_sd_ctx_t *ctx = NULL;
uint32_t ctx_id = FF_VOLUMES;
FATFS *fs = NULL;
int card_handle = -1; //uninitialized
sdmmc_card_t* card = NULL;
BYTE pdrv = FF_DRV_NOT_USED;
char* dup_path = NULL;
bool host_inited = false;
err = mount_prepare_mem_mh(base_path, &pdrv, &dup_path, &card);
if (err != ESP_OK) {
ESP_LOGE(TAG, "mount_prepare failed");
return err;
}
err = (*host_config->init)();
CHECK_EXECUTE_RESULT(err, "host init failed");
//deinit() needs to be called to revert the init
host_inited = true;
//If this failed (indicated by card_handle != -1), slot deinit needs to called()
//leave card_handle as is to indicate that (though slot deinit not implemented yet.
err = init_sdmmc_host_mh(host_config->slot, slot_config, &card_handle);
CHECK_EXECUTE_RESULT(err, "slot init failed");
// probe and initialize card
err = sdmmc_card_init(host_config, card);
CHECK_EXECUTE_RESULT(err, "sdmmc_card_init failed");
err = mount_to_vfs_fat_mh(mount_config, card, pdrv, dup_path, &fs);
CHECK_EXECUTE_RESULT(err, "mount_to_vfs failed");
if (out_card != NULL) {
*out_card = card;
}
//For deprecation backward compatibility
if (s_saved_ctx_id == FF_VOLUMES) {
s_saved_ctx_id = 0;
}
ctx = calloc(sizeof(mh_vfs_fat_sd_ctx_t), 1);
if (!ctx) {
CHECK_EXECUTE_RESULT(ESP_ERR_NO_MEM, "no mem");
}
ctx->pdrv = pdrv;
memcpy(&ctx->mount_config, mount_config, sizeof(esp_vfs_fat_mount_config_t));
ctx->card = card;
ctx->base_path = dup_path;
ctx->fs = fs;
ctx_id = s_get_unused_context_id_mh();
assert(ctx_id != FF_VOLUMES);
s_ctx[ctx_id] = ctx;
return ESP_OK;
cleanup:
if (host_inited) {
call_host_deinit_mh(host_config);
}
free(card);
free(dup_path);
return err;
}
#endif
static esp_err_t init_sdspi_host_mh(int slot, const void *slot_config, int *out_slot)
{
esp_err_t err = sdspi_host_init_device((const sdspi_device_config_t*)slot_config, out_slot);
if (err != ESP_OK) {
ESP_LOGE(TAG,
"Failed to attach sdspi device onto an SPI bus (rc=0x%x), please initialize the \
bus first and check the device parameters."
, err);
}
return err;
}
esp_err_t esp_vfs_fat_sdspi_mount_mh(const char* base_path, const sdmmc_host_t* host_config_input, const sdspi_device_config_t* slot_config, const esp_vfs_fat_mount_config_t* mount_config, sdmmc_card_t** out_card)
{
const sdmmc_host_t* host_config = host_config_input;
esp_err_t err;
mh_vfs_fat_sd_ctx_t *ctx = NULL;
uint32_t ctx_id = FF_VOLUMES;
FATFS *fs = NULL;
int card_handle = -1; //uninitialized
bool host_inited = false;
BYTE pdrv = FF_DRV_NOT_USED;
sdmmc_card_t* card = NULL;
char* dup_path = NULL;
err = mount_prepare_mem_mh(base_path, &pdrv, &dup_path, &card);
if (err != ESP_OK) {
ESP_LOGE(TAG, "mount_prepare failed");
return err;
}
//the init() function is usually empty, doesn't require any deinit to revert it
err = (*host_config->init)();
CHECK_EXECUTE_RESULT(err, "host init failed");
err = init_sdspi_host_mh(host_config->slot, slot_config, &card_handle);
CHECK_EXECUTE_RESULT(err, "slot init failed");
//Set `host_inited` to true to indicate that host_config->deinit() needs
//to be called to revert `init_sdspi_host`
host_inited = true;
//The `slot` argument inside host_config should be replaced by the SD SPI handled returned
//above. But the input pointer is const, so create a new variable.
sdmmc_host_t new_config;
if (card_handle != host_config->slot) {
new_config = *host_config_input;
host_config = &new_config;
new_config.slot = card_handle;
}
// probe and initialize card
err = sdmmc_card_init(host_config, card);
CHECK_EXECUTE_RESULT(err, "sdmmc_card_init failed");
err = mount_to_vfs_fat_mh(mount_config, card, pdrv, dup_path, &fs);
CHECK_EXECUTE_RESULT(err, "mount_to_vfs failed");
if (out_card != NULL) {
*out_card = card;
}
//For deprecation backward compatibility
if (s_saved_ctx_id == FF_VOLUMES) {
s_saved_ctx_id = 0;
}
ctx = calloc(sizeof(mh_vfs_fat_sd_ctx_t), 1);
if (!ctx) {
CHECK_EXECUTE_RESULT(ESP_ERR_NO_MEM, "no mem");
}
ctx->pdrv = pdrv;
memcpy(&ctx->mount_config, mount_config, sizeof(esp_vfs_fat_mount_config_t));
ctx->card = card;
ctx->base_path = dup_path;
ctx->fs = fs;
ctx_id = s_get_unused_context_id_mh();
assert(ctx_id != FF_VOLUMES);
s_ctx[ctx_id] = ctx;
return ESP_OK;
cleanup:
if (host_inited) {
call_host_deinit_mh(host_config);
}
free(card);
free(dup_path);
return err;
}
static void call_host_deinit_mh(const sdmmc_host_t *host_config)
{
if (host_config->flags & SDMMC_HOST_FLAG_DEINIT_ARG) {
host_config->deinit_p(host_config->slot);
} else {
host_config->deinit();
}
}
static esp_err_t unmount_card_core_mh(const char *base_path, sdmmc_card_t *card)
{
BYTE pdrv = ff_diskio_get_pdrv_card_mh(card);
if (pdrv == 0xff) {
return ESP_ERR_INVALID_ARG;
}
// unmount
char drv[3] = {(char)('0' + pdrv), ':', 0};
f_mount(0, drv, 0);
// release SD driver
ff_diskio_unregister(pdrv);
call_host_deinit_mh(&card->host);
free(card);
esp_err_t err = esp_vfs_fat_unregister_path(base_path);
return err;
}
esp_err_t esp_vfs_fat_sdmmc_unmount_mh(void)
{
esp_err_t err = unmount_card_core_mh(s_ctx[s_saved_ctx_id]->base_path, s_ctx[s_saved_ctx_id]->card);
free(s_ctx[s_saved_ctx_id]);
s_ctx[s_saved_ctx_id] = NULL;
s_saved_ctx_id = FF_VOLUMES;
return err;
}
esp_err_t esp_vfs_fat_sdcard_unmount_mh(const char *base_path, sdmmc_card_t *card)
{
uint32_t id = FF_VOLUMES;
bool found = s_get_context_id_by_card_mh(card, &id);
if (!found) {
return ESP_ERR_INVALID_ARG;
}
free(s_ctx[id]);
s_ctx[id] = NULL;
esp_err_t err = unmount_card_core_mh(base_path, card);
return err;
}
esp_err_t esp_vfs_fat_sdcard_format_mh(const char *base_path, sdmmc_card_t *card)
{
esp_err_t ret = ESP_OK;
if (!card) {
ESP_LOGE(TAG, "card not initialized");
return ESP_ERR_INVALID_STATE;
}
BYTE pdrv = ff_diskio_get_pdrv_card_mh(card);
if (pdrv == 0xff) {
ESP_LOGE(TAG, "card driver not registered");
return ESP_ERR_INVALID_STATE;
}
const size_t workbuf_size = 4096;
void *workbuf = ff_memalloc(workbuf_size);
if (workbuf == NULL) {
return ESP_ERR_NO_MEM;
}
//unmount
char drv[3] = {(char)('0' + pdrv), ':', 0};
f_mount(0, drv, 0);
//format
uint32_t id = FF_VOLUMES;
bool found = s_get_context_id_by_card_mh(card, &id);
assert(found);
size_t alloc_unit_size = esp_vfs_fat_get_allocation_unit_size(card->csd.sector_size, s_ctx[id]->mount_config.allocation_unit_size);
ESP_LOGI(TAG, "Formatting card, allocation unit size=%d", alloc_unit_size);
const MKFS_PARM opt = {(BYTE)FM_ANY, 0, 0, 0, alloc_unit_size};
FRESULT res = f_mkfs(drv, &opt, workbuf, workbuf_size);
free(workbuf);
if (res != FR_OK) {
ret = ESP_FAIL;
ESP_LOGD(TAG, "f_mkfs failed (%d)", res);
}
//mount back
esp_err_t err = s_f_mount_mh(card, s_ctx[id]->fs, drv, pdrv, &s_ctx[id]->mount_config);
if (err != ESP_OK) {
unmount_card_core_mh(base_path, card);
ESP_LOGE(TAG, "failed to format, resources recycled, please mount again");
}
return ret;
}

Some files were not shown because too many files have changed in this diff Show More