asdasd
This commit is contained in:
parent
5ef3a74b15
commit
11ba292d11
1 changed files with 5 additions and 5 deletions
10
lights.js
10
lights.js
|
@ -98,26 +98,26 @@ function tick_pattern() {
|
||||||
log.debug("TICKING PATTERN")
|
log.debug("TICKING PATTERN")
|
||||||
|
|
||||||
let parsed = pattern.parsed;
|
let parsed = pattern.parsed;
|
||||||
log.info(`${JSON.stringify(pattern)} ${JSON.stringify(parsed)}`);
|
log.debug(`${JSON.stringify(pattern)} ${JSON.stringify(parsed)}`);
|
||||||
|
|
||||||
if (parsed && parsed.length > 0) {
|
if (parsed && parsed.length > 0) {
|
||||||
for (let i = 0; i < cfg.leds; i++) {
|
for (let i = 0; i < cfg.leds; i++) {
|
||||||
for (let id in parsed) {
|
for (let id in parsed) {
|
||||||
let command = parsed[id];
|
let command = parsed[id];
|
||||||
log.info(`pattern ${id} ${command}`);
|
log.debug(`pattern ${id} ${command}`);
|
||||||
let name = command["command"];
|
let name = command["command"];
|
||||||
log.info(`${name} matches: ${functions[name]}`);
|
log.debug(`${name} matches: ${functions[name]}`);
|
||||||
if (functions[name] != undefined) {
|
if (functions[name] != undefined) {
|
||||||
if (functions[name].options && functions[name].options["convert_args"]) {
|
if (functions[name].options && functions[name].options["convert_args"]) {
|
||||||
let param_arg1 = parseInt(command.arg1) || targets[command.arg1];
|
let param_arg1 = parseInt(command.arg1) || targets[command.arg1];
|
||||||
let param_arg2 = parseInt(command.arg2) || targets[command.arg2];
|
let param_arg2 = parseInt(command.arg2) || targets[command.arg2];
|
||||||
let result = functions[name].func(i, param_arg1, param_arg2);
|
let result = functions[name].func(i, param_arg1, param_arg2);
|
||||||
log.info(`convert ${command.arg1} ${param_arg1} ${command.arg2} ${param_arg2} ${result}`);
|
log.debug(`convert ${command.arg1} ${param_arg1} ${command.arg2} ${param_arg2} ${result}`);
|
||||||
targets[command.arg1] = result;
|
targets[command.arg1] = result;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
let result = functions[name].func(i, command.arg1, command.arg2);
|
let result = functions[name].func(i, command.arg1, command.arg2);
|
||||||
log.info("no convert " + result);
|
log.debug(`no convert ${command.arg1} = ${result}`);
|
||||||
targets[command.arg1] = result;
|
targets[command.arg1] = result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue