diff --git a/Changelog.md b/Changelog.md index 54cbc5c6..ac662cec 100644 --- a/Changelog.md +++ b/Changelog.md @@ -62,7 +62,6 @@ xxx @jomjol, TODO: are those URLS correct? The `update.zip` does not contain a ` - n.a. - ## [12.0.1](https://github.com/jomjol/AI-on-the-edge-device/releases/tag/v12.0.1), 2022-09-29 Improve **u**ser e**x**perience diff --git a/FeatureRequest.md b/FeatureRequest.md index 1b2bc592..c2d77d5a 100644 --- a/FeatureRequest.md +++ b/FeatureRequest.md @@ -11,8 +11,6 @@ ____ - - #### #33 Implement MATTER protocoll * see [#1404](https://github.com/jomjol/AI-on-the-edge-device/issues/1404) @@ -35,6 +33,9 @@ ____ accept the new value and calculate correctly the difference. (see line 739 onwards in ClassFlowPostProcessing.cpp) +#### ~~#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~~ #### #28 Improved error handling for ROIs @@ -68,7 +69,13 @@ ____ * Show the CPU Temp directly in Webpage. Also add the value to MQTT sending - + + +#### ~~#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~~ + + #### #21 Extended "CheckDigitalConsistency" Logik @@ -76,21 +83,40 @@ ____ +#### #20 Deep sleep and push mode + +* Let the device be normally in deep sleep state, and wake it up periodically to collect data and push it via MQTT or HTTP post. +* Support ESP-NOW to reduce the overhead of connecting to wifi and mqtt +* the above should enable battery powered applications + +* An other way to set deep sleep would be to enable it in a specific period (at night). + + +#### #19 Extended log informations + +* https://github.com/jomjol/AI-on-the-edge-device/issues/580 + + + +#### ~~#18 Document WLAN-strength in web page~~ + +* ~~https://github.com/jomjol/AI-on-the-edge-device/issues/563~~ + + + +#### ~~#17 Direct InfluxDB connection~~ + +* ~~Done in v10.6.0~~ + #### #16 Serial Communication * https://github.com/jomjol/AI-on-the-edge-device/issues/512 - * Send the readout value via RX/TX interface with a dedicated TAG - * Make dedicated communication FlowModule - * Modification of RX/TX communication - * Configuration interfache - - #### #15 Calibration for FishEye image @@ -104,6 +130,16 @@ ____ +#### ~~#14 Backup and restore option for configuration~~- implemented v11.3.1 + +* ~~https://github.com/jomjol/AI-on-the-edge-device/issues/459~~ + +* ~~Implement a zip file compression for store and restore~~ + +* ~~Update the html to handle it~~ + + + #### #13 Manage non linear gauge without CNN re-training * https://github.com/jomjol/AI-on-the-edge-device/issues/443 @@ -112,6 +148,12 @@ ____ +#### ~~#12 Less reboots due to memory leakage~~ + +* ~~Issue: #414 & #425 #430~~ + + + #### #11 MQTT - configurable payload * https://github.com/jomjol/AI-on-the-edge-device/issues/344 @@ -124,14 +166,18 @@ ____ +#### #9 Basic auth for the UI + +* https://github.com/jomjol/AI-on-the-edge-device/issues/283 + +* Implementation of an authentication mechanism. + #### #8 MQTT configurable readout intervall Make the readout intervall configurable via MQTT. * Change the mqtt part to receive and process input and not only sending - - #### #7 Extended Error Handling Check different types of error (e.g. tflite not availabe) and generate an error on the html page. @@ -142,7 +188,15 @@ To do: * Implement a checking algo * Extend the firmware and html page for the error handling +#### ~~#6 Check for double ROI names~~ - implemented v8.0.0 +~~Check during configuration, that ROI names are unique.~~ + +~~To do:~~ + +* ~~Implementation of ROI name checking in html code before saving analog or digital ROIs~~ + + #### #5 Configurable decimal separator (point or comma) @@ -156,112 +210,6 @@ To do: -#### #2 MQTT-controll with callback -* https://github.com/jomjol/AI-on-the-edge-device/issues/105 - -Extend the MQTT client to also enable callbacks for configuration setting - -To do: - -* implement callback for receiving information and override `config.ini` settings - -* change configuration management to handle online updates (currently changes need a restart) - -* think about the startup, as there the default config is loaded - - - -____ - - - -# Refused - -#### #9 Basic auth for the UI - -* https://github.com/jomjol/AI-on-the-edge-device/issues/283 - -* Implementation of an authentication mechanism. - -This will not be part of the free version - - - -#### #20 Deep sleep and push mode - -* Let the device be normally in deep sleep state, and wake it up periodically to collect data and push it via MQTT or HTTP post. -* Support ESP-NOW to reduce the overhead of connecting to wifi and mqtt -* the above should enable battery powered applications - -* An other way to set deep sleep would be to enable it in a specific period (at night). - -Technically not possible, as the limiting factor for the power consumption is not the esp32, but the electrical curcuit on the ESP32CAM board, which consumes a lot already in deep sleep mode. - - - -# Closed - - -#### ~~#29 Add favicon and use the hostname for the website~~- implemented v11.3.1 - - - -#### ~~#19 Extended log informations~~ - -~~* https://github.com/jomjol/AI-on-the-edge-device/issues/580~~ - - - -#### ~~#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~~ - - - -#### ~~#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~~ - - - -#### ~~#18 Document WLAN-strength in web page~~ - -* ~~https://github.com/jomjol/AI-on-the-edge-device/issues/563~~ - - - -#### ~~#17 Direct InfluxDB connection~~ - -* ~~Done in v10.6.0~~ - - - -#### ~~#14 Backup and restore option for configuration~~- implemented v11.3.1 - -* ~~https://github.com/jomjol/AI-on-the-edge-device/issues/459~~ - -* ~~Implement a zip file compression for store and restore~~ - -* ~~Update the html to handle it~~ - - - -#### ~~#12 Less reboots due to memory leakage~~ - -* ~~Issue: #414 & #425 #430~~ - - - -#### ~~#6 Check for double ROI names~~ - implemented v8.0.0 - -~~Check during configuration, that ROI names are unique.~~ - -~~To do:~~ - -* ~~Implementation of ROI name checking in html code before saving analog or digital ROIs~~ - - - #### ~~#4 Initial Shifting and Rotation~~ - implemented v7.0.0 * ~~https://github.com/jomjol/AI-on-the-edge-device/issues/123~~ @@ -288,6 +236,27 @@ Technically not possible, as the limiting factor for the power consumption is no + + +____ + +#### #2 MQTT-controll with callback +* https://github.com/jomjol/AI-on-the-edge-device/issues/105 + +Extend the MQTT client to also enable callbacks for configuration setting + +To do: + +* implement callback for receiving information and override `config.ini` settings + +* change configuration management to handle online updates (currently changes need a restart) + +* think about the startup, as there the default config is loaded + + + +____ + #### ~~#1 Optional GPIO for external flash/lighting~~ - implemented (v8.0.0) * ~~https://github.com/jomjol/AI-on-the-edge-device/issues/133~~ @@ -301,6 +270,3 @@ Technically not possible, as the limiting factor for the power consumption is no * ~~Implementation of a software module for external light source (e.g. WS8132 LED controller, ...)~~ * ~~Update of the camera module to use the external light instead of the internal flash light~~ * ~~Adopt the configuration algorithm with a configurable light source~~ - - - diff --git a/code/components/jomjol_controlGPIO/SmartLeds.h b/code/components/jomjol_controlGPIO/SmartLeds.h index 4c46fec7..824eb337 100644 --- a/code/components/jomjol_controlGPIO/SmartLeds.h +++ b/code/components/jomjol_controlGPIO/SmartLeds.h @@ -269,8 +269,7 @@ private: std::unique_ptr< Rgb[] > _secondBuffer; Rgb *_buffer; - SemaphoreHandle_t _finishedFlag; -// xSemaphoreHandle _finishedFlag; + xSemaphoreHandle _finishedFlag; int _pixelPosition; int _componentPosition; diff --git a/code/components/jomjol_fileserver_ota/server_file.cpp b/code/components/jomjol_fileserver_ota/server_file.cpp index c46d7636..e2e05a74 100644 --- a/code/components/jomjol_fileserver_ota/server_file.cpp +++ b/code/components/jomjol_fileserver_ota/server_file.cpp @@ -955,7 +955,7 @@ std::string unzip_new(std::string _in_zip_file, std::string _target_zip, std::st zw = std::string(archive_filename); ESP_LOGD(TAG, "Rohfilename: %s", zw.c_str()); - if (getFileType(zw) == "BIN") + if (toUpper(zw) == "FIRMWARE.BIN") { zw = _target_bin + zw; ret = zw; diff --git a/code/components/jomjol_flowcontroll/ClassFlowControll.cpp b/code/components/jomjol_flowcontroll/ClassFlowControll.cpp index b2cefbd5..ad69ed1b 100644 --- a/code/components/jomjol_flowcontroll/ClassFlowControll.cpp +++ b/code/components/jomjol_flowcontroll/ClassFlowControll.cpp @@ -415,7 +415,7 @@ string ClassFlowControll::GetPrevalue(std::string _number) std::string ClassFlowControll::UpdatePrevalue(std::string _newvalue, std::string _numbers, bool _extern) { - double zw; + float zw; char* p; _newvalue = trim(_newvalue); @@ -427,7 +427,7 @@ std::string ClassFlowControll::UpdatePrevalue(std::string _newvalue, std::string } else { - zw = strtod(_newvalue.c_str(), &p); + zw = strtof(_newvalue.c_str(), &p); if (zw == 0) return "- Error in String to Value Conversion!!! Must be of format value=123.456"; } diff --git a/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.cpp b/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.cpp index f1965b52..2691118b 100644 --- a/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.cpp +++ b/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.cpp @@ -56,7 +56,6 @@ std::string ClassFlowPostProcessing::GetJSON(std::string _id, std::string _mac, else json += " \"value\": \"\"," + _lineend; json += " \"raw\": \"" + NUMBERS[i]->ReturnRawValue + "\"," + _lineend; - json += " \"pre\": \"" + NUMBERS[i]->ReturnPreValue + "\"," + _lineend; json += " \"error\": \"" + NUMBERS[i]->ErrorMessageText + "\"," + _lineend; if (NUMBERS[i]->ReturnRateValue.length() > 0) json += " \"rate\": " + NUMBERS[i]->ReturnRateValue + "," + _lineend; @@ -103,7 +102,7 @@ void ClassFlowPostProcessing::SetPreValue(double zw, string _numbers, bool _exte if (NUMBERS[j]->name == _numbers) { NUMBERS[j]->PreValue = zw; - NUMBERS[j]->ReturnPreValue = RundeOutput(zw, NUMBERS[j]->Nachkomma); + NUMBERS[j]->ReturnPreValue = std::to_string(zw); NUMBERS[j]->PreValueOkay = true; if (_extern) { diff --git a/code/dependencies.lock b/code/dependencies.lock index 6e6120b5..de82408d 100644 --- a/code/dependencies.lock +++ b/code/dependencies.lock @@ -1,3 +1,2 @@ -manifest_hash: 4e37bb0f9273c4de05f38688720fe32aa6e5b892452694a4f7a2ca1659f02cf6 -target: esp32 +manifest_hash: 45994dbfed009907994c31f6d279c5861a1eacbf219ce8b58e74e39b3393816a version: 1.0.0 diff --git a/code/main/main.cpp b/code/main/main.cpp index 92de3017..f1665a2e 100644 --- a/code/main/main.cpp +++ b/code/main/main.cpp @@ -121,8 +121,6 @@ bool Init_NVS_SDCard() void task_NoSDBlink(void *pvParameter) { -// esp_rom_gpio_pad_select_gpio(BLINK_GPIO); - gpio_pad_select_gpio(BLINK_GPIO); gpio_set_direction(BLINK_GPIO, GPIO_MODE_OUTPUT); diff --git a/code/platformio.ini b/code/platformio.ini index 9a39a856..39b6032c 100644 --- a/code/platformio.ini +++ b/code/platformio.ini @@ -13,12 +13,14 @@ src_dir = main [env:esp32cam] -;platform = espressif32@4.4.0 -platform = espressif32@5.2.0 +platform = espressif32@4.4.0 +;platform = espressif32@5.1.0 +;platform = espressif32 board = esp32cam ;board = m5stack-core-esp32 framework = espidf +;board_build.partitions = partitions_singleapp.csv board_build.partitions = partitions.csv lib_deps = diff --git a/code/test/components/jomjol-flowcontroll/test_cnnflowcontroll.cpp b/code/test/components/jomjol-flowcontroll/test_cnnflowcontroll.cpp new file mode 100644 index 00000000..9d7c9b09 --- /dev/null +++ b/code/test/components/jomjol-flowcontroll/test_cnnflowcontroll.cpp @@ -0,0 +1,107 @@ +#include +#include + +class UnderTestCNN : public ClassFlowCNNGeneral { + public: + using ClassFlowCNNGeneral::ZeigerEvalAnalogNeu; + using ClassFlowCNNGeneral::ZeigerEvalHybridNeu; + using ClassFlowCNNGeneral::ClassFlowCNNGeneral; + +}; + + +/** + * @brief test if all combinations of digit + * evaluation are running correctly + */ +void test_ZeigerEval() +{ + UnderTestCNN undertest = UnderTestCNN(nullptr, Digital100); + + // the 5.2 is already above 5.0 and the previous digit too (3) + printf("Test 5.2, 3\n"); + int result = undertest.ZeigerEvalAnalogNeu(5.2, 3); + TEST_ASSERT_EQUAL(5, result); + + // the 5.2 is already above 5.0 and the previous digit not (9) + // so the current digit shoult be reduced (4.9) + printf("Test 5.2, 9\n"); + TEST_ASSERT_EQUAL(4, undertest.ZeigerEvalAnalogNeu(5.2, 9)); + + printf("Test 4.4, 9\n"); + // the 4.4 (digital100) is not above 5 and the previous digit (analog) too (9.3) + TEST_ASSERT_EQUAL(4, undertest.ZeigerEvalAnalogNeu(4.4, 9)); + + printf("Test 4.5, 0\n"); + // the 4.5 (digital100) is not above 5 and the previous digit (analog) too (9.6) + TEST_ASSERT_EQUAL(4, undertest.ZeigerEvalAnalogNeu(4.5, 0)); + +} + +/** + * @brief test if all combinations of digit + * evaluation are running correctly + */ +void test_ZeigerEvalHybrid() { + UnderTestCNN undertest = UnderTestCNN(nullptr, Digital100); + + // the 5.2 and no previous should round down + printf("ZeigerEvalHybridNeu(5.2, 0, -1)\n"); + TEST_ASSERT_EQUAL(5, undertest.ZeigerEvalHybridNeu(5.2, 0, -1)); + + // the 5.3 and no previous should trunc to 5 + printf("ZeigerEvalHybridNeu(5.3, 0, -1)\n"); + TEST_ASSERT_EQUAL(5, undertest.ZeigerEvalHybridNeu(5.3, 0, -1)); + + printf("ZeigerEvalHybridNeu(5.7, 0, -1)\n"); + // the 5.7 and no previous should trunc to 5 + TEST_ASSERT_EQUAL(6, undertest.ZeigerEvalHybridNeu(5.7, 0, -1)); + + // the 5.8 and no previous should round up to 6 + printf("ZeigerEvalHybridNeu(5.8, 0, -1)\n"); + TEST_ASSERT_EQUAL(6, undertest.ZeigerEvalHybridNeu(5.8, 0, -1)); + + // the 5.7 with previous and the previous between 0.3-0.5 should round up to 6 + TEST_ASSERT_EQUAL(6, undertest.ZeigerEvalHybridNeu(5.7, 0.4, 1)); + + // the 5.3 with previous and the previous between 0.3-0.7 should round down to 5 + TEST_ASSERT_EQUAL(5, undertest.ZeigerEvalHybridNeu(5.3, 0.7, 1)); + + // the 5.3 with previous and the previous <=0.5 should trunc to 5 + TEST_ASSERT_EQUAL(5, undertest.ZeigerEvalHybridNeu(5.3, 0.1, 1)); + + // the 5.3 with previous and the previous >=9.5 should reduce to 4 + TEST_ASSERT_EQUAL(4, undertest.ZeigerEvalHybridNeu(5.3, 9.6, 9)); + + // the 5.7 with previous and the previous >=9.5 should trunc to 5 + TEST_ASSERT_EQUAL(5, undertest.ZeigerEvalHybridNeu(5.7, 9.6, 9)); + + // the 4.5 (digital100) is not above 5 and the previous digit (analog) not over Zero (9.6) + TEST_ASSERT_EQUAL(4, undertest.ZeigerEvalHybridNeu(4.5, 9.6, 0)); + + // the 4.5 (digital100) is not above 5 and the previous digit (analog) not over Zero (9.6) + TEST_ASSERT_EQUAL(4, undertest.ZeigerEvalHybridNeu(4.5, 9.6, 9)); + // the 4.5 (digital100) is not above 5 and the previous digit (analog) not over Zero (9.5) + TEST_ASSERT_EQUAL(4, undertest.ZeigerEvalHybridNeu(4.5, 9.5, 9)); + + // 59.96889 - Pre: 58.94888 + // 8.6 : 9.8 : 6.7 + // the 4.4 (digital100) is not above 5 and the previous digit (analog) not over Zero (9.5) + TEST_ASSERT_EQUAL(8, undertest.ZeigerEvalHybridNeu(8.6, 9.8, 9)); + + // pre = 9.9 (0.0 raw) + // zahl = 1.8 + TEST_ASSERT_EQUAL(2, undertest.ZeigerEvalHybridNeu(1.8, 9.0, 9)); + + // if a digit have an early transition and the pointer is < 9.0 + // prev (pointer) = 6.2, but on digital readout = 6.0 (prev is int parameter) + // zahl = 4.6 + TEST_ASSERT_EQUAL(4, undertest.ZeigerEvalHybridNeu(4.6, 6.0, 6)); + + + // issue #879 vorgaenger is -1, zahl = 6.7 + //TEST_ASSERT_EQUAL(7, undertest.ZeigerEvalHybrid(6.7, -1.0, -1)); + + +} + diff --git a/code/test/test_suite_flowcontroll.cpp b/code/test/test_suite_flowcontroll.cpp index 66d5dda4..f737891c 100644 --- a/code/test/test_suite_flowcontroll.cpp +++ b/code/test/test_suite_flowcontroll.cpp @@ -122,4 +122,4 @@ extern "C" void app_main() RUN_TEST(test_getReadoutRawString); UNITY_END(); -} \ No newline at end of file +}