14 次代碼提交 64e6f979f6 ... ec7fa328a9

作者 SHA1 備註 提交日期
  SybexXx ec7fa328a9 Merge pull request #4039 from SybexX/test_mh 2 周之前
  SybexXx 2772187740 Update camera bus frequency to 16 MHz 2 周之前
  michael 4cd8cad83d test5 2 周之前
  SybexXx bba1dbc8b1 Merge pull request #4036 from SybexX/test_mh 2 周之前
  michael 6e1288dca0 test4 2 周之前
  SybexXx d571feb5de Merge pull request #4033 from SybexX/test_mh 2 周之前
  michael f2f5ae7b8f test3 2 周之前
  SybexXx f30cbe68fb Merge pull request #4031 from SybexX/test_mh 2 周之前
  SybexXx 908a283685 Toggle include for stb_image_resize header 2 周之前
  SybexXx a80239832b Update image resize header includes 2 周之前
  michael ed9543b34d test2 2 周之前
  michael 490fe23b8a test2 2 周之前
  michael fa18cc1ce3 test2 2 周之前
  michael e39718a21a test2 2 周之前
共有 51 個文件被更改,包括 1372 次插入1457 次删除
  1. 1 1
      code/components/esp-nn
  2. 1 1
      code/components/esp-tflite-micro
  3. 1 1
      code/components/esp32-camera
  4. 1 1
      code/components/jomjol_controlcamera/ClassControllCamera.cpp
  5. 290 243
      code/components/jomjol_fileserver_ota/server_file.cpp
  6. 158 158
      code/components/jomjol_flowcontroll/ClassFlowCNNGeneral.cpp
  7. 4 4
      code/components/jomjol_flowcontroll/ClassFlowControll.cpp
  8. 4 3
      code/components/jomjol_flowcontroll/ClassFlowDefineTypes.h
  9. 34 21
      code/components/jomjol_flowcontroll/ClassFlowImage.cpp
  10. 6 6
      code/components/jomjol_flowcontroll/ClassFlowImage.h
  11. 5 2
      code/components/jomjol_flowcontroll/ClassFlowMQTT.cpp
  12. 1 1
      code/components/jomjol_flowcontroll/ClassFlowMQTT.h
  13. 137 74
      code/components/jomjol_flowcontroll/ClassFlowPostProcessing.cpp
  14. 3 3
      code/components/jomjol_flowcontroll/ClassFlowPostProcessing.h
  15. 25 27
      code/components/jomjol_helper/Helper.cpp
  16. 92 35
      code/components/jomjol_helper/sdcard_check.cpp
  17. 2 2
      code/components/jomjol_image_proc/CImageBasis.h
  18. 2 2
      code/components/jomjol_image_proc/make_stb.cpp
  19. 1 0
      code/components/jomjol_mqtt/interface_mqtt.cpp
  20. 3 3
      code/components/jomjol_mqtt/server_mqtt.cpp
  21. 10 2
      code/components/jomjol_network/network_init.cpp
  22. 0 3
      code/components/jomjol_network/read_network_config.cpp
  23. 1 1
      code/components/jomjol_network/read_network_config.h
  24. 84 80
      code/components/jomjol_network/server_remote.cpp
  25. 1 1
      code/components/stb
  26. 2 1
      code/include/defines.h
  27. 29 22
      code/main/version.h
  28. 1 2
      param-docs/expert-params.txt
  29. 2 2
      param-docs/parameter-pages/PostProcessing/NUMBER.SkipErrorMessage.md
  30. 6 8
      sd-card/config/config.ini
  31. 20 16
      sd-card/demo/config.ini
  32. 12 22
      sd-card/html/backup.html
  33. 14 10
      sd-card/html/data.html
  34. 10 8
      sd-card/html/data_export.html
  35. 8 14
      sd-card/html/edit_alignment.html
  36. 13 23
      sd-card/html/edit_analog.html
  37. 12 10
      sd-card/html/edit_config_raw.html
  38. 25 28
      sd-card/html/edit_config_template.html
  39. 13 21
      sd-card/html/edit_digits.html
  40. 14 18
      sd-card/html/edit_reference.html
  41. 21 20
      sd-card/html/graph.html
  42. 1 4
      sd-card/html/index.html
  43. 22 25
      sd-card/html/info.html
  44. 14 12
      sd-card/html/log.html
  45. 3 17
      sd-card/html/ota_page.html
  46. 7 24
      sd-card/html/overview.html
  47. 19 24
      sd-card/html/prevalue_set.html
  48. 58 6
      sd-card/html/readconfigcommon.js
  49. 168 435
      sd-card/html/readconfigparam.js
  50. 3 2
      sd-card/html/reboot_page.html
  51. 8 8
      sd-card/html/setup.html

+ 1 - 1
code/components/esp-nn

@@ -1 +1 @@
-Subproject commit 9195e969a7599c4355311fffabd2cd8a093ee691
+Subproject commit 596b08401a63da3a2e1b40868c442f582a99ae26

+ 1 - 1
code/components/esp-tflite-micro

@@ -1 +1 @@
-Subproject commit 07c014eb657962adc46614764e0b7068880d2cfd
+Subproject commit 5f31ea08cee30ef3c2a1dfe7357f4be4048bc044

+ 1 - 1
code/components/esp32-camera

@@ -1 +1 @@
-Subproject commit dba8da9898928d9808d57a0b0cdcde9f130ed8fe
+Subproject commit ddd00c5649ad72a007133e33ea8f34e9d7636078

+ 1 - 1
code/components/jomjol_controlcamera/ClassControllCamera.cpp

@@ -55,7 +55,7 @@ std::vector<std::string> demoFiles;
 // Originally: config.xclk_freq_mhz = 20000000, but this lead to visual artifacts on many modules.
 // Originally: config.xclk_freq_mhz = 20000000, but this lead to visual artifacts on many modules.
 // See https://github.com/espressif/esp32-camera/issues/150#issuecomment-726473652 et al.
 // See https://github.com/espressif/esp32-camera/issues/150#issuecomment-726473652 et al.
 #if !defined(XCLK_FREQ_MHZ)
 #if !defined(XCLK_FREQ_MHZ)
-int xclk = 20;
+int xclk = 16;
 #else
 #else
 int xclk = XCLK_FREQ_MHZ;
 int xclk = XCLK_FREQ_MHZ;
 #endif
 #endif

File diff suppressed because it is too large
+ 290 - 243
code/components/jomjol_fileserver_ota/server_file.cpp


+ 158 - 158
code/components/jomjol_flowcontroll/ClassFlowCNNGeneral.cpp

@@ -42,15 +42,15 @@ std::vector<double> ClassFlowCNNGeneral::getMeterValues(int _number = 0)
         return meterValues;
         return meterValues;
     }
     }
 
 
-    for (int i = 0; i < GENERAL[_number]->ROI.size(); ++i)
+    for (int _roi = 0; _roi < GENERAL[_number]->ROI.size(); ++_roi)
     {
     {
         if (CNNType == Digit)
         if (CNNType == Digit)
         {
         {
-            meterValues.push_back(GENERAL[_number]->ROI[i]->result_klasse);
+            meterValues.push_back(GENERAL[_number]->ROI[_roi]->result_klasse);
         }
         }
         else
         else
         {
         {
-            meterValues.push_back(GENERAL[_number]->ROI[i]->result_float);
+            meterValues.push_back(GENERAL[_number]->ROI[_roi]->result_float);
         }
         }
     }
     }
 
 
@@ -71,7 +71,7 @@ std::string ClassFlowCNNGeneral::getReadout(int _number = 0, bool _extendedResol
     if (CNNType == Analogue || CNNType == Analogue100)
     if (CNNType == Analogue || CNNType == Analogue100)
     {
     {
         float number = GENERAL[_number]->ROI[GENERAL[_number]->ROI.size() - 1]->result_float;
         float number = GENERAL[_number]->ROI[GENERAL[_number]->ROI.size() - 1]->result_float;
-        int result_after_decimal_point = ((int)floor(number * 10) + 10) % 10;
+        int result_after_decimal_point = ((int)floor(number * 10.0f) + 10) % 10;
 
 
         prev = PointerEvalAnalog(GENERAL[_number]->ROI[GENERAL[_number]->ROI.size() - 1]->result_float, prev);
         prev = PointerEvalAnalog(GENERAL[_number]->ROI[GENERAL[_number]->ROI.size() - 1]->result_float, prev);
         result = std::to_string(prev);
         result = std::to_string(prev);
@@ -81,9 +81,9 @@ std::string ClassFlowCNNGeneral::getReadout(int _number = 0, bool _extendedResol
             result = result + std::to_string(result_after_decimal_point);
             result = result + std::to_string(result_after_decimal_point);
         }
         }
 
 
-        for (int i = GENERAL[_number]->ROI.size() - 2; i >= 0; --i)
+        for (int _roi = GENERAL[_number]->ROI.size() - 2; _roi >= 0; --_roi)
         {
         {
-            prev = PointerEvalAnalog(GENERAL[_number]->ROI[i]->result_float, prev);
+            prev = PointerEvalAnalog(GENERAL[_number]->ROI[_roi]->result_float, prev);
             result = std::to_string(prev) + result;
             result = std::to_string(prev) + result;
         }
         }
         return result;
         return result;
@@ -91,11 +91,11 @@ std::string ClassFlowCNNGeneral::getReadout(int _number = 0, bool _extendedResol
 
 
     if (CNNType == Digit)
     if (CNNType == Digit)
     {
     {
-        for (int i = 0; i < GENERAL[_number]->ROI.size(); ++i)
+        for (int _roi = 0; _roi < GENERAL[_number]->ROI.size(); ++_roi)
         {
         {
-            if ((GENERAL[_number]->ROI[i]->result_klasse >= 0) && (GENERAL[_number]->ROI[i]->result_klasse < 10))
+            if ((GENERAL[_number]->ROI[_roi]->result_klasse >= 0) && (GENERAL[_number]->ROI[_roi]->result_klasse < 10))
             {
             {
-                result = result + std::to_string(GENERAL[_number]->ROI[i]->result_klasse);
+                result = result + std::to_string(GENERAL[_number]->ROI[_roi]->result_klasse);
             }
             }
             else
             else
             {
             {
@@ -114,7 +114,7 @@ std::string ClassFlowCNNGeneral::getReadout(int _number = 0, bool _extendedResol
             // is only set if it is the first digit (no analogue before!)
             // is only set if it is the first digit (no analogue before!)
             if (_extendedResolution)
             if (_extendedResolution)
             {
             {
-                int result_after_decimal_point = ((int)floor(number * 10)) % 10;
+                int result_after_decimal_point = ((int)floor(number * 10.0f)) % 10;
                 int result_before_decimal_point = ((int)floor(number)) % 10;
                 int result_before_decimal_point = ((int)floor(number)) % 10;
 
 
                 result = std::to_string(result_before_decimal_point) + std::to_string(result_after_decimal_point);
                 result = std::to_string(result_before_decimal_point) + std::to_string(result_after_decimal_point);
@@ -153,20 +153,20 @@ std::string ClassFlowCNNGeneral::getReadout(int _number = 0, bool _extendedResol
             }
             }
         }
         }
 
 
-        for (int i = GENERAL[_number]->ROI.size() - 2; i >= 0; --i)
+        for (int _roi = GENERAL[_number]->ROI.size() - 2; _roi >= 0; --_roi)
         {
         {
-            if ((GENERAL[_number]->ROI[i]->result_float >= 0.0f) && (GENERAL[_number]->ROI[i]->result_float < 10.0f))
+            if ((GENERAL[_number]->ROI[_roi]->result_float >= 0.0f) && (GENERAL[_number]->ROI[_roi]->result_float < 10.0f))
             {
             {
-                prev = PointerEvalHybrid(GENERAL[_number]->ROI[i]->result_float, GENERAL[_number]->ROI[i + 1]->result_float, prev);
-                LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "getReadout(DoubleHyprid10) - roi_" + std::to_string(i) + "prev= " + std::to_string(prev));
+                prev = PointerEvalHybrid(GENERAL[_number]->ROI[_roi]->result_float, GENERAL[_number]->ROI[_roi + 1]->result_float, prev);
+                LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "getReadout(DoubleHyprid10) - roi_" + std::to_string(_roi) + "prev= " + std::to_string(prev));
                 result = std::to_string(prev) + result;
                 result = std::to_string(prev) + result;
-                LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "getReadout(DoubleHyprid10) - roi_" + std::to_string(i) + "result= " + result);
+                LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "getReadout(DoubleHyprid10) - roi_" + std::to_string(_roi) + "result= " + result);
             }
             }
             else
             else
             {
             {
                 prev = -1;
                 prev = -1;
                 result = "N" + result;
                 result = "N" + result;
-                LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "getReadout(result_float < 0 /'N') - roi_" + std::to_string(i) + "result_float=" + std::to_string(GENERAL[_number]->ROI[i]->result_float));
+                LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "getReadout(result_float < 0 /'N') - roi_" + std::to_string(_roi) + "result_float=" + std::to_string(GENERAL[_number]->ROI[_roi]->result_float));
             }
             }
         }
         }
         return result;
         return result;
@@ -193,8 +193,8 @@ std::string ClassFlowCNNGeneral::getReadout(int _number = 0, bool _extendedResol
 int ClassFlowCNNGeneral::PointerEvalHybrid(float number, float number_of_predecessors, int eval_predecessors, bool Analog_Predecessors, float digitAnalogTransitionStart)
 int ClassFlowCNNGeneral::PointerEvalHybrid(float number, float number_of_predecessors, int eval_predecessors, bool Analog_Predecessors, float digitAnalogTransitionStart)
 {
 {
     int result = -1;
     int result = -1;
-    int result_after_decimal_point = ((int)floor(number * 10)) % 10;
-    int result_before_decimal_point = ((int)floor(number) + 10) % 10;
+    int result_after_decimal_point = ((int)floor(number * 10.0f)) % 10;
+    int result_before_decimal_point = ((int)(floor(number) + 10.0f)) % 10;
 
 
     if (eval_predecessors < 0)
     if (eval_predecessors < 0)
     {
     {
@@ -203,8 +203,7 @@ int ClassFlowCNNGeneral::PointerEvalHybrid(float number, float number_of_predece
         // add precisition of 2 digits and round before trunc
         // add precisition of 2 digits and round before trunc
         // a number greater than 9.994999 is returned as 10, this leads to an error during the decimal shift because the NUMBERS[j]->ReturnRawValue is one digit longer.
         // a number greater than 9.994999 is returned as 10, this leads to an error during the decimal shift because the NUMBERS[j]->ReturnRawValue is one digit longer.
         // To avoid this, an additional test must be carried out, see "if ((CNNType == DoubleHyprid10) || (CNNType == Digit100))" check in getReadout()
         // To avoid this, an additional test must be carried out, see "if ((CNNType == DoubleHyprid10) || (CNNType == Digit100))" check in getReadout()
-        // Another alternative would be "result = (int) ((int) trunc(round((number+10 % 10)*1000))) / 1000;", which could, however, lead to other errors?
-        result = (int)((int)trunc(round((number + 10 % 10) * 100))) / 100;
+        result = (int)(trunc(round((float)((int)(number + 10.0f) % 10) * 100.0f)) / 100.0f);
 
 
         LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "PointerEvalHybrid - No predecessor - Result = " + std::to_string(result) + " number: " + std::to_string(number) + " number_of_predecessors = " + std::to_string(number_of_predecessors) + " eval_predecessors = " + std::to_string(eval_predecessors) + " Digit_Uncertainty = " + std::to_string(Digit_Uncertainty));
         LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "PointerEvalHybrid - No predecessor - Result = " + std::to_string(result) + " number: " + std::to_string(number) + " number_of_predecessors = " + std::to_string(number_of_predecessors) + " eval_predecessors = " + std::to_string(eval_predecessors) + " Digit_Uncertainty = " + std::to_string(Digit_Uncertainty));
         return result;
         return result;
@@ -217,17 +216,17 @@ int ClassFlowCNNGeneral::PointerEvalHybrid(float number, float number_of_predece
         return result;
         return result;
     }
     }
 
 
-    if ((number_of_predecessors >= Digit_Transition_Area_Predecessor) && (number_of_predecessors <= (10.0 - Digit_Transition_Area_Predecessor)))
+    if ((number_of_predecessors >= (float)Digit_Transition_Area_Predecessor) && (number_of_predecessors <= (10.0f - (float)Digit_Transition_Area_Predecessor)))
     {
     {
         // no digit change, because predecessor is far enough away (0+/-DigitTransitionRangePredecessor) --> number is rounded
         // no digit change, because predecessor is far enough away (0+/-DigitTransitionRangePredecessor) --> number is rounded
         // Band around the digit --> Round off, as digit reaches inaccuracy in the frame
         // Band around the digit --> Round off, as digit reaches inaccuracy in the frame
         if ((result_after_decimal_point <= DigitBand) || (result_after_decimal_point >= (10 - DigitBand)))
         if ((result_after_decimal_point <= DigitBand) || (result_after_decimal_point >= (10 - DigitBand)))
         {
         {
-            result = ((int)round(number) + 10) % 10;
+            result = ((int)(round(number) + 10.0f)) % 10;
         }
         }
         else
         else
         {
         {
-            result = ((int)trunc(number) + 10) % 10;
+            result = ((int)(trunc(number) + 10.0f)) % 10;
         }
         }
 
 
         LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "PointerEvalHybrid - NO analogue predecessor, no change of digits, as pre-decimal point far enough away = " + std::to_string(result) + " number: " + std::to_string(number) + " number_of_predecessors = " + std::to_string(number_of_predecessors) + " eval_predecessors = " + std::to_string(eval_predecessors) + " Digit_Uncertainty = " + std::to_string(Digit_Uncertainty));
         LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "PointerEvalHybrid - NO analogue predecessor, no change of digits, as pre-decimal point far enough away = " + std::to_string(result) + " number: " + std::to_string(number) + " number_of_predecessors = " + std::to_string(number_of_predecessors) + " eval_predecessors = " + std::to_string(eval_predecessors) + " Digit_Uncertainty = " + std::to_string(Digit_Uncertainty));
@@ -277,25 +276,25 @@ int ClassFlowCNNGeneral::PointerEvalHybrid(float number, float number_of_predece
 int ClassFlowCNNGeneral::PointerEvalAnalogToDigit(float number, float numeral_preceder, int eval_predecessors, float AnalogToDigitTransitionStart)
 int ClassFlowCNNGeneral::PointerEvalAnalogToDigit(float number, float numeral_preceder, int eval_predecessors, float AnalogToDigitTransitionStart)
 {
 {
     int result = -1;
     int result = -1;
-    int result_after_decimal_point = ((int)floor(number * 10)) % 10;
-    int result_before_decimal_point = ((int)floor(number) + 10) % 10;
+    int result_after_decimal_point = ((int)floor(number * 10.0f)) % 10;
+    int result_before_decimal_point = ((int)(floor(number) + 10.0f)) % 10;
     bool roundedUp = false;
     bool roundedUp = false;
 
 
     // Within the digit inequalities
     // Within the digit inequalities
     // Band around the digit --> Round off, as digit reaches inaccuracy in the frame
     // Band around the digit --> Round off, as digit reaches inaccuracy in the frame
-    if ((result_after_decimal_point >= (10 - Digit_Uncertainty * 10)) || (eval_predecessors <= 4 && result_after_decimal_point >= 6))
-    { 
+    if ((result_after_decimal_point >= (int)(10.0f - ((float)Digit_Uncertainty * 10.0f))) || (eval_predecessors <= 4 && result_after_decimal_point >= 6))
+    {
         // or digit runs after (analogue =0..4, digit >=6)
         // or digit runs after (analogue =0..4, digit >=6)
-        result = (int)(round(number) + 10) % 10;
+        result = (int)(round(number) + 10.0f) % 10;
         roundedUp = true;
         roundedUp = true;
         // before/ after decimal point, because we adjust the number based on the uncertainty.
         // before/ after decimal point, because we adjust the number based on the uncertainty.
-        result_after_decimal_point = ((int)floor(result * 10)) % 10;
-        result_before_decimal_point = ((int)floor(result) + 10) % 10;
+        result_after_decimal_point = ((int)floor(result * 10.0f)) % 10;
+        result_before_decimal_point = ((int)(floor(result) + 10.0f)) % 10;
         LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "PointerEvalAnalogToDigit - Digit Uncertainty - Result = " + std::to_string(result) + " number: " + std::to_string(number) + " numeral_preceder: " + std::to_string(numeral_preceder) + " erg before comma: " + std::to_string(result_before_decimal_point) + " erg after comma: " + std::to_string(result_after_decimal_point));
         LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "PointerEvalAnalogToDigit - Digit Uncertainty - Result = " + std::to_string(result) + " number: " + std::to_string(number) + " numeral_preceder: " + std::to_string(numeral_preceder) + " erg before comma: " + std::to_string(result_before_decimal_point) + " erg after comma: " + std::to_string(result_after_decimal_point));
     }
     }
     else
     else
     {
     {
-        result = (int)((int)trunc(number) + 10) % 10;
+        result = (int)((int)(trunc(number) + 10.0f)) % 10;
         LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "PointerEvalAnalogToDigit - NO digit Uncertainty - Result = " + std::to_string(result) + " number: " + std::to_string(number) + " numeral_preceder = " + std::to_string(numeral_preceder));
         LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "PointerEvalAnalogToDigit - NO digit Uncertainty - Result = " + std::to_string(result) + " number: " + std::to_string(number) + " numeral_preceder = " + std::to_string(numeral_preceder));
     }
     }
 
 
@@ -322,26 +321,26 @@ int ClassFlowCNNGeneral::PointerEvalAnalog(float number, int numeral_preceder)
         return result;
         return result;
     }
     }
 
 
-    float number_min = number - Analog_error / 10.0;
-    float number_max = number + Analog_error / 10.0;
+    float number_min = number - ((float)Analog_error / 10.0f);
+    float number_max = number + ((float)Analog_error / 10.0f);
 
 
     if ((int)floor(number_max) - (int)floor(number_min) != 0)
     if ((int)floor(number_max) - (int)floor(number_min) != 0)
     {
     {
-        if (numeral_preceder <= Analog_error)
+        if (numeral_preceder <= (int)Analog_error)
         {
         {
-            result = ((int)floor(number_max) + 10) % 10;
+            result = ((int)(floor(number_max) + 10.0f)) % 10;
             LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "PointerEvalAnalog - number ambiguous, correction upwards - result = " + std::to_string(result) + " number: " + std::to_string(number) + " numeral_preceder = " + std::to_string(numeral_preceder) + " Analog_error = " + std::to_string(Analog_error));
             LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "PointerEvalAnalog - number ambiguous, correction upwards - result = " + std::to_string(result) + " number: " + std::to_string(number) + " numeral_preceder = " + std::to_string(numeral_preceder) + " Analog_error = " + std::to_string(Analog_error));
             return result;
             return result;
         }
         }
-        if (numeral_preceder >= 10 - Analog_error)
+        if (numeral_preceder >= (10 - (int)Analog_error))
         {
         {
-            result = ((int)floor(number_min) + 10) % 10;
+            result = ((int)(floor(number_min) + 10.0f)) % 10;
             LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "PointerEvalAnalog - number ambiguous, downward correction - result = " + std::to_string(result) + " number: " + std::to_string(number) + " numeral_preceder = " + std::to_string(numeral_preceder) + " Analog_error = " + std::to_string(Analog_error));
             LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "PointerEvalAnalog - number ambiguous, downward correction - result = " + std::to_string(result) + " number: " + std::to_string(number) + " numeral_preceder = " + std::to_string(numeral_preceder) + " Analog_error = " + std::to_string(Analog_error));
             return result;
             return result;
         }
         }
     }
     }
 
 
-    result = ((int)floor(number) + 10) % 10;
+    result = ((int)(floor(number) + 10.0f)) % 10;
     LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "PointerEvalAnalog - number unambiguous, no correction necessary - result = " + std::to_string(result) + " number: " + std::to_string(number) + " numeral_preceder = " + std::to_string(numeral_preceder) + " Analog_error = " + std::to_string(Analog_error));
     LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "PointerEvalAnalog - number unambiguous, no correction necessary - result = " + std::to_string(result) + " number: " + std::to_string(number) + " numeral_preceder = " + std::to_string(numeral_preceder) + " Analog_error = " + std::to_string(Analog_error));
 
 
     return result;
     return result;
@@ -369,7 +368,8 @@ bool ClassFlowCNNGeneral::ReadParameter(FILE *pfile, std::string &aktparamgraph)
     if (aktparamgraph[0] == ';')
     if (aktparamgraph[0] == ';')
     {
     {
         disabled = true;
         disabled = true;
-        while (getNextLine(pfile, &aktparamgraph) && !isNewParagraph(aktparamgraph));
+        while (getNextLine(pfile, &aktparamgraph) && !isNewParagraph(aktparamgraph))
+            ;
         ESP_LOGD(TAG, "[Analog/Digit] is disabled!");
         ESP_LOGD(TAG, "[Analog/Digit] is disabled!");
 
 
         return true;
         return true;
@@ -455,12 +455,12 @@ bool ClassFlowCNNGeneral::ReadParameter(FILE *pfile, std::string &aktparamgraph)
         return false;
         return false;
     }
     }
 
 
-    for (int i = 0; i < GENERAL.size(); ++i)
+    for (int _number = 0; _number < GENERAL.size(); ++_number)
     {
     {
-        for (int j = 0; j < GENERAL[i]->ROI.size(); ++j)
+        for (int _roi = 0; _roi < GENERAL[_number]->ROI.size(); ++_roi)
         {
         {
-            GENERAL[i]->ROI[j]->image = new CImageBasis("ROI " + GENERAL[i]->ROI[j]->name, model_x_size, model_y_size, model_channel);
-            GENERAL[i]->ROI[j]->image_org = new CImageBasis("ROI " + GENERAL[i]->ROI[j]->name + " original", GENERAL[i]->ROI[j]->delta_x, GENERAL[i]->ROI[j]->delta_y, 3);
+            GENERAL[_number]->ROI[_roi]->image = new CImageBasis("ROI " + GENERAL[_number]->ROI[_roi]->name, model_x_size, model_y_size, model_channel);
+            GENERAL[_number]->ROI[_roi]->image_org = new CImageBasis("ROI " + GENERAL[_number]->ROI[_roi]->name + " original", GENERAL[_number]->ROI[_roi]->delta_x, GENERAL[_number]->ROI[_roi]->delta_y, 3);
         }
         }
     }
     }
 
 
@@ -469,11 +469,11 @@ bool ClassFlowCNNGeneral::ReadParameter(FILE *pfile, std::string &aktparamgraph)
 
 
 general *ClassFlowCNNGeneral::FindGENERAL(std::string _name_number)
 general *ClassFlowCNNGeneral::FindGENERAL(std::string _name_number)
 {
 {
-    for (int i = 0; i < GENERAL.size(); ++i)
+    for (int _number = 0; _number < GENERAL.size(); ++_number)
     {
     {
-        if (GENERAL[i]->name == _name_number)
+        if (GENERAL[_number]->name == _name_number)
         {
         {
-            return GENERAL[i];
+            return GENERAL[_number];
         }
         }
     }
     }
 
 
@@ -581,35 +581,35 @@ bool ClassFlowCNNGeneral::doAlignAndCut(std::string time_value)
 
 
     CAlignAndCutImage *caic = flowpostalignment->GetAlignAndCutImage();
     CAlignAndCutImage *caic = flowpostalignment->GetAlignAndCutImage();
 
 
-    for (int _ana = 0; _ana < GENERAL.size(); ++_ana)
+    for (int _number = 0; _number < GENERAL.size(); ++_number)
     {
     {
-        for (int i = 0; i < GENERAL[_ana]->ROI.size(); ++i)
+        for (int _roi = 0; _roi < GENERAL[_number]->ROI.size(); ++_roi)
         {
         {
-            ESP_LOGD(TAG, "General %d - Align&Cut", i);
+            ESP_LOGD(TAG, "General %d - Align&Cut", _roi);
 
 
-            caic->CutAndSave(GENERAL[_ana]->ROI[i]->pos_x, GENERAL[_ana]->ROI[i]->pos_y, GENERAL[_ana]->ROI[i]->delta_x, GENERAL[_ana]->ROI[i]->delta_y, GENERAL[_ana]->ROI[i]->image_org);
+            caic->CutAndSave(GENERAL[_number]->ROI[_roi]->pos_x, GENERAL[_number]->ROI[_roi]->pos_y, GENERAL[_number]->ROI[_roi]->delta_x, GENERAL[_number]->ROI[_roi]->delta_y, GENERAL[_number]->ROI[_roi]->image_org);
             if (Camera.SaveAllFiles)
             if (Camera.SaveAllFiles)
             {
             {
-                if (GENERAL[_ana]->name == "default")
+                if (GENERAL[_number]->name == "default")
                 {
                 {
-                    GENERAL[_ana]->ROI[i]->image_org->SaveToFile(format_filename("/sdcard/img_tmp/" + GENERAL[_ana]->ROI[i]->name + ".jpg"));
+                    GENERAL[_number]->ROI[_roi]->image_org->SaveToFile(format_filename("/sdcard/img_tmp/" + GENERAL[_number]->ROI[_roi]->name + ".jpg"));
                 }
                 }
                 else
                 else
                 {
                 {
-                    GENERAL[_ana]->ROI[i]->image_org->SaveToFile(format_filename("/sdcard/img_tmp/" + GENERAL[_ana]->name + "_" + GENERAL[_ana]->ROI[i]->name + ".jpg"));
+                    GENERAL[_number]->ROI[_roi]->image_org->SaveToFile(format_filename("/sdcard/img_tmp/" + GENERAL[_number]->name + "_" + GENERAL[_number]->ROI[_roi]->name + ".jpg"));
                 }
                 }
             }
             }
 
 
-            GENERAL[_ana]->ROI[i]->image_org->Resize(model_x_size, model_y_size, GENERAL[_ana]->ROI[i]->image);
+            GENERAL[_number]->ROI[_roi]->image_org->Resize(model_x_size, model_y_size, GENERAL[_number]->ROI[_roi]->image);
             if (Camera.SaveAllFiles)
             if (Camera.SaveAllFiles)
             {
             {
-                if (GENERAL[_ana]->name == "default")
+                if (GENERAL[_number]->name == "default")
                 {
                 {
-                    GENERAL[_ana]->ROI[i]->image->SaveToFile(format_filename("/sdcard/img_tmp/" + GENERAL[_ana]->ROI[i]->name + ".jpg"));
+                    GENERAL[_number]->ROI[_roi]->image->SaveToFile(format_filename("/sdcard/img_tmp/" + GENERAL[_number]->ROI[_roi]->name + ".jpg"));
                 }
                 }
                 else
                 else
                 {
                 {
-                    GENERAL[_ana]->ROI[i]->image->SaveToFile(format_filename("/sdcard/img_tmp/" + GENERAL[_ana]->name + "_" + GENERAL[_ana]->ROI[i]->name + ".jpg"));
+                    GENERAL[_number]->ROI[_roi]->image->SaveToFile(format_filename("/sdcard/img_tmp/" + GENERAL[_number]->name + "_" + GENERAL[_number]->ROI[_roi]->name + ".jpg"));
                 }
                 }
             }
             }
         }
         }
@@ -630,12 +630,12 @@ void ClassFlowCNNGeneral::DrawROI(CImageBasis *Image)
 
 
             for (int _ana = 0; _ana < GENERAL.size(); ++_ana)
             for (int _ana = 0; _ana < GENERAL.size(); ++_ana)
             {
             {
-                for (int i = 0; i < GENERAL[_ana]->ROI.size(); ++i)
+                for (int _roi = 0; _roi < GENERAL[_ana]->ROI.size(); ++_roi)
                 {
                 {
-                    Image->drawRect(GENERAL[_ana]->ROI[i]->pos_x, GENERAL[_ana]->ROI[i]->pos_y, GENERAL[_ana]->ROI[i]->delta_x, GENERAL[_ana]->ROI[i]->delta_y, r, g, b, 1);
-                    Image->drawEllipse((int)(GENERAL[_ana]->ROI[i]->pos_x + GENERAL[_ana]->ROI[i]->delta_x / 2), (int)(GENERAL[_ana]->ROI[i]->pos_y + GENERAL[_ana]->ROI[i]->delta_y / 2), (int)(GENERAL[_ana]->ROI[i]->delta_x / 2), (int)(GENERAL[_ana]->ROI[i]->delta_y / 2), r, g, b, 2);
-                    Image->drawLine((int)(GENERAL[_ana]->ROI[i]->pos_x + GENERAL[_ana]->ROI[i]->delta_x / 2), (int)GENERAL[_ana]->ROI[i]->pos_y, (int)(GENERAL[_ana]->ROI[i]->pos_x + GENERAL[_ana]->ROI[i]->delta_x / 2), (int)(GENERAL[_ana]->ROI[i]->pos_y + GENERAL[_ana]->ROI[i]->delta_y), r, g, b, 2);
-                    Image->drawLine((int)GENERAL[_ana]->ROI[i]->pos_x, (int)(GENERAL[_ana]->ROI[i]->pos_y + GENERAL[_ana]->ROI[i]->delta_y / 2), (int)GENERAL[_ana]->ROI[i]->pos_x + GENERAL[_ana]->ROI[i]->delta_x, (int)(GENERAL[_ana]->ROI[i]->pos_y + GENERAL[_ana]->ROI[i]->delta_y / 2), r, g, b, 2);
+                    Image->drawRect(GENERAL[_ana]->ROI[_roi]->pos_x, GENERAL[_ana]->ROI[_roi]->pos_y, GENERAL[_ana]->ROI[_roi]->delta_x, GENERAL[_ana]->ROI[_roi]->delta_y, r, g, b, 1);
+                    Image->drawEllipse((int)(GENERAL[_ana]->ROI[_roi]->pos_x + GENERAL[_ana]->ROI[_roi]->delta_x / 2), (int)(GENERAL[_ana]->ROI[_roi]->pos_y + GENERAL[_ana]->ROI[_roi]->delta_y / 2), (int)(GENERAL[_ana]->ROI[_roi]->delta_x / 2), (int)(GENERAL[_ana]->ROI[_roi]->delta_y / 2), r, g, b, 2);
+                    Image->drawLine((int)(GENERAL[_ana]->ROI[_roi]->pos_x + GENERAL[_ana]->ROI[_roi]->delta_x / 2), (int)GENERAL[_ana]->ROI[_roi]->pos_y, (int)(GENERAL[_ana]->ROI[_roi]->pos_x + GENERAL[_ana]->ROI[_roi]->delta_x / 2), (int)(GENERAL[_ana]->ROI[_roi]->pos_y + GENERAL[_ana]->ROI[_roi]->delta_y), r, g, b, 2);
+                    Image->drawLine((int)GENERAL[_ana]->ROI[_roi]->pos_x, (int)(GENERAL[_ana]->ROI[_roi]->pos_y + GENERAL[_ana]->ROI[_roi]->delta_y / 2), (int)GENERAL[_ana]->ROI[_roi]->pos_x + GENERAL[_ana]->ROI[_roi]->delta_x, (int)(GENERAL[_ana]->ROI[_roi]->pos_y + GENERAL[_ana]->ROI[_roi]->delta_y / 2), r, g, b, 2);
                 }
                 }
             }
             }
         }
         }
@@ -643,9 +643,9 @@ void ClassFlowCNNGeneral::DrawROI(CImageBasis *Image)
         {
         {
             for (int _dig = 0; _dig < GENERAL.size(); ++_dig)
             for (int _dig = 0; _dig < GENERAL.size(); ++_dig)
             {
             {
-                for (int i = 0; i < GENERAL[_dig]->ROI.size(); ++i)
+                for (int _roi = 0; _roi < GENERAL[_dig]->ROI.size(); ++_roi)
                 {
                 {
-                    Image->drawRect(GENERAL[_dig]->ROI[i]->pos_x, GENERAL[_dig]->ROI[i]->pos_y, GENERAL[_dig]->ROI[i]->delta_x, GENERAL[_dig]->ROI[i]->delta_y, 0, 0, (255 - _dig * 100), 2);
+                    Image->drawRect(GENERAL[_dig]->ROI[_roi]->pos_x, GENERAL[_dig]->ROI[_roi]->pos_y, GENERAL[_dig]->ROI[_roi]->delta_x, GENERAL[_dig]->ROI[_roi]->delta_y, 0, 0, (255 - _dig * 100), 2);
                 }
                 }
             }
             }
         }
         }
@@ -773,34 +773,34 @@ bool ClassFlowCNNGeneral::doNeuralNetwork(std::string time_value)
     LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "doNeuralNetwork, _imagetime: " + std::to_string(_imagetime));
     LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "doNeuralNetwork, _imagetime: " + std::to_string(_imagetime));
 
 
     // For each NUMBER
     // For each NUMBER
-    for (int j = 0; j < GENERAL.size(); ++j)
+    for (int _number = 0; _number < GENERAL.size(); ++_number)
     {
     {
-        LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "Processing Number '" + GENERAL[j]->name + "'");
+        LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "Processing Number '" + GENERAL[_number]->name + "'");
 
 
         int start_roi = 0;
         int start_roi = 0;
 
 
-        if ((numbers[j]->useMaxFlowRate) && (numbers[j]->PreValueOkay) && (numbers[j]->timeStampLastValue == numbers[j]->timeStampLastPreValue))
+        if ((numbers[_number]->useMaxFlowRate) && (numbers[_number]->PreValueValid) && (numbers[_number]->timeStampLastValue == numbers[_number]->timeStampLastPreValue))
         {
         {
-            int _AnzahlDigit = numbers[j]->AnzahlDigit;
+            int _AnzahlDigit = numbers[_number]->AnzahlDigit;
             LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "doNeuralNetwork, _AnzahlDigit: " + std::to_string(_AnzahlDigit));
             LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "doNeuralNetwork, _AnzahlDigit: " + std::to_string(_AnzahlDigit));
 
 
-            int _AnzahlAnalog = numbers[j]->AnzahlAnalog;
+            int _AnzahlAnalog = numbers[_number]->AnzahlAnalog;
             LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "doNeuralNetwork, _AnzahlAnalog: " + std::to_string(_AnzahlAnalog));
             LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "doNeuralNetwork, _AnzahlAnalog: " + std::to_string(_AnzahlAnalog));
 
 
-            float _MaxFlowRate = (numbers[j]->MaxFlowRate / 60); // in unit/minutes
+            float _MaxFlowRate = (numbers[_number]->MaxFlowRate / 60); // in unit/minutes
             LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "doNeuralNetwork, _MaxFlowRate: " + std::to_string(_MaxFlowRate));
             LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "doNeuralNetwork, _MaxFlowRate: " + std::to_string(_MaxFlowRate));
 
 
-            float _LastPreValueTimeDifference = (float)((difftime(_imagetime, numbers[j]->timeStampLastPreValue)) / 60); // in minutes
+            float _LastPreValueTimeDifference = (float)((difftime(_imagetime, numbers[_number]->timeStampLastPreValue)) / 60); // in minutes
             LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "doNeuralNetwork, _LastPreValueTimeDifference: " + std::to_string(_LastPreValueTimeDifference) + " minutes");
             LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "doNeuralNetwork, _LastPreValueTimeDifference: " + std::to_string(_LastPreValueTimeDifference) + " minutes");
 
 
-            std::string _PreValue_old = std::to_string((float)numbers[j]->PreValue);
+            std::string _PreValue_old = std::to_string((float)numbers[_number]->PreValue);
             LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "doNeuralNetwork, _PreValue_old: " + _PreValue_old);
             LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "doNeuralNetwork, _PreValue_old: " + _PreValue_old);
 
 
             ////////////////////////////////////////////////////
             ////////////////////////////////////////////////////
-            std::string _PreValue_new1 = std::to_string((float)numbers[j]->PreValue + (_MaxFlowRate * _LastPreValueTimeDifference));
+            std::string _PreValue_new1 = std::to_string((float)numbers[_number]->PreValue + (_MaxFlowRate * _LastPreValueTimeDifference));
             LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "doNeuralNetwork, _PreValue_new1: " + _PreValue_new1);
             LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "doNeuralNetwork, _PreValue_new1: " + _PreValue_new1);
 
 
-            std::string _PreValue_new2 = std::to_string((float)numbers[j]->PreValue - (_MaxFlowRate * _LastPreValueTimeDifference));
+            std::string _PreValue_new2 = std::to_string((float)numbers[_number]->PreValue - (_MaxFlowRate * _LastPreValueTimeDifference));
             LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "doNeuralNetwork, _PreValue_new2: " + _PreValue_new2);
             LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "doNeuralNetwork, _PreValue_new2: " + _PreValue_new2);
 
 
             ////////////////////////////////////////////////////
             ////////////////////////////////////////////////////
@@ -810,12 +810,12 @@ bool ClassFlowCNNGeneral::doNeuralNetwork(std::string time_value)
             if (_pospunkt > -1)
             if (_pospunkt > -1)
             {
             {
                 _CorrectionValue = _PreValue_old.length() - _pospunkt;
                 _CorrectionValue = _PreValue_old.length() - _pospunkt;
-                _CorrectionValue = _CorrectionValue - numbers[j]->Nachkomma;
+                _CorrectionValue = _CorrectionValue - numbers[_number]->Nachkomma;
             }
             }
             LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "doNeuralNetwork, _CorrectionValue: " + std::to_string(_CorrectionValue));
             LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "doNeuralNetwork, _CorrectionValue: " + std::to_string(_CorrectionValue));
 
 
             int _PreValue_len = ((int)_PreValue_old.length() - _CorrectionValue);
             int _PreValue_len = ((int)_PreValue_old.length() - _CorrectionValue);
-            if (numbers[j]->isExtendedResolution)
+            if (numbers[_number]->ExtendedResolution)
             {
             {
                 _PreValue_len = _PreValue_len - 1;
                 _PreValue_len = _PreValue_len - 1;
             }
             }
@@ -845,7 +845,7 @@ bool ClassFlowCNNGeneral::doNeuralNetwork(std::string time_value)
             ////////////////////////////////////////////////////
             ////////////////////////////////////////////////////
             // (-) Find out which Numbers should not change
             // (-) Find out which Numbers should not change
             int _NumbersNotChanged2 = _NumbersNotChanged1;
             int _NumbersNotChanged2 = _NumbersNotChanged1;
-            if (numbers[j]->AllowNegativeRates)
+            if (numbers[_number]->AllowNegativeRates)
             {
             {
                 int _DecimalPoint2 = 0;
                 int _DecimalPoint2 = 0;
                 while ((_PreValue_old.length() > _NumbersNotChanged2) && (_PreValue_old[_NumbersNotChanged2] == _PreValue_new2[_NumbersNotChanged2]))
                 while ((_PreValue_old.length() > _NumbersNotChanged2) && (_PreValue_old[_NumbersNotChanged2] == _PreValue_new2[_NumbersNotChanged2]))
@@ -898,9 +898,9 @@ bool ClassFlowCNNGeneral::doNeuralNetwork(std::string time_value)
         }
         }
 
 
         // For each ROI
         // For each ROI
-        for (int i = 0; i < GENERAL[j]->ROI.size(); ++i)
+        for (int _roi = 0; _roi < GENERAL[_number]->ROI.size(); ++_roi)
         {
         {
-            LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "ROI #" + std::to_string(i) + " - TfLite");
+            LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "ROI #" + std::to_string(_roi) + " - TfLite");
 
 
             switch (CNNType)
             switch (CNNType)
             {
             {
@@ -908,7 +908,7 @@ bool ClassFlowCNNGeneral::doNeuralNetwork(std::string time_value)
             {
             {
                 LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "CNN Type: Analogue");
                 LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "CNN Type: Analogue");
 
 
-                tflite->LoadInputImageBasis(GENERAL[j]->ROI[i]->image);
+                tflite->LoadInputImageBasis(GENERAL[_number]->ROI[_roi]->image);
 
 
                 tflite->Invoke();
                 tflite->Invoke();
                 LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "Analogue - After Invoke");
                 LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "Analogue - After Invoke");
@@ -916,45 +916,45 @@ bool ClassFlowCNNGeneral::doNeuralNetwork(std::string time_value)
                 float _value1 = tflite->GetOutputValue(0);
                 float _value1 = tflite->GetOutputValue(0);
                 float _value2 = tflite->GetOutputValue(1);
                 float _value2 = tflite->GetOutputValue(1);
 
 
-                float _result = fmod(atan2(_value1, _value2) / (M_PI * 2) + 2, 1);
+                float _result = fmod((atan2(_value1, _value2) / (M_PI * 2.0f) + 2.0f), 1.0f);
 
 
-                if (GENERAL[j]->ROI[i]->ccw)
+                if (GENERAL[_number]->ROI[_roi]->ccw)
                 {
                 {
-                    _result = 10 - (_result * 10);
+                    _result = 10.0f - (_result * 10.0f);
                 }
                 }
                 else
                 else
                 {
                 {
-                    _result = _result * 10;
+                    _result = _result * 10.0f;
                 }
                 }
 
 
-                if (i >= start_roi)
+                if (_roi >= start_roi)
                 {
                 {
-                    GENERAL[j]->ROI[i]->result_float = _result;
+                    GENERAL[_number]->ROI[_roi]->result_float = _result;
                 }
                 }
 
 
-                GENERAL[j]->ROI[i]->raw_result_float = _result;
+                GENERAL[_number]->ROI[_roi]->raw_result_float = _result;
 
 
                 if ((_result < 0.0f) || (_result >= 10.0f))
                 if ((_result < 0.0f) || (_result >= 10.0f))
                 {
                 {
-                    GENERAL[j]->ROI[i]->isReject = true;
+                    GENERAL[_number]->ROI[_roi]->isReject = true;
                 }
                 }
                 else
                 else
                 {
                 {
-                    GENERAL[j]->ROI[i]->isReject = false;
+                    GENERAL[_number]->ROI[_roi]->isReject = false;
                 }
                 }
 
 
-                LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "General result (Analog) - roi_" + std::to_string(i) + ": " + std::to_string(GENERAL[j]->ROI[i]->raw_result_float));
-                ESP_LOGD(TAG, "General result (Analog) - roi_%i - ccw: %d -  %f", i, GENERAL[j]->ROI[i]->ccw, GENERAL[j]->ROI[i]->raw_result_float);
+                LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "General result (Analog) - roi_" + std::to_string(_roi) + ": " + std::to_string(GENERAL[_number]->ROI[_roi]->raw_result_float));
+                ESP_LOGD(TAG, "General result (Analog) - roi_%i - ccw: %d -  %f", _roi, GENERAL[_number]->ROI[_roi]->ccw, GENERAL[_number]->ROI[_roi]->raw_result_float);
 
 
                 if (isLogImage)
                 if (isLogImage)
                 {
                 {
-                    std::string _image_name = GENERAL[j]->name + "_" + GENERAL[j]->ROI[i]->name;
+                    std::string _image_name = GENERAL[_number]->name + "_" + GENERAL[_number]->ROI[_roi]->name;
 
 
                     if (isLogImageSelect)
                     if (isLogImageSelect)
                     {
                     {
-                        if (LogImageSelect.find(GENERAL[j]->ROI[i]->name) != std::string::npos)
+                        if (LogImageSelect.find(GENERAL[_number]->ROI[_roi]->name) != std::string::npos)
                         {
                         {
-                            LogImage(logPath, _image_name, &GENERAL[j]->ROI[i]->raw_result_float, NULL, time_value, GENERAL[j]->ROI[i]->image_org);
+                            LogImage(logPath, _image_name, &GENERAL[_number]->ROI[_roi]->raw_result_float, NULL, time_value, GENERAL[_number]->ROI[_roi]->image_org);
                         }
                         }
                     }
                     }
                 }
                 }
@@ -965,36 +965,36 @@ bool ClassFlowCNNGeneral::doNeuralNetwork(std::string time_value)
             {
             {
                 LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "CNN Type: Digit");
                 LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "CNN Type: Digit");
 
 
-                int _result = tflite->GetClassFromImageBasis(GENERAL[j]->ROI[i]->image);
+                int _result = tflite->GetClassFromImageBasis(GENERAL[_number]->ROI[_roi]->image);
 
 
-                if (i >= start_roi)
+                if (_roi >= start_roi)
                 {
                 {
-                    GENERAL[j]->ROI[i]->result_klasse = _result;
+                    GENERAL[_number]->ROI[_roi]->result_klasse = _result;
                 }
                 }
 
 
-                GENERAL[j]->ROI[i]->raw_result_klasse = _result;
+                GENERAL[_number]->ROI[_roi]->raw_result_klasse = _result;
 
 
                 if ((_result < 0) || (_result >= 10))
                 if ((_result < 0) || (_result >= 10))
                 {
                 {
-                    GENERAL[j]->ROI[i]->isReject = true;
+                    GENERAL[_number]->ROI[_roi]->isReject = true;
                 }
                 }
                 else
                 else
                 {
                 {
-                    GENERAL[j]->ROI[i]->isReject = false;
+                    GENERAL[_number]->ROI[_roi]->isReject = false;
                 }
                 }
 
 
-                LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "General result (Digit) - roi_" + std::to_string(i) + ": " + std::to_string(GENERAL[j]->ROI[i]->raw_result_klasse));
-                ESP_LOGD(TAG, "General result (Digit) - roi_%i: %d", i, GENERAL[j]->ROI[i]->raw_result_klasse);
+                LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "General result (Digit) - roi_" + std::to_string(_roi) + ": " + std::to_string(GENERAL[_number]->ROI[_roi]->raw_result_klasse));
+                ESP_LOGD(TAG, "General result (Digit) - roi_%i: %d", _roi, GENERAL[_number]->ROI[_roi]->raw_result_klasse);
 
 
                 if (isLogImage)
                 if (isLogImage)
                 {
                 {
-                    std::string _image_name = GENERAL[j]->name + "_" + GENERAL[j]->ROI[i]->name;
+                    std::string _image_name = GENERAL[_number]->name + "_" + GENERAL[_number]->ROI[_roi]->name;
 
 
                     if (isLogImageSelect)
                     if (isLogImageSelect)
                     {
                     {
-                        if (LogImageSelect.find(GENERAL[j]->ROI[i]->name) != std::string::npos)
+                        if (LogImageSelect.find(GENERAL[_number]->ROI[_roi]->name) != std::string::npos)
                         {
                         {
-                            LogImage(logPath, _image_name, NULL, &GENERAL[j]->ROI[i]->raw_result_klasse, time_value, GENERAL[j]->ROI[i]->image_org);
+                            LogImage(logPath, _image_name, NULL, &GENERAL[_number]->ROI[_roi]->raw_result_klasse, time_value, GENERAL[_number]->ROI[_roi]->image_org);
                         }
                         }
                     }
                     }
                 }
                 }
@@ -1005,7 +1005,7 @@ bool ClassFlowCNNGeneral::doNeuralNetwork(std::string time_value)
             {
             {
                 LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "CNN Type: DoubleHyprid10");
                 LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "CNN Type: DoubleHyprid10");
 
 
-                tflite->LoadInputImageBasis(GENERAL[j]->ROI[i]->image);
+                tflite->LoadInputImageBasis(GENERAL[_number]->ROI[_roi]->image);
 
 
                 tflite->Invoke();
                 tflite->Invoke();
                 LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "DoubleHyprid10 - After Invoke");
                 LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "DoubleHyprid10 - After Invoke");
@@ -1040,39 +1040,39 @@ bool ClassFlowCNNGeneral::doNeuralNetwork(std::string time_value)
 
 
                 if (_fit < CNNGoodThreshold)
                 if (_fit < CNNGoodThreshold)
                 {
                 {
-                    GENERAL[j]->ROI[i]->isReject = true;
+                    GENERAL[_number]->ROI[_roi]->isReject = true;
                     _result = -1;
                     _result = -1;
                     temp_bufer = "DoubleHyprid10 - Value Rejected due to Threshold (Fit: " + std::to_string(_fit) + ", Threshold: " + std::to_string(CNNGoodThreshold) + ")";
                     temp_bufer = "DoubleHyprid10 - Value Rejected due to Threshold (Fit: " + std::to_string(_fit) + ", Threshold: " + std::to_string(CNNGoodThreshold) + ")";
                     LogFile.WriteToFile(ESP_LOG_WARN, TAG, temp_bufer);
                     LogFile.WriteToFile(ESP_LOG_WARN, TAG, temp_bufer);
                 }
                 }
                 else
                 else
                 {
                 {
-                    GENERAL[j]->ROI[i]->isReject = false;
+                    GENERAL[_number]->ROI[_roi]->isReject = false;
                 }
                 }
 
 
-                if (GENERAL[j]->ROI[i]->ccw)
+                if (GENERAL[_number]->ROI[_roi]->ccw)
                 {
                 {
                 }
                 }
 
 
-                if (i >= start_roi)
+                if (_roi >= start_roi)
                 {
                 {
-                    GENERAL[j]->ROI[i]->result_float = _result;
+                    GENERAL[_number]->ROI[_roi]->result_float = _result;
                 }
                 }
 
 
-                GENERAL[j]->ROI[i]->raw_result_float = _result;
+                GENERAL[_number]->ROI[_roi]->raw_result_float = _result;
 
 
-                LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "Result General(DoubleHyprid10) - roi_" + std::to_string(i) + ": " + std::to_string(GENERAL[j]->ROI[i]->raw_result_float));
-                ESP_LOGD(TAG, "Result General(DoubleHyprid10) - roi_%i: %f", i, GENERAL[j]->ROI[i]->raw_result_float);
+                LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "Result General(DoubleHyprid10) - roi_" + std::to_string(_roi) + ": " + std::to_string(GENERAL[_number]->ROI[_roi]->raw_result_float));
+                ESP_LOGD(TAG, "Result General(DoubleHyprid10) - roi_%i: %f", _roi, GENERAL[_number]->ROI[_roi]->raw_result_float);
 
 
                 if (isLogImage)
                 if (isLogImage)
                 {
                 {
-                    std::string _image_name = GENERAL[j]->name + "_" + GENERAL[j]->ROI[i]->name;
+                    std::string _image_name = GENERAL[_number]->name + "_" + GENERAL[_number]->ROI[_roi]->name;
 
 
                     if (isLogImageSelect)
                     if (isLogImageSelect)
                     {
                     {
-                        if (LogImageSelect.find(GENERAL[j]->ROI[i]->name) != std::string::npos)
+                        if (LogImageSelect.find(GENERAL[_number]->ROI[_roi]->name) != std::string::npos)
                         {
                         {
-                            LogImage(logPath, _image_name, &_result_save_file, NULL, time_value, GENERAL[j]->ROI[i]->image_org);
+                            LogImage(logPath, _image_name, &_result_save_file, NULL, time_value, GENERAL[_number]->ROI[_roi]->image_org);
                         }
                         }
                     }
                     }
                 }
                 }
@@ -1084,49 +1084,49 @@ bool ClassFlowCNNGeneral::doNeuralNetwork(std::string time_value)
             {
             {
                 LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "CNN Type: Digit100 or Analogue100");
                 LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "CNN Type: Digit100 or Analogue100");
 
 
-                tflite->LoadInputImageBasis(GENERAL[j]->ROI[i]->image);
+                tflite->LoadInputImageBasis(GENERAL[_number]->ROI[_roi]->image);
                 tflite->Invoke();
                 tflite->Invoke();
 
 
                 int _num = tflite->GetOutClassification();
                 int _num = tflite->GetOutClassification();
                 float _result = 0.0f;
                 float _result = 0.0f;
 
 
-                if (GENERAL[j]->ROI[i]->ccw)
+                if (GENERAL[_number]->ROI[_roi]->ccw)
                 {
                 {
-                    _result = 10 - ((float)_num / 10.0);
+                    _result = 10.0f - ((float)_num / 10.0f);
                 }
                 }
                 else
                 else
                 {
                 {
-                    _result = (float)_num / 10.0;
+                    _result = (float)_num / 10.0f;
                 }
                 }
 
 
-                if (i >= start_roi)
+                if (_roi >= start_roi)
                 {
                 {
-                    GENERAL[j]->ROI[i]->result_float = _result;
+                    GENERAL[_number]->ROI[_roi]->result_float = _result;
                 }
                 }
 
 
-                GENERAL[j]->ROI[i]->raw_result_float = _result;
+                GENERAL[_number]->ROI[_roi]->raw_result_float = _result;
 
 
                 if ((_result < 0.0f) || (_result >= 10.0f))
                 if ((_result < 0.0f) || (_result >= 10.0f))
                 {
                 {
-                    GENERAL[j]->ROI[i]->isReject = true;
+                    GENERAL[_number]->ROI[_roi]->isReject = true;
                 }
                 }
                 else
                 else
                 {
                 {
-                    GENERAL[j]->ROI[i]->isReject = false;
+                    GENERAL[_number]->ROI[_roi]->isReject = false;
                 }
                 }
 
 
-                LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "Result General(Digit100 or Analogue100) - roi_" + std::to_string(i) + ": " + std::to_string(GENERAL[j]->ROI[i]->raw_result_float));
-                ESP_LOGD(TAG, "Result General(Digit100 or Analogue100) - roi_%i - ccw: %d - %f", i, GENERAL[j]->ROI[i]->ccw, GENERAL[j]->ROI[i]->raw_result_float);
+                LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "Result General(Digit100 or Analogue100) - roi_" + std::to_string(_roi) + ": " + std::to_string(GENERAL[_number]->ROI[_roi]->raw_result_float));
+                ESP_LOGD(TAG, "Result General(Digit100 or Analogue100) - roi_%i - ccw: %d - %f", _roi, GENERAL[_number]->ROI[_roi]->ccw, GENERAL[_number]->ROI[_roi]->raw_result_float);
 
 
                 if (isLogImage)
                 if (isLogImage)
                 {
                 {
-                    std::string _image_name = GENERAL[j]->name + "_" + GENERAL[j]->ROI[i]->name;
+                    std::string _image_name = GENERAL[_number]->name + "_" + GENERAL[_number]->ROI[_roi]->name;
 
 
                     if (isLogImageSelect)
                     if (isLogImageSelect)
                     {
                     {
-                        if (LogImageSelect.find(GENERAL[j]->ROI[i]->name) != std::string::npos)
+                        if (LogImageSelect.find(GENERAL[_number]->ROI[_roi]->name) != std::string::npos)
                         {
                         {
-                            LogImage(logPath, _image_name, &GENERAL[j]->ROI[i]->raw_result_float, NULL, time_value, GENERAL[j]->ROI[i]->image_org);
+                            LogImage(logPath, _image_name, &GENERAL[_number]->ROI[_roi]->raw_result_float, NULL, time_value, GENERAL[_number]->ROI[_roi]->image_org);
                         }
                         }
                     }
                     }
                 }
                 }
@@ -1160,46 +1160,46 @@ std::vector<HTMLInfo *> ClassFlowCNNGeneral::GetHTMLInfo(void)
 {
 {
     std::vector<HTMLInfo *> result;
     std::vector<HTMLInfo *> result;
 
 
-    for (int _ana = 0; _ana < GENERAL.size(); ++_ana)
+    for (int _number = 0; _number < GENERAL.size(); ++_number)
     {
     {
-        for (int i = 0; i < GENERAL[_ana]->ROI.size(); ++i)
+        for (int _roi = 0; _roi < GENERAL[_number]->ROI.size(); ++_roi)
         {
         {
-            ESP_LOGD(TAG, "Image: %d", (int)GENERAL[_ana]->ROI[i]->image);
-            if (GENERAL[_ana]->ROI[i]->image)
+            ESP_LOGD(TAG, "Image: %d", (int)GENERAL[_number]->ROI[_roi]->image);
+            if (GENERAL[_number]->ROI[_roi]->image)
             {
             {
-                if (GENERAL[_ana]->name == "default")
+                if (GENERAL[_number]->name == "default")
                 {
                 {
-                    GENERAL[_ana]->ROI[i]->image->SaveToFile(format_filename("/sdcard/img_tmp/" + GENERAL[_ana]->ROI[i]->name + ".jpg"));
+                    GENERAL[_number]->ROI[_roi]->image->SaveToFile(format_filename("/sdcard/img_tmp/" + GENERAL[_number]->ROI[_roi]->name + ".jpg"));
                 }
                 }
                 else
                 else
                 {
                 {
-                    GENERAL[_ana]->ROI[i]->image->SaveToFile(format_filename("/sdcard/img_tmp/" + GENERAL[_ana]->name + "_" + GENERAL[_ana]->ROI[i]->name + ".jpg"));
+                    GENERAL[_number]->ROI[_roi]->image->SaveToFile(format_filename("/sdcard/img_tmp/" + GENERAL[_number]->name + "_" + GENERAL[_number]->ROI[_roi]->name + ".jpg"));
                 }
                 }
             }
             }
 
 
             HTMLInfo *temp_info = new HTMLInfo;
             HTMLInfo *temp_info = new HTMLInfo;
-            if (GENERAL[_ana]->name == "default")
+            if (GENERAL[_number]->name == "default")
             {
             {
-                temp_info->filename = GENERAL[_ana]->ROI[i]->name + ".jpg";
-                temp_info->filename_org = GENERAL[_ana]->ROI[i]->name + ".jpg";
+                temp_info->filename = GENERAL[_number]->ROI[_roi]->name + ".jpg";
+                temp_info->filename_org = GENERAL[_number]->ROI[_roi]->name + ".jpg";
             }
             }
             else
             else
             {
             {
-                temp_info->filename = GENERAL[_ana]->name + "_" + GENERAL[_ana]->ROI[i]->name + ".jpg";
-                temp_info->filename_org = GENERAL[_ana]->name + "_" + GENERAL[_ana]->ROI[i]->name + ".jpg";
+                temp_info->filename = GENERAL[_number]->name + "_" + GENERAL[_number]->ROI[_roi]->name + ".jpg";
+                temp_info->filename_org = GENERAL[_number]->name + "_" + GENERAL[_number]->ROI[_roi]->name + ".jpg";
             }
             }
 
 
             if (CNNType == Digit)
             if (CNNType == Digit)
             {
             {
-                temp_info->val = (float)GENERAL[_ana]->ROI[i]->raw_result_klasse;
+                temp_info->val = (float)GENERAL[_number]->ROI[_roi]->raw_result_klasse;
             }
             }
             else
             else
             {
             {
-                temp_info->val = GENERAL[_ana]->ROI[i]->raw_result_float;
+                temp_info->val = GENERAL[_number]->ROI[_roi]->raw_result_float;
             }
             }
 
 
-            temp_info->image = GENERAL[_ana]->ROI[i]->image;
-            temp_info->image_org = GENERAL[_ana]->ROI[i]->image_org;
+            temp_info->image = GENERAL[_number]->ROI[_roi]->image;
+            temp_info->image_org = GENERAL[_number]->ROI[_roi]->image_org;
 
 
             result.push_back(temp_info);
             result.push_back(temp_info);
         }
         }
@@ -1235,14 +1235,14 @@ general *ClassFlowCNNGeneral::GetGENERAL(int _number)
 
 
 void ClassFlowCNNGeneral::UpdateNameNumbers(std::vector<std::string> *_name_numbers)
 void ClassFlowCNNGeneral::UpdateNameNumbers(std::vector<std::string> *_name_numbers)
 {
 {
-    for (int _dig = 0; _dig < GENERAL.size(); _dig++)
+    for (int _number = 0; _number < GENERAL.size(); ++_number)
     {
     {
-        std::string _name = GENERAL[_dig]->name;
+        std::string _name = GENERAL[_number]->name;
         bool found = false;
         bool found = false;
 
 
-        for (int i = 0; i < (*_name_numbers).size(); ++i)
+        for (int _roi = 0; _roi < (*_name_numbers).size(); ++_roi)
         {
         {
-            if ((*_name_numbers)[i] == _name)
+            if ((*_name_numbers)[_roi] == _name)
             {
             {
                 found = true;
                 found = true;
             }
             }
@@ -1263,41 +1263,41 @@ std::string ClassFlowCNNGeneral::getReadoutRawString(int _number)
         return temp_string;
         return temp_string;
     }
     }
 
 
-    for (int i = 0; i < GENERAL[_number]->ROI.size(); ++i)
+    for (int _roi = 0; _roi < GENERAL[_number]->ROI.size(); ++_roi)
     {
     {
         if (CNNType == Analogue || CNNType == Analogue100)
         if (CNNType == Analogue || CNNType == Analogue100)
         {
         {
-            if ((GENERAL[_number]->ROI[i]->raw_result_float < 0.0f) || (GENERAL[_number]->ROI[i]->raw_result_float >= 10.0f))
+            if ((GENERAL[_number]->ROI[_roi]->raw_result_float < 0.0f) || (GENERAL[_number]->ROI[_roi]->raw_result_float >= 10.0f))
             {
             {
                 temp_string = temp_string + ",N";
                 temp_string = temp_string + ",N";
             }
             }
             else
             else
             {
             {
-                temp_string = temp_string + "," + round_output(GENERAL[_number]->ROI[i]->raw_result_float, 1);
+                temp_string = temp_string + "," + round_output(GENERAL[_number]->ROI[_roi]->raw_result_float, 1);
             }
             }
         }
         }
 
 
         else if (CNNType == Digit)
         else if (CNNType == Digit)
         {
         {
-            if ((GENERAL[_number]->ROI[i]->raw_result_klasse < 0) || (GENERAL[_number]->ROI[i]->raw_result_klasse >= 10))
+            if ((GENERAL[_number]->ROI[_roi]->raw_result_klasse < 0) || (GENERAL[_number]->ROI[_roi]->raw_result_klasse >= 10))
             {
             {
                 temp_string = temp_string + ",N";
                 temp_string = temp_string + ",N";
             }
             }
             else
             else
             {
             {
-                temp_string = temp_string + "," + round_output(GENERAL[_number]->ROI[i]->raw_result_klasse, 0);
+                temp_string = temp_string + "," + round_output(GENERAL[_number]->ROI[_roi]->raw_result_klasse, 0);
             }
             }
         }
         }
 
 
         else if ((CNNType == DoubleHyprid10) || (CNNType == Digit100))
         else if ((CNNType == DoubleHyprid10) || (CNNType == Digit100))
         {
         {
-            if ((GENERAL[_number]->ROI[i]->raw_result_float < 0.0f) || (GENERAL[_number]->ROI[i]->raw_result_float >= 10.0f))
+            if ((GENERAL[_number]->ROI[_roi]->raw_result_float < 0.0f) || (GENERAL[_number]->ROI[_roi]->raw_result_float >= 10.0f))
             {
             {
                 temp_string = temp_string + ",N";
                 temp_string = temp_string + ",N";
             }
             }
             else
             else
             {
             {
-                temp_string = temp_string + "," + round_output(GENERAL[_number]->ROI[i]->raw_result_float, 1);
+                temp_string = temp_string + "," + round_output(GENERAL[_number]->ROI[_roi]->raw_result_float, 1);
             }
             }
         }
         }
     }
     }

+ 4 - 4
code/components/jomjol_flowcontroll/ClassFlowControll.cpp

@@ -312,11 +312,11 @@ void ClassFlowControll::InitFlow(std::string config)
     flowpostprocessing = NULL;
     flowpostprocessing = NULL;
 
 
     ClassFlow *cfc;
     ClassFlow *cfc;
+
     config = format_filename(config);
     config = format_filename(config);
     FILE *pFile = fopen(config.c_str(), "r");
     FILE *pFile = fopen(config.c_str(), "r");
 
 
     std::string line = "";
     std::string line = "";
-
     char temp_char[1024];
     char temp_char[1024];
 
 
     if (pFile != NULL)
     if (pFile != NULL)
@@ -454,7 +454,7 @@ std::string ClassFlowControll::getReadoutAll(int _type)
             case READOUT_TYPE_PREVALUE:
             case READOUT_TYPE_PREVALUE:
                 if (flowpostprocessing->PreValueUse)
                 if (flowpostprocessing->PreValueUse)
                 {
                 {
-                    if ((*numbers)[i]->PreValueOkay)
+                    if ((*numbers)[i]->PreValueValid)
                     {
                     {
                         out = out + (*numbers)[i]->ReturnPreValue;
                         out = out + (*numbers)[i]->ReturnPreValue;
                     }
                     }
@@ -632,7 +632,7 @@ bool ClassFlowControll::ReadParameter(FILE *pFile, std::string &aktparamgraph)
                 int RSSIThresholdTMP = atoi(splitted[1].c_str());
                 int RSSIThresholdTMP = atoi(splitted[1].c_str());
                 RSSIThresholdTMP = min(0, max(-100, RSSIThresholdTMP)); // Verify input limits (-100 - 0)
                 RSSIThresholdTMP = min(0, max(-100, RSSIThresholdTMP)); // Verify input limits (-100 - 0)
 
 
-                if (ChangeRSSIThreshold(NETWORK_CONFIG_FILE, RSSIThresholdTMP))
+                if ((ChangeRSSIThreshold(WLAN_CONFIG_FILE, RSSIThresholdTMP)) || (ChangeRSSIThreshold(NETWORK_CONFIG_FILE, RSSIThresholdTMP)))
                 {
                 {
                     // reboot necessary so that the new wlan.ini is also used !!!
                     // reboot necessary so that the new wlan.ini is also used !!!
                     fclose(pFile);
                     fclose(pFile);
@@ -643,7 +643,7 @@ bool ClassFlowControll::ReadParameter(FILE *pFile, std::string &aktparamgraph)
 #endif
 #endif
             else if (_param == "HOSTNAME")
             else if (_param == "HOSTNAME")
             {
             {
-                if (ChangeHostName(NETWORK_CONFIG_FILE, splitted[1]))
+                if ((ChangeHostName(WLAN_CONFIG_FILE, splitted[1])) || (ChangeHostName(NETWORK_CONFIG_FILE, splitted[1])))
                 {
                 {
                     // reboot necessary so that the new wlan.ini is also used !!!
                     // reboot necessary so that the new wlan.ini is also used !!!
                     fclose(pFile);
                     fclose(pFile);

+ 4 - 3
code/components/jomjol_flowcontroll/ClassFlowDefineTypes.h

@@ -41,9 +41,8 @@ struct NumberPost
     float MaxRateValue;                 // maxRate; upper bound for the difference between two consecutive readings; affected by maxRateType;
     float MaxRateValue;                 // maxRate; upper bound for the difference between two consecutive readings; affected by maxRateType;
     bool useMaxRateValue;               // consistencyChecksEnabled; enables consistency checks; uses maxRate and maxRateType
     bool useMaxRateValue;               // consistencyChecksEnabled; enables consistency checks; uses maxRate and maxRateType
     t_RateType MaxRateType;             // maxRateType; affects how the value of maxRate is used for comparing the current and previous value
     t_RateType MaxRateType;             // maxRateType; affects how the value of maxRate is used for comparing the current and previous value
-    bool ErrorMessage;                  // FIXME: not used; can be removed
     int ChangeRateThreshold;            // threshold parameter for negative rate detection
     int ChangeRateThreshold;            // threshold parameter for negative rate detection
-    bool PreValueOkay;                  // previousValueValid; indicates that the reading of the previous round has no errors
+    bool PreValueValid;                 // previousValueValid; indicates that the reading of the previous round has no errors
     bool AllowNegativeRates;            // allowNegativeRate; defines if the consistency checks allow negative rates between consecutive meter readings.
     bool AllowNegativeRates;            // allowNegativeRate; defines if the consistency checks allow negative rates between consecutive meter readings.
     bool IgnoreLeadingNaN;              //
     bool IgnoreLeadingNaN;              //
     time_t timeStampLastValue;          // Timestamp for the last read value; is used for the log
     time_t timeStampLastValue;          // Timestamp for the last read value; is used for the log
@@ -58,7 +57,9 @@ struct NumberPost
     string ReturnRawValue;              // rawValueStr; Raw value (with N & leading 0)
     string ReturnRawValue;              // rawValueStr; Raw value (with N & leading 0)
     string ReturnValue;                 // valueStr; corrected return value, if necessary with error message
     string ReturnValue;                 // valueStr; corrected return value, if necessary with error message
     string ReturnPreValue;              // lastValidValueStr; corrected return value without error message
     string ReturnPreValue;              // lastValidValueStr; corrected return value without error message
+    bool ErrorMessage;                  //
     string ErrorMessageText;            // errorMessage; Error message for consistency checks
     string ErrorMessageText;            // errorMessage; Error message for consistency checks
+    bool SkipErrorMessage;
     int AnzahlAnalog;                   // numAnalogRoi; number of analog ROIs used in this sequence
     int AnzahlAnalog;                   // numAnalogRoi; number of analog ROIs used in this sequence
     int AnzahlDigit;                    // numDigitRoi; number of digit ROIs used in this sequence
     int AnzahlDigit;                    // numDigitRoi; number of digit ROIs used in this sequence
     int DecimalShift;                   // decimalShift; each increment shifts the decimal separator by one digit; value=value*10^decimalShift; pos. value shifts to the right
     int DecimalShift;                   // decimalShift; each increment shifts the decimal separator by one digit; value=value*10^decimalShift; pos. value shifts to the right
@@ -74,7 +75,7 @@ struct NumberPost
     string FieldV2;       // influxdbFieldName_v2; Name of the Field in InfluxDBv2
     string FieldV2;       // influxdbFieldName_v2; Name of the Field in InfluxDBv2
     string MeasurementV2; // influxdbMeasurementName_v2; Name of the Measurement in InfluxDBv2
     string MeasurementV2; // influxdbMeasurementName_v2; Name of the Measurement in InfluxDBv2
 
 
-    bool isExtendedResolution; // extendResolution; Adds the decimal place of the least significant analog ROI to the value
+    bool ExtendedResolution; // extendResolution; Adds the decimal place of the least significant analog ROI to the value
 
 
     general *digit_roi;  // digitRoi; set of digit ROIs for the sequence
     general *digit_roi;  // digitRoi; set of digit ROIs for the sequence
     general *analog_roi; // analogRoi; set of analog ROIs for the sequence
     general *analog_roi; // analogRoi; set of analog ROIs for the sequence

+ 34 - 21
code/components/jomjol_flowcontroll/ClassFlowImage.cpp

@@ -13,36 +13,39 @@
 
 
 static const char *TAG = "FLOWIMAGE";
 static const char *TAG = "FLOWIMAGE";
 
 
-ClassFlowImage::ClassFlowImage(const char *logTag)
+ClassFlowImage::ClassFlowImage(const char *_logTag)
 {
 {
-    this->logTag = logTag;
+    logTag = _logTag;
     isLogImage = false;
     isLogImage = false;
     disabled = false;
     disabled = false;
-    this->imagesRetention = 5;
+    imagesRetention = 5;
 }
 }
 
 
-ClassFlowImage::ClassFlowImage(std::vector<ClassFlow *> *lfc, const char *logTag) : ClassFlow(lfc)
+ClassFlowImage::ClassFlowImage(std::vector<ClassFlow *> *_lfc, const char *_logTag) : ClassFlow(_lfc)
 {
 {
-    this->logTag = logTag;
+    logTag = _logTag;
     isLogImage = false;
     isLogImage = false;
     disabled = false;
     disabled = false;
-    this->imagesRetention = 5;
+    imagesRetention = 5;
 }
 }
 
 
-ClassFlowImage::ClassFlowImage(std::vector<ClassFlow *> *lfc, ClassFlow *_prev, const char *logTag) : ClassFlow(lfc, _prev)
+ClassFlowImage::ClassFlowImage(std::vector<ClassFlow *> *_lfc, ClassFlow *_prev, const char *_logTag) : ClassFlow(_lfc, _prev)
 {
 {
-    this->logTag = logTag;
+    logTag = _logTag;
     isLogImage = false;
     isLogImage = false;
     disabled = false;
     disabled = false;
-    this->imagesRetention = 5;
+    imagesRetention = 5;
 }
 }
 
 
-string ClassFlowImage::CreateLogFolder(string time)
+string ClassFlowImage::CreateLogFolder(string _time)
 {
 {
     if (!isLogImage)
     if (!isLogImage)
+    {
         return "";
         return "";
+    }
+
+    string logPath = imagesLocation + "/" + _time.LOGFILE_TIME_FORMAT_DATE_EXTR + "/" + _time.LOGFILE_TIME_FORMAT_HOUR_EXTR;
 
 
-    string logPath = imagesLocation + "/" + time.LOGFILE_TIME_FORMAT_DATE_EXTR + "/" + time.LOGFILE_TIME_FORMAT_HOUR_EXTR;
     isLogImage = mkdir_r(logPath.c_str(), S_IRWXU) == 0;
     isLogImage = mkdir_r(logPath.c_str(), S_IRWXU) == 0;
     if (!isLogImage)
     if (!isLogImage)
     {
     {
@@ -52,42 +55,50 @@ string ClassFlowImage::CreateLogFolder(string time)
     return logPath;
     return logPath;
 }
 }
 
 
-void ClassFlowImage::LogImage(string logPath, string name, float *resultFloat, int *resultInt, string time, CImageBasis *_img)
+void ClassFlowImage::LogImage(string _logPath, string _name, float *_resultFloat, int *_resultInt, string _time, CImageBasis *_img)
 {
 {
     if (!isLogImage)
     if (!isLogImage)
+    {
         return;
         return;
+    }
 
 
     char buf[10];
     char buf[10];
 
 
-    if (resultFloat != NULL)
+    if (_resultFloat != NULL)
     {
     {
-        if (*resultFloat < 0)
+        if (*_resultFloat < 0)
+        {
             sprintf(buf, "N.N_");
             sprintf(buf, "N.N_");
+        }
         else
         else
         {
         {
-            sprintf(buf, "%.1f_", *resultFloat);
+            sprintf(buf, "%.1f_", *_resultFloat);
             if (strcmp(buf, "10.0_") == 0)
             if (strcmp(buf, "10.0_") == 0)
-                sprintf(buf, "0.0_");
+            {
+                sprintf(buf, "N.N_");
+            }
         }
         }
     }
     }
-    else if (resultInt != NULL)
+    else if (_resultInt != NULL)
     {
     {
-        sprintf(buf, "%d_", *resultInt);
+        sprintf(buf, "%d_", *_resultInt);
     }
     }
     else
     else
     {
     {
         buf[0] = '\0';
         buf[0] = '\0';
     }
     }
 
 
-    string nm = logPath + "/" + buf + name + "_" + time + ".jpg";
+    string nm = _logPath + "/" + buf + _name + "_" + _time + ".jpg";
     nm = format_filename(nm);
     nm = format_filename(nm);
-    string output = "/sdcard/img_tmp/" + name + ".jpg";
+
+    string output = "/sdcard/img_tmp/" + _name + ".jpg";
     output = format_filename(output);
     output = format_filename(output);
+
     ESP_LOGD(logTag, "save to file: %s", nm.c_str());
     ESP_LOGD(logTag, "save to file: %s", nm.c_str());
     _img->SaveToFile(nm);
     _img->SaveToFile(nm);
 }
 }
 
 
-void ClassFlowImage::RemoveOldLogs()
+void ClassFlowImage::RemoveOldLogs(void)
 {
 {
     if (!isLogImage)
     if (!isLogImage)
     {
     {
@@ -121,6 +132,7 @@ void ClassFlowImage::RemoveOldLogs()
     struct dirent *entry;
     struct dirent *entry;
     int deleted = 0;
     int deleted = 0;
     int notDeleted = 0;
     int notDeleted = 0;
+
     while ((entry = readdir(dir)) != NULL)
     while ((entry = readdir(dir)) != NULL)
     {
     {
         string folderPath = imagesLocation + "/" + entry->d_name;
         string folderPath = imagesLocation + "/" + entry->d_name;
@@ -137,6 +149,7 @@ void ClassFlowImage::RemoveOldLogs()
             }
             }
         }
         }
     }
     }
+
     ESP_LOGD(TAG, "Image folder deleted: %d | Image folder not deleted: %d", deleted, notDeleted);
     ESP_LOGD(TAG, "Image folder deleted: %d | Image folder not deleted: %d", deleted, notDeleted);
     closedir(dir);
     closedir(dir);
 }
 }

+ 6 - 6
code/components/jomjol_flowcontroll/ClassFlowImage.h

@@ -15,15 +15,15 @@ protected:
 	unsigned short imagesRetention;
 	unsigned short imagesRetention;
 	const char *logTag;
 	const char *logTag;
 
 
-	string CreateLogFolder(string time);
-	void LogImage(string logPath, string name, float *resultFloat, int *resultInt, string time, CImageBasis *_img);
+	string CreateLogFolder(string _time);
+	void LogImage(string _logPath, string _name, float *_resultFloat, int *_resultInt, string _time, CImageBasis *_img);
 
 
 public:
 public:
-	ClassFlowImage(const char *logTag);
-	ClassFlowImage(std::vector<ClassFlow *> *lfc, const char *logTag);
-	ClassFlowImage(std::vector<ClassFlow *> *lfc, ClassFlow *_prev, const char *logTag);
+	ClassFlowImage(const char *_logTag);
+	ClassFlowImage(std::vector<ClassFlow *> *_lfc, const char *_logTag);
+	ClassFlowImage(std::vector<ClassFlow *> *_lfc, ClassFlow *_prev, const char *_logTag);
 
 
-	void RemoveOldLogs();
+	void RemoveOldLogs(void);
 };
 };
 
 
 #endif // CLASSFLOWIMAGE_H
 #endif // CLASSFLOWIMAGE_H

+ 5 - 2
code/components/jomjol_flowcontroll/ClassFlowMQTT.cpp

@@ -56,7 +56,7 @@ void ClassFlowMQTT::SetInitialParameter(void)
     mqtt_controll_config.validateServerCert = true;
     mqtt_controll_config.validateServerCert = true;
     mqtt_controll_config.clientname = network_config.hostname;
     mqtt_controll_config.clientname = network_config.hostname;
 
 
-    mqtt_controll_config.OldValue = "";
+    mqtt_controll_config.oldValue = "";
 
 
     mqtt_controll_config.user = "";
     mqtt_controll_config.user = "";
     mqtt_controll_config.password = "";
     mqtt_controll_config.password = "";
@@ -362,10 +362,12 @@ bool ClassFlowMQTT::doFlow(std::string time)
 
 
             if (name_temp == "default")
             if (name_temp == "default")
             {
             {
+                // e.g. watermeter/default/
                 name_temp = mqtt_controll_config.maintopic + "/";
                 name_temp = mqtt_controll_config.maintopic + "/";
             }
             }
             else
             else
             {
             {
+                // e.g. watermeter/main/
                 name_temp = mqtt_controll_config.maintopic + "/" + name_temp + "/";
                 name_temp = mqtt_controll_config.maintopic + "/" + name_temp + "/";
             }
             }
 
 
@@ -404,6 +406,7 @@ bool ClassFlowMQTT::doFlow(std::string time)
 
 
             if (change_absolute_temp.length() > 0)
             if (change_absolute_temp.length() > 0)
             {
             {
+                // e.g. _key = watermeter/main/changeabsolut, _content = change_absolute_temp, _qos = 1, retained_flag = mqtt_controll_config.retainFlag
                 success |= MQTTPublish(name_temp + "changeabsolut", change_absolute_temp, qos, mqtt_controll_config.retainFlag); // Legacy API
                 success |= MQTTPublish(name_temp + "changeabsolut", change_absolute_temp, qos, mqtt_controll_config.retainFlag); // Legacy API
                 success |= MQTTPublish(name_temp + "rate_per_digitization_round", change_absolute_temp, qos, mqtt_controll_config.retainFlag);
                 success |= MQTTPublish(name_temp + "rate_per_digitization_round", change_absolute_temp, qos, mqtt_controll_config.retainFlag);
             }
             }
@@ -423,7 +426,7 @@ bool ClassFlowMQTT::doFlow(std::string time)
         }
         }
     }
     }
 
 
-    mqtt_controll_config.OldValue = value_temp;
+    mqtt_controll_config.oldValue = value_temp;
 
 
     if (!success)
     if (!success)
     {
     {

+ 1 - 1
code/components/jomjol_flowcontroll/ClassFlowMQTT.h

@@ -28,7 +28,7 @@ typedef struct
     std::string topicTimeStamp;
     std::string topicTimeStamp;
     std::string topicUptime;
     std::string topicUptime;
     std::string topicFreeMem;
     std::string topicFreeMem;
-    std::string OldValue;
+    std::string oldValue;
 
 
     std::string user;
     std::string user;
     std::string password;
     std::string password;

+ 137 - 74
code/components/jomjol_flowcontroll/ClassFlowPostProcessing.cpp

@@ -13,7 +13,7 @@
 #include "Helper.h"
 #include "Helper.h"
 #include "time_sntp.h"
 #include "time_sntp.h"
 
 
-static const char *TAG = "POSTPROCESS";
+static const char *TAG = "POSTPROC";
 
 
 std::string ClassFlowPostProcessing::getNumbersName()
 std::string ClassFlowPostProcessing::getNumbersName()
 {
 {
@@ -80,6 +80,15 @@ std::string ClassFlowPostProcessing::getJsonFromNumber(int i, std::string _linee
         json += "    \"rate\": \"\"," + _lineend;
         json += "    \"rate\": \"\"," + _lineend;
     }
     }
 
 
+    if (NUMBERS[i]->ReturnChangeAbsolute.length() > 0)
+    {
+        json += "    \"absrate\": \"" + NUMBERS[i]->ReturnChangeAbsolute + "\"," + _lineend;
+    }
+    else
+    {
+        json += "    \"absrate\": \"\"," + _lineend;
+    }
+
     json += "    \"timestamp\": \"" + NUMBERS[i]->timeStamp + "\"" + _lineend;
     json += "    \"timestamp\": \"" + NUMBERS[i]->timeStamp + "\"" + _lineend;
     json += "  }" + _lineend;
     json += "  }" + _lineend;
 
 
@@ -141,7 +150,7 @@ bool ClassFlowPostProcessing::SetPreValue(double _newvalue, std::string _numbers
             }
             }
 
 
             NUMBERS[j]->ReturnPreValue = std::to_string(NUMBERS[j]->PreValue);
             NUMBERS[j]->ReturnPreValue = std::to_string(NUMBERS[j]->PreValue);
-            NUMBERS[j]->PreValueOkay = true;
+            NUMBERS[j]->PreValueValid = true;
 
 
             if (_extern)
             if (_extern)
             {
             {
@@ -149,8 +158,6 @@ bool ClassFlowPostProcessing::SetPreValue(double _newvalue, std::string _numbers
                 localtime(&(NUMBERS[j]->timeStampLastPreValue));
                 localtime(&(NUMBERS[j]->timeStampLastPreValue));
             }
             }
 
 
-            // ESP_LOGD(TAG, "Found %d! - set to %.8f", j,  NUMBERS[j]->PreValue);
-
             UpdatePreValueINI = true; // Only update prevalue file if a new value is set
             UpdatePreValueINI = true; // Only update prevalue file if a new value is set
             SavePreValue();
             SavePreValue();
 
 
@@ -228,11 +235,11 @@ bool ClassFlowPostProcessing::LoadPreValue(void)
 
 
                     if (difference > PreValueAgeStartup)
                     if (difference > PreValueAgeStartup)
                     {
                     {
-                        NUMBERS[j]->PreValueOkay = false;
+                        NUMBERS[j]->PreValueValid = false;
                     }
                     }
                     else
                     else
                     {
                     {
-                        NUMBERS[j]->PreValueOkay = true;
+                        NUMBERS[j]->PreValueValid = true;
                     }
                     }
                 }
                 }
             }
             }
@@ -344,7 +351,6 @@ ClassFlowPostProcessing::ClassFlowPostProcessing(std::vector<ClassFlow *> *lfc,
 {
 {
     PreValueUse = false;
     PreValueUse = false;
     PreValueAgeStartup = 30;
     PreValueAgeStartup = 30;
-    ErrorMessage = false;
     ListFlowControll = NULL;
     ListFlowControll = NULL;
     FilePreValue = format_filename("/sdcard/config/prevalue.ini");
     FilePreValue = format_filename("/sdcard/config/prevalue.ini");
     ListFlowControll = lfc;
     ListFlowControll = lfc;
@@ -362,7 +368,7 @@ ClassFlowPostProcessing::ClassFlowPostProcessing(std::vector<ClassFlow *> *lfc,
     }
     }
 }
 }
 
 
-void ClassFlowPostProcessing::handleDecimalExtendedResolution(std::string _decsep, std::string _value)
+void ClassFlowPostProcessing::handleExtendedResolution(std::string _decsep, std::string _value)
 {
 {
     std::string _digit;
     std::string _digit;
     int _pospunkt = _decsep.find_first_of(".");
     int _pospunkt = _decsep.find_first_of(".");
@@ -383,12 +389,12 @@ void ClassFlowPostProcessing::handleDecimalExtendedResolution(std::string _decse
         // Set to default first (if nothing else is set)
         // Set to default first (if nothing else is set)
         if ((_digit == "default") || (NUMBERS[j]->name == _digit))
         if ((_digit == "default") || (NUMBERS[j]->name == _digit))
         {
         {
-            NUMBERS[j]->isExtendedResolution = temp_value;
+            NUMBERS[j]->ExtendedResolution = temp_value;
         }
         }
     }
     }
 }
 }
 
 
-void ClassFlowPostProcessing::handleDecimalSeparator(std::string _decsep, std::string _value)
+void ClassFlowPostProcessing::handleDecimalShift(std::string _decsep, std::string _value)
 {
 {
     std::string _digit;
     std::string _digit;
     int _pospunkt = _decsep.find_first_of(".");
     int _pospunkt = _decsep.find_first_of(".");
@@ -453,6 +459,32 @@ void ClassFlowPostProcessing::handleAnalogToDigitTransitionStart(std::string _de
     }
     }
 }
 }
 
 
+void ClassFlowPostProcessing::handleSkipErrorMessage(std::string _decsep, std::string _value)
+{
+    std::string _digit;
+    int _pospunkt = _decsep.find_first_of(".");
+
+    if (_pospunkt > -1)
+    {
+        _digit = _decsep.substr(0, _pospunkt);
+    }
+    else
+    {
+        _digit = "default";
+    }
+
+    for (int j = 0; j < NUMBERS.size(); ++j)
+    {
+        bool temp_value = alphanumeric_to_boolean(_value);
+
+        // Set to default first (if nothing else is set)
+        if ((_digit == "default") || (NUMBERS[j]->name == _digit))
+        {
+            NUMBERS[j]->SkipErrorMessage = temp_value;
+        }
+    }
+}
+
 void ClassFlowPostProcessing::handleAllowNegativeRate(std::string _decsep, std::string _value)
 void ClassFlowPostProcessing::handleAllowNegativeRate(std::string _decsep, std::string _value)
 {
 {
     std::string _digit;
     std::string _digit;
@@ -670,9 +702,9 @@ bool ClassFlowPostProcessing::ReadParameter(FILE *pFile, std::string &aktparamgr
                     PreValueAgeStartup = std::stoi(splitted[1]);
                     PreValueAgeStartup = std::stoi(splitted[1]);
                 }
                 }
             }
             }
-            else if (_param == "ERRORMESSAGE")
+            else if (_param == "SKIPERRORMESSAGE")
             {
             {
-                ErrorMessage = alphanumeric_to_boolean(splitted[1]);
+                handleSkipErrorMessage(splitted[0], splitted[1]);
             }
             }
             else if (_param == "ALLOWNEGATIVERATES")
             else if (_param == "ALLOWNEGATIVERATES")
             {
             {
@@ -680,7 +712,7 @@ bool ClassFlowPostProcessing::ReadParameter(FILE *pFile, std::string &aktparamgr
             }
             }
             else if (_param == "DECIMALSHIFT")
             else if (_param == "DECIMALSHIFT")
             {
             {
-                handleDecimalSeparator(splitted[0], splitted[1]);
+                handleDecimalShift(splitted[0], splitted[1]);
             }
             }
             else if (_param == "ANALOGTODIGITTRANSITIONSTART")
             else if (_param == "ANALOGTODIGITTRANSITIONSTART")
             {
             {
@@ -704,7 +736,7 @@ bool ClassFlowPostProcessing::ReadParameter(FILE *pFile, std::string &aktparamgr
             }
             }
             else if (_param == "EXTENDEDRESOLUTION")
             else if (_param == "EXTENDEDRESOLUTION")
             {
             {
-                handleDecimalExtendedResolution(splitted[0], splitted[1]);
+                handleExtendedResolution(splitted[0], splitted[1]);
             }
             }
             else if (_param == "IGNORELEADINGNAN")
             else if (_param == "IGNORELEADINGNAN")
             {
             {
@@ -776,27 +808,29 @@ void ClassFlowPostProcessing::InitNUMBERS()
             _number->AnzahlAnalog = 0;
             _number->AnzahlAnalog = 0;
         }
         }
 
 
-        _number->PreValue = 0;    // last value read out well
+        _number->PreValue = 0.0f; // last value read out well
         _number->ReturnPreValue = "";
         _number->ReturnPreValue = "";
-        _number->PreValueOkay = false;
+        _number->PreValueValid = false;
+        _number->ErrorMessage = false;
         _number->ErrorMessageText = ""; // Error message for consistency check
         _number->ErrorMessageText = ""; // Error message for consistency check
+        _number->SkipErrorMessage = false;
         _number->AllowNegativeRates = false;
         _number->AllowNegativeRates = false;
         _number->DecimalShift = 0;
         _number->DecimalShift = 0;
         _number->DecimalShiftInitial = 0;
         _number->DecimalShiftInitial = 0;
-        _number->AnalogToDigitTransitionStart = 9.2;
-        _number->MaxFlowRate = 4.0;
+        _number->AnalogToDigitTransitionStart = 9.2f;
+        _number->MaxFlowRate = 4.0f;
         _number->useMaxFlowRate = false;
         _number->useMaxFlowRate = false;
-        _number->MaxRateValue = 0.1;
+        _number->MaxRateValue = 0.1f;
         _number->MaxRateType = AbsoluteChange;
         _number->MaxRateType = AbsoluteChange;
         _number->useMaxRateValue = false;
         _number->useMaxRateValue = false;
         _number->ChangeRateThreshold = 2;
         _number->ChangeRateThreshold = 2;
-        _number->isExtendedResolution = false;
+        _number->ExtendedResolution = false;
         _number->IgnoreLeadingNaN = false;
         _number->IgnoreLeadingNaN = false;
 
 
-        _number->Value = 0;           // last value read out, incl. corrections
+        _number->Value = 0.0f;        // last value read out, incl. corrections
         _number->ReturnValue = "";    // corrected return value, possibly with error message
         _number->ReturnValue = "";    // corrected return value, possibly with error message
         _number->ReturnRawValue = ""; // raw value (with N & leading 0)
         _number->ReturnRawValue = ""; // raw value (with N & leading 0)
-        _number->FlowRateAct = 0;     // m3 / min
+        _number->FlowRateAct = 0.0f;  // m3 / min
 
 
         _number->Nachkomma = _number->AnzahlAnalog;
         _number->Nachkomma = _number->AnzahlAnalog;
 
 
@@ -871,22 +905,42 @@ bool ClassFlowPostProcessing::doFlow(std::string temp_time)
 
 
     for (int j = 0; j < NUMBERS.size(); ++j)
     for (int j = 0; j < NUMBERS.size(); ++j)
     {
     {
-        NUMBERS[j]->ReturnRawValue = "";
-        NUMBERS[j]->ReturnRateValue = "";
-        NUMBERS[j]->ReturnValue = "";
-        NUMBERS[j]->ReturnChangeAbsolute = round_output(0.0, NUMBERS[j]->Nachkomma); // always reset change absolute
+        NUMBERS[j]->ErrorMessage = false;
         NUMBERS[j]->ErrorMessageText = "";
         NUMBERS[j]->ErrorMessageText = "";
+
         NUMBERS[j]->Value = -1;
         NUMBERS[j]->Value = -1;
 
 
+        if (NUMBERS[j]->SkipErrorMessage)
+        {
+            NUMBERS[j]->ReturnValue = std::to_string(NUMBERS[j]->PreValue);
+            NUMBERS[j]->ReturnRawValue = NUMBERS[j]->ReturnValue;
+        }
+        else
+        {
+            NUMBERS[j]->ReturnValue = "";
+            NUMBERS[j]->ReturnRawValue = "";
+        }
+
+        NUMBERS[j]->FlowRateAct = 0.0f;
+        NUMBERS[j]->ReturnRateValue = round_output(0.0f, NUMBERS[j]->Nachkomma);
+        NUMBERS[j]->ReturnChangeAbsolute = NUMBERS[j]->ReturnRateValue;
+
         // calculate time difference
         // calculate time difference
-        double LastValueTimeDifference = difftime(imagetime, NUMBERS[j]->timeStampLastValue) / 60;  // in minutes
+        double LastValueTimeDifference = difftime(imagetime, NUMBERS[j]->timeStampLastValue) / 60;       // in minutes
         double LastPreValueTimeDifference = difftime(imagetime, NUMBERS[j]->timeStampLastPreValue) / 60; // in minutes
         double LastPreValueTimeDifference = difftime(imagetime, NUMBERS[j]->timeStampLastPreValue) / 60; // in minutes
 
 
         if (!flowctrl.AlignmentOk)
         if (!flowctrl.AlignmentOk)
         {
         {
-            NUMBERS[j]->ErrorMessageText = "alignment failed";
-            LogFile.WriteToFile(ESP_LOG_ERROR, TAG, NUMBERS[j]->ErrorMessageText);
+            NUMBERS[j]->Value = NUMBERS[j]->PreValue;
+            NUMBERS[j]->timeStampLastValue = imagetime;
+
+            NUMBERS[j]->ErrorMessage = true;
+            NUMBERS[j]->ErrorMessageText = NUMBERS[j]->ErrorMessageText + "Alignment failed - Read: " + round_output(NUMBERS[j]->Value, NUMBERS[j]->Nachkomma) + " - Raw: " + NUMBERS[j]->ReturnRawValue + " - Pre: " + round_output(NUMBERS[j]->PreValue, NUMBERS[j]->Nachkomma) + " - Rate: " + NUMBERS[j]->ReturnRateValue;
+
+            std::string temp_string = NUMBERS[j]->name + ": Raw: " + NUMBERS[j]->ReturnRawValue + ", Value: " + NUMBERS[j]->ReturnValue + ", Status: " + NUMBERS[j]->ErrorMessageText;
+            LogFile.WriteToFile(ESP_LOG_ERROR, TAG, temp_string);
             WriteDataLog(j);
             WriteDataLog(j);
+
             continue;
             continue;
         }
         }
 
 
@@ -895,11 +949,12 @@ bool ClassFlowPostProcessing::doFlow(std::string temp_time)
         int previous_value = -1;
         int previous_value = -1;
         if (NUMBERS[j]->analog_roi)
         if (NUMBERS[j]->analog_roi)
         {
         {
-            NUMBERS[j]->ReturnRawValue = flowAnalog->getReadout(j, NUMBERS[j]->isExtendedResolution);
+            NUMBERS[j]->ReturnRawValue = flowAnalog->getReadout(j, NUMBERS[j]->ExtendedResolution);
 
 
             if (NUMBERS[j]->ReturnRawValue.length() > 0)
             if (NUMBERS[j]->ReturnRawValue.length() > 0)
             {
             {
                 char temp_char = NUMBERS[j]->ReturnRawValue[0];
                 char temp_char = NUMBERS[j]->ReturnRawValue[0];
+
                 if (temp_char >= 48 && temp_char <= 57)
                 if (temp_char >= 48 && temp_char <= 57)
                 {
                 {
                     previous_value = temp_char - 48;
                     previous_value = temp_char - 48;
@@ -920,7 +975,7 @@ bool ClassFlowPostProcessing::doFlow(std::string temp_time)
             }
             }
             else
             else
             {
             {
-                NUMBERS[j]->ReturnRawValue = flowDigit->getReadout(j, NUMBERS[j]->isExtendedResolution, previous_value); // Extended Resolution only if there are no analogue digits
+                NUMBERS[j]->ReturnRawValue = flowDigit->getReadout(j, NUMBERS[j]->ExtendedResolution, previous_value); // Extended Resolution only if there are no analogue digits
             }
             }
         }
         }
 
 
@@ -934,34 +989,52 @@ bool ClassFlowPostProcessing::doFlow(std::string temp_time)
             }
             }
         }
         }
 
 
-        NUMBERS[j]->ReturnValue = NUMBERS[j]->ReturnRawValue;
+        std::string TempValue = NUMBERS[j]->ReturnRawValue;
 
 
-        if (find_delimiter_pos(NUMBERS[j]->ReturnValue, "N") != std::string::npos)
+        if (find_delimiter_pos(TempValue, "N") != std::string::npos)
         {
         {
-            if (PreValueUse && NUMBERS[j]->PreValueOkay)
+            if (PreValueUse && NUMBERS[j]->PreValueValid)
             {
             {
-                NUMBERS[j]->ReturnValue = ErsetzteN(NUMBERS[j]->ReturnValue, NUMBERS[j]->PreValue);
+                TempValue = ErsetzteN(TempValue, NUMBERS[j]->PreValue);
             }
             }
             else
             else
             {
             {
+                NUMBERS[j]->Value = NUMBERS[j]->PreValue;
+                NUMBERS[j]->timeStampLastValue = imagetime;
+
+                NUMBERS[j]->ErrorMessage = true;
+                NUMBERS[j]->ErrorMessageText = NUMBERS[j]->ErrorMessageText + "PreValue not valid - Read: " + round_output(NUMBERS[j]->Value, NUMBERS[j]->Nachkomma) + " - Raw: " + NUMBERS[j]->ReturnRawValue + " - Pre: " + round_output(NUMBERS[j]->PreValue, NUMBERS[j]->Nachkomma) + " - Rate: " + NUMBERS[j]->ReturnRateValue;
+
                 std::string temp_string = NUMBERS[j]->name + ": Raw: " + NUMBERS[j]->ReturnRawValue + ", Value: " + NUMBERS[j]->ReturnValue + ", Status: " + NUMBERS[j]->ErrorMessageText;
                 std::string temp_string = NUMBERS[j]->name + ": Raw: " + NUMBERS[j]->ReturnRawValue + ", Value: " + NUMBERS[j]->ReturnValue + ", Status: " + NUMBERS[j]->ErrorMessageText;
                 LogFile.WriteToFile(ESP_LOG_INFO, TAG, temp_string);
                 LogFile.WriteToFile(ESP_LOG_INFO, TAG, temp_string);
-                NUMBERS[j]->ReturnValue = "";
-                NUMBERS[j]->timeStampLastValue = imagetime;
                 WriteDataLog(j);
                 WriteDataLog(j);
+
                 continue; // there is no number because there is still an N.
                 continue; // there is no number because there is still an N.
             }
             }
         }
         }
 
 
         // Delete leading zeros (unless there is only one 0 left)
         // Delete leading zeros (unless there is only one 0 left)
-        while ((NUMBERS[j]->ReturnValue.length() > 1) && (NUMBERS[j]->ReturnValue[0] == '0'))
+        while ((TempValue.length() > 1) && (TempValue[0] == '0'))
         {
         {
-            NUMBERS[j]->ReturnValue.erase(0, 1);
+            TempValue.erase(0, 1);
         }
         }
 
 
-        NUMBERS[j]->Value = std::stod(NUMBERS[j]->ReturnValue);
+        NUMBERS[j]->Value = std::stod(TempValue);
+
+        NUMBERS[j]->ReturnChangeAbsolute = round_output(NUMBERS[j]->Value - NUMBERS[j]->PreValue, NUMBERS[j]->Nachkomma);
+        NUMBERS[j]->FlowRateAct = std::stod(round_output(((NUMBERS[j]->Value - NUMBERS[j]->PreValue) / LastPreValueTimeDifference), NUMBERS[j]->Nachkomma));
+
+        if (NUMBERS[j]->MaxRateType == RateChange)
+        {
+            NUMBERS[j]->ReturnRateValue = std::to_string(NUMBERS[j]->FlowRateAct);
+        }
+        else
+        {
+            // Difference per round, as a safeguard in case a reading error(Neg. Rate - Read: or Rate too high - Read:) occurs in the meantime
+            NUMBERS[j]->ReturnRateValue = round_output((NUMBERS[j]->Value - NUMBERS[j]->PreValue) / ((int)(round(LastPreValueTimeDifference / LastValueTimeDifference))), NUMBERS[j]->Nachkomma);
+        }
 
 
-        if (PreValueUse && NUMBERS[j]->PreValueOkay)
+        if (PreValueUse && NUMBERS[j]->PreValueValid)
         {
         {
             if ((NUMBERS[j]->Nachkomma > 0) && (NUMBERS[j]->ChangeRateThreshold > 0))
             if ((NUMBERS[j]->Nachkomma > 0) && (NUMBERS[j]->ChangeRateThreshold > 0))
             {
             {
@@ -971,7 +1044,6 @@ bool ClassFlowPostProcessing::doFlow(std::string temp_time)
                 if ((NUMBERS[j]->Value >= _difference1) && (NUMBERS[j]->Value <= _difference2))
                 if ((NUMBERS[j]->Value >= _difference1) && (NUMBERS[j]->Value <= _difference2))
                 {
                 {
                     NUMBERS[j]->Value = NUMBERS[j]->PreValue;
                     NUMBERS[j]->Value = NUMBERS[j]->PreValue;
-                    NUMBERS[j]->ReturnValue = std::to_string(NUMBERS[j]->PreValue);
                 }
                 }
             }
             }
 
 
@@ -981,63 +1053,53 @@ bool ClassFlowPostProcessing::doFlow(std::string temp_time)
 
 
                 if ((NUMBERS[j]->Value < NUMBERS[j]->PreValue))
                 if ((NUMBERS[j]->Value < NUMBERS[j]->PreValue))
                 {
                 {
-                    NUMBERS[j]->ErrorMessageText = NUMBERS[j]->ErrorMessageText + "Neg. Rate - Read: " + round_output(NUMBERS[j]->Value, NUMBERS[j]->Nachkomma) + " - Raw: " + NUMBERS[j]->ReturnRawValue + " - Pre: " + round_output(NUMBERS[j]->PreValue, NUMBERS[j]->Nachkomma) + " ";
                     NUMBERS[j]->Value = NUMBERS[j]->PreValue;
                     NUMBERS[j]->Value = NUMBERS[j]->PreValue;
-                    NUMBERS[j]->ReturnValue = "";
                     NUMBERS[j]->timeStampLastValue = imagetime;
                     NUMBERS[j]->timeStampLastValue = imagetime;
 
 
+                    NUMBERS[j]->ErrorMessage = true;
+                    NUMBERS[j]->ErrorMessageText = NUMBERS[j]->ErrorMessageText + "Neg. Rate - Read: " + round_output(NUMBERS[j]->Value, NUMBERS[j]->Nachkomma) + " - Raw: " + NUMBERS[j]->ReturnRawValue + " - Pre: " + round_output(NUMBERS[j]->PreValue, NUMBERS[j]->Nachkomma) + " - Rate: " + NUMBERS[j]->ReturnRateValue;
+
                     std::string temp_string = NUMBERS[j]->name + ": Raw: " + NUMBERS[j]->ReturnRawValue + ", Value: " + NUMBERS[j]->ReturnValue + ", Status: " + NUMBERS[j]->ErrorMessageText;
                     std::string temp_string = NUMBERS[j]->name + ": Raw: " + NUMBERS[j]->ReturnRawValue + ", Value: " + NUMBERS[j]->ReturnValue + ", Status: " + NUMBERS[j]->ErrorMessageText;
                     LogFile.WriteToFile(ESP_LOG_ERROR, TAG, temp_string);
                     LogFile.WriteToFile(ESP_LOG_ERROR, TAG, temp_string);
                     WriteDataLog(j);
                     WriteDataLog(j);
+
                     continue;
                     continue;
                 }
                 }
             }
             }
 
 
-            NUMBERS[j]->FlowRateAct = (NUMBERS[j]->Value - NUMBERS[j]->PreValue) / LastPreValueTimeDifference;
-            NUMBERS[j]->ReturnRateValue = std::to_string(NUMBERS[j]->FlowRateAct);
-
             if ((NUMBERS[j]->useMaxRateValue) && (NUMBERS[j]->Value != NUMBERS[j]->PreValue))
             if ((NUMBERS[j]->useMaxRateValue) && (NUMBERS[j]->Value != NUMBERS[j]->PreValue))
             {
             {
-                double _ratedifference;
-
-                if (NUMBERS[j]->MaxRateType == RateChange)
-                {
-                    _ratedifference = NUMBERS[j]->FlowRateAct;
-                }
-                else
-                {
-                    // Difference per round, as a safeguard in case a reading error(Neg. Rate - Read: or Rate too high - Read:) occurs in the meantime
-                    _ratedifference = ((NUMBERS[j]->Value - NUMBERS[j]->PreValue) / ((int)(round(LastPreValueTimeDifference / LastValueTimeDifference))));
-                }
-
-                if (abs(_ratedifference) > abs(NUMBERS[j]->MaxRateValue))
+                if (abs(std::stod(NUMBERS[j]->ReturnRateValue)) > abs(NUMBERS[j]->MaxRateValue))
                 {
                 {
-                    NUMBERS[j]->ErrorMessageText = NUMBERS[j]->ErrorMessageText + "Rate too high - Read: " + round_output(NUMBERS[j]->Value, NUMBERS[j]->Nachkomma) + " - Pre: " + round_output(NUMBERS[j]->PreValue, NUMBERS[j]->Nachkomma) + " - Rate: " + round_output(_ratedifference, NUMBERS[j]->Nachkomma);
                     NUMBERS[j]->Value = NUMBERS[j]->PreValue;
                     NUMBERS[j]->Value = NUMBERS[j]->PreValue;
-                    NUMBERS[j]->ReturnValue = "";
-                    NUMBERS[j]->ReturnRateValue = "";
                     NUMBERS[j]->timeStampLastValue = imagetime;
                     NUMBERS[j]->timeStampLastValue = imagetime;
 
 
+                    NUMBERS[j]->ErrorMessage = true;
+                    NUMBERS[j]->ErrorMessageText = NUMBERS[j]->ErrorMessageText + "Rate too high - Read: " + round_output(NUMBERS[j]->Value, NUMBERS[j]->Nachkomma) + " - Raw: " + NUMBERS[j]->ReturnRawValue + " - Pre: " + round_output(NUMBERS[j]->PreValue, NUMBERS[j]->Nachkomma) + " - Rate: " + NUMBERS[j]->ReturnRateValue;
+
                     std::string temp_string = NUMBERS[j]->name + ": Raw: " + NUMBERS[j]->ReturnRawValue + ", Value: " + NUMBERS[j]->ReturnValue + ", Status: " + NUMBERS[j]->ErrorMessageText;
                     std::string temp_string = NUMBERS[j]->name + ": Raw: " + NUMBERS[j]->ReturnRawValue + ", Value: " + NUMBERS[j]->ReturnValue + ", Status: " + NUMBERS[j]->ErrorMessageText;
                     LogFile.WriteToFile(ESP_LOG_ERROR, TAG, temp_string);
                     LogFile.WriteToFile(ESP_LOG_ERROR, TAG, temp_string);
                     WriteDataLog(j);
                     WriteDataLog(j);
+
                     continue;
                     continue;
                 }
                 }
             }
             }
         }
         }
 
 
         NUMBERS[j]->ReturnChangeAbsolute = round_output(NUMBERS[j]->Value - NUMBERS[j]->PreValue, NUMBERS[j]->Nachkomma);
         NUMBERS[j]->ReturnChangeAbsolute = round_output(NUMBERS[j]->Value - NUMBERS[j]->PreValue, NUMBERS[j]->Nachkomma);
-        NUMBERS[j]->PreValue = NUMBERS[j]->Value;
-        NUMBERS[j]->PreValueOkay = true;
 
 
-        NUMBERS[j]->timeStampLastValue = imagetime;
-        NUMBERS[j]->timeStampLastPreValue = imagetime;
+        NUMBERS[j]->PreValue = NUMBERS[j]->Value;
+        NUMBERS[j]->PreValueValid = true;
+        UpdatePreValueINI = true;
 
 
         NUMBERS[j]->ReturnValue = round_output(NUMBERS[j]->Value, NUMBERS[j]->Nachkomma);
         NUMBERS[j]->ReturnValue = round_output(NUMBERS[j]->Value, NUMBERS[j]->Nachkomma);
         NUMBERS[j]->ReturnPreValue = round_output(NUMBERS[j]->PreValue, NUMBERS[j]->Nachkomma);
         NUMBERS[j]->ReturnPreValue = round_output(NUMBERS[j]->PreValue, NUMBERS[j]->Nachkomma);
 
 
-        NUMBERS[j]->ErrorMessageText = "no error";
-        UpdatePreValueINI = true;
+        NUMBERS[j]->timeStampLastValue = imagetime;
+        NUMBERS[j]->timeStampLastPreValue = imagetime;
+
+        NUMBERS[j]->ErrorMessage = false;
+        NUMBERS[j]->ErrorMessageText = NUMBERS[j]->ErrorMessageText + "no error - Read: " + round_output(NUMBERS[j]->Value, NUMBERS[j]->Nachkomma) + " - Raw: " + NUMBERS[j]->ReturnRawValue + " - Pre: " + round_output(NUMBERS[j]->PreValue, NUMBERS[j]->Nachkomma) + " - Rate: " + NUMBERS[j]->ReturnRateValue;
 
 
         std::string temp_string = NUMBERS[j]->name + ": Raw: " + NUMBERS[j]->ReturnRawValue + ", Value: " + NUMBERS[j]->ReturnValue + ", Status: " + NUMBERS[j]->ErrorMessageText;
         std::string temp_string = NUMBERS[j]->name + ": Raw: " + NUMBERS[j]->ReturnRawValue + ", Value: " + NUMBERS[j]->ReturnValue + ", Status: " + NUMBERS[j]->ErrorMessageText;
         LogFile.WriteToFile(ESP_LOG_INFO, TAG, temp_string);
         LogFile.WriteToFile(ESP_LOG_INFO, TAG, temp_string);
@@ -1045,6 +1107,7 @@ bool ClassFlowPostProcessing::doFlow(std::string temp_time)
     }
     }
 
 
     SavePreValue();
     SavePreValue();
+
     return true;
     return true;
 }
 }
 
 
@@ -1074,11 +1137,11 @@ void ClassFlowPostProcessing::WriteDataLog(int _index)
 
 
     std::string analog = "";
     std::string analog = "";
     std::string digit = "";
     std::string digit = "";
-    std::string temp_time = "";
+
     char buffer[80];
     char buffer[80];
     struct tm *timeinfo = localtime(&NUMBERS[_index]->timeStampLastValue);
     struct tm *timeinfo = localtime(&NUMBERS[_index]->timeStampLastValue);
     strftime(buffer, 80, PREVALUE_TIME_FORMAT_OUTPUT, timeinfo);
     strftime(buffer, 80, PREVALUE_TIME_FORMAT_OUTPUT, timeinfo);
-    temp_time = std::string(buffer);
+    std::string temp_time = std::string(buffer);
 
 
     if (flowAnalog)
     if (flowAnalog)
     {
     {
@@ -1107,7 +1170,7 @@ void ClassFlowPostProcessing::UpdateNachkommaDecimalShift()
             NUMBERS[j]->DecimalShift = NUMBERS[j]->DecimalShiftInitial;
             NUMBERS[j]->DecimalShift = NUMBERS[j]->DecimalShiftInitial;
 
 
             // Extended resolution is on and should also be used for this digit.
             // Extended resolution is on and should also be used for this digit.
-            if (NUMBERS[j]->isExtendedResolution && flowDigit->isExtendedResolution())
+            if (NUMBERS[j]->ExtendedResolution && flowDigit->isExtendedResolution())
             {
             {
                 NUMBERS[j]->DecimalShift = NUMBERS[j]->DecimalShift - 1;
                 NUMBERS[j]->DecimalShift = NUMBERS[j]->DecimalShift - 1;
             }
             }
@@ -1120,7 +1183,7 @@ void ClassFlowPostProcessing::UpdateNachkommaDecimalShift()
             // ESP_LOGD(TAG, "Nur analog");
             // ESP_LOGD(TAG, "Nur analog");
             NUMBERS[j]->DecimalShift = NUMBERS[j]->DecimalShiftInitial;
             NUMBERS[j]->DecimalShift = NUMBERS[j]->DecimalShiftInitial;
 
 
-            if (NUMBERS[j]->isExtendedResolution && flowAnalog->isExtendedResolution())
+            if (NUMBERS[j]->ExtendedResolution && flowAnalog->isExtendedResolution())
             {
             {
                 NUMBERS[j]->DecimalShift = NUMBERS[j]->DecimalShift - 1;
                 NUMBERS[j]->DecimalShift = NUMBERS[j]->DecimalShift - 1;
             }
             }
@@ -1137,7 +1200,7 @@ void ClassFlowPostProcessing::UpdateNachkommaDecimalShift()
             NUMBERS[j]->Nachkomma = NUMBERS[j]->analog_roi->ROI.size() - NUMBERS[j]->DecimalShift;
             NUMBERS[j]->Nachkomma = NUMBERS[j]->analog_roi->ROI.size() - NUMBERS[j]->DecimalShift;
 
 
             // Extended resolution is on and should also be used for this digit.
             // Extended resolution is on and should also be used for this digit.
-            if (NUMBERS[j]->isExtendedResolution && flowAnalog->isExtendedResolution())
+            if (NUMBERS[j]->ExtendedResolution && flowAnalog->isExtendedResolution())
             {
             {
                 NUMBERS[j]->Nachkomma = NUMBERS[j]->Nachkomma + 1;
                 NUMBERS[j]->Nachkomma = NUMBERS[j]->Nachkomma + 1;
             }
             }

+ 3 - 3
code/components/jomjol_flowcontroll/ClassFlowPostProcessing.h

@@ -16,7 +16,6 @@ protected:
     bool UpdatePreValueINI;
     bool UpdatePreValueINI;
 
 
     int PreValueAgeStartup;
     int PreValueAgeStartup;
-    bool ErrorMessage;
 
 
     ClassFlowCNNGeneral *flowAnalog;
     ClassFlowCNNGeneral *flowAnalog;
     ClassFlowCNNGeneral *flowDigit;
     ClassFlowCNNGeneral *flowDigit;
@@ -32,11 +31,12 @@ protected:
 
 
     void InitNUMBERS();
     void InitNUMBERS();
 
 
-    void handleDecimalSeparator(std::string _decsep, std::string _value);
+    void handleDecimalShift(std::string _decsep, std::string _value);
     void handleMaxRateValue(std::string _decsep, std::string _value);
     void handleMaxRateValue(std::string _decsep, std::string _value);
-    void handleDecimalExtendedResolution(std::string _decsep, std::string _value);
+    void handleExtendedResolution(std::string _decsep, std::string _value);
     void handleMaxRateType(std::string _decsep, std::string _value);
     void handleMaxRateType(std::string _decsep, std::string _value);
     void handleAnalogToDigitTransitionStart(std::string _decsep, std::string _value);
     void handleAnalogToDigitTransitionStart(std::string _decsep, std::string _value);
+    void handleSkipErrorMessage(std::string _decsep, std::string _value);
     void handleAllowNegativeRate(std::string _decsep, std::string _value);
     void handleAllowNegativeRate(std::string _decsep, std::string _value);
     void handleIgnoreLeadingNaN(std::string _decsep, std::string _value);
     void handleIgnoreLeadingNaN(std::string _decsep, std::string _value);
     void handleChangeRateThreshold(std::string _decsep, std::string _value);
     void handleChangeRateThreshold(std::string _decsep, std::string _value);

+ 25 - 27
code/components/jomjol_helper/Helper.cpp

@@ -368,15 +368,8 @@ std::string decrypt_pw_string(std::string toDecrypt)
 // Checks if all passwords on the SD are encrypted and if they are not encrypted, it encrypts them.
 // Checks if all passwords on the SD are encrypted and if they are not encrypted, it encrypts them.
 esp_err_t encrypt_decrypt_pw_on_sd(bool _encrypt, std::string filename)
 esp_err_t encrypt_decrypt_pw_on_sd(bool _encrypt, std::string filename)
 {
 {
-	std::string line = "";
-
-	std::vector<std::string> splitted;
-	std::vector<std::string> temp_file;
-
-	all_pw_were_encrypted = false;
-
-	std::string fn = format_filename(filename);
-	FILE *pFile = fopen(fn.c_str(), "r");
+	std::string _filename = format_filename(filename);
+	FILE *pFile = fopen(_filename.c_str(), "r");
 
 
 	if (pFile == NULL)
 	if (pFile == NULL)
 	{
 	{
@@ -387,6 +380,7 @@ esp_err_t encrypt_decrypt_pw_on_sd(bool _encrypt, std::string filename)
 
 
 	ESP_LOGD(TAG, "EncryptDecryptConfigPwOnSD: config.ini opened");
 	ESP_LOGD(TAG, "EncryptDecryptConfigPwOnSD: config.ini opened");
 
 
+	std::string line = "";
 	char temp_line[256];
 	char temp_line[256];
 
 
 	if (fgets(temp_line, sizeof(temp_line), pFile) == NULL)
 	if (fgets(temp_line, sizeof(temp_line), pFile) == NULL)
@@ -401,6 +395,11 @@ esp_err_t encrypt_decrypt_pw_on_sd(bool _encrypt, std::string filename)
 		line = std::string(temp_line);
 		line = std::string(temp_line);
 	}
 	}
 
 
+	all_pw_were_encrypted = false;
+
+	std::vector<std::string> splitted;
+	std::vector<std::string> temp_file;
+
 	if (_encrypt)
 	if (_encrypt)
 	{
 	{
 		while ((line.size() > 0) || !(feof(pFile)))
 		while ((line.size() > 0) || !(feof(pFile)))
@@ -425,7 +424,7 @@ esp_err_t encrypt_decrypt_pw_on_sd(bool _encrypt, std::string filename)
 						line = "apikey = " + encrypt_pw_string(splitted[1]) + "\n";
 						line = "apikey = " + encrypt_pw_string(splitted[1]) + "\n";
 					}
 					}
 				}
 				}
-				else if (filename == NETWORK_CONFIG_FILE)
+				else if ((filename == WLAN_CONFIG_FILE) || (filename == NETWORK_CONFIG_FILE))
 				{
 				{
 					if (_param == "PASSWORD")
 					if (_param == "PASSWORD")
 					{
 					{
@@ -474,7 +473,7 @@ esp_err_t encrypt_decrypt_pw_on_sd(bool _encrypt, std::string filename)
 						line = "apikey = " + decrypt_pw_string(splitted[1]) + "\n";
 						line = "apikey = " + decrypt_pw_string(splitted[1]) + "\n";
 					}
 					}
 				}
 				}
-				else if (filename == NETWORK_CONFIG_FILE)
+				else if ((filename == WLAN_CONFIG_FILE) || (filename == NETWORK_CONFIG_FILE))
 				{
 				{
 					if (_param == "PASSWORD")
 					if (_param == "PASSWORD")
 					{
 					{
@@ -505,7 +504,7 @@ esp_err_t encrypt_decrypt_pw_on_sd(bool _encrypt, std::string filename)
 	// Only write to the SD if not all passwords are encrypted
 	// Only write to the SD if not all passwords are encrypted
 	if ((all_pw_were_encrypted == false && _encrypt == true) || (all_pw_were_encrypted == true && _encrypt == false))
 	if ((all_pw_were_encrypted == false && _encrypt == true) || (all_pw_were_encrypted == true && _encrypt == false))
 	{
 	{
-		pFile = fopen(fn.c_str(), "w+");
+		pFile = fopen(_filename.c_str(), "w+");
 
 
 		if (pFile == NULL)
 		if (pFile == NULL)
 		{
 		{
@@ -1140,16 +1139,16 @@ size_t find_delimiter_pos(string input, string delimiter)
 bool rename_file(string from, string to)
 bool rename_file(string from, string to)
 {
 {
 	// ESP_LOGI(logTag, "Renaming File: %s", from.c_str());
 	// ESP_LOGI(logTag, "Renaming File: %s", from.c_str());
-	FILE *fpSourceFile = fopen(from.c_str(), "rb");
+	FILE *pFile = fopen(from.c_str(), "rb");
 
 
 	// Sourcefile does not exist otherwise there is a mistake when renaming!
 	// Sourcefile does not exist otherwise there is a mistake when renaming!
-	if (!fpSourceFile)
+	if (!pFile)
 	{
 	{
 		ESP_LOGE(TAG, "RenameFile: File %s does not exist!", from.c_str());
 		ESP_LOGE(TAG, "RenameFile: File %s does not exist!", from.c_str());
 		return false;
 		return false;
 	}
 	}
 
 
-	fclose(fpSourceFile);
+	fclose(pFile);
 	rename(from.c_str(), to.c_str());
 	rename(from.c_str(), to.c_str());
 
 
 	return true;
 	return true;
@@ -1175,15 +1174,15 @@ bool rename_folder(string from, string to)
 
 
 bool file_exists(string filename)
 bool file_exists(string filename)
 {
 {
-	FILE *fpSourceFile = fopen(filename.c_str(), "rb");
+	FILE *pFile = fopen(filename.c_str(), "rb");
 
 
 	// Sourcefile does not exist
 	// Sourcefile does not exist
-	if (!fpSourceFile)
+	if (!pFile)
 	{
 	{
 		return false;
 		return false;
 	}
 	}
 
 
-	fclose(fpSourceFile);
+	fclose(pFile);
 
 
 	return true;
 	return true;
 }
 }
@@ -1207,16 +1206,16 @@ bool delete_file(string filename)
 {
 {
 	// ESP_LOGI(logTag, "Deleting file: %s", filename.c_str());
 	// ESP_LOGI(logTag, "Deleting file: %s", filename.c_str());
 	/* Delete file */
 	/* Delete file */
-	FILE *fpSourceFile = fopen(filename.c_str(), "rb");
+	FILE *pFile = fopen(filename.c_str(), "rb");
 
 
 	// Sourcefile does not exist otherwise there is a mistake in copying!
 	// Sourcefile does not exist otherwise there is a mistake in copying!
-	if (!fpSourceFile)
+	if (!pFile)
 	{
 	{
 		ESP_LOGD(TAG, "DeleteFile: File %s existiert nicht!", filename.c_str());
 		ESP_LOGD(TAG, "DeleteFile: File %s existiert nicht!", filename.c_str());
 		return false;
 		return false;
 	}
 	}
 
 
-	fclose(fpSourceFile);
+	fclose(pFile);
 	unlink(filename.c_str());
 	unlink(filename.c_str());
 
 
 	return true;
 	return true;
@@ -1227,13 +1226,12 @@ bool copy_file(string input, string output)
 	input = format_filename(input);
 	input = format_filename(input);
 	output = format_filename(output);
 	output = format_filename(output);
 
 
-	if (to_upper(input).compare(NETWORK_CONFIG_FILE) == 0)
+	if ((to_upper(input).compare(WLAN_CONFIG_FILE) == 0) || (to_upper(input).compare(NETWORK_CONFIG_FILE) == 0))
 	{
 	{
 		ESP_LOGD(TAG, "wlan.ini kann nicht kopiert werden!");
 		ESP_LOGD(TAG, "wlan.ini kann nicht kopiert werden!");
 		return false;
 		return false;
 	}
 	}
 
 
-	char cTemp;
 	FILE *fpSourceFile = fopen(input.c_str(), "rb");
 	FILE *fpSourceFile = fopen(input.c_str(), "rb");
 
 
 	// Sourcefile existiert nicht sonst gibt es einen Fehler beim Kopierversuch!
 	// Sourcefile existiert nicht sonst gibt es einen Fehler beim Kopierversuch!
@@ -1245,18 +1243,19 @@ bool copy_file(string input, string output)
 
 
 	FILE *fpTargetFile = fopen(output.c_str(), "wb");
 	FILE *fpTargetFile = fopen(output.c_str(), "wb");
 
 
-	// Code Section
+	char temp_char[1024];
 
 
 	// Read From The Source File - "Copy"
 	// Read From The Source File - "Copy"
-	while (fread(&cTemp, 1, 1, fpSourceFile) == 1)
+	while (fread(&temp_char, 1, 1, fpSourceFile) == 1)
 	{
 	{
 		// Write To The Target File - "Paste"
 		// Write To The Target File - "Paste"
-		fwrite(&cTemp, 1, 1, fpTargetFile);
+		fwrite(&temp_char, 1, 1, fpTargetFile);
 	}
 	}
 
 
 	// Close The Files
 	// Close The Files
 	fclose(fpSourceFile);
 	fclose(fpSourceFile);
 	fclose(fpTargetFile);
 	fclose(fpTargetFile);
+
 	ESP_LOGD(TAG, "File copied: %s to %s", input.c_str(), output.c_str());
 	ESP_LOGD(TAG, "File copied: %s to %s", input.c_str(), output.c_str());
 
 
 	return true;
 	return true;
@@ -1466,7 +1465,6 @@ string round_output(double _in, int _anzNachkomma)
 {
 {
 	std::stringstream stream;
 	std::stringstream stream;
 	int temp_value = _in;
 	int temp_value = _in;
-	//    ESP_LOGD(TAG, "AnzNachkomma: %d", _anzNachkomma);
 
 
 	if (_anzNachkomma > 0)
 	if (_anzNachkomma > 0)
 	{
 	{

+ 92 - 35
code/components/jomjol_helper/sdcard_check.cpp

@@ -7,7 +7,7 @@
 #include <inttypes.h>
 #include <inttypes.h>
 #include <sys/stat.h>
 #include <sys/stat.h>
 
 
-#include "esp_rom_crc.h" 
+#include "esp_rom_crc.h"
 #include "ClassLogFile.h"
 #include "ClassLogFile.h"
 
 
 static const char *TAG = "SDCARD";
 static const char *TAG = "SDCARD";
@@ -15,52 +15,60 @@ static const char *TAG = "SDCARD";
 int SDCardCheckRW(void)
 int SDCardCheckRW(void)
 {
 {
     LogFile.WriteToFile(ESP_LOG_INFO, TAG, "Basic R/W check started...");
     LogFile.WriteToFile(ESP_LOG_INFO, TAG, "Basic R/W check started...");
-    FILE* pFile = NULL;
     int iCRCMessage = 0;
     int iCRCMessage = 0;
-   
-    pFile = fopen("/sdcard/sdcheck.txt","w");
-    if (pFile == NULL) {
+
+    FILE *pFile = fopen("/sdcard/sdcheck.txt", "w");
+    if (pFile == NULL)
+    {
         LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Basic R/W check: (E1) No able to open file to write");
         LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Basic R/W check: (E1) No able to open file to write");
         return -1;
         return -1;
-    } 
-    else {
+    }
+    else
+    {
         std::string sMessage = "This message is used for a SD-Card basic check!";
         std::string sMessage = "This message is used for a SD-Card basic check!";
-        iCRCMessage = esp_rom_crc16_le(0, (uint8_t*)sMessage.c_str(), sMessage.length());
-        if (fwrite(sMessage.c_str(), sMessage.length(), 1, pFile) == 0 ) {
+        iCRCMessage = esp_rom_crc16_le(0, (uint8_t *)sMessage.c_str(), sMessage.length());
+        if (fwrite(sMessage.c_str(), sMessage.length(), 1, pFile) == 0)
+        {
             LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Basic R/W check: (E2) Not able to write file");
             LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Basic R/W check: (E2) Not able to write file");
             fclose(pFile);
             fclose(pFile);
             unlink("/sdcard/sdcheck.txt");
             unlink("/sdcard/sdcheck.txt");
             return -2;
             return -2;
         }
         }
-        fclose(pFile); 
+        fclose(pFile);
     }
     }
 
 
-    pFile = fopen("/sdcard/sdcheck.txt","r");
-    if (pFile == NULL) {
+    pFile = fopen("/sdcard/sdcheck.txt", "r");
+    if (pFile == NULL)
+    {
         LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Basic R/W check: (E3) Not able to open file to read back");
         LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Basic R/W check: (E3) Not able to open file to read back");
         unlink("/sdcard/sdcheck.txt");
         unlink("/sdcard/sdcheck.txt");
         return -3;
         return -3;
-    } 
-    else {
+    }
+    else
+    {
         char cReadBuf[50];
         char cReadBuf[50];
-        if (fgets(cReadBuf, sizeof(cReadBuf), pFile) == 0) {
+        if (fgets(cReadBuf, sizeof(cReadBuf), pFile) == 0)
+        {
             LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Basic R/W check: (E4) Not able to read file back");
             LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Basic R/W check: (E4) Not able to read file back");
             fclose(pFile);
             fclose(pFile);
             unlink("/sdcard/sdcheck.txt");
             unlink("/sdcard/sdcheck.txt");
             return -4;
             return -4;
         }
         }
-        else {
-            if (esp_rom_crc16_le(0, (uint8_t*)cReadBuf, strlen(cReadBuf)) != iCRCMessage) {                 
+        else
+        {
+            if (esp_rom_crc16_le(0, (uint8_t *)cReadBuf, strlen(cReadBuf)) != iCRCMessage)
+            {
                 LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Basic R/W check: (E5) Read back, but wrong CRC");
                 LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Basic R/W check: (E5) Read back, but wrong CRC");
                 fclose(pFile);
                 fclose(pFile);
                 unlink("/sdcard/sdcheck.txt");
                 unlink("/sdcard/sdcheck.txt");
                 return -5;
                 return -5;
             }
             }
-        }      
+        }
         fclose(pFile);
         fclose(pFile);
     }
     }
 
 
-    if (unlink("/sdcard/sdcheck.txt") != 0) {
+    if (unlink("/sdcard/sdcheck.txt") != 0)
+    {
         LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Basic R/W check: (E6) Unable to delete the file");
         LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Basic R/W check: (E6) Unable to delete the file");
         return -6;
         return -6;
     }
     }
@@ -76,86 +84,135 @@ bool SDCardCheckFolderFilePresence()
 
 
     LogFile.WriteToFile(ESP_LOG_INFO, TAG, "Folder/file presence check started...");
     LogFile.WriteToFile(ESP_LOG_INFO, TAG, "Folder/file presence check started...");
     /* check if folder exists: config */
     /* check if folder exists: config */
-    if (stat("/sdcard/config", &sb) != 0) {
+    if (stat("/sdcard/config", &sb) != 0)
+    {
         LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Folder/file check: Folder /config not found");
         LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Folder/file check: Folder /config not found");
         bRetval = false;
         bRetval = false;
     }
     }
 
 
     /* check if folder exists: html */
     /* check if folder exists: html */
-    if (stat("/sdcard/html", &sb) != 0) {
+    if (stat("/sdcard/html", &sb) != 0)
+    {
         LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Folder/file check: Folder /html not found");
         LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Folder/file check: Folder /html not found");
         bRetval = false;
         bRetval = false;
     }
     }
 
 
     /* check if folder exists: firmware */
     /* check if folder exists: firmware */
-    if (stat("/sdcard/firmware", &sb) != 0) {
+    if (stat("/sdcard/firmware", &sb) != 0)
+    {
         LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Folder/file check: Folder /firmware not found");
         LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Folder/file check: Folder /firmware not found");
         bRetval = false;
         bRetval = false;
     }
     }
 
 
     /* check if folder exists: img_tmp */
     /* check if folder exists: img_tmp */
-    if (stat("/sdcard/img_tmp", &sb) != 0) {
+    if (stat("/sdcard/img_tmp", &sb) != 0)
+    {
         LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Folder/file check: Folder /img_tmp not found");
         LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Folder/file check: Folder /img_tmp not found");
         bRetval = false;
         bRetval = false;
     }
     }
 
 
     /* check if folder exists: log */
     /* check if folder exists: log */
-    if (stat("/sdcard/log", &sb) != 0) {
+    if (stat("/sdcard/log", &sb) != 0)
+    {
         LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Folder/file check: Folder /log not found");
         LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Folder/file check: Folder /log not found");
         bRetval = false;
         bRetval = false;
     }
     }
 
 
     /* check if folder exists: demo */
     /* check if folder exists: demo */
-    if (stat("/sdcard/demo", &sb) != 0) {
+    if (stat("/sdcard/demo", &sb) != 0)
+    {
         LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Folder/file check: Folder /demo not found");
         LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Folder/file check: Folder /demo not found");
         bRetval = false;
         bRetval = false;
     }
     }
 
 
     /* check if file exists: wlan.ini */
     /* check if file exists: wlan.ini */
-    if (stat("/sdcard/wlan.ini", &sb) != 0) {
+    if ((stat("/sdcard/wlan.ini", &sb) != 0) && (stat("/sdcard/network.ini", &sb) != 0))
+    {
         LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Folder/file check: File /wlan.ini not found");
         LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Folder/file check: File /wlan.ini not found");
         bRetval = false;
         bRetval = false;
     }
     }
 
 
     /* check if file exists: config.ini */
     /* check if file exists: config.ini */
-    if (stat("/sdcard/config/config.ini", &sb) != 0) {
+    if (stat("/sdcard/config/config.ini", &sb) != 0)
+    {
         LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Folder/file check: File /config/config.ini not found");
         LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Folder/file check: File /config/config.ini not found");
         bRetval = false;
         bRetval = false;
     }
     }
 
 
     /* check if file exists: index.html */
     /* check if file exists: index.html */
-    if ((stat("/sdcard/html/index.html", &sb) != 0) && (stat("/sdcard/html/index.html.gz", &sb) != 0)) {
+    if ((stat("/sdcard/html/index.html", &sb) != 0) && (stat("/sdcard/html/index.html.gz", &sb) != 0))
+    {
         LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Folder/file check: File /html/index.html not found");
         LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Folder/file check: File /html/index.html not found");
         bRetval = false;
         bRetval = false;
     }
     }
 
 
+    /* check if file exists: overview.html */
+    if ((stat("/sdcard/html/overview.html", &sb) != 0) && (stat("/sdcard/html/overview.html.gz", &sb) != 0))
+    {
+        LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Folder/file check: File /html/overview.html not found");
+        bRetval = false;
+    }
+
     /* check if file exists: ota.html */
     /* check if file exists: ota.html */
-    if ((stat("/sdcard/html/ota_page.html", &sb) != 0) && (stat("/sdcard/html/ota_page.html.gz", &sb) != 0)) {
+    if ((stat("/sdcard/html/ota_page.html", &sb) != 0) && (stat("/sdcard/html/ota_page.html.gz", &sb) != 0))
+    {
         LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Folder/file check: File /html/ota.html not found");
         LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Folder/file check: File /html/ota.html not found");
         bRetval = false;
         bRetval = false;
     }
     }
 
 
     /* check if file exists: log.html */
     /* check if file exists: log.html */
-    if ((stat("/sdcard/html/log.html", &sb) != 0) && (stat("/sdcard/html/log.html.gz", &sb) != 0)) {
+    if ((stat("/sdcard/html/log.html", &sb) != 0) && (stat("/sdcard/html/log.html.gz", &sb) != 0))
+    {
         LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Folder/file check: File /html/log.html not found");
         LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Folder/file check: File /html/log.html not found");
         bRetval = false;
         bRetval = false;
     }
     }
 
 
     /* check if file exists: common.js */
     /* check if file exists: common.js */
-    if ((stat("/sdcard/html/common.js", &sb) != 0) && (stat("/sdcard/html/common.js.gz", &sb) != 0)) {
+    if ((stat("/sdcard/html/common.js", &sb) != 0) && (stat("/sdcard/html/common.js.gz", &sb) != 0))
+    {
         LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Folder/file check: File /html/common.js not found");
         LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Folder/file check: File /html/common.js not found");
         bRetval = false;
         bRetval = false;
     }
     }
 
 
+    /* check if file exists: readconfigcommon.js */
+    if ((stat("/sdcard/html/readconfigcommon.js", &sb) != 0) && (stat("/sdcard/html/readconfigcommon.js.gz", &sb) != 0))
+    {
+        LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Folder/file check: File /html/readconfigcommon.js not found");
+        bRetval = false;
+    }
+
+    /* check if file exists: readconfigparam.js */
+    if ((stat("/sdcard/html/readconfigparam.js", &sb) != 0) && (stat("/sdcard/html/readconfigparam.js.gz", &sb) != 0))
+    {
+        LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Folder/file check: File /html/readconfigparam.js not found");
+        bRetval = false;
+    }
+
+    /* check if file exists: jquery-3.6.0.min.js */
+    if ((stat("/sdcard/html/jquery-3.6.0.min.js", &sb) != 0) && (stat("/sdcard/html/jquery-3.6.0.min.js.gz", &sb) != 0))
+    {
+        LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Folder/file check: File /html/jquery-3.6.0.min.js not found");
+        bRetval = false;
+    }
+
+    /* check if file exists: firework.js */
+    if ((stat("/sdcard/html/firework.js", &sb) != 0) && (stat("/sdcard/html/firework.js.gz", &sb) != 0))
+    {
+        LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Folder/file check: File /html/firework.js not found");
+        bRetval = false;
+    }
+
     /* check if file exists: version.txt */
     /* check if file exists: version.txt */
-    if (stat("/sdcard/html/version.txt", &sb) != 0) {
+    if (stat("/sdcard/html/version.txt", &sb) != 0)
+    {
         LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Folder/file check: File /html/version.txt not found");
         LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Folder/file check: File /html/version.txt not found");
-        bRetval = false;
+        // bRetval = false;
     }
     }
 
 
-    if (bRetval) {
+    if (bRetval)
+    {
         LogFile.WriteToFile(ESP_LOG_INFO, TAG, "Folder/file presence check successful");
         LogFile.WriteToFile(ESP_LOG_INFO, TAG, "Folder/file presence check successful");
     }
     }
-    
+
     return bRetval;
     return bRetval;
 }
 }

+ 2 - 2
code/components/jomjol_image_proc/CImageBasis.h

@@ -13,8 +13,8 @@
 
 
 #include "../stb/stb_image.h"
 #include "../stb/stb_image.h"
 #include "../stb/stb_image_write.h"
 #include "../stb/stb_image_write.h"
-// #include "../stb/deprecated/stb_image_resize.h"
-#include "../stb/stb_image_resize.h"
+#include "../stb/deprecated/stb_image_resize.h"
+// #include "../stb/stb_image_resize2.h"
 
 
 #include "esp_heap_caps.h"
 #include "esp_heap_caps.h"
 
 

+ 2 - 2
code/components/jomjol_image_proc/make_stb.cpp

@@ -24,5 +24,5 @@
 #include "../stb/stb_image_write.h"
 #include "../stb/stb_image_write.h"
 
 
 #define STB_IMAGE_RESIZE_IMPLEMENTATION
 #define STB_IMAGE_RESIZE_IMPLEMENTATION
-// #include "../stb/deprecated/stb_image_resize.h"
-#include "../stb/stb_image_resize.h"
+#include "../stb/deprecated/stb_image_resize.h"
+// #include "../stb/stb_image_resize2.h"

+ 1 - 0
code/components/jomjol_mqtt/interface_mqtt.cpp

@@ -31,6 +31,7 @@ int MQTTReconnectCnt = 0;
 
 
 void (*callbackOnConnected)(std::string, bool) = NULL;
 void (*callbackOnConnected)(std::string, bool) = NULL;
 
 
+// e.g. _key = watermeter/main/rate_per_digitization_round, _content = change_absolute_temp, _qos = 1, retained_flag = mqtt_controll_config.retainFlag
 bool MQTTPublish(std::string _key, std::string _content, int qos, bool retained_flag)
 bool MQTTPublish(std::string _key, std::string _content, int qos, bool retained_flag)
 {
 {
     if (!mqtt_controll_config.mqtt_enabled)
     if (!mqtt_controll_config.mqtt_enabled)

+ 3 - 3
code/components/jomjol_mqtt/server_mqtt.cpp

@@ -92,10 +92,10 @@ bool sendHomeAssistantDiscoveryTopic(std::string group, std::string field, std::
 
 
     /* See https://www.home-assistant.io/docs/mqtt/discovery/ */
     /* See https://www.home-assistant.io/docs/mqtt/discovery/ */
     std::string payload = string("{") + "\"~\": \"" + mqtt_controll_config.maintopic + "\"," +
     std::string payload = string("{") + "\"~\": \"" + mqtt_controll_config.maintopic + "\"," +
-                          "\"unique_id\": \"" + mqtt_controll_config.maintopic + "-" + configTopic + "\"," +
+                          "\"name\": \"" + name + "\"," + "\"icon\": \"mdi:" + icon + "\"," +
                           "\"object_id\": \"" + mqtt_controll_config.maintopic + "_" + configTopic + "\"," +                           // Default entity ID; required for HA <= 2025.10
                           "\"object_id\": \"" + mqtt_controll_config.maintopic + "_" + configTopic + "\"," +                           // Default entity ID; required for HA <= 2025.10
                           "\"default_entity_id\": \"" + component + "." + mqtt_controll_config.maintopic + "_" + configTopic + "\"," + // Default entity ID; required in HA >=2026.4
                           "\"default_entity_id\": \"" + component + "." + mqtt_controll_config.maintopic + "_" + configTopic + "\"," + // Default entity ID; required in HA >=2026.4
-                          "\"name\": \"" + name + "\"," + "\"icon\": \"mdi:" + icon + "\",";
+                          "\"unique_id\": \"" + mqtt_controll_config.maintopic + "-" + configTopic + "\",";
 
 
     if (group != "")
     if (group != "")
     {
     {
@@ -224,7 +224,7 @@ bool MQTThomeassistantDiscovery(int qos)
         /* Not announcing "rate" as it is better to use rate_per_time_unit resp. rate_per_digitization_round */
         /* Not announcing "rate" as it is better to use rate_per_time_unit resp. rate_per_digitization_round */
         // allSendsSuccessed |= sendHomeAssistantDiscoveryTopic(group, "rate", "Rate (Unit/Minute)", "swap-vertical", "", "", "", "", qos); // Legacy, always Unit per Minute
         // allSendsSuccessed |= sendHomeAssistantDiscoveryTopic(group, "rate", "Rate (Unit/Minute)", "swap-vertical", "", "", "", "", qos); // Legacy, always Unit per Minute
         allSendsSuccessed |= sendHomeAssistantDiscoveryTopic(group, "rate_per_time_unit", "Rate (" + mqtt_controll_config.rateUnit + ")", "swap-vertical", mqtt_controll_config.rateUnit, rate_device_class, "measurement", "", qos);
         allSendsSuccessed |= sendHomeAssistantDiscoveryTopic(group, "rate_per_time_unit", "Rate (" + mqtt_controll_config.rateUnit + ")", "swap-vertical", mqtt_controll_config.rateUnit, rate_device_class, "measurement", "", qos);
-        allSendsSuccessed |= sendHomeAssistantDiscoveryTopic(group, "rate_per_digitization_round", "Change since last Digitization round", "arrow-expand-vertical", mqtt_controll_config.valueUnit, "", "measurement", "", qos); // correctly the Unit is Unit/Interval!
+        allSendsSuccessed |= sendHomeAssistantDiscoveryTopic(group, "rate_per_digitization_round", "Change since last Digitization round", "arrow-expand-vertical", mqtt_controll_config.valueUnit, rate_device_class, "measurement", "", qos); // correctly the Unit is Unit/Interval!
         allSendsSuccessed |= sendHomeAssistantDiscoveryTopic(group, "timestamp", "Timestamp", "clock-time-eight-outline", "", "timestamp", "", "diagnostic", qos);
         allSendsSuccessed |= sendHomeAssistantDiscoveryTopic(group, "timestamp", "Timestamp", "clock-time-eight-outline", "", "timestamp", "", "diagnostic", qos);
         allSendsSuccessed |= sendHomeAssistantDiscoveryTopic(group, "json", "JSON", "code-json", "", "", "", "diagnostic", qos);
         allSendsSuccessed |= sendHomeAssistantDiscoveryTopic(group, "json", "JSON", "code-json", "", "", "", "diagnostic", qos);
         allSendsSuccessed |= sendHomeAssistantDiscoveryTopic(group, "problem", "Problem", "alert-outline", "", "problem", "", "", qos); // Special binary sensor which is based on error topic
         allSendsSuccessed |= sendHomeAssistantDiscoveryTopic(group, "problem", "Problem", "alert-outline", "", "problem", "", "", qos); // Special binary sensor which is based on error topic

+ 10 - 2
code/components/jomjol_network/network_init.cpp

@@ -56,7 +56,15 @@ esp_err_t init_network(void)
 
 
     // Read Network parameter and start it
     // Read Network parameter and start it
     // ********************************************
     // ********************************************
-    int iNetworkStatus = LoadNetworkFromFile(NETWORK_CONFIG_FILE);
+    int iNetworkStatus = -1;
+    if (file_exists(WLAN_CONFIG_FILE))
+    {
+        iNetworkStatus = LoadNetworkFromFile(WLAN_CONFIG_FILE);
+    }
+    else
+    {
+        iNetworkStatus = LoadNetworkFromFile(NETWORK_CONFIG_FILE);
+    }
 
 
     // Network config available (0) or SSID/password not configured (-2)
     // Network config available (0) or SSID/password not configured (-2)
     if (file_exists(CONFIG_FILE) && ((iNetworkStatus == 0) || (iNetworkStatus == -2)))
     if (file_exists(CONFIG_FILE) && ((iNetworkStatus == 0) || (iNetworkStatus == -2)))
@@ -191,7 +199,7 @@ esp_err_t init_network(void)
             return ESP_OK;
             return ESP_OK;
         }
         }
     }
     }
-    // network.ini not available (-1) and config.ini not available
+    // wlan.ini not available (-1) and config.ini not available
     else
     else
     {
     {
         network_config.connection_type = NETWORK_CONNECTION_WIFI_AP_SETUP;
         network_config.connection_type = NETWORK_CONNECTION_WIFI_AP_SETUP;

+ 0 - 3
code/components/jomjol_network/read_network_config.cpp

@@ -244,7 +244,6 @@ bool ChangeHostName(std::string filename, std::string _newhostname)
 
 
     filename = format_filename(filename);
     filename = format_filename(filename);
     FILE *pFile = fopen(filename.c_str(), "r");
     FILE *pFile = fopen(filename.c_str(), "r");
-
     if (pFile == NULL)
     if (pFile == NULL)
     {
     {
         LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "ChangeHostName: unable to open wlan.ini (read)");
         LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "ChangeHostName: unable to open wlan.ini (read)");
@@ -338,7 +337,6 @@ bool ChangeRSSIThreshold(std::string filename, int _newrssithreshold)
 
 
     filename = format_filename(filename);
     filename = format_filename(filename);
     FILE *pFile = fopen(filename.c_str(), "r");
     FILE *pFile = fopen(filename.c_str(), "r");
-
     if (pFile == NULL)
     if (pFile == NULL)
     {
     {
         LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "ChangeRSSIThreshold: unable to open wlan.ini (read)");
         LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "ChangeRSSIThreshold: unable to open wlan.ini (read)");
@@ -435,7 +433,6 @@ esp_err_t GetAuthWebUIConfig(std::string filename)
 {
 {
     filename = format_filename(filename);
     filename = format_filename(filename);
     FILE *pFile = fopen(filename.c_str(), "r");
     FILE *pFile = fopen(filename.c_str(), "r");
-
     if (pFile == NULL)
     if (pFile == NULL)
     {
     {
         LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "GetAuthWebUIConfig: unable to open wlan.ini (read)");
         LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "GetAuthWebUIConfig: unable to open wlan.ini (read)");

+ 1 - 1
code/components/jomjol_network/read_network_config.h

@@ -16,7 +16,7 @@ struct network_config_t
     std::string eapid = "";
     std::string eapid = "";
     std::string username = "";
     std::string username = "";
     std::string password = "";
     std::string password = "";
-    std::string hostname = "watermeter"; // Default: watermeter
+    std::string hostname = "watermeter";
     std::string ipaddress = "";
     std::string ipaddress = "";
     std::string gateway = "";
     std::string gateway = "";
     std::string netmask = "";
     std::string netmask = "";

+ 84 - 80
code/components/jomjol_network/server_remote.cpp

@@ -42,7 +42,7 @@ void remote_send_http_response(httpd_req_t *req)
     message += "Please follow the below instructions.<p>";
     message += "Please follow the below instructions.<p>";
     httpd_resp_send_chunk(req, message.c_str(), strlen(message.c_str()));
     httpd_resp_send_chunk(req, message.c_str(), strlen(message.c_str()));
 
 
-    is_wlan_ini = file_exists(NETWORK_CONFIG_FILE);
+    is_wlan_ini = (file_exists(WLAN_CONFIG_FILE) || file_exists(NETWORK_CONFIG_FILE));
 
 
     if (!is_config_ini)
     if (!is_config_ini)
     {
     {
@@ -65,6 +65,7 @@ void remote_send_http_response(httpd_req_t *req)
         message += "document.getElementById(\"doUpdate\").disabled = true;}";
         message += "document.getElementById(\"doUpdate\").disabled = true;}";
         message += "</script>";
         message += "</script>";
         httpd_resp_send_chunk(req, message.c_str(), strlen(message.c_str()));
         httpd_resp_send_chunk(req, message.c_str(), strlen(message.c_str()));
+
         return;
         return;
     }
     }
 
 
@@ -83,6 +84,7 @@ void remote_send_http_response(httpd_req_t *req)
         message += "api = \"/config?\"+\"ssid=\"+document.getElementById(\"ssid\").value+\"&pwd=\"+document.getElementById(\"password\").value;";
         message += "api = \"/config?\"+\"ssid=\"+document.getElementById(\"ssid\").value+\"&pwd=\"+document.getElementById(\"password\").value;";
         message += "fetch(api);await new Promise(resolve => setTimeout(resolve, 1000));location.reload();}</script>";
         message += "fetch(api);await new Promise(resolve => setTimeout(resolve, 1000));location.reload();}</script>";
         httpd_resp_send_chunk(req, message.c_str(), strlen(message.c_str()));
         httpd_resp_send_chunk(req, message.c_str(), strlen(message.c_str()));
+
         return;
         return;
     }
     }
 
 
@@ -100,6 +102,7 @@ esp_err_t remote_test_handler(httpd_req_t *req)
 {
 {
     remote_send_http_response(req);
     remote_send_http_response(req);
     httpd_resp_send_chunk(req, NULL, 0);
     httpd_resp_send_chunk(req, NULL, 0);
+
     return ESP_OK;
     return ESP_OK;
 }
 }
 
 
@@ -107,25 +110,25 @@ esp_err_t remote_reboot_handler(httpd_req_t *req)
 {
 {
     LogFile.WriteToFile(ESP_LOG_INFO, TAG, "Trigger reboot due to firmware update.");
     LogFile.WriteToFile(ESP_LOG_INFO, TAG, "Trigger reboot due to firmware update.");
     doRebootOTA();
     doRebootOTA();
+
     return ESP_OK;
     return ESP_OK;
 }
 }
 
 
 esp_err_t remote_config_ini_handler(httpd_req_t *req)
 esp_err_t remote_config_ini_handler(httpd_req_t *req)
 {
 {
     LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "config_ini_handler");
     LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "config_ini_handler");
+
     char _query[400];
     char _query[400];
     char _valuechar[100];
     char _valuechar[100];
-    std::string fn = "/sdcard/firmware/";
-    std::string _task = "";
-    std::string ssid = "";
-    std::string pwd = "";
-    std::string hn = ""; // hostname
-    std::string ip = "";
-    std::string gw = ""; // gateway
-    std::string nm = ""; // netmask
-    std::string dns = "";
-    std::string rssithreshold = ""; // rssi threshold for WIFI roaming
-    std::string text = "";
+
+    std::string _ssid = "";
+    std::string _pwd = "";
+    std::string _hostname = "";
+    std::string _ip = "";
+    std::string _gateway = "";
+    std::string _netmask = "";
+    std::string _dns = "";
+    std::string _rssithreshold = ""; // rssi threshold for WIFI roaming
 
 
     if (httpd_req_get_url_query_str(req, _query, 400) == ESP_OK)
     if (httpd_req_get_url_query_str(req, _query, 400) == ESP_OK)
     {
     {
@@ -134,150 +137,150 @@ esp_err_t remote_config_ini_handler(httpd_req_t *req)
         if (httpd_query_key_value(_query, "ssid", _valuechar, 100) == ESP_OK)
         if (httpd_query_key_value(_query, "ssid", _valuechar, 100) == ESP_OK)
         {
         {
             ESP_LOGD(TAG, "ssid is found: %s", _valuechar);
             ESP_LOGD(TAG, "ssid is found: %s", _valuechar);
-            ssid = url_decode(std::string(_valuechar));
+            _ssid = url_decode(std::string(_valuechar));
         }
         }
 
 
         if (httpd_query_key_value(_query, "pwd", _valuechar, 100) == ESP_OK)
         if (httpd_query_key_value(_query, "pwd", _valuechar, 100) == ESP_OK)
         {
         {
             ESP_LOGD(TAG, "pwd is found: %s", _valuechar);
             ESP_LOGD(TAG, "pwd is found: %s", _valuechar);
-            pwd = url_decode(std::string(_valuechar));
+            _pwd = url_decode(std::string(_valuechar));
         }
         }
 
 
         if (httpd_query_key_value(_query, "ssid", _valuechar, 100) == ESP_OK)
         if (httpd_query_key_value(_query, "ssid", _valuechar, 100) == ESP_OK)
         {
         {
             ESP_LOGD(TAG, "ssid is found: %s", _valuechar);
             ESP_LOGD(TAG, "ssid is found: %s", _valuechar);
-            ssid = url_decode(std::string(_valuechar));
+            _ssid = url_decode(std::string(_valuechar));
         }
         }
 
 
         if (httpd_query_key_value(_query, "hn", _valuechar, 100) == ESP_OK)
         if (httpd_query_key_value(_query, "hn", _valuechar, 100) == ESP_OK)
         {
         {
             ESP_LOGD(TAG, "hostname is found: %s", _valuechar);
             ESP_LOGD(TAG, "hostname is found: %s", _valuechar);
-            hn = url_decode(std::string(_valuechar));
+            _hostname = url_decode(std::string(_valuechar));
         }
         }
 
 
         if (httpd_query_key_value(_query, "ip", _valuechar, 100) == ESP_OK)
         if (httpd_query_key_value(_query, "ip", _valuechar, 100) == ESP_OK)
         {
         {
             ESP_LOGD(TAG, "ip is found: %s", _valuechar);
             ESP_LOGD(TAG, "ip is found: %s", _valuechar);
-            ip = url_decode(std::string(_valuechar));
+            _ip = url_decode(std::string(_valuechar));
         }
         }
 
 
         if (httpd_query_key_value(_query, "gw", _valuechar, 100) == ESP_OK)
         if (httpd_query_key_value(_query, "gw", _valuechar, 100) == ESP_OK)
         {
         {
             ESP_LOGD(TAG, "gateway is found: %s", _valuechar);
             ESP_LOGD(TAG, "gateway is found: %s", _valuechar);
-            gw = url_decode(std::string(_valuechar));
+            _gateway = url_decode(std::string(_valuechar));
         }
         }
 
 
         if (httpd_query_key_value(_query, "nm", _valuechar, 100) == ESP_OK)
         if (httpd_query_key_value(_query, "nm", _valuechar, 100) == ESP_OK)
         {
         {
             ESP_LOGD(TAG, "netmask is found: %s", _valuechar);
             ESP_LOGD(TAG, "netmask is found: %s", _valuechar);
-            nm = url_decode(std::string(_valuechar));
+            _netmask = url_decode(std::string(_valuechar));
         }
         }
 
 
         if (httpd_query_key_value(_query, "dns", _valuechar, 100) == ESP_OK)
         if (httpd_query_key_value(_query, "dns", _valuechar, 100) == ESP_OK)
         {
         {
             ESP_LOGD(TAG, "dns is found: %s", _valuechar);
             ESP_LOGD(TAG, "dns is found: %s", _valuechar);
-            dns = url_decode(std::string(_valuechar));
+            _dns = url_decode(std::string(_valuechar));
         }
         }
 
 
         if (httpd_query_key_value(_query, "rssithreshold", _valuechar, 100) == ESP_OK)
         if (httpd_query_key_value(_query, "rssithreshold", _valuechar, 100) == ESP_OK)
         {
         {
             ESP_LOGD(TAG, "rssithreshold is found: %s", _valuechar);
             ESP_LOGD(TAG, "rssithreshold is found: %s", _valuechar);
-            rssithreshold = url_decode(std::string(_valuechar));
+            _rssithreshold = url_decode(std::string(_valuechar));
         }
         }
     }
     }
 
 
-    FILE *configfilehandle = fopen(NETWORK_CONFIG_FILE, "w");
+    FILE *pFile = fopen(NETWORK_CONFIG_FILE, "w");
 
 
-    text = ";++++++++++++++++++++++++++++++++++\n";
+    std::string text = ";++++++++++++++++++++++++++++++++++\n";
     text += "; AI on the edge - WLAN configuration\n";
     text += "; AI on the edge - WLAN configuration\n";
     text += "; ssid: Name of WLAN network (mandatory), e.g. \"WLAN-SSID\"\n";
     text += "; ssid: Name of WLAN network (mandatory), e.g. \"WLAN-SSID\"\n";
     text += "; password: Password of WLAN network (mandatory), e.g. \"PASSWORD\"\n\n";
     text += "; password: Password of WLAN network (mandatory), e.g. \"PASSWORD\"\n\n";
-    fputs(text.c_str(), configfilehandle);
+    fputs(text.c_str(), pFile);
 
 
-    if (ssid.length())
+    if (_ssid.length())
     {
     {
-        ssid = "ssid = \"" + ssid + "\"\n";
+        _ssid = "ssid = \"" + _ssid + "\"\n";
     }
     }
     else
     else
     {
     {
-        ssid = "ssid = \"\"\n";
+        _ssid = "ssid = \"\"\n";
     }
     }
-    fputs(ssid.c_str(), configfilehandle);
+    fputs(_ssid.c_str(), pFile);
 
 
-    if (pwd.length())
+    if (_pwd.length())
     {
     {
-        pwd = "password = \"" + pwd + "\"\n";
+        _pwd = "password = \"" + _pwd + "\"\n";
     }
     }
     else
     else
     {
     {
-        pwd = "password = \"\"\n";
+        _pwd = "password = \"\"\n";
     }
     }
-    fputs(pwd.c_str(), configfilehandle);
+    fputs(_pwd.c_str(), pFile);
 
 
     text = "\n;++++++++++++++++++++++++++++++++++\n";
     text = "\n;++++++++++++++++++++++++++++++++++\n";
     text += "; Hostname: Name of device in network\n";
     text += "; Hostname: Name of device in network\n";
     text += "; This parameter can be configured via WebUI configuration\n";
     text += "; This parameter can be configured via WebUI configuration\n";
     text += "; Default: \"watermeter\", if nothing is configured\n\n";
     text += "; Default: \"watermeter\", if nothing is configured\n\n";
-    fputs(text.c_str(), configfilehandle);
+    fputs(text.c_str(), pFile);
 
 
-    if (hn.length())
+    if (_hostname.length())
     {
     {
-        hn = "hostname = \"" + hn + "\"\n";
+        _hostname = "hostname = \"" + _hostname + "\"\n";
     }
     }
     else
     else
     {
     {
-        hn = ";hostname = \"watermeter\"\n";
+        _hostname = ";hostname = \"watermeter\"\n";
     }
     }
-    fputs(hn.c_str(), configfilehandle);
+    fputs(_hostname.c_str(), pFile);
 
 
     text = "\n;++++++++++++++++++++++++++++++++++\n";
     text = "\n;++++++++++++++++++++++++++++++++++\n";
     text += "; Fixed IP: If you like to use fixed IP instead of DHCP (default), the following\n";
     text += "; Fixed IP: If you like to use fixed IP instead of DHCP (default), the following\n";
     text += "; parameters needs to be configured: ip, gateway, netmask are mandatory, dns optional\n\n";
     text += "; parameters needs to be configured: ip, gateway, netmask are mandatory, dns optional\n\n";
-    fputs(text.c_str(), configfilehandle);
+    fputs(text.c_str(), pFile);
 
 
-    if (ip.length())
+    if (_ip.length())
     {
     {
-        ip = "ip = \"" + ip + "\"\n";
+        _ip = "ip = \"" + _ip + "\"\n";
     }
     }
     else
     else
     {
     {
-        ip = ";ip = \"xxx.xxx.xxx.xxx\"\n";
+        _ip = ";ip = \"xxx.xxx.xxx.xxx\"\n";
     }
     }
-    fputs(ip.c_str(), configfilehandle);
+    fputs(_ip.c_str(), pFile);
 
 
-    if (gw.length())
+    if (_gateway.length())
     {
     {
-        gw = "gateway = \"" + gw + "\"\n";
+        _gateway = "gateway = \"" + _gateway + "\"\n";
     }
     }
     else
     else
     {
     {
-        gw = ";gateway = \"xxx.xxx.xxx.xxx\"\n";
+        _gateway = ";gateway = \"xxx.xxx.xxx.xxx\"\n";
     }
     }
-    fputs(gw.c_str(), configfilehandle);
+    fputs(_gateway.c_str(), pFile);
 
 
-    if (nm.length())
+    if (_netmask.length())
     {
     {
-        nm = "netmask = \"" + nm + "\"\n";
+        _netmask = "netmask = \"" + _netmask + "\"\n";
     }
     }
     else
     else
     {
     {
-        nm = ";netmask = \"xxx.xxx.xxx.xxx\"\n";
+        _netmask = ";netmask = \"xxx.xxx.xxx.xxx\"\n";
     }
     }
-    fputs(nm.c_str(), configfilehandle);
+    fputs(_netmask.c_str(), pFile);
 
 
     text = "\n;++++++++++++++++++++++++++++++++++\n";
     text = "\n;++++++++++++++++++++++++++++++++++\n";
     text += "; DNS server (optional, if no DNS is configured, gateway address will be used)\n\n";
     text += "; DNS server (optional, if no DNS is configured, gateway address will be used)\n\n";
-    fputs(text.c_str(), configfilehandle);
+    fputs(text.c_str(), pFile);
 
 
-    if (dns.length())
+    if (_dns.length())
     {
     {
-        dns = "dns = \"" + dns + "\"\n";
+        _dns = "dns = \"" + _dns + "\"\n";
     }
     }
     else
     else
     {
     {
-        dns = ";dns = \"xxx.xxx.xxx.xxx\"\n";
+        _dns = ";dns = \"xxx.xxx.xxx.xxx\"\n";
     }
     }
-    fputs(dns.c_str(), configfilehandle);
+    fputs(_dns.c_str(), pFile);
 
 
     text = "\n;++++++++++++++++++++++++++++++++++\n";
     text = "\n;++++++++++++++++++++++++++++++++++\n";
     text += "; WIFI Roaming:\n";
     text += "; WIFI Roaming:\n";
@@ -288,20 +291,20 @@ esp_err_t remote_config_ini_handler(httpd_req_t *req)
     text += "; RSSI Threshold for client requested roaming query (RSSI < RSSIThreshold)\n";
     text += "; RSSI Threshold for client requested roaming query (RSSI < RSSIThreshold)\n";
     text += "; Note: This parameter can be configured via WebUI configuration\n";
     text += "; Note: This parameter can be configured via WebUI configuration\n";
     text += "; Default: 0 = Disable client requested roaming query\n\n";
     text += "; Default: 0 = Disable client requested roaming query\n\n";
-    fputs(text.c_str(), configfilehandle);
+    fputs(text.c_str(), pFile);
 
 
-    if (rssithreshold.length())
+    if (_rssithreshold.length())
     {
     {
-        rssithreshold = "RSSIThreshold = " + rssithreshold + "\n";
+        _rssithreshold = "RSSIThreshold = " + _rssithreshold + "\n";
     }
     }
     else
     else
     {
     {
-        rssithreshold = "RSSIThreshold = 0\n";
+        _rssithreshold = "RSSIThreshold = 0\n";
     }
     }
-    fputs(rssithreshold.c_str(), configfilehandle);
+    fputs(_rssithreshold.c_str(), pFile);
 
 
-    fflush(configfilehandle);
-    fclose(configfilehandle);
+    fflush(pFile);
+    fclose(pFile);
 
 
     std::string zw = "ota without parameter - should not be the case!";
     std::string zw = "ota without parameter - should not be the case!";
     httpd_resp_set_hdr(req, "Access-Control-Allow-Origin", "*");
     httpd_resp_set_hdr(req, "Access-Control-Allow-Origin", "*");
@@ -325,7 +328,6 @@ esp_err_t remote_upload_post_handler(httpd_req_t *req)
 
 
     LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "remote_upload_post_handler");
     LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "remote_upload_post_handler");
     char filepath[FILE_PATH_MAX];
     char filepath[FILE_PATH_MAX];
-    FILE *fd = NULL;
 
 
     const char *filename = get_path_from_uri(filepath, "/sdcard", req->uri + sizeof("/upload") - 1, sizeof(filepath));
     const char *filename = get_path_from_uri(filepath, "/sdcard", req->uri + sizeof("/upload") - 1, sizeof(filepath));
     if (!filename)
     if (!filename)
@@ -338,8 +340,8 @@ esp_err_t remote_upload_post_handler(httpd_req_t *req)
 
 
     delete_file(std::string(filepath));
     delete_file(std::string(filepath));
 
 
-    fd = fopen(filepath, "w");
-    if (!fd)
+    FILE *pFile = fopen(filepath, "w");
+    if (!pFile)
     {
     {
         ESP_LOGE(TAG, "Failed to create file: %s", filepath);
         ESP_LOGE(TAG, "Failed to create file: %s", filepath);
         httpd_resp_send_err(req, HTTPD_500_INTERNAL_SERVER_ERROR, "Failed to create file");
         httpd_resp_send_err(req, HTTPD_500_INTERNAL_SERVER_ERROR, "Failed to create file");
@@ -365,7 +367,7 @@ esp_err_t remote_upload_post_handler(httpd_req_t *req)
                 continue;
                 continue;
             }
             }
 
 
-            fclose(fd);
+            fclose(pFile);
             unlink(filepath);
             unlink(filepath);
 
 
             ESP_LOGE(TAG, "File reception failed!");
             ESP_LOGE(TAG, "File reception failed!");
@@ -373,9 +375,9 @@ esp_err_t remote_upload_post_handler(httpd_req_t *req)
             return ESP_FAIL;
             return ESP_FAIL;
         }
         }
 
 
-        if (received && (received != fwrite(buf, 1, received, fd)))
+        if (received && (received != fwrite(buf, 1, received, pFile)))
         {
         {
-            fclose(fd);
+            fclose(pFile);
             unlink(filepath);
             unlink(filepath);
 
 
             ESP_LOGE(TAG, "File write failed!");
             ESP_LOGE(TAG, "File write failed!");
@@ -386,13 +388,13 @@ esp_err_t remote_upload_post_handler(httpd_req_t *req)
         remaining -= received;
         remaining -= received;
     }
     }
 
 
-    fclose(fd);
+    fclose(pFile);
     is_config_ini = true;
     is_config_ini = true;
 
 
-    FILE *pfile = fopen("/sdcard/update.txt", "w");
-    std::string _s_zw = "/sdcard" + std::string(filename);
-    fwrite(_s_zw.c_str(), strlen(_s_zw.c_str()), 1, pfile);
-    fclose(pfile);
+    pFile = fopen("/sdcard/update.txt", "w");
+    std::string temp_string = "/sdcard" + std::string(filename);
+    fwrite(temp_string.c_str(), strlen(temp_string.c_str()), 1, pFile);
+    fclose(pFile);
 
 
     ESP_LOGI(TAG, "File reception complete");
     ESP_LOGI(TAG, "File reception complete");
     httpd_resp_set_hdr(req, "Location", "/test");
     httpd_resp_set_hdr(req, "Location", "/test");
@@ -424,6 +426,7 @@ httpd_handle_t start_remote_webserver(void)
     }
     }
 
 
     ESP_LOGI(TAG, "Error starting ap server!");
     ESP_LOGI(TAG, "Error starting ap server!");
+
     return NULL;
     return NULL;
 }
 }
 
 
@@ -435,27 +438,27 @@ void stop_remote_webserver(httpd_handle_t server)
 httpd_handle_t remote_webserver_register_uri(httpd_handle_t server)
 httpd_handle_t remote_webserver_register_uri(httpd_handle_t server)
 {
 {
     httpd_uri_t reboot_handle = {
     httpd_uri_t reboot_handle = {
-        .uri = "/reboot", // Match all URIs of type /path/to/file
+        .uri = "/reboot",
         .method = HTTP_GET,
         .method = HTTP_GET,
         .handler = APPLY_BASIC_AUTH_FILTER(remote_reboot_handler),
         .handler = APPLY_BASIC_AUTH_FILTER(remote_reboot_handler),
-        .user_ctx = NULL // Pass server data as context
+        .user_ctx = NULL,
     };
     };
     httpd_register_uri_handler(server, &reboot_handle);
     httpd_register_uri_handler(server, &reboot_handle);
 
 
     httpd_uri_t config_ini_handle = {
     httpd_uri_t config_ini_handle = {
-        .uri = "/config", // Match all URIs of type /path/to/file
+        .uri = "/config",
         .method = HTTP_GET,
         .method = HTTP_GET,
         .handler = APPLY_BASIC_AUTH_FILTER(remote_config_ini_handler),
         .handler = APPLY_BASIC_AUTH_FILTER(remote_config_ini_handler),
-        .user_ctx = NULL // Pass server data as context
+        .user_ctx = NULL,
     };
     };
     httpd_register_uri_handler(server, &config_ini_handle);
     httpd_register_uri_handler(server, &config_ini_handle);
 
 
     /* URI handler for uploading files to server */
     /* URI handler for uploading files to server */
     httpd_uri_t file_uploadAP = {
     httpd_uri_t file_uploadAP = {
-        .uri = "/upload/*", // Match all URIs of type /upload/path/to/file
+        .uri = "/upload/*",
         .method = HTTP_POST,
         .method = HTTP_POST,
         .handler = APPLY_BASIC_AUTH_FILTER(remote_upload_post_handler),
         .handler = APPLY_BASIC_AUTH_FILTER(remote_upload_post_handler),
-        .user_ctx = NULL // Pass server data as context
+        .user_ctx = NULL,
     };
     };
     httpd_register_uri_handler(server, &file_uploadAP);
     httpd_register_uri_handler(server, &file_uploadAP);
 
 
@@ -463,7 +466,8 @@ httpd_handle_t remote_webserver_register_uri(httpd_handle_t server)
         .uri = "*",
         .uri = "*",
         .method = HTTP_GET,
         .method = HTTP_GET,
         .handler = APPLY_BASIC_AUTH_FILTER(remote_test_handler),
         .handler = APPLY_BASIC_AUTH_FILTER(remote_test_handler),
-        .user_ctx = NULL};
+        .user_ctx = NULL,
+    };
     httpd_register_uri_handler(server, &test_uri);
     httpd_register_uri_handler(server, &test_uri);
 
 
     return NULL;
     return NULL;

+ 1 - 1
code/components/stb

@@ -1 +1 @@
-Subproject commit 5736b15f7ea0ffb08dd38af21067c314d6a3aae9
+Subproject commit f1c79c02822848a9bed4315b12c8c8f3761e1296

+ 2 - 1
code/include/defines.h

@@ -69,7 +69,8 @@
 
 
     
     
     //ClassFlowControll + Main + SoftAP
     //ClassFlowControll + Main + SoftAP
-    #define NETWORK_CONFIG_FILE "/sdcard/wlan.ini"
+    #define WLAN_CONFIG_FILE "/sdcard/wlan.ini"
+    #define NETWORK_CONFIG_FILE "/sdcard/network.ini"
 
 
 
 
     //main
     //main

+ 29 - 22
code/main/version.h

@@ -5,10 +5,10 @@
 // into the library by the version.cmake script
 // into the library by the version.cmake script
 extern "C"
 extern "C"
 {
 {
-    extern const char* GIT_TAG;
-    extern const char* GIT_REV;
-    extern const char* GIT_BRANCH;
-    extern const char* BUILD_TIME;
+    extern const char *GIT_TAG;
+    extern const char *GIT_REV;
+    extern const char *GIT_BRANCH;
+    extern const char *BUILD_TIME;
 }
 }
 
 
 #include <string>
 #include <string>
@@ -17,34 +17,37 @@ extern "C"
 #include <fstream>
 #include <fstream>
 #include <algorithm>
 #include <algorithm>
 
 
-
-const char* build_time(void)
+const char *build_time(void)
 {
 {
     return BUILD_TIME;
     return BUILD_TIME;
 }
 }
 
 
-const char* libfive_git_version(void)
+const char *libfive_git_version(void)
 {
 {
     return GIT_TAG;
     return GIT_TAG;
 }
 }
 
 
-const char* libfive_git_revision(void)
+const char *libfive_git_revision(void)
 {
 {
     return GIT_REV;
     return GIT_REV;
 }
 }
 
 
-const char* libfive_git_branch(void)
+const char *libfive_git_branch(void)
 {
 {
     return GIT_BRANCH;
     return GIT_BRANCH;
 }
 }
 
 
-
-std::string getFwVersion(void) {
+std::string getFwVersion(void)
+{
     std::string buf;
     std::string buf;
-    if (std::string(GIT_TAG) == "") { // Tag not set, show branch
+    if (std::string(GIT_TAG) == "")
+    {
+        // Tag not set, show branch
         buf = "Development-Branch: " + std::string(GIT_BRANCH);
         buf = "Development-Branch: " + std::string(GIT_BRANCH);
     }
     }
-    else { // Tag is set, ignore branch
+    else
+    {
+        // Tag is set, ignore branch
         buf = "Release: " + std::string(GIT_TAG);
         buf = "Release: " + std::string(GIT_TAG);
     }
     }
     buf = buf + " (Commit: " + std::string(GIT_REV) + ")";
     buf = buf + " (Commit: " + std::string(GIT_REV) + ")";
@@ -52,14 +55,16 @@ std::string getFwVersion(void) {
     return buf;
     return buf;
 }
 }
 
 
-std::string getHTMLversion(void){
-    char buf[100]="?\0";
-    FILE* pFile;
+std::string getHTMLversion(void)
+{
+    char buf[100] = "?\0";
     string fn = format_filename("/sdcard/html/version.txt");
     string fn = format_filename("/sdcard/html/version.txt");
-    pFile = fopen(fn.c_str(), "r");
+    FILE *pFile = fopen(fn.c_str(), "r");
 
 
     if (pFile == NULL)
     if (pFile == NULL)
+    {
         return std::string(buf);
         return std::string(buf);
+    }
 
 
     fgets(buf, sizeof(buf), pFile); // Line 1: Version
     fgets(buf, sizeof(buf), pFile); // Line 1: Version
     fclose(pFile);
     fclose(pFile);
@@ -70,14 +75,16 @@ std::string getHTMLversion(void){
     return value;
     return value;
 }
 }
 
 
-std::string getHTMLcommit(void){
-    char buf[100]="?\0";
-    FILE* pFile;
+std::string getHTMLcommit(void)
+{
+    char buf[100] = "?\0";
     string fn = format_filename("/sdcard/html/version.txt");
     string fn = format_filename("/sdcard/html/version.txt");
-    pFile = fopen(fn.c_str(), "r");
+    FILE *pFile = fopen(fn.c_str(), "r");
 
 
     if (pFile == NULL)
     if (pFile == NULL)
+    {
         return std::string(buf);
         return std::string(buf);
+    }
 
 
     fgets(buf, sizeof(buf), pFile); // Line 1: Version -> ignored
     fgets(buf, sizeof(buf), pFile); // Line 1: Version -> ignored
     fgets(buf, sizeof(buf), pFile); // Line 2: Commit
     fgets(buf, sizeof(buf), pFile); // Line 2: Commit
@@ -89,4 +96,4 @@ std::string getHTMLcommit(void){
     return value;
     return value;
 }
 }
 
 
-#endif // _VERSION_H
+#endif // _VERSION_H

+ 1 - 2
param-docs/expert-params.txt

@@ -33,9 +33,8 @@ Antialiasing
 AlignmentAlgo
 AlignmentAlgo
 CNNGoodThreshold
 CNNGoodThreshold
 PreValueAgeStartup
 PreValueAgeStartup
-ErrorMessage
+SkipErrorMessage
 MaxFlowRate
 MaxFlowRate
-ProcessAlgoNew
 CACert
 CACert
 ClientCert
 ClientCert
 ClientKey
 ClientKey

+ 2 - 2
param-docs/parameter-pages/PostProcessing/ErrorMessage.md → param-docs/parameter-pages/PostProcessing/NUMBER.SkipErrorMessage.md

@@ -1,5 +1,5 @@
-# Parameter `ErrorMessage`
-Default Value: `true`
+# Parameter `SkipErrorMessage`
+Default Value: `false`
 
 
 !!! Warning
 !!! Warning
     This is an **Expert Parameter**! Only change it if you understand what it does!
     This is an **Expert Parameter**! Only change it if you understand what it does!

+ 6 - 8
sd-card/config/config.ini

@@ -67,17 +67,16 @@ main.ana4 155 328 92 92 false
 [PostProcessing]
 [PostProcessing]
 PreValueUse = true
 PreValueUse = true
 PreValueAgeStartup = 720
 PreValueAgeStartup = 720
-ErrorMessage = true
+main.SkipErrorMessage = false
 main.AllowNegativeRates = false
 main.AllowNegativeRates = false
 main.DecimalShift = 0
 main.DecimalShift = 0
 main.AnalogToDigitTransitionStart = 9.8
 main.AnalogToDigitTransitionStart = 9.8
-;main.MaxFlowRate = 4.0
+main.MaxFlowRate = 4.0
 main.MaxRateValue = 0.05
 main.MaxRateValue = 0.05
 main.MaxRateType = AbsoluteChange
 main.MaxRateType = AbsoluteChange
 main.ChangeRateThreshold = 2
 main.ChangeRateThreshold = 2
 main.ExtendedResolution = false
 main.ExtendedResolution = false
 main.IgnoreLeadingNaN = false
 main.IgnoreLeadingNaN = false
-main.ProcessAlgoNew = false
 
 
 ;[MQTT]
 ;[MQTT]
 ;Uri = mqtt://IP-ADRESS:1883
 ;Uri = mqtt://IP-ADRESS:1883
@@ -85,14 +84,14 @@ main.ProcessAlgoNew = false
 ;ClientID = watermeter
 ;ClientID = watermeter
 ;user = USERNAME
 ;user = USERNAME
 ;password = PASSWORD
 ;password = PASSWORD
-;RetainMessages = false
-;HomeassistantDiscovery = false
-;DiscoveryPrefix = 1
-;MeterType = other
 ;CACert = /config/certs/RootCA.pem
 ;CACert = /config/certs/RootCA.pem
 ;ClientCert = /config/certs/client.pem.crt
 ;ClientCert = /config/certs/client.pem.crt
 ;ClientKey = /config/certs/client.pem.key
 ;ClientKey = /config/certs/client.pem.key
 ;ValidateServerCert = true
 ;ValidateServerCert = true
+;RetainMessages = true
+;HomeassistantDiscovery = true
+;DiscoveryPrefix = homeassistant
+;MeterType = other
 ;DomoticzTopicIn = domoticz/in
 ;DomoticzTopicIn = domoticz/in
 ;main.DomoticzIDX = 0
 ;main.DomoticzIDX = 0
 
 
@@ -118,7 +117,6 @@ main.ProcessAlgoNew = false
 ;UploadImg = 0
 ;UploadImg = 0
 
 
 ;[GPIO]
 ;[GPIO]
-;MainTopicMQTT = wasserzaehler/GPIO
 ;IO0 = input disabled 10 false false 
 ;IO0 = input disabled 10 false false 
 ;IO1 = input disabled 10 false false 
 ;IO1 = input disabled 10 false false 
 ;IO3 = input disabled 10 false false 
 ;IO3 = input disabled 10 false false 

+ 20 - 16
sd-card/demo/config.ini

@@ -1,7 +1,9 @@
 [TakeImage]
 [TakeImage]
 ;RawImagesLocation = /log/source
 ;RawImagesLocation = /log/source
 ;RawImagesRetention = 15
 ;RawImagesRetention = 15
+SaveAllFiles = false
 WaitBeforeTakingPicture = 2
 WaitBeforeTakingPicture = 2
+CamXclkFreqMhz = 20
 CamGainceiling = x8
 CamGainceiling = x8
 CamQuality = 10
 CamQuality = 10
 CamBrightness = 0
 CamBrightness = 0
@@ -35,9 +37,10 @@ LEDIntensity = 0
 Demo = true
 Demo = true
 
 
 [Alignment]
 [Alignment]
-InitialRotate = -34.6
 SearchFieldX = 20
 SearchFieldX = 20
 SearchFieldY = 20
 SearchFieldY = 20
+SearchMaxAngle = 15
+InitialRotate = -34.6
 AlignmentAlgo = default
 AlignmentAlgo = default
 /config/ref0.jpg 30 189
 /config/ref0.jpg 30 189
 /config/ref1.jpg 536 113
 /config/ref1.jpg 536 113
@@ -56,18 +59,18 @@ Model = /config/ana-cont_1400_s2_q.tflite
 main.ana1 452 199 120 120 false
 main.ana1 452 199 120 120 false
 
 
 [PostProcessing]
 [PostProcessing]
-main.DecimalShift = 0
-;main.AnalogToDigitTransitionStart = 
-main.ChangeRateThreshold = 2
 PreValueUse = true
 PreValueUse = true
 PreValueAgeStartup = 720
 PreValueAgeStartup = 720
+main.SkipErrorMessage = false
 main.AllowNegativeRates = true
 main.AllowNegativeRates = true
-;main.MaxRateValue = 0
-;main.MaxRateType = AbsoluteChange
+main.DecimalShift = 0
+main.AnalogToDigitTransitionStart = 9.8
+main.MaxFlowRate = 4.0
+main.MaxRateValue = 0.05
+main.MaxRateType = AbsoluteChange
+main.ChangeRateThreshold = 2
 main.ExtendedResolution = true
 main.ExtendedResolution = true
 main.IgnoreLeadingNaN = false
 main.IgnoreLeadingNaN = false
-ErrorMessage = true
-main.CheckDigitIncreaseConsistency = false
 
 
 ;[MQTT]
 ;[MQTT]
 ;Uri = mqtt://IP-ADRESS:1883
 ;Uri = mqtt://IP-ADRESS:1883
@@ -75,15 +78,16 @@ main.CheckDigitIncreaseConsistency = false
 ;ClientID = watermeter
 ;ClientID = watermeter
 ;user = USERNAME
 ;user = USERNAME
 ;password = PASSWORD
 ;password = PASSWORD
-RetainMessages = false
-;DomoticzTopicIn = undefined
-;main.DomoticzIDX = undefined
-HomeassistantDiscovery = false
-;MeterType = other
 ;CACert = /config/certs/RootCA.pem
 ;CACert = /config/certs/RootCA.pem
 ;ClientCert = /config/certs/client.pem.crt
 ;ClientCert = /config/certs/client.pem.crt
 ;ClientKey = /config/certs/client.pem.key
 ;ClientKey = /config/certs/client.pem.key
 ;ValidateServerCert = true
 ;ValidateServerCert = true
+;RetainMessages = true
+;HomeassistantDiscovery = true
+;DiscoveryPrefix = homeassistant
+;MeterType = other
+;DomoticzTopicIn = domoticz/in
+;main.DomoticzIDX = 0
 
 
 ;[InfluxDB]
 ;[InfluxDB]
 ;Uri = undefined
 ;Uri = undefined
@@ -91,7 +95,7 @@ HomeassistantDiscovery = false
 ;user = undefined
 ;user = undefined
 ;password = undefined
 ;password = undefined
 ;main.Measurement = undefined
 ;main.Measurement = undefined
-;main.Field = 
+;main.Field = undefined
 
 
 ;[InfluxDBv2]
 ;[InfluxDBv2]
 ;Uri = undefined
 ;Uri = undefined
@@ -129,10 +133,10 @@ LogLevel = 3
 LogfilesRetention = 3
 LogfilesRetention = 3
 
 
 [System]
 [System]
-Tooltip = true
 TimeZone = CET-1CEST,M3.5.0,M10.5.0/3
 TimeZone = CET-1CEST,M3.5.0,M10.5.0/3
 ;TimeServer = pool.ntp.org
 ;TimeServer = pool.ntp.org
 ;Hostname = undefined
 ;Hostname = undefined
 RSSIThreshold = -75
 RSSIThreshold = -75
 CPUFrequency = 160
 CPUFrequency = 160
-SetupMode = false
+Tooltip = true
+SetupMode = false

+ 12 - 22
sd-card/html/backup.html

@@ -25,6 +25,11 @@
         }
         }
     </style>
     </style>
 
 
+    <script type="text/javascript" src="common.js?v=$COMMIT_HASH"></script>
+    <script type="text/javascript" src="jszip.min.js?v=$COMMIT_HASH"></script>
+    <script type="text/javascript" src="FileSaver.min.js?v=$COMMIT_HASH"></script>
+
+    <script type="text/javascript">var domainname = getDomainname();</script>
 </head>
 </head>
 
 
 <body style="font-family: arial; padding: 0px 10px;">
 <body style="font-family: arial; padding: 0px 10px;">
@@ -36,21 +41,15 @@
     <hr>
     <hr>
     <h2>Restore Configuration</h2>
     <h2>Restore Configuration</h2>
     <p>Use the <a href="/fileserver/config/" target="_self">File Server</a> to upload individual files.</p>
     <p>Use the <a href="/fileserver/config/" target="_self">File Server</a> to upload individual files.</p>
-</body>
-
-
-<script type="text/javascript" src="common.js?v=$COMMIT_HASH"></script>
-<script type="text/javascript" src="jszip.min.js?v=$COMMIT_HASH"></script>
-<script type="text/javascript" src="FileSaver.min.js?v=$COMMIT_HASH"></script>
-<script>
 
 
+<script type="text/javascript">
 function startBackup() {  
 function startBackup() {  
     document.getElementById("progress").innerHTML = "Creating backup...<br>\n";
     document.getElementById("progress").innerHTML = "Creating backup...<br>\n";
     
     
     // Get hostname
     // Get hostname
     try {
     try {
         var xhttp = new XMLHttpRequest();
         var xhttp = new XMLHttpRequest();
-        xhttp.open("GET", getDomainname() + "/info?type=Hostname", false);
+        xhttp.open("GET", domainname + "/info?type=Hostname", false);
         xhttp.send();
         xhttp.send();
         hostname = xhttp.responseText;
         hostname = xhttp.responseText;
     }
     }
@@ -69,7 +68,7 @@ function startBackup() {
     setStatus("Fetching File List...");
     setStatus("Fetching File List...");
     try {
     try {
         var xhttp = new XMLHttpRequest();
         var xhttp = new XMLHttpRequest();
-        xhttp.open("GET", getDomainname() + "/fileserver/config/", false);
+        xhttp.open("GET", domainname + "/fileserver/config/", false);
         xhttp.send();
         xhttp.send();
         
         
         var parser = new DOMParser();
         var parser = new DOMParser();
@@ -85,7 +84,7 @@ function startBackup() {
     
     
     for (a of list) {
     for (a of list) {
         url = a.getAttribute("href");
         url = a.getAttribute("href");
-        urls.push(getDomainname() + url);
+        urls.push(domainname + url);
     }
     }
     
     
     // Pack as zip and download
     // Pack as zip and download
@@ -98,7 +97,6 @@ function startBackup() {
     }
     }
 }
 }
 
 
-
 function fetchFiles(urls, filesData, index, retry, zipFilename) {
 function fetchFiles(urls, filesData, index, retry, zipFilename) {
     url = urls[index];
     url = urls[index];
 
 
@@ -172,7 +170,6 @@ function fetchFiles(urls, filesData, index, retry, zipFilename) {
     xhr.send(null);
     xhr.send(null);
 }
 }
 
 
-
 function generateZipFile(urls, filesData, zipFilename) {
 function generateZipFile(urls, filesData, zipFilename) {
     setStatus("Creating Zip File...");
     setStatus("Creating Zip File...");
 
 
@@ -190,15 +187,8 @@ function generateZipFile(urls, filesData, zipFilename) {
     setStatus("Backup completed");
     setStatus("Backup completed");
 }
 }
 
 
-
 const backup = (urls, zipFilename) => {
 const backup = (urls, zipFilename) => {
-    if(!urls) return;
-
-    /* Testing */
-    /*len = urls.length;
-    for (i = 0; i < len - 3; i++) {
-        urls.pop();
-    }*/
+    if(!urls) { return; }
 
 
     console.log(urls);
     console.log(urls);
 
 
@@ -218,5 +208,5 @@ function getFilenameFromUrl(url) {
 }
 }
 
 
 </script>
 </script>
-
-</html>
+</body>
+</html>

+ 14 - 10
sd-card/html/data.html

@@ -46,33 +46,36 @@
                 font-size: 16px;
                 font-size: 16px;
             }
             }
         </style>
         </style>
-        <script type="text/javascript" src="common.js?v=$COMMIT_HASH"></script> 
+		
+        <script type="text/javascript" src="common.js?v=$COMMIT_HASH"></script>
+		
+		<script type="text/javascript">var domainname = getDomainname();</script>
     </head>
     </head>
+	
     <body>
     <body>
             <h2>Data Viewer</h2>
             <h2>Data Viewer</h2>
             <h4>Today's latest data</h4>
             <h4>Today's latest data</h4>
         <div class="box">
         <div class="box">
             <div class="row header">
             <div class="row header">
                 <button class="button" onClick="reload();">Refresh</button>
                 <button class="button" onClick="reload();">Refresh</button>
-                <button class="button" onClick="window.open(getDomainname() + '/datafileact');">Show Full File</button>
-                <button class="button" onClick="window.location.href = getDomainname() + '/fileserver/log/data/'">Show Data Files</button>
+                <button class="button" onClick="window.open(domainname + '/datafileact');">Show Full File</button>
+                <button class="button" onClick="window.location.href = domainname + '/fileserver/log/data/'">Show Data Files</button>
                 <button class="button" onClick="window.location.href = 'graph.html?v=$COMMIT_HASH'">Show Graph</button>
                 <button class="button" onClick="window.location.href = 'graph.html?v=$COMMIT_HASH'">Show Graph</button>
             </div>
             </div>
             <div class="row content" id="data"><br><br><br><b>Loading data file, please wait...</b></div>
             <div class="row content" id="data"><br><br><br><b>Loading data file, please wait...</b></div>
             <div class="row footer">
             <div class="row footer">
                 <button class="button" onClick="reload();">Refresh</button>
                 <button class="button" onClick="reload();">Refresh</button>
-                <button class="button" onClick="window.open(getDomainname() + '/datafileact');">Show Full File</button>
-                <button class="button" onClick="window.location.href = getDomainname() + '/fileserver/log/data/'">Show Data Files</button>
+                <button class="button" onClick="window.open(domainname + '/datafileact');">Show Full File</button>
+                <button class="button" onClick="window.location.href = domainname + '/fileserver/log/data/'">Show Data Files</button>
                 <button class="button" onClick="window.location.href = 'graph.html?v=$COMMIT_HASH'">Show Graph</button>
                 <button class="button" onClick="window.location.href = 'graph.html?v=$COMMIT_HASH'">Show Graph</button>
             </div>
             </div>
           </div>
           </div>
-    </body>
 
 
-    <script>  
+    <script type="text/javascript">  
         function reload() {
         function reload() {
             document.getElementById('data').innerHTML += "<br><b>Reloading...<b><br><br>";
             document.getElementById('data').innerHTML += "<br><b>Reloading...<b><br><br>";
             window.scrollBy(0,document.body.scrollHeight);
             window.scrollBy(0,document.body.scrollHeight);
-            funcRequest(getDomainname() + '/data');
+            funcRequest(domainname + '/data');
         } 
         } 
 
 
         async function funcRequest(url){
         async function funcRequest(url){
@@ -95,7 +98,8 @@
             });
             });
         }
         }
 
 
-        funcRequest(getDomainname() + '/data');
+        funcRequest(domainname + '/data');
 
 
     </script>
     </script>
-</html>
+    </body>
+</html>

+ 10 - 8
sd-card/html/data_export.html

@@ -24,6 +24,12 @@
             font-size: 16px;
             font-size: 16px;
         }
         }
     </style>
     </style>
+	
+    <script type="text/javascript" src="common.js?v=$COMMIT_HASH"></script>
+    <script type="text/javascript" src="jszip.min.js?v=$COMMIT_HASH"></script>
+    <script type="text/javascript" src="FileSaver.min.js?v=$COMMIT_HASH"></script>
+
+    <script type="text/javascript">var domainname = getDomainname();</script>
 </head>
 </head>
 
 
 <body style="font-family: arial; padding: 0px 10px;">
 <body style="font-family: arial; padding: 0px 10px;">
@@ -34,10 +40,6 @@
     <hr>
     <hr>
     <p id=progress></p>
     <p id=progress></p>
 
 
-<script type="text/javascript" src="common.js?v=$COMMIT_HASH"></script>
-<script type="text/javascript" src="jszip.min.js?v=$COMMIT_HASH"></script>
-<script type="text/javascript" src="FileSaver.min.js?v=$COMMIT_HASH"></script>
-
 <script type="text/javascript">
 <script type="text/javascript">
 function startExportData() {  
 function startExportData() {  
     document.getElementById("progress").innerHTML = "Creating Export Data...<br>\n";
     document.getElementById("progress").innerHTML = "Creating Export Data...<br>\n";
@@ -45,7 +47,7 @@ function startExportData() {
     // Get hostname
     // Get hostname
     try {
     try {
         var xhttp = new XMLHttpRequest();
         var xhttp = new XMLHttpRequest();
-        xhttp.open("GET", getDomainname() + "/info?type=Hostname", false);
+        xhttp.open("GET", domainname + "/info?type=Hostname", false);
         xhttp.send();
         xhttp.send();
         hostname = xhttp.responseText;
         hostname = xhttp.responseText;
     }
     }
@@ -64,7 +66,7 @@ function startExportData() {
     setStatus("Fetching File List...");
     setStatus("Fetching File List...");
     try {
     try {
         var xhttp = new XMLHttpRequest();
         var xhttp = new XMLHttpRequest();
-        xhttp.open("GET", getDomainname() + "/fileserver/log/data/", false);
+        xhttp.open("GET", domainname + "/fileserver/log/data/", false);
         xhttp.send();
         xhttp.send();
         
         
         var parser = new DOMParser();
         var parser = new DOMParser();
@@ -81,7 +83,7 @@ function startExportData() {
     
     
     for (a of list) {
     for (a of list) {
         url = a.getAttribute("href");
         url = a.getAttribute("href");
-        urls.push(getDomainname() + url);
+        urls.push(domainname + url);
     }
     }
     
     
     // Pack as zip and download
     // Pack as zip and download
@@ -204,4 +206,4 @@ function getFilenameFromUrl(url) {
 
 
 </script>
 </script>
 </body>
 </body>
-</html>
+</html>

+ 8 - 14
sd-card/html/edit_alignment.html

@@ -99,6 +99,10 @@
     <script type="text/javascript" src="jquery-3.6.0.min.js?v=$COMMIT_HASH"></script>
     <script type="text/javascript" src="jquery-3.6.0.min.js?v=$COMMIT_HASH"></script>
     <script type="text/javascript" src="firework.js?v=$COMMIT_HASH"></script>
     <script type="text/javascript" src="firework.js?v=$COMMIT_HASH"></script>
 
 
+    <script type="text/javascript" src="readconfigparam.js?v=$COMMIT_HASH"></script>
+    <script type="text/javascript" src="readconfigcommon.js?v=$COMMIT_HASH"></script>
+
+    <script type="text/javascript">var domainname = getDomainname();</script>
 </head>
 </head>
 
 
 <body style="font-family: arial; padding: 0px 10px;">
 <body style="font-family: arial; padding: 0px 10px;">
@@ -181,9 +185,6 @@
         </tr>
         </tr>
     </table>
     </table>
 
 
-    <script type="text/javascript" src="readconfigparam.js?v=$COMMIT_HASH"></script>
-    <script type="text/javascript" src="readconfigcommon.js?v=$COMMIT_HASH"></script>
-
     <script type="text/javascript">
     <script type="text/javascript">
         var canvas = document.getElementById('canvas'),
         var canvas = document.getElementById('canvas'),
             ctx = canvas.getContext('2d'),
             ctx = canvas.getContext('2d'),
@@ -193,10 +194,9 @@
             aktindex = 0,
             aktindex = 0,
             refInfo,
             refInfo,
             enhanceCon = false,
             enhanceCon = false,
-            domainname = getDomainname(),
             neueref1,
             neueref1,
             neueref2,
             neueref2,
-            cofcat,	
+            category,	
             param;
             param;
     
     
         function doReboot() {
         function doReboot() {
@@ -314,7 +314,7 @@
                             xhttp.open("GET", domainname + "/statusflow", false);
                             xhttp.open("GET", domainname + "/statusflow", false);
                             xhttp.send();
                             xhttp.send();
                         }
                         }
-                        catch (error){}
+                        catch (error){ console.log(error); }
 
 
                         document.getElementById("overlaytext").innerHTML = "Device is busy, waiting until the Digitization Round got completed (this can take several minutes)...<br><br>Current step: " + xhttp.responseText;
                         document.getElementById("overlaytext").innerHTML = "Device is busy, waiting until the Digitization Round got completed (this can take several minutes)...<br><br>Current step: " + xhttp.responseText;
                         console.log("Device is busy, waiting 5s then checking again...");
                         console.log("Device is busy, waiting 5s then checking again...");
@@ -429,14 +429,8 @@
             EnDisableItem(false, "savemarker", true);
             EnDisableItem(false, "savemarker", true);
             EnDisableItem(false, "enhancecontrast", true);
             EnDisableItem(false, "enhancecontrast", true);
 
 
-            if (!loadConfig(domainname)) {
-                firework.launch('Configuration could not be loaded! Please reload the page!', 'danger', 30000);
-                return;
-            }
-
-            ParseConfig();
             param = getConfigParameters();
             param = getConfigParameters();
-            cofcat = getConfigCategory();
+            category = getConfigCategory();
 
 
             canvas.addEventListener('mousedown', mouseDown, false);
             canvas.addEventListener('mousedown', mouseDown, false);
             canvas.addEventListener('mouseup', mouseUp, false);
             canvas.addEventListener('mouseup', mouseUp, false);
@@ -515,7 +509,7 @@
                             xhttp.open("GET", domainname + "/statusflow", false);
                             xhttp.open("GET", domainname + "/statusflow", false);
                             xhttp.send();
                             xhttp.send();
                         }
                         }
-                        catch (error){}
+                        catch (error){ console.log(error); }
 
 
                         document.getElementById("overlaytext").innerHTML = "Device is busy, waiting until the Digitization Round got completed (this can take several minutes)...<br><br>Current step: " + xhttp.responseText;
                         document.getElementById("overlaytext").innerHTML = "Device is busy, waiting until the Digitization Round got completed (this can take several minutes)...<br><br>Current step: " + xhttp.responseText;
                         console.log("Device is busy, waiting 5s then checking again...");
                         console.log("Device is busy, waiting 5s then checking again...");

+ 13 - 23
sd-card/html/edit_analog.html

@@ -25,6 +25,11 @@
     <script type="text/javascript" src="common.js?v=$COMMIT_HASH"></script>
     <script type="text/javascript" src="common.js?v=$COMMIT_HASH"></script>
     <script type="text/javascript" src="jquery-3.6.0.min.js?v=$COMMIT_HASH"></script>
     <script type="text/javascript" src="jquery-3.6.0.min.js?v=$COMMIT_HASH"></script>
     <script type="text/javascript" src="firework.js?v=$COMMIT_HASH"></script>
     <script type="text/javascript" src="firework.js?v=$COMMIT_HASH"></script>
+	
+    <script type="text/javascript" src="readconfigparam.js?v=$COMMIT_HASH"></script>
+    <script type="text/javascript" src="readconfigcommon.js?v=$COMMIT_HASH"></script>
+
+    <script type="text/javascript">var domainname = getDomainname();</script>
 </head>
 </head>
 
 
 <body style="font-family: arial; padding: 0px 10px;">
 <body style="font-family: arial; padding: 0px 10px;">
@@ -178,10 +183,6 @@ The following settings are only used for easier setup, they are <b>not</b> persi
         </tr>
         </tr>
     </table>
     </table>
 
 
-
-<script type="text/javascript" src="readconfigparam.js?v=$COMMIT_HASH"></script>
-<script type="text/javascript" src="readconfigcommon.js?v=$COMMIT_HASH"></script>
-
 <script type="text/javascript">
 <script type="text/javascript">
     var canvas = document.getElementById('canvas'),
     var canvas = document.getElementById('canvas'),
         ctx = canvas.getContext('2d'),
         ctx = canvas.getContext('2d'),
@@ -190,17 +191,16 @@ The following settings are only used for easier setup, they are <b>not</b> persi
         drag = false,
         drag = false,
         aktindex = 0,
         aktindex = 0,
         ROIInfo,
         ROIInfo,
-        cofcat,
+        category,
         param,
         param,
         _roialt = "ana",
         _roialt = "ana",
         enhanceCon = false,
         enhanceCon = false,
         lockAspectRatio = true,
         lockAspectRatio = true,
         lockSizes = false,
         lockSizes = false,
-        drawFromCenter = true,
-        domainname = getDomainname();
+        drawFromCenter = true;
 
 
     function doReboot() {
     function doReboot() {
-        var stringota = getDomainname() + "/reboot";
+        var stringota = domainname + "/reboot";
         window.location = stringota;
         window.location = stringota;
         window.location.href = stringota;
         window.location.href = stringota;
         window.location.assign(stringota);
         window.location.assign(stringota);
@@ -222,7 +222,7 @@ The following settings are only used for easier setup, they are <b>not</b> persi
 		
 		
         sah1(document.getElementById("div1"), !isEnabled);
         sah1(document.getElementById("div1"), !isEnabled);
 
 
-        cofcat["Analog"]["enabled"] = isEnabled;
+        category["Analog"]["enabled"] = isEnabled;
         document.getElementById("saveroi").disabled = false;
         document.getElementById("saveroi").disabled = false;
                 
                 
         if (isEnabled) {
         if (isEnabled) {
@@ -348,8 +348,7 @@ The following settings are only used for easier setup, they are <b>not</b> persi
     }
     }
 
 
     function SaveToConfig() {
     function SaveToConfig() {
-        //_zwcat = getConfigCategory();
-        cofcat["Analog"]["enabled"] = document.getElementById("Category_Analog_enabled").checked;
+        category["Analog"]["enabled"] = document.getElementById("Category_Analog_enabled").checked;
         WriteConfigININew();
         WriteConfigININew();
         SaveConfigToServer(domainname);
         SaveConfigToServer(domainname);
         UpdateROIs();
         UpdateROIs();
@@ -412,16 +411,14 @@ The following settings are only used for easier setup, they are <b>not</b> persi
         }
         }
     }
     }
 
 
-
     function UpdateROIs(_sel){
     function UpdateROIs(_sel){
         document.getElementById("Category_Analog_enabled").checked = true;
         document.getElementById("Category_Analog_enabled").checked = true;
         var sel = document.getElementById("Numbers_value1");
         var sel = document.getElementById("Numbers_value1");
         var _number = sel.options[sel.selectedIndex].text;
         var _number = sel.options[sel.selectedIndex].text;
 
 
         ROIInfo = getROIInfo("analog", _number);
         ROIInfo = getROIInfo("analog", _number);
-        // _catzw = getConfigCategory();
 
 
-        if (cofcat["Analog"]["enabled"] == false) {
+        if (category["Analog"]["enabled"] == false) {
             document.getElementById("Category_Analog_enabled").checked = false;
             document.getElementById("Category_Analog_enabled").checked = false;
             EnDisableAnalog();
             EnDisableAnalog();
             firework.launch('Analog ROI processing is disabled. Activate with checkbox if needed', 'warning', 10000);
             firework.launch('Analog ROI processing is disabled. Activate with checkbox if needed', 'warning', 10000);
@@ -558,16 +555,9 @@ The following settings are only used for easier setup, they are <b>not</b> persi
     
     
     function init() {
     function init() {
         openDescription();
         openDescription();
-        domainname = getDomainname();
-		
-		if (!loadConfig(domainname)) {
-			firework.launch('Configuration could not be loaded! Please reload the page!', 'danger', 30000);
-			return;
-		}
-	
-        ParseConfig();
+
         param = getConfigParameters(); 
         param = getConfigParameters(); 
-        cofcat = getConfigCategory();
+        category = getConfigCategory();
 		
 		
         canvas.addEventListener('mousedown', mouseDown, false);
         canvas.addEventListener('mousedown', mouseDown, false);
         canvas.addEventListener('mouseup', mouseUp, false);
         canvas.addEventListener('mouseup', mouseUp, false);

+ 12 - 10
sd-card/html/edit_config_raw.html

@@ -39,6 +39,11 @@
 <script type="text/javascript" src="common.js?v=$COMMIT_HASH"></script>
 <script type="text/javascript" src="common.js?v=$COMMIT_HASH"></script>
 <script type="text/javascript" src="jquery-3.6.0.min.js?v=$COMMIT_HASH"></script>
 <script type="text/javascript" src="jquery-3.6.0.min.js?v=$COMMIT_HASH"></script>
 <script type="text/javascript" src="firework.js?v=$COMMIT_HASH"></script>
 <script type="text/javascript" src="firework.js?v=$COMMIT_HASH"></script>
+
+<script type="text/javascript" src="readconfigparam.js?v=$COMMIT_HASH"></script>
+<script type="text/javascript" src="readconfigcommon.js?v=$COMMIT_HASH"></script>
+	
+<script type="text/javascript">var domainname = getDomainname();</script>
 </head>
 </head>
 
 
 <body style="font-family: arial; padding: 0px 10px;">
 <body style="font-family: arial; padding: 0px 10px;">
@@ -53,17 +58,15 @@
 	<hr>
 	<hr>
 	<button class="button" onclick="saveTextAsFile()">Save Config</button>
 	<button class="button" onclick="saveTextAsFile()">Save Config</button>
 
 
-	<script type="text/javascript" src="readconfigparam.js?v=$COMMIT_HASH"></script>
-	<script type="text/javascript" src="readconfigcommon.js?v=$COMMIT_HASH"></script>
-
 	<script type="text/javascript">
 	<script type="text/javascript">
 		var canvas = document.getElementById('canvas'),
 		var canvas = document.getElementById('canvas'),
-			domainname = getDomainname(); 
-
-
+			param,
+			category;
+		
 	function LoadConfigNeu() {
 	function LoadConfigNeu() {
-		domainname = getDomainname();  
-		loadConfig(domainname); 	
+        param = getConfigParameters();
+        category = getConfigCategory();
+		
 		document.getElementById("inputTextToSave").value = getConfig();
 		document.getElementById("inputTextToSave").value = getConfig();
 		}
 		}
 
 
@@ -87,6 +90,5 @@
 	LoadConfigNeu();
 	LoadConfigNeu();
 	
 	
 	</script>
 	</script>
- 
 </body>
 </body>
-</html>
+</html>

+ 25 - 28
sd-card/html/edit_config_template.html

@@ -130,6 +130,7 @@
     }
     }
 
 
     .tooltip {
     .tooltip {
+        min-width:15px;
         position: relative;
         position: relative;
         display: inline-block;
         display: inline-block;
     }
     }
@@ -211,6 +212,7 @@
 <script type="text/javascript" src="readconfigparam.js?v=$COMMIT_HASH"></script>
 <script type="text/javascript" src="readconfigparam.js?v=$COMMIT_HASH"></script>
 <script type="text/javascript" src="readconfigcommon.js?v=$COMMIT_HASH"></script> 
 <script type="text/javascript" src="readconfigcommon.js?v=$COMMIT_HASH"></script> 
 
 
+<script type="text/javascript">var domainname = getDomainname();</script>
 </head>
 </head>
 
 
 <body style="font-family: arial; padding: 0px 10px;">
 <body style="font-family: arial; padding: 0px 10px;">
@@ -250,9 +252,9 @@
 <div id="divall" style="display:none">
 <div id="divall" style="display:none">
     <table class="table">
     <table class="table">
         <colgroup>
         <colgroup>
-            <col span="1" style="width:290px">
-            <col span="1" style="width:300px;">
-            <col span="1">
+            <col span="1" style="width:50%;">
+            <col span="1" style="width:47%;">
+            <col span="1" style="width:3%;">
         </colgroup>
         </colgroup>
 
 
         <tr style="border-bottom: 2px solid lightgray;">
         <tr style="border-bottom: 2px solid lightgray;">
@@ -774,7 +776,7 @@
                     <option value="false" selected>disabled (false)</option>
                     <option value="false" selected>disabled (false)</option>
                 </select>
                 </select>
             </td>
             </td>
-            <td>$TOOLTIP_Alignment_Antialiasing</td>
+            <td class="tooltip" style="display:none;"></td>
         </tr>
         </tr>
 
 
         <tr class="expert">
         <tr class="expert">
@@ -928,24 +930,24 @@
             <td>$TOOLTIP_PostProcessing_PreValueAgeStartup</td>
             <td>$TOOLTIP_PostProcessing_PreValueAgeStartup</td>
         </tr>
         </tr>
 
 
+        <tr style="margin-top:12px">
+            <td class="indent1" style="padding-top:25px" colspan="3">
+                <b>The following parameters are configurable individually for each number sequence:</b>
+                <select style="font-weight: bold; margin-left:17px" id="Numbers_value1" onchange="numberChanged()"></select>
+            </td>
+        </tr>
+
         <tr class="expert">
         <tr class="expert">
-            <td class="indent1">
-                <class id="PostProcessing_ErrorMessage_text" style="color:black;">Skip Messages on Error</class>
+            <td class="indent2">
+                <class id="PostProcessing_SkipErrorMessage_text" style="color:black;">Skip Messages on Error</class>
             </td>
             </td>
             <td>
             <td>
-                <select id="PostProcessing_ErrorMessage_value1">
+                <select id="PostProcessing_SkipErrorMessage_value1">
                     <option value="true">enabled (true)</option>
                     <option value="true">enabled (true)</option>
                     <option value="false" selected>disabled (false)</option>
                     <option value="false" selected>disabled (false)</option>
                 </select>
                 </select>
             </td>
             </td>
-            <td>$TOOLTIP_PostProcessing_ErrorMessage</td>
-        </tr>
-
-        <tr style="margin-top:12px">
-            <td class="indent1" style="padding-top:25px" colspan="3">
-                <b>The following parameters are configurable individually for each number sequence:</b>
-                <select style="font-weight: bold; margin-left:17px" id="Numbers_value1" onchange="numberChanged()"></select>
-            </td>
+            <td>$TOOLTIP_PostProcessing_NUMBER.SkipErrorMessage</td>
         </tr>
         </tr>
 
 
         <tr>
         <tr>
@@ -1213,13 +1215,13 @@
 
 
         <tr class="MQTTItem">
         <tr class="MQTTItem">
             <td class="indent2">
             <td class="indent2">
-                <input type="checkbox" id="MQTT_DiscoveryPrefix_enabled" value="1"  onclick = 'InvertEnableItem("MQTT", "DiscoveryPrefix")' unchecked >
+                <input type="checkbox" id="MQTT_DiscoveryPrefix_enabled" value="homeassistant"  onclick = 'InvertEnableItem("MQTT", "DiscoveryPrefix")' unchecked >
                 <label for=MQTT_DiscoveryPrefix_enabled><class id="MQTT_DiscoveryPrefix_text" style="color:black;">Discovery Prefix</class></label>
                 <label for=MQTT_DiscoveryPrefix_enabled><class id="MQTT_DiscoveryPrefix_text" style="color:black;">Discovery Prefix</class></label>
             </td>
             </td>
             <td>
             <td>
                 <input required type="text" id="MQTT_DiscoveryPrefix_value1">
                 <input required type="text" id="MQTT_DiscoveryPrefix_value1">
             </td>
             </td>
-            <td>$TOOLTIP_MQTT_DiscoveryPrefix</td>
+            <td class="tooltip" style="display:none;"></td>
         </tr>
         </tr>
 
 
         <tr class="MQTTItem">
         <tr class="MQTTItem">
@@ -2172,7 +2174,6 @@
 
 
 <script type="text/javascript">
 <script type="text/javascript">
 var canvas = document.getElementById('canvas'),
 var canvas = document.getElementById('canvas'),
-    domainname = getDomainname(),
     changeCamValue = 0,	
     changeCamValue = 0,	
     param,
     param,
     category,
     category,
@@ -2203,13 +2204,9 @@ function cameraParameterChanged() {
 }
 }
 
 
 function LoadConfigNeu() {
 function LoadConfigNeu() {
-    if (!loadConfig(domainname)) {
-        firework.launch('Configuration could not be loaded! Please reload the page!', 'danger', 30000);
-        return;
-    }
-	
-    param = getCamConfig();
+    param = getConfigParameters();
     category = getConfigCategory();
     category = getConfigCategory();
+	
     InitIndivParameter();
     InitIndivParameter();
 
 
     UpdateInput();
     UpdateInput();
@@ -2302,6 +2299,7 @@ function UpdateInputIndividual(sel) {
         ReadParameter(param, "PostProcessing", "MaxRateType", true, NUNBERSAkt);
         ReadParameter(param, "PostProcessing", "MaxRateType", true, NUNBERSAkt);
         ReadParameter(param, "PostProcessing", "ExtendedResolution", false, NUNBERSAkt);
         ReadParameter(param, "PostProcessing", "ExtendedResolution", false, NUNBERSAkt);
         ReadParameter(param, "PostProcessing", "IgnoreLeadingNaN", false, NUNBERSAkt);
         ReadParameter(param, "PostProcessing", "IgnoreLeadingNaN", false, NUNBERSAkt);
+        ReadParameter(param, "PostProcessing", "SkipErrorMessage", false, NUNBERSAkt);
         ReadParameter(param, "PostProcessing", "AllowNegativeRates", false, NUNBERSAkt);
         ReadParameter(param, "PostProcessing", "AllowNegativeRates", false, NUNBERSAkt);
         ReadParameter(param, "InfluxDB", "Field", true, NUNBERSAkt);
         ReadParameter(param, "InfluxDB", "Field", true, NUNBERSAkt);
         ReadParameter(param, "InfluxDBv2", "Field", true, NUNBERSAkt);
         ReadParameter(param, "InfluxDBv2", "Field", true, NUNBERSAkt);
@@ -2321,6 +2319,7 @@ function UpdateInputIndividual(sel) {
     WriteParameter(param, category, "PostProcessing", "MaxRateType", true, NUNBERSAkt);
     WriteParameter(param, category, "PostProcessing", "MaxRateType", true, NUNBERSAkt);
     WriteParameter(param, category, "PostProcessing", "ExtendedResolution", false, NUNBERSAkt);
     WriteParameter(param, category, "PostProcessing", "ExtendedResolution", false, NUNBERSAkt);
     WriteParameter(param, category, "PostProcessing", "IgnoreLeadingNaN", false, NUNBERSAkt);
     WriteParameter(param, category, "PostProcessing", "IgnoreLeadingNaN", false, NUNBERSAkt);
+    WriteParameter(param, category, "PostProcessing", "SkipErrorMessage", false, NUNBERSAkt);
     WriteParameter(param, category, "PostProcessing", "AllowNegativeRates", false, NUNBERSAkt);
     WriteParameter(param, category, "PostProcessing", "AllowNegativeRates", false, NUNBERSAkt);
     WriteParameter(param, category, "InfluxDB", "Field", true, NUNBERSAkt);
     WriteParameter(param, category, "InfluxDB", "Field", true, NUNBERSAkt);
     WriteParameter(param, category, "InfluxDBv2", "Field", true, NUNBERSAkt);
     WriteParameter(param, category, "InfluxDBv2", "Field", true, NUNBERSAkt);
@@ -2405,7 +2404,6 @@ function UpdateInput() {
     
     
     WriteParameter(param, category, "PostProcessing", "PreValueUse", false);		
     WriteParameter(param, category, "PostProcessing", "PreValueUse", false);		
     WriteParameter(param, category, "PostProcessing", "PreValueAgeStartup", true);		
     WriteParameter(param, category, "PostProcessing", "PreValueAgeStartup", true);		
-    WriteParameter(param, category, "PostProcessing", "ErrorMessage", false);
 
 
     WriteParameter(param, category, "MQTT", "Uri", true);	
     WriteParameter(param, category, "MQTT", "Uri", true);	
     WriteParameter(param, category, "MQTT", "MainTopic", true);	
     WriteParameter(param, category, "MQTT", "MainTopic", true);	
@@ -2579,7 +2577,6 @@ function ReadParameterAll() {
 
 
     ReadParameter(param, "PostProcessing", "PreValueUse", false);
     ReadParameter(param, "PostProcessing", "PreValueUse", false);
     ReadParameter(param, "PostProcessing", "PreValueAgeStartup", true);
     ReadParameter(param, "PostProcessing", "PreValueAgeStartup", true);
-    ReadParameter(param, "PostProcessing", "ErrorMessage", false);
 
 
     ReadParameter(param, "MQTT", "Uri", true);
     ReadParameter(param, "MQTT", "Uri", true);
     ReadParameter(param, "MQTT", "MainTopic", true);
     ReadParameter(param, "MQTT", "MainTopic", true);
@@ -2936,7 +2933,7 @@ function camSettingsSet(){
             try {
             try {
                 xhttp.open("GET", url, false);
                 xhttp.open("GET", url, false);
                 xhttp.send();			
                 xhttp.send();			
-            } catch (error){}				
+            } catch (error){ console.log(error); }				
             
             
             if (xhttp.responseText == "CamSettingsSet") {
             if (xhttp.responseText == "CamSettingsSet") {
                 document.getElementById("overlay").style.display = "none";
                 document.getElementById("overlay").style.display = "none";
@@ -2952,7 +2949,7 @@ function camSettingsSet(){
                     _xhttp.open("GET", domainname + "/statusflow", false);
                     _xhttp.open("GET", domainname + "/statusflow", false);
                     _xhttp.send();
                     _xhttp.send();
                 }
                 }
-                catch (error){}
+                catch (error){ console.log(error); }
 
 
                 document.getElementById("overlaytext").innerHTML = "Device is busy, please wait.<br><br>Current step: " + _xhttp.responseText;
                 document.getElementById("overlaytext").innerHTML = "Device is busy, please wait.<br><br>Current step: " + _xhttp.responseText;
                 console.log("Device is busy, waiting 2s then checking again...");
                 console.log("Device is busy, waiting 2s then checking again...");

+ 13 - 21
sd-card/html/edit_digits.html

@@ -25,6 +25,10 @@
     <script type="text/javascript" src="jquery-3.6.0.min.js?v=$COMMIT_HASH"></script>
     <script type="text/javascript" src="jquery-3.6.0.min.js?v=$COMMIT_HASH"></script>
     <script type="text/javascript" src="firework.js?v=$COMMIT_HASH"></script>
     <script type="text/javascript" src="firework.js?v=$COMMIT_HASH"></script>
 
 
+    <script type="text/javascript" src="readconfigparam.js?v=$COMMIT_HASH"></script>
+    <script type="text/javascript" src="readconfigcommon.js?v=$COMMIT_HASH"></script>
+
+    <script type="text/javascript">var domainname = getDomainname();</script>
 </head>
 </head>
 
 
 <body style="font-family: arial; padding: 0px 10px;">
 <body style="font-family: arial; padding: 0px 10px;">
@@ -195,10 +199,6 @@
         </tr>
         </tr>
     </table>
     </table>
 
 
-
-<script type="text/javascript" src="readconfigparam.js?v=$COMMIT_HASH"></script>
-<script type="text/javascript" src="readconfigcommon.js?v=$COMMIT_HASH"></script>
-
 <script type="text/javascript">
 <script type="text/javascript">
     var canvas = document.getElementById('canvas'),
     var canvas = document.getElementById('canvas'),
         imageObj = new Image(),
         imageObj = new Image(),
@@ -206,18 +206,17 @@
         drag = false,
         drag = false,
         aktindex = 0,
         aktindex = 0,
         ROIInfo,
         ROIInfo,
-        cofcat,
+        category,
         param,
         param,
         _roialt = "dig",
         _roialt = "dig",
         enhanceCon = false,
         enhanceCon = false,
         lockAspectRatio = true,
         lockAspectRatio = true,
         lockSizes = false,
         lockSizes = false,
         lockSpaceEquidistant = true,
         lockSpaceEquidistant = true,
-        space = 3,
-        domainname = getDomainname();
+        space = 3;
 
 
     function doReboot() {
     function doReboot() {
-        var stringota = getDomainname() + "/reboot";
+        var stringota = domainname + "/reboot";
         window.location = stringota;
         window.location = stringota;
         window.location.href = stringota;
         window.location.href = stringota;
         window.location.assign(stringota);
         window.location.assign(stringota);
@@ -239,7 +238,7 @@
 		
 		
         sah1(document.getElementById("div1"), !isEnabled);
         sah1(document.getElementById("div1"), !isEnabled);
 
 
-        cofcat["Digits"]["enabled"] = isEnabled;
+        category["Digits"]["enabled"] = isEnabled;
         document.getElementById("saveroi").disabled = false;
         document.getElementById("saveroi").disabled = false;
                 
                 
         if (isEnabled) {
         if (isEnabled) {
@@ -371,7 +370,7 @@
 
 
     function SaveToConfig() {
     function SaveToConfig() {
         // _zwcat = getConfigCategory();
         // _zwcat = getConfigCategory();
-        cofcat["Digits"]["enabled"] = document.getElementById("Category_Digits_enabled").checked;
+        category["Digits"]["enabled"] = document.getElementById("Category_Digits_enabled").checked;
         WriteConfigININew();
         WriteConfigININew();
         SaveConfigToServer(domainname);
         SaveConfigToServer(domainname);
         UpdateROIs();
         UpdateROIs();
@@ -423,7 +422,7 @@
         ROIInfo = getROIInfo("digit", _number);
         ROIInfo = getROIInfo("digit", _number);
         // _catzw = getConfigCategory();
         // _catzw = getConfigCategory();
 
 
-        if (cofcat["Digits"]["enabled"] == false)  {
+        if (category["Digits"]["enabled"] == false)  {
             document.getElementById("Category_Digits_enabled").checked = false;
             document.getElementById("Category_Digits_enabled").checked = false;
             EnDisableDigits();
             EnDisableDigits();
             firework.launch('Digit ROI processing is disabled. Activate with checkbox if needed', 'warning', 10000);
             firework.launch('Digit ROI processing is disabled. Activate with checkbox if needed', 'warning', 10000);
@@ -569,16 +568,9 @@
     
     
     function init() {
     function init() {
         openDescription();
         openDescription();
-        domainname = getDomainname();
-		
-		if (!loadConfig(domainname)) {
-			firework.launch('Configuration could not be loaded! Please reload the page!', 'danger', 30000);
-			return;
-		}
-		
-        ParseConfig();
-        param = getConfigParameters(); 
-        cofcat = getConfigCategory();
+
+        param = getConfigParameters();
+        category = getConfigCategory();
 		
 		
         canvas.addEventListener('mousedown', mouseDown, false);
         canvas.addEventListener('mousedown', mouseDown, false);
         canvas.addEventListener('mouseup', mouseUp, false);
         canvas.addEventListener('mouseup', mouseUp, false);

+ 14 - 18
sd-card/html/edit_reference.html

@@ -51,6 +51,7 @@
         }
         }
 
 
         .tooltip {
         .tooltip {
+            min-width:15px;
             position: relative;
             position: relative;
             display: inline-block;
             display: inline-block;
         }
         }
@@ -117,6 +118,10 @@
     <script type="text/javascript" src="jquery-3.6.0.min.js?v=$COMMIT_HASH"></script>
     <script type="text/javascript" src="jquery-3.6.0.min.js?v=$COMMIT_HASH"></script>
     <script type="text/javascript" src="firework.js?v=$COMMIT_HASH"></script>
     <script type="text/javascript" src="firework.js?v=$COMMIT_HASH"></script>
 
 
+    <script type="text/javascript" src="readconfigparam.js?v=$COMMIT_HASH"></script>
+    <script type="text/javascript" src="readconfigcommon.js?v=$COMMIT_HASH"></script>
+	
+    <script type="text/javascript">var domainname = getDomainname();</script>
 </head>
 </head>
 
 
 <body style="font-family: arial; padding: 0px 10px;">
 <body style="font-family: arial; padding: 0px 10px;">
@@ -160,11 +165,11 @@
 
 
     <table style="width: 100%">
     <table style="width: 100%">
         <colgroup>
         <colgroup>
-            <col span="1" style="width: 12%;">
-            <col span="1" style="width: 15%;">
+            <col span="1" style="width: 22%;">
+            <col span="1" style="width: 25%;">
             <col span="1" style="width: 3%;">
             <col span="1" style="width: 3%;">
-            <col span="1" style="width: 18%;">
-            <col span="1" style="width: 10%;">
+            <col span="1" style="width: 22%;">
+            <col span="1" style="width: 25%;">
             <col span="1" style="width: 3%;">
             <col span="1" style="width: 3%;">
         </colgroup>
         </colgroup>
 		
 		
@@ -389,12 +394,8 @@
     <b>Reference Image:</b><br>
     <b>Reference Image:</b><br>
     <canvas id="canvas"></canvas>
     <canvas id="canvas"></canvas>
 
 
-    <script type="text/javascript" src="readconfigparam.js?v=$COMMIT_HASH"></script>
-    <script type="text/javascript" src="readconfigcommon.js?v=$COMMIT_HASH"></script>
-
     <script type="text/javascript">
     <script type="text/javascript">
         var canvas = document.getElementById('canvas'),
         var canvas = document.getElementById('canvas'),
-        domainname = getDomainname(),
         context = canvas.getContext('2d'),
         context = canvas.getContext('2d'),
         imageObj = new Image(),
         imageObj = new Image(),
         isActReference = false,
         isActReference = false,
@@ -583,7 +584,7 @@
                     try {
                     try {
                         xhttp.open("GET", url, false);
                         xhttp.open("GET", url, false);
                         xhttp.send();
                         xhttp.send();
-                    } catch (error){}				
+                    } catch (error){ console.log(error); }				
             
             
                     if (xhttp.responseText != "DeviceIsBusy") {
                     if (xhttp.responseText != "DeviceIsBusy") {
                         var _url = domainname + "/img_tmp/raw.jpg" + "?session=" + Math.floor((Math.random() * 1000000) + 1);						
                         var _url = domainname + "/img_tmp/raw.jpg" + "?session=" + Math.floor((Math.random() * 1000000) + 1);						
@@ -604,7 +605,7 @@
                             _xhttp.open("GET", domainname + "/statusflow", false);
                             _xhttp.open("GET", domainname + "/statusflow", false);
                             _xhttp.send();
                             _xhttp.send();
                         }
                         }
-                        catch (error){}
+                        catch (error){ console.log(error); }
 
 
                         document.getElementById("overlaytext").innerHTML = "Device is busy, please wait.<br><br>Current step: " + _xhttp.responseText;
                         document.getElementById("overlaytext").innerHTML = "Device is busy, please wait.<br><br>Current step: " + _xhttp.responseText;
                         console.log("Device is busy, waiting 5s then checking again...");
                         console.log("Device is busy, waiting 5s then checking again...");
@@ -723,7 +724,7 @@
                     try {
                     try {
                         xhttp.open("GET", url, false);
                         xhttp.open("GET", url, false);
                         xhttp.send();
                         xhttp.send();
-                    } catch (error){}				
+                    } catch (error){ console.log(error); }				
             
             
                     if (xhttp.responseText == "CamSettingsSet") {
                     if (xhttp.responseText == "CamSettingsSet") {
 						document.getElementById("overlay").style.display = "none";
 						document.getElementById("overlay").style.display = "none";
@@ -739,7 +740,7 @@
                             _xhttp.open("GET", domainname + "/statusflow", false);
                             _xhttp.open("GET", domainname + "/statusflow", false);
                             _xhttp.send();
                             _xhttp.send();
                         }
                         }
-                        catch (error){}
+                        catch (error){ console.log(error); }
 
 
                         document.getElementById("overlaytext").innerHTML = "Device is busy, plase waiting...<br><br>Current step: " + _xhttp.responseText;
                         document.getElementById("overlaytext").innerHTML = "Device is busy, plase waiting...<br><br>Current step: " + _xhttp.responseText;
                         console.log("Device is busy, waiting 2s then checking again...");
                         console.log("Device is busy, waiting 2s then checking again...");
@@ -870,12 +871,7 @@
         function init() {
         function init() {
             openDescription();		
             openDescription();		
 	
 	
-            if (!loadConfig(domainname)) {
-				firework.launch('Configuration could not be loaded! Please reload the page!', 'danger', 30000);
-				return;
-            }		
-			
-            param = getCamConfig();
+			param = getConfigParameters();
 			category = getConfigCategory();
 			category = getConfigCategory();
 			
 			
 			canvas.addEventListener('mousemove', mouseMove, false);			
 			canvas.addEventListener('mousemove', mouseMove, false);			

+ 21 - 20
sd-card/html/graph.html

@@ -3,13 +3,7 @@
 <head>
 <head>
     <meta charset="UTF-8"/>
     <meta charset="UTF-8"/>
     <title>Data Graph</title>
     <title>Data Graph</title>
-	
-    <script type="text/javascript" src='plotly-basic-2.18.2.min.js?v=$COMMIT_HASH'></script>
 
 
-    <script type="text/javascript" src="common.js?v=$COMMIT_HASH"></script> 
-    <script type="text/javascript" src="readconfigcommon.js?v=$COMMIT_HASH"></script>  
-    <script type="text/javascript" src="readconfigparam.js?v=$COMMIT_HASH"></script>
-    
     <style>
     <style>
         h1 {font-size: 2em;}
         h1 {font-size: 2em;}
         h2 {font-size: 1.5em; margin-block-start: 0.0em; margin-block-end: 0.2em;}
         h2 {font-size: 1.5em; margin-block-start: 0.0em; margin-block-end: 0.2em;}
@@ -37,15 +31,26 @@
         }
         }
     </style>
     </style>
 
 
-    <script>
+    <script type="text/javascript" src='plotly-basic-2.18.2.min.js?v=$COMMIT_HASH'></script>
+
+    <script type="text/javascript" src="common.js?v=$COMMIT_HASH"></script> 
+    <script type="text/javascript" src="readconfigcommon.js?v=$COMMIT_HASH"></script>  
+    <script type="text/javascript" src="readconfigparam.js?v=$COMMIT_HASH"></script>
+
+    <link href="firework.css?v=$COMMIT_HASH" rel="stylesheet">
+    <script type="text/javascript" src="jquery-3.6.0.min.js?v=$COMMIT_HASH"></script>  
+    <script type="text/javascript" src="firework.js?v=$COMMIT_HASH"></script>
+
+    <script type="text/javascript">var domainname = getDomainname();</script>
+
+    <script type="text/javascript">
     function run() {
     function run() {
-        datefile = document.getElementById("datafiles").value;
-        numbername = document.getElementById("numbers").value;
-        showRrelativeValues = document.getElementById("showRrelativeValues").checked;
+        var datefile = document.getElementById("datafiles").value;
+        var numbername = document.getElementById("numbers").value;
+        var showRrelativeValues = document.getElementById("showRrelativeValues").checked;
         //alert("Auslesen: " + datefile + " " + numbername);
         //alert("Auslesen: " + datefile + " " + numbername);
 
 
-        _domainname = getDomainname();
-        fetch(_domainname + '/fileserver/log/data/' + datefile)
+        fetch(domainname + '/fileserver/log/data/' + datefile)
         .then(response => {
         .then(response => {
             // handle the response
             // handle the response
             if (response.status == 404) {
             if (response.status == 404) {
@@ -119,7 +124,6 @@
                     }
                     }
                 }
                 }
 
 
-
                 // Copy time to all traces
                 // Copy time to all traces
                 tracePreValue.x = traceValue.x;
                 tracePreValue.x = traceValue.x;
                 traceChangeRate.x = traceValue.x;
                 traceChangeRate.x = traceValue.x;
@@ -181,9 +185,6 @@
         });
         });
     }
     }
     </script>
     </script>
-    <link href="firework.css?v=$COMMIT_HASH" rel="stylesheet">
-    <script type="text/javascript" src="jquery-3.6.0.min.js?v=$COMMIT_HASH"></script>  
-    <script type="text/javascript" src="firework.js?v=$COMMIT_HASH"></script>
 </head>
 </head>
 
 
 <body>
 <body>
@@ -198,10 +199,10 @@
     <button class="button" onClick="window.location.href = 'data.html?v=$COMMIT_HASH'">Show Data Viewer</button>
     <button class="button" onClick="window.location.href = 'data.html?v=$COMMIT_HASH'">Show Data Viewer</button>
     <button class="button" onClick="window.location.href = getDomainname() + '/fileserver/log/data/'">Show Data Files</button>
     <button class="button" onClick="window.location.href = getDomainname() + '/fileserver/log/data/'">Show Data Files</button>
 
 
-<script>
+<script type="text/javascript">
     function WriteModelFiles()
     function WriteModelFiles()
     {
     {
-        list_data = getDATAList();
+        var list_data = getDATAList();
 
 
         var _indexDig = document.getElementById("datafiles");
         var _indexDig = document.getElementById("datafiles");
         while (_indexDig.length)
         while (_indexDig.length)
@@ -220,7 +221,7 @@
 
 
     function WriteNumbers()
     function WriteNumbers()
     {
     {
-        list_data = getNUMBERSList();
+        var list_data = getNUMBERSList();
 
 
         var _indexDig = document.getElementById("numbers");
         var _indexDig = document.getElementById("numbers");
         while (_indexDig.length)
         while (_indexDig.length)
@@ -251,4 +252,4 @@
     Refresh();
     Refresh();
 </script>
 </script>
 </body>
 </body>
-</html>
+</html>

+ 1 - 4
sd-card/html/index.html

@@ -252,11 +252,8 @@
         }
         }
     
     
         function HA_send_discovery_visibility()	{
         function HA_send_discovery_visibility()	{
-            loadConfig(domainname); 
-            ParseConfig();
-			
-            category = getConfigCategory();
             param = getConfigParameters();
             param = getConfigParameters();
+            category = getConfigCategory();
 		
 		
             if (category["MQTT"]["enabled"] && param["MQTT"]["HomeassistantDiscovery"].value1 == "true") {
             if (category["MQTT"]["enabled"] && param["MQTT"]["HomeassistantDiscovery"].value1 == "true") {
 		        document.getElementById("ManualControl").style.display="";
 		        document.getElementById("ManualControl").style.display="";

+ 22 - 25
sd-card/html/info.html

@@ -29,6 +29,7 @@ table {
 </style>
 </style>
 
 
 <script type="text/javascript" src="common.js?v=$COMMIT_HASH"></script> 
 <script type="text/javascript" src="common.js?v=$COMMIT_HASH"></script> 
+<script type="text/javascript">var domainname = getDomainname();</script>
 </head>
 </head>
 
 
 <body style="font-family: arial; padding: 0px 10px;">
 <body style="font-family: arial; padding: 0px 10px;">
@@ -107,7 +108,6 @@ table {
 		</tr>
 		</tr>
 	</table>
 	</table>
 
 
-
 	<table>
 	<table>
 		<colgroup>
 		<colgroup>
 			<col span="1" style="width: 35%;">
 			<col span="1" style="width: 35%;">
@@ -240,18 +240,13 @@ table {
 		</tr>
 		</tr>
 	</table>
 	</table>
 
 
-
 <h3>Copyright</h3>
 <h3>Copyright</h3>
 Copyright &copy; 2020 - 2024 by <a href="https://github.com/jomjol/AI-on-the-edge-device" target=_blank>Jomjol</a> and others.
 Copyright &copy; 2020 - 2024 by <a href="https://github.com/jomjol/AI-on-the-edge-device" target=_blank>Jomjol</a> and others.
 
 
-</body>
-</html>
-
 <script type="text/javascript">
 <script type="text/javascript">
-
 	function loadLastRestart() 
 	function loadLastRestart() 
 	{
 	{
-		url = getDomainname() + '/starttime';     
+		var url = domainname + '/starttime';     
 		var xhttp = new XMLHttpRequest();
 		var xhttp = new XMLHttpRequest();
 		xhttp.onreadystatechange = function() {
 		xhttp.onreadystatechange = function() {
 			if (this.readyState == 4 && this.status == 200) {
 			if (this.readyState == 4 && this.status == 200) {
@@ -271,7 +266,7 @@ Copyright &copy; 2020 - 2024 by <a href="https://github.com/jomjol/AI-on-the-edg
 
 
 	function loadUptime() 
 	function loadUptime() 
 	{
 	{
-		url = getDomainname() + '/uptime';     
+		var url = domainname + '/uptime';     
 		var xhttp = new XMLHttpRequest();
 		var xhttp = new XMLHttpRequest();
 		xhttp.onreadystatechange = function() {
 		xhttp.onreadystatechange = function() {
 			if (this.readyState == 4 && this.status == 200) {
 			if (this.readyState == 4 && this.status == 200) {
@@ -284,7 +279,7 @@ Copyright &copy; 2020 - 2024 by <a href="https://github.com/jomjol/AI-on-the-edg
 
 
 	function loadFWVersion() 
 	function loadFWVersion() 
 	{
 	{
-		url = getDomainname() + '/info?type=FirmwareVersion';     
+		var url = domainname + '/info?type=FirmwareVersion';     
 		var xhttp = new XMLHttpRequest();
 		var xhttp = new XMLHttpRequest();
 		xhttp.onreadystatechange = function() {
 		xhttp.onreadystatechange = function() {
 			if (this.readyState == 4 && this.status == 200) {
 			if (this.readyState == 4 && this.status == 200) {
@@ -297,7 +292,7 @@ Copyright &copy; 2020 - 2024 by <a href="https://github.com/jomjol/AI-on-the-edg
 
 
 	function loadFWBuildTime() 
 	function loadFWBuildTime() 
 	{
 	{
-		url = getDomainname() + '/info?type=BuildTime';     
+		var url = domainname + '/info?type=BuildTime';     
 		var xhttp = new XMLHttpRequest();
 		var xhttp = new XMLHttpRequest();
 		xhttp.onreadystatechange = function() {
 		xhttp.onreadystatechange = function() {
 			if (this.readyState == 4 && this.status == 200) {
 			if (this.readyState == 4 && this.status == 200) {
@@ -316,7 +311,7 @@ Copyright &copy; 2020 - 2024 by <a href="https://github.com/jomjol/AI-on-the-edg
 
 
 	function loadHTMLVersion() 
 	function loadHTMLVersion() 
 	{
 	{
-		url = getDomainname() + '/info?type=HTMLVersion';     
+		var url = domainname + '/info?type=HTMLVersion';     
 		var xhttp = new XMLHttpRequest();
 		var xhttp = new XMLHttpRequest();
 		xhttp.onreadystatechange = function() {
 		xhttp.onreadystatechange = function() {
 			if (this.readyState == 4 && this.status == 200) {
 			if (this.readyState == 4 && this.status == 200) {
@@ -329,7 +324,7 @@ Copyright &copy; 2020 - 2024 by <a href="https://github.com/jomjol/AI-on-the-edg
 
 
 	function loadHostname() 
 	function loadHostname() 
 	{
 	{
-		url = getDomainname() + '/info?type=Hostname';     
+		var url = domainname + '/info?type=Hostname';     
 		var xhttp = new XMLHttpRequest();
 		var xhttp = new XMLHttpRequest();
 		xhttp.onreadystatechange = function() {
 		xhttp.onreadystatechange = function() {
 			if (this.readyState == 4 && this.status == 200) {
 			if (this.readyState == 4 && this.status == 200) {
@@ -342,7 +337,7 @@ Copyright &copy; 2020 - 2024 by <a href="https://github.com/jomjol/AI-on-the-edg
 
 
 	function loadIPAddress() 
 	function loadIPAddress() 
 	{
 	{
-		url = getDomainname() + '/info?type=IP';     
+		var url = domainname + '/info?type=IP';     
 		var xhttp = new XMLHttpRequest();
 		var xhttp = new XMLHttpRequest();
 		xhttp.onreadystatechange = function() {
 		xhttp.onreadystatechange = function() {
 			if (this.readyState == 4 && this.status == 200) {
 			if (this.readyState == 4 && this.status == 200) {
@@ -355,7 +350,7 @@ Copyright &copy; 2020 - 2024 by <a href="https://github.com/jomjol/AI-on-the-edg
 
 
 	function loadWLANSSID() 
 	function loadWLANSSID() 
 	{
 	{
-		url = getDomainname() + '/info?type=SSID';     
+		var url = domainname + '/info?type=SSID';     
 		var xhttp = new XMLHttpRequest();
 		var xhttp = new XMLHttpRequest();
 		xhttp.onreadystatechange = function() {
 		xhttp.onreadystatechange = function() {
 			if (this.readyState == 4 && this.status == 200) {
 			if (this.readyState == 4 && this.status == 200) {
@@ -368,7 +363,7 @@ Copyright &copy; 2020 - 2024 by <a href="https://github.com/jomjol/AI-on-the-edg
 
 
 	function loadSDCardManufacturer() 
 	function loadSDCardManufacturer() 
 	{
 	{
-		url = getDomainname() + '/info?type=SDCardManufacturer';     
+		var url = domainname + '/info?type=SDCardManufacturer';     
 		var xhttp = new XMLHttpRequest();
 		var xhttp = new XMLHttpRequest();
 		xhttp.onreadystatechange = function() {
 		xhttp.onreadystatechange = function() {
 			if (this.readyState == 4 && this.status == 200) {
 			if (this.readyState == 4 && this.status == 200) {
@@ -381,7 +376,7 @@ Copyright &copy; 2020 - 2024 by <a href="https://github.com/jomjol/AI-on-the-edg
 
 
 	function loadSDCardName() 
 	function loadSDCardName() 
 	{
 	{
-		url = getDomainname() + '/info?type=SDCardName';     
+		var url = domainname + '/info?type=SDCardName';     
 		var xhttp = new XMLHttpRequest();
 		var xhttp = new XMLHttpRequest();
 		xhttp.onreadystatechange = function() {
 		xhttp.onreadystatechange = function() {
 			if (this.readyState == 4 && this.status == 200) {
 			if (this.readyState == 4 && this.status == 200) {
@@ -394,7 +389,7 @@ Copyright &copy; 2020 - 2024 by <a href="https://github.com/jomjol/AI-on-the-edg
 
 
 	function loadSDCardCapacity() 
 	function loadSDCardCapacity() 
 	{
 	{
-		url = getDomainname() + '/info?type=SDCardCapacity';     
+		var url = domainname + '/info?type=SDCardCapacity';     
 		var xhttp = new XMLHttpRequest();
 		var xhttp = new XMLHttpRequest();
 		xhttp.onreadystatechange = function() {
 		xhttp.onreadystatechange = function() {
 			if (this.readyState == 4 && this.status == 200) {
 			if (this.readyState == 4 && this.status == 200) {
@@ -407,7 +402,7 @@ Copyright &copy; 2020 - 2024 by <a href="https://github.com/jomjol/AI-on-the-edg
 
 
 	function loadSDCardSectorSize() 
 	function loadSDCardSectorSize() 
 	{
 	{
-		url = getDomainname() + '/info?type=SDCardSectorSize';     
+		var url = domainname + '/info?type=SDCardSectorSize';     
 		var xhttp = new XMLHttpRequest();
 		var xhttp = new XMLHttpRequest();
 		xhttp.onreadystatechange = function() {
 		xhttp.onreadystatechange = function() {
 			if (this.readyState == 4 && this.status == 200) {
 			if (this.readyState == 4 && this.status == 200) {
@@ -420,7 +415,7 @@ Copyright &copy; 2020 - 2024 by <a href="https://github.com/jomjol/AI-on-the-edg
 
 
 	function loadSDCardPartitionSize() 
 	function loadSDCardPartitionSize() 
 	{
 	{
-		url = getDomainname() + '/info?type=SDCardPartitionSize';     
+		var url = domainname + '/info?type=SDCardPartitionSize';     
 		var xhttp = new XMLHttpRequest();
 		var xhttp = new XMLHttpRequest();
 		xhttp.onreadystatechange = function() {
 		xhttp.onreadystatechange = function() {
 			if (this.readyState == 4 && this.status == 200) {
 			if (this.readyState == 4 && this.status == 200) {
@@ -433,7 +428,7 @@ Copyright &copy; 2020 - 2024 by <a href="https://github.com/jomjol/AI-on-the-edg
 
 
 	function loadSDCardFreePartitionSpace() 
 	function loadSDCardFreePartitionSpace() 
 	{
 	{
-		url = getDomainname() + '/info?type=SDCardFreePartitionSpace';     
+		var url = domainname + '/info?type=SDCardFreePartitionSpace';     
 		var xhttp = new XMLHttpRequest();
 		var xhttp = new XMLHttpRequest();
 		xhttp.onreadystatechange = function() {
 		xhttp.onreadystatechange = function() {
 			if (this.readyState == 4 && this.status == 200) {
 			if (this.readyState == 4 && this.status == 200) {
@@ -446,7 +441,7 @@ Copyright &copy; 2020 - 2024 by <a href="https://github.com/jomjol/AI-on-the-edg
 
 
 	function loadSDCardPartitionAllocationSize() 
 	function loadSDCardPartitionAllocationSize() 
 	{
 	{
-		url = getDomainname() + '/info?type=SDCardPartitionAllocationSize';     
+		var url = domainname + '/info?type=SDCardPartitionAllocationSize';     
 		var xhttp = new XMLHttpRequest();
 		var xhttp = new XMLHttpRequest();
 		xhttp.onreadystatechange = function() {
 		xhttp.onreadystatechange = function() {
 			if (this.readyState == 4 && this.status == 200) {
 			if (this.readyState == 4 && this.status == 200) {
@@ -459,7 +454,7 @@ Copyright &copy; 2020 - 2024 by <a href="https://github.com/jomjol/AI-on-the-edg
 
 
 	function loadMemoryInfo() 
 	function loadMemoryInfo() 
 	{
 	{
-		url = getDomainname() + '/heap';     
+		var url = domainname + '/heap';     
 		var xhttp = new XMLHttpRequest();
 		var xhttp = new XMLHttpRequest();
 		xhttp.onreadystatechange = function() {
 		xhttp.onreadystatechange = function() {
 			if (this.readyState == 4 && this.status == 200) {
 			if (this.readyState == 4 && this.status == 200) {
@@ -479,7 +474,7 @@ Copyright &copy; 2020 - 2024 by <a href="https://github.com/jomjol/AI-on-the-edg
 
 
 	function loadChipCores() 
 	function loadChipCores() 
 	{
 	{
-		url = getDomainname() + '/info?type=ChipCores';     
+		var url = domainname + '/info?type=ChipCores';     
 		var xhttp = new XMLHttpRequest();
 		var xhttp = new XMLHttpRequest();
 		xhttp.onreadystatechange = function() {
 		xhttp.onreadystatechange = function() {
 			if (this.readyState == 4 && this.status == 200) {				
 			if (this.readyState == 4 && this.status == 200) {				
@@ -492,7 +487,7 @@ Copyright &copy; 2020 - 2024 by <a href="https://github.com/jomjol/AI-on-the-edg
 
 
 	function loadChipRevision() 
 	function loadChipRevision() 
 	{
 	{
-		url = getDomainname() + '/info?type=ChipRevision';     
+		var url = domainname + '/info?type=ChipRevision';     
 		var xhttp = new XMLHttpRequest();
 		var xhttp = new XMLHttpRequest();
 		xhttp.onreadystatechange = function() {
 		xhttp.onreadystatechange = function() {
 			if (this.readyState == 4 && this.status == 200) {				
 			if (this.readyState == 4 && this.status == 200) {				
@@ -505,7 +500,7 @@ Copyright &copy; 2020 - 2024 by <a href="https://github.com/jomjol/AI-on-the-edg
 
 
 	function loadChipFeatures() 
 	function loadChipFeatures() 
 	{
 	{
-		url = getDomainname() + '/info?type=ChipFeatures';     
+		var url = domainname + '/info?type=ChipFeatures';     
 		var xhttp = new XMLHttpRequest();
 		var xhttp = new XMLHttpRequest();
 		xhttp.onreadystatechange = function() {
 		xhttp.onreadystatechange = function() {
 			if (this.readyState == 4 && this.status == 200) {				
 			if (this.readyState == 4 && this.status == 200) {				
@@ -541,3 +536,5 @@ Copyright &copy; 2020 - 2024 by <a href="https://github.com/jomjol/AI-on-the-edg
 
 
 	init();
 	init();
 </script>
 </script>
+</body>
+</html>

+ 14 - 12
sd-card/html/log.html

@@ -40,33 +40,34 @@
                 font-size: 16px;
                 font-size: 16px;
             }
             }
         </style>
         </style>
-        <script type="text/javascript" src="common.js?v=$COMMIT_HASH"></script> 
+		
+        <script type="text/javascript" src="common.js?v=$COMMIT_HASH"></script>
+	    <script type="text/javascript">var domainname = getDomainname();</script>
     </head>
     </head>
+	
     <body>
     <body>
         <div class="box">
         <div class="box">
             <div class="row header">
             <div class="row header">
                 <button class="button" onClick="reload();">Reload</button>
                 <button class="button" onClick="reload();">Reload</button>
-                <button class="button" onClick="window.open(getDomainname() + '/logfileact');">Show Full Log</button>
-                <button class="button" onClick="window.location.href = getDomainname() + '/fileserver/log/message/'">Show Older Log Files</button>
+                <button class="button" onClick="window.open(domainname + '/logfileact');">Show Full Log</button>
+                <button class="button" onClick="window.location.href = domainname + '/fileserver/log/message/'">Show Older Log Files</button>
             </div>
             </div>
             <div class="row content" id="log"><br><br><br><b>Loading logfile, please wait...</b></div>
             <div class="row content" id="log"><br><br><br><b>Loading logfile, please wait...</b></div>
             <div class="row footer">
             <div class="row footer">
                 <button class="button" onClick="reload();">Reload</button>
                 <button class="button" onClick="reload();">Reload</button>
-                <button class="button" onClick="window.open(getDomainname() + '/logfileact');">Show Full Log</button>
-                <button class="button" onClick="window.location.href = getDomainname() + '/fileserver/log/message/'">Show Older Log Files</button>
+                <button class="button" onClick="window.open(domainname + '/logfileact');">Show Full Log</button>
+                <button class="button" onClick="window.location.href = domainname + '/fileserver/log/message/'">Show Older Log Files</button>
             </div>
             </div>
-          </div>
-    </body>
+        </div>
 
 
-    <script>  
+    <script type="text/javascript">  
         function reload() {
         function reload() {
           //  document.getElementById('log').innerHTML += "<br><b>Reloading...<b><br><br>";
           //  document.getElementById('log').innerHTML += "<br><b>Reloading...<b><br><br>";
             document.getElementById('log').innerHTML += "<b>Reloading...</b>";
             document.getElementById('log').innerHTML += "<b>Reloading...</b>";
             window.scrollBy(0,document.body.scrollHeight);
             window.scrollBy(0,document.body.scrollHeight);
-            funcRequest(getDomainname() + '/log');
+            funcRequest(domainname + '/log');
         } 
         } 
 
 
-
         function processLogLine(line, index, arr) {
         function processLogLine(line, index, arr) {
             /* Make sure the whitespaces in the uptime field get persevered */
             /* Make sure the whitespaces in the uptime field get persevered */
             uptimePart = line.slice(0, line.indexOf("]")).replace(/ /g, "&nbsp;");
             uptimePart = line.slice(0, line.indexOf("]")).replace(/ /g, "&nbsp;");
@@ -113,7 +114,8 @@
             });
             });
         }
         }
 
 
-        funcRequest(getDomainname() + '/log');
+        funcRequest(domainname + '/log');
 
 
     </script>
     </script>
-</html>
+    </body>
+</html>

+ 3 - 17
sd-card/html/ota_page.html

@@ -29,6 +29,7 @@
     <script type="text/javascript" src="jquery-3.6.0.min.js?v=$COMMIT_HASH"></script>
     <script type="text/javascript" src="jquery-3.6.0.min.js?v=$COMMIT_HASH"></script>
     <script type="text/javascript" src="common.js?v=$COMMIT_HASH"></script>
     <script type="text/javascript" src="common.js?v=$COMMIT_HASH"></script>
     <script type="text/javascript" src="firework.js?v=$COMMIT_HASH"></script>
     <script type="text/javascript" src="firework.js?v=$COMMIT_HASH"></script>
+    <script type="text/javascript">var domainname = getDomainname();</script>
 </head>
 </head>
 
 
 <body style="font-family: arial; padding: 0px 10px;">
 <body style="font-family: arial; padding: 0px 10px;">
@@ -56,12 +57,8 @@
         <h3><span id="status">Status: Idle</span></h3>
         <h3><span id="status">Status: Idle</span></h3>
         <p id="loaded_n_total"></p>
         <p id="loaded_n_total"></p>
     </form>
     </form>
-    
 
 
-
-    <script language="JavaScript">
-        var domainname = getDomainname();
-        
+    <script type="text/javascript">
         var action_runtime = 0;
         var action_runtime = 0;
         
         
         /* Max size of an individual file. Make sure this
         /* Max size of an individual file. Make sure this
@@ -128,7 +125,6 @@
             document.getElementById("start_OTA_button").disabled = false;
             document.getElementById("start_OTA_button").disabled = false;
         }
         }
 
 
-
         function start_OTA() {
         function start_OTA() {
             document.getElementById("start_OTA_button").disabled = true;
             document.getElementById("start_OTA_button").disabled = true;
 
 
@@ -140,14 +136,12 @@
             prepareOnServer();
             prepareOnServer();
         }
         }
 
 
-
         function doRebootAfterUpdate() {
         function doRebootAfterUpdate() {
             var xhttp = new XMLHttpRequest();
             var xhttp = new XMLHttpRequest();
             xhttp.open("GET", domainname + "/reboot", true);
             xhttp.open("GET", domainname + "/reboot", true);
             xhttp.send();
             xhttp.send();
         }
         }
 
 
-
         function prepareOnServer() {
         function prepareOnServer() {
             document.getElementById("status").innerText = "Status: Preparing device...";
             document.getElementById("status").innerText = "Status: Preparing device...";
 
 
@@ -175,7 +169,6 @@
             xhttp.send();
             xhttp.send();
         }
         }
 
 
-
         function validateMd5(md5_on_device, callback) {
         function validateMd5(md5_on_device, callback) {
             const reader = new FileReader();
             const reader = new FileReader();
 
 
@@ -197,7 +190,6 @@
             reader.readAsArrayBuffer(fileInput[0]);
             reader.readAsArrayBuffer(fileInput[0]);
         }
         }
 
 
-
         function extract() {
         function extract() {
             var xhttp = new XMLHttpRequest();
             var xhttp = new XMLHttpRequest();
             /* first delete the old firmware */	
             /* first delete the old firmware */	
@@ -254,12 +246,10 @@
             xhttp.send();
             xhttp.send();
         }
         }
 
 
-
         function _(el) {
         function _(el) {
             return document.getElementById(el);
             return document.getElementById(el);
         }
         }
 
 
-
         function upload() {
         function upload() {
             document.getElementById("status").innerText = "Status: Uploading...";
             document.getElementById("status").innerText = "Status: Uploading...";
 
 
@@ -278,7 +268,6 @@
             ajax.send(file);
             ajax.send(file);
         }
         }
 
 
-
         function progressHandler(event) {
         function progressHandler(event) {
             _("loaded_n_total").innerHTML = "Uploaded " + (event.loaded / 1024 / 1024).toFixed(2) + 
             _("loaded_n_total").innerHTML = "Uploaded " + (event.loaded / 1024 / 1024).toFixed(2) + 
                     " MB of " + (event.total / 1024/ 1024).toFixed(2) + " MB";
                     " MB of " + (event.total / 1024/ 1024).toFixed(2) + " MB";
@@ -295,7 +284,6 @@
             }
             }
         }
         }
 
 
-
         function completeHandler(event) {
         function completeHandler(event) {
             console.log("Upload completed");
             console.log("Upload completed");
             console.log("Response: " + event.target.responseText);
             console.log("Response: " + event.target.responseText);
@@ -323,14 +311,12 @@
             }
             }
         }
         }
 
 
-
         function errorHandler(event) {
         function errorHandler(event) {
             _("status").innerHTML = "Status: Upload Failed";
             _("status").innerHTML = "Status: Upload Failed";
             firework.launch('Upload failed!', 'danger', 30000);
             firework.launch('Upload failed!', 'danger', 30000);
             document.getElementById("file_selector").disabled = false;
             document.getElementById("file_selector").disabled = false;
         }
         }
 
 
-
         function abortHandler(event) {
         function abortHandler(event) {
             _("status").innerHTML = "Status: Upload Aborted";
             _("status").innerHTML = "Status: Upload Aborted";
             firework.launch('Upload aborted!', 'danger', 30000);
             firework.launch('Upload aborted!', 'danger', 30000);
@@ -338,4 +324,4 @@
         }
         }
     </script>
     </script>
 </body>
 </body>
-</html> 
+</html> 

+ 7 - 24
sd-card/html/overview.html

@@ -65,10 +65,14 @@
 	}
 	}
 </style>
 </style>
 
 
+	<script type="text/javascript" src="jquery-3.6.0.min.js?v=$COMMIT_HASH"></script>
+	<script type="text/javascript" src="common.js?v=$COMMIT_HASH"></script> 
+	<script type="text/javascript" src="readconfigcommon.js?v=$COMMIT_HASH"></script>
+	<script type="text/javascript" src="readconfigparam.js?v=$COMMIT_HASH"></script>
+    <script type="text/javascript">var domainname = getDomainname();</script>
 </head>
 </head>
 
 
 <body style="font-family: arial">
 <body style="font-family: arial">
-
 	<table class="tg">
 	<table class="tg">
 		<tr>
 		<tr>
 			<th class="th">Value</th>
 			<th class="th">Value</th>
@@ -130,11 +134,6 @@
 		</tr>
 		</tr>
 	</table>
 	</table>
 
 
-	<script type="text/javascript" src="jquery-3.6.0.min.js?v=$COMMIT_HASH"></script>
-	<script type="text/javascript" src="common.js?v=$COMMIT_HASH"></script> 
-	<script type="text/javascript" src="readconfigcommon.js?v=$COMMIT_HASH"></script>
-	<script type="text/javascript" src="readconfigparam.js?v=$COMMIT_HASH"></script>
-	
 	<script type="text/javascript">
 	<script type="text/javascript">
 		function addZero(i) {
 		function addZero(i) {
 			if (i < 10) {
 			if (i < 10) {
@@ -167,7 +166,7 @@
 			var h = addZero(d.getHours());
 			var h = addZero(d.getHours());
 			var m = addZero(d.getMinutes());
 			var m = addZero(d.getMinutes());
 			var s = addZero(d.getSeconds());
 			var s = addZero(d.getSeconds());
-			document.getElementById("img").src = getDomainname() + '/img_tmp/alg_roi.jpg?timestamp=' + timestamp;
+			document.getElementById("img").src = domainname + '/img_tmp/alg_roi.jpg?timestamp=' + timestamp;
 			$('#timestamp').html("Last Page Refresh:" + (h + ":" + m + ":" + s));
 			$('#timestamp').html("Last Page Refresh:" + (h + ":" + m + ":" + s));
 		}
 		}
 
 
@@ -326,23 +325,7 @@
 			xhttp.send();		
 			xhttp.send();		
 		}
 		}
 
 
-		/* 
-		function setImageMaxWidth() {
-			loadConfig(domainname); 
-			ParseConfig();
-			param = getConfigParameters();
-			
-			if(param["TakeImage"]["CamFrameSize"].value == "QVGA") {
-				document.getElementById("img").style.maxWidth = "320px";
-			}
-			else {
-				document.getElementById("img").style.maxWidth = "640px";
-			}
-		}
-		*/
 		function init(){
 		function init(){
-			domainname = getDomainname();
-			// setImageMaxWidth(); // CamFrameSize was replaced by zoom - CamFrameSize is no longer needed/used for zoom 
 			Refresh();
 			Refresh();
 		}
 		}
 
 
@@ -350,4 +333,4 @@
 
 
 	</script>
 	</script>
 </body>
 </body>
-</html>
+</html>

+ 19 - 24
sd-card/html/prevalue_set.html

@@ -59,6 +59,14 @@
     }
     }
     </style>
     </style>
 
 
+    <link href="firework.css?v=$COMMIT_HASH" rel="stylesheet">
+    <script type="text/javascript" src="jquery-3.6.0.min.js?v=$COMMIT_HASH"></script>  
+    <script type="text/javascript" src="firework.js?v=$COMMIT_HASH"></script>
+
+    <script type="text/javascript" src="common.js?v=$COMMIT_HASH"></script> 
+    <script type="text/javascript" src="readconfigcommon.js?v=$COMMIT_HASH"></script>  
+    <script type="text/javascript" src="readconfigparam.js?v=$COMMIT_HASH"></script> 
+    <script type="text/javascript">var domainname = getDomainname();</script>
 </head>
 </head>
 
 
 <body style="font-family: arial; padding: 0px 10px;">
 <body style="font-family: arial; padding: 0px 10px;">
@@ -129,20 +137,10 @@
         </tr>	 
         </tr>	 
     </table>
     </table>
 
 
-</body>
-</html>
-
-<link href="firework.css?v=$COMMIT_HASH" rel="stylesheet">
-<script type="text/javascript" src="jquery-3.6.0.min.js?v=$COMMIT_HASH"></script>  
-<script type="text/javascript" src="firework.js?v=$COMMIT_HASH"></script>
-
-<script type="text/javascript" src="common.js?v=$COMMIT_HASH"></script> 
-<script type="text/javascript" src="readconfigcommon.js?v=$COMMIT_HASH"></script>  
-<script type="text/javascript" src="readconfigparam.js?v=$COMMIT_HASH"></script>  
-
 <script type="text/javascript">
 <script type="text/javascript">
- 	var domainname = getDomainname(); 
-  var	NUMBERS;
+ 	var NUMBERS,
+		param,
+		category;
 
 
 function setprevalue() {
 function setprevalue() {
 	var inputVal = document.getElementById("myInput").value;
 	var inputVal = document.getElementById("myInput").value;
@@ -158,8 +156,7 @@ function setprevalue() {
           document.getElementById("result").innerHTML=response;
           document.getElementById("result").innerHTML=response;
           firework.launch('New \"previous value\" set', 'success', 5000);
           firework.launch('New \"previous value\" set', 'success', 5000);
      }
      }
-    catch (error)
-    {
+    catch (error) {
       firework.launch('Failed to get data from device!', 'danger', 30000);
       firework.launch('Failed to get data from device!', 'danger', 30000);
     }
     }
 }
 }
@@ -177,8 +174,7 @@ function loadPrevalue(_domainname) {
       response = xhttp.responseText;
       response = xhttp.responseText;
       document.getElementById("prevalue").innerHTML=response;
       document.getElementById("prevalue").innerHTML=response;
   }
   }
-  catch (error)
-  {
+  catch (error) {
     firework.launch('Failed to get data from device!', 'danger', 30000);
     firework.launch('Failed to get data from device!', 'danger', 30000);
   }
   }
 
 
@@ -203,13 +199,11 @@ function loadPrevalue(_domainname) {
       }
       }
     });
     });
   }
   }
-  catch (error)
-  {
+  catch (error) {
     firework.launch('Failed to get data from device!', 'danger', 30000);
     firework.launch('Failed to get data from device!', 'danger', 30000);
   }
   }
 }
 }
 
 
-
 function numberChanged(){
 function numberChanged(){
   loadPrevalue(domainname);
   loadPrevalue(domainname);
 }
 }
@@ -240,14 +234,15 @@ function UpdateNUMBERS(_sel){
     loadPrevalue(domainname);
     loadPrevalue(domainname);
 }
 }
 
 
-
 function init(){
 function init(){
-  domainname = getDomainname();
-  loadConfig(domainname); 
-  ParseConfig();
+  param = getConfigParameters();
+  category = getConfigCategory();
+  
   UpdateNUMBERS();
   UpdateNUMBERS();
   loadPrevalue(domainname);
   loadPrevalue(domainname);
 }
 }
 
 
 init();
 init();
 </script>
 </script>
+</body>
+</html>

+ 58 - 6
sd-card/html/readconfigcommon.js

@@ -109,7 +109,7 @@ function FileCopyOnServer(_source, _target, _domainname = "") {
 	try {
 	try {
         xhttp.open("GET", url, false);
         xhttp.open("GET", url, false);
         xhttp.send();
         xhttp.send();
-	} catch (error) {}
+	} catch (error) { console.log(error); }
 }
 }
 
 
 function FileDeleteOnServer(_filename, _domainname = "") {
 function FileDeleteOnServer(_filename, _domainname = "") {
@@ -128,7 +128,7 @@ function FileDeleteOnServer(_filename, _domainname = "") {
         var url = _domainname + "/delete" + _filename;
         var url = _domainname + "/delete" + _filename;
         xhttp.open("POST", url, false);
         xhttp.open("POST", url, false);
         xhttp.send();
         xhttp.send();
-    } catch (error) {}
+    } catch (error) { console.log(error); }
 
 
     return okay;
     return okay;
 }
 }
@@ -155,11 +155,63 @@ function FileSendContent(_content, _filename, _domainname = "") {
         upload_path = _domainname + "/upload" + _filename;
         upload_path = _domainname + "/upload" + _filename;
         xhttp.open("POST", upload_path, false);
         xhttp.open("POST", upload_path, false);
         xhttp.send(_content);
         xhttp.send(_content);
-    } catch (error) {}
+    } catch (error) { console.log(error); }
 	
 	
     return okay;        
     return okay;        
 }
 }
 
 
+function CopyReferenceToImgTmp(_domainname) {
+    for (index = 0; index < 2; ++index) {
+        _filenamevon = REFERENCES[index]["name"];
+        _filenamenach = _filenamevon.replace("/config/", "/img_tmp/");
+        FileDeleteOnServer(_filenamenach, _domainname);
+        FileCopyOnServer(_filenamevon, _filenamenach, _domainname);
+     
+        _filenamevon = _filenamevon.replace(".jpg", "_org.jpg");
+        _filenamenach = _filenamenach.replace(".jpg", "_org.jpg");
+        FileDeleteOnServer(_filenamenach, _domainname);
+        FileCopyOnServer(_filenamevon, _filenamenach, _domainname);
+    }
+}
+
+function UpdateConfigReferences(_domainname){
+    for (var index = 0; index < 2; ++index) {
+        _filenamenach = REFERENCES[index]["name"];
+        _filenamevon = _filenamenach.replace("/config/", "/img_tmp/");
+        FileDeleteOnServer(_filenamenach, _domainname);
+        FileCopyOnServer(_filenamevon, _filenamenach, _domainname);
+     
+        _filenamenach = _filenamenach.replace(".jpg", "_org.jpg");
+        _filenamevon = _filenamevon.replace(".jpg", "_org.jpg");
+        FileDeleteOnServer(_filenamenach, _domainname);
+        FileCopyOnServer(_filenamevon, _filenamenach, _domainname);
+    }
+}
+
+function UpdateConfigReference(_anzneueref, _domainname){
+    var index = 0;
+
+    if (_anzneueref == 1) {	
+        index = 0;
+    }
+
+    else if (_anzneueref == 2) {
+        index = 1;
+    }
+
+    _filenamenach = REFERENCES[index]["name"];
+    _filenamevon = _filenamenach.replace("/config/", "/img_tmp/");
+
+    FileDeleteOnServer(_filenamenach, _domainname);
+    FileCopyOnServer(_filenamevon, _filenamenach, _domainname);
+
+    _filenamenach = _filenamenach.replace(".jpg", "_org.jpg");
+    _filenamevon = _filenamevon.replace(".jpg", "_org.jpg");
+
+    FileDeleteOnServer(_filenamenach, _domainname);
+    FileCopyOnServer(_filenamevon, _filenamenach, _domainname);
+}
+
 function MakeTempRefImage(_filename, _enhance, _domainname){
 function MakeTempRefImage(_filename, _enhance, _domainname){
     var filename = _filename["name"].replace("/config/", "/img_tmp/");
     var filename = _filename["name"].replace("/config/", "/img_tmp/");
 	 
 	 
@@ -174,7 +226,7 @@ function MakeTempRefImage(_filename, _enhance, _domainname){
     try {
     try {
         xhttp.open("GET", url, false);
         xhttp.open("GET", url, false);
         xhttp.send();
         xhttp.send();
-    } catch (error){}
+    } catch (error){ console.log(error); }
 
 
     if (xhttp.responseText == "CutImage Done") {
     if (xhttp.responseText == "CutImage Done") {
         if (_enhance == true) {
         if (_enhance == true) {
@@ -230,7 +282,7 @@ function decryptConfigPwOnSD(_domainname = getDomainname()) {
 	try {
 	try {
         xhttp.open("GET", url, false);
         xhttp.open("GET", url, false);
         xhttp.send();
         xhttp.send();
-	} catch (error) {}
+	} catch (error) { console.log(error); }
 	
 	
 	if (xhttp.responseText == "decrypted") {
 	if (xhttp.responseText == "decrypted") {
 		return true;
 		return true;
@@ -247,7 +299,7 @@ function decryptWifiPwOnSD(_domainname = getDomainname()) {
 	try {
 	try {
         xhttp.open("GET", url, false);
         xhttp.open("GET", url, false);
         xhttp.send();
         xhttp.send();
-	} catch (error) {}
+	} catch (error) { console.log(error); }
 	
 	
 	if (xhttp.responseText == "decrypted") {
 	if (xhttp.responseText == "decrypted") {
 		return true;
 		return true;

+ 168 - 435
sd-card/html/readconfigparam.js

@@ -1,10 +1,24 @@
 var config_gesamt = "";
 var config_gesamt = "";
-var config_split = [];
+var config_gesamt_temp = "";
+
+var config_split = "";
+var config_split_temp = "";
+
 var param = [];
 var param = [];
-var category;
-var ref = new Array(2);
+var param_temp = [];
+
+var namenumberslist = "";
+var datalist = "";
+var tflitelist = "";
+
+var category = [];
+var category_temp = [];
+
 var NUMBERS = new Array(0);
 var NUMBERS = new Array(0);
+var NUMBERS_temp = new Array(0);
+
 var REFERENCES = new Array(0);
 var REFERENCES = new Array(0);
+var REFERENCES_temp = new Array(0);
 
 
 var domainname_for_testing = "";
 var domainname_for_testing = "";
 
 
@@ -31,6 +45,10 @@ function getConfig() {
     return config_gesamt;
     return config_gesamt;
 }
 }
 
 
+function getConfigCategory() {
+    return category;
+}
+
 function loadConfig(_domainname) {
 function loadConfig(_domainname) {
 	config_gesamt = "";
 	config_gesamt = "";
 
 
@@ -48,22 +66,7 @@ function loadConfig(_domainname) {
     try {     
     try {     
         xhttp.open("GET", url, false);
         xhttp.open("GET", url, false);
         xhttp.send();
         xhttp.send();
-    } catch (error) {}
-	
-	return true;
-}
-
-function loadConfig1(_domainname) {
-    var xhttp = new XMLHttpRequest();
-    
-	try {
-        url = _domainname + '/fileserver/config/config.ini';     
-        xhttp.open("GET", url, false);
-        xhttp.send();
-        config_gesamt = xhttp.responseText;
-    } catch (error) {}
-    
-	return true;
+    } catch (error) { console.log(error); }
 }
 }
 
 
 function SaveConfigToServer(_domainname){
 function SaveConfigToServer(_domainname){
@@ -86,7 +89,7 @@ function SaveConfigToServer(_domainname){
 
 
 function getNUMBERSList() {
 function getNUMBERSList() {
     _domainname = getDomainname(); 
     _domainname = getDomainname(); 
-    var namenumberslist = "";
+    namenumberslist = "";
 
 
     var xhttp = new XMLHttpRequest();
     var xhttp = new XMLHttpRequest();
 	
 	
@@ -103,7 +106,7 @@ function getNUMBERSList() {
         url = _domainname + '/editflow?task=namenumbers';     
         url = _domainname + '/editflow?task=namenumbers';     
         xhttp.open("GET", url, false);
         xhttp.open("GET", url, false);
         xhttp.send();
         xhttp.send();
-    } catch (error) {}
+    } catch (error) { console.log(error); }
 
 
     namenumberslist = namenumberslist.split("\t");
     namenumberslist = namenumberslist.split("\t");
 
 
@@ -129,7 +132,7 @@ function getDATAList() {
         url = _domainname + '/editflow?task=data';     
         url = _domainname + '/editflow?task=data';     
         xhttp.open("GET", url, false);
         xhttp.open("GET", url, false);
         xhttp.send();
         xhttp.send();
-    } catch (error) {}
+    } catch (error) { console.log(error); }
 
 
     datalist = datalist.split("\t");
     datalist = datalist.split("\t");
     datalist.pop();
     datalist.pop();
@@ -139,7 +142,8 @@ function getDATAList() {
 }
 }
 
 
 function getTFLITEList() {
 function getTFLITEList() {
-    _domainname = getDomainname(); 
+    _domainname = getDomainname();
+	
     tflitelist = "";
     tflitelist = "";
 
 
     var xhttp = new XMLHttpRequest();
     var xhttp = new XMLHttpRequest();
@@ -157,7 +161,7 @@ function getTFLITEList() {
         url = _domainname + '/editflow?task=tflite';
         url = _domainname + '/editflow?task=tflite';
         xhttp.open("GET", url, false);
         xhttp.open("GET", url, false);
         xhttp.send();
         xhttp.send();
-    } catch (error) {}
+    } catch (error) { console.log(error); }
 
 
     tflitelist = tflitelist.split("\t");
     tflitelist = tflitelist.split("\t");
     tflitelist.sort();
     tflitelist.sort();
@@ -221,7 +225,7 @@ function ParseConfig() {
     param[catname] = new Object();
     param[catname] = new Object();
     ParamAddValue(param, catname, "SearchFieldX", 1, false, "20");
     ParamAddValue(param, catname, "SearchFieldX", 1, false, "20");
     ParamAddValue(param, catname, "SearchFieldY", 1, false, "20");
     ParamAddValue(param, catname, "SearchFieldY", 1, false, "20");
-    ParamAddValue(param, catname, "SearchMaxAngle", 1, false, "45");
+    ParamAddValue(param, catname, "SearchMaxAngle", 1, false, "15");
     ParamAddValue(param, catname, "Antialiasing", 1, false, "true");
     ParamAddValue(param, catname, "Antialiasing", 1, false, "true");
     ParamAddValue(param, catname, "AlignmentAlgo", 1, false, "default");
     ParamAddValue(param, catname, "AlignmentAlgo", 1, false, "default");
     ParamAddValue(param, catname, "InitialRotate", 1, false, "0");
     ParamAddValue(param, catname, "InitialRotate", 1, false, "0");
@@ -231,7 +235,7 @@ function ParseConfig() {
     category[catname]["enabled"] = false;
     category[catname]["enabled"] = false;
     category[catname]["found"] = false;
     category[catname]["found"] = false;
     param[catname] = new Object();
     param[catname] = new Object();
-    ParamAddValue(param, catname, "Model");
+    ParamAddValue(param, catname, "Model", 1, false, "/config/dig-cont_0712_s3_q.tflite");
     ParamAddValue(param, catname, "CNNGoodThreshold", 1, false, "0.5");
     ParamAddValue(param, catname, "CNNGoodThreshold", 1, false, "0.5");
     ParamAddValue(param, catname, "ROIImagesLocation", 1, false, "/log/digit");
     ParamAddValue(param, catname, "ROIImagesLocation", 1, false, "/log/digit");
     ParamAddValue(param, catname, "ROIImagesRetention", 1, false, "3");
     ParamAddValue(param, catname, "ROIImagesRetention", 1, false, "3");
@@ -241,7 +245,7 @@ function ParseConfig() {
     category[catname]["enabled"] = false;
     category[catname]["enabled"] = false;
     category[catname]["found"] = false;
     category[catname]["found"] = false;
     param[catname] = new Object();
     param[catname] = new Object();
-    ParamAddValue(param, catname, "Model");
+    ParamAddValue(param, catname, "Model", 1, false, "/config/ana-cont_1300_s2.tflite");
     ParamAddValue(param, catname, "ROIImagesLocation", 1, false, "/log/analog");
     ParamAddValue(param, catname, "ROIImagesLocation", 1, false, "/log/analog");
     ParamAddValue(param, catname, "ROIImagesRetention", 1, false, "3");
     ParamAddValue(param, catname, "ROIImagesRetention", 1, false, "3");
 
 
@@ -253,7 +257,7 @@ function ParseConfig() {
     // ParamAddValue(param, catname, "PreValueUse", 1, true, "true");
     // ParamAddValue(param, catname, "PreValueUse", 1, true, "true");
     ParamAddValue(param, catname, "PreValueUse", 1, false, "true");
     ParamAddValue(param, catname, "PreValueUse", 1, false, "true");
     ParamAddValue(param, catname, "PreValueAgeStartup", 1, false, "720");
     ParamAddValue(param, catname, "PreValueAgeStartup", 1, false, "720");
-    ParamAddValue(param, catname, "ErrorMessage", 1, false, "true");
+    ParamAddValue(param, catname, "SkipErrorMessage", 1, true, "false");
     ParamAddValue(param, catname, "AllowNegativeRates", 1, true, "false");
     ParamAddValue(param, catname, "AllowNegativeRates", 1, true, "false");
     ParamAddValue(param, catname, "DecimalShift", 1, true, "0");
     ParamAddValue(param, catname, "DecimalShift", 1, true, "0");
     ParamAddValue(param, catname, "AnalogToDigitTransitionStart", 1, true, "9.2");
     ParamAddValue(param, catname, "AnalogToDigitTransitionStart", 1, true, "9.2");
@@ -269,54 +273,54 @@ function ParseConfig() {
     category[catname]["enabled"] = false;
     category[catname]["enabled"] = false;
     category[catname]["found"] = false;
     category[catname]["found"] = false;
     param[catname] = new Object();
     param[catname] = new Object();
-    ParamAddValue(param, catname, "Uri");
-    ParamAddValue(param, catname, "MainTopic", 1, false);
-    ParamAddValue(param, catname, "ClientID");
-    ParamAddValue(param, catname, "user");
-    ParamAddValue(param, catname, "password");
-    ParamAddValue(param, catname, "RetainMessages");
-    ParamAddValue(param, catname, "DomoticzTopicIn");
-    ParamAddValue(param, catname, "DomoticzIDX", 1, true);
-    ParamAddValue(param, catname, "HomeassistantDiscovery");
-    ParamAddValue(param, catname, "DiscoveryPrefix", 1, false);
-    ParamAddValue(param, catname, "MeterType");
-    ParamAddValue(param, catname, "CACert");
-    ParamAddValue(param, catname, "ClientCert");
-    ParamAddValue(param, catname, "ClientKey");
-    ParamAddValue(param, catname, "ValidateServerCert");
+    ParamAddValue(param, catname, "Uri", 1, false, "mqtt://example.com:1883");
+    ParamAddValue(param, catname, "MainTopic", 1, false, "watermeter");
+    ParamAddValue(param, catname, "ClientID", 1, false, "watermeter");
+    ParamAddValue(param, catname, "user", 1, false, "USERNAME");
+    ParamAddValue(param, catname, "password", 1, false, "PASSWORD");
+    ParamAddValue(param, catname, "CACert", 1, false, "/config/certs/RootCA.pem");
+    ParamAddValue(param, catname, "ClientCert", 1, false, "/config/certs/client.pem.crt");
+    ParamAddValue(param, catname, "ClientKey", 1, false, "/config/certs/client.pem.key");
+    ParamAddValue(param, catname, "ValidateServerCert", 1, false, "true");
+    ParamAddValue(param, catname, "RetainMessages", 1, false, "true");
+    ParamAddValue(param, catname, "HomeassistantDiscovery", 1, false, "true");
+    ParamAddValue(param, catname, "DiscoveryPrefix", 1, false, "homeassistant");
+    ParamAddValue(param, catname, "MeterType", 1, false, "other");
+    ParamAddValue(param, catname, "DomoticzTopicIn", 1, false, "domoticz/in");
+    ParamAddValue(param, catname, "DomoticzIDX", 1, true, "0");
 
 
     var catname = "InfluxDB";
     var catname = "InfluxDB";
     category[catname] = new Object();
     category[catname] = new Object();
     category[catname]["enabled"] = false;
     category[catname]["enabled"] = false;
     category[catname]["found"] = false;
     category[catname]["found"] = false;
     param[catname] = new Object();
     param[catname] = new Object();
-    ParamAddValue(param, catname, "Uri");
-    ParamAddValue(param, catname, "Database");
-    ParamAddValue(param, catname, "user");
-    ParamAddValue(param, catname, "password");
-    ParamAddValue(param, catname, "Measurement", 1, true);
-    ParamAddValue(param, catname, "Field", 1, true);
+    ParamAddValue(param, catname, "Uri", 1, false, "undefined");
+    ParamAddValue(param, catname, "Database", 1, false, "undefined");
+    ParamAddValue(param, catname, "user", 1, false, "undefined");
+    ParamAddValue(param, catname, "password", 1, false, "undefined");
+    ParamAddValue(param, catname, "Measurement", 1, true, "undefined");
+    ParamAddValue(param, catname, "Field", 1, true, "undefined");
 
 
     var catname = "InfluxDBv2";
     var catname = "InfluxDBv2";
     category[catname] = new Object();
     category[catname] = new Object();
     category[catname]["enabled"] = false;
     category[catname]["enabled"] = false;
     category[catname]["found"] = false;
     category[catname]["found"] = false;
     param[catname] = new Object();
     param[catname] = new Object();
-    ParamAddValue(param, catname, "Uri");
-    ParamAddValue(param, catname, "Bucket");
-    ParamAddValue(param, catname, "Org");
-    ParamAddValue(param, catname, "Token");
-    ParamAddValue(param, catname, "Measurement", 1, true);
-    ParamAddValue(param, catname, "Field", 1, true);
+    ParamAddValue(param, catname, "Uri", 1, false, "undefined");
+    ParamAddValue(param, catname, "Bucket", 1, false, "undefined");
+    ParamAddValue(param, catname, "Org", 1, false, "undefined");
+    ParamAddValue(param, catname, "Token", 1, false, "undefined");
+    ParamAddValue(param, catname, "Measurement", 1, true, "undefined");
+    ParamAddValue(param, catname, "Field", 1, true, "undefined");
 
 
     var catname = "Webhook";
     var catname = "Webhook";
     category[catname] = new Object();
     category[catname] = new Object();
     category[catname]["enabled"] = false;
     category[catname]["enabled"] = false;
     category[catname]["found"] = false;
     category[catname]["found"] = false;
     param[catname] = new Object();
     param[catname] = new Object();
-    ParamAddValue(param, catname, "Uri", 1, false);
-    ParamAddValue(param, catname, "ApiKey", 1, false);
-    ParamAddValue(param, catname, "UploadImg", 1, false);
+    ParamAddValue(param, catname, "Uri", 1, false, "undefined");
+    ParamAddValue(param, catname, "ApiKey", 1, false, "undefined");
+    ParamAddValue(param, catname, "UploadImg", 1, false, "0");
 
 
     var catname = "GPIO";
     var catname = "GPIO";
     category[catname] = new Object();
     category[catname] = new Object();
@@ -369,7 +373,7 @@ function ParseConfig() {
     category[catname]["found"] = false;
     category[catname]["found"] = false;
     param[catname] = new Object();
     param[catname] = new Object();
     ParamAddValue(param, catname, "TimeZone", 1, false, "default");
     ParamAddValue(param, catname, "TimeZone", 1, false, "default");
-    ParamAddValue(param, catname, "TimeServer", 1, false, "default");
+    ParamAddValue(param, catname, "TimeServer", 1, false, "pool.ntp.org");
     ParamAddValue(param, catname, "Hostname", 1, false, "watermeter");   
     ParamAddValue(param, catname, "Hostname", 1, false, "watermeter");   
     ParamAddValue(param, catname, "RSSIThreshold", 1, false, "0"); 
     ParamAddValue(param, catname, "RSSIThreshold", 1, false, "0"); 
     ParamAddValue(param, catname, "CPUFrequency", 1, false, "160");
     ParamAddValue(param, catname, "CPUFrequency", 1, false, "160");
@@ -378,12 +382,12 @@ function ParseConfig() {
      
      
     while (aktline < config_split.length){
     while (aktline < config_split.length){
         for (var cat in category) {
         for (var cat in category) {
-            zw = cat.toUpperCase();
-            zw1 = "[" + zw + "]";
-            zw2 = ";[" + zw + "]";
+            var cat_temp = cat.toUpperCase();
+            var cat_aktive = "[" + cat_temp + "]";
+            var cat_inaktive = ";[" + cat_temp + "]";
             
             
-            if ((config_split[aktline].trim().toUpperCase() == zw1) || (config_split[aktline].trim().toUpperCase() == zw2)) {
-                if (config_split[aktline].trim().toUpperCase() == zw1) {
+            if ((config_split[aktline].trim().toUpperCase() == cat_aktive) || (config_split[aktline].trim().toUpperCase() == cat_inaktive)) {
+                if (config_split[aktline].trim().toUpperCase() == cat_aktive) {
                     category[cat]["enabled"] = true;
                     category[cat]["enabled"] = true;
                 }
                 }
                 
                 
@@ -396,43 +400,6 @@ function ParseConfig() {
         
         
         aktline++;
         aktline++;
     }
     }
-
-    // Make the downward compatiblity with DataLogging
-    if (category["DataLogging"]["found"] == false) {
-        category["DataLogging"]["found"] = true;
-        category["DataLogging"]["enabled"] = true;
-
-        param["DataLogging"]["DataLogActive"]["found"] = true;
-        param["DataLogging"]["DataLogActive"]["enabled"] = true;
-        param["DataLogging"]["DataLogActive"]["value1"] = "true";
-          
-        param["DataLogging"]["DataFilesRetention"]["found"] = true;
-        param["DataLogging"]["DataFilesRetention"]["enabled"] = true;
-        param["DataLogging"]["DataFilesRetention"]["value1"] = "3";
-    }
-
-    if (category["DataLogging"]["enabled"] == false) {
-        category["DataLogging"]["enabled"] = true
-    }
-
-    if (param["DataLogging"]["DataLogActive"]["enabled"] == false && param["DataLogging"]["DataLogActive"]["value1"] == "") {
-        param["DataLogging"]["DataLogActive"]["found"] = true;
-        param["DataLogging"]["DataLogActive"]["enabled"] = true;
-        param["DataLogging"]["DataLogActive"]["value1"] = "true";
-    }
-
-    if (param["DataLogging"]["DataFilesRetention"]["enabled"] == false && param["DataLogging"]["DataFilesRetention"]["value1"] == "") {
-        param["DataLogging"]["DataFilesRetention"]["found"] = true;
-        param["DataLogging"]["DataFilesRetention"]["enabled"] = true;
-        param["DataLogging"]["DataFilesRetention"]["value1"] = "3";
-    }
-
-    // Downward compatibility: Create RSSIThreshold if not available
-    if (param["System"]["RSSIThreshold"]["found"] == false) {
-        param["System"]["RSSIThreshold"]["found"] = true;
-        param["System"]["RSSIThreshold"]["enabled"] = false;
-        param["System"]["RSSIThreshold"]["value1"] = "0";
-    }
 }
 }
 
 
 function ParamAddValue(param, _cat, _param, _anzParam = 1, _isNUMBER = false, _defaultValue = "", _checkRegExList = null) {
 function ParamAddValue(param, _cat, _param, _anzParam = 1, _isNUMBER = false, _defaultValue = "", _checkRegExList = null) {
@@ -444,6 +411,19 @@ function ParamAddValue(param, _cat, _param, _anzParam = 1, _isNUMBER = false, _d
     param[_cat][_param]["defaultValue"] = _defaultValue;
     param[_cat][_param]["defaultValue"] = _defaultValue;
     param[_cat][_param]["Numbers"] = _isNUMBER;
     param[_cat][_param]["Numbers"] = _isNUMBER;
     param[_cat][_param].checkRegExList = _checkRegExList;
     param[_cat][_param].checkRegExList = _checkRegExList;
+	
+    if (_isNUMBER) {
+        for (var _num in NUMBERS) {
+            for (var j = 1; j <= param[_cat][_param]["anzParam"]; ++j) {
+                NUMBERS[_num][_cat][_param]["value"+j] = _defaultValue;
+            }
+        }
+    }
+    else {
+        for (var j = 1; j <= param[_cat][_param]["anzParam"]; ++j) {
+            param[_cat][_param]["value"+j] = _defaultValue;
+        }
+    }
 };
 };
 
 
 function ParseConfigParamAll(_aktline, _catname) {
 function ParseConfigParamAll(_aktline, _catname) {
@@ -503,25 +483,28 @@ function ParamExtractValueAll(_param, _linesplit, _catname, _aktline, _iscom) {
         
         
         if (_AktPara.toUpperCase() == paramname.toUpperCase()) {
         if (_AktPara.toUpperCase() == paramname.toUpperCase()) {
             while (_linesplit.length <= _param[_catname][paramname]["anzParam"]) {
             while (_linesplit.length <= _param[_catname][paramname]["anzParam"]) {
-                _linesplit.push("");
+                // line contains no value, so the default value is loaded
+                _linesplit.push(_param[_catname][paramname]["defaultValue"]);
             }
             }
 
 
             _param[_catname][paramname]["found"] = true;
             _param[_catname][paramname]["found"] = true;
             _param[_catname][paramname]["enabled"] = !_iscom;
             _param[_catname][paramname]["enabled"] = !_iscom;
             _param[_catname][paramname]["line"] = _aktline;
             _param[_catname][paramname]["line"] = _aktline;
             
             
-            if (_param[_catname][paramname]["Numbers"] == true) {        // möglicher Multiusage
-                abc = getNUMBERS(_linesplit[0]);
-                abc[_catname][paramname] = new Object;
-                abc[_catname][paramname]["found"] = true;
-                abc[_catname][paramname]["enabled"] = !_iscom;
+            if (_param[_catname][paramname]["Numbers"] == true) {
+                // möglicher Multiusage
+                var _numbers = getNUMBERS(_linesplit[0]);
+                _numbers[_catname][paramname] = new Object;
+                _numbers[_catname][paramname]["found"] = true;
+                _numbers[_catname][paramname]["enabled"] = !_iscom;
      
      
                 for (var j = 1; j <= _param[_catname][paramname]["anzParam"]; ++j) {
                 for (var j = 1; j <= _param[_catname][paramname]["anzParam"]; ++j) {
-                    abc[_catname][paramname]["value"+j] = _linesplit[j];
+                    _numbers[_catname][paramname]["value"+j] = _linesplit[j];
                 }
                 }
 				
 				
-                if (abc["name"] == "default") {
-                    for (_num in NUMBERS) {        // wert mit Default belegen
+                if (_numbers["name"] == "default") {
+                    for (var _num in NUMBERS) {
+                        // Assign value to default
                         if (NUMBERS[_num][_catname][paramname]["found"] == false) {
                         if (NUMBERS[_num][_catname][paramname]["found"] == false) {
                             NUMBERS[_num][_catname][paramname]["found"] = true;
                             NUMBERS[_num][_catname][paramname]["found"] = true;
                             NUMBERS[_num][_catname][paramname]["enabled"] = !_iscom;
                             NUMBERS[_num][_catname][paramname]["enabled"] = !_iscom;
@@ -534,11 +517,7 @@ function ParamExtractValueAll(_param, _linesplit, _catname, _aktline, _iscom) {
                     }
                     }
                 }
                 }
             }
             }
-            else {
-                _param[_catname][paramname]["found"] = true;
-                _param[_catname][paramname]["enabled"] = !_iscom;
-                _param[_catname][paramname]["line"] = _aktline;
-                    
+            else {  
                 for (var j = 1; j <= _param[_catname][paramname]["anzParam"]; ++j) {
                 for (var j = 1; j <= _param[_catname][paramname]["anzParam"]; ++j) {
                     _param[_catname][paramname]["value"+j] = _linesplit[j];
                     _param[_catname][paramname]["value"+j] = _linesplit[j];
                 }
                 }
@@ -547,184 +526,9 @@ function ParamExtractValueAll(_param, _linesplit, _catname, _aktline, _iscom) {
     }
     }
 }
 }
 
 
-function getCamConfig() {			
-    ParseConfig();		
-
-    param["System"]["Tooltip"]["enabled"] = true;
-    param["Alignment"]["InitialRotate"]["enabled"] = true;
-			
-    param["TakeImage"]["WaitBeforeTakingPicture"]["enabled"] = true;
-    param["TakeImage"]["CamGainceiling"]["enabled"] = true;		// Image gain (GAINCEILING_x2, x4, x8, x16, x32, x64 or x128)
-    param["TakeImage"]["CamQuality"]["enabled"] = true;    		// 0 - 63
-    param["TakeImage"]["CamBrightness"]["enabled"] = true; 		// (-2 to 2) - set brightness
-    param["TakeImage"]["CamContrast"]["enabled"] = true;   		//-2 - 2
-    param["TakeImage"]["CamSaturation"]["enabled"] = true; 		//-2 - 2
-    param["TakeImage"]["CamSharpness"]["enabled"] = true;  		//-2 - 2
-    param["TakeImage"]["CamAutoSharpness"]["enabled"] = true;  	//(1 or 0)
-    param["TakeImage"]["CamSpecialEffect"]["enabled"] = true;	// 0 - 6
-    param["TakeImage"]["CamWbMode"]["enabled"] = true;        	// 0 to 4 - if awb_gain enabled (0 - Auto, 1 - Sunny, 2 - Cloudy, 3 - Office, 4 - Home)
-    param["TakeImage"]["CamAwb"]["enabled"] = true;           	// white balance enable (0 or 1)
-    param["TakeImage"]["CamAwbGain"]["enabled"] = true;       	// Auto White Balance enable (0 or 1)
-    param["TakeImage"]["CamAec"]["enabled"] = true;           	// auto exposure off (1 or 0)
-    param["TakeImage"]["CamAec2"]["enabled"] = true;          	// automatic exposure sensor  (0 or 1)
-    param["TakeImage"]["CamAeLevel"]["enabled"] = true;       	// auto exposure levels (-2 to 2)
-    param["TakeImage"]["CamAecValue"]["enabled"] = true;      	// set exposure manually  (0-1200)
-    param["TakeImage"]["CamAgc"]["enabled"] = true;           	// auto gain off (1 or 0)
-    param["TakeImage"]["CamAgcGain"]["enabled"] = true;       	// set gain manually (0 - 30)
-    param["TakeImage"]["CamBpc"]["enabled"] = true;          	// black pixel correction
-    param["TakeImage"]["CamWpc"]["enabled"] = true;           	// white pixel correction
-    param["TakeImage"]["CamRawGma"]["enabled"] = true;        	// (1 or 0)
-    param["TakeImage"]["CamLenc"]["enabled"] = true;          	// lens correction (1 or 0)
-    param["TakeImage"]["CamHmirror"]["enabled"] = true;       	// (0 or 1) flip horizontally
-    param["TakeImage"]["CamVflip"]["enabled"] = true;         	// Invert image (0 or 1)
-    param["TakeImage"]["CamDcw"]["enabled"] = true;           	// downsize enable (1 or 0)
-    param["TakeImage"]["CamDenoise"]["enabled"] = true;       	// The OV2640 does not support it, OV3660 and OV5640 (0 to 8)
-    param["TakeImage"]["CamZoom"]["enabled"] = true;
-    param["TakeImage"]["CamZoomOffsetX"]["enabled"] = true;
-    param["TakeImage"]["CamZoomOffsetY"]["enabled"] = true;
-    param["TakeImage"]["CamZoomSize"]["enabled"] = true;
-    param["TakeImage"]["LEDIntensity"]["enabled"] = true;
-
-    if (!param["System"]["Tooltip"]["found"]) {
-        param["System"]["Tooltip"]["found"] = true;
-        param["System"]["Tooltip"].value1 = 'true';
-    }
-
-    if (!param["Alignment"]["InitialRotate"]["found"]) {
-        param["Alignment"]["InitialRotate"]["found"] = true;
-        param["Alignment"]["InitialRotate"].value1 = 'false';
-    }
-
-    if (!param["TakeImage"]["WaitBeforeTakingPicture"]["found"]) {
-        param["TakeImage"]["WaitBeforeTakingPicture"]["found"] = true;
-        param["TakeImage"]["WaitBeforeTakingPicture"].value1 = '5';
-    }
-    if (!param["TakeImage"]["CamGainceiling"]["found"]) {
-        param["TakeImage"]["CamGainceiling"]["found"] = true;
-        // param["TakeImage"]["CamGainceiling"].value1 = '2';
-        param["TakeImage"]["CamGainceiling"].value1 = 'x8';
-    }
-    if (!param["TakeImage"]["CamQuality"]["found"]) {
-        param["TakeImage"]["CamQuality"]["found"] = true;
-        param["TakeImage"]["CamQuality"].value1 = '10';
-    }
-    if (!param["TakeImage"]["CamBrightness"]["found"]) {
-        param["TakeImage"]["CamBrightness"]["found"] = true;
-        param["TakeImage"]["CamBrightness"].value1 = '0';
-    }
-    if (!param["TakeImage"]["CamContrast"]["found"]) {
-        param["TakeImage"]["CamContrast"]["found"] = true;
-        param["TakeImage"]["CamContrast"].value1 = '0';
-    }
-    if (!param["TakeImage"]["CamSaturation"]["found"]) {
-        param["TakeImage"]["CamSaturation"]["found"] = true;
-        param["TakeImage"]["CamSaturation"].value1 = '0';
-    }
-    if (!param["TakeImage"]["CamSharpness"]["found"]) {
-        param["TakeImage"]["CamSharpness"]["found"] = true;
-        param["TakeImage"]["CamSharpness"].value1 = '0';
-    }
-    if (!param["TakeImage"]["CamAutoSharpness"]["found"]) {
-        param["TakeImage"]["CamAutoSharpness"]["found"] = true;
-        param["TakeImage"]["CamAutoSharpness"].value1 = 'false';
-    }			
-    if (!param["TakeImage"]["CamSpecialEffect"]["found"]) {
-        param["TakeImage"]["CamSpecialEffect"]["found"] = true;
-        param["TakeImage"]["CamSpecialEffect"].value1 = 'no_effect';
-    }		
-    if (!param["TakeImage"]["CamWbMode"]["found"]) {
-        param["TakeImage"]["CamWbMode"]["found"] = true;
-        param["TakeImage"]["CamWbMode"].value1 = 'auto';
-    }			
-    if (!param["TakeImage"]["CamAwb"]["found"]) {
-        param["TakeImage"]["CamAwb"]["found"] = true;
-        param["TakeImage"]["CamAwb"].value1 = 'true';
-    }
-    if (!param["TakeImage"]["CamAwbGain"]["found"]) {
-        param["TakeImage"]["CamAwbGain"]["found"] = true;
-        param["TakeImage"]["CamAwbGain"].value1 = 'true';
-    }
-    if (!param["TakeImage"]["CamAec"]["found"]) {
-        param["TakeImage"]["CamAec"]["found"] = true;
-        param["TakeImage"]["CamAec"].value1 = 'true';
-    }
-    if (!param["TakeImage"]["CamAec2"]["found"]) {
-        param["TakeImage"]["CamAec2"]["found"] = true;
-        param["TakeImage"]["CamAec2"].value1 = 'true';
-    }
-    if (!param["TakeImage"]["CamAeLevel"]["found"]) {
-        param["TakeImage"]["CamAeLevel"]["found"] = true;
-        param["TakeImage"]["CamAeLevel"].value1 = '2';
-    }
-    if (!param["TakeImage"]["CamAecValue"]["found"]) {
-        param["TakeImage"]["CamAecValue"]["found"] = true;
-        param["TakeImage"]["CamAecValue"].value1 = '600';
-    }
-    if (!param["TakeImage"]["CamAgc"]["found"]) {
-        param["TakeImage"]["CamAgc"]["found"] = true;
-        param["TakeImage"]["CamAgc"].value1 = 'true';
-    }
-    if (!param["TakeImage"]["CamAgcGain"]["found"]) {
-        param["TakeImage"]["CamAgcGain"]["found"] = true;
-        param["TakeImage"]["CamAgcGain"].value1 = '8';
-    }
-    if (!param["TakeImage"]["CamBpc"]["found"]) {
-        param["TakeImage"]["CamBpc"]["found"] = true;
-        param["TakeImage"]["CamBpc"].value1 = 'true';
-    }
-    if (!param["TakeImage"]["CamWpc"]["found"]) {
-        param["TakeImage"]["CamWpc"]["found"] = true;
-        param["TakeImage"]["CamWpc"].value1 = 'true';
-    }		
-    if (!param["TakeImage"]["CamRawGma"]["found"]) {
-        param["TakeImage"]["CamRawGma"]["found"] = true;
-        param["TakeImage"]["CamRawGma"].value1 = 'true';
-    }		
-    if (!param["TakeImage"]["CamLenc"]["found"]) {
-        param["TakeImage"]["CamLenc"]["found"] = true;
-        param["TakeImage"]["CamLenc"].value1 = 'true';
-    }			
-    if (!param["TakeImage"]["CamHmirror"]["found"]) {
-        param["TakeImage"]["CamHmirror"]["found"] = true;
-        param["TakeImage"]["CamHmirror"].value1 = 'false';
-    }
-    if (!param["TakeImage"]["CamVflip"]["found"]) {
-        param["TakeImage"]["CamVflip"]["found"] = true;
-        param["TakeImage"]["CamVflip"].value1 = 'false';
-    }
-    if (!param["TakeImage"]["CamDcw"]["found"]) {
-        param["TakeImage"]["CamDcw"]["found"] = true;
-        param["TakeImage"]["CamDcw"].value1 = 'true';
-    }
-    if (!param["TakeImage"]["CamDenoise"]["found"]) {
-        param["TakeImage"]["CamDenoise"]["found"] = true;
-        param["TakeImage"]["CamDenoise"].value1 = '0';
-    }
-    if (!param["TakeImage"]["CamZoom"]["found"]) {
-        param["TakeImage"]["CamZoom"]["found"] = true;
-        param["TakeImage"]["CamZoom"].value1 = 'false';
-    }
-    if (!param["TakeImage"]["CamZoomOffsetX"]["found"]) {
-        param["TakeImage"]["CamZoomOffsetX"]["found"] = true;
-        param["TakeImage"]["CamZoomOffsetX"].value1 = '0';
-    }
-    if (!param["TakeImage"]["CamZoomOffsetY"]["found"]) {
-        param["TakeImage"]["CamZoomOffsetY"]["found"] = true;
-        param["TakeImage"]["CamZoomOffsetY"].value1 = '0';
-    }
-    if (!param["TakeImage"]["CamZoomSize"]["found"]) {
-        param["TakeImage"]["CamZoomSize"]["found"] = true;
-        param["TakeImage"]["CamZoomSize"].value1 = '0';
-    }
-    if (!param["TakeImage"]["LEDIntensity"]["found"]) {
-        param["TakeImage"]["LEDIntensity"]["found"] = true;
-        param["TakeImage"]["LEDIntensity"].value1 = '50';
-    }
-
-    return param;	
-}
-
 function getConfigParameters() {
 function getConfigParameters() {
+	loadConfig(getDomainname());
+	ParseConfig(getDomainname());
     return param;
     return param;
 }
 }
 
 
@@ -739,48 +543,54 @@ function WriteConfigININew() {
     config_split = new Array(0);
     config_split = new Array(0);
 
 
     for (var cat in param) {
     for (var cat in param) {
-        text = "[" + cat + "]";
+        var text_cat = "[" + cat + "]";
 		  
 		  
         if (!category[cat]["enabled"]) {
         if (!category[cat]["enabled"]) {
-            text = ";" + text;
+            text_cat = ";" + text_cat;
         }
         }
         
         
-        config_split.push(text);
+        config_split.push(text_cat);
 
 
         for (var name in param[cat]) {
         for (var name in param[cat]) {
             if (param[cat][name]["Numbers"]) {
             if (param[cat][name]["Numbers"]) {
                 for (_num in NUMBERS) {
                 for (_num in NUMBERS) {
-                    text = NUMBERS[_num]["name"] + "." + name;
+                    var text_numbers = NUMBERS[_num]["name"] + "." + name;
 
 
-                    var text = text + " =" 
+                    text_numbers = text_numbers + " =" 
                          
                          
                     for (var j = 1; j <= param[cat][name]["anzParam"]; ++j) {
                     for (var j = 1; j <= param[cat][name]["anzParam"]; ++j) {
                         if (!(typeof NUMBERS[_num][cat][name]["value"+j] == 'undefined')) {
                         if (!(typeof NUMBERS[_num][cat][name]["value"+j] == 'undefined')) {
-                            text = text + " " + NUMBERS[_num][cat][name]["value"+j];
+                            text_numbers = text_numbers + " " + NUMBERS[_num][cat][name]["value"+j];
+                        }
+                        else {
+                            text_numbers = text_numbers + " " + NUMBERS[_num][cat][name]["defaultValue"];
                         }
                         }
                     }
                     }
 						 
 						 
-                    if (!NUMBERS[_num][cat][name]["enabled"]) {
-                        text = ";" + text;
+                    if ((!category[cat]["enabled"]) || (!NUMBERS[_num][cat][name]["enabled"])) {
+                        text_numbers = ";" + text_numbers;
                     }
                     }
 						 
 						 
-                    config_split.push(text);
+                    config_split.push(text_numbers);
                 }
                 }
             }
             }
             else {
             else {
-                var text = name + " =" 
+                var text_name = name + " =" 
                     
                     
                 for (var j = 1; j <= param[cat][name]["anzParam"]; ++j) {
                 for (var j = 1; j <= param[cat][name]["anzParam"]; ++j) {
                     if (!(typeof param[cat][name]["value"+j] == 'undefined')) {
                     if (!(typeof param[cat][name]["value"+j] == 'undefined')) {
-                        text = text + " " + param[cat][name]["value"+j];
+                        text_name = text_name + " " + param[cat][name]["value"+j];
+                    }
+                    else {
+                        text_name = text_name + " " + param[cat][name]["defaultValue"];
                     }
                     }
                 }
                 }
 					
 					
-                if (!param[cat][name]["enabled"]) {
-                    text = ";" + text;
+                if ((!category[cat]["enabled"]) || (!param[cat][name]["enabled"])) {
+                    text_name = ";" + text_name;
                 }
                 }
 					
 					
-                config_split.push(text);
+                config_split.push(text_name);
             }
             }
         }
         }
 		  
 		  
@@ -788,13 +598,13 @@ function WriteConfigININew() {
             for (var _roi in NUMBERS) {
             for (var _roi in NUMBERS) {
                 if (NUMBERS[_roi]["digit"].length > 0) {
                 if (NUMBERS[_roi]["digit"].length > 0) {
                     for (var _roiddet in NUMBERS[_roi]["digit"]) {
                     for (var _roiddet in NUMBERS[_roi]["digit"]) {
-                        text = NUMBERS[_roi]["name"] + "." + NUMBERS[_roi]["digit"][_roiddet]["name"];
-                        text = text + " " + NUMBERS[_roi]["digit"][_roiddet]["x"];
-                        text = text + " " + NUMBERS[_roi]["digit"][_roiddet]["y"];
-                        text = text + " " + NUMBERS[_roi]["digit"][_roiddet]["dx"];
-                        text = text + " " + NUMBERS[_roi]["digit"][_roiddet]["dy"];
-                        text = text + " " + NUMBERS[_roi]["digit"][_roiddet]["CCW"];
-                        config_split.push(text);
+                        var text_digital = NUMBERS[_roi]["name"] + "." + NUMBERS[_roi]["digit"][_roiddet]["name"];
+                        text_digital = text_digital + " " + NUMBERS[_roi]["digit"][_roiddet]["x"];
+                        text_digital = text_digital + " " + NUMBERS[_roi]["digit"][_roiddet]["y"];
+                        text_digital = text_digital + " " + NUMBERS[_roi]["digit"][_roiddet]["dx"];
+                        text_digital = text_digital + " " + NUMBERS[_roi]["digit"][_roiddet]["dy"];
+                        text_digital = text_digital + " " + NUMBERS[_roi]["digit"][_roiddet]["CCW"];
+                        config_split.push(text_digital);
                     }
                     }
                 }
                 }
             }
             }
@@ -804,13 +614,13 @@ function WriteConfigININew() {
             for (var _roi in NUMBERS) {
             for (var _roi in NUMBERS) {
                 if (NUMBERS[_roi]["analog"].length > 0) {
                 if (NUMBERS[_roi]["analog"].length > 0) {
                     for (var _roiddet in NUMBERS[_roi]["analog"]) {
                     for (var _roiddet in NUMBERS[_roi]["analog"]) {
-                        text = NUMBERS[_roi]["name"] + "." + NUMBERS[_roi]["analog"][_roiddet]["name"];
-                        text = text + " " + NUMBERS[_roi]["analog"][_roiddet]["x"];
-                        text = text + " " + NUMBERS[_roi]["analog"][_roiddet]["y"];
-                        text = text + " " + NUMBERS[_roi]["analog"][_roiddet]["dx"];
-                        text = text + " " + NUMBERS[_roi]["analog"][_roiddet]["dy"];
-                        text = text + " " + NUMBERS[_roi]["analog"][_roiddet]["CCW"];
-                        config_split.push(text);
+                        var text_analog = NUMBERS[_roi]["name"] + "." + NUMBERS[_roi]["analog"][_roiddet]["name"];
+                        text_analog = text_analog + " " + NUMBERS[_roi]["analog"][_roiddet]["x"];
+                        text_analog = text_analog + " " + NUMBERS[_roi]["analog"][_roiddet]["y"];
+                        text_analog = text_analog + " " + NUMBERS[_roi]["analog"][_roiddet]["dx"];
+                        text_analog = text_analog + " " + NUMBERS[_roi]["analog"][_roiddet]["dy"];
+                        text_analog = text_analog + " " + NUMBERS[_roi]["analog"][_roiddet]["CCW"];
+                        config_split.push(text_analog);
                     }
                     }
                 }
                 }
             }
             }
@@ -818,10 +628,10 @@ function WriteConfigININew() {
 		  
 		  
         if (cat == "Alignment") {
         if (cat == "Alignment") {
             for (var _roi in REFERENCES) {
             for (var _roi in REFERENCES) {
-                text = REFERENCES[_roi]["name"];
-                text = text + " " + REFERENCES[_roi]["x"];
-                text = text + " " + REFERENCES[_roi]["y"];
-                config_split.push(text);
+                var text_alignment = REFERENCES[_roi]["name"];
+                text_alignment = text_alignment + " " + REFERENCES[_roi]["x"];
+                text_alignment = text_alignment + " " + REFERENCES[_roi]["y"];
+                config_split.push(text_alignment);
             }
             }
         }
         }
 
 
@@ -838,33 +648,6 @@ function isCommented(input) {
     }
     }
 		  
 		  
     return [isComment, input];
     return [isComment, input];
-}    
-
-function SaveConfigToServer(_domainname){
-    // leere Zeilen am Ende löschen
-    var zw = config_split.length - 1;
-	 
-    while (config_split[zw] == "") {
-        config_split.pop();
-    }
-
-    var config_gesamt = "";
-	 
-    for (var i = 0; i < config_split.length; ++i)
-    {
-        config_gesamt = config_gesamt + config_split[i] + "\n";
-    } 
-
-    FileDeleteOnServer("/config/config.ini", _domainname);
-    FileSendContent(config_gesamt, "/config/config.ini", _domainname);          
-}
-
-function getConfig() {
-    return config_gesamt;
-}
-
-function getConfigCategory() {
-    return category;
 }
 }
 
 
 function ExtractROIs(_aktline, _type){
 function ExtractROIs(_aktline, _type){
@@ -903,8 +686,9 @@ function getNUMBERS(_name, _type, _create = true) {
         }
         }
     }
     }
 
 
-    if (!_create) {         // nicht gefunden und soll auch nicht erzeugt werden, ggf. geht eine NULL zurück
-          return _ret;
+    if (!_create) {         
+        // nicht gefunden und soll auch nicht erzeugt werden, ggf. geht eine NULL zurück
+        return _ret;
     }
     }
 
 
     if (_ret == -1) {
     if (_ret == -1) {
@@ -931,7 +715,8 @@ function getNUMBERS(_name, _type, _create = true) {
         NUMBERS.push(_ret);
         NUMBERS.push(_ret);
     }
     }
 
 
-    if (typeof _type == 'undefined') {            // muss schon existieren !!! - also erst nach Digits / Analog aufrufen
+    if (typeof _type == 'undefined') {
+        // muss schon existieren !!! - also erst nach Digits / Analog aufrufen
         return _ret;
         return _ret;
     }
     }
 
 
@@ -942,66 +727,6 @@ function getNUMBERS(_name, _type, _create = true) {
     return neuroi;
     return neuroi;
 }
 }
 
 
-function CopyReferenceToImgTmp(_domainname) {
-    for (index = 0; index < 2; ++index) {
-        _filenamevon = REFERENCES[index]["name"];
-        _filenamenach = _filenamevon.replace("/config/", "/img_tmp/");
-        FileDeleteOnServer(_filenamenach, _domainname);
-        FileCopyOnServer(_filenamevon, _filenamenach, _domainname);
-     
-        _filenamevon = _filenamevon.replace(".jpg", "_org.jpg");
-        _filenamenach = _filenamenach.replace(".jpg", "_org.jpg");
-        FileDeleteOnServer(_filenamenach, _domainname);
-        FileCopyOnServer(_filenamevon, _filenamenach, _domainname);
-    }
-}
-
-function GetReferencesInfo(){
-    return REFERENCES;
-}
-
-function UpdateConfigReferences(_domainname){
-    for (var index = 0; index < 2; ++index) {
-        _filenamenach = REFERENCES[index]["name"];
-        _filenamevon = _filenamenach.replace("/config/", "/img_tmp/");
-        FileDeleteOnServer(_filenamenach, _domainname);
-        FileCopyOnServer(_filenamevon, _filenamenach, _domainname);
-     
-        _filenamenach = _filenamenach.replace(".jpg", "_org.jpg");
-        _filenamevon = _filenamevon.replace(".jpg", "_org.jpg");
-        FileDeleteOnServer(_filenamenach, _domainname);
-        FileCopyOnServer(_filenamevon, _filenamenach, _domainname);
-    }
-}
-
-function UpdateConfigReference(_anzneueref, _domainname){
-    var index = 0;
-
-    if (_anzneueref == 1) {	
-        index = 0;
-    }
-
-    else if (_anzneueref == 2) {
-        index = 1;
-    }
-
-    _filenamenach = REFERENCES[index]["name"];
-    _filenamevon = _filenamenach.replace("/config/", "/img_tmp/");
-
-    FileDeleteOnServer(_filenamenach, _domainname);
-    FileCopyOnServer(_filenamevon, _filenamenach, _domainname);
-
-    _filenamenach = _filenamenach.replace(".jpg", "_org.jpg");
-    _filenamevon = _filenamevon.replace(".jpg", "_org.jpg");
-
-    FileDeleteOnServer(_filenamenach, _domainname);
-    FileCopyOnServer(_filenamevon, _filenamenach, _domainname);
-}	
-
-function getNUMBERInfo(){
-     return NUMBERS;
-}
-
 function RenameNUMBER(_alt, _neu){
 function RenameNUMBER(_alt, _neu){
     if ((_neu.indexOf(".") >= 0) || (_neu.indexOf(",") >= 0) || (_neu.indexOf(" ") >= 0) || (_neu.indexOf("\"") >= 0)) {
     if ((_neu.indexOf(".") >= 0) || (_neu.indexOf(",") >= 0) || (_neu.indexOf(" ") >= 0) || (_neu.indexOf("\"") >= 0)) {
         return "Number sequence name must not contain , . \" or a space";
         return "Number sequence name must not contain , . \" or a space";
@@ -1096,6 +821,34 @@ function CreateNUMBER(_numbernew){
     return "";
     return "";
 }
 }
 
 
+function DeleteNUMBER(_delte) {
+    if (NUMBERS.length == 1) {
+        return "The last number cannot be deleted"
+    }
+	
+    index = -1;
+    
+    for (i = 0; i < NUMBERS.length; ++i) {
+        if (NUMBERS[i]["name"] == _delte) {
+            index = i;
+        }
+    }
+
+    if (index > -1) {
+        NUMBERS.splice(index, 1);
+    }
+
+    return "";
+}
+
+function GetReferencesInfo(){
+    return REFERENCES;
+}
+
+function getNUMBERInfo(){
+     return NUMBERS;
+}
+
 function getROIInfo(_typeROI, _number){
 function getROIInfo(_typeROI, _number){
     index = -1;
     index = -1;
     
     
@@ -1151,26 +904,6 @@ function RenameROI(_number, _type, _alt, _neu){
     return "";
     return "";
 }
 }
 
 
-function DeleteNUMBER(_delte) {
-    if (NUMBERS.length == 1) {
-        return "The last number cannot be deleted"
-    }
-	
-    index = -1;
-    
-    for (i = 0; i < NUMBERS.length; ++i) {
-        if (NUMBERS[i]["name"] == _delte) {
-            index = i;
-        }
-    }
-
-    if (index > -1) {
-        NUMBERS.splice(index, 1);
-    }
-
-    return "";
-}
-
 function CreateROI(_number, _type, _pos, _roinew, _x, _y, _dx, _dy, _CCW){
 function CreateROI(_number, _type, _pos, _roinew, _x, _y, _dx, _dy, _CCW){
     _indexnumber = -1;
     _indexnumber = -1;
     
     
@@ -1208,4 +941,4 @@ function CreateROI(_number, _type, _pos, _roinew, _x, _y, _dx, _dy, _CCW){
     NUMBERS[_indexnumber][_type].splice(_pos+1, 0, _ret);
     NUMBERS[_indexnumber][_type].splice(_pos+1, 0, _ret);
 
 
     return "";
     return "";
-}
+}

+ 3 - 2
sd-card/html/reboot_page.html

@@ -18,6 +18,7 @@ p {font-size: 1em;}
 </style>
 </style>
 
 
 <script type="text/javascript" src="common.js?v=$COMMIT_HASH"></script> 
 <script type="text/javascript" src="common.js?v=$COMMIT_HASH"></script> 
+<script type="text/javascript">var domainname = getDomainname();</script>
 </head>
 </head>
 
 
 <body style="font-family: arial; padding: 0px 10px;">
 <body style="font-family: arial; padding: 0px 10px;">
@@ -32,9 +33,9 @@ p {font-size: 1em;}
 	</tr>
 	</tr>
 </table>
 </table>
 
 
-<script>
+<script type="text/javascript">
 function doReboot() {
 function doReboot() {
-	var stringota = getDomainname() + "/reboot";
+	var stringota = domainname + "/reboot";
 	window.location = stringota;
 	window.location = stringota;
 	window.location.href = stringota;
 	window.location.href = stringota;
 	window.location.assign(stringota);
 	window.location.assign(stringota);

+ 8 - 8
sd-card/html/setup.html

@@ -57,15 +57,19 @@ body, html {
 }
 }
 
 
 </style>
 </style>
+
+<script type="text/javascript" src="common.js?v=$COMMIT_HASH"></script>
+<script type="text/javascript">var domainname = getDomainname();</script>
+	
 <script type="text/javascript">
 <script type="text/javascript">
     function resizeIframe(obj) {
     function resizeIframe(obj) {
         obj.style.height = obj.contentWindow.document.documentElement.scrollHeight + 20 + 'px';
         obj.style.height = obj.contentWindow.document.documentElement.scrollHeight + 20 + 'px';
     }
     }
 </script>
 </script>
+
 </head>
 </head>
 
 
 <body style="font-family: arial">
 <body style="font-family: arial">
-
     <table style="border: none">
     <table style="border: none">
         <tr>
         <tr>
             <td style="padding-right: 10px;"><img src="favicon.ico?v=$COMMIT_HASH"></td>
             <td style="padding-right: 10px;"><img src="favicon.ico?v=$COMMIT_HASH"></td>
@@ -96,7 +100,6 @@ body, html {
         </tr>
         </tr>
     </table>
     </table>
 
 
-
     <div class="h_iframe_explain" id="h_iframe_explain">
     <div class="h_iframe_explain" id="h_iframe_explain">
         <iframe name="explaincontent" id ="explaincontent" src="" allowfullscreen></iframe>
         <iframe name="explaincontent" id ="explaincontent" src="" allowfullscreen></iframe>
     </div>
     </div>
@@ -106,8 +109,6 @@ body, html {
         <iframe name="stream" id ="stream" src="" display="none" allowfullscreen></iframe>
         <iframe name="stream" id ="stream" src="" display="none" allowfullscreen></iframe>
     </div>
     </div>
 
 
-
-<script type="text/javascript" src="common.js?v=$COMMIT_HASH"></script> 
 <script type="text/javascript">
 <script type="text/javascript">
     var aktstep = 0;
     var aktstep = 0;
     var setupCompleted = false;
     var setupCompleted = false;
@@ -189,7 +190,7 @@ body, html {
             setupCompleted = false;
             setupCompleted = false;
 
 
             setTimeout(function() {
             setTimeout(function() {
-                document.getElementById('stream').src = getDomainname() + '/stream?flashlight=true';   // needs to be the last statement because it's kind of blocking
+                document.getElementById('stream').src = domainname + '/stream?flashlight=true';   // needs to be the last statement because it's kind of blocking
                 document.getElementById('stream').style.display = "";
                 document.getElementById('stream').style.display = "";
             }, 500);
             }, 500);
             break;
             break;
@@ -308,7 +309,7 @@ body, html {
    }
    }
 
 
    function loadRSSI() {
    function loadRSSI() {
-		url = getDomainname() + '/rssi';     
+		url = domainname + '/rssi';     
 		var xhttp = new XMLHttpRequest();
 		var xhttp = new XMLHttpRequest();
 		xhttp.onreadystatechange = function() {
 		xhttp.onreadystatechange = function() {
 			if (this.readyState == 4 && this.status == 200) {
 			if (this.readyState == 4 && this.status == 200) {
@@ -339,6 +340,5 @@ body, html {
    LoadStep();
    LoadStep();
 
 
 </script>
 </script>
-
 </body>
 </body>
-</html>
+</html>

Some files were not shown because too many files changed in this diff