mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Fix for narrrowbandEq mode start condition failure
And add test As discussed https://discourse.nodered.org/t/the-filter-node-or-the-old-rbe-node/56371
This commit is contained in:
parent
062f76214e
commit
52e4e0e569
@ -58,7 +58,7 @@ module.exports = function(RED) {
|
|||||||
else {
|
else {
|
||||||
var n = parseFloat(value);
|
var n = parseFloat(value);
|
||||||
if (!isNaN(n)) {
|
if (!isNaN(n)) {
|
||||||
if ((typeof node.previous[t] === 'undefined') && (this.func === "narrowband")) {
|
if ((typeof node.previous[t] === 'undefined') && (this.func === "narrowband" || this.func === "narrowbandEq")) {
|
||||||
if (node.start === '') { node.previous[t] = n; }
|
if (node.start === '') { node.previous[t] = n; }
|
||||||
else { node.previous[t] = node.start; }
|
else { node.previous[t] = node.start; }
|
||||||
}
|
}
|
||||||
|
@ -425,7 +425,7 @@ describe('rbe node', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should not send output if x away or greater from original value (narrowbandEq)', function(done) {
|
it('should not send output if x away or greater from original value (narrowbandEq)', function(done) {
|
||||||
var flow = [{"id":"n1", "type":"rbe", func:"narrowbandEq", gap:"10", inout:"out", wires:[["n2"]] },
|
var flow = [{"id":"n1", "type":"rbe", func:"narrowbandEq", gap:"10", inout:"out", start:"1", wires:[["n2"]] },
|
||||||
{id:"n2", type:"helper"} ];
|
{id:"n2", type:"helper"} ];
|
||||||
helper.load(testNode, flow, function() {
|
helper.load(testNode, flow, function() {
|
||||||
var n1 = helper.getNode("n1");
|
var n1 = helper.getNode("n1");
|
||||||
@ -445,6 +445,7 @@ describe('rbe node', function() {
|
|||||||
done();
|
done();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
n1.emit("input", {payload:100});
|
||||||
n1.emit("input", {payload:0});
|
n1.emit("input", {payload:0});
|
||||||
n1.emit("input", {payload:10});
|
n1.emit("input", {payload:10});
|
||||||
n1.emit("input", {payload:5});
|
n1.emit("input", {payload:5});
|
||||||
|
Loading…
Reference in New Issue
Block a user