mirror of
https://github.com/jomjol/AI-on-the-edge-device.git
synced 2026-01-30 06:10:43 +03:00
Merge branch 'jomjol:rolling' into rolling
This commit is contained in:
@@ -4,16 +4,19 @@
|
||||
|
||||
### Added
|
||||
|
||||
- Addes PreValue to `/json` ([#1154](https://github.com/jomjol/AI-on-the-edge-device/issues/1154))
|
||||
- added `/graph.html` to fetch measurements from the debug log and display them as a graph. Activate debug logging for this feature to work.
|
||||
- Added PreValue to `/json` ([#1154](https://github.com/jomjol/AI-on-the-edge-device/issues/1154))
|
||||
- Show graph of values direct in the user interface (thanks to [@rdmueller](https://github.com/rdmueller))
|
||||
|
||||
### Changed
|
||||
|
||||
- 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
|
||||
### Fixed
|
||||
|
||||
- [#1116](https://github.com/jomjol/AI-on-the-edge-device/issues/1116) precision problem at setting prevalue
|
||||
- [#1119](https://github.com/jomjol/AI-on-the-edge-device/issues/1119) renamed `firmware.bin` not working in OTA
|
||||
- [#1143](https://github.com/jomjol/AI-on-the-edge-device/issues/1143) changed postprocess for analog->digit (lowest digit processing)
|
||||
### Removed
|
||||
|
||||
- n.a.
|
||||
|
||||
@@ -11,18 +11,18 @@
|
||||
|
||||
____
|
||||
|
||||
#### #31 Implement InfluxDB v2.x interface
|
||||
|
||||
* Currently only InfluxDB v1.x is supportet, extend to v2.x
|
||||
* Remark: interface has changed
|
||||
* see [#1160](https://github.com/jomjol/AI-on-the-edge-device/issues/1160)
|
||||
|
||||
#### #30 Support meter clock over
|
||||
|
||||
* In case of meter clocking over, that is, reaching its max. value and starting over from 0,
|
||||
accept the new value and calculate correctly the difference.
|
||||
(see line 739 onwards in ClassFlowPostProcessing.cpp)
|
||||
|
||||
* In case of meter clocking over, that is, reaching its max. value and starting over from 0,
|
||||
accept the new value and calculate correctly the difference.
|
||||
(see line 739 onwards in ClassFlowPostProcessing.cpp)
|
||||
|
||||
|
||||
|
||||
|
||||
#### #28 Improved error handling for ROIs
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
static const char* TAG = "flow_analog";
|
||||
|
||||
bool debugdetailgeneral = true;
|
||||
bool debugdetailgeneral = false;
|
||||
|
||||
ClassFlowCNNGeneral::ClassFlowCNNGeneral(ClassFlowAlignment *_flowalign, t_CNNType _cnntype) : ClassFlowImage(NULL, TAG)
|
||||
{
|
||||
@@ -35,7 +35,7 @@ string ClassFlowCNNGeneral::getReadout(int _analog = 0, bool _extendedResolution
|
||||
if (GENERAL[_analog]->ROI.size() == 0)
|
||||
return result;
|
||||
if (debugdetailgeneral) LogFile.WriteToFile("ClassFlowCNNGeneral::getReadout _analog=" + std::to_string(_analog) + ", _extendedResolution=" + std::to_string(_extendedResolution) + ", prev=" + std::to_string(prev));
|
||||
|
||||
|
||||
if (CNNType == Analogue || CNNType == Analogue100)
|
||||
{
|
||||
float zahl = GENERAL[_analog]->ROI[GENERAL[_analog]->ROI.size() - 1]->result_float;
|
||||
@@ -147,7 +147,6 @@ int ClassFlowCNNGeneral::ZeigerEvalHybridNeu(float zahl, float zahl_vorgaenger,
|
||||
|
||||
if (AnalogerVorgaenger)
|
||||
{
|
||||
// result = ZeigerEvalAnalogToDigitNeu(zahl, eval_vorgaenger);
|
||||
result = ZeigerEvalAnalogToDigitNeu(zahl, zahl_vorgaenger, eval_vorgaenger);
|
||||
if (debugdetailgeneral) LogFile.WriteToFile("ClassFlowCNNGeneral::ZeigerEvalHybridNeu - Analoger Vorgänger, Bewertung über ZeigerEvalAnalogNeu = " + std::to_string(result) +
|
||||
" zahl: " + std::to_string(zahl) + " zahl_vorgaenger = " + std::to_string(zahl_vorgaenger)+ " eval_vorgaenger = " + std::to_string(eval_vorgaenger) + " DigitalUnschaerfe = " + std::to_string(DigitalUnschaerfe));
|
||||
@@ -216,20 +215,7 @@ int ClassFlowCNNGeneral::ZeigerEvalAnalogToDigitNeu(float zahl, float ziffer_vor
|
||||
return result;
|
||||
}
|
||||
|
||||
if ((ziffer_vorgaenger >= DigitalUebergangsbereichVorgaengerAnalogToDigit ) && (ziffer_vorgaenger <= (10.0 - DigitalUebergangsbereichVorgaengerAnalogToDigit)))
|
||||
{
|
||||
// kein Ziffernwechsel, da Vorgänger weit genug weg ist (0+/-DigitalUebergangsbereichVorgaenger) --> zahl wird gerundet
|
||||
if ((ergebnis_nachkomma <= 2) || (ergebnis_nachkomma >= 8)) // Band um die Ziffer --> Runden, da Ziffer im Rahmen Ungenauigkeit erreicht
|
||||
result = ((int) round(zahl) + 10) % 10;
|
||||
else
|
||||
result = ((int) trunc(zahl) + 10) % 10;
|
||||
|
||||
if (debugdetailgeneral) LogFile.WriteToFile("ClassFlowCNNGeneral::ZeigerEvalAnalogToDigitNeu - kein Ziffernwechsel, da Vorkomma weit genug weg = " + std::to_string(result) +
|
||||
" zahl: " + std::to_string(zahl) + " ziffer_vorgaenger = " + std::to_string(ziffer_vorgaenger) + " DigitalUnschaerfe = " + std::to_string(DigitalUnschaerfe));
|
||||
return result;
|
||||
}
|
||||
|
||||
if (ziffer_vorgaenger <= 1 && eval_vorgaenger<9) // Nulldurchgang hat stattgefunden (!Bewertung über Prev_value und nicht Zahl!) --> hier aufrunden (2.8 --> 3, aber auch 3.1 --> 3)
|
||||
if (ziffer_vorgaenger <= 3 && eval_vorgaenger<9) // Nulldurchgang hat stattgefunden (!Bewertung über Prev_value und nicht Zahl!) --> hier aufrunden (2.8 --> 3, aber auch 3.1 --> 3)
|
||||
// aber Sonderfall ziffer_vorgaeger = 0.1 vor_vorgaenger 9.9 => eval_vorgaenger ist 9, damit hat Nulldurchgang nicht stattgefunden.
|
||||
{
|
||||
if (ergebnis_nachkomma > 5)
|
||||
@@ -241,14 +227,26 @@ int ClassFlowCNNGeneral::ZeigerEvalAnalogToDigitNeu(float zahl, float ziffer_vor
|
||||
return result;
|
||||
}
|
||||
|
||||
// bleibt nur >= 9.5 --> noch kein Nulldurchgang --> 2.8 --> 2, und 3.1 --> 2
|
||||
// hier auf 4 reduziert, da erst ab Vorgänder 9 anfängt umzustellen. Bei 9.5 Vorgänger kann die aktuelle
|
||||
// Zahl noch x.4 - x.5 sein.
|
||||
if (ergebnis_nachkomma >= 4)
|
||||
result = ergebnis_vorkomma;
|
||||
else
|
||||
result = (ergebnis_vorkomma - 1 + 10) % 10;
|
||||
// Vorlauf ziffer_vorgaenger <=9.9 und ergebnis_nachkomma >=0..1 (digits drehen nach umschalten nicht gleich weiter)
|
||||
// Beispiel dig=4.0, ana=9.1 ==> dig=3
|
||||
|
||||
// Nachlauf ziffer_vorgaenger 0..2 und ergebnis_nachkomma 8..9
|
||||
// Beispiel dig=6.8, ana=2.2 ==> dig=7
|
||||
// dig=4.8, ana=5.5 => dig=4
|
||||
|
||||
// Vorlauf bei ergebnis_nachkomma >=0..1 und ziffer_vorgaenger 8..9
|
||||
if (ergebnis_nachkomma <= 1 && ziffer_vorgaenger>=8) {
|
||||
result = (ergebnis_vorkomma - 1 + 10) % 10;
|
||||
} else {
|
||||
// Ziffer bleibt bei x.8 oder x.9 "hängen", kommt also nicht richtig auf x.0
|
||||
// muss eine Rundung erfolgen
|
||||
// jedoch nicht im während der Transition (ziffer_vorgaenger>=8)
|
||||
if (eval_vorgaenger<9 && ziffer_vorgaenger<8 && ergebnis_nachkomma >= 8)
|
||||
result = ((int) round(zahl) + 10) % 10;
|
||||
else
|
||||
result = ergebnis_vorkomma;
|
||||
}
|
||||
|
||||
if (debugdetailgeneral) LogFile.WriteToFile("ClassFlowCNNGeneral::ZeigerEvalAnalogToDigitNeu - 9.0 --> noch kein Nulldurchgang = " + std::to_string(result) +
|
||||
" zahl: " + std::to_string(zahl) + " ziffer_vorgaenger = " + std::to_string(ziffer_vorgaenger) + " DigitalUnschaerfe = " + std::to_string(DigitalUnschaerfe));
|
||||
return result;
|
||||
|
||||
@@ -28,7 +28,7 @@ protected:
|
||||
float DigitalUnschaerfe = 0.2;
|
||||
int DigitalBand = 3;
|
||||
float DigitalAnalogerVorgaengerUebergangsbereich = 2;
|
||||
float DigitalUebergangsbereichVorgaengerAnalogToDigit = 1; // war vorher 2
|
||||
// nicht mehr benötigt float DigitalUebergangsbereichVorgaengerAnalogToDigit = 1; // war vorher 2
|
||||
float DigitalUebergangsbereichVorgaenger = 0.7; // 9.3 - 0.7
|
||||
float DigitalUebergangsbereichVorlauf = 9.7; // Vorlauf-Nulldurchgang passiert erst ab ca. 9.7
|
||||
|
||||
|
||||
@@ -739,12 +739,18 @@ bool ClassFlowPostProcessing::doFlow(string zwtime)
|
||||
|
||||
if (!NUMBERS[j]->AllowNegativeRates)
|
||||
{
|
||||
if (NUMBERS[j]->Value < NUMBERS[j]->PreValue)
|
||||
if ((NUMBERS[j]->Value < NUMBERS[j]->PreValue))
|
||||
{
|
||||
NUMBERS[j]->ErrorMessageText = NUMBERS[j]->ErrorMessageText + "Neg. Rate - Read: " + zwvalue + " - Raw: " + NUMBERS[j]->ReturnRawValue + " - Pre: " + RundeOutput(NUMBERS[j]->PreValue, NUMBERS[j]->Nachkomma) + " ";
|
||||
NUMBERS[j]->Value = NUMBERS[j]->PreValue;
|
||||
NUMBERS[j]->ReturnValue = "";
|
||||
continue;
|
||||
// Bei isExtendedResolution Ungenauigkeit von 0.2 mit einrechnen.
|
||||
if (NUMBERS[j]->Value < (NUMBERS[j]->PreValue-0.2) && NUMBERS[j]->isExtendedResolution) {
|
||||
NUMBERS[j]->Value = NUMBERS[j]->PreValue;
|
||||
} else {
|
||||
NUMBERS[j]->ErrorMessageText = NUMBERS[j]->ErrorMessageText + "Neg. Rate - Read: " + zwvalue + " - Raw: " + NUMBERS[j]->ReturnRawValue + " - Pre: " + RundeOutput(NUMBERS[j]->PreValue, NUMBERS[j]->Nachkomma) + " ";
|
||||
NUMBERS[j]->Value = NUMBERS[j]->PreValue;
|
||||
NUMBERS[j]->ReturnValue = "";
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
#ifdef SERIAL_DEBUG
|
||||
|
||||
@@ -1,107 +0,0 @@
|
||||
#include <unity.h>
|
||||
#include <ClassFlowCNNGeneral.h>
|
||||
|
||||
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));
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ void test_doFlow() {
|
||||
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
||||
|
||||
/*
|
||||
* https://github.com/jomjol/AI-on-the-edge-device/issues/921
|
||||
* https://github.com/jomjol/AI-on-the-edge-device/issues/921#issuecomment-1222672175
|
||||
*
|
||||
* Das Ergebnis sollte "376529.6" sein. Bzw. 16.98 ohne Extended true
|
||||
*/
|
||||
@@ -101,7 +101,7 @@ void test_doFlow() {
|
||||
|
||||
digits = { 1.1, 9.0, 4.0};
|
||||
analogs = { 8.1, 2.6, 6.25, 9.7};
|
||||
expected = "194.8259";
|
||||
expected = "193.8259";
|
||||
result = process_doFlow(analogs, digits);
|
||||
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
||||
|
||||
@@ -303,6 +303,160 @@ void test_doFlow() {
|
||||
result = process_doFlow(analogs, digits, Digital100, false, true, -3);
|
||||
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
|
||||
|
||||
// Fehler bei V12.0.1
|
||||
// Lokal
|
||||
digits = { 9.8, 9.8, 1.9, 0.9, 0.9, 9.9, 2.9, 4.8}; // 211.0345 als falsches Ergebnis
|
||||
analogs = { 5.5};
|
||||
expected = "211.0355";
|
||||
expected_extended= "211.03555";
|
||||
|
||||
// extendResolution=false
|
||||
result = process_doFlow(analogs, digits, Digital100, false, false, -3);
|
||||
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
||||
|
||||
// checkConsistency=false und extendResolution=true
|
||||
result = process_doFlow(analogs, digits, Digital100, false, true, -3);
|
||||
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
|
||||
|
||||
// Fehler bei V12.0.1
|
||||
// https://github.com/jomjol/AI-on-the-edge-device/issues/1110#issuecomment-1277425333
|
||||
digits = { 2.2, 4.5, 5.9}; // 245.938 als falsches Ergebnis
|
||||
analogs = { 9.4, 3.8, 8.6};
|
||||
expected = "245.938";
|
||||
expected_extended= "245.9386";
|
||||
|
||||
// extendResolution=false
|
||||
result = process_doFlow(analogs, digits, Digital100, false, false, 0);
|
||||
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
||||
|
||||
// checkConsistency=false und extendResolution=true
|
||||
result = process_doFlow(analogs, digits, Digital100, false, true, 0);
|
||||
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
|
||||
|
||||
// Fehler bei V12.0.1
|
||||
// https://github.com/jomjol/AI-on-the-edge-device/issues/1110#issuecomment-1277425333
|
||||
digits = { 2.2, 4.5, 5.9}; // 245.938 kein Fehler. Aber Grenzfall, deshalb mit als Test aufgenommen.
|
||||
analogs = { 9.4, 3.8, 8.6};
|
||||
expected = "245.938";
|
||||
expected_extended= "245.9386";
|
||||
|
||||
// extendResolution=false
|
||||
result = process_doFlow(analogs, digits, Digital100, false, false, 0);
|
||||
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
||||
|
||||
// checkConsistency=false und extendResolution=true
|
||||
result = process_doFlow(analogs, digits, Digital100, false, true, 0);
|
||||
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
|
||||
|
||||
// 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";
|
||||
|
||||
// extendResolution=false
|
||||
result = process_doFlow(analogs, digits, Digital100, false, false, 0);
|
||||
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
||||
|
||||
// checkConsistency=false und extendResolution=true
|
||||
result = process_doFlow(analogs, digits, Digital100, false, true, 0);
|
||||
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
|
||||
|
||||
|
||||
// Fehler bei V12.0.1
|
||||
// https://github.com/jomjol/AI-on-the-edge-device/issues/1110#issue-1391153343
|
||||
digits = { 1.0, 4.0, 2.0}; // 142.9269 als falsches Ergebnis
|
||||
analogs = { 9.2, 2.5, 6.8, 9.0};
|
||||
expected = "141.9269";
|
||||
expected_extended= "141.92690";
|
||||
|
||||
// extendResolution=false
|
||||
result = process_doFlow(analogs, digits, Digital100, false, false, 0);
|
||||
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
||||
|
||||
// checkConsistency=false und extendResolution=true
|
||||
result = process_doFlow(analogs, digits, Digital100, false, true, 0);
|
||||
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
|
||||
|
||||
|
||||
// Fehler bei V12.0.1
|
||||
// https://github.com/jomjol/AI-on-the-edge-device/issues/1110#issuecomment-1262626388
|
||||
digits = { 1.2, 6.8, 0.0, 0.0, 5.0, 2.8}; //170.05387 als falsches Ergebnis
|
||||
analogs = { 8.7};
|
||||
expected = "170.0528";
|
||||
expected_extended= "170.05287";
|
||||
|
||||
// extendResolution=false
|
||||
result = process_doFlow(analogs, digits, Digital100, false, false, -3);
|
||||
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
||||
|
||||
// checkConsistency=false und extendResolution=true
|
||||
result = process_doFlow(analogs, digits, Digital100, false, true, -3);
|
||||
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
|
||||
|
||||
|
||||
// Fehler bei rolling post V12.0.1
|
||||
// lokal watermeter1
|
||||
digits = { 0.0, 0.0, 9.0, 1.0}; //91.88174 als falsches Ergebnis
|
||||
analogs = {9.0, 8.0, 1.8, 7.4};
|
||||
expected = "90.8817";
|
||||
expected_extended= "90.88174";
|
||||
|
||||
// extendResolution=false
|
||||
result = process_doFlow(analogs, digits, Digital100, false, false, 0);
|
||||
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
||||
|
||||
// checkConsistency=false und extendResolution=true
|
||||
result = process_doFlow(analogs, digits, Digital100, false, true, 0);
|
||||
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
|
||||
|
||||
|
||||
// Fehler bei rolling post V12.0.1
|
||||
// lokal watermeter1
|
||||
digits = { 0.0, 0.0, 9.0, 1.9}; //91.38403 als falsches Ergebnis
|
||||
analogs = {3.6, 8.2, 3.2, 2.0};
|
||||
expected = "92.3832";
|
||||
expected_extended= "92.38320";
|
||||
|
||||
// extendResolution=false
|
||||
result = process_doFlow(analogs, digits, Digital100, false, false, 0);
|
||||
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
||||
|
||||
// checkConsistency=false und extendResolution=true
|
||||
result = process_doFlow(analogs, digits, Digital100, false, true, 0);
|
||||
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
|
||||
|
||||
// Fehler V11.3.0
|
||||
// https://github.com/jomjol/AI-on-the-edge-device/issues/1143#issue-1400807695
|
||||
digits = { 7.0, 4.0, 7.0, 2.0, 7.0, 5.4, 9.4}; // 7472.749 als falsches Ergebnis
|
||||
analogs = {};
|
||||
expected = "7472.759";
|
||||
expected_extended= "7472.7594";
|
||||
|
||||
// extendResolution=false
|
||||
result = process_doFlow(analogs, digits, Digital100, false, false, -3);
|
||||
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
||||
|
||||
// checkConsistency=false und extendResolution=true
|
||||
result = process_doFlow(analogs, digits, Digital100, false, true, -3);
|
||||
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
|
||||
|
||||
// Fehler V12.0.1
|
||||
// https://github.com/jomjol/AI-on-the-edge-device/issues/1143#issuecomment-1274434805
|
||||
digits = { 4.9, 6.9, 6.8}; // 576.8649 als falsches Ergebnis
|
||||
analogs = {8.6, 6.2, 5.0, 9.0};
|
||||
// fall unklar ob wirklich 577 oder 576, erst mal 577
|
||||
expected = "576.8649";
|
||||
expected_extended= "576.86490";
|
||||
|
||||
// extendResolution=false
|
||||
result = process_doFlow(analogs, digits, Digital100, false, false, 0);
|
||||
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
||||
|
||||
// checkConsistency=false und extendResolution=true
|
||||
result = process_doFlow(analogs, digits, Digital100, false, true, 0);
|
||||
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
|
||||
|
||||
}
|
||||
|
||||
@@ -388,9 +542,11 @@ std::string process_doFlow(std::vector<float> analog, std::vector<float> digits,
|
||||
}
|
||||
|
||||
string time;
|
||||
|
||||
// run test
|
||||
TEST_ASSERT_TRUE(undertestPost->doFlow(time));
|
||||
|
||||
|
||||
return undertestPost->getReadout(0);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#include <unity.h>
|
||||
#include "components/jomjol-flowcontroll/test_cnnflowcontroll.cpp"
|
||||
#include "components/jomjol-flowcontroll/test_flowpostprocessing.cpp"
|
||||
// SD-Card ////////////////////
|
||||
#include "nvs_flash.h"
|
||||
@@ -8,6 +7,24 @@
|
||||
#include "driver/sdmmc_host.h"
|
||||
#include "driver/sdmmc_defs.h"
|
||||
static const char *TAGMAIN = "main";
|
||||
#define __SD_USE_ONE_LINE_MODE__
|
||||
#include "server_GPIO.h"
|
||||
|
||||
|
||||
|
||||
|
||||
void initGPIO()
|
||||
{
|
||||
gpio_config_t io_conf;
|
||||
//set as output mode
|
||||
io_conf.mode = gpio_mode_t::GPIO_MODE_INPUT;
|
||||
//bit mask of the pins that you want to set,e.g.GPIO18/19
|
||||
io_conf.pull_down_en = gpio_pulldown_t::GPIO_PULLDOWN_ENABLE;
|
||||
//set pull-up mode
|
||||
io_conf.pull_up_en = gpio_pullup_t::GPIO_PULLUP_DISABLE;
|
||||
//configure GPIO with the given settings
|
||||
gpio_config(&io_conf);
|
||||
}
|
||||
|
||||
bool Init_NVS_SDCard()
|
||||
{
|
||||
@@ -80,11 +97,10 @@ bool Init_NVS_SDCard()
|
||||
*/
|
||||
extern "C" void app_main()
|
||||
{
|
||||
initGPIO();
|
||||
Init_NVS_SDCard();
|
||||
UNITY_BEGIN();
|
||||
|
||||
// RUN_TEST(test_ZeigerEval);
|
||||
// RUN_TEST(test_ZeigerEvalHybrid);
|
||||
RUN_TEST(test_doFlow);
|
||||
|
||||
UNITY_END();
|
||||
|
||||
@@ -644,7 +644,7 @@ textarea {
|
||||
<td colspan="3" style="padding-left: 20px;">
|
||||
<h4>
|
||||
<input type="checkbox" id="Category_InfluxDB_enabled" value="1" onclick = 'UpdateAfterCategoryCheck()' unchecked >
|
||||
<label for=Category_InfluxDB_enabled>InfluxDB</label>
|
||||
<label for=Category_InfluxDB_enabled>InfluxDB (Remark: only InfluxDB v1.x is supported, v2.x has a changed interface)</label>
|
||||
</h4>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
82
sd-card/html/graph.html
Normal file
82
sd-card/html/graph.html
Normal file
@@ -0,0 +1,82 @@
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<script src='https://cdn.plot.ly/plotly-2.14.0.min.js'></script>
|
||||
<style>
|
||||
textarea {
|
||||
width: 600px;
|
||||
height: 300px;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
function run() {
|
||||
var el = document.getElementById('cnsl');
|
||||
el && eval(el.value);
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id='chart'></div>
|
||||
<select id="selector" onchange="document.location.href=document.location.href.split('#')[0]+'#'+this.value;run();"></select>
|
||||
<button onclick="document.getElementById('editor').hidden = false; this.hidden = true;" >Editor</button>
|
||||
<div id='editor' hidden='true'>
|
||||
<textarea id="cnsl">
|
||||
var hash = window.location.hash;
|
||||
console.log (hash);
|
||||
var d = new Date();
|
||||
var options="<option>Please Select...</option>";
|
||||
for (var i=0; i<27; i++) {
|
||||
var currentDate = new Date(d-i*60*60*24*1000);
|
||||
var option = currentDate.getFullYear()+"-"+(currentDate.getMonth()+1)+"-"+currentDate.getDate()
|
||||
options += "<option>"+option+"</option>\n";
|
||||
}
|
||||
document.getElementById("selector").innerHTML = options;
|
||||
|
||||
var dateString = d.getFullYear() + "-" + (d.getMonth()+1) + "-" + d.getDate();
|
||||
if (hash!="") {
|
||||
dateString = hash.substring(1);
|
||||
}
|
||||
fetch('/fileserver/log/message/log_'+dateString+'.txt')
|
||||
.then(response => {
|
||||
// handle the response
|
||||
if (response.status == 404) {
|
||||
alert("no log data available for "+dateString);
|
||||
}
|
||||
response.text()
|
||||
.then( result => {
|
||||
var lines = result.split("\n");
|
||||
var trace = {
|
||||
x: [],
|
||||
y: [],
|
||||
type: 'scatter'
|
||||
};
|
||||
|
||||
var timex = 1;
|
||||
for (let line of lines) {
|
||||
if (line.includes("PostProcessing - Raw")) {
|
||||
console.log(line);
|
||||
var value = line.split(" ")[6];
|
||||
var time = line.split(" ")[0];
|
||||
console.log("> "+time+" "+value+"\n");
|
||||
if (value<1000) {
|
||||
trace.x.push(timex);
|
||||
timex += 1;
|
||||
trace.y.push(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
console.log(trace);
|
||||
var data = [trace];
|
||||
Plotly.newPlot('chart', data);
|
||||
});
|
||||
}).catch((error) => {
|
||||
// handle the error
|
||||
console.log(error);
|
||||
alert("test");
|
||||
});
|
||||
</textarea><br />
|
||||
<button onclick="run();">run</button>
|
||||
</div>
|
||||
<script>run();</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -62,6 +62,7 @@
|
||||
</ul>
|
||||
|
||||
<li><a href="#" onclick="loadPage('wasserzaehler.html?full');">Recognition</a></li>
|
||||
<li><a href="#" onclick="loadPage('graph.html');">Data Graph</a></li>
|
||||
<li><a href="#" onclick="loadPage('fileserver/');">File Server</a></li>
|
||||
<li><a>System <i class="arrow down"></i></a>
|
||||
<ul class="submenu">
|
||||
|
||||
Reference in New Issue
Block a user