Adding sensor test calls

This commit is contained in:
Skylar Grant 2022-12-18 12:47:03 -05:00
parent a4d93e4757
commit d1ac00f737
1 changed files with 11 additions and 2 deletions

13
main.js
View File

@ -1,6 +1,6 @@
/* Pellet Stove Control Panel /* Pellet Stove Control Panel
* Written by Skylar Grant * Written by Skylar Grant
* v0.2.0 * v0.2
* *
* TODO: * TODO:
* Add logic for other sensors * Add logic for other sensors
@ -128,11 +128,20 @@ function statusCheck(fn, gpio) {
main(fn, gpio); main(fn, gpio);
}); });
// Check the vacuum switch, if the test returns true, the vacuum is sensed
// if it returns false, we will initiate a shutdown
fn.tests.vacuum(gpio).then(status => { fn.tests.vacuum(gpio).then(status => {
if (!status) { if (!status) {
fn.commands.shutdown(gpio); fn.commands.shutdown(gpio);
} }
}) });
// Check the Proof of Fire Switch
fn.tests.pof(gpio).then(status => {
// If the igniter has finished running and no proof of fire is seen, shutdown the stove
// TODO Shutdown will handle checks if it's being called repeatedly.
if (config.status.igniterFinished && (!status)) fn.commands.shutdown(gpio);
});
// blowerOffDelay() returns true only if the blower shutdown has // blowerOffDelay() returns true only if the blower shutdown has
// been initiated AND the specified cooldown time has passed // been initiated AND the specified cooldown time has passed