diff --git a/modules/functions.js b/modules/functions.js index 07dfb58..d68bffe 100644 --- a/modules/functions.js +++ b/modules/functions.js @@ -362,19 +362,22 @@ const functions = { gpio.setup(augerPin, gpio.DIR_OUT, (err) => { if (err) reject(err); if (process.env.DEBUG) console.log('== Auger pin initialized.'); + this.auger.ready(); + // Init the Igniter pin + gpio.setup(igniterPin, gpio.DIR_OUT, (err) => { + if (err) reject(err); + if (process.env.DEBUG) console.log('== Igniter pin initialized.'); + this.igniter.ready(); + // Init the Exhaust pin + gpio.setup(exhaustPin, gpio.DIR_OUT, (err) => { + if (err) reject(err); + if (process.env.DEBUG) console.log('== Exhaust pin initialized.'); + this.exhaust.ready(); + // Resolve the promise now that all pins have been initialized + resolve('== GPIO Initialized.'); + }); + }); }); - // Init the Igniter pin - gpio.setup(igniterPin, gpio.DIR_OUT, (err) => { - if (err) reject(err); - if (process.env.DEBUG) console.log('== Igniter pin initialized.'); - }); - // Init the Exhaust pin - gpio.setup(exhaustPin, gpio.DIR_OUT, (err) => { - if (err) reject(err); - if (process.env.DEBUG) console.log('== Exhaust pin initialized.'); - }); - // Resolve the promise now that all pins have been initialized - resolve('== GPIO Initialized.'); } else { // Resolve the promise resolve('== GPIO Simulated');