Compare commits
No commits in common. "94af045e0cb3af7db1fc836de863abf91a2cf1df" and "0a90a93269fe12c81cbbd945b8a9068c541f802d" have entirely different histories.
94af045e0c
...
0a90a93269
@ -61,9 +61,9 @@
|
|||||||
],
|
],
|
||||||
"power": {
|
"power": {
|
||||||
"start": {
|
"start": {
|
||||||
"exhaustDelay": 5000,
|
"exhaustDelay": 30000,
|
||||||
"igniterPreheat": 60000,
|
"augerDelay": 60000,
|
||||||
"igniterDelay": 420000
|
"fireCheckDelay": 420000
|
||||||
},
|
},
|
||||||
"stop": {
|
"stop": {
|
||||||
"exhaustDelay": 600000
|
"exhaustDelay": 600000
|
||||||
|
@ -63,68 +63,53 @@ module.exports = {
|
|||||||
module.exports.log(changes);
|
module.exports.log(changes);
|
||||||
}).catch(e => console.error(e));
|
}).catch(e => console.error(e));
|
||||||
|
|
||||||
// Start the exhaust
|
// Power on igniter
|
||||||
this.exhaust().then(() => {
|
gpio.setPin(process.pinMap.get('igniter').board, 1).then(async () => {
|
||||||
// Check for vacuum
|
// Wait for igniter preheat
|
||||||
this.vacuum().then(() => {
|
await module.exports.sleep(config.power.start.exhaustDelay);
|
||||||
// Start the auger
|
|
||||||
this.auger().then(() => {
|
|
||||||
resolve('Startup sequence complete.');
|
|
||||||
}).catch(e => console.error(e));
|
|
||||||
// Preheat the igniter
|
|
||||||
this.igniter().then(() => {
|
|
||||||
module.exports.sleep(config.power.start.igniterDelay).then(() => {
|
|
||||||
// Check for fire
|
|
||||||
this.fire().then(() => {
|
|
||||||
}).catch(e => console.error(e));
|
|
||||||
});
|
|
||||||
}).catch(e => console.error(e));
|
|
||||||
}).catch(e => console.error(e));
|
|
||||||
}).catch(e => console.error(e));
|
}).catch(e => console.error(e));
|
||||||
});
|
|
||||||
},
|
|
||||||
exhaust() {
|
|
||||||
return new Promise(async (resolve, reject) => {
|
|
||||||
// Start exhaust
|
// Start exhaust
|
||||||
gpio.setPin(process.pinMap.get('exhaust').board, 1).then(() => {
|
gpio.setPin(process.pinMap.get('exhaust').board, 1).then(async () => {
|
||||||
// Wait to resolve
|
// Finish igniter preheat
|
||||||
module.exports.sleep(config.power.start.exhaustDelay).then(() => {
|
await module.exports.sleep(config.power.start.augerDelay);
|
||||||
resolve('Exhaust started.');
|
|
||||||
});
|
|
||||||
}).catch(e => console.error(e));
|
}).catch(e => console.error(e));
|
||||||
});
|
|
||||||
},
|
|
||||||
vacuum() {
|
|
||||||
return new Promise(async (resolve, reject) => {
|
|
||||||
// Check for vacuum
|
// Check for vacuum
|
||||||
gpio.readPin(process.pinMap.get('vacuum').board).then(state => {
|
gpio.readPin(process.pinMap.get('vacuum').board).then(state => {
|
||||||
if (state === '0') {
|
if (state === '0') {
|
||||||
reject(new Error('Vacuum failure.'));
|
// Power off exhaust
|
||||||
|
gpio.setPin(process.pinMap.get('exhaust').board, 0).then(() => {
|
||||||
|
// Report vacuum failure
|
||||||
|
reject(new Error('Vacuum failure.'));
|
||||||
|
return;
|
||||||
|
}).catch(e => console.error(e));
|
||||||
} else {
|
} else {
|
||||||
resolve('Vacuum established.');
|
// Start auger
|
||||||
}
|
gpio.setPin(process.pinMap.get('auger').board, 1).then(async () => {
|
||||||
}).catch(e => console.error(e));
|
// Wait for fire
|
||||||
});
|
await module.exports.sleep(config.power.start.fireCheckDelay);
|
||||||
},
|
|
||||||
igniter() {
|
// Power off igniter
|
||||||
return new Promise(async (resolve, reject) => {
|
gpio.setPin(process.pinMap.get('igniter').board, 0).then(() => {
|
||||||
// Start igniter
|
// Check for fire on pof
|
||||||
gpio.setPin(process.pinMap.get('igniter').board, 1).then(() => {
|
gpio.readPin(process.pinMap.get('pof').board).then(state => {
|
||||||
// Wait to resolve
|
if (state === '0') {
|
||||||
module.exports.sleep(config.power.start.igniterPreheat).then(() => {
|
// Power off auger
|
||||||
resolve('Igniter preheated.');
|
gpio.setPin(process.pinMap.get('auger').board, 0).then(() => {
|
||||||
});
|
// Report failed ignition
|
||||||
}).catch(e => console.error(e));
|
reject(new Error('Failed ignition.'));
|
||||||
});
|
}).catch(e => console.error(e));
|
||||||
},
|
} else {
|
||||||
fire() {
|
// Power off auger
|
||||||
return new Promise(async (resolve, reject) => {
|
gpio.setPin(process.pinMap.get('auger').board, 0).then(() => {
|
||||||
// Check for fire
|
// Report successful ignition
|
||||||
gpio.readPin(process.pinMap.get('pof').board).then(state => {
|
resolve('Successful ignition.');
|
||||||
if (state === '0') {
|
}).catch(e => console.error(e));
|
||||||
reject(new Error('Failed ignition.'));
|
}
|
||||||
} else {
|
}).catch(e => console.error(e));
|
||||||
resolve('Successful ignition.');
|
}).catch(e => console.error(e));
|
||||||
|
}).catch(e => console.error(e));
|
||||||
}
|
}
|
||||||
}).catch(e => console.error(e));
|
}).catch(e => console.error(e));
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user