Matching log style

This commit is contained in:
Skylar Grant 2022-12-06 00:31:21 -05:00
parent 8111fafbad
commit 8936a96af7
2 changed files with 11 additions and 12 deletions

View File

@ -168,8 +168,7 @@ const functions = {
init(gpio) { init(gpio) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// Boot/About/Info // Boot/About/Info
console.log(` console.log(`== Lennox Winslow PS40
== Lennox Winslow PS40
== Pellet Stove Control Panel == Pellet Stove Control Panel
== Author: Skylar Grant == Author: Skylar Grant
== Version: v${package.version} == Version: v${package.version}
@ -187,29 +186,29 @@ const functions = {
// Init the Auger pin // Init the Auger pin
gpio.setup(augerPin, gpio.DIR_OUT, (err) => { gpio.setup(augerPin, gpio.DIR_OUT, (err) => {
if (err) reject(err); if (err) reject(err);
if (process.env.DEBUG == 'true') console.log('Auger pin initialized.'); if (process.env.DEBUG == 'true') console.log('== Auger pin initialized.');
// Init the igniter pin // Init the igniter pin
gpio.setup(igniterPin, gpio.DIR_OUT, (err) => { gpio.setup(igniterPin, gpio.DIR_OUT, (err) => {
if (err) reject(err); if (err) reject(err);
if (process.env.DEBUG == 'true') console.log('Igniter pin initialized.'); if (process.env.DEBUG == 'true') console.log('== Igniter pin initialized.');
// Init the blower pin // Init the blower pin
gpio.setup(blowerPin, gpio.DIR_OUT, (err) => { gpio.setup(blowerPin, gpio.DIR_OUT, (err) => {
if (err) reject(err); if (err) reject(err);
if (process.env.DEBUG == 'true') console.log('Combustion blower pin initialized.'); if (process.env.DEBUG == 'true') console.log('== Combustion blower pin initialized.');
// Init the Proof of Fire pin // Init the Proof of Fire pin
gpio.setup(pofPin, gpio.DIR_IN, (err) => { gpio.setup(pofPin, gpio.DIR_IN, (err) => {
if (err) reject(err); if (err) reject(err);
if (process.env.DEBUG == 'true') console.log('Proof of Fire pin initialized.'); if (process.env.DEBUG == 'true') console.log('== Proof of Fire pin initialized.');
// Init the Temp Sensor pin // Init the Temp Sensor pin
gpio.setup(tempPin, gpio.DIR_IN, (err) => { gpio.setup(tempPin, gpio.DIR_IN, (err) => {
if (err) reject(err); if (err) reject(err);
if (process.env.DEBUG == 'true') console.log('Temperature pin initialized.'); if (process.env.DEBUG == 'true') console.log('== Temperature pin initialized.');
// Init the Vacuum Switch pin // Init the Vacuum Switch pin
gpio.setup(vacuumPin, gpio.DIR_IN, (err) => { gpio.setup(vacuumPin, gpio.DIR_IN, (err) => {
if (err) reject(err); if (err) reject(err);
if (process.env.DEBUG == 'true') console.log('Vacuum Switch pin initialized.'); if (process.env.DEBUG == 'true') console.log('== Vacuum Switch pin initialized.');
// Resolve the promise now that all pins have been initialized // Resolve the promise now that all pins have been initialized
resolve('GPIO Initialized.'); resolve('== GPIO Initialized.');
}); });
}); });
}); });

View File

@ -15,7 +15,7 @@ const dotenv = require('dotenv').config();
// Setup for use with the Pi's GPIO pins // Setup for use with the Pi's GPIO pins
if (process.env.ONPI == 'true') { if (process.env.ONPI == 'true') {
console.log('Running on a Raspberry Pi.'); console.log('== Running on a Raspberry Pi.');
const gpio = require('rpi-gpio'); const gpio = require('rpi-gpio');
fn.init(gpio).then((res, rej) => { fn.init(gpio).then((res, rej) => {
if (res != undefined) { if (res != undefined) {
@ -26,7 +26,7 @@ if (process.env.ONPI == 'true') {
} }
}); });
} else if (process.env.ONPI == 'false') { } else if (process.env.ONPI == 'false') {
console.log('Not running on a Raspberry Pi.'); console.log('== Not running on a Raspberry Pi.');
const gpio = 'gpio'; const gpio = 'gpio';
fn.init(gpio).then((res, rej) => { fn.init(gpio).then((res, rej) => {
if (res != undefined) { if (res != undefined) {
@ -37,7 +37,7 @@ if (process.env.ONPI == 'true') {
} }
}); });
} else { } else {
console.log('Problem with ENV file.'); console.log('== Problem with ENV file.');
} }
// TODO Add logic for other sensors // TODO Add logic for other sensors