Skip to content

Commit

Permalink
feat: adds support for extruder stepper enable (#1039)
Browse files Browse the repository at this point in the history
Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
  • Loading branch information
pedrolamas authored Feb 13, 2023
1 parent 2b30418 commit 10bd04c
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 6 deletions.
16 changes: 16 additions & 0 deletions src/components/widgets/toolhead/ExtruderStepperSync.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,18 @@
item-text="name"
@change="sendSyncExtruderMotion"
/>
</v-col><v-col
v-if="extruderStepper.enabled !== undefined"
cols="12"
sm="6"
>
<app-switch
:value="extruderStepper.enabled"
:label="$t('app.general.label.stepper_enabled')"
:disabled="!klippyReady || printerPrinting"
:loading="hasWait(`${$waits.onStepperEnable}${extruderStepper.name}`)"
@change="sendSetStepperEnable"
/>
</v-col>
</v-row>
</template>
Expand All @@ -38,5 +50,9 @@ export default class ExtruderStepperSync extends Mixins(StateMixin) {
sendSyncExtruderMotion (value: string | null) {
this.sendGcode(`SYNC_EXTRUDER_MOTION EXTRUDER=${this.extruderStepper.name} MOTION_QUEUE=${value ?? ''}`, `${this.$waits.onSyncExtruder}${this.extruderStepper.name}`)
}
sendSetStepperEnable (value: boolean) {
this.sendGcode(`SET_STEPPER_ENABLE STEPPER="${this.extruderStepper.key}" ENABLE=${+value}`, `${this.$waits.onStepperEnable}${this.extruderStepper.name}`)
}
}
</script>
16 changes: 11 additions & 5 deletions src/components/widgets/toolhead/ExtruderSteppers.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
v-else
key="1"
>
{{ extruderStepper.prettyName }} <span class="secondary--text">[ {{ extruderStepper.motion_queue_pretty_name }} ]</span>
{{ extruderStepper.prettyName }} <span class="secondary--text">[ {{ extruderStepper.description }} ]</span>
</span>
</v-fade-transition>
</template>
Expand Down Expand Up @@ -67,10 +67,16 @@ export default class ExtruderSteppers extends Vue {
const extruderSteppers = this.$store.getters['printer/getExtruderSteppers'] as ExtruderStepper[]
return extruderSteppers
.map(x => ({
...x,
motion_queue_pretty_name: extruders.find(y => y.key === x.motion_queue)?.name ?? this.$t('app.setting.label.none')
}))
.map(x => {
const motionQueueName = extruders.find(y => y.key === x.motion_queue)?.name ?? this.$t('app.setting.label.none')
const enabledDesc = x.enabled !== undefined && this.$t(`app.general.label.${x.enabled ? 'on' : 'off'}`)
const description = enabledDesc ? `${motionQueueName}, ${enabledDesc}` : motionQueueName
return {
...x,
description
}
})
}
}
</script>
3 changes: 2 additions & 1 deletion src/globals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,8 @@ export const Waits = Object.freeze({
onQueryEndstops: 'onQueryEndstops',
onQueryProbe: 'onQueryProbe',
onVersionRefresh: 'onVersionRefresh',
onSyncExtruder: 'onSyncExtruder'
onSyncExtruder: 'onSyncExtruder',
onStepperEnable: 'onStepperEnable'
})

export const SupportedLocales = Object.freeze([
Expand Down
1 change: 1 addition & 0 deletions src/locales/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ app:
smooth_time: Smooth Time
speed: Speed
sqv: Square Corner Velocity
stepper_enabled: Stepper Enabled
synced_extruder: Synced Extruder
thumbnail_size: Thumbnail Size
total: Total
Expand Down
2 changes: 2 additions & 0 deletions src/store/printer/getters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,8 @@ export const getters: GetterTree<PrinterState, RootState> = {
extruderSteppers.push({
name,
prettyName: Vue.$filters.startCase(name),
key: item,
enabled: state.printer.stepper_enable?.steppers[item],
...e,
config_pressure_advance: c.pressure_advance,
config_smooth_time: c.pressure_advance_smooth_time
Expand Down
2 changes: 2 additions & 0 deletions src/store/printer/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ export interface Extruder {
export interface ExtruderStepper {
name: string;
prettyName: string;
key: string;
enabled?: boolean;
pressure_advance: number;
smooth_time: number;
motion_queue?: string | null;
Expand Down

0 comments on commit 10bd04c

Please sign in to comment.