This commit is contained in:
jomjol
2020-09-26 19:29:39 +02:00
parent d428abc12f
commit 5a98b3d0bb
20 changed files with 312 additions and 161 deletions

View File

@@ -258,7 +258,7 @@ static esp_err_t download_get_handler(httpd_req_t *req)
return ESP_FAIL;
}
esp_err_t res = httpd_resp_set_hdr(req, "Access-Control-Allow-Origin", "*");
httpd_resp_set_hdr(req, "Access-Control-Allow-Origin", "*");
ESP_LOGI(TAG, "Sending file : %s (%ld bytes)...", filename, file_stat.st_size);
set_content_type_from_file(req, filename);
@@ -437,7 +437,6 @@ static esp_err_t delete_post_handler(httpd_req_t *req)
//////////////////////////////////////////////////////////////
char _query[200];
char _filename[30];
char _valuechar[30];
std::string fn = "/sdcard/firmware/";
std::string _task;
@@ -576,8 +575,6 @@ void unzip(std::string _in_zip_file, std::string _target_directory){
size_t uncomp_size;
mz_zip_archive zip_archive;
void* p;
const int N = 50;
char data[2048];
char archive_filename[64];
std::string zw;
// static const char* s_Test_archive_filename = "testhtml.zip";

View File

@@ -171,8 +171,14 @@ bool ClassFlowAnalog::doAlignAndCut(string time)
return false;
}
if (input_roi.length() > 0)
img_roi = new CImageBasis(input_roi);
if (input_roi.length() > 0){
img_roi = new CImageBasis(input_roi);
if (!img_roi->ImageOkay()){
LogFile.WriteToFile("ClassFlowAnalog::doAlignAndCut ImageRoi not okay!");
delete img_roi;
return false;
}
}
for (int i = 0; i < ROI.size(); ++i)
{

View File

@@ -6,7 +6,6 @@
#include "server_ota.h"
std::string ClassFlowControll::doSingleStep(std::string _stepname, std::string _host){
bool found = false;
std::string _classname = "";
std::string result = "";
if (_stepname.compare("[MakeImage]") == 0){
@@ -29,7 +28,6 @@ std::string ClassFlowControll::doSingleStep(std::string _stepname, std::string _
// printf(FlowControll[i]->name().c_str()); printf("\n");
FlowControll[i]->doFlow("");
result = FlowControll[i]->getHTMLSingleStep(_host);
found = true;
}
return result;

View File

@@ -149,8 +149,15 @@ bool ClassFlowDigit::doAlignAndCut(string time)
return false;
}
if (input_roi.length() > 0)
if (input_roi.length() > 0){
img_roi = new CImageBasis(input_roi);
if (!img_roi->ImageOkay()){
LogFile.WriteToFile("ClassFlowAnalog::doAlignAndCut ImageRoi not okay!");
delete img_roi;
return false;
}
}
for (int i = 0; i < ROI.size(); ++i)

View File

@@ -329,9 +329,15 @@ bool ClassFlowPostProcessing::doFlow(string zwtime)
return true;
}
zw = ErsetzteN(ReturnRawValue);
zw = ErsetzteN(ReturnRawValue);
Value = std::stof(zw);
if (checkDigitIncreaseConsistency)
{
// Value = checkDigitConsistency(Value, DecimalShift, isanalog);
}
zwvalue = RundeOutput(Value, AnzahlAnalog - DecimalShift);
if ((!AllowNegativeRates) && (Value < PreValue))
@@ -413,39 +419,40 @@ string ClassFlowPostProcessing::ErsetzteN(string input)
return input;
}
string ClassFlowPostProcessing::checkDigitConsistency(string input, int _decilamshift, int lastvalueanalog){
/*
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;
}
float ClassFlowPostProcessing::checkDigitConsistency(float input, int _decilamshift, bool _isanalog){
int aktdigit, olddigit;
int aktdigit_before, olddigit_before;
int pot, pot_max;
float zw;
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;
}
}
}
pot = _decilamshift;
if (!_isanalog) // falls es keine analogwerte gibt, kann die letzte nicht bewerte werden
{
pot++;
}
*/
pot_max = ((int) log10(input)) + 1;
while (pot <= pot_max)
{
zw = input / pow(10, pot-1);
aktdigit_before = ((int) zw) % 10;
zw = PreValue / pow(10, pot-1);
olddigit_before = ((int) zw) % 10;
zw = input / pow(10, pot);
aktdigit = ((int) zw) % 10;
zw = PreValue / pow(10, pot);
olddigit = ((int) zw) % 10;
if (aktdigit != olddigit) {
if (olddigit_before >= aktdigit_before) // stelle vorher hat noch keinen Nulldurchgang --> nachfolgestelle sollte sich nicht verändern
{
input = input + ((float) (olddigit - aktdigit)) * pow(10, pot); // Neue Digit wird durch alte Digit ersetzt;
}
}
pot++;
}
return input;
}

View File

@@ -9,7 +9,7 @@ class ClassFlowPostProcessing :
{
protected:
bool PreValueUse;
int PreValueAgeStartup;
int PreValueAgeStartup;
bool AllowNegativeRates;
float MaxRateValue;
bool useMaxRateValue;
@@ -29,7 +29,7 @@ protected:
string ShiftDecimal(string in, int _decShift);
string ErsetzteN(string);
string checkDigitConsistency(string, int _decilamshift, int lastvalueanalog = -1);
float checkDigitConsistency(float input, int _decilamshift, bool _isanalog);
string RundeOutput(float _in, int _anzNachkomma);
public:

View File

@@ -528,8 +528,6 @@ void CAlignAndCutImage::CutAndSave(std::string _template1, int x1, int y1, int d
int memsize = dx * dy * this->channels;
uint8_t* odata = (unsigned char*)GET_MEMORY(memsize);
int x_source, y_source;
stbi_uc* p_target;
stbi_uc* p_source;