Skip to content

Commit

Permalink
feat: add minimum_cruise_ratio support in MotionSettingsPanel
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Dej <[email protected]>
  • Loading branch information
meteyou committed Dec 5, 2023
1 parent 465ddb5 commit e408360
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 12 deletions.
48 changes: 36 additions & 12 deletions src/components/panels/MachineSettings/MotionSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<v-row>
<v-col :class="{ 'col-12': el.is.small, 'col-6': el.is.medium }">
<number-input
:label="$t('Panels.MachineSettingsPanel.MotionSettings.Velocity').toString()"
:label="$t('Panels.MachineSettingsPanel.MotionSettings.Velocity')"
param="VELOCITY"
:target="velocity"
:default-value="defaultVelocity"
Expand All @@ -21,11 +21,11 @@
:max="null"
:dec="0"
unit="mm/s"
@submit="sendCmd"></number-input>
@submit="sendCmd" />
</v-col>
<v-col :class="{ 'col-12': el.is.small, 'col-6': el.is.medium }">
<number-input
:label="$t('Panels.MachineSettingsPanel.MotionSettings.SquareCornerVelocity').toString()"
:label="$t('Panels.MachineSettingsPanel.MotionSettings.SquareCornerVelocity')"
param="SQUARE_CORNER_VELOCITY"
:target="squareCornerVelocity"
:default-value="defaultSquareCornerVelocity"
Expand All @@ -36,13 +36,13 @@
:max="null"
:dec="1"
unit="mm/s"
@submit="sendCmd"></number-input>
@submit="sendCmd" />
</v-col>
</v-row>
<v-row>
<v-col :class="{ 'col-12': el.is.small, 'col-6': el.is.medium }">
<number-input
:label="$t('Panels.MachineSettingsPanel.MotionSettings.Acceleration').toString()"
:label="$t('Panels.MachineSettingsPanel.MotionSettings.Acceleration')"
param="ACCEL"
:target="accel"
:default-value="defaultAccel"
Expand All @@ -54,11 +54,12 @@
:max="null"
:dec="0"
unit="mm/s²"
@submit="sendCmd"></number-input>
@submit="sendCmd" />
</v-col>
<v-col :class="{ 'col-12': el.is.small, 'col-6': el.is.medium }">
<number-input
:label="$t('Panels.MachineSettingsPanel.MotionSettings.MaxAccelToDecel').toString()"
v-if="minimumCruiseRatio === null"
:label="$t('Panels.MachineSettingsPanel.MotionSettings.MaxAccelToDecel')"
param="ACCEL_TO_DECEL"
:target="accelToDecel"
:default-value="defaultAccelToDecel"
Expand All @@ -70,7 +71,21 @@
:max="null"
:dec="0"
unit="mm/s²"
@submit="sendCmd"></number-input>
@submit="sendCmd" />
<number-input
v-else
:label="$t('Panels.MachineSettingsPanel.MotionSettings.MinimumCruiseRatio')"
param="MINIMUM_CRUISE_RATIO"
:target="minimumCruiseRatio"
:default-value="defaultMinimumCruiseRatio"
:output-error-msg="true"
:has-spinner="true"
:spinner-factor="5"
:step="0.01"
:min="0.01"
:max="0.99"
:dec="2"
@submit="sendCmd" />
</v-col>
</v-row>
</template>
Expand Down Expand Up @@ -102,6 +117,10 @@ export default class MotionSettings extends Mixins(BaseMixin) {
return Math.trunc(this.$store.state.printer?.toolhead?.max_accel_to_decel ?? this.accel / 2)
}
get minimumCruiseRatio(): number {
return this.$store.state.printer?.toolhead?.minimum_cruise_ratio ?? null
}
get squareCornerVelocity(): number {
return Math.floor((this.$store.state.printer?.toolhead?.square_corner_velocity ?? 8) * 10) / 10
}
Expand All @@ -118,11 +137,16 @@ export default class MotionSettings extends Mixins(BaseMixin) {
return Math.trunc(this.$store.state.printer?.configfile?.settings?.printer?.max_accel_to_decel ?? 1500)
}
get defaultMinimumCruiseRatio(): number {
const value = this.$store.state.printer?.configfile?.settings?.printer?.minimum_cruise_ratio ?? 0.5
return Math.round(value / 10) * 10
}
get defaultSquareCornerVelocity(): number {
return (
Math.floor((this.$store.state.printer?.configfile?.settings?.printer?.square_corner_velocity ?? 8) * 10) /
10
)
const value = this.$store.state.printer?.configfile?.settings?.printer?.square_corner_velocity ?? 8
return Math.floor(value * 10) / 10
}
@Debounce(500)
Expand Down
1 change: 1 addition & 0 deletions src/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,7 @@
"MotionSettings": {
"Acceleration": "Beschleunigung",
"MaxAccelToDecel": "Max. Beschl. zu Verz.",
"MinimumCruiseRatio": "Min. Kreuzfahr Quote",
"SquareCornerVelocity": "Eck-Geschwindigkeit",
"Velocity": "Geschwindigkeit"
}
Expand Down
1 change: 1 addition & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,7 @@
"MotionSettings": {
"Acceleration": "Acceleration",
"MaxAccelToDecel": "Max Accel. to Decel.",
"MinimumCruiseRatio": "Min. Cruise Ratio",
"SquareCornerVelocity": "Square Corner Velocity",
"Velocity": "Velocity"
}
Expand Down

0 comments on commit e408360

Please sign in to comment.