|
|
@@ -17,7 +17,7 @@ class Reading {
|
|
17
|
17
|
* @param {*} param0.min
|
|
18
|
18
|
* @param {*} param0.max
|
|
19
|
19
|
*/
|
|
20
|
|
- constructor({ onRead, unit, min, max }) {
|
|
|
20
|
+ constructor({ onRead=() => "err", unit, min, max }) {
|
|
21
|
21
|
this._readVal = onRead
|
|
22
|
22
|
this.unit = unit
|
|
23
|
23
|
this.max = max
|
|
|
@@ -81,14 +81,24 @@ class Channel {
|
|
81
|
81
|
get val() {
|
|
82
|
82
|
return this._reader.val
|
|
83
|
83
|
}
|
|
|
84
|
+ // Just used to simplify updateChannel()
|
|
|
85
|
+ get onRead() {
|
|
|
86
|
+ return this._reader._readVal
|
|
|
87
|
+ }
|
|
|
88
|
+ get min() {
|
|
|
89
|
+ return this._reader.min
|
|
|
90
|
+ }
|
|
|
91
|
+ get max() {
|
|
|
92
|
+ return this._reader.max
|
|
|
93
|
+ }
|
|
84
|
94
|
get unit() {
|
|
85
|
95
|
return this._reader.unit
|
|
86
|
96
|
}
|
|
87
|
97
|
get aboveRange() {
|
|
88
|
|
- return this._reader.val > this._reader.max
|
|
|
98
|
+ return this.val > this.max
|
|
89
|
99
|
}
|
|
90
|
100
|
get belowRange() {
|
|
91
|
|
- return this._reader.val < this._reader.min
|
|
|
101
|
+ return this.val < this.min
|
|
92
|
102
|
}
|
|
93
|
103
|
get inRange() {
|
|
94
|
104
|
return this._reader.val && !this.aboveRange && !this.belowRange
|