Skip to content

Commit e91f990

Browse files
authored
fix: able to set limits and setpoint to zero (#92)
With the current implementation you cannot set any of the limits or the setpoint to zero, since 0 is falsy.
1 parent 6684c17 commit e91f990

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

node-red-node-ui-lineargauge/linear_gauge.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,9 @@ module.exports = function(RED) {
160160
}
161161

162162
var payload = msg.payload;
163-
var highLimit = msg.highlimit || 80;
164-
var lowLimit= msg.lowlimit || 20;
165-
var setpoint = msg.setpoint || 50;
163+
var highLimit = msg.highlimit === 0 ? 0 : msg.highlimit || 80;
164+
var lowLimit = msg.lowlimit === 0 ? 0 : msg.lowlimit || 20;
165+
var setpoint = msg.setpoint === 0 ? 0 : msg.setpoint || 50;
166166
var gaugeStart = 0 // this is the gauge starting position, should be left at zero
167167
var gaugeEnd = 188 // this is the length of the gauge, if the gauge is to be longer, this value should be the sum of the heights of the scale areas
168168

0 commit comments

Comments
 (0)