From 2a605f948835155764dcec2a709afa8e6de0a52d Mon Sep 17 00:00:00 2001 From: Jane Petrovna Date: Wed, 26 May 2021 19:56:14 -0400 Subject: [PATCH] add more logging --- lights.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lights.js b/lights.js index d64b227..beef6f0 100644 --- a/lights.js +++ b/lights.js @@ -54,20 +54,23 @@ function tick_pattern() { for (let command of pattern) { if (command.valid) { let instruction = command.instruction; - if (functions[instruction.name.toLowerCase()]) { + let name = instruction.name.toLowerCase(); + if (functions[name]) { for (let target of instruction.args) { let channel = target.channel; if (!targets[channel]) { targets[channel] = 0; } - log.debug("targets " + channel + " " + target.arg); + log.debug("targets " + name + " " + channel + " " + target.arg); targets[channel] = - functions[instruction.name.toLowerCase()](i, target.arg, targets[channel]); + functions[name](i, target.arg, targets[channel]); } } } } - next_pattern[i] = rgb_to_int(targets.r || 0, targets.g || 0, targets.b || 0); + + log.debug(`next: ${targets["r"]}, ${targets["g"]}, ${targets["b"]}`); + next_pattern[i] = rgb_to_int(targets["r"] || 0, targets["g"] || 0, targets["b"] || 0); } } else {