touching up logic
This commit is contained in:
parent
7ddb65783c
commit
82fe402b2e
@ -264,9 +264,11 @@ const functions = {
|
|||||||
tests: {
|
tests: {
|
||||||
vacuum(gpio) {
|
vacuum(gpio) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
if (config.status.blower == 1) {
|
||||||
if (process.env.ONPI == 'true') {
|
if (process.env.ONPI == 'true') {
|
||||||
gpio.read(vacuumPin, (err, status) => {
|
gpio.read(vacuumPin, (err, status) => {
|
||||||
if (err) reject(err);
|
if (err) reject(err);
|
||||||
|
config.status.vacuum = status;
|
||||||
resolve(status);
|
resolve(status);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@ -282,6 +284,11 @@ const functions = {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// If the blower isn't on, the vacuum doesn't matter so always return true
|
||||||
|
resolve(true);
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
pof(gpio) {
|
pof(gpio) {
|
||||||
@ -289,6 +296,7 @@ const functions = {
|
|||||||
if (process.env.ONPI == 'true') {
|
if (process.env.ONPI == 'true') {
|
||||||
gpio.read(pofPin, (err, status) => {
|
gpio.read(pofPin, (err, status) => {
|
||||||
if (err) reject(err);
|
if (err) reject(err);
|
||||||
|
config.status.pof = status;
|
||||||
resolve(status);
|
resolve(status);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
1
main.js
1
main.js
@ -124,6 +124,7 @@ async function main(fn, gpio) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function statusCheck(fn, gpio) {
|
function statusCheck(fn, gpio) {
|
||||||
|
// Once per cycle, write the config variable to the file so it can be read by the web server
|
||||||
fn.commands.writeConfig();
|
fn.commands.writeConfig();
|
||||||
if (config.status.shutdown == 1) {
|
if (config.status.shutdown == 1) {
|
||||||
console.log(fn.commands.shutdown(gpio) || 'Shutting down...');
|
console.log(fn.commands.shutdown(gpio) || 'Shutting down...');
|
||||||
|
Loading…
Reference in New Issue
Block a user