From b5704f4359f5daf8d02bb085d0d2631bddec235c Mon Sep 17 00:00:00 2001 From: Tobias Hopp Date: Mon, 28 Nov 2022 12:05:10 +0100 Subject: [PATCH] fix pumps Took 8 minutes --- src/iTender.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/iTender.ts b/src/iTender.ts index 336ccfd..02d94d7 100644 --- a/src/iTender.ts +++ b/src/iTender.ts @@ -105,7 +105,7 @@ export class iTender { job.estimatedTime = 0; let tolerance = 3; for (let x of amounts) { - let c = await Container.findOne({$and: [{enabled: true}, {filled: {$gt: x.amount + tolerance}}]}); + let c = await Container.findOne({$and: [{enabled: true}, {filled: {$gt: x.amount + tolerance}}, {content: x.ingredient}]}); if (!c) { mixLog("Not enough ingredients!"); reject(RejectReason.NOT_ENOUGH_INGREDIENTS); @@ -118,6 +118,7 @@ export class iTender { } + console.log(amounts); job.drink = drink job.amounts = amounts as { ingredient: IIngredient, amount: number, container: IContainer }[]; if( job.estimatedTime < 0.5 ) @@ -143,7 +144,7 @@ export class iTender { let timers: NodeJS.Timeout[] = []; for (let x of job.amounts) { - console.log(x); + // Start pump here try { await MyGPIO.setup(x.container.pumpPin, GPIO.DIR_OUT)