diff --git a/.gitignore b/.gitignore index 09c6592..7cea202 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,9 @@ pids # node-waf configuration .lock-wscript + +# vscode +.vscode + +# +package-lock.json diff --git a/app/server/blink1Service.js b/app/server/blink1Service.js index 663cb0c..b1f1e76 100644 --- a/app/server/blink1Service.js +++ b/app/server/blink1Service.js @@ -31,6 +31,7 @@ var listeners = []; // callback listeners /** * blink1 devices currently opened. + * This is a global because this is true across entire Node process * One entry per blink1, with always at least one entry. * Entry 0 is 'default' entry when no blink1 is plugged in. * Format: @@ -439,13 +440,14 @@ var Blink1Service = { * @param {Object} pattern a pattern from PatternsService * @param {boolean} fill whether or not to fill-out the pattern with last pattern line * @param {String} blink1id blink1 serial number or id or nothing to use first blink1 + * @return error message, if any */ writePatternToBlink1: function(pattern, fill, blink1id) { log.msg("writePatternToBlink1: ") var blink1idx = this.idToBlink1Index(blink1id); var colors = pattern.colors; if( !colors ) { - // error + return "no colors in pattern"; } var pattlen = colors.length; if( pattlen < 32 ) { // extend out pattern to fill @@ -454,9 +456,7 @@ var Blink1Service = { colors.push( (fill) ? colors[i] : c ); } } - log.msg("newpatt:",colors); // if the device exists - // (async () => { if( blink1s[blink1idx] && blink1s[blink1idx].device ) { var blink1dev = blink1s[blink1idx].device; for(var i=0; i