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: adds new Tools menu to Tool card #1071

Merged
merged 1 commit into from
Mar 18, 2023
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
219 changes: 168 additions & 51 deletions src/components/widgets/toolhead/ToolheadCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,64 +39,87 @@
>
{{ $t('app.tool.tooltip.manual_probe') }}
</app-btn>

<app-btn
v-if="printerSupportsForceMove"
:disabled="!klippyReady || printerPrinting"
v-if="isBedScrewsAdjustActive"
:disabled="!klippyReady || printerPrinting || !allHomed"
small
class="ms-1 my-1"
:color="forceMove ? 'error' : undefined"
@click="toggleForceMove"
@click="bedScrewsAdjustDialogOpen = true"
>
{{ $t('app.tool.tooltip.force_move') }}
BED_SCREWS_ADJUST
</app-btn>

<app-btn
v-if="printerSupportsForceMove"
:disabled="!klippyReady || printerPrinting"
small
class="ms-1 my-1"
@click="sendGcode('M84')"
>
{{ $t('app.tool.tooltip.motors_off') }}
</app-btn>
<app-btn
v-if="printerSupportsBedScrews"
:loading="hasWait($waits.onBedScrewsAdjust)"
:disabled="!allHomed || !klippyReady || printerPrinting"
small
class="ms-1 my-1"
@click="bedScrewsAdjust"
>
{{ $t('app.tool.tooltip.bed_screws_adjust') }}
</app-btn>
<app-btn
v-if="printerSupportsBedScrewsCalculate"
:loading="hasWait($waits.onBedScrewsCalculate)"
:disabled="!allHomed || !klippyReady || printerPrinting"
small
class="ms-1 my-1"
@click="sendGcode('SCREWS_TILT_CALCULATE', $waits.onBedScrewsCalculate)"
:color="forceMove ? 'error' : undefined"
@click="toggleForceMove"
>
{{ $t('app.tool.tooltip.screws_tilt_calculate') }}
FORCE_MOVE
</app-btn>

<app-btn
v-if="printerSupportsZtilt"
:loading="hasWait($waits.onZTilt)"
:disabled="!klippyReady || printerPrinting"
small
class="ms-1 my-1"
@click="sendGcode('Z_TILT_ADJUST', $waits.onZTilt)"
@click="sendGcode('M84')"
>
{{ $t('app.tool.tooltip.z_tilt_adjust') }}
{{ $t('app.tool.tooltip.motors_off') }}
</app-btn>
<app-btn
v-if="printerSupportsQgl"
:loading="hasWait($waits.onQGL)"
:disabled="!klippyReady || printerPrinting"
small
class="ms-1 my-1"
@click="sendGcode('QUAD_GANTRY_LEVEL', $waits.onQGL)"

<v-menu
v-if="availableTools.length"
left
offset-y
transition="slide-y-transition"
>
{{ $t('app.tool.tooltip.quad_gantry_level') }}
</app-btn>
<template #activator="{ on, attrs, value }">
<app-btn
v-bind="attrs"
small
class="ms-1 my-1"
:disabled="!klippyReady || printerPrinting"
v-on="on"
>
<v-icon
small
class="mr-1"
>
$tools
</v-icon>
{{ $t('app.tool.tooltip.tools') }}
<v-icon
small
class="ml-1"
:class="{ 'rotate-180': value }"
>
$chevronDown
</v-icon>
</app-btn>
</template>
<v-list dense>
<v-list-item
v-for="tool in availableTools"
:key="tool.name"
:disabled="tool.disabled || (tool.wait && hasWait(tool.wait))"
@click="sendGcode(tool.name, tool.wait)"
>
<v-list-item-icon>
<v-icon>
$tools
</v-icon>
</v-list-item-icon>
<v-list-item-content>
<v-list-item-title>
{{ tool.name }}
</v-list-item-title>
</v-list-item-content>
</v-list-item>
</v-list>
</v-menu>
</app-btn-collapse-group>
</template>

Expand All @@ -120,6 +143,12 @@ import StateMixin from '@/mixins/state'
import ToolheadMixin from '@/mixins/toolhead'
import Toolhead from './Toolhead.vue'

type Tool = {
name: string,
disabled?: boolean,
wait?: string,
}

@Component({
components: {
Toolhead
Expand All @@ -136,22 +165,118 @@ export default class ToolheadCard extends Mixins(StateMixin, ToolheadMixin) {
return this.$store.getters['printer/getPrinterSettings']()
}

get printerSupportsQgl (): boolean {
get printerSupportsQuadGantryLevel (): boolean {
return 'quad_gantry_level' in this.printerSettings
}

get printerSupportsZtilt (): boolean {
get printerSupportsZTiltAdjust (): boolean {
return 'z_tilt' in this.printerSettings
}

get printerSupportsBedScrews (): boolean {
get printerSupportsBedScrewsAdjust (): boolean {
return 'bed_screws' in this.printerSettings
}

get printerSupportsBedScrewsCalculate (): boolean {
return 'screws_tilt_adjust' in this.printerSettings
}

get printerSupportsBedTiltCalibrate (): boolean {
return 'bed_tilt' in this.printerSettings
}

get printerSupportsDeltaCalibrate (): boolean {
return 'delta_calibrate' in this.printerSettings
}

get printerSupportsProbeCalibrate (): boolean {
return 'probe' in this.printerSettings || 'bltouch' in this.printerSettings
}

get printerSupportsZEndstopCalibrate (): boolean {
return (
'stepper_z' in this.printerSettings &&
'z_position_endstop' in this.printerSettings.stepper_z
)
}

get availableTools () {
const tools: Tool[] = []

if (this.printerSupportsBedScrewsAdjust) {
tools.push({
name: 'BED_SCREWS_ADJUST',
disabled: !this.allHomed || this.isBedScrewsAdjustActive,
wait: this.$waits.onBedScrewsAdjust
})
}

if (this.printerSupportsBedTiltCalibrate) {
tools.push({
name: 'BED_TILT_CALIBRATE',
disabled: !this.allHomed || this.isManualProbeActive,
wait: this.$waits.onBedTiltCalibrate
})
}

if (this.printerSupportsDeltaCalibrate) {
tools.push({
name: 'DELTA_CALIBRATE',
disabled: !this.allHomed || this.isManualProbeActive,
wait: this.$waits.onDeltaCalibrate
})
}

tools.push({
name: 'MANUAL_PROBE',
disabled: !this.allHomed || this.isManualProbeActive,
wait: this.$waits.onManualProbe
})

if (this.printerSupportsProbeCalibrate) {
tools.push({
name: 'PROBE_CALIBRATE',
disabled: !this.allHomed,
wait: this.$waits.onProbeCalibrate
})
}

if (this.printerSupportsQuadGantryLevel) {
tools.push({
name: 'QUAD_GANTRY_LEVEL',
disabled: !this.allHomed || this.isManualProbeActive,
wait: this.$waits.onQGL
})
}

if (this.printerSupportsBedScrewsCalculate) {
tools.push({
name: 'SCREWS_TILT_CALCULATE',
disabled: !this.allHomed || this.isManualProbeActive,
wait: this.$waits.onBedScrewsCalculate
})
}

if (this.printerSupportsZEndstopCalibrate) {
tools.push({
name: 'Z_ENDSTOP_CALIBRATE',
disabled: !this.allHomed || this.isManualProbeActive,
wait: this.$waits.onZEndstopCalibrate
})
}

if (this.printerSupportsZTiltAdjust) {
tools.push({
name: 'Z_TILT_ADJUST',
disabled: !this.allHomed || this.isManualProbeActive,
wait: this.$waits.onZTilt
})
}

return tools
.sort((a, b) => a.name.localeCompare(b.name))
}

get printerSupportsForceMove () {
return (
(this.printerSettings.force_move?.enable_force_move ?? false) &&
Expand Down Expand Up @@ -191,14 +316,6 @@ export default class ToolheadCard extends Mixins(StateMixin, ToolheadMixin) {
}
}

bedScrewsAdjust () {
if (this.isBedScrewsAdjustActive) {
this.bedScrewsAdjustDialogOpen = true
} else {
this.sendGcode('BED_SCREWS_ADJUST', this.$waits.onBedScrewsAdjust)
}
}

async toggleForceMove () {
if (!this.forceMove && this.$store.state.config.uiSettings.general.forceMoveToggleWarning) {
const result = await this.$confirm(
Expand Down
4 changes: 4 additions & 0 deletions src/globals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,8 @@ export const Waits = Object.freeze({
onZTilt: 'onZTilt',
onBedScrewsAdjust: 'onBedScrewAdjust',
onBedScrewsCalculate: 'onBedScrewsCalculate',
onBedTiltCalibrate: 'onBedTiltCalibrate',
onDeltaCalibrate: 'onDeltaCalibrate',
onPrintPause: 'onPrintPause',
onPrintCancel: 'onPrintCancel',
onPrintResume: 'onPrintResume',
Expand Down Expand Up @@ -406,6 +408,8 @@ export const Waits = Object.freeze({
onJobQueue: 'onJobQueue',
onTimelapseSaveFrame: 'onTimelapseSaveFrame',
onManualProbe: 'onManualProbe',
onProbeCalibrate: 'onProbeCalibrate',
onZEndstopCalibrate: 'onZEndstopCalibrate',
onQueryEndstops: 'onQueryEndstops',
onQueryProbe: 'onQueryProbe',
onVersionRefresh: 'onVersionRefresh',
Expand Down
11 changes: 3 additions & 8 deletions src/locales/de.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -607,20 +607,15 @@ app:
home_y: 'Y'
home_all: Alle
tooltip:
absolute_positioning: Absolute Positionierung
extruder_disabled: >-
Extruder deaktiviert, da unter der min_extrude_temp
(%{min}<small>°C</small>)
home_xy: Home XY
home_z: Home Z
motors_off: MOTOREN AUS
relative_positioning: Relative Positionierung
absolute_positioning: Absolute Positionierung
force_move: FORCE_MOVE
screws_tilt_calculate: Screws_Tilt_Calculate
z_tilt_adjust: Z_Tilt_Adjust
quad_gantry_level: QGL
bed_screws_adjust: BED_SCREWS_ADJUST
manual_probe: Manuelles Probing
motors_off: Motoren Aus
relative_positioning: Relative Positionierung
title:
bed_screws_adjust: Bettschrauben einstellen
manual_probe: Manuelles Probing
Expand Down
8 changes: 2 additions & 6 deletions src/locales/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -644,13 +644,9 @@ app:
home_xy: Home XY
home_z: Home Z
manual_probe: Manual Probe
motors_off: MOTORS OFF
z_tilt_adjust: Z_Tilt_Adjust
quad_gantry_level: QGL
motors_off: Motors Off
relative_positioning: Relative Positioning
screws_tilt_calculate: Screws_Tilt_Calculate
bed_screws_adjust: BED_SCREWS_ADJUST
force_move: FORCE_MOVE
tools: Tools
label:
stats_active_extruder: >-
<span class="secondary--text">The active extruder configuration is set for</span>
Expand Down
6 changes: 1 addition & 5 deletions src/locales/es.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -488,17 +488,13 @@ app:
bed_screws_adjust: Ajustar tornillos de la cama
tooltip:
absolute_positioning: Posicionamiento Absoluto
bed_screws_adjust: BED_SCREWS_ADJUST
extruder_disabled: >-
Extrusor deshabilidado, por debajo de min_extrude_temp
(%{min}<small>°C</small>)
force_move: FORCE_MOVE
home_xy: Origen XY
home_z: Origen Z
motors_off: APAGAR MOTORES
motors_off: Apagar Motores
relative_positioning: Posicionamiento Relativo
screws_tilt_calculate: Screws_Tilt_Calculate
z_tilt_adjust: Z_Tilt_Adjust
version:
btn:
check_for_updates: Buscar actualizaciones
Expand Down
7 changes: 1 addition & 6 deletions src/locales/hu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -635,13 +635,8 @@ app:
home_xy: XY kezdőpont
home_z: Z kezdőpont
manual_probe: Kézi szonda
motors_off: MOTOROK KI
z_tilt_adjust: Z_Tilt_Adjust
quad_gantry_level: QGL
motors_off: Motorok Ki
relative_positioning: Relatív pozicionálás
screws_tilt_calculate: Screws_Tilt_Calculate
bed_screws_adjust: BED_SCREWS_ADJUST
force_move: FORCE_MOVE
label:
stats_active_extruder: >-
<span class="secondary--text">Az aktív extruder konfigurációja be van állítva</span>
Expand Down
5 changes: 0 additions & 5 deletions src/locales/ja.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -640,17 +640,12 @@ app:
manual_probe: マニュアルプローブ
tooltip:
absolute_positioning: 相対位置
bed_screws_adjust: ベッドスクリューの調整
extruder_disabled: '最小温度未満(%{min}<small>°C</small>)のためホットエンドが無効です。'
force_move: 強制移動
home_xy: Home XY
home_z: Home Z
manual_probe: マニュアルプローブ
motors_off: モーターオフ
quad_gantry_level: QGL
relative_positioning: 相対位置
screws_tilt_calculate: ネジチルト計算
z_tilt_adjust: Zチルト調整
version:
btn:
check_for_updates: アップデートを確認
Expand Down
Loading