diff --git a/src/components/panels/ExtruderPanel.vue b/src/components/panels/ExtruderPanel.vue index 640d7150..1fef72f4 100644 --- a/src/components/panels/ExtruderPanel.vue +++ b/src/components/panels/ExtruderPanel.vue @@ -9,13 +9,13 @@ Feed amount in mm: - {{ amount }} + {{ amount }} Feedrate in mm/s: - {{ rate }} + {{ rate }} @@ -34,15 +34,6 @@ import Vue from "vue"; export default { - components: { - - }, - data: function() { - return { - feedAmount: 25, - feedrate: 5, - } - }, computed: { ...mapState({ loadings: state => state.socket.loadings, @@ -65,23 +56,39 @@ get() { return [...this.feedrates].sort((a,b) => { return b-a }) } + }, + currentFeedAmount: { + get() { + return parseFloat(this.$store.state.gui.dashboard.extruder.feedamount) + }, + set(newVal) { + return this.$store.dispatch('gui/setSettings', { dashboard: { extruder: { feedamount: newVal } } }) + } + }, + currentFeedRate: { + get() { + return parseFloat(this.$store.state.gui.dashboard.extruder.feedrate) + }, + set(newVal) { + return this.$store.dispatch('gui/setSettings', { dashboard: { extruder: { feedrate: newVal } } }) + } } }, methods: { setFeedAmount(value) { - this.feedAmount = value; + this.currentFeedAmount = value; }, setFeedrate(value) { - this.feedrate = value; + this.currentFeedRate = value; }, sendRetract() { - let gcode = "M83\nG1 E-"+this.feedAmount+" F"+(this.feedrate * 60); + let gcode = "M83\nG1 E-"+this.currentFeedAmount+" F"+(this.currentFeedRate * 60); this.$store.commit('server/addEvent', { message: gcode, type: 'command' }); this.$store.commit('socket/addLoading', { name: 'btnRetract' }); Vue.prototype.$socket.sendObj('printer.gcode.script', { script: gcode }, "socket/removeLoading", { name: 'btnRetract' }); }, sendDetract() { - let gcode = "M83\nG1 E"+this.feedAmount+" F"+(this.feedrate * 60); + let gcode = "M83\nG1 E"+this.currentFeedAmount+" F"+(this.currentFeedRate * 60); this.$store.commit('server/addEvent', { message: gcode, type: 'command' }); this.$store.commit('socket/addLoading', { name: 'btnDetract' }); Vue.prototype.$socket.sendObj('printer.gcode.script', { script: gcode }, "socket/removeLoading", { name: 'btnDetract' }); diff --git a/src/store/gui/index.js b/src/store/gui/index.js index 4e3bf7f4..08efea7f 100644 --- a/src/store/gui/index.js +++ b/src/store/gui/index.js @@ -20,7 +20,9 @@ export function getDefaultState() { stepsZ: [ 25, 1, 0.1 ], }, extruder: { + feedamount: 25, feedamounts: [ 50, 25, 10, 5, 1 ], + feedrate: 5, feedrates: [ 60, 30, 15, 5, 1 ], } },