This commit is contained in:
jomjol
2020-08-13 07:24:43 +02:00
parent 3623ac68f0
commit 16290d4566
7 changed files with 75 additions and 12 deletions

View File

@@ -101,6 +101,7 @@ ClassFlowPostProcessing::ClassFlowPostProcessing()
ListFlowControll = NULL;
PreValueOkay = false;
useMaxRateValue = false;
checkDigitIncreaseConsistency = false;
FilePreValue = FormatFileName("/sdcard/config/prevalue.ini");
}
@@ -114,6 +115,7 @@ ClassFlowPostProcessing::ClassFlowPostProcessing(std::vector<ClassFlow*>* lfc)
ListFlowControll = NULL;
PreValueOkay = false;
useMaxRateValue = false;
checkDigitIncreaseConsistency = false;
FilePreValue = FormatFileName("/sdcard/config/prevalue.ini");
ListFlowControll = lfc;
}
@@ -157,14 +159,19 @@ bool ClassFlowPostProcessing::ReadParameter(FILE* pfile, string& aktparamgraph)
}
}
}
if ((zerlegt[0] == "CheckDigitIncreaseConsistency") && (zerlegt.size() > 1))
{
if (toUpper(zerlegt[1]) == "TRUE")
checkDigitIncreaseConsistency = true;
}
if ((zerlegt[0] == "AllowNegativeRates") && (zerlegt.size() > 1))
{
if ((zerlegt[1] == "True") || (zerlegt[1] == "true"))
if (toUpper(zerlegt[1]) == "TRUE")
AllowNegativeRates = true;
}
if ((zerlegt[0] == "ErrorMessage") && (zerlegt.size() > 1))
{
if ((zerlegt[1] == "True") || (zerlegt[1] == "true"))
if (toUpper(zerlegt[1]) == "TRUE")
ErrorMessage = true;
}
if ((zerlegt[0] == "PreValueAgeStartup") && (zerlegt.size() > 1))
@@ -253,9 +260,13 @@ bool ClassFlowPostProcessing::doFlow(string zwtime)
if (isdigit)
{
digit = ErsetzteN(digit);
int lastanalog = -1;
if (isanalog)
lastanalog = analog[0] - 48;
digit = ErsetzteN(digit, lastanalog);
zw = digit;
}
if (isdigit && isanalog)
zw = zw + ".";
if (isanalog)
@@ -304,7 +315,7 @@ string ClassFlowPostProcessing::getReadoutParam(bool _rawValue)
}
string ClassFlowPostProcessing::ErsetzteN(string input)
string ClassFlowPostProcessing::ErsetzteN(string input, int lastvalueanalog = -1)
{
int posN, posPunkt;
int pot, ziffer;
@@ -322,5 +333,45 @@ string ClassFlowPostProcessing::ErsetzteN(string input)
posN = findDelimiterPos(input, "N");
}
///////////////////////////// TestCode
/*
input = "10";
posPunkt = input.length();
PreValue = 9.5;
lastvalueanalog = 7;
*/
if (checkDigitIncreaseConsistency && lastvalueanalog > -1)
{
int zifferIST;
int substrakt = 0;
bool lastcorrected = false;
for (int i = input.length() - 1; i >= 0; --i)
{
zifferIST = input[i] - 48; //std::stoi(std::string(input[i]));
if (lastcorrected)
{
zifferIST--;
input[i] = zifferIST + 48;
lastcorrected = false;
}
pot = posPunkt - i - 1;
zw = PreValue / pow(10, pot);
ziffer = ((int) zw) % 10;
if (zifferIST < ziffer)
{
if (lastvalueanalog >= 7)
{
input[i] = ziffer + 48;
lastvalueanalog = ziffer;
lastcorrected = true;
}
}
}
}
return input;
}

View File

@@ -15,6 +15,7 @@ protected:
bool useMaxRateValue;
bool ErrorMessage;
bool PreValueOkay;
bool checkDigitIncreaseConsistency;
string FilePreValue;
float PreValue;
@@ -25,7 +26,7 @@ protected:
bool LoadPreValue(void);
string ErsetzteN(string);
string ErsetzteN(string, int lastvalueanalog);
public:
ClassFlowPostProcessing();

View File

@@ -166,7 +166,7 @@ bool CTfLiteClass::LoadInputImage(std::string _fn)
*(input_data_ptr) = (float) blue;
input_data_ptr++;
printf("BMP: %f %f %f\n", (float) red, (float) green, (float) blue);
// printf("BMP: %f %f %f\n", (float) red, (float) green, (float) blue);
}
return true;

View File

@@ -104,22 +104,26 @@ void Init_NVS_SDCard()
extern "C" void app_main()
{
// LogFile.WriteToFile("Startsequence 01");
Init_NVS_SDCard();
LogFile.WriteToFile("Startsequence 02");
CheckOTAUpdate();
LogFile.WriteToFile("Startsequence 03");
std::string ssid = "";
std::string password = "";
LoadWlanFromFile("/sdcard/wlan.ini", ssid, password);
LogFile.WriteToFile("Startsequence 04");
printf("WLan: %s, %s\n", ssid.c_str(), password.c_str());
initialise_wifi(ssid, password);
LogFile.WriteToFile("Startsequence 05");
TickType_t xDelay;
xDelay = 2000 / portTICK_PERIOD_MS;
printf("Autoflow: sleep for : %ldms\n", (long) xDelay);
LogFile.WriteToFile("Startsequence 06");
vTaskDelay( xDelay );
LogFile.WriteToFile("Startsequence 07");
setup_time();
LogFile.WriteToFile("======================== Main Started ================================");