Add graceful shutdown

This commit is contained in:
Skylar Grant 2024-12-07 14:59:45 -05:00
parent 4eed28046f
commit 2a49263797

View File

@ -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
/***************************************************************************************/