diff --git a/components.d.ts b/components.d.ts index 44d756bf8..f8d74a7b1 100644 --- a/components.d.ts +++ b/components.d.ts @@ -21,7 +21,6 @@ declare module 'vue' { FarmPrinterPanel: typeof import('./src/components/panels/FarmPrinterPanel.vue')['default'] FilamentSensor: typeof import('./src/components/inputs/FilamentSensor.vue')['default'] FirmwareRetractionSettings: typeof import('./src/components/panels/MachineSettings/FirmwareRetractionSettings.vue')['default'] - FirmwareRetractionSettingsInput: typeof import('./src/components/inputs/FirmwareRetractionSettingsInput.vue')['default'] GcodefilesPanel: typeof import('./src/components/panels/GcodefilesPanel.vue')['default'] HistoryAllPrintStatus: typeof import('./src/components/charts/HistoryAllPrintStatus.vue')['default'] HistoryFilamentUsage: typeof import('./src/components/charts/HistoryFilamentUsage.vue')['default'] @@ -46,12 +45,10 @@ declare module 'vue' { MjpegstreamerAdaptive: typeof import('./src/components/webcams/MjpegstreamerAdaptive.vue')['default'] MoonrakerStatePanel: typeof import('./src/components/panels/MoonrakerStatePanel.vue')['default'] MotionSettings: typeof import('./src/components/panels/MachineSettings/MotionSettings.vue')['default'] - MotionSettingsInput: typeof import('./src/components/inputs/MotionSettingsInput.vue')['default'] NumberInput: typeof import('./src/components/inputs/NumberInput.vue')['default'] Panel: typeof import('./src/components/ui/Panel.vue')['default'] PowerControlPanel: typeof import('./src/components/panels/PowerControlPanel.vue')['default'] PressureAdvanceSettings: typeof import('./src/components/panels/MachineSettings/PressureAdvanceSettings.vue')['default'] - PressureAdvanceSettingsInput: typeof import('./src/components/inputs/PressureAdvanceSettingsInput.vue')['default'] PrinterSelector: typeof import('./src/components/ui/PrinterSelector.vue')['default'] PrintsettingsPanel: typeof import('./src/components/panels/PrintsettingsPanel.vue')['default'] SettingsConsoleTab: typeof import('./src/components/settings/SettingsConsoleTab.vue')['default'] diff --git a/src/components/inputs/FirmwareRetractionSettingsInput.vue b/src/components/inputs/FirmwareRetractionSettingsInput.vue deleted file mode 100644 index cfef5948b..000000000 --- a/src/components/inputs/FirmwareRetractionSettingsInput.vue +++ /dev/null @@ -1,109 +0,0 @@ - - - - - - - - - mdi-chevron-up - - - mdi-chevron-down - - - - - - - - diff --git a/src/components/inputs/MotionSettingsInput.vue b/src/components/inputs/MotionSettingsInput.vue deleted file mode 100644 index 899ad0d2e..000000000 --- a/src/components/inputs/MotionSettingsInput.vue +++ /dev/null @@ -1,110 +0,0 @@ - - - - - - - - - mdi-chevron-up - - - mdi-chevron-down - - - - - - - - diff --git a/src/components/inputs/NumberInput.vue b/src/components/inputs/NumberInput.vue index 3119b5d8b..5dfd910e8 100644 --- a/src/components/inputs/NumberInput.vue +++ b/src/components/inputs/NumberInput.vue @@ -77,20 +77,20 @@ export default class NumberInput extends Mixins(BaseMixin) { declare readonly param: string // props defining incoming data - @Prop({ type: Number, required: true, default: 0 }) + @Prop({ type: Number, required: true }) declare readonly target: number - @Prop({ type: Number, required: true, default: 0 }) + @Prop({ type: Number, required: true }) declare readonly defaultValue: number // props for internal processing - @Prop({ type: Number, required: true, default: 0 }) + @Prop({ type: Number, required: true }) declare readonly min: number @Prop({ type: Number, default: null }) declare readonly max: number | null - @Prop({ type: Number, required: true, default: 0 }) + @Prop({ type: Number, required: true }) declare readonly dec: number @Prop({ type: Number, required: false, default: 1 }) @@ -147,8 +147,7 @@ export default class NumberInput extends Mixins(BaseMixin) { submit(): void { if (this.invalidInput()) return - this.$emit('target-changed', this.param, this.value) - this.$emit('submit', this.param) + this.$emit('submit', { name: this.param, value: this.value }) } // input validation // diff --git a/src/components/inputs/PressureAdvanceSettingsInput.vue b/src/components/inputs/PressureAdvanceSettingsInput.vue deleted file mode 100644 index ae9ddb727..000000000 --- a/src/components/inputs/PressureAdvanceSettingsInput.vue +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - mdi-chevron-up - - - mdi-chevron-down - - - - - - - - diff --git a/src/components/panels/MachineSettings/FirmwareRetractionSettings.vue b/src/components/panels/MachineSettings/FirmwareRetractionSettings.vue index fd0acb0a5..5794271c0 100644 --- a/src/components/panels/MachineSettings/FirmwareRetractionSettings.vue +++ b/src/components/panels/MachineSettings/FirmwareRetractionSettings.vue @@ -2,10 +2,12 @@ - + @submit="sendCmd"> - + @submit="sendCmd"> - + @submit="sendCmd"> - + @submit="sendCmd"> @@ -67,31 +75,32 @@ diff --git a/src/components/panels/MachineSettings/MotionSettings.vue b/src/components/panels/MachineSettings/MotionSettings.vue index aa6616196..1e4525606 100644 --- a/src/components/panels/MachineSettings/MotionSettings.vue +++ b/src/components/panels/MachineSettings/MotionSettings.vue @@ -2,10 +2,12 @@ - + @submit="sendCmd"> - + @submit="sendCmd"> - + @submit="sendCmd"> - + @submit="sendCmd"> @@ -64,47 +72,56 @@ diff --git a/src/components/panels/MachineSettings/PressureAdvanceSettings.vue b/src/components/panels/MachineSettings/PressureAdvanceSettings.vue index f6aa7f92d..81e9c5e66 100644 --- a/src/components/panels/MachineSettings/PressureAdvanceSettings.vue +++ b/src/components/panels/MachineSettings/PressureAdvanceSettings.vue @@ -1,54 +1,58 @@ - + mdi-restart - - + + @submit="sendCmd"> - - + + @submit="sendCmd"> @@ -58,10 +62,11 @@ import { Component, Mixins } from 'vue-property-decorator' import BaseMixin from '@/components/mixins/base' import Panel from '@/components/ui/Panel.vue' -import PressureAdvanceSettingsInput from '@/components/inputs/PressureAdvanceSettingsInput.vue' +import NumberInput from '@/components/inputs/NumberInput.vue' +import { Debounce } from 'vue-debounce-decorator' @Component({ - components: { Panel, PressureAdvanceSettingsInput }, + components: { Panel, NumberInput }, }) export default class PressureAdvanceSettings extends Mixins(BaseMixin) { private extruders: string[] = [] @@ -71,7 +76,7 @@ export default class PressureAdvanceSettings extends Mixins(BaseMixin) { this.selectedExtruder = this.$store.state.printer.toolhead?.extruder } - get all_extruders(): string[] { + get allExtruders(): string[] { Object.keys(this.$store.state.printer).forEach((e) => { if (e.startsWith('extruder') && !this.extruders.includes(e)) this.extruders.push(e) }) @@ -80,20 +85,20 @@ export default class PressureAdvanceSettings extends Mixins(BaseMixin) { return this.extruders } - get active_extruder(): string { + get activeExtruder(): string { this.resetToActiveExtruder() return this.$store.state.printer.toolhead?.extruder } - get current_pressure_advance(): number { + get pressureAdvance(): number { return Math.floor((this.$store.state.printer?.[this.selectedExtruder]?.pressure_advance ?? 0) * 1000) / 1000 } - get current_smooth_time(): number { + get smoothTime(): number { return Math.floor((this.$store.state.printer?.[this.selectedExtruder]?.smooth_time ?? 0.04) * 1000) / 1000 } - get default_pressure_advance(): number { + get defaultPressureAdvance(): number { return ( Math.floor( (this.$store.state.printer.configfile?.settings?.[this.selectedExtruder]?.pressure_advance ?? 0) * 1000 @@ -101,7 +106,7 @@ export default class PressureAdvanceSettings extends Mixins(BaseMixin) { ) } - get default_smooth_time(): number { + get defaultSmoothTime(): number { return ( Math.floor( (this.$store.state.printer.configfile?.settings?.[this.selectedExtruder] @@ -109,5 +114,13 @@ export default class PressureAdvanceSettings extends Mixins(BaseMixin) { ) / 1000 ) } + + @Debounce(500) + sendCmd(params: { name: string; value: number }): void { + const gcode = `SET_PRESSURE_ADVANCE EXTRUDER=${this.selectedExtruder} ${params.name}=${params.value}` + + this.$store.dispatch('server/addEvent', { message: gcode, type: 'command' }) + this.$socket.emit('printer.gcode.script', { script: gcode }) + } }