From a92a71d5e713fcea06d1ed432283ebec9d9bd721 Mon Sep 17 00:00:00 2001 From: Skylar Grant Date: Sat, 30 Nov 2024 18:21:29 -0500 Subject: [PATCH] MVP --- src/custom_modules/HestiaClasses.js | 2 +- src/custom_modules/functions.js | 8 ++++++++ src/main.js | 1 - 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/custom_modules/HestiaClasses.js b/src/custom_modules/HestiaClasses.js index 738b6e9..889fdff 100644 --- a/src/custom_modules/HestiaClasses.js +++ b/src/custom_modules/HestiaClasses.js @@ -131,7 +131,7 @@ module.exports = { } // this.emit('announcement', 'Message is from the frontend, updating state'); // Update the state - state[msgJson.name].on = msgJson.on; + state[msgJson.name] = msgJson; // Emit the state change this.emit('stateChange', oldState, state); } else if (topic === 'hestia/command/startup') { diff --git a/src/custom_modules/functions.js b/src/custom_modules/functions.js index 6e82af3..181be24 100644 --- a/src/custom_modules/functions.js +++ b/src/custom_modules/functions.js @@ -313,6 +313,14 @@ module.exports = { } } + + // Check if the feed rate changed + if (oldState.auger.feedRate !== state.auger.feedRate) { + module.exports.log(`Auger feed rate changed to ${state.auger.feedRate}ms.`, 'DEBUG'); + return new Promise((resolve, reject) => { + resolve(); + }); + } }); // Wait for all promises to resolve diff --git a/src/main.js b/src/main.js index b45c020..4d4db59 100644 --- a/src/main.js +++ b/src/main.js @@ -58,7 +58,6 @@ setInterval(fn.routines.cycleAuger, config.augerTotalCycleTime); /***************************************************************************************/ process.comlink.on('stateChange', (oldState, state) => { fn.log(`ComLink: State change detected.`, 'INFO'); - fn.log(`ComLink: Old State: ${JSON.stringify(oldState.auger)}\nNew State: ${JSON.stringify(state.auger)}`, 'DEBUG'); fn.handlers.stateChange(oldState, state); });