Parcourir la source

formatting and whitespace fixes

bug-decimal-undefined
John Robinson il y a 4 ans
Parent
révision
bddd710d74
Aucune clé connue n'a été trouvée dans la base pour cette signature
3 fichiers modifiés avec 18 ajouts et 18 suppressions
  1. +3
    -3
      boolean-logic-ultimate/BlinkerUltimate.js
  2. +13
    -13
      boolean-logic-ultimate/FilterUltimate.js
  3. +2
    -2
      boolean-logic-ultimate/InterruptFlowUltimate.js

+ 3
- 3
boolean-logic-ultimate/BlinkerUltimate.js Voir le fichier

@@ -26,7 +26,7 @@ module.exports = function (RED) {
}
}
if (msg.hasOwnProperty("payload")) {
// 06/11/2019
// 06/11/2019
if (ToBoolean(msg.payload) === true) {
if (node.tBlinker !== null) clearInterval(node.tBlinker);
node.tBlinker = setInterval(handleTimer, node.blinkfrequency); // Start the timer that handles the queue of telegrams
@@ -40,7 +40,7 @@ module.exports = function (RED) {
node.curPayload = false;
}
}
});

node.on('close', function () {
@@ -85,4 +85,4 @@ module.exports = function (RED) {


RED.nodes.registerType("BlinkerUltimate", BlinkerUltimate);
}
}

+ 13
- 13
boolean-logic-ultimate/FilterUltimate.js Voir le fichier

@@ -10,19 +10,19 @@ module.exports = function(RED) {
if (msg.hasOwnProperty("topic")){
sTopic = (msg.topic === "" ? sTopic : msg.topic);
}
if (typeof msg.payload !== "undefined") {
var bRes = ToBoolean(msg.payload);
if (typeof bRes === "undefined") return;
// 24/01/2020 Clone input message and replace only relevant topics
var msgTrue = RED.util.cloneMessage(msg);
var msgTrue = RED.util.cloneMessage(msg);
msgTrue.topic = sTopic;
msgTrue.payload = true;
var msgFalse = RED.util.cloneMessage(msg);
var msgFalse = RED.util.cloneMessage(msg);
msgFalse.topic = sTopic;
msgFalse.payload = false;
if (bRes === true) {
setNodeStatus({ fill: "green", shape: "dot", text: "(Send) true" });
node.send([msgTrue, null]);
@@ -34,20 +34,20 @@ module.exports = function(RED) {
return;
}
});
function setNodeStatus({fill, shape, text})
{
var dDate = new Date();
node.status({fill: fill,shape: shape,text: text + " (" + dDate.getDate() + ", " + dDate.toLocaleTimeString() + ")"})
}

function ToBoolean( value ) {
var res = false;
if (typeof value === 'boolean') {
res = value;
}
}
else if( typeof value === 'number' || typeof value === 'string' ) {
// Is it formated as a decimal number?
if( decimal.test( value ) ) {
@@ -58,11 +58,11 @@ module.exports = function(RED) {
res = value.toLowerCase() === "true";
}
}
return res;
};
}
}

RED.nodes.registerType("FilterUltimate",FilterUltimate);
}
}

+ 2
- 2
boolean-logic-ultimate/InterruptFlowUltimate.js Voir le fichier

@@ -11,7 +11,7 @@ module.exports = function (RED) {
this.on('input', function (msg) {
var sIncomingTopic = "";
if (msg.hasOwnProperty("topic")) {
// 06/11/2019
// 06/11/2019
sIncomingTopic = msg.topic.replace(/[`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi, ''); // Cut unwanted Characters
if (sIncomingTopic == node.sTriggerTopic) {
if (msg.hasOwnProperty("play")) {
@@ -73,4 +73,4 @@ module.exports = function (RED) {


RED.nodes.registerType("InterruptFlowUltimate", InterruptFlowUltimate);
}
}

Chargement…
Annuler
Enregistrer