Skip to content

Instantly share code, notes, and snippets.

@fpillet
Forked from anonymous/CIP.js
Created June 19, 2011 16:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fpillet/1034444 to your computer and use it in GitHub Desktop.
Save fpillet/1034444 to your computer and use it in GitHub Desktop.
alljoins.js
//Setup join arrays for used joins monitoring and clearing
for (var join in gui.allJoins) {
joinType = gui.allJoins[join].charCodeAt(0);
joinNumber = parseInt(gui.allJoins[join].substr(1));
if ((joinType == 0x64) && (joinNumber >= self.DJoin_Low) && (joinNumber <= self.DJoin_High) && (joinNumber != self.DJoin_connectedFB) && (!self.PageJoins[gui.allJoins[join]])) { //digital
self.DJoins.push(gui.allJoins[join]);
self.ClearJoins.push({join:gui.allJoins[join], value:0});
} else if ((joinType == 0x61) && (joinNumber >= self.AJoin_Low) && (joinNumber <= self.AJoin_High)) { //analog
self.AJoins.push(gui.allJoins[join]);
self.ClearJoins.push({join:gui.allJoins[join], value:0});
} else if ((joinType == 0x73) && (joinNumber >= self.SJoin_Low) && (joinNumber <= self.SJoin_High)) { //serial
self.SJoins.push(gui.allJoins[join]);
self.ClearJoins.push({join:gui.allJoins[join], value:""});
}
}
@fpillet
Copy link
Author

fpillet commented Jun 19, 2011

//Setup join arrays for used joins monitoring and clearing
for (var i=0, numJoins=gui.allJoins.length; i < numJoins; i++) {
    var join = gui.allJoins[i];
    var type = join.charAt(0);
    var num = parseInt(join.substr(1));
    if (type === "d" && num >= self.DJoin_Low && num <= self.DJoin_High && num != self.DJoin_connectedFB && !self.PageJoins[join]) {
        //digital
        self.DJoins.push(join);
        self.ClearJoins.push({join:join, value:0});
    } else if (type === "a" && num >= self.AJoin_Low && joinNumber <= self.AJoin_High) {
        //analog
        self.AJoins.push(join);
        self.ClearJoins.push({join:join, value:0});

    } else if (type === "s" && num >= self.SJoin_Low && num <= self.SJoin_High) {
        //serial
        self.SJoins.push(join);
        self.ClearJoins.push({join:join, value:""});
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment