diff --git a/Changelog.md b/Changelog.md index 95c8b53d..ca68bb66 100644 --- a/Changelog.md +++ b/Changelog.md @@ -21,6 +21,7 @@ - Updated built environment to `espressif32@v5.2.0` - [#1176](https://github.com/jomjol/AI-on-the-edge-device/discussions/1176) accept minor negative values (-0.2) if extended resolution is enabled - [#1143](https://github.com/jomjol/AI-on-the-edge-device/issues/1143) added config parameter AnalogDigitalTransitionStart. It can setup very early and very late digit transition starts. +- new version of dig-class100 (v1.4.0): added images of heliowatt powermeter ### Fixed - [#1116](https://github.com/jomjol/AI-on-the-edge-device/issues/1116) precision problem at setting prevalue diff --git a/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.cpp b/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.cpp index 076ce5b4..0e2d91c9 100644 --- a/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.cpp +++ b/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.cpp @@ -866,8 +866,6 @@ bool ClassFlowPostProcessing::doFlow(string zwtime) void ClassFlowPostProcessing::WriteDataLog(int _index) { - LogFile.WriteToFile(ESP_LOG_WARN, "Data file writing temporarily disabled, see https://github.com/jomjol/AI-on-the-edge-device/issues/1225"); - return; string analog = ""; string digital = ""; string timezw = ""; @@ -875,7 +873,7 @@ void ClassFlowPostProcessing::WriteDataLog(int _index) struct tm* timeinfo = localtime(&NUMBERS[_index]->lastvalue); strftime(buffer, 80, PREVALUE_TIME_FORMAT_OUTPUT, timeinfo); timezw = std::string(buffer); - + if (flowAnalog) analog = flowAnalog->getReadoutRawString(_index); if (flowDigit) diff --git a/code/test/components/jomjol-flowcontroll/test_flow_postrocess_helper.cpp b/code/test/components/jomjol-flowcontroll/test_flow_postrocess_helper.cpp index 6e20e395..7d577742 100644 --- a/code/test/components/jomjol-flowcontroll/test_flow_postrocess_helper.cpp +++ b/code/test/components/jomjol-flowcontroll/test_flow_postrocess_helper.cpp @@ -82,6 +82,8 @@ UnderTestPost* init_do_flow(std::vector analog, std::vector digits anaROI->result_float = analog[i]; gen_analog->ROI.push_back(anaROI); } + } else { + _undertestPost->flowAnalog = NULL; } ESP_LOGD(TAG, "Setting up of ROIs completed."); diff --git a/code/test/components/jomjol-flowcontroll/test_flow_postrocess_helper.h b/code/test/components/jomjol-flowcontroll/test_flow_postrocess_helper.h index 84e3e237..eba0ec39 100644 --- a/code/test/components/jomjol-flowcontroll/test_flow_postrocess_helper.h +++ b/code/test/components/jomjol-flowcontroll/test_flow_postrocess_helper.h @@ -4,7 +4,6 @@ #include #include #include -#include #include #include diff --git a/code/test/components/jomjol-flowcontroll/test_flow_pp_negative.cpp b/code/test/components/jomjol-flowcontroll/test_flow_pp_negative.cpp index aa3e06f6..87ee56b2 100644 --- a/code/test/components/jomjol-flowcontroll/test_flow_pp_negative.cpp +++ b/code/test/components/jomjol-flowcontroll/test_flow_pp_negative.cpp @@ -8,6 +8,8 @@ * */ void testNegative() { + + // Ohne decimal_shift std::vector digits = { 1.2, 6.7}; std::vector analogs = { 9.5, 8.4}; diff --git a/code/test/components/jomjol-flowcontroll/test_flowpostprocessing.cpp b/code/test/components/jomjol-flowcontroll/test_flowpostprocessing.cpp index 228ff4d8..a9dc4f65 100644 --- a/code/test/components/jomjol-flowcontroll/test_flowpostprocessing.cpp +++ b/code/test/components/jomjol-flowcontroll/test_flowpostprocessing.cpp @@ -13,7 +13,7 @@ * expected - enthält das erwartete Ergebnis, wobei der Dezimalpunkt genau zwischen digits und analog ist. * */ -void test_doFlow() { +void test_doFlowPP() { /* * @@ -27,7 +27,7 @@ void test_doFlow() { std::vector digits = { 1.2, 6.7}; std::vector analogs = { 9.5, 8.4}; const char* expected = "16.98"; - const char* expected_extended = "16.984"; + //const char* expected_extended = "16.984"; std::string result = process_doFlow(analogs, digits); TEST_ASSERT_EQUAL_STRING(expected, result.c_str()); @@ -108,11 +108,14 @@ void test_doFlow() { result = process_doFlow(analogs, digits); TEST_ASSERT_EQUAL_STRING(expected, result.c_str()); +} + +void test_doFlowPP1() { // https://github.com/jomjol/AI-on-the-edge-device/issues/942#issuecomment-1226966346 - digits = { 0.0, 2.9, 3.0, 2.9, 3.5, 9.5}; - analogs = { }; - expected = "33330"; - result = process_doFlow(analogs, digits); + std::vector digits = { 0.0, 2.9, 3.0, 2.9, 3.5, 9.5}; + std::vector analogs = { }; + const char* expected = "33330"; + std::string result = process_doFlow(analogs, digits); TEST_ASSERT_EQUAL_STRING(expected, result.c_str()); // https://github.com/jomjol/AI-on-the-edge-device/issues/942#issuecomment-1226966346 @@ -167,13 +170,15 @@ void test_doFlow() { expected = "395.8632"; result = process_doFlow(analogs, digits); TEST_ASSERT_EQUAL_STRING(expected, result.c_str()); +} +void test_doFlowPP2() { // Fehler bei V11.2.0 // https://github.com/jomjol/AI-on-the-edge-device/discussions/950#discussion-4338615 - digits = { 1.0, 9.0, 9.0}; // Übergang wurde um 1 erhöht (200, statt 199) - analogs = { 7.1, 4.8, 8.3}; - expected = "199.748"; - result = process_doFlow(analogs, digits, Digital); + std::vector digits = { 1.0, 9.0, 9.0}; // Übergang wurde um 1 erhöht (200, statt 199) + std::vector analogs = { 7.1, 4.8, 8.3}; + const char* expected = "199.748"; + std::string result = process_doFlow(analogs, digits, Digital); TEST_ASSERT_EQUAL_STRING(expected, result.c_str()); // Fehler bei Rolling (2002-09-09) @@ -181,7 +186,7 @@ void test_doFlow() { digits = { 3.0, 2.0, 2.0, 8.0, 9.0, 4.0, 1.7, 9.8}; // falscher Wert 32290.420 analogs = { }; expected = "32289.420"; - expected_extended= "32289.4198"; + const char* expected_extended= "32289.4198"; // FALSCH! wegen ungenügender Präzision von NUMBERS->Value // expected_extended= "32289.4198"; @@ -330,16 +335,18 @@ void test_doFlow() { // checkConsistency=false und extendResolution=true result = process_doFlow(analogs, digits, Digital100, false, true, 0); TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str()); +} +void test_doFlowPP3() { // Fehler bei V12.0.1 // https://github.com/jomjol/AI-on-the-edge-device/issues/1110#issuecomment-1265523710 - digits = { 2.0, 4.0, 6.8}; // 246.2045 als falsches Ergebnis - analogs = { 2.2, 0.1, 4.5}; - expected = "247.204"; - expected_extended= "247.2045"; + std::vector digits = { 2.0, 4.0, 6.8}; // 246.2045 als falsches Ergebnis + std::vector analogs = { 2.2, 0.1, 4.5}; + const char* expected = "247.204"; + const char* expected_extended= "247.2045"; // extendResolution=false - result = process_doFlow(analogs, digits, Digital100, false, false, 0); + std::string result = process_doFlow(analogs, digits, Digital100, false, false, 0); TEST_ASSERT_EQUAL_STRING(expected, result.c_str()); // checkConsistency=false und extendResolution=true diff --git a/code/test/test_suite_flowcontroll.cpp b/code/test/test_suite_flowcontroll.cpp index 772b8735..dccd53c7 100644 --- a/code/test/test_suite_flowcontroll.cpp +++ b/code/test/test_suite_flowcontroll.cpp @@ -104,13 +104,18 @@ extern "C" void app_main() { initGPIO(); Init_NVS_SDCard(); + esp_log_level_set("*", ESP_LOG_DEBUG); // set all components to ERROR level + UNITY_BEGIN(); RUN_TEST(testNegative); RUN_TEST(test_analogToDigit_Standard); RUN_TEST(test_analogToDigit_Transition); - RUN_TEST(test_doFlow); + RUN_TEST(test_doFlowPP); + RUN_TEST(test_doFlowPP1); + RUN_TEST(test_doFlowPP2); + RUN_TEST(test_doFlowPP3); UNITY_END(); } \ No newline at end of file diff --git a/sd-card/config/dig-class100-0130_s2_q.tflite b/sd-card/config/dig-class100-0130_s2_q.tflite deleted file mode 100644 index 5134e3b2..00000000 Binary files a/sd-card/config/dig-class100-0130_s2_q.tflite and /dev/null differ diff --git a/sd-card/config/dig-class100-0140_s2_q.tflite b/sd-card/config/dig-class100-0140_s2_q.tflite new file mode 100644 index 00000000..40ce39dd Binary files /dev/null and b/sd-card/config/dig-class100-0140_s2_q.tflite differ