mirror of
https://github.com/jomjol/AI-on-the-edge-device.git
synced 2025-12-08 12:36:52 +03:00
Update Rolling
This commit is contained in:
11
README.md
11
README.md
@@ -33,6 +33,7 @@ If you would like to support the developer with a cup of coffee you can do that
|
|||||||
### Known Issues
|
### Known Issues
|
||||||
|
|
||||||
* slow response of web server during picture analysis
|
* slow response of web server during picture analysis
|
||||||
|
* spontaneous reboots (mostly due to html access during image processing) - self recovery implemented
|
||||||
|
|
||||||
------
|
------
|
||||||
|
|
||||||
@@ -40,7 +41,15 @@ If you would like to support the developer with a cup of coffee you can do that
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
##### Rolling - (2021-01-05)
|
##### Rolling - (2021-01-17)
|
||||||
|
|
||||||
|
* Disabling of digital counters implemented
|
||||||
|
* Attention: do not disable digital and analog!
|
||||||
|
* Bug fixing:
|
||||||
|
|
||||||
|
* Configuration of analog counters on html-page failed (enable/disable, undefined ROIs)
|
||||||
|
|
||||||
|
2021-01-05
|
||||||
|
|
||||||
* Configuration: simple enabling / disabling of analog counters
|
* Configuration: simple enabling / disabling of analog counters
|
||||||
|
|
||||||
|
|||||||
@@ -217,7 +217,7 @@ void initialise_wifi_fixed_ip(std::string _ip, std::string _gw, std::string _net
|
|||||||
netmask = std::string(ip4addr_ntoa(&ip_info2.netmask));
|
netmask = std::string(ip4addr_ntoa(&ip_info2.netmask));
|
||||||
gw = std::string(ip4addr_ntoa(&ip_info2.gw));
|
gw = std::string(ip4addr_ntoa(&ip_info2.gw));
|
||||||
|
|
||||||
vEventGroupDelete(wifi_event_group);
|
// vEventGroupDelete(wifi_event_group);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
// #define OHNETFLITE
|
// #define OHNETFLITE
|
||||||
|
|
||||||
#ifndef OHNETFLITE
|
#ifndef OHNETFLITE
|
||||||
@@ -97,7 +97,7 @@ bool ClassFlowAnalog::ReadParameter(FILE* pfile, string& aktparamgraph)
|
|||||||
if (aktparamgraph[0] == ';')
|
if (aktparamgraph[0] == ';')
|
||||||
{
|
{
|
||||||
disabled = true;
|
disabled = true;
|
||||||
while (this->getNextLine(pfile, &aktparamgraph) && !this->isNewParagraph(aktparamgraph));
|
while (getNextLine(pfile, &aktparamgraph) && !isNewParagraph(aktparamgraph));
|
||||||
printf("[Analog] is disabled !!!\n");
|
printf("[Analog] is disabled !!!\n");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,6 +40,6 @@ public:
|
|||||||
std::vector<HTMLInfo*> GetHTMLInfo();
|
std::vector<HTMLInfo*> GetHTMLInfo();
|
||||||
int AnzahlROIs(){return ROI.size();};
|
int AnzahlROIs(){return ROI.size();};
|
||||||
|
|
||||||
string name(){return "ClassFlowAnalog";};
|
string name(){return "ClassFlowAnalog";};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -76,6 +76,8 @@ void ClassFlowControll::SetInitialParameter(void)
|
|||||||
flowanalog = NULL;
|
flowanalog = NULL;
|
||||||
flowpostprocessing = NULL;
|
flowpostprocessing = NULL;
|
||||||
disabled = false;
|
disabled = false;
|
||||||
|
aktRunNr = 0;
|
||||||
|
aktstatus = "Startup";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -241,6 +243,21 @@ bool ClassFlowControll::doFlow(string time)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ClassFlowControll::UpdateAktStatus(std::string _flow)
|
||||||
|
{
|
||||||
|
aktstatus = gettimestring("%Y%m%d-%H%M%S");
|
||||||
|
aktstatus = aktstatus + "\t" + std::to_string(aktRunNr) + "\t";
|
||||||
|
|
||||||
|
if (_flow == "ClassFlowMakeImage")
|
||||||
|
aktstatus = aktstatus + "Taking Raw Image";
|
||||||
|
else
|
||||||
|
if (_flow == "ClassFlowAlignment")
|
||||||
|
aktstatus = aktstatus + "Aligning Image";
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
string ClassFlowControll::getReadout(bool _rawvalue = false, bool _noerror = false)
|
string ClassFlowControll::getReadout(bool _rawvalue = false, bool _noerror = false)
|
||||||
{
|
{
|
||||||
if (flowpostprocessing)
|
if (flowpostprocessing)
|
||||||
|
|||||||
@@ -28,6 +28,9 @@ protected:
|
|||||||
bool SetupModeActive;
|
bool SetupModeActive;
|
||||||
void SetInitialParameter(void);
|
void SetInitialParameter(void);
|
||||||
std::string aktstatus;
|
std::string aktstatus;
|
||||||
|
int aktRunNr;
|
||||||
|
|
||||||
|
void UpdateAktStatus(std::string _flow);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void InitFlow(std::string config);
|
void InitFlow(std::string config);
|
||||||
|
|||||||
@@ -85,13 +85,21 @@ bool ClassFlowDigit::ReadParameter(FILE* pfile, string& aktparamgraph)
|
|||||||
aktparamgraph = trim(aktparamgraph);
|
aktparamgraph = trim(aktparamgraph);
|
||||||
|
|
||||||
if (aktparamgraph.size() == 0)
|
if (aktparamgraph.size() == 0)
|
||||||
if (!this->GetNextParagraph(pfile, aktparamgraph))
|
if (!this->GetNextParagraph(pfile, aktparamgraph))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if ((aktparamgraph.compare("[Digits]") != 0) && (aktparamgraph.compare(";[Digits]") != 0)) // Paragraph passt nich zu MakeImage
|
||||||
if (aktparamgraph.compare("[Digits]") != 0) // Paragraph passt nicht
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (aktparamgraph[0] == ';')
|
||||||
|
{
|
||||||
|
disabled = true;
|
||||||
|
while (getNextLine(pfile, &aktparamgraph) && !isNewParagraph(aktparamgraph));
|
||||||
|
printf("[Digits] is disabled !!!\n");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
while (getNextLine(pfile, &aktparamgraph) && !isNewParagraph(aktparamgraph))
|
while (getNextLine(pfile, &aktparamgraph) && !isNewParagraph(aktparamgraph))
|
||||||
{
|
{
|
||||||
zerlegt = this->ZerlegeZeile(aktparamgraph);
|
zerlegt = this->ZerlegeZeile(aktparamgraph);
|
||||||
@@ -169,6 +177,9 @@ string ClassFlowDigit::getHTMLSingleStep(string host)
|
|||||||
|
|
||||||
bool ClassFlowDigit::doFlow(string time)
|
bool ClassFlowDigit::doFlow(string time)
|
||||||
{
|
{
|
||||||
|
if (disabled)
|
||||||
|
return true;
|
||||||
|
|
||||||
if (!doAlignAndCut(time)){
|
if (!doAlignAndCut(time)){
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
@@ -182,6 +193,9 @@ bool ClassFlowDigit::doFlow(string time)
|
|||||||
|
|
||||||
bool ClassFlowDigit::doAlignAndCut(string time)
|
bool ClassFlowDigit::doAlignAndCut(string time)
|
||||||
{
|
{
|
||||||
|
if (disabled)
|
||||||
|
return true;
|
||||||
|
|
||||||
CAlignAndCutImage *caic = flowpostalignment->GetAlignAndCutImage();
|
CAlignAndCutImage *caic = flowpostalignment->GetAlignAndCutImage();
|
||||||
|
|
||||||
for (int i = 0; i < ROI.size(); ++i)
|
for (int i = 0; i < ROI.size(); ++i)
|
||||||
@@ -200,6 +214,9 @@ bool ClassFlowDigit::doAlignAndCut(string time)
|
|||||||
|
|
||||||
bool ClassFlowDigit::doNeuralNetwork(string time)
|
bool ClassFlowDigit::doNeuralNetwork(string time)
|
||||||
{
|
{
|
||||||
|
if (disabled)
|
||||||
|
return true;
|
||||||
|
|
||||||
string logPath = CreateLogFolder(time);
|
string logPath = CreateLogFolder(time);
|
||||||
|
|
||||||
#ifndef OHNETFLITE
|
#ifndef OHNETFLITE
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ protected:
|
|||||||
bool SaveAllFiles;
|
bool SaveAllFiles;
|
||||||
|
|
||||||
ClassFlowAlignment* flowpostalignment;
|
ClassFlowAlignment* flowpostalignment;
|
||||||
|
|
||||||
bool doNeuralNetwork(string time);
|
bool doNeuralNetwork(string time);
|
||||||
bool doAlignAndCut(string time);
|
bool doAlignAndCut(string time);
|
||||||
|
|
||||||
|
|||||||
@@ -14,17 +14,28 @@
|
|||||||
string ClassFlowPostProcessing::GetPreValue()
|
string ClassFlowPostProcessing::GetPreValue()
|
||||||
{
|
{
|
||||||
std::string result;
|
std::string result;
|
||||||
|
bool isAnalog = false;
|
||||||
|
bool isDigit = false;
|
||||||
|
|
||||||
|
int AnzahlAnalog = 0;
|
||||||
result = RundeOutput(PreValue, -DecimalShift);
|
result = RundeOutput(PreValue, -DecimalShift);
|
||||||
|
|
||||||
for (int i = 0; i < ListFlowControll->size(); ++i)
|
for (int i = 0; i < ListFlowControll->size(); ++i)
|
||||||
{
|
{
|
||||||
if (((*ListFlowControll)[i])->name().compare("ClassFlowAnalog") == 0)
|
if (((*ListFlowControll)[i])->name().compare("ClassFlowAnalog") == 0)
|
||||||
{
|
{
|
||||||
int AnzahlAnalog = ((ClassFlowAnalog*)(*ListFlowControll)[i])->AnzahlROIs();
|
isAnalog = true;
|
||||||
result = RundeOutput(PreValue, AnzahlAnalog - DecimalShift);
|
AnzahlAnalog = ((ClassFlowAnalog*)(*ListFlowControll)[i])->AnzahlROIs();
|
||||||
|
}
|
||||||
|
if (((*ListFlowControll)[i])->name().compare("ClassFlowDigit") == 0)
|
||||||
|
{
|
||||||
|
isDigit = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isDigit && isAnalog)
|
||||||
|
result = RundeOutput(PreValue, AnzahlAnalog - DecimalShift);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,17 +86,24 @@ bool ClassFlowPostProcessing::LoadPreValue(void)
|
|||||||
ReturnValue = to_string(Value);
|
ReturnValue = to_string(Value);
|
||||||
ReturnValueNoError = ReturnValue;
|
ReturnValueNoError = ReturnValue;
|
||||||
|
|
||||||
// falls es Analog gibt, dann die Anzahl der Nachkommastellen feststellen und entsprechend runden:
|
bool isAnalog = false;
|
||||||
|
bool isDigit = false;
|
||||||
|
int AnzahlAnalog = 0;
|
||||||
|
|
||||||
for (int i = 0; i < ListFlowControll->size(); ++i)
|
for (int i = 0; i < ListFlowControll->size(); ++i)
|
||||||
{
|
{
|
||||||
if (((*ListFlowControll)[i])->name().compare("ClassFlowAnalog") == 0)
|
if (((*ListFlowControll)[i])->name().compare("ClassFlowAnalog") == 0)
|
||||||
{
|
isAnalog = true;
|
||||||
int AnzahlAnalog = ((ClassFlowAnalog*)(*ListFlowControll)[i])->AnzahlROIs();
|
if (((*ListFlowControll)[i])->name().compare("ClassFlowDigit") == 0)
|
||||||
ReturnValue = RundeOutput(Value, AnzahlAnalog - DecimalShift);
|
isDigit = true;
|
||||||
ReturnValueNoError = ReturnValue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isDigit || isAnalog)
|
||||||
|
{
|
||||||
|
ReturnValue = RundeOutput(Value, AnzahlAnalog - DecimalShift);
|
||||||
|
ReturnValueNoError = ReturnValue;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,28 +137,6 @@ void ClassFlowPostProcessing::SavePreValue(float value, string zwtime)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
ClassFlowPostProcessing::ClassFlowPostProcessing()
|
|
||||||
{
|
|
||||||
PreValueUse = false;
|
|
||||||
PreValueAgeStartup = 30;
|
|
||||||
AllowNegativeRates = false;
|
|
||||||
MaxRateValue = 0.1;
|
|
||||||
ErrorMessage = false;
|
|
||||||
ListFlowControll = NULL;
|
|
||||||
PreValueOkay = false;
|
|
||||||
useMaxRateValue = false;
|
|
||||||
checkDigitIncreaseConsistency = false;
|
|
||||||
DecimalShift = 0;
|
|
||||||
ErrorMessageText = "";
|
|
||||||
disabled = false;
|
|
||||||
disabled = false;
|
|
||||||
|
|
||||||
|
|
||||||
FilePreValue = FormatFileName("/sdcard/config/prevalue.ini");
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
ClassFlowPostProcessing::ClassFlowPostProcessing(std::vector<ClassFlow*>* lfc)
|
ClassFlowPostProcessing::ClassFlowPostProcessing(std::vector<ClassFlow*>* lfc)
|
||||||
{
|
{
|
||||||
PreValueUse = false;
|
PreValueUse = false;
|
||||||
@@ -273,6 +269,7 @@ bool ClassFlowPostProcessing::doFlow(string zwtime)
|
|||||||
int AnzahlAnalog = 0;
|
int AnzahlAnalog = 0;
|
||||||
string zw;
|
string zw;
|
||||||
time_t imagetime = 0;
|
time_t imagetime = 0;
|
||||||
|
string rohwert;
|
||||||
|
|
||||||
ErrorMessageText = "";
|
ErrorMessageText = "";
|
||||||
|
|
||||||
@@ -311,6 +308,8 @@ bool ClassFlowPostProcessing::doFlow(string zwtime)
|
|||||||
// isdigit = true; digit = "12N";
|
// isdigit = true; digit = "12N";
|
||||||
// isanalog = true; analog = "456";
|
// isanalog = true; analog = "456";
|
||||||
|
|
||||||
|
ReturnRawValue = "";
|
||||||
|
|
||||||
if (isdigit)
|
if (isdigit)
|
||||||
ReturnRawValue = digit;
|
ReturnRawValue = digit;
|
||||||
if (isdigit && isanalog)
|
if (isdigit && isanalog)
|
||||||
@@ -318,8 +317,16 @@ bool ClassFlowPostProcessing::doFlow(string zwtime)
|
|||||||
if (isanalog)
|
if (isanalog)
|
||||||
ReturnRawValue = ReturnRawValue + analog;
|
ReturnRawValue = ReturnRawValue + analog;
|
||||||
|
|
||||||
|
|
||||||
|
if (!isdigit)
|
||||||
|
{
|
||||||
|
AnzahlAnalog = 0;
|
||||||
|
}
|
||||||
|
|
||||||
ReturnRawValue = ShiftDecimal(ReturnRawValue, DecimalShift);
|
ReturnRawValue = ShiftDecimal(ReturnRawValue, DecimalShift);
|
||||||
|
|
||||||
|
rohwert = ReturnRawValue;
|
||||||
|
|
||||||
if (!PreValueUse || !PreValueOkay)
|
if (!PreValueUse || !PreValueOkay)
|
||||||
{
|
{
|
||||||
ReturnValue = ReturnRawValue;
|
ReturnValue = ReturnRawValue;
|
||||||
@@ -354,7 +361,7 @@ bool ClassFlowPostProcessing::doFlow(string zwtime)
|
|||||||
|
|
||||||
if ((!AllowNegativeRates) && (Value < PreValue))
|
if ((!AllowNegativeRates) && (Value < PreValue))
|
||||||
{
|
{
|
||||||
ErrorMessageText = ErrorMessageText + "Negative Rate - Returned old value - read value: " + zwvalue + " ";
|
ErrorMessageText = ErrorMessageText + "Negative Rate - Returned old value - read value: " + zwvalue + " - raw value: " + ReturnRawValue;
|
||||||
Value = PreValue;
|
Value = PreValue;
|
||||||
zwvalue = RundeOutput(Value, AnzahlAnalog - DecimalShift);
|
zwvalue = RundeOutput(Value, AnzahlAnalog - DecimalShift);
|
||||||
}
|
}
|
||||||
@@ -397,10 +404,24 @@ string ClassFlowPostProcessing::getReadoutParam(bool _rawValue, bool _noerror)
|
|||||||
|
|
||||||
string ClassFlowPostProcessing::RundeOutput(float _in, int _anzNachkomma){
|
string ClassFlowPostProcessing::RundeOutput(float _in, int _anzNachkomma){
|
||||||
std::stringstream stream;
|
std::stringstream stream;
|
||||||
|
int _zw = _in;
|
||||||
|
// printf("AnzNachkomma: %d\n", _anzNachkomma);
|
||||||
|
|
||||||
if (_anzNachkomma < 0) {
|
if (_anzNachkomma < 0) {
|
||||||
_anzNachkomma = 0;
|
_anzNachkomma = 0;
|
||||||
}
|
}
|
||||||
stream << std::fixed << std::setprecision(_anzNachkomma) << _in;
|
|
||||||
|
if (_anzNachkomma > 0)
|
||||||
|
{
|
||||||
|
stream << std::fixed << std::setprecision(_anzNachkomma) << _in;
|
||||||
|
return stream.str();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
stream << _zw;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return stream.str();
|
return stream.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ protected:
|
|||||||
string RundeOutput(float _in, int _anzNachkomma);
|
string RundeOutput(float _in, int _anzNachkomma);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// ClassFlowPostProcessing();
|
|
||||||
ClassFlowPostProcessing(std::vector<ClassFlow*>* lfc);
|
ClassFlowPostProcessing(std::vector<ClassFlow*>* lfc);
|
||||||
bool ReadParameter(FILE* pfile, string& aktparamgraph);
|
bool ReadParameter(FILE* pfile, string& aktparamgraph);
|
||||||
bool doFlow(string time);
|
bool doFlow(string time);
|
||||||
|
|||||||
@@ -470,21 +470,26 @@ esp_err_t handler_prevalue(httpd_req_t *req)
|
|||||||
const char* resp_str;
|
const char* resp_str;
|
||||||
string zw;
|
string zw;
|
||||||
|
|
||||||
// printf("handler_prevalue:\n"); printf(req->uri); printf("\n");
|
#ifdef DEBUG_DETAIL_ON
|
||||||
|
printf("handler_prevalue:\n"); printf(req->uri); printf("\n");
|
||||||
|
#endif
|
||||||
|
|
||||||
char _query[100];
|
char _query[100];
|
||||||
char _size[10] = "";
|
char _size[10] = "";
|
||||||
|
|
||||||
if (httpd_req_get_url_query_str(req, _query, 100) == ESP_OK)
|
if (httpd_req_get_url_query_str(req, _query, 100) == ESP_OK)
|
||||||
{
|
{
|
||||||
// printf("Query: "); printf(_query); printf("\n");
|
#ifdef DEBUG_DETAIL_ON
|
||||||
|
printf("Query: "); printf(_query); printf("\n");
|
||||||
|
#endif
|
||||||
|
|
||||||
if (httpd_query_key_value(_query, "value", _size, 10) == ESP_OK)
|
if (httpd_query_key_value(_query, "value", _size, 10) == ESP_OK)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_DETAIL_ON
|
#ifdef DEBUG_DETAIL_ON
|
||||||
printf("Value: "); printf(_size); printf("\n");
|
printf("Value: "); printf(_size); printf("\n");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strlen(_size) == 0)
|
if (strlen(_size) == 0)
|
||||||
zw = tfliteflow.GetPrevalue();
|
zw = tfliteflow.GetPrevalue();
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
const char* GIT_REV="e520609";
|
const char* GIT_REV="9bb715f";
|
||||||
const char* GIT_TAG="";
|
const char* GIT_TAG="";
|
||||||
const char* GIT_BRANCH="rolling";
|
const char* GIT_BRANCH="rolling";
|
||||||
const char* BUILD_TIME="2021-01-05 20:40";
|
const char* BUILD_TIME="2021-01-17 12:21";
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
const char* GIT_REV="e520609";
|
const char* GIT_REV="9bb715f";
|
||||||
const char* GIT_TAG="";
|
const char* GIT_TAG="";
|
||||||
const char* GIT_BRANCH="rolling";
|
const char* GIT_BRANCH="rolling";
|
||||||
const char* BUILD_TIME="2021-01-05 20:40";
|
const char* BUILD_TIME="2021-01-17 12:21";
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -147,16 +147,20 @@ function EnDisableAnalog() {
|
|||||||
$("#div2").addClass("disabledDiv");
|
$("#div2").addClass("disabledDiv");
|
||||||
}
|
}
|
||||||
|
|
||||||
sah1(document.getElementById("div1"));
|
sah1(document.getElementById("div1"), !isEnabled);
|
||||||
|
if (isEnabled)
|
||||||
|
{
|
||||||
|
UpdateROIs();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function sah1(el) {
|
function sah1(el, _target) {
|
||||||
try {
|
try {
|
||||||
el.disabled = el.disabled ? false : true;
|
el.disabled = _target;
|
||||||
} catch (E) {}
|
} catch (E) {}
|
||||||
if (el.childNodes && el.childNodes.length > 0) {
|
if (el.childNodes && el.childNodes.length > 0) {
|
||||||
for (var x = 0; x < el.childNodes.length; x++) {
|
for (var x = 0; x < el.childNodes.length; x++) {
|
||||||
sah1(el.childNodes[x]);
|
sah1(el.childNodes[x], _target);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -219,7 +223,7 @@ function ChangeSelection(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function SaveToConfig(){
|
function SaveToConfig(){
|
||||||
_enabled = document.getElementById("index").checked;
|
_enabled = document.getElementById("Category_Analog_enabled").checked;
|
||||||
SaveROIToConfig(ROIInfo, "[Analog]", basepath, _enabled);
|
SaveROIToConfig(ROIInfo, "[Analog]", basepath, _enabled);
|
||||||
UpdatePage();
|
UpdatePage();
|
||||||
}
|
}
|
||||||
@@ -346,22 +350,25 @@ function ParseIni(_basepath) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function draw() {
|
function draw() {
|
||||||
var canvas = document.getElementById('canvas');
|
var canvas = document.getElementById('canvas');
|
||||||
var context = canvas.getContext('2d');
|
var context = canvas.getContext('2d');
|
||||||
context.drawImage(imageObj, 0, 0);
|
context.drawImage(imageObj, 0, 0);
|
||||||
lw = 4
|
if (document.getElementById("Category_Analog_enabled").checked)
|
||||||
context.lineWidth = lw;
|
{
|
||||||
context.strokeStyle = "#FF0000";
|
lw = 4
|
||||||
var x0 = parseInt(rect.startX) - parseInt(lw/2);
|
context.lineWidth = lw;
|
||||||
var y0 = parseInt(rect.startY) - parseInt(lw/2);
|
context.strokeStyle = "#FF0000";
|
||||||
var dx = parseInt(rect.w) + parseInt(lw);
|
var x0 = parseInt(rect.startX) - parseInt(lw/2);
|
||||||
var dy = parseInt(rect.h) + parseInt(lw);
|
var y0 = parseInt(rect.startY) - parseInt(lw/2);
|
||||||
context.strokeRect(x0, y0, dx, dy);
|
var dx = parseInt(rect.w) + parseInt(lw);
|
||||||
ROIInfo[aktindex]["x"] = rect.startX;
|
var dy = parseInt(rect.h) + parseInt(lw);
|
||||||
ROIInfo[aktindex]["y"] = rect.startY;
|
context.strokeRect(x0, y0, dx, dy);
|
||||||
ROIInfo[aktindex]["dx"] = rect.w;
|
ROIInfo[aktindex]["x"] = rect.startX;
|
||||||
ROIInfo[aktindex]["dy"] = rect.h;
|
ROIInfo[aktindex]["y"] = rect.startY;
|
||||||
|
ROIInfo[aktindex]["dx"] = rect.w;
|
||||||
|
ROIInfo[aktindex]["dy"] = rect.h;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCoords(elem) { // crossbrowser version
|
function getCoords(elem) { // crossbrowser version
|
||||||
|
|||||||
@@ -179,8 +179,10 @@ textarea {
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr class="expert" id="ex4">
|
|
||||||
<td colspan="4" style="padding-left: 20px;"><h4>Digits</h4></td>
|
<tr id="Category_Digits_ex4">
|
||||||
|
<td colspan="4" style="padding-left: 20px;">
|
||||||
|
<h4><input type="checkbox" id="Category_Digits_enabled" value="1" onclick = 'UpdateAfterCategoryCheck()' unchecked >Digits</h4></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="20px" style="padding-left: 40px;">
|
<td width="20px" style="padding-left: 40px;">
|
||||||
@@ -736,6 +738,7 @@ function ReadParameter(_param, _cat, _name, _optional, _select = false){
|
|||||||
|
|
||||||
function UpdateInput() {
|
function UpdateInput() {
|
||||||
document.getElementById("Category_Analog_enabled").checked = category["Analog"]["enabled"];
|
document.getElementById("Category_Analog_enabled").checked = category["Analog"]["enabled"];
|
||||||
|
document.getElementById("Category_Digits_enabled").checked = category["Digits"]["enabled"];
|
||||||
document.getElementById("Category_MQTT_enabled").checked = category["MQTT"]["enabled"];
|
document.getElementById("Category_MQTT_enabled").checked = category["MQTT"]["enabled"];
|
||||||
|
|
||||||
WriteParameter(param, category, "MakeImage", "LogImageLocation", true);
|
WriteParameter(param, category, "MakeImage", "LogImageLocation", true);
|
||||||
@@ -787,6 +790,7 @@ function UpdateInput() {
|
|||||||
function ReadParameterAll()
|
function ReadParameterAll()
|
||||||
{
|
{
|
||||||
category["Analog"]["enabled"] = document.getElementById("Category_Analog_enabled").checked;
|
category["Analog"]["enabled"] = document.getElementById("Category_Analog_enabled").checked;
|
||||||
|
category["Digits"]["enabled"] = document.getElementById("Category_Digits_enabled").checked;
|
||||||
category["MQTT"]["enabled"] = document.getElementById("Category_MQTT_enabled").checked;
|
category["MQTT"]["enabled"] = document.getElementById("Category_MQTT_enabled").checked;
|
||||||
|
|
||||||
ReadParameter(param, "MakeImage", "LogImageLocation", true);
|
ReadParameter(param, "MakeImage", "LogImageLocation", true);
|
||||||
@@ -853,6 +857,7 @@ function FormatDecimalValue(_param, _cat, _name) {
|
|||||||
function UpdateAfterCategoryCheck() {
|
function UpdateAfterCategoryCheck() {
|
||||||
ReadParameterAll();
|
ReadParameterAll();
|
||||||
category["Analog"]["enabled"] = document.getElementById("Category_Analog_enabled").checked;
|
category["Analog"]["enabled"] = document.getElementById("Category_Analog_enabled").checked;
|
||||||
|
category["Digits"]["enabled"] = document.getElementById("Category_Digits_enabled").checked;
|
||||||
UpdateInput();
|
UpdateInput();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,10 @@ th, td {
|
|||||||
|
|
||||||
<body style="font-family: arial; padding: 0px 10px;">
|
<body style="font-family: arial; padding: 0px 10px;">
|
||||||
|
|
||||||
<h2>Edit Digits</h2>
|
<h2><input type="checkbox" id="Category_Digits_enabled" value="1" onclick = 'EnDisableDigits()' checked >
|
||||||
|
Edit Digits</h2>
|
||||||
|
|
||||||
|
<div id="div1">
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -91,7 +94,9 @@ th, td {
|
|||||||
<td>y: <input type="number" name="refy" id="refy" step=1 onchange="valuemanualchanged()"></td>
|
<td>y: <input type="number" name="refy" id="refy" step=1 onchange="valuemanualchanged()"></td>
|
||||||
<td>dy: <input type="number" name="refdy" id="refdy" step=1 onchange="valuemanualchanged()"></td>
|
<td>dy: <input type="number" name="refdy" id="refdy" step=1 onchange="valuemanualchanged()"></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -102,6 +107,7 @@ th, td {
|
|||||||
<script type="text/javascript" src="./gethost.js"></script>
|
<script type="text/javascript" src="./gethost.js"></script>
|
||||||
<script type="text/javascript" src="./readconfig.js"></script>
|
<script type="text/javascript" src="./readconfig.js"></script>
|
||||||
<script type="text/javascript" src="./readconfigcommon.js"></script>
|
<script type="text/javascript" src="./readconfigcommon.js"></script>
|
||||||
|
<script type="text/javascript" src="./jquery-3.5.1.min.js"></script>
|
||||||
|
|
||||||
<script language="JavaScript">
|
<script language="JavaScript">
|
||||||
var canvas = document.getElementById('canvas'),
|
var canvas = document.getElementById('canvas'),
|
||||||
@@ -115,6 +121,41 @@ th, td {
|
|||||||
lockAR = true;
|
lockAR = true;
|
||||||
basepath = "http://192.168.178.26";
|
basepath = "http://192.168.178.26";
|
||||||
|
|
||||||
|
|
||||||
|
function EnDisableDigits() {
|
||||||
|
isEnabled = document.getElementById("Category_Digits_enabled").checked;
|
||||||
|
|
||||||
|
$("#div2").attr("disabled", "disabled").off('click');
|
||||||
|
var x1=$("#div2").hasClass("disabledDiv");
|
||||||
|
|
||||||
|
if (isEnabled)
|
||||||
|
{
|
||||||
|
$("#div2").removeClass("disabledDiv");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$("#div2").addClass("disabledDiv");
|
||||||
|
}
|
||||||
|
|
||||||
|
sah1(document.getElementById("div1"), !isEnabled);
|
||||||
|
if (isEnabled)
|
||||||
|
{
|
||||||
|
UpdateROIs();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function sah1(el, _target) {
|
||||||
|
try {
|
||||||
|
el.disabled = _target;
|
||||||
|
} catch (E) {}
|
||||||
|
if (el.childNodes && el.childNodes.length > 0) {
|
||||||
|
for (var x = 0; x < el.childNodes.length; x++) {
|
||||||
|
sah1(el.childNodes[x], _target);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function onNameChange(){
|
function onNameChange(){
|
||||||
ROIInfo[aktindex]["name"] = document.getElementById("name").value;
|
ROIInfo[aktindex]["name"] = document.getElementById("name").value;
|
||||||
UpdateROIs();
|
UpdateROIs();
|
||||||
@@ -173,7 +214,8 @@ function ChangeSelection(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function SaveToConfig(){
|
function SaveToConfig(){
|
||||||
SaveROIToConfig(ROIInfo, "[Digits]", basepath);
|
_enabled = document.getElementById("Category_Digits_enabled").checked;
|
||||||
|
SaveROIToConfig(ROIInfo, "[Digits]", basepath, _enabled);
|
||||||
UpdatePage();
|
UpdatePage();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -231,8 +273,19 @@ function UpdateROIs(){
|
|||||||
function ParseIni(_basepath) {
|
function ParseIni(_basepath) {
|
||||||
loadConfig(_basepath);
|
loadConfig(_basepath);
|
||||||
ParseConfig();
|
ParseConfig();
|
||||||
|
|
||||||
|
document.getElementById("Category_Digits_enabled").checked = true;
|
||||||
ROIInfo = getROIInfo("[Digits]");
|
ROIInfo = getROIInfo("[Digits]");
|
||||||
|
|
||||||
|
if (!GetDigitsEnabled())
|
||||||
|
{
|
||||||
|
document.getElementById("Category_Digits_enabled").checked = false;
|
||||||
|
EnDisableDigits();
|
||||||
|
alert("Digital ROIs are disabled - please enable (Check box top left).\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
UpdateROIs();
|
UpdateROIs();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -288,22 +341,25 @@ function ParseIni(_basepath) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function draw() {
|
function draw() {
|
||||||
var canvas = document.getElementById('canvas');
|
var canvas = document.getElementById('canvas');
|
||||||
var context = canvas.getContext('2d');
|
var context = canvas.getContext('2d');
|
||||||
context.drawImage(imageObj, 0, 0);
|
context.drawImage(imageObj, 0, 0);
|
||||||
lw = 4
|
if (document.getElementById("Category_Digits_enabled").checked)
|
||||||
context.lineWidth = lw;
|
{
|
||||||
context.strokeStyle = "#FF0000";
|
lw = 4
|
||||||
var x0 = parseInt(rect.startX) - parseInt(lw/2);
|
context.lineWidth = lw;
|
||||||
var y0 = parseInt(rect.startY) - parseInt(lw/2);
|
context.strokeStyle = "#FF0000";
|
||||||
var dx = parseInt(rect.w) + parseInt(lw);
|
var x0 = parseInt(rect.startX) - parseInt(lw/2);
|
||||||
var dy = parseInt(rect.h) + parseInt(lw);
|
var y0 = parseInt(rect.startY) - parseInt(lw/2);
|
||||||
context.strokeRect(x0, y0, dx, dy);
|
var dx = parseInt(rect.w) + parseInt(lw);
|
||||||
ROIInfo[aktindex]["x"] = rect.startX;
|
var dy = parseInt(rect.h) + parseInt(lw);
|
||||||
ROIInfo[aktindex]["y"] = rect.startY;
|
context.strokeRect(x0, y0, dx, dy);
|
||||||
ROIInfo[aktindex]["dx"] = rect.w;
|
ROIInfo[aktindex]["x"] = rect.startX;
|
||||||
ROIInfo[aktindex]["dy"] = rect.h;
|
ROIInfo[aktindex]["y"] = rect.startY;
|
||||||
|
ROIInfo[aktindex]["dx"] = rect.w;
|
||||||
|
ROIInfo[aktindex]["dy"] = rect.h;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCoords(elem) { // crossbrowser version
|
function getCoords(elem) { // crossbrowser version
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ var analog = new Array(0);
|
|||||||
var initalrotate = new Object();
|
var initalrotate = new Object();
|
||||||
var analogEnabled = false;
|
var analogEnabled = false;
|
||||||
var posAnalogHeader;
|
var posAnalogHeader;
|
||||||
|
var digitsEnabled = false;
|
||||||
|
var posDigitsHeader;
|
||||||
|
|
||||||
function MakeRefZW(zw, _basepath){
|
function MakeRefZW(zw, _basepath){
|
||||||
url = _basepath + "/editflow.html?task=cutref&in=/config/reference.jpg&out=/img_tmp/ref_zw_org.jpg&x=" + zw["x"] + "&y=" + zw["y"] + "&dx=" + zw["dx"] + "&dy=" + zw["dy"];
|
url = _basepath + "/editflow.html?task=cutref&in=/config/reference.jpg&out=/img_tmp/ref_zw_org.jpg&x=" + zw["x"] + "&y=" + zw["y"] + "&dx=" + zw["dx"] + "&dy=" + zw["dy"];
|
||||||
@@ -96,6 +98,12 @@ function GetAnalogEnabled() {
|
|||||||
return analogEnabled;
|
return analogEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function GetDigitsEnabled() {
|
||||||
|
return digitsEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function ParseConfigAnalog(_aktline){
|
function ParseConfigAnalog(_aktline){
|
||||||
++_aktline;
|
++_aktline;
|
||||||
analog.length = 0;
|
analog.length = 0;
|
||||||
@@ -133,16 +141,19 @@ function getROIInfo(_typeROI){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function SaveROIToConfig(_ROIInfo, _typeROI, _basepath, _enabled){
|
function SaveROIToConfig(_ROIInfo, _typeROI, _basepath, _enabled){
|
||||||
|
if (_enabled) {
|
||||||
|
text = _typeROI;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
text = ";" + _typeROI;
|
||||||
|
}
|
||||||
|
|
||||||
if (_typeROI == "[Digits]"){
|
if (_typeROI == "[Digits]"){
|
||||||
|
config_split[posDigitsHeader] = text;
|
||||||
targetROI = digit;
|
targetROI = digit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_typeROI == "[Analog]"){
|
if (_typeROI == "[Analog]"){
|
||||||
if (_enabled) {
|
|
||||||
text = _typeROI;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
text = ";" + _typeROI;
|
|
||||||
}
|
|
||||||
config_split[posAnalogHeader] = text;
|
config_split[posAnalogHeader] = text;
|
||||||
targetROI = analog;
|
targetROI = analog;
|
||||||
}
|
}
|
||||||
@@ -188,14 +199,18 @@ function ParseConfig() {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ((config_split[aktline].trim().toUpperCase() == "[DIGITS]") || (config_split[aktline].trim().toUpperCase() == ";[DIGITS]")){
|
if ((config_split[aktline].trim().toUpperCase() == "[DIGITS]") || (config_split[aktline].trim().toUpperCase() == ";[DIGITS]")){
|
||||||
|
posDigitsHeader = aktline;
|
||||||
|
if (config_split[aktline][0] == "[") {
|
||||||
|
digitsEnabled = true;
|
||||||
|
}
|
||||||
aktline = ParseConfigDigit(aktline);
|
aktline = ParseConfigDigit(aktline);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((config_split[aktline].trim().toUpperCase() == "[ANALOG]") || (config_split[aktline].trim().toUpperCase() == ";[ANALOG]")) {
|
if ((config_split[aktline].trim().toUpperCase() == "[ANALOG]") || (config_split[aktline].trim().toUpperCase() == ";[ANALOG]")) {
|
||||||
|
posAnalogHeader = aktline;
|
||||||
if (config_split[aktline][0] == "[") {
|
if (config_split[aktline][0] == "[") {
|
||||||
analogEnabled = true;
|
analogEnabled = true;
|
||||||
posAnalogHeader = aktline;
|
|
||||||
}
|
}
|
||||||
aktline = ParseConfigAnalog(aktline);
|
aktline = ParseConfigAnalog(aktline);
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
5.0.1
|
5.1.0
|
||||||
|
|||||||
Reference in New Issue
Block a user