This commit is contained in:
Skylar Grant 2024-11-30 18:21:29 -05:00
parent 5fadfd2000
commit a92a71d5e7
3 changed files with 9 additions and 2 deletions

View File

@ -131,7 +131,7 @@ module.exports = {
} }
// this.emit('announcement', 'Message is from the frontend, updating state'); // this.emit('announcement', 'Message is from the frontend, updating state');
// Update the state // Update the state
state[msgJson.name].on = msgJson.on; state[msgJson.name] = msgJson;
// Emit the state change // Emit the state change
this.emit('stateChange', oldState, state); this.emit('stateChange', oldState, state);
} else if (topic === 'hestia/command/startup') { } else if (topic === 'hestia/command/startup') {

View File

@ -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 // Wait for all promises to resolve

View File

@ -58,7 +58,6 @@ setInterval(fn.routines.cycleAuger, config.augerTotalCycleTime);
/***************************************************************************************/ /***************************************************************************************/
process.comlink.on('stateChange', (oldState, state) => { process.comlink.on('stateChange', (oldState, state) => {
fn.log(`ComLink: State change detected.`, 'INFO'); 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); fn.handlers.stateChange(oldState, state);
}); });