feature: dynamic max of machine limits

Signed-off-by: Stefan Dej <meteyou@gmail.com>
This commit is contained in:
Stefan Dej 2021-06-01 22:49:38 +02:00
parent de3e4200e5
commit 75246d58d1
2 changed files with 15 additions and 13 deletions

View File

@ -5,13 +5,13 @@
<span class="subheading"><v-icon left>mdi-speedometer</v-icon>{{ $t('Settings.LimitsPanel.MachineLimits')}}</span>
</v-toolbar-title>
</v-toolbar>
<tool-slider :label="$t('Settings.LimitsPanel.Velocity')" unit="mm/s" :target="current_velocity" :max="max_velocity" :default-value="max_velocity" command="SET_VELOCITY_LIMIT" attribute-name="VELOCITY=" ></tool-slider>
<tool-slider :label="$t('Settings.LimitsPanel.Velocity')" unit="mm/s" :target="current_velocity" :max="max_velocity" :default-value="max_velocity" :step="50" :dynamic-range="true" command="SET_VELOCITY_LIMIT" attribute-name="VELOCITY=" ></tool-slider>
<v-divider></v-divider>
<tool-slider :label="$t('Settings.LimitsPanel.Acceleration')" unit="mm/s²" :target="current_accel" :max="max_accel" :default-value="max_accel" command="SET_VELOCITY_LIMIT" attribute-name="ACCEL=" ></tool-slider>
<tool-slider :label="$t('Settings.LimitsPanel.Acceleration')" unit="mm/s²" :target="current_accel" :max="max_accel" :default-value="max_accel" :step="100" :dynamic-range="true" command="SET_VELOCITY_LIMIT" attribute-name="ACCEL=" ></tool-slider>
<v-divider></v-divider>
<tool-slider :label="$t('Settings.LimitsPanel.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>
<tool-slider :label="$t('Settings.LimitsPanel.Deceleration')" unit="mm/s²" :target="current_accel_to_decel" :max="max_accel_to_decel" :default-value="max_accel_to_decel" :step="100" :dynamic-range="true" command="SET_VELOCITY_LIMIT" attribute-name="ACCEL_TO_DECEL=" ></tool-slider>
<v-divider></v-divider>
<tool-slider :label="$t('Settings.LimitsPanel.SquareCornerVelocity')" 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>
<tool-slider :label="$t('Settings.LimitsPanel.SquareCornerVelocity')" unit="mm/s" :target="current_square_corner_velocity" :max="max_square_corner_velocity" :default-value="max_square_corner_velocity" :step="1" :dynamic-range="true" command="SET_VELOCITY_LIMIT" attribute-name="SQUARE_CORNER_VELOCITY=" ></tool-slider>
</v-card>
</template>
@ -33,7 +33,6 @@
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.settings,
max_velocity: state => state.printer.configfile.settings.printer.max_velocity || 0,
max_accel: state => state.printer.configfile.settings.printer.max_accel || 0,
max_accel_to_decel: state => state.printer.configfile.settings.printer.max_accel_to_decel || 0,

View File

@ -31,6 +31,7 @@
:max="processedMax"
@start="sliding = true"
@end="sendCmd()"
:color="colorBar"
hide-details>
<template v-slot:prepend>
@ -139,7 +140,9 @@
}
},
computed: {
colorBar() {
return this.max < this.value ? "warning" : "primary"
}
},
watch: {
target: {
@ -154,18 +157,18 @@
this.processingTimer = null;
}
if (this.value >= this.processedMax) {
this.processingTimer = setTimeout(() => {
const [min, max] = this.dynamicClamp;
this.processedMin = Math.max(min, this.value - this.dynamicStep);
this.processedMax = Math.min(max, this.value + this.dynamicStep);
}, this.dynamicDebounceTime);
//this.processingTimer = setTimeout(() => {
//const [min, max] = this.dynamicClamp;
this.processedMin = Math.min(this.min, this.value - this.dynamicStep);
this.processedMax = Math.max(this.max, this.value + this.dynamicStep, newVal);
//}, this.dynamicDebounceTime);
}
}
},
max: {
immediate: true,
handler(newVal) {
this.processedMax = newVal
this.processedMax = newVal > this.value ? newVal : Math.ceil(this.value / this.step) * this.step
}
}
},
@ -183,7 +186,7 @@
this.sendCmd(true);
},
increment() {
this.value = this.value < this.processedMax ? Math.round(this.value + this.step) : this.processedMax
this.value = this.value < this.processedMax || this.dynamicRange ? Math.round(this.value + this.step) : this.processedMax
this.sendCmd(true);
}
}