Skip to content

Commit

Permalink
feat: Kalico firmware retraction z-hop support
Browse files Browse the repository at this point in the history
Signed-off-by: Pedro Lamas <[email protected]>
  • Loading branch information
pedrolamas committed Jan 20, 2025
1 parent ff205f8 commit f446b32
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 0 deletions.
46 changes: 46 additions & 0 deletions src/components/widgets/retract/Retract.vue
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,38 @@
/>
</v-col>
</v-row>

<v-row v-if="supportsZHopHeight">
<v-col
cols="12"
sm="6"
md="12"
lg="6"
>
<app-named-slider
:label="$t('app.general.label.z_hop_height')"
suffix="mm"
:value="z_hop_height"
:reset-value="defaults.z_hop_height"
:min="0"
:step="0.1"
:max="z_hop_height_max"
overridable
:disabled="!klippyReady"
:locked="isMobileViewport"
:loading="hasWait($waits.onSetZHopHeight)"
@submit="setZHopHeight"
/>
</v-col>
</v-row>
</v-card-text>
</template>

<script lang="ts">
import { Component, Mixins } from 'vue-property-decorator'
import StateMixin from '@/mixins/state'
import BrowserMixin from '@/mixins/browser'
import type { KlippyApp } from '@/store/printer/types'
@Component({})
export default class Retract extends Mixins(StateMixin, BrowserMixin) {
Expand Down Expand Up @@ -135,10 +160,27 @@ export default class Retract extends Mixins(StateMixin, BrowserMixin) {
return Math.round(this.defaults.unretract_extra_length * 2 * 100) / 100
}
get z_hop_height () {
return this.$store.state.printer.printer.firmware_retraction.z_hop_height
}
get z_hop_height_max () {
if (this.defaults.z_hop_height <= 0) return 2
return Math.round(this.defaults.z_hop_height * 2 * 100) / 100
}
get defaults () {
return this.$store.getters['printer/getPrinterSettings']('firmware_retraction') || {}
}
get klippyApp (): KlippyApp {
return this.$store.getters['printer/getKlippyApp'] as KlippyApp
}
get supportsZHopHeight () {
return this.klippyApp.isKalicoOrDangerKlipper
}
setRetractLength (val: number) {
this.sendGcode(`SET_RETRACTION RETRACT_LENGTH=${val}`, this.$waits.onSetRetractLength)
}
Expand All @@ -154,5 +196,9 @@ export default class Retract extends Mixins(StateMixin, BrowserMixin) {
setUnRetractExtraLength (val: number) {
this.sendGcode(`SET_RETRACTION UNRETRACT_EXTRA_LENGTH=${val}`, this.$waits.onSetUnretractExtraLength)
}
setZHopHeight (val: number) {
this.sendGcode(`SET_RETRACTION Z_HOP_HEIGHT=${val}`, this.$waits.onSetZHopHeight)
}
}
</script>
1 change: 1 addition & 0 deletions src/globals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,7 @@ export const Waits = Object.freeze({
onSetRetractSpeed: 'onSetRetractSpeed',
onSetUnretractSpeed: 'onSetUnretractSpeed',
onSetUnretractExtraLength: 'onSetUnretractExtraLength',
onSetZHopHeight: 'onSetZHopHeight',
onExtruderChange: 'onExtruderChange',
onLoadLanguage: 'onLoadLanguage',
onFileSystem: 'onFileSystem',
Expand Down
1 change: 1 addition & 0 deletions src/locales/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ app:
version_sort: Version sort
visible: Visible
z_offset: Z Offset
z_hop_height: Z-Hop Height
unsaved_changes: Unsaved Changes
alias: Alias
apply_z_offset: Apply and Save Z_Offset
Expand Down

0 comments on commit f446b32

Please sign in to comment.