diff --git a/FeatureRequest.md b/FeatureRequest.md index bd08760b..d9157b90 100644 --- a/FeatureRequest.md +++ b/FeatureRequest.md @@ -11,6 +11,19 @@ ____ +#### #24 Show Mqtt state directly in Webserver + +* Show MQTT log in Web page. E.g. connection established or failed to connect... + + + + +#### #23 CPU Temp and Mqtt values + +* 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 * https://github.com/jomjol/AI-on-the-edge-device/issues/644 diff --git a/README.md b/README.md index edfdd90e..0a028c44 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,16 @@ In other cases you can contact the developer via email: ReturnValueNoError; + out = out + (*numbers)[i]->ReturnValue; break; case READOUT_TYPE_PREVALUE: if (flowpostprocessing->PreValueUse) @@ -643,8 +643,8 @@ string ClassFlowControll::getJSON() { json += "\"" + (*NUMBERS)[i]->name + "\":\n"; json += " {\n"; - if ((*NUMBERS)[i]->ReturnValueNoError.length() > 0) - json += " \"value\": " + (*NUMBERS)[i]->ReturnValueNoError + ",\n"; + if ((*NUMBERS)[i]->ReturnValue.length() > 0) + json += " \"value\": " + (*NUMBERS)[i]->ReturnValue + ",\n"; else json += " \"value\": \"\",\n"; json += " \"raw\": \"" + (*NUMBERS)[i]->ReturnRawValue + "\",\n"; diff --git a/code/components/jomjol_flowcontroll/ClassFlowDefineTypes.h b/code/components/jomjol_flowcontroll/ClassFlowDefineTypes.h index 1b4e03df..af413232 100644 --- a/code/components/jomjol_flowcontroll/ClassFlowDefineTypes.h +++ b/code/components/jomjol_flowcontroll/ClassFlowDefineTypes.h @@ -39,7 +39,7 @@ struct NumberPost { string ReturnRawValue; // Rohwert (mit N & führenden 0) string ReturnValue; // korrigierter Rückgabewert, ggf. mit Fehlermeldung string ReturnPreValue; // korrigierter Rückgabewert ohne Fehlermeldung - string ReturnValueNoError; +// string ReturnValueNoError; string ErrorMessageText; // Fehlermeldung bei Consistency Check int AnzahlAnalog; int AnzahlDigital; diff --git a/code/components/jomjol_flowcontroll/ClassFlowMQTT.cpp b/code/components/jomjol_flowcontroll/ClassFlowMQTT.cpp index a02fedd5..d78399cb 100644 --- a/code/components/jomjol_flowcontroll/ClassFlowMQTT.cpp +++ b/code/components/jomjol_flowcontroll/ClassFlowMQTT.cpp @@ -157,7 +157,7 @@ bool ClassFlowMQTT::doFlow(string zwtime) sprintf(freeheapmem, "%zu", esp_get_free_heap_size()); MQTTPublish(zw, freeheapmem); - zw = maintopic + "/" + "Wifi RSSI"; + zw = maintopic + "/" + "wifiRSSI"; char rssi[11]; sprintf(rssi, "%d", get_WIFI_RSSI()); MQTTPublish(zw, rssi); @@ -169,7 +169,7 @@ bool ClassFlowMQTT::doFlow(string zwtime) for (int i = 0; i < (*NUMBERS).size(); ++i) { - result = (*NUMBERS)[i]->ReturnValueNoError; + result = (*NUMBERS)[i]->ReturnValue; resultraw = (*NUMBERS)[i]->ReturnRawValue; resulterror = (*NUMBERS)[i]->ErrorMessageText; resultrate = (*NUMBERS)[i]->ReturnRateValue; diff --git a/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.cpp b/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.cpp index 05d61e2d..167622fb 100644 --- a/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.cpp +++ b/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.cpp @@ -167,12 +167,10 @@ bool ClassFlowPostProcessing::LoadPreValue(void) NUMBERS[0]->Value = NUMBERS[0]->PreValue; NUMBERS[0]->ReturnValue = to_string(NUMBERS[0]->Value); - NUMBERS[0]->ReturnValueNoError = NUMBERS[0]->ReturnValue; if (NUMBERS[0]->digit_roi || NUMBERS[0]->analog_roi) { NUMBERS[0]->ReturnValue = RundeOutput(NUMBERS[0]->Value, NUMBERS[0]->Nachkomma); - NUMBERS[0]->ReturnValueNoError = NUMBERS[0]->ReturnValue; } UpdatePreValueINI = true; // Konvertierung ins neue Format @@ -507,7 +505,7 @@ void ClassFlowPostProcessing::InitNUMBERS() _number->ReturnRawValue = ""; // Rohwert (mit N & führenden 0) _number->ReturnValue = ""; // korrigierter Rückgabewert, ggf. mit Fehlermeldung - _number->ReturnValueNoError = ""; // korrigierter Rückgabewert ohne Fehlermeldung +// _number->ReturnValueNoError = ""; // korrigierter Rückgabewert ohne Fehlermeldung _number->ErrorMessageText = ""; // Fehlermeldung bei Consistency Check _number->ReturnPreValue = ""; _number->PreValueOkay = false; @@ -526,7 +524,7 @@ void ClassFlowPostProcessing::InitNUMBERS() _number->Value = 0; // letzer ausgelesener Wert, inkl. Korrekturen _number->ReturnRawValue = ""; // Rohwert (mit N & führenden 0) _number->ReturnValue = ""; // korrigierter Rückgabewert, ggf. mit Fehlermeldung - _number->ReturnValueNoError = ""; // korrigierter Rückgabewert ohne Fehlermeldung +// _number->ReturnValueNoError = ""; // korrigierter Rückgabewert ohne Fehlermeldung _number->ErrorMessageText = ""; // Fehlermeldung bei Consistency Check _number->Nachkomma = _number->AnzahlAnalog; @@ -607,7 +605,9 @@ bool ClassFlowPostProcessing::doFlow(string zwtime) for (int j = 0; j < NUMBERS.size(); ++j) { NUMBERS[j]->ReturnRawValue = ""; + NUMBERS[j]->ReturnValue = ""; NUMBERS[j]->ErrorMessageText = ""; + NUMBERS[j]->Value = -1; UpdateNachkommaDecimalShift(); @@ -624,109 +624,74 @@ bool ClassFlowPostProcessing::doFlow(string zwtime) if (NUMBERS[j]->analog_roi) NUMBERS[j]->ReturnRawValue = NUMBERS[j]->ReturnRawValue + flowAnalog->getReadout(j, NUMBERS[j]->isExtendedResolution); - NUMBERS[j]->ReturnRawValue = ShiftDecimal(NUMBERS[j]->ReturnRawValue, NUMBERS[j]->DecimalShift); + NUMBERS[j]->ReturnRawValue = ShiftDecimal(NUMBERS[j]->ReturnRawValue, NUMBERS[j]->DecimalShift); + + printf("RetunrRawValue %s", NUMBERS[j]->ReturnRawValue.c_str()); if (IgnoreLeadingNaN) - { while ((NUMBERS[j]->ReturnRawValue.length() > 1) && (NUMBERS[j]->ReturnRawValue[0] == 'N')) - { NUMBERS[j]->ReturnRawValue.erase(0, 1); - } - } - rohwert = NUMBERS[j]->ReturnRawValue; + NUMBERS[j]->ReturnValue = NUMBERS[j]->ReturnRawValue; - if (!PreValueUse || !NUMBERS[j]->PreValueOkay) + if (findDelimiterPos(NUMBERS[j]->ReturnValue, "N") != std::string::npos) { - NUMBERS[j]->ReturnValue = NUMBERS[j]->ReturnRawValue; - NUMBERS[j]->ReturnValueNoError = NUMBERS[j]->ReturnRawValue; - - if ((findDelimiterPos(NUMBERS[j]->ReturnValue, "N") == std::string::npos) && (NUMBERS[j]->ReturnValue.length() > 0)) - { - while ((NUMBERS[j]->ReturnValue.length() > 1) && (NUMBERS[j]->ReturnValue[0] == '0')) - { - NUMBERS[j]->ReturnValue.erase(0, 1); - } - NUMBERS[j]->Value = std::stof(NUMBERS[j]->ReturnValue); - NUMBERS[j]->ReturnValueNoError = NUMBERS[j]->ReturnValue; - - NUMBERS[j]->PreValueOkay = true; - NUMBERS[j]->PreValue = NUMBERS[j]->Value; - NUMBERS[j]->ReturnPreValue = RundeOutput(NUMBERS[j]->PreValue, NUMBERS[j]->Nachkomma); - NUMBERS[j]->lastvalue = flowMakeImage->getTimeImageTaken(); - zwtime = ConvertTimeToString(NUMBERS[j]->lastvalue, PREVALUE_TIME_FORMAT_OUTPUT); - - UpdatePreValueINI = true; - SavePreValue(); - } + if (PreValueUse && NUMBERS[j]->PreValueOkay) + NUMBERS[j]->ReturnValue = ErsetzteN(NUMBERS[j]->ReturnValue, NUMBERS[j]->PreValue); else - { - NUMBERS[j]->ReturnValue = ""; - NUMBERS[j]->ReturnValueNoError = ""; - } + continue; // es gibt keinen Zahl, da noch ein N vorhanden ist. } - else + + // Lösche führende Nullen (außer es ist nur noch einen 0) + while ((NUMBERS[j]->ReturnValue.length() > 1) && (NUMBERS[j]->ReturnValue[0] == '0')) + NUMBERS[j]->ReturnValue.erase(0, 1); + + + NUMBERS[j]->Value = std::stof(NUMBERS[j]->ReturnValue); + + if (NUMBERS[j]->checkDigitIncreaseConsistency) + NUMBERS[j]->Value = checkDigitConsistency(NUMBERS[j]->Value, NUMBERS[j]->DecimalShift, NUMBERS[j]->analog_roi != NULL, NUMBERS[j]->PreValue); + + if (!NUMBERS[j]->AllowNegativeRates) { - zw = ErsetzteN(NUMBERS[j]->ReturnRawValue, NUMBERS[j]->PreValue); - - NUMBERS[j]->Value = std::stof(zw); - if (NUMBERS[j]->checkDigitIncreaseConsistency) - { - NUMBERS[j]->Value = checkDigitConsistency(NUMBERS[j]->Value, NUMBERS[j]->DecimalShift, NUMBERS[j]->analog_roi != NULL, NUMBERS[j]->PreValue); - } - - zwvalue = RundeOutput(NUMBERS[j]->Value, NUMBERS[j]->Nachkomma); - - if ((!NUMBERS[j]->AllowNegativeRates) && (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; - zwvalue = RundeOutput(NUMBERS[j]->Value, NUMBERS[j]->Nachkomma); + NUMBERS[j]->ReturnValue = ""; + continue; } + } - double difference = difftime(imagetime, NUMBERS[j]->lastvalue); // in Sekunden - difference /= 60; - NUMBERS[j]->FlowRateAct = (NUMBERS[j]->Value - NUMBERS[j]->PreValue) / difference; - NUMBERS[j]->ReturnRateValue = std::to_string(NUMBERS[j]->FlowRateAct); + double difference = difftime(imagetime, NUMBERS[j]->lastvalue); // in Sekunden + difference /= 60; + NUMBERS[j]->FlowRateAct = (NUMBERS[j]->Value - NUMBERS[j]->PreValue) / difference; + if (NUMBERS[j]->useMaxRateValue) + { float _ratedifference; if (NUMBERS[j]->RateType == RateChange) - _ratedifference = (NUMBERS[j]->Value - NUMBERS[j]->PreValue) / difference; + _ratedifference = NUMBERS[j]->FlowRateAct; else _ratedifference = (NUMBERS[j]->Value - NUMBERS[j]->PreValue); - - if (NUMBERS[j]->useMaxRateValue && (abs(_ratedifference) > NUMBERS[j]->MaxRateValue)) + + if (abs(_ratedifference) > NUMBERS[j]->MaxRateValue) { NUMBERS[j]->ErrorMessageText = NUMBERS[j]->ErrorMessageText + "Rate too high - Read: " + RundeOutput(NUMBERS[j]->Value, NUMBERS[j]->Nachkomma) + " - Pre: " + RundeOutput(NUMBERS[j]->PreValue, NUMBERS[j]->Nachkomma); NUMBERS[j]->Value = NUMBERS[j]->PreValue; - zwvalue = RundeOutput(NUMBERS[j]->Value, NUMBERS[j]->Nachkomma); - } - - NUMBERS[j]->ReturnValueNoError = zwvalue; - NUMBERS[j]->ReturnValue = zwvalue; - if (NUMBERS[j]->ErrorMessage && (NUMBERS[j]->ErrorMessageText.length() > 0)) - NUMBERS[j]->ReturnValue = NUMBERS[j]->ReturnValue + "\t" + NUMBERS[j]->ErrorMessageText; - - if (NUMBERS[j]->ErrorMessageText.length() == 0) - { - NUMBERS[j]->lastvalue = imagetime; - NUMBERS[j]->PreValue = NUMBERS[j]->Value; - - NUMBERS[j]->ReturnValueNoError = NUMBERS[j]->ReturnValue; - NUMBERS[j]->ReturnPreValue = RundeOutput(NUMBERS[j]->PreValue, NUMBERS[j]->Nachkomma); - NUMBERS[j]->ErrorMessageText = "no error"; - UpdatePreValueINI = true; - } - else - { - NUMBERS[j]->ReturnRateValue = ""; NUMBERS[j]->ReturnValue = ""; - NUMBERS[j]->ReturnValueNoError = ""; - NUMBERS[j]->timeStamp = ""; - + continue; } } + + NUMBERS[j]->lastvalue = imagetime; + NUMBERS[j]->PreValue = NUMBERS[j]->Value; + + NUMBERS[j]->ReturnPreValue = RundeOutput(NUMBERS[j]->PreValue, NUMBERS[j]->Nachkomma); + NUMBERS[j]->ErrorMessageText = "no error"; + UpdatePreValueINI = true; + string _zw = "PostProcessing - Raw: " + NUMBERS[j]->ReturnRawValue + " Value: " + NUMBERS[j]->ReturnValue + " Error: " + NUMBERS[j]->ErrorMessageText; LogFile.WriteToFile(_zw); } @@ -788,7 +753,7 @@ string ClassFlowPostProcessing::getReadoutParam(bool _rawValue, bool _noerror, i if (_rawValue) return NUMBERS[_number]->ReturnRawValue; if (_noerror) - return NUMBERS[_number]->ReturnValueNoError; + return NUMBERS[_number]->ReturnValue; return NUMBERS[_number]->ReturnValue; } diff --git a/code/main/version.cpp b/code/main/version.cpp index 2d876470..80df987b 100644 --- a/code/main/version.cpp +++ b/code/main/version.cpp @@ -1,4 +1,4 @@ -const char* GIT_REV="b0d8ed6"; -const char* GIT_TAG=""; -const char* GIT_BRANCH="master"; -const char* BUILD_TIME="2022-02-12 09:04"; \ No newline at end of file +const char* GIT_REV="1371be6"; +const char* GIT_TAG="v10.4.0"; +const char* GIT_BRANCH="rolling"; +const char* BUILD_TIME="2022-02-15 21:17"; \ No newline at end of file diff --git a/code/sdkconfig b/code/sdkconfig index ba188dc4..225d3a06 100644 --- a/code/sdkconfig +++ b/code/sdkconfig @@ -1224,8 +1224,10 @@ CONFIG_OV5640_SUPPORT=y CONFIG_GC2145_SUPPORT=y CONFIG_GC032A_SUPPORT=y CONFIG_GC0308_SUPPORT=y +CONFIG_BF3005_SUPPORT=y # CONFIG_SCCB_HARDWARE_I2C_PORT0 is not set CONFIG_SCCB_HARDWARE_I2C_PORT1=y +CONFIG_SCCB_CLK_FREQ=100000 # CONFIG_GC_SENSOR_WINDOWING_MODE is not set CONFIG_GC_SENSOR_SUBSAMPLE_MODE=y CONFIG_CAMERA_CORE0=y diff --git a/code/version.cpp b/code/version.cpp index 2d876470..80df987b 100644 --- a/code/version.cpp +++ b/code/version.cpp @@ -1,4 +1,4 @@ -const char* GIT_REV="b0d8ed6"; -const char* GIT_TAG=""; -const char* GIT_BRANCH="master"; -const char* BUILD_TIME="2022-02-12 09:04"; \ No newline at end of file +const char* GIT_REV="1371be6"; +const char* GIT_TAG="v10.4.0"; +const char* GIT_BRANCH="rolling"; +const char* BUILD_TIME="2022-02-15 21:17"; \ No newline at end of file diff --git a/firmware/ana-s2-q-20220213.tflite b/firmware/ana-s2-q-20220213.tflite new file mode 100644 index 00000000..e666f11e Binary files /dev/null and b/firmware/ana-s2-q-20220213.tflite differ diff --git a/firmware/bootloader.bin b/firmware/bootloader.bin index 3015652f..973fbfbe 100644 Binary files a/firmware/bootloader.bin and b/firmware/bootloader.bin differ diff --git a/firmware/firmware.bin b/firmware/firmware.bin index 994b061e..bc566b3d 100644 Binary files a/firmware/firmware.bin and b/firmware/firmware.bin differ diff --git a/firmware/html.zip b/firmware/html.zip index dac0c892..ec069237 100644 Binary files a/firmware/html.zip and b/firmware/html.zip differ diff --git a/sd-card/html/edit_config_param.html b/sd-card/html/edit_config_param.html index 1c9a6a2b..1d4c485d 100644 --- a/sd-card/html/edit_config_param.html +++ b/sd-card/html/edit_config_param.html @@ -1480,12 +1480,21 @@ function WriteParameter(_param, _category, _cat, _name, _optional, _number = -1) if (textToFind == undefined) continue; + _isFound = false; + element.selectedIndex = -1; for (var i = 0; i < element.options.length; i++) { if (element.options[i].value.toLowerCase() === textToFind.toLowerCase()) { element.selectedIndex = i; + _isFound = true; break; } } + if (!_isFound) + { + _zw_txt = "In the selectd field the value '" + textToFind + "' in the parameter '"; + _zw_txt = _zw_txt + _cat + "' in the field '" + _name + "' is invalid.\nPLEASE CHECK BEFORE SAVING!"; + alert(_zw_txt); + } } else if ((element.getAttribute("type") != null) && (element.getAttribute("type").toLowerCase() == "checkbox")) { element.checked = NUMBERS[_number][_cat][_name]["value"+j] == "true"; @@ -1512,12 +1521,22 @@ function WriteParameter(_param, _category, _cat, _name, _optional, _number = -1) if (textToFind == undefined) continue; + _isFound = false; + element.selectedIndex = -1; for (var i = 0; i < element.options.length; i++) { if (element.options[i].value.toLowerCase() === textToFind.toLowerCase()) { element.selectedIndex = i; + _isFound = true; break; } } + if (!_isFound) + { + _zw_txt = "In the selectd field the value '" + textToFind + "' in the section '"; + _zw_txt = _zw_txt + _cat + "' in the field '" + _name + "' is invalid.\nPLEASE CHECK BEFORE SAVING!"; + alert(_zw_txt); + } + } else if ((element.getAttribute("type") != null) && (element.getAttribute("type").toLowerCase() == "checkbox")) { element.checked = _param[_cat][_name]["value"+j] == "true"; diff --git a/sd-card/html/gethost.js b/sd-card/html/gethost.js index 751e4b11..8a9df763 100644 --- a/sd-card/html/gethost.js +++ b/sd-card/html/gethost.js @@ -13,7 +13,7 @@ function getbasepath(){ { // host = "http://192.168.2.219"; // jomjol interner test // host = "http://192.168.178.46"; // jomjol interner test - host = "http://192.168.178.62"; // jomjol interner Real + host = "http://192.168.178.34"; // jomjol interner Real // host = "http://192.168.43.191"; // host = "."; // jomjol interner localhost diff --git a/sd-card/html/version.txt b/sd-card/html/version.txt index 03c39bfe..2e7dfda2 100644 --- a/sd-card/html/version.txt +++ b/sd-card/html/version.txt @@ -1 +1 @@ -13.1.0 \ No newline at end of file +13.1.1 \ No newline at end of file