-
Notifications
You must be signed in to change notification settings - Fork 17
/
73-bmp085.html
130 lines (123 loc) · 5.37 KB
/
73-bmp085.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
<!--
Copyright 2015 Sergey Krasnov <[email protected]>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- Edit dialog -->
<script type="text/x-red" data-template-name="bmp085">
<div class="form-row">
<label for="node-input-device"><i class="fa fa-cog"></i> Device</label>
<input type="text" id="node-input-device" placeholder="Device">
</div>
<div class="form-row">
<label for="node-input-timer"><i class="fa fa-repeat"></i> Update at</label>
<input type="text" id="node-input-timer" placeholder="Timer" style="width:17%">
<label>sec intervals</label>
</div>
<div class="form-row">
<label><i class="fa fa-tachometer"></i> Units</label>
<label for="node-input-pressureUnits" style="width:15%">Pressure:</label>
<select id="node-input-pressureUnits" style="width:20%">
<option value="mmHg">mm Hg</option>
<option value="hPa">hPa</option>
<option value="mBar">mBar</option>
<option value="inHg">in Hg</option>
</select>
<label for="node-input-temperatureUnits"> Temperature:</label>
<select id="node-input-temperatureUnits" style="width:12%">
<option value="degC">˚C</option>
<option value="degF">˚F</option>
</select>
</div>
<div class="form-row">
<label for="node-input-seaLevel"><i class="fa fa-ship"></i> Correction</label>
<select id="node-input-seaLevel" style="width:73%">
<option value="QFE">output actual uncorrected pressure</option>
<option value="QNH">output pressure corrected to sea level</option>
</select>
</div>
<div class="form-row" id="node-input-row-height">
<label></label>
<label for="node-input-height" style="width:38%">Height above sea level:</label>
<input type="text" id="node-input-height" style="width:17%">
<select id="node-input-heightUnits" style="width:12%">
<option value="m">m</option>
<option value="ft">ft</option>
</select>
</div>
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
</script>
<style>
</style>
<!-- Help text -->
<script type="text/x-red" data-help-name="bmp085">
<p>Reads data from a Bosch BMP085 or BMP180 barometric pressure sensor using the I2C interface</p>
Periodically reads the sensor and sends a message containing both temperature and pressure
(<b>msg.payload.temperature</b> and <b>msg.payload.pressure</b>). The temperature and pressure units
of measurement can be selected as required.</p>
<p>The measured pressure can optionally be corrected to sea level, as used in meteorolgical surface
pressure charts, by entering the actual height above sea level of the sensor (US Standard Atmosphere;
maximum height 11,000m).</p>
<p>The measurement update interval can also be specified.</p>
</script>
<!-- Register node type -->
<script type="text/javascript">
RED.nodes.registerType('bmp085',{
category: 'hardware',
defaults: {
device: {value: '\/dev\/i2c-1', required:false},
timer: {value: '15', required:true},
pressureUnits: {value: 'mmHg', required:true},
temperatureUnits: {value: 'degC', required:true},
seaLevel: {value: 'QFE', required:true},
height: {value:0, required:true},
heightUnits: {value: 'm', required:true},
name: {value:""}
},
color:"#d8bfd8",
inputs:0,
outputs:1,
icon: "chip.png",
label: function() {
return this.name||"BMP085";
},
labelStyle: function() {
return this.name?"node_label_italic":"";
},
oneditprepare: function () {
var correction = $("#node-input-seaLevel");
var height = $("#node-input-height");
correction.change(function () {
var id = correction.find("option:selected").val();
if (id == "QNH") {
$("#node-input-row-height").show();
} else {
$("#node-input-row-height").hide();
}
});
correction.val(this.seaLevel);
correction.change();
if (this.heightUnits == "m") {
height.val(this.height);
} else {
height.val(Math.round(this.height/0.3048*10)/10);
}
},
oneditsave: function () {
var height = $("#node-input-height");
if ($("#node-input-heightUnits option:selected").val() == "ft") {
height.val(height.val()*0.3048);
}
}
});
</script>