Rixed multiplying message bug.
This commit is contained in:
@@ -28,12 +28,17 @@ module.exports = function(RED) {
|
||||
);
|
||||
|
||||
node.on('input', function(msg, send, done) {
|
||||
let toggleUpdate = false;
|
||||
|
||||
switch (msg.topic) {
|
||||
case "clock":
|
||||
reactor.updateState(msg.timestamp);
|
||||
toggleUpdate = true;
|
||||
break;
|
||||
case "Fluent":
|
||||
reactor.setInfluent = msg;
|
||||
if (msg.payload.inlet == 0) {
|
||||
toggleUpdate = true;
|
||||
}
|
||||
break;
|
||||
case "OTR":
|
||||
reactor.setOTR = msg;
|
||||
@@ -42,7 +47,10 @@ module.exports = function(RED) {
|
||||
console.log("Unknown topic: " + msg.topic);
|
||||
}
|
||||
|
||||
send(reactor.getEffluent);
|
||||
if (toggleUpdate) {
|
||||
reactor.updateState(msg.timestamp);
|
||||
send(reactor.getEffluent);
|
||||
}
|
||||
|
||||
if (done) {
|
||||
done();
|
||||
|
||||
Reference in New Issue
Block a user