some more fixes
This commit is contained in:
parent
9ae6acba36
commit
37bd68e9de
1 changed files with 15 additions and 4 deletions
|
@ -58,6 +58,9 @@ async function complex(config) {
|
||||||
}
|
}
|
||||||
await setLedAnimated(indices[index]);
|
await setLedAnimated(indices[index]);
|
||||||
await singleAnimation(JSON.parse(JSON.stringify(config)), indices[index]);
|
await singleAnimation(JSON.parse(JSON.stringify(config)), indices[index]);
|
||||||
|
if (config.options.index === LEDS_ALL) {
|
||||||
|
await clearLedState(indices[index]);
|
||||||
|
}
|
||||||
config.repetitions.done++;
|
config.repetitions.done++;
|
||||||
}
|
}
|
||||||
return complex(config);
|
return complex(config);
|
||||||
|
@ -67,7 +70,7 @@ async function complex(config) {
|
||||||
async function powerOff(config) {
|
async function powerOff(config) {
|
||||||
config.timestamp = new Date().getTime();
|
config.timestamp = new Date().getTime();
|
||||||
let indices = getIndices(config);
|
let indices = getIndices(config);
|
||||||
await forceStop();
|
await forceStop(config.options.index);
|
||||||
for (let index = 0; index < indices.length; index++) {
|
for (let index = 0; index < indices.length; index++) {
|
||||||
await singleAnimation(JSON.parse(JSON.stringify(config)), indices[index]);
|
await singleAnimation(JSON.parse(JSON.stringify(config)), indices[index]);
|
||||||
logger.info('led \'' + indices[index] + '\' powered off');
|
logger.info('led \'' + indices[index] + '\' powered off');
|
||||||
|
@ -124,13 +127,21 @@ async function stopLedsAccordingly(config) {
|
||||||
return stopLedAnimation(config.options.index);
|
return stopLedAnimation(config.options.index);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function forceStop() {
|
async function forceStop(index) {
|
||||||
|
if (index === LEDS_ALL) {
|
||||||
LEDS_STOP.push(LEDS_ALL);
|
LEDS_STOP.push(LEDS_ALL);
|
||||||
return await new Promise((resolve, reject) => {
|
return await new Promise((resolve, reject) => {
|
||||||
waitForAllAnimationsEnd(() => {
|
waitForAllAnimationsEnd(() => {
|
||||||
resolve();
|
resolve();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
setLedStopping(index);
|
||||||
|
return await new Promise((resolve, reject) => {
|
||||||
|
waitForAnimationEnd(index, () => {
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function shouldLedFinish(config) {
|
function shouldLedFinish(config) {
|
||||||
|
|
Loading…
Reference in a new issue