Added handlers for ign/exh buttons

This commit is contained in:
Skylar Grant 2023-11-17 10:06:22 -05:00
parent ef726b1853
commit 78a502e959
1 changed files with 40 additions and 0 deletions

View File

@ -58,6 +58,46 @@ app.post('/', (req, response) => {
});
return;
}
if (req.body.igniterOn != undefined) {
fn.commands.igniterOn();
fn.commands.refreshConfig().then(res => {
config = res.config;
response.render('index', { config: JSON.stringify(config) });
return;
});
return;
}
if (req.body.igniterOff != undefined) {
fn.commands.igniterOff();
fn.commands.refreshConfig().then(res => {
config = res.config;
response.render('index', { config: JSON.stringify(config) });
return;
});
return;
}
if (req.body.exhaustOn != undefined) {
fn.commands.exhaustOn();
fn.commands.refreshConfig().then(res => {
config = res.config;
response.render('index', { config: JSON.stringify(config) });
return;
});
return;
}
if (req.body.exhaustOff != undefined) {
fn.commands.exhaustOff();
fn.commands.refreshConfig().then(res => {
config = res.config;
response.render('index', { config: JSON.stringify(config) });
return;
});
return;
}
if (req.body.reload != undefined) {
const updateAugerOffIntervalQuery = `UPDATE intervals SET value = '${2000 - req.body.feedRate}' WHERE key = 'auger_off'`;
const updateAugerOnIntervalQuery = `UPDATE intervals SET value = '${req.body.feedRate}' WHERE key = 'auger_on'`;