Fancy logging

This commit is contained in:
Skylar Grant 2022-12-06 00:28:14 -05:00
parent 6a0d9eeadc
commit 5f4e1cfb41

View File

@ -6,6 +6,9 @@ const pofPin = 16; // Pin for sensing the status (open/closed) of the P
const tempPin = 18; // Pin for receiving data from a DS18B20 OneWire temperature sensor. const tempPin = 18; // Pin for receiving data from a DS18B20 OneWire temperature sensor.
const vacuumPin = 22; // Pin for sensing the status (open/closed) of the vacuum switch. const vacuumPin = 22; // Pin for sensing the status (open/closed) of the vacuum switch.
// Require the package for pulling version numbers
const package = require('./package.json');
// Get environment variables // Get environment variables
const dotenv = require('dotenv').config(); const dotenv = require('dotenv').config();
// Module for working with files // Module for working with files
@ -164,13 +167,23 @@ const functions = {
// Initializes rpi-gpio, or resolves if not on a raspberry pi // Initializes rpi-gpio, or resolves if not on a raspberry pi
init(gpio) { init(gpio) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// Boot About/Info
console.log(`
== Lennox Winslow PS40
== Pellet Stove Control Panel
== Author: Skylar Grant
== Version: v${package.version}
==
== Startup Time: ${new Date().toISOString()}
==
== Environment variables:
== == ONTIME=${process.env.ONTIME}
== == OFFTIME=${process.env.OFFTIME}
== == PAUSETIME=${process.env.PAUSETIME}
== == DEBUG=${process.env.DEBUG}
== == ONPI=${process.env.ONPI}`);
// Write the current env vars to console // Write the current env vars to console
console.log(`Environment variables: console.log(`E`);
ONTIME=${process.env.ONTIME}
OFFTIME=${process.env.OFFTIME}
PAUSETIME=${process.env.PAUSETIME}
DEBUG=${process.env.DEBUG}
ONPI=${process.env.ONPI}`);
// Set up GPIO 4 (pysical pin 7) as output, then call functions.auger.ready() // Set up GPIO 4 (pysical pin 7) as output, then call functions.auger.ready()
if (process.env.ONPI == 'true') { if (process.env.ONPI == 'true') {
// Init the Auger pin // Init the Auger pin