fix rbe edge case of sending when change = 0 in narrowband mode

and add test
to close #569
This commit is contained in:
Dave Conway-Jones
2019-08-14 21:35:45 +01:00
parent 75df218a23
commit 2e5b526c55
3 changed files with 28 additions and 2 deletions

View File

@@ -1,6 +1,6 @@
{
"name" : "node-red-node-rbe",
"version" : "0.2.4",
"version" : "0.2.5",
"description" : "A Node-RED node that provides report-by-exception (RBE) and deadband capability.",
"dependencies" : {
},

View File

@@ -56,7 +56,7 @@ module.exports = function(RED) {
if ((node.previous[t] === undefined) && (node.func === "narrowbandEq")) { node.previous[t] = n; }
if (node.previous[t] === undefined) { node.previous[t] = n - node.gap; }
if (Math.abs(n - node.previous[t]) === node.gap) {
if (this.func === "deadbandEq") {
if ((this.func === "deadbandEq")||(this.func === "narrowband")) {
if (node.inout === "out") { node.previous[t] = n; }
node.send(msg);
}