Change logging for auger

This commit is contained in:
Skylar Grant 2024-12-07 14:57:53 -05:00
parent 292d66ca33
commit 4eed28046f

View File

@ -15,6 +15,9 @@ module.exports = {
console.log(`DEBUG: ${message}`); console.log(`DEBUG: ${message}`);
} }
break; break;
case 'AUGER':
if(process.env.DEBUG_AUGER === "TRUE") console.log(`AUGER: ${message}`);
break;
case 'ERROR': case 'ERROR':
console.error(`ERROR: ${message}`); console.error(`ERROR: ${message}`);
break; break;
@ -106,16 +109,16 @@ module.exports = {
if (process.psState.auger.on) { if (process.psState.auger.on) {
mod.power.auger.on().then((res) => { mod.power.auger.on().then((res) => {
// Sleep while auger is feeding // Sleep while auger is feeding
mod.log(`Auger feeding at ${process.psState.auger.feedRate}ms.`, 'DEBUG'); mod.log(`Auger feeding at ${process.psState.auger.feedRate}ms.`, 'AUGER');
mod.sleep(process.psState.auger.feedRate).then(() => { mod.sleep(process.psState.auger.feedRate).then(() => {
// Turn off auger // Turn off auger
mod.power.auger.off().then((res) => { mod.power.auger.off().then((res) => {
mod.log('Auger cycle complete.', 'DEBUG'); mod.log('Auger cycle complete.', 'AUGER');
}).catch(e => reject(e)); }).catch(e => reject(e));
}); });
}).catch(e => reject(e)); }).catch(e => reject(e));
} else { } else {
mod.log('Auger is disabled.', 'DEBUG'); mod.log('Auger is disabled.', 'AUGER');
} }
} }
}, },