From 40293a22d1b76806e8455b27db69635ecc2fe596 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Thu, 11 Mar 2021 16:12:54 +0100 Subject: [PATCH] feature: add probe to endstop status panel Signed-off-by: Stefan Dej --- .../panels/Settings/EndstopPanel.vue | 40 ++++++++++++++----- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/src/components/panels/Settings/EndstopPanel.vue b/src/components/panels/Settings/EndstopPanel.vue index 5f4c3156..a7d6920b 100644 --- a/src/components/panels/Settings/EndstopPanel.vue +++ b/src/components/panels/Settings/EndstopPanel.vue @@ -7,12 +7,20 @@ - - - - {{ status }} - - +
+ + + + {{ status }} + + + + + + {{ probe ? 'TRIGGERED' : 'open' }} + + +

Press the sync-button on the right-bottom to load the current endstop status.

@@ -45,15 +53,29 @@ ...mapState({ loadings: state => state.socket.loadings, endstops: state => state.printer.endstops, - }) + }), + probe: { + get() { + if ( + 'probe' in this.$store.state.printer && + 'last_query' in this.$store.state.printer.probe + ) return this.$store.state.printer.probe.last_query + + return false + } + } }, created() { this.getEndstops(); }, methods: { syncEndstops() { - this.$store.commit('socket/addLoading', { name: 'queryEndstops' }); - this.$socket.sendObj('printer.query_endstops.status', { }, "printer/getEndstopStatus"); + this.$store.commit('socket/addLoading', { name: 'queryEndstops' }) + this.$socket.sendObj('printer.query_endstops.status', { }, "printer/getEndstopStatus") + if (this.probe !== false) { + this.$store.commit('server/addEvent', { message: "QUERY_PROBE", type: 'command' }) + this.$socket.sendObj('printer.gcode.script', { script: "QUERY_PROBE" }) + } }, getEndstops() { this.sortEndstops = {};