feature: add filament_motion_sensors

Signed-off-by: Stefan Dej <meteyou@gmail.com>
This commit is contained in:
Stefan Dej 2021-05-10 18:09:06 +02:00
parent 576e0eaada
commit 1919aa6921
2 changed files with 7 additions and 8 deletions

View File

@ -1,6 +1,6 @@
<template> <template>
<div> <div>
<div v-for="(runout, index) of this['printer/getFilamentSwitchSensors']" v-bind:key="index"> <div v-for="(runout, index) of filamentSensors" v-bind:key="index">
<v-card class="mt-6"> <v-card class="mt-6">
<v-toolbar flat dense > <v-toolbar flat dense >
<v-toolbar-title> <v-toolbar-title>
@ -18,8 +18,6 @@
</template> </template>
<script> <script>
import { mapGetters } from 'vuex'
export default { export default {
components: { components: {
@ -30,9 +28,9 @@
} }
}, },
computed: { computed: {
...mapGetters([ filamentSensors() {
'printer/getFilamentSwitchSensors' return this.$store.getters["printer/getFilamentSensors"]
]) }
}, },
methods: { methods: {
changeSensor(runout) { changeSensor(runout) {

View File

@ -398,13 +398,14 @@ export default {
}) })
}, },
getFilamentSwitchSensors: state => { getFilamentSensors: state => {
const sensorObjectNames = ['filament_switch_sensor', 'filament_motion_sensor']
let sensors = [] let sensors = []
for (let [key, value] of Object.entries(state)) { for (let [key, value] of Object.entries(state)) {
let nameSplit = key.split(" ") let nameSplit = key.split(" ")
if (nameSplit[0] === "filament_switch_sensor") { if (sensorObjectNames.includes(nameSplit[0])) {
sensors.push({ sensors.push({
name: nameSplit[1], name: nameSplit[1],
enabled: value.enabled, enabled: value.enabled,