bugfix: filament runout sensor new design / rework
Signed-off-by: Stefan Dej <meteyou@gmail.com>
This commit is contained in:
parent
339dda6455
commit
6f4f33f1a6
@ -2,15 +2,15 @@
|
||||
<div>
|
||||
<div v-for="(runout, index) of this['printer/getFilamentSwitchSensors']" v-bind:key="index">
|
||||
<v-card class="mt-6">
|
||||
<v-list-item>
|
||||
<v-list-item-avatar color="grey"><v-icon dark>mdi-printer-3d-nozzle-alert</v-icon></v-list-item-avatar>
|
||||
<v-list-item-content>
|
||||
<v-list-item-title class="headline">{{ runout.name }}</v-list-item-title>
|
||||
</v-list-item-content>
|
||||
</v-list-item>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<v-card-text class="px-0 pt-0 pb-2 content">
|
||||
<settings-runout-switch :name="runout.name" :enabled="runout.enabled" :filament_detected="runout.filament_detected"></settings-runout-switch>
|
||||
<v-toolbar flat dense >
|
||||
<v-toolbar-title>
|
||||
<span class="subheading"><v-icon left>mdi-printer-3d-nozzle-alert</v-icon>{{ runout.name }}</span>
|
||||
</v-toolbar-title>
|
||||
<v-spacer></v-spacer>
|
||||
<v-switch v-model="runout.enabled" hide-details @change="changeSensor(runout)" class="settingsRunoutSwitchInput my-0"></v-switch>
|
||||
</v-toolbar>
|
||||
<v-card-text v-if="runout.enabled">
|
||||
<v-chip label block :color="runout.filament_detected ? 'green' : 'red' " class="d-block text-center">{{ runout.filament_detected ? 'detected' : 'empty' }}</v-chip>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</div>
|
||||
@ -19,11 +19,10 @@
|
||||
|
||||
<script>
|
||||
import { mapGetters } from 'vuex'
|
||||
import SettingsRunoutSwitch from "../../../inputs/SettingsRunoutSwitch";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
SettingsRunoutSwitch
|
||||
|
||||
},
|
||||
data: function() {
|
||||
return {
|
||||
@ -36,7 +35,11 @@
|
||||
])
|
||||
},
|
||||
methods: {
|
||||
|
||||
changeSensor(runout) {
|
||||
const gcode = 'SET_FILAMENT_SENSOR SENSOR='+runout.name+' ENABLE='+(runout.enabled ? 1 : 0)
|
||||
this.$store.commit('server/addEvent', gcode)
|
||||
this.$socket.sendObj('printer.gcode.script', { script: gcode })
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
@ -1,51 +0,0 @@
|
||||
<style>
|
||||
.settingsRunoutSwitchInput .v-messages {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<v-row class="px-6" >
|
||||
<v-col sm-12>
|
||||
<v-switch v-model="value" :label="enabled ? 'enabled' : 'disabled'" @change="changeSensor()" class="settingsRunoutSwitchInput my-0"></v-switch>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row class="px-6" v-if="value" >
|
||||
<v-col sm-12>
|
||||
<label class="mt-1 d-inline-block">Filament:</label>
|
||||
<v-chip class="float-right" :color="filament_detected ? 'green' : 'red' " text-color="white">{{ filament_detected ? 'detected' : 'empty' }}</v-chip>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data: function() {
|
||||
return {
|
||||
value: false,
|
||||
}
|
||||
},
|
||||
props: {
|
||||
name: String,
|
||||
enabled: Boolean,
|
||||
filament_detected: Boolean,
|
||||
|
||||
},
|
||||
computed: {
|
||||
|
||||
},
|
||||
methods: {
|
||||
changeSensor() {
|
||||
let gcode = 'SET_FILAMENT_SENSOR SENSOR='+this.name+' ENABLE='+(this.value ? 1 : 0)
|
||||
this.$store.commit('server/addEvent', gcode)
|
||||
this.$socket.sendObj('printer.gcode.script', { script: gcode })
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.value = this.enabled
|
||||
}
|
||||
}
|
||||
</script>
|
Loading…
x
Reference in New Issue
Block a user