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>
<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-toolbar flat dense >
<v-toolbar-title>
@ -18,8 +18,6 @@
</template>
<script>
import { mapGetters } from 'vuex'
export default {
components: {
@ -30,9 +28,9 @@
}
},
computed: {
...mapGetters([
'printer/getFilamentSwitchSensors'
])
filamentSensors() {
return this.$store.getters["printer/getFilamentSensors"]
}
},
methods: {
changeSensor(runout) {

View File

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