Change data to csv, harmonize REST API editflow

This commit is contained in:
jomjol
2022-11-05 19:56:09 +01:00
parent 22fe50f80a
commit 9b8594c040
11 changed files with 31 additions and 30 deletions

View File

@@ -12,7 +12,7 @@
- SD card info into the "Info" Menue (thanks to [@Slider007]( https://github.com/Slider0007)) - SD card info into the "Info" Menue (thanks to [@Slider007]( https://github.com/Slider0007))
- Added a logging of the values in a text table in `/log/data` - each measurement is one line - Added a logging of the values in a text table in `/log/data` - each measurement is one line
- Format: tabulator separated - Format: csv - comma separated
- Content: time, name-of-number, raw-value, return-value, pre-value, change-rate, change-absolute, error-text, cnn-digital, cnn-analog - Content: time, name-of-number, raw-value, return-value, pre-value, change-rate, change-absolute, error-text, cnn-digital, cnn-analog
@@ -27,6 +27,8 @@
- [#1116](https://github.com/jomjol/AI-on-the-edge-device/issues/1116) precision problem at setting prevalue - [#1116](https://github.com/jomjol/AI-on-the-edge-device/issues/1116) precision problem at setting prevalue
- [#1119](https://github.com/jomjol/AI-on-the-edge-device/issues/1119) renamed `firmware.bin` not working in OTA - [#1119](https://github.com/jomjol/AI-on-the-edge-device/issues/1119) renamed `firmware.bin` not working in OTA
- [#1143](https://github.com/jomjol/AI-on-the-edge-device/issues/1143) changed postprocess for analog->digit (lowest digit processing) - [#1143](https://github.com/jomjol/AI-on-the-edge-device/issues/1143) changed postprocess for analog->digit (lowest digit processing)
- [#1280](https://github.com/jomjol/AI-on-the-edge-device/issues/1280) check ROIs name for "," and "." (not allowed)
### Removed ### Removed
- n.a. - n.a.

View File

@@ -979,20 +979,20 @@ string ClassFlowCNNGeneral::getReadoutRawString(int _analog)
{ {
if (CNNType == Analogue || CNNType == Analogue100) if (CNNType == Analogue || CNNType == Analogue100)
{ {
rt = rt + "\t" + RundeOutput(GENERAL[_analog]->ROI[i]->result_float, 1); rt = rt + "," + RundeOutput(GENERAL[_analog]->ROI[i]->result_float, 1);
} }
if (CNNType == Digital) if (CNNType == Digital)
{ {
if (GENERAL[_analog]->ROI[i]->result_klasse == 10) if (GENERAL[_analog]->ROI[i]->result_klasse == 10)
rt = rt + "\tN"; rt = rt + ",N";
else else
rt = rt + "\t" + RundeOutput(GENERAL[_analog]->ROI[i]->result_klasse, 0); rt = rt + "," + RundeOutput(GENERAL[_analog]->ROI[i]->result_klasse, 0);
} }
if ((CNNType == DoubleHyprid10) || (CNNType == Digital100)) if ((CNNType == DoubleHyprid10) || (CNNType == Digital100))
{ {
rt = rt + "\t" + RundeOutput(GENERAL[_analog]->ROI[i]->result_float, 1); rt = rt + "," + RundeOutput(GENERAL[_analog]->ROI[i]->result_float, 1);
} }
} }
return rt; return rt;

View File

@@ -18,7 +18,7 @@ extern "C" {
static const char *TAG = "log"; static const char *TAG = "log";
ClassLogFile LogFile("/sdcard/log/message", "log_%Y-%m-%d.txt", "/sdcard/log/data", "data_%Y-%m-%d.txt"); ClassLogFile LogFile("/sdcard/log/message", "log_%Y-%m-%d.txt", "/sdcard/log/data", "data_%Y-%m-%d.csv");
void ClassLogFile::WriteHeapInfo(std::string _id) void ClassLogFile::WriteHeapInfo(std::string _id)
{ {
@@ -90,19 +90,19 @@ void ClassLogFile::WriteToData(std::string _timestamp, std::string _name, std::s
if (pFile!=NULL) { if (pFile!=NULL) {
fputs(_timestamp.c_str(), pFile); fputs(_timestamp.c_str(), pFile);
fputs("\t", pFile); fputs(",", pFile);
fputs(_name.c_str(), pFile); fputs(_name.c_str(), pFile);
fputs("\t", pFile); fputs(",", pFile);
fputs(_ReturnRawValue.c_str(), pFile); fputs(_ReturnRawValue.c_str(), pFile);
fputs("\t", pFile); fputs(",", pFile);
fputs(_ReturnValue.c_str(), pFile); fputs(_ReturnValue.c_str(), pFile);
fputs("\t", pFile); fputs(",", pFile);
fputs(_ReturnPreValue.c_str(), pFile); fputs(_ReturnPreValue.c_str(), pFile);
fputs("\t", pFile); fputs(",", pFile);
fputs(_ReturnRateValue.c_str(), pFile); fputs(_ReturnRateValue.c_str(), pFile);
fputs("\t", pFile); fputs(",", pFile);
fputs(_ReturnChangeAbsolute.c_str(), pFile); fputs(_ReturnChangeAbsolute.c_str(), pFile);
fputs("\t", pFile); fputs(",", pFile);
fputs(_ErrorMessageText.c_str(), pFile); fputs(_ErrorMessageText.c_str(), pFile);
fputs(_digital.c_str(), pFile); fputs(_digital.c_str(), pFile);
fputs(_analog.c_str(), pFile); fputs(_analog.c_str(), pFile);

View File

@@ -28,7 +28,6 @@ public:
void CreateLogDirectories(); void CreateLogDirectories();
void RemoveOld(); void RemoveOld();
// void WriteToData(std::string _ReturnRawValue, std::string _ReturnValue, std::string _ReturnPreValue, std::string _ErrorMessageText, std::string _digital, std::string _analog);
void WriteToData(std::string _timestamp, std::string _name, std::string _ReturnRawValue, std::string _ReturnValue, std::string _ReturnPreValue, std::string _ReturnRateValue, std::string _ReturnChangeAbsolute, std::string _ErrorMessageText, std::string _digital, std::string _analog); void WriteToData(std::string _timestamp, std::string _name, std::string _ReturnRawValue, std::string _ReturnValue, std::string _ReturnPreValue, std::string _ReturnRateValue, std::string _ReturnChangeAbsolute, std::string _ErrorMessageText, std::string _digital, std::string _analog);

View File

@@ -859,7 +859,7 @@ void register_server_tflite_uri(httpd_handle_t server)
camuri.user_ctx = (void*) "Light Off"; camuri.user_ctx = (void*) "Light Off";
httpd_register_uri_handler(server, &camuri); httpd_register_uri_handler(server, &camuri);
camuri.uri = "/editflow.html"; camuri.uri = "/editflow";
camuri.handler = handler_editflow; camuri.handler = handler_editflow;
camuri.user_ctx = (void*) "EditFlow"; camuri.user_ctx = (void*) "EditFlow";
httpd_register_uri_handler(server, &camuri); httpd_register_uri_handler(server, &camuri);

Binary file not shown.

View File

@@ -58,7 +58,7 @@ p {font-size: 1em;}
function doAnalog(){ function doAnalog(){
var xhttp = new XMLHttpRequest(); var xhttp = new XMLHttpRequest();
url = basepath + "/editflow.html?task=test_analog"; url = basepath + "/editflow?task=test_analog";
if (basepath.length > 0){ if (basepath.length > 0){
url = url + "&host=" + basepath; url = url + "&host=" + basepath;
} }
@@ -73,7 +73,7 @@ p {font-size: 1em;}
function doDigits(){ function doDigits(){
var xhttp = new XMLHttpRequest(); var xhttp = new XMLHttpRequest();
url = basepath + "/editflow.html?task=test_digits"; url = basepath + "/editflow?task=test_digits";
if (basepath.length > 0){ if (basepath.length > 0){
url = url + "&host=" + basepath; url = url + "&host=" + basepath;
} }
@@ -88,7 +88,7 @@ p {font-size: 1em;}
function doAlign(){ function doAlign(){
var xhttp = new XMLHttpRequest(); var xhttp = new XMLHttpRequest();
url = basepath + "/editflow.html?task=test_align"; url = basepath + "/editflow?task=test_align";
if (basepath.length > 0){ if (basepath.length > 0){
url = url + "&host=" + basepath; url = url + "&host=" + basepath;
} }
@@ -107,7 +107,7 @@ p {font-size: 1em;}
function doTake(){ function doTake(){
var xhttp = new XMLHttpRequest(); var xhttp = new XMLHttpRequest();
url = basepath + "/editflow.html?task=test_take"; url = basepath + "/editflow?task=test_take";
if (basepath.length > 0){ if (basepath.length > 0){
url = url + "&host=" + basepath; url = url + "&host=" + basepath;
} }

View File

@@ -126,12 +126,12 @@ table {
_brightness = document.getElementById("MakeImage_Brightness_value1").value; _brightness = document.getElementById("MakeImage_Brightness_value1").value;
_contrast = document.getElementById("MakeImage_Contrast_value1").value; _contrast = document.getElementById("MakeImage_Contrast_value1").value;
_saturation = document.getElementById("MakeImage_Saturation_value1").value; _saturation = document.getElementById("MakeImage_Saturation_value1").value;
url = basepath + "/editflow.html?task=test_take&bri=" + _brightness; url = basepath + "/editflow?task=test_take&bri=" + _brightness;
url = url + "&con=" + _saturation + "&sat=" + _saturation + "&int=" + _intensity; url = url + "&con=" + _saturation + "&sat=" + _saturation + "&int=" + _intensity;
} }
else else
{ {
url = basepath + "/editflow.html?task=test_take"; url = basepath + "/editflow?task=test_take";
} }
if (basepath.length > 0){ if (basepath.length > 0){
url = url + "&host=" + basepath; url = url + "&host=" + basepath;

View File

@@ -59,10 +59,10 @@ fetch(_basepath + '/fileserver/log/data/' + datefile)
for (let line of lines) { for (let line of lines) {
{ {
console.log(line); console.log(line);
if (line.split("\t")[1] == numbername) if (line.split(",")[1] == numbername)
{ {
var value = line.split("\t")[datatype]; var value = line.split(",")[datatype];
var time = line.split("\t")[0]; var time = line.split(",")[0];
console.log("> "+time+" "+value+"\n"); console.log("> "+time+" "+value+"\n");
trace.x.push(time); trace.x.push(time);
// timex += 1; // timex += 1;

View File

@@ -141,7 +141,7 @@ function dataURLtoBlob(dataurl) {
} }
function FileCopyOnServer(_source, _target, _basepath = ""){ function FileCopyOnServer(_source, _target, _basepath = ""){
url = _basepath + "/editflow.html?task=copy&in=" + _source + "&out=" + _target; url = _basepath + "/editflow?task=copy&in=" + _source + "&out=" + _target;
var xhttp = new XMLHttpRequest(); var xhttp = new XMLHttpRequest();
try { try {
xhttp.open("GET", url, false); xhttp.open("GET", url, false);
@@ -225,7 +225,7 @@ function SaveCanvasToImage(_canvas, _filename, _delete = true, _basepath = ""){
function MakeContrastImageZW(zw, _enhance, _basepath){ function MakeContrastImageZW(zw, _enhance, _basepath){
_filename = zw["name"].replace("/config/", "/img_tmp/"); _filename = zw["name"].replace("/config/", "/img_tmp/");
url = _basepath + "/editflow.html?task=cutref&in=/config/reference.jpg&out=" + _filename + "&x=" + zw["x"] + "&y=" + zw["y"] + "&dx=" + zw["dx"] + "&dy=" + zw["dy"]; url = _basepath + "/editflow?task=cutref&in=/config/reference.jpg&out=" + _filename + "&x=" + zw["x"] + "&y=" + zw["y"] + "&dx=" + zw["dx"] + "&dy=" + zw["dy"];
if (_enhance == true){ if (_enhance == true){
url = url + "&enhance=true"; url = url + "&enhance=true";
} }
@@ -245,7 +245,7 @@ function MakeContrastImageZW(zw, _enhance, _basepath){
function MakeRefZW(zw, _basepath){ function MakeRefZW(zw, _basepath){
_filetarget = zw["name"].replace("/config/", "/img_tmp/"); _filetarget = zw["name"].replace("/config/", "/img_tmp/");
_filetarget = _filetarget.replace(".jpg", "_org.jpg"); _filetarget = _filetarget.replace(".jpg", "_org.jpg");
url = _basepath + "/editflow.html?task=cutref&in=/config/reference.jpg&out="+_filetarget+"&x=" + zw["x"] + "&y=" + zw["y"] + "&dx=" + zw["dx"] + "&dy=" + zw["dy"]; url = _basepath + "/editflow?task=cutref&in=/config/reference.jpg&out="+_filetarget+"&x=" + zw["x"] + "&y=" + zw["y"] + "&dx=" + zw["dx"] + "&dy=" + zw["dy"];
var xhttp = new XMLHttpRequest(); var xhttp = new XMLHttpRequest();
try { try {
xhttp.open("GET", url, false); xhttp.open("GET", url, false);

View File

@@ -25,7 +25,7 @@ function getNUMBERSList() {
}); });
try { try {
url = _basepath + '/editflow.html?task=namenumbers'; url = _basepath + '/editflow?task=namenumbers';
xhttp.open("GET", url, false); xhttp.open("GET", url, false);
xhttp.send(); xhttp.send();
@@ -56,7 +56,7 @@ function getDATAList() {
}); });
try { try {
url = _basepath + '/editflow.html?task=data'; url = _basepath + '/editflow?task=data';
xhttp.open("GET", url, false); xhttp.open("GET", url, false);
xhttp.send(); xhttp.send();
@@ -87,7 +87,7 @@ function getTFLITEList() {
}); });
try { try {
url = _basepath + '/editflow.html?task=tflite'; url = _basepath + '/editflow?task=tflite';
xhttp.open("GET", url, false); xhttp.open("GET", url, false);
xhttp.send(); xhttp.send();