Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add minimum_cruise_ratio support in MotionSettingsPanel #1670

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 40 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.0"
:max="0.99"
:dec="2"
@submit="sendCmd" />
</v-col>
</v-row>
</template>
Expand Down Expand Up @@ -102,6 +117,14 @@ 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 | null {
const value = this.$store.state.printer?.toolhead?.minimum_cruise_ratio ?? null

if (value === null) return null

return Math.round(value * 100) / 100
}

get squareCornerVelocity(): number {
return Math.floor((this.$store.state.printer?.toolhead?.square_corner_velocity ?? 8) * 10) / 10
}
Expand All @@ -118,11 +141,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
Loading