jomjol пре 5 година
родитељ
комит
068d57f382

+ 1 - 0
README.md

@@ -29,6 +29,7 @@ A 3d-printable housing can be found here: https://www.thingiverse.com/thing:4571
 
 ##### Rolling - (2020-11-30)
 
+* Modification `config.ini`: true/false only in small letters, removal of comma as separator (up/downwards compatibility is still given)
 * New feature: time zone can be specified, regular time synchronization possible (see new section `[System]` in configuration)
 
 2020-11-29

BIN
firmware/html.zip


+ 19 - 19
sd-card/config/config.ini

@@ -7,8 +7,8 @@ ImageSize = VGA
 
 [Alignment]
 InitalRotate=180
-/config/ref0.jpg 119, 273
-/config/ref1.jpg 456, 138
+/config/ref0.jpg 119 273
+/config/ref1.jpg 456 138
 SearchFieldX = 20
 SearchFieldY = 20
 
@@ -18,43 +18,43 @@ Model = /config/dig0720s1.tflite
 ;LogImageLocation = /log/digit
 ;LogfileRetentionInDays = 3
 ModelInputSize = 20 32
-digit1, 306, 120, 37, 67
-digit2, 355, 120, 37, 67
-digit3, 404, 120, 37, 67
+digit1 306 120 37 67
+digit2 355 120 37 67
+digit3 404 120 37 67
 
 [Analog]
 Model = /config/ana0630s2.tflite
 ;LogImageLocation = /log/analog
 ;LogfileRetentionInDays = 3
 ModelInputSize = 32 32
-analog1, 444, 225, 92, 92
-analog2, 391, 329, 92, 92
-analog3, 294, 369, 92, 92
-analog4, 168, 326, 92, 92
+analog1 444 225 92 92
+analog2 391 329 92 92
+analog3 294 369 92 92
+analog4 168 326 92 92
 
 [PostProcessing]
 DecimalShift = 0
-PreValueUse = True
+PreValueUse = true
 PreValueAgeStartup = 720
-AllowNegativeRates = False
+AllowNegativeRates = false
 MaxRateValue = 0.1
-ErrorMessage = True
-CheckDigitIncreaseConsistency = True
+ErrorMessage = true
+CheckDigitIncreaseConsistency = true
 
 [MQTT]
-;Uri = mqtt://IP-ADRESS:1883
-;Topic = wasserzaehler/zaehlerstand
-;TopicError = wasserzaehler/error
-;ClientID = wasser
+Uri = mqtt://IP-ADRESS:1883
+Topic = wasserzaehler/zaehlerstand
+TopicError = wasserzaehler/error
+ClientID = wasser
 ;user = USERNAME
 ;password = PASSWORD
 
 [AutoTimer]
-AutoStart = True
+AutoStart = true
 Intervall = 4.85
 
 [Debug]
-Logfile = False
+Logfile = false
 LogfileRetentionInDays = 3
 
 [System]

+ 25 - 17
sd-card/html/edit_config_param.html

@@ -24,7 +24,6 @@ textarea {
 </head>
 
 <body style="font-family: arial; padding: 0px 10px;">
-
 	<table style="width:100%">
 		<tr>
 			<td>
@@ -39,6 +38,8 @@ textarea {
 
 	<br>
 
+	<div id = "divall" style="display:none">
+
 	<table>
 		<tr>
 			<th width="20px"  style="text-align: left;">
@@ -304,8 +305,8 @@ textarea {
 			</td>
 			<td>
 				<select id="PostProcessing_PreValueUse_value1">
-					<option value="0" selected>True</option>
-					<option value="1" >False</option>
+					<option value="0" selected>true</option>
+					<option value="1" >false</option>
 				</select>
 			</td>
 			<td style="font-size: 80%;">
@@ -335,12 +336,12 @@ textarea {
 			</td>
 			<td>
 				<select id="PostProcessing_AllowNegativeRates_value1">
-					<option value="0" selected>True</option>
-					<option value="1" >False</option>
+					<option value="0" selected>true</option>
+					<option value="1" >false</option>
 				</select>
 			</td>
 			<td style="font-size: 80%;">
-				Set on "False" to ensure, that only positive changes are accepted (typically for counter)
+				Set on "false" to ensure, that only positive changes are accepted (typically for counter)
 			</td>
 		</tr>
 		<tr>
@@ -366,8 +367,8 @@ textarea {
 			</td>
 			<td>
 				<select id="PostProcessing_ErrorMessage_value1">
-					<option value="0" selected>True</option>
-					<option value="1" >False</option>
+					<option value="0" selected>true</option>
+					<option value="1" >false</option>
 				</select>
 			</td>
 			<td style="font-size: 80%;">
@@ -383,8 +384,8 @@ textarea {
 			</td>
 			<td>
 				<select id="PostProcessing_CheckDigitIncreaseConsistency_value1">
-					<option value="0" selected>True</option>
-					<option value="1" >False</option>
+					<option value="0" selected>true</option>
+					<option value="1" >false</option>
 				</select>
 			</td>
 			<td style="font-size: 80%;">
@@ -492,12 +493,12 @@ textarea {
 			</td>
 			<td>
 				<select id="AutoTimer_AutoStart_value1">
-					<option value="0" selected>True</option>
-					<option value="1" >False</option>
+					<option value="0" selected>true</option>
+					<option value="1" >false</option>
 				</select>
 			</td>
 			<td style="font-size: 80%;">
-				Start the image recognition immediatly after power up. False is basically for debugging.
+				Start the image recognition immediatly after power up. false is basically for debugging.
 			</td>
 		</tr>
 		<tr>
@@ -527,8 +528,8 @@ textarea {
 			</td>
 			<td>
 				<select id="Debug_Logfile_value1">
-					<option value="0" selected>True</option>
-					<option value="1" >False</option>
+					<option value="0" selected>true</option>
+					<option value="1" >false</option>
 				</select>
 			</td>
 			<td style="font-size: 80%;">
@@ -593,6 +594,8 @@ textarea {
 		<button class="button" id="reboot" type="button" onclick="doReboot()">Reboot to activate updates</button>
 	</p>
 
+</div>
+
 <script type="text/javascript" src="./gethost.js"></script> 
 <script type="text/javascript" src="./readconfigparam.js"></script>  
  
@@ -603,11 +606,16 @@ textarea {
 
 
 function LoadConfigNeu() {
-	basepath = getbasepath();  
+	basepath = getbasepath(); 
+	if (!loadConfig(basepath)) {
+		alert("Config.ini could not be loaded!\nPlease reload the page.");
+		return;
+	} 
 	loadConfig(basepath); 
 	ParseConfig();	
 	UpdateInput();
 	UpdateExpertModus();
+	document.getElementById("divall").style.display = ''; 
 	}
 
 function WriteParameter(_param, _cat, _name, _optional, _select = false, _anzpara = 1){
@@ -623,7 +631,7 @@ function WriteParameter(_param, _cat, _name, _optional, _select = false, _anzpar
 			var textToFind = _param[_cat][_name]["value1"];
 			var dd = document.getElementById(_cat+"_"+_name+"_value1");
 			for (var i = 0; i < dd.options.length; i++) {
-				if (dd.options[i].text === textToFind) {
+				if (dd.options[i].text.toLowerCase() === textToFind.toLowerCase()) {
 					dd.selectedIndex = i;
 					break;
 				}

+ 5 - 5
sd-card/html/readconfig.js

@@ -153,7 +153,7 @@ function SaveROIToConfig(_ROIInfo, _typeROI, _basepath){
           else {
                linewrite++;
           }
-          config_split[linewrite] = _ROIInfo[i]["name"] + ", " + _ROIInfo[i]["x"] + ", " + _ROIInfo[i]["y"] + ", " + _ROIInfo[i]["dx"] + ", " + _ROIInfo[i]["dy"];
+          config_split[linewrite] = _ROIInfo[i]["name"] + " " + _ROIInfo[i]["x"] + " " + _ROIInfo[i]["y"] + " " + _ROIInfo[i]["dx"] + " " + _ROIInfo[i]["dy"];
      }
 
      SaveConfigToServer(_basepath);
@@ -234,7 +234,7 @@ function SaveConfigToServer(_basepath){
 
 function UpdateConfigFileReferenceChange(_basepath){
      for (var _index = 0; _index < ref.length; ++_index){
-          var zeile = ref[_index]["name"] + " " + ref[_index]["x"] + ", " + ref[_index]["y"];
+          var zeile = ref[_index]["name"] + " " + ref[_index]["x"] + " " + ref[_index]["y"];
           var _pos = ref[_index]["pos_ref"];
           config_split[_pos] = zeile;          
      }
@@ -253,10 +253,10 @@ function UpdateConfigFileReferenceChange(_basepath){
      }     
      if (mirror_pos > -1) {
           if (mirror) {
-               config_split[mirror_pos] = "InitialMirror = True";
+               config_split[mirror_pos] = "InitialMirror = true";
           }
           else {
-               config_split[mirror_pos] = "InitialMirror = False";
+               config_split[mirror_pos] = "InitialMirror = false";
           }
      }
      else {
@@ -285,7 +285,7 @@ function UpdateConfigFileReferenceChange(_basepath){
 }
 
 function UpdateConfig(zw, _index, _enhance, _basepath){
-     var zeile = zw["name"] + " " + zw["x"] + ", " + zw["y"];
+     var zeile = zw["name"] + " " + zw["x"] + " " + zw["y"];
      var _pos = ref[_index]["pos_ref"];
      config_split[_pos] = zeile;
 

+ 3 - 0
sd-card/html/readconfigparam.js

@@ -473,16 +473,19 @@ function trim(istring, adddelimiter)
      
 function loadConfig(_basepath) {
      var xhttp = new XMLHttpRequest();
+     config_gesamt = "";
      try {
           url = _basepath + '/fileserver/config/config.ini';     
           xhttp.open("GET", url, false);
           xhttp.send();
           config_gesamt = xhttp.responseText;
+          return true;
      }
      catch (error)
      {
      //          alert("Deleting Config.ini failed");
      }
+     return false;
 }
 	 
 function getConfig() {

+ 1 - 1
sd-card/html/version.txt

@@ -1 +1 @@
-2.0.0
+2.1.0