Skip to content

Commit 95387d0

Browse files
committed
Added field for sensor calibration offset
1 parent c0e88c5 commit 95387d0

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

css/style.css

+4
Original file line numberDiff line numberDiff line change
@@ -783,3 +783,7 @@ pre.json {outline: 1px solid #ccc; padding: 5px; margin: 5px;
783783
.boolean { color: #00bfff; }
784784
.null { color: #ff4500; }
785785
.key { color: #d3d3d3; }
786+
787+
input.sensor-calibration {
788+
width: 90px;
789+
}

js/device-config.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,13 @@ function addDeviceToDeviceList(device, pinList, addManual){
326326
"device-value",
327327
"<span class='device-value device-setting'>" + value + "</span>"));
328328
}
329+
if((typeof device.j !== "undefined") ){
330+
var value = device.j;
331+
$settings.append(generateDeviceSettingContainer(
332+
"Calibration Offset",
333+
"sensor-calibration",
334+
'<input type="number" step="0.01" min="-5" max="5" class="sensor-calibration device-setting" value="' + value + '">'));
335+
}
329336
}
330337

331338
function findPinInList(pinList, pinNr){
@@ -585,11 +592,12 @@ function getDeviceConfigString(deviceNr){
585592
configString = addToConfigString(configString,"x", $deviceContainer.find(".pin-type select").val());
586593
configString = addToConfigString(configString,"a", $deviceContainer.find("span.onewire-address").text());
587594
configString = addToConfigString(configString,"n", $deviceContainer.find(".output-nr select").val());
595+
configString = addToConfigString(configString,"j", $deviceContainer.find("input.sensor-calibration").val());
588596

589597
//configString = addToConfigString(configString,"d", 0); // hardwire deactivate for now
590-
//configString = addToConfigString(configString,"j", 0); // hardwire calibration for now
591598

592599
configString += "}";
600+
console.log(configString);
593601
return configString;
594602
}
595603

@@ -602,6 +610,7 @@ function addToConfigString(configString, key, value){
602610

603611
configString += "\"" + key + "\"" + ":" + "\"" + value + "\"";
604612
}
613+
console.log(key);
605614
return configString;
606615
}
607616

0 commit comments

Comments
 (0)