Polished EMR mode and added control panel
This commit is contained in:
parent
743eb6cfcf
commit
225d464ad6
@ -21,9 +21,6 @@ setInterval(() => {
|
||||
}, process.env.AUGER_CYCLE_TIME || 500);
|
||||
}, 2000);
|
||||
|
||||
fn.log('Setting exhaust to low to keep NC relay closed and fan running', 'DEBUG');
|
||||
gpio.setPin(process.pinMap.get('exhaust').board, 0);
|
||||
|
||||
process.on('SIGINT', () => {
|
||||
fn.log(`Exiting gracefully...`, 'INFO');
|
||||
gpio.setPin(process.pinMap.get('auger').board, 0);
|
17
src/_EMR/exh_off.js
Normal file
17
src/_EMR/exh_off.js
Normal file
@ -0,0 +1,17 @@
|
||||
// Import modules
|
||||
const gpio = require('../custom_modules/VoidGPIO.js');
|
||||
const config = require('../custom_modules/config.json');
|
||||
const fn = require('../custom_modules/functions.js');
|
||||
|
||||
// Variables
|
||||
process.pinMap = new Map();
|
||||
|
||||
fn.log('Initializing pinMap', 'DEBUG');
|
||||
for (const pin of config.pins) {
|
||||
process.pinMap.set(pin.key, pin);
|
||||
}
|
||||
|
||||
fn.log('Turning off exhaust', 'INFO');
|
||||
gpio.setPin(process.pinMap.get('exhaust').board, 1);
|
||||
fn.log('Exhast off', 'INFO');
|
||||
process.exit();
|
17
src/_EMR/exh_on.js
Normal file
17
src/_EMR/exh_on.js
Normal file
@ -0,0 +1,17 @@
|
||||
// Import modules
|
||||
const gpio = require('../custom_modules/VoidGPIO.js');
|
||||
const config = require('../custom_modules/config.json');
|
||||
const fn = require('../custom_modules/functions.js');
|
||||
|
||||
// Variables
|
||||
process.pinMap = new Map();
|
||||
|
||||
fn.log('Initializing pinMap', 'DEBUG');
|
||||
for (const pin of config.pins) {
|
||||
process.pinMap.set(pin.key, pin);
|
||||
}
|
||||
|
||||
fn.log('Turning on exhaust', 'INFO');
|
||||
gpio.setPin(process.pinMap.get('exhaust').board, 0);
|
||||
fn.log('Exhast on', 'INFO');
|
||||
process.exit();
|
62
src/_EMR/panel.sh
Normal file
62
src/_EMR/panel.sh
Normal file
@ -0,0 +1,62 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Path variables
|
||||
ROOT_PATH="/srv/hestia"
|
||||
EMR_FOLDER="src/_EMR"
|
||||
|
||||
# Prompt for input
|
||||
echo "##########################################"
|
||||
echo "# Hestia Emergency Control Panel #"
|
||||
echo "##########################################"
|
||||
echo "# 1. Exhaust ON #"
|
||||
echo "# 2. Exhaust OFF #"
|
||||
echo "# 3. Igniter ON #"
|
||||
echo "# 4. Igniter OFF #"
|
||||
echo "# 5. Start Auger Loop #"
|
||||
echo "# 6. Stop Auger Loop #"
|
||||
echo "##########################################"
|
||||
echo "# 0. Exit #"
|
||||
echo "##########################################"
|
||||
|
||||
# Read user input
|
||||
read -p "Menu Option: " choice
|
||||
|
||||
# Switch case on input
|
||||
case $choice in
|
||||
1)
|
||||
echo "Turning Exhaust ON"
|
||||
cd $ROOT_PATH
|
||||
node $EMR_FOLDER/exh_on.js
|
||||
;;
|
||||
2)
|
||||
echo "Turning Exhaust OFF"
|
||||
cd $ROOT_PATH
|
||||
node $EMR_FOLDER/exh_off.js
|
||||
;;
|
||||
3)
|
||||
echo "Turning Igniter ON"
|
||||
cd $ROOT_PATH
|
||||
node $EMR_FOLDER/ign_on.js
|
||||
;;
|
||||
4)
|
||||
echo "Turning Igniter OFF"
|
||||
cd $ROOT_PATH
|
||||
node $EMR_FOLDER/ign_off.js
|
||||
;;
|
||||
5)
|
||||
echo "Starting Auger Loop"
|
||||
cd $ROOT_PATH
|
||||
pm2 start $EMR_FOLDER/auger_loop.js --name hestia-emr
|
||||
;;
|
||||
6)
|
||||
echo "Stopping Auger Loop"
|
||||
cd $ROOT_PATH
|
||||
pm2 stop hestia-emr
|
||||
;;
|
||||
0)
|
||||
echo "Exiting"
|
||||
;;
|
||||
*)
|
||||
echo "Invalid input"
|
||||
;;
|
||||
esac
|
Loading…
Reference in New Issue
Block a user