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); });