From d96cc86c94f37a52ecddd09308c143da0c297b08 Mon Sep 17 00:00:00 2001 From: Christian Hammacher Date: Tue, 24 Sep 2024 18:37:59 +0200 Subject: [PATCH] Fixes for IS plugin --- package-lock.json | 8 ++--- package.json | 2 +- src/plugins/InputShaping/InputShaping.vue | 29 +++++++++---------- .../InputShaping/InputShapingChart.vue | 18 ++++++------ .../RecordMotionProfileDialog.vue | 6 ++-- src/store/machine/model.ts | 18 ------------ 6 files changed, 30 insertions(+), 51 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8f1853e1b..91b05ef90 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "3.6.0-beta.1", "license": "GPL-3.0", "dependencies": { - "@duet3d/connectors": "~3.6.0-beta.11", + "@duet3d/connectors": "~3.6.0-beta.12", "@duet3d/monacotokens": "^3.5.3", "@duet3d/motionanalysis": "^3.4.0", "@duet3d/objectmodel": "~3.6.0-alpha.1", @@ -2091,9 +2091,9 @@ } }, "node_modules/@duet3d/connectors": { - "version": "3.6.0-beta.11", - "resolved": "https://registry.npmjs.org/@duet3d/connectors/-/connectors-3.6.0-beta.11.tgz", - "integrity": "sha512-eJR7mneGQuvRe00JYeMGcEmYzzuJr4UQrPqWiJXYPlj3gnxAxPrjcAoxfy3l0uVHSsNGsXN3c/RuW+0590B3oA==", + "version": "3.6.0-beta.13", + "resolved": "https://registry.npmjs.org/@duet3d/connectors/-/connectors-3.6.0-beta.13.tgz", + "integrity": "sha512-GoGhG3HZGLkRXlFw1MF5e6FzYLl2A2Fb488AkwlsS/LjDes3iGbGt0Th5U8yUF4lGAfo/sXhvb5IaCmaUTfz9Q==", "license": "LGPL-2.1", "dependencies": { "@duet3d/objectmodel": "~3.6.0-alpha.1", diff --git a/package.json b/package.json index ca7eacdfb..780ed01e4 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "report": "vue-cli-service build --report" }, "dependencies": { - "@duet3d/connectors": "~3.6.0-beta.11", + "@duet3d/connectors": "~3.6.0-beta.13", "@duet3d/monacotokens": "^3.5.3", "@duet3d/motionanalysis": "^3.4.0", "@duet3d/objectmodel": "~3.6.0-alpha.1", diff --git a/src/plugins/InputShaping/InputShaping.vue b/src/plugins/InputShaping/InputShaping.vue index 0b4743551..90dbffb6e 100644 --- a/src/plugins/InputShaping/InputShaping.vue +++ b/src/plugins/InputShaping/InputShaping.vue @@ -49,8 +49,7 @@ th {
+ :input-shaper-damping="damping" />
@@ -97,8 +96,6 @@ th { :input-shapers="inputShapers" :input-shaper-frequency="frequency" :input-shaper-damping="damping" - :custom-amplitudes="customAmplitudes" - :custom-durations="customDurations" :estimate-shaper-effect="estimateShaperEffect" :show-values="showOriginalValues" /> @@ -162,7 +159,7 @@ th { @@ -270,23 +267,23 @@ export default { set(value) { if (this.customAmplitudes.length > value) { this.customAmplitudes.splice(value); - this.customDurations.splice(value); + this.customDelays.splice(value); } else { for (let i = this.customAmplitudes.length; i < value; i++) { this.customAmplitudes.push(0); - this.customDurations.push(0); + this.customDelays.push(0); } } } }, canConfigureCustom() { - return this.numCustomCoefficients > 0 && this.customAmplitudes.every(amplitude => amplitude > 0) && this.customDurations.every(duration => duration > 0); + return this.numCustomCoefficients > 0 && this.customAmplitudes.every(amplitude => amplitude > 0) && this.customDelays.every(duration => duration > 0); }, customShaperCode() { if (this.inputShapers.includes('custom') && this.canConfigureCustom) { const amplitudes = this.customAmplitudes.map(amplitude => amplitude.toFixed(3)).reduce((a, b) => a + ':' + b); - const durations = this.customDurations.map(duration => duration.toFixed(4)).reduce((a, b) => a + ':' + b); - return `M593 P"custom" H${amplitudes} T${durations}`; + const delays = this.customDelays.map(duration => duration.toFixed(4)).reduce((a, b) => a + ':' + b); + return `M593 P"custom" H${amplitudes} T${delays}`; } return ''; }, @@ -304,7 +301,7 @@ export default { inputShapers: [], customAmplitudes: [], - customDurations: [], + customDelays: [], customMenu: false, configuringCustomShaper: false, frequency: 0, @@ -344,7 +341,7 @@ export default { setCustomDuration(index, value) { const val = parseFloat(value); if (!isNaN(val) && val >= 0) { - Vue.set(this.customDurations, index, val / 1000); + Vue.set(this.customDelays, index, val / 1000); } }, copy() { @@ -421,7 +418,7 @@ export default { this.frequency = this.shaping.frequency; this.damping = this.shaping.damping; this.customAmplitudes = this.shaping.amplitudes.slice(); - this.customDurations = this.shaping.durations.slice(); + this.customDelays = this.shaping.delays.slice(); // Keep track of file changes this.$root.$on(Events.filesOrDirectoriesChanged, this.filesOrDirectoriesChanged); @@ -441,7 +438,7 @@ export default { if (to === 'custom') { this.customAmplitudes = this.shaping.amplitudes.slice(); - this.customDurations = this.shaping.durations.slice(); + this.customDelays = this.shaping.delays.slice(); } } }, @@ -453,11 +450,11 @@ export default { } } }, - 'shaping.durations': { + 'shaping.delays': { deep: true, handler(to) { if (!this.inputShapers.includes('custom') || this.shaping.type === 'custom') { - this.customDurations = to.slice(); + this.customDelays = to.slice(); } } }, diff --git a/src/plugins/InputShaping/InputShapingChart.vue b/src/plugins/InputShaping/InputShapingChart.vue index a5ca3e80f..2249082d1 100644 --- a/src/plugins/InputShaping/InputShapingChart.vue +++ b/src/plugins/InputShaping/InputShapingChart.vue @@ -30,13 +30,13 @@ export default { inputShaperDamping: Number, // damping factor to use when computing input shaper damping curves customAmplitudes: Array, // amplitudes for the computation of the custom input shaper - customDurations: Array, // durations for the computation of the custom input shaper + customDelays: Array, // delays for the computation of the custom input shaper estimateShaperEffect: Boolean // show estimated shaper effect }, computed: { ...mapState('settings', ['darkTheme']), - showReduction() { return ((this.amplitudes && this.durations) || (!!this.inputShapers && this.inputShapers.length > 0)) && !this.estimateShaperEffect; }, + showReduction() { return ((this.amplitudes && this.delays) || (!!this.inputShapers && this.inputShapers.length > 0)) && !this.estimateShaperEffect; }, resolution() { return (this.frequencies && this.frequencies.length > 2) ? (this.frequencies[1] - this.frequencies[0]) : 0; }, lineAtPoint() { let point = -1; @@ -323,8 +323,8 @@ export default { } // Compute the damping curve for custom parameters - if (this.inputShapers.includes('custom') && this.frequencies && this.frequencies.length > 0 && this.customAmplitudes && this.customDurations && this.customAmplitudes.length > 0 && this.customDurations.length > 0) { - const damping = getInputShaperDamping(this.frequencies, this.customAmplitudes, this.customDurations); + if (this.inputShapers.includes('custom') && this.frequencies && this.frequencies.length > 0 && this.customAmplitudes && this.customDelays && this.customAmplitudes.length > 0 && this.customDelays.length > 0) { + const damping = getInputShaperDamping(this.frequencies, this.customAmplitudes, this.customDelays); if (this.estimateShaperEffect) { for (let key in this.value) { const dataset = { @@ -505,10 +505,10 @@ export default { customAmplitudes: { deep: true, handler() { - if (this.customAmplitudes && this.customDurations) { + if (this.customAmplitudes && this.customDelays) { for (let dataset in this.chart.data.datasets) { if (dataset.isCustom) { - dataset.data = getInputShaperDamping(this.frequencies, this.customAmplitudes, this.customDurations); + dataset.data = getInputShaperDamping(this.frequencies, this.customAmplitudes, this.customDelays); this.update(); return; } @@ -517,13 +517,13 @@ export default { } } }, - customDurations: { + customDelays: { deep: true, handler() { - if (this.customAmplitudes && this.customDurations) { + if (this.customAmplitudes && this.customDelays) { for (let dataset in this.chart.data.datasets) { if (dataset.isCustom) { - dataset.data = getInputShaperDamping(this.frequencies, this.customAmplitudes, this.customDurations); + dataset.data = getInputShaperDamping(this.frequencies, this.customAmplitudes, this.customDelays); this.update(); return; } diff --git a/src/plugins/InputShaping/RecordMotionProfileDialog.vue b/src/plugins/InputShaping/RecordMotionProfileDialog.vue index 7e8f51bbb..0faff1676 100644 --- a/src/plugins/InputShaping/RecordMotionProfileDialog.vue +++ b/src/plugins/InputShaping/RecordMotionProfileDialog.vue @@ -30,7 +30,7 @@
  • Shaper Frequency: {{ frequency }}
  • Damping Factor: {{ damping }}
  • Amplitudes: {{ amplitudes }}
  • -
  • Durations: {{ durations }}
  • +
  • Delays: {{ delays }}
  • @@ -266,8 +266,8 @@ export default { amplitudes() { return (this.move.shaping.type === 'custom') ? this.move.shaping.amplitudes.map(amplitude => amplitude.toString()).reduce((a, b) => a + ', ' + b) : null; }, - durations() { - return (this.move.shaping.type === 'custom') ? this.move.shaping.durations.map(duration => (duration / 1000).toFixed(3) + 'ms').reduce((a, b) => a + ', ' + b) : null; + delays() { + return (this.move.shaping.type === 'custom') ? this.move.shaping.delays.map(duration => (duration / 1000).toFixed(3) + 'ms').reduce((a, b) => a + ', ' + b) : null; }, allAxesHomed() { return !this.move.axes.some(axis => axis.visible && !axis.homed); }, accelerometers() { diff --git a/src/store/machine/model.ts b/src/store/machine/model.ts index c8445147a..79079f6f1 100644 --- a/src/store/machine/model.ts +++ b/src/store/machine/model.ts @@ -152,24 +152,6 @@ export default function (connector: BaseConnector | null): MachineModel { } }, mutations: { - addPlugin(state, plugin: Plugin) { - typedState.plugins.set(plugin.id, plugin); - - const clonedPlugins = new Map(); - for (const [key, value] of typedState.plugins) { - clonedPlugins.set(key, JSON.parse(JSON.stringify(value))); - } - Vue.set(state, "plugins", clonedPlugins); - }, - removePlugin(state, plugin: Plugin) { - typedState.plugins.delete(plugin.id); - - const clonedPlugins = new Map(); - for (const [key, value] of typedState.plugins) { - clonedPlugins.set(key, JSON.parse(JSON.stringify(value))); - } - Vue.set(state, "plugins", clonedPlugins); - }, update(state, data: any) { // Check for i18n actions if (data.state instanceof Object) {