diff --git a/README.md b/README.md index 9fed9621..7de089a8 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,11 @@ In other cases you can contact the developer via email: PreValueAgeStartup) return false; @@ -121,7 +128,7 @@ void ClassFlowPostProcessing::SavePreValue(float value, string zwtime) time(&rawtime); timeinfo = localtime(&rawtime); - strftime(buffer, 80, "%Y-%m-%dT%H:%M:%S", timeinfo); + strftime(buffer, 80, PREVALUE_TIME_FORMAT_OUTPUT, timeinfo); timeStamp = std::string(buffer); } else @@ -157,6 +164,15 @@ ClassFlowPostProcessing::ClassFlowPostProcessing(std::vector* lfc) timeStamp = ""; FilePreValue = FormatFileName("/sdcard/config/prevalue.ini"); ListFlowControll = lfc; + flowMakeImage = NULL; + + for (int i = 0; i < ListFlowControll->size(); ++i) + { + if (((*ListFlowControll)[i])->name().compare("ClassFlowMakeImage") == 0) + { + flowMakeImage = (ClassFlowMakeImage*) (*ListFlowControll)[i]; + } + } } @@ -348,8 +364,16 @@ bool ClassFlowPostProcessing::doFlow(string zwtime) PreValueOkay = true; PreValue = Value; - time(&lastvalue); - localtime(&lastvalue); + if (flowMakeImage) + { + lastvalue = flowMakeImage->getTimeImageTaken(); + zwtime = ConvertTimeToString(lastvalue, PREVALUE_TIME_FORMAT_OUTPUT); + } + else + { + time(&lastvalue); + localtime(&lastvalue); + } SavePreValue(Value, zwtime); } @@ -387,16 +411,28 @@ bool ClassFlowPostProcessing::doFlow(string zwtime) if (ErrorMessage && (ErrorMessageText.length() > 0)) ReturnValue = ReturnValue + "\t" + ErrorMessageText; - if (ErrorMessageText.length() == 0) + time_t currenttime; + if (flowMakeImage) + { + currenttime = flowMakeImage->getTimeImageTaken(); + zwtime = ConvertTimeToString(currenttime, PREVALUE_TIME_FORMAT_OUTPUT); + } + else { - time_t currenttime; time(¤ttime); localtime(¤ttime); -// currenttime = - double difference = difftime(currenttime, lastvalue); // in Sekunden - difference /= 60; // in Minuten - FlowRateAct = (Value - PreValue) / difference; + } + double difference = difftime(currenttime, lastvalue); // in Sekunden + difference /= 60; // in Minuten + FlowRateAct = (Value - PreValue) / difference; + lastvalue = currenttime; +// std::string _zw = "CalcRate: " + std::to_string(FlowRateAct) + " TimeDifference[min]: " + std::to_string(difference); +// _zw = _zw + " Value: " + std::to_string(Value) + " PreValue: " + std::to_string(PreValue); +// LogFile.WriteToFile(_zw); + + if (ErrorMessageText.length() == 0) + { PreValue = Value; SavePreValue(Value, zwtime); } diff --git a/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.h b/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.h index 3c8df529..8a115705 100644 --- a/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.h +++ b/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.h @@ -1,9 +1,12 @@ #pragma once #include "ClassFlow.h" +#include "ClassFlowMakeImage.h" #include + + class ClassFlowPostProcessing : public ClassFlow { @@ -30,6 +33,8 @@ protected: string ErrorMessageText; // Fehlermeldung bei Consistency Check string timeStamp; + ClassFlowMakeImage *flowMakeImage; + bool LoadPreValue(void); string ShiftDecimal(string in, int _decShift); diff --git a/code/main/version.cpp b/code/main/version.cpp index e2ed3c43..1d999e99 100644 --- a/code/main/version.cpp +++ b/code/main/version.cpp @@ -1,4 +1,4 @@ -const char* GIT_REV="9b791bb"; +const char* GIT_REV="528a443"; const char* GIT_TAG=""; const char* GIT_BRANCH="rolling"; -const char* BUILD_TIME="2021-05-20 21:43"; \ No newline at end of file +const char* BUILD_TIME="2021-05-22 07:33"; \ No newline at end of file diff --git a/code/version.cpp b/code/version.cpp index e2ed3c43..1d999e99 100644 --- a/code/version.cpp +++ b/code/version.cpp @@ -1,4 +1,4 @@ -const char* GIT_REV="9b791bb"; +const char* GIT_REV="528a443"; const char* GIT_TAG=""; const char* GIT_BRANCH="rolling"; -const char* BUILD_TIME="2021-05-20 21:43"; \ No newline at end of file +const char* BUILD_TIME="2021-05-22 07:33"; \ No newline at end of file diff --git a/firmware/bootloader.bin b/firmware/bootloader.bin index 24cac60c..5b9480f6 100644 Binary files a/firmware/bootloader.bin and b/firmware/bootloader.bin differ diff --git a/firmware/firmware.bin b/firmware/firmware.bin index 91fdeca5..cbd5ee19 100644 Binary files a/firmware/firmware.bin and b/firmware/firmware.bin differ