diff --git a/src/main.js b/src/main.js index c9f9012..86fcfaf 100644 --- a/src/main.js +++ b/src/main.js @@ -135,6 +135,15 @@ process.comlink.on('feedRate', (message) => { } }); +process.on('SIGINT', () => { + fn.log(`Exiting gracefully...`, 'INFO'); + // Fail-safe to turn off all the outputs and keep the exhaust fan on + gpio.setPin(process.pinMap.get('auger').board, 0); + gpio.setPin(process.pinMap.get('igniter').board, 0); + gpio.setPin(process.pinMap.get('exhaust').board, 0); // Exhaust 0: On 1: Off + process.exit(); +}); + /***************************************************************************************/ // Call Things /***************************************************************************************/