async update({ state, commit, dispatch }, payload) {
			const wasPrinting = state.model.state.isPrinting, lastJobFile = state.model.job.file.fileName;
			const beepFrequency = state.model.state.beep.frequency, beepDuration = state.model.state.beep.duration;
			const displayMessage = state.model.state.displayMessage;

			// Merge updates into the object model
			commit('model/update', payload);

			// Is a beep requested?
			if (state.model.state.beep.frequency != 0 && state.model.state.beep.duration != 0 &&
				(state.model.state.beep.frequency != beepFrequency || state.model.state.beep.duration != beepDuration))
				{
					beep(state.model.state.beep.frequency, state.model.state.beep.duration);
				}

				// Is a message supposed to be shown?
				if (state.model.state.displayMessage != "" && state.model.state.displayMessage != displayMessage) {
					showMessage(state.model.state.displayMessage);
				}

				// Is an update or emergency reset in progress?
				const reconnect = (state.model.state.status === 'updating') || (state.model.state.status === 'halted');
				if (reconnect) {
					if (!state.isReconnecting) {
						if (state.model.state.status === 'halted') {
							log('warning', i18n.t('events.emergencyStop'));
						} else {
							log('warning', i18n.t('events.reconnecting'));
						}
						commit('setReconnecting', true);
					}
				} else {
					if (state.isReconnecting) {
						log('success', i18n.t('events.reconnected'));
						commit('setReconnecting', false);
					}

					// Have we just finished a job?
					if (wasPrinting && !state.model.state.isPrinting) {
						// Clear the cache of the last file
						commit('cache/clearFileInfo', lastJobFile);

						// Send M1 if auto-sleep is enabled
						if (state.autoSleep) {
							try {
								await dispatch('sendCode', 'M1');
							} catch (e) {
								logCode('M1', e.message, hostname);
							}
						}
					}
				}
			}
// Update machine mode. Reserved for the machine connector!
Update machine mode. Reserved for the machine connector!
Update machine mode . Reserved for the machine connector!
async update({ state, commit, dispatch }, payload) {
			const wasPrinting = state.model.state.isPrinting, lastJobFile = state.model.job.file.fileName;
			const beepFrequency = state.model.state.beep.frequency, beepDuration = state.model.state.beep.duration;
			const displayMessage = state.model.state.displayMessage;
			commit('model/update', payload);
			if (state.model.state.beep.frequency != 0 && state.model.state.beep.duration != 0 &&
				(state.model.state.beep.frequency != beepFrequency || state.model.state.beep.duration != beepDuration))
				{
					beep(state.model.state.beep.frequency, state.model.state.beep.duration);
				}
				if (state.model.state.displayMessage != "" && state.model.state.displayMessage != displayMessage) {
					showMessage(state.model.state.displayMessage);
				}
				const reconnect = (state.model.state.status === 'updating') || (state.model.state.status === 'halted');
				if (reconnect) {
					if (!state.isReconnecting) {
						if (state.model.state.status === 'halted') {
							log('warning', i18n.t('events.emergencyStop'));
						} else {
							log('warning', i18n.t('events.reconnecting'));
						}
						commit('setReconnecting', true);
					}
				} else {
					if (state.isReconnecting) {
						log('success', i18n.t('events.reconnected'));
						commit('setReconnecting', false);
					}
					if (wasPrinting && !state.model.state.isPrinting) {
						commit('cache/clearFileInfo', lastJobFile);
						if (state.autoSleep) {
							try {
								await dispatch('sendCode', 'M1');
							} catch (e) {
								logCode('M1', e.message, hostname);
							}
						}
					}
				}
			}
async update ( { state , commit , dispatch } , payload ) { const wasPrinting = state . model . state . isPrinting , lastJobFile = state . model . job . file . fileName ; const beepFrequency = state . model . state . beep . frequency , beepDuration = state . model . state . beep . duration ; const displayMessage = state . model . state . displayMessage ; commit ( 'model/update' , payload ) ; if ( state . model . state . beep . frequency != 0 && state . model . state . beep . duration != 0 && ( state . model . state . beep . frequency != beepFrequency || state . model . state . beep . duration != beepDuration ) ) { beep ( state . model . state . beep . frequency , state . model . state . beep . duration ) ; } if ( state . model . state . displayMessage != "" && state . model . state . displayMessage != displayMessage ) { showMessage ( state . model . state . displayMessage ) ; } const reconnect = ( state . model . state . status === 'updating' ) || ( state . model . state . status === 'halted' ) ; if ( reconnect ) { if ( ! state . isReconnecting ) { if ( state . model . state . status === 'halted' ) { log ( 'warning' , i18n . t ( 'events.emergencyStop' ) ) ; } else { log ( 'warning' , i18n . t ( 'events.reconnecting' ) ) ; } commit ( 'setReconnecting' , true ) ; } } else { if ( state . isReconnecting ) { log ( 'success' , i18n . t ( 'events.reconnected' ) ) ; commit ( 'setReconnecting' , false ) ; } if ( wasPrinting && ! state . model . state . isPrinting ) { commit ( 'cache/clearFileInfo' , lastJobFile ) ; if ( state . autoSleep ) { try { await dispatch ( 'sendCode' , 'M1' ) ; } catch ( e ) { logCode ( 'M1' , e . message , hostname ) ; } } } } }
Update machine mode.
Update machine mode .
// Merge updates into the object model // Is a beep requested? // Is a message supposed to be shown? // Is an update or emergency reset in progress? // Have we just finished a job? // Clear the cache of the last file // Send M1 if auto-sleep is enabled