can now have multiple triggers

+ Pattern.log now makes sense
This commit is contained in:
Felix Roos 2022-11-12 16:52:00 +01:00
parent 27fb2d2d5b
commit ff5d14fb63
9 changed files with 32 additions and 22 deletions

View file

@ -17,12 +17,14 @@ export function repl({
interval,
onTrigger: async (hap, deadline, duration) => {
try {
if (!hap.context.onTrigger) {
return await defaultOutput(hap, deadline, duration);
if (!hap.context.onTrigger || !hap.context.dominantTrigger) {
await defaultOutput(hap, deadline, duration);
}
if (hap.context.onTrigger) {
const cps = 1;
// call signature of output / onTrigger is different...
await hap.context.onTrigger(getTime() + deadline, hap, getTime(), cps);
}
const cps = 1; // TODO: fix
// call signature of output / onTrigger is different...
return await hap.context.onTrigger(getTime() + deadline, hap, getTime(), cps);
} catch (err) {
logger(`[cyclist] error: ${err.message}`, 'error');
}