fix long standing rbe % change bug (should be abs change)

to close #312
This commit is contained in:
Dave Conway-Jones 2018-02-08 15:51:57 +00:00
parent a89379c631
commit 559edcf0f8
No known key found for this signature in database
GPG Key ID: 9E7F9C73F5168CD4
2 changed files with 2 additions and 2 deletions

View File

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

View File

@ -51,7 +51,7 @@ module.exports = function(RED) {
if (node.start === '') { node.previous[t] = n; }
else { node.previous[t] = node.start; }
}
if (node.pc) { node.gap = (node.previous[t] * node.g / 100) || 0; }
if (node.pc) { node.gap = Math.abs(node.previous[t] * node.g / 100) || 0; }
else { node.gap = Number(node.gap); }
if ((node.previous[t] === undefined) && (node.func === "narrowbandEq")) { node.previous[t] = n; }
if (node.previous[t] === undefined) { node.previous[t] = n - node.gap; }