Fix call for init
This commit is contained in:
parent
49d855e306
commit
0a90a93269
@ -54,12 +54,12 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
power: {
|
power: {
|
||||||
start: {
|
start: {
|
||||||
init() {
|
init(communicator, state) {
|
||||||
return new Promise(async (resolve, reject) => {
|
return new Promise(async (resolve, reject) => {
|
||||||
// TODO: Check pin states?
|
// TODO: Check pin states?
|
||||||
|
|
||||||
// Set pins to default states
|
// Set pins to default states
|
||||||
module.exports.gpio.setDefaults().then(changes => {
|
module.exports.gpio.setDefaults(communicator, state).then(changes => {
|
||||||
module.exports.log(changes);
|
module.exports.log(changes);
|
||||||
}).catch(e => console.error(e));
|
}).catch(e => console.error(e));
|
||||||
|
|
||||||
|
@ -34,10 +34,10 @@ comms.on('stateChange', (oldState, state) => {
|
|||||||
|
|
||||||
comms.on('startup', () => {
|
comms.on('startup', () => {
|
||||||
console.log(`Startup detected.`);
|
console.log(`Startup detected.`);
|
||||||
fn.power.start.init().catch(e => console.error(e));
|
fn.power.start.init(comms, psState).catch(e => console.error(e));
|
||||||
});
|
});
|
||||||
|
|
||||||
comms.on('shutdown', () => {
|
comms.on('shutdown', () => {
|
||||||
console.log(`Shutdown detected.`);
|
console.log(`Shutdown detected.`);
|
||||||
fn.power.stop.init().catch(e => console.error(e));
|
fn.power.stop.init(comms, psState).catch(e => console.error(e));
|
||||||
});
|
});
|
Loading…
Reference in New Issue
Block a user