new dynamic range on tool slider
This commit is contained in:
4 files changed
+107
-32
No files matched your search
+3
-1
@@ -1,3 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
npm install
|
||||
if [ ! -d 'node_modules' ]; then
|
||||
npm ci
|
||||
fi
|
||||
npm run serve
|
||||
@@ -17,15 +17,15 @@
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<v-card class="mt-6" v-if="['printing', 'paused'].includes(printer_state)">
|
||||
<v-card class="mt-6" v-if="['printing', 'paused', 'standby'].includes(printer_state)">
|
||||
<v-toolbar flat dense >
|
||||
<v-toolbar-title>
|
||||
<span class="subheading"><v-icon class="mdi mdi-printer-3d" left></v-icon>Print Settings</span>
|
||||
</v-toolbar-title>
|
||||
</v-toolbar>
|
||||
<tool-slider label="Speed factor" :target="speed_factor" :max="200" :multi="100" :step="5" command="M220" attribute-name="S" ></tool-slider>
|
||||
<tool-slider label="Speed factor" :target="speed_factor" :max="200" :multi="100" :step="5" :dynamic-range="true" command="M220" attribute-name="S" ></tool-slider>
|
||||
<v-divider></v-divider>
|
||||
<tool-slider label="Extrusion factor" :target="extrude_factor" :max="200" :multi="100" :step="1" command="M221" attribute-name="S" ></tool-slider>
|
||||
<tool-slider label="Extrusion factor" :target="extrude_factor" :max="200" :multi="100" :step="1" :dynamic-range="true" command="M221" attribute-name="S" ></tool-slider>
|
||||
</v-card>
|
||||
<v-card class="mt-6" v-if="this['printer/getMiscellaneous'].length">
|
||||
<v-toolbar flat dense >
|
||||
@@ -66,5 +66,8 @@
|
||||
'printer/getMiscellaneous',
|
||||
]),
|
||||
},
|
||||
mounted() {
|
||||
console.log(this.printer_state);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -5,13 +5,13 @@
|
||||
<span class="subheading"><v-icon left>mdi-speedometer</v-icon>Machine Limits</span>
|
||||
</v-toolbar-title>
|
||||
</v-toolbar>
|
||||
<tool-slider label="Velocity" unit="mm/s" :target="current_velocity" :max="max_velocity" command="SET_VELOCITY_LIMIT" attribute-name="VELOCITY=" ></tool-slider>
|
||||
<tool-slider label="Velocity" unit="mm/s" :target="current_velocity" :max="max_velocity" :default-value="max_velocity" command="SET_VELOCITY_LIMIT" attribute-name="VELOCITY=" ></tool-slider>
|
||||
<v-divider></v-divider>
|
||||
<tool-slider label="Acceleration" unit="mm/s²" :target="current_accel" :max="max_accel" command="SET_VELOCITY_LIMIT" attribute-name="ACCEL=" ></tool-slider>
|
||||
<tool-slider label="Acceleration" unit="mm/s²" :target="current_accel" :max="max_accel" :default-value="max_accel" command="SET_VELOCITY_LIMIT" attribute-name="ACCEL=" ></tool-slider>
|
||||
<v-divider></v-divider>
|
||||
<tool-slider label="Deceleration" unit="mm/s²" :target="current_accel_to_decel" :max="max_accel_to_decel" command="SET_VELOCITY_LIMIT" attribute-name="ACCEL_TO_DECEL=" ></tool-slider>
|
||||
<tool-slider label="Deceleration" unit="mm/s²" :target="current_accel_to_decel" :max="max_accel_to_decel" :default-value="max_accel_to_decel" command="SET_VELOCITY_LIMIT" attribute-name="ACCEL_TO_DECEL=" ></tool-slider>
|
||||
<v-divider></v-divider>
|
||||
<tool-slider label="Square corner velocity" unit="mm/s" :target="current_square_corner_velocity" :max="max_square_corner_velocity" command="SET_VELOCITY_LIMIT" attribute-name="SQUARE_CORNER_VELOCITY=" ></tool-slider>
|
||||
<tool-slider label="Square corner velocity" unit="mm/s" :target="current_square_corner_velocity" :max="max_square_corner_velocity" :default-value="max_square_corner_velocity" command="SET_VELOCITY_LIMIT" attribute-name="SQUARE_CORNER_VELOCITY=" ></tool-slider>
|
||||
</v-card>
|
||||
</template>
|
||||
|
||||
@@ -33,11 +33,11 @@
|
||||
current_accel: state => state.printer.toolhead.max_accel,
|
||||
current_accel_to_decel: state => state.printer.toolhead.max_accel_to_decel,
|
||||
current_square_corner_velocity: state => state.printer.toolhead.square_corner_velocity,
|
||||
config: state => state.printer.configfile.config,
|
||||
max_velocity: state => parseInt(state.printer.configfile.config.printer.max_velocity) || 0,
|
||||
max_accel: state => parseInt(state.printer.configfile.config.printer.max_accel) || 0,
|
||||
max_accel_to_decel: state => parseInt(state.printer.configfile.config.printer.max_accel_to_decel) || parseInt(state.printer.configfile.config.printer.max_accel) / 2,
|
||||
max_square_corner_velocity: state => parseInt(state.printer.configfile.config.printer.square_corner_velocity) || 5,
|
||||
config: state => state.printer.configfile.settings,
|
||||
max_velocity: state => state.printer.configfile.settings.printer.max_velocity,
|
||||
max_accel: state => state.printer.configfile.settings.printer.max_accel,
|
||||
max_accel_to_decel: state => state.printer.configfile.settings.printer.max_accel_to_decel || state.printer.configfile.settings.printer.max_accel / 2,
|
||||
max_square_corner_velocity: state => state.printer.configfile.settings.printer.square_corner_velocity || 5,
|
||||
}),
|
||||
},
|
||||
watch: {
|
||||
|
||||
+89
-19
@@ -10,15 +10,36 @@
|
||||
<v-col class="pb-1 pt-3">
|
||||
<v-subheader class="_tool-slider-subheader">
|
||||
<span>{{ label }}</span>
|
||||
<v-btn
|
||||
v-if="value !== defaultValue"
|
||||
class="ml-2"
|
||||
x-small
|
||||
icon
|
||||
@click="processedMin = min; processedMax = max; value = defaultValue; sliding = true; sendCmd()"
|
||||
>
|
||||
<v-icon>mdi-restart</v-icon>
|
||||
</v-btn>
|
||||
<v-spacer></v-spacer>
|
||||
<span class="font-weight-bold">{{ value }} {{ unit }}</span>
|
||||
<span class="font-weight-bold">
|
||||
<v-progress-circular
|
||||
v-if="sliding && (value === processedMin || value === processedMax)"
|
||||
class="mr-2"
|
||||
indeterminate
|
||||
color="info"
|
||||
:size="20"
|
||||
:width="2"
|
||||
></v-progress-circular>
|
||||
{{ value }} {{ unit }}
|
||||
</span>
|
||||
</v-subheader>
|
||||
<v-card-text class="py-0">
|
||||
<v-slider
|
||||
v-model="value"
|
||||
:min="min"
|
||||
:max="max"
|
||||
@change="sendCmd"
|
||||
:min="processedMin"
|
||||
:max="processedMax"
|
||||
@start="sliding = true"
|
||||
@end="sendCmd"
|
||||
@input="processNewRange"
|
||||
hide-details>
|
||||
|
||||
<template v-slot:prepend>
|
||||
@@ -38,11 +59,6 @@
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data: function() {
|
||||
return {
|
||||
value: this.target * this.multi,
|
||||
}
|
||||
},
|
||||
props: {
|
||||
target: {
|
||||
type: Number,
|
||||
@@ -81,6 +97,16 @@
|
||||
required: false,
|
||||
default: 100
|
||||
},
|
||||
dynamicRange: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: false
|
||||
},
|
||||
defaultValue: {
|
||||
type: Number,
|
||||
required: false,
|
||||
default: 100
|
||||
},
|
||||
step: {
|
||||
type: Number,
|
||||
required: false,
|
||||
@@ -92,14 +118,65 @@
|
||||
default: 1
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
value: this.target * this.multi,
|
||||
startValue: this.target * this.multi,
|
||||
sliding: false,
|
||||
processedMin: this.min,
|
||||
processedMax: this.max,
|
||||
dynamicStep: Math.floor((this.max - this.min) / 2),
|
||||
processingTimer: null
|
||||
}
|
||||
},
|
||||
created() {
|
||||
if (this.value > this.max || this.value < this.min) {
|
||||
this.processedMax = Math.ceil(this.value / this.defaultValue) * this.defaultValue;
|
||||
this.processedMin = Math.floor(this.value / this.defaultValue) * this.defaultValue - this.defaultValue;
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
||||
},
|
||||
watch: {
|
||||
target: function(newVal) {
|
||||
this.value = newVal * this.multi;
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
processNewRange() {
|
||||
if (!this.dynamicRange || !this.sliding) {
|
||||
return;
|
||||
}
|
||||
if (this.processingTimer) {
|
||||
clearInterval(this.processingTimer);
|
||||
this.processingTimer = null;
|
||||
}
|
||||
if (this.value === this.processedMax || this.value === this.processedMin) {
|
||||
this.processingTimer = setInterval(() => {
|
||||
let was = '';
|
||||
if (this.value === this.processedMax) {
|
||||
was = 'max';
|
||||
} else if(this.value === this.processedMin) {
|
||||
was = 'min';
|
||||
}
|
||||
this.processedMin = Math.max(0, this.value - this.dynamicStep);
|
||||
this.processedMax = Math.min(1000, this.value + this.dynamicStep);
|
||||
this.value = was === 'max' ? this.processedMax : this.processedMin;
|
||||
}, 500);
|
||||
}
|
||||
},
|
||||
sendCmd() {
|
||||
let gcode = this.command+' '+this.attributeName+(this.value*this.attributeScale).toFixed(0)
|
||||
this.$store.commit('server/addEvent', { message: gcode, type: 'command' })
|
||||
this.$socket.sendObj('printer.gcode.script', { script: gcode })
|
||||
if (this.sliding) {
|
||||
let gcode = this.command + ' ' + this.attributeName + (Math.max(1, this.value) * this.attributeScale).toFixed(0)
|
||||
this.$store.commit('server/addEvent', {message: gcode, type: 'command'})
|
||||
this.$socket.sendObj('printer.gcode.script', {script: gcode})
|
||||
this.sliding = false;
|
||||
if (this.processingTimer) {
|
||||
clearInterval(this.processingTimer);
|
||||
this.processingTimer = null;
|
||||
}
|
||||
}
|
||||
},
|
||||
decrement() {
|
||||
this.value = this.value > this.min ? (this.value - this.step).toFixed(0) : this.min
|
||||
@@ -109,13 +186,6 @@
|
||||
this.value = this.value < this.max ? (this.value + this.step).toFixed(0) : this.max
|
||||
this.sendCmd();
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
target: function(newVal) {
|
||||
this.value = newVal * this.multi;
|
||||
},
|
||||
},
|
||||
created: function() {
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in new issue
Block a user