feature: send an api e-stop instead of M112 gcode

Signed-off-by: Stefan Dej <meteyou@gmail.com>
This commit is contained in:
Stefan Dej committed 2021-04-09 21:00:28 +02:00
1 parent 85770b8489
commit fe05d5c489
3 files changed
+20 -14

No files matched your search

+5 -8
View File
@@ -101,8 +101,7 @@
<script>
import {mapState} from 'vuex'
import Vue from "vue";
import { colorConsoleMessage, formatConsoleMessage } from "@/plugins/helpers";
import { colorConsoleMessage, formatConsoleMessage } from "@/plugins/helpers"
export default {
components: {
@@ -164,12 +163,10 @@ import {mapState} from 'vuex'
},
methods: {
doSend() {
this.$store.commit('socket/addLoading', { name: 'sendGcode' });
this.$store.commit('server/addEvent', { message: this.gcode, type: 'command' });
Vue.prototype.$socket.sendObj('printer.gcode.script', { script: this.gcode }, "socket/removeLoading", { name: 'sendGcode' });
this.lastCommands.push(this.gcode);
this.gcode = "";
this.lastCommandNumber = null;
this.$store.dispatch('printer/sendGcode', this.gcode)
this.lastCommands.push(this.gcode)
this.gcode = ""
this.lastCommandNumber = null
},
onKeyUp() {
if (this.lastCommandNumber === null && this.lastCommands.length) {
+4 -6
View File
@@ -105,9 +105,8 @@
</div>
</template>
<script>
import { mapState, mapGetters } from 'vuex';
import Vue from "vue";
import { colorConsoleMessage, formatConsoleMessage } from "@/plugins/helpers";
import { mapState, mapGetters } from 'vuex'
import { colorConsoleMessage, formatConsoleMessage } from "@/plugins/helpers"
export default {
name: "console",
@@ -171,9 +170,8 @@
},
methods: {
doSend() {
this.$store.commit('socket/addLoading', { name: 'sendGcode' });
this.$store.commit('server/addEvent', { message: this.gcode, type: 'command' });
Vue.prototype.$socket.sendObj('printer.gcode.script', { script: this.gcode }, "socket/removeLoading", { name: 'sendGcode' });
this.$store.dispatch('printer/sendGcode', this.gcode)
this.lastCommands.push(this.gcode);
this.gcode = "";
this.lastCommandNumber = null;
+11
View File
@@ -67,5 +67,16 @@ export default {
removeBedMeshProfile({ commit }, payload) {
commit('socket/removeLoading', { name: 'bedMeshRemove_'+payload.name }, { root: true })
commit('removeBedMeshProfile', payload)
},
sendGcode({ commit }, payload) {
commit('socket/addLoading', { name: 'sendGcode' }, { root: true })
commit('server/addEvent', { message: payload, type: 'command' }, { root: true })
if (payload.toLowerCase().trim() === "m112") {
Vue.prototype.$socket.sendObj('printer.emergency_stop', {}, "socket/removeLoading", { name: 'sendGcode' })
} else {
Vue.prototype.$socket.sendObj('printer.gcode.script', { script: this.gcode }, "socket/removeLoading", { name: 'sendGcode' })
}
}
}