Skip to content

Commit

Permalink
Merge branch 'mainsail-crew:develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Bahoue authored Nov 29, 2023
2 parents cf62b69 + ad18c1d commit ae3abef
Show file tree
Hide file tree
Showing 18 changed files with 692 additions and 352 deletions.
9 changes: 9 additions & 0 deletions src/components/TheSettingsMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,11 @@ import {
mdiWebcam,
mdiDipSwitch,
mdiMenu,
mdiGrid,
} from '@mdi/js'
import SettingsMiscellaneousTab from '@/components/settings/SettingsMiscellaneousTab.vue'
import SettingsHeightmapTab from '@/components/settings/SettingsHeightmapTab.vue'
@Component({
components: {
Panel,
Expand All @@ -119,6 +122,7 @@ import SettingsMiscellaneousTab from '@/components/settings/SettingsMiscellaneou
SettingsTimelapseTab,
SettingsMiscellaneousTab,
SettingsNavigationTab,
SettingsHeightmapTab,
},
})
export default class TheSettingsMenu extends Mixins(BaseMixin) {
Expand Down Expand Up @@ -202,6 +206,11 @@ export default class TheSettingsMenu extends Mixins(BaseMixin) {
name: 'navigation',
title: this.$t('Settings.NavigationTab.Navigation'),
},
{
icon: mdiGrid,
name: 'heightmap',
title: this.$t('Settings.HeightmapTab.Heightmap'),
},
]
if (this.moonrakerComponents.includes('timelapse')) {
Expand Down
69 changes: 69 additions & 0 deletions src/components/mixins/zoffset.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import Vue from 'vue'
import Component from 'vue-class-component'
import { CommandHelp } from '@/store/printer/types'

@Component
export default class ZoffsetMixin extends Vue {
get homing_origin() {
return this.$store.state.printer?.gcode_move?.homing_origin ?? []
}

get z_gcode_offset() {
return this.homing_origin.length > 1 ? Math.round(this.homing_origin[2] * 1000) / 1000 : 0
}
get helplist() {
return this.$store.state.printer.helplist ?? []
}

get settings() {
return this.$store.state.printer.configfile?.settings ?? {}
}

get kinematics() {
return this.settings.printer?.kinematics ?? 'cartesian'
}

get stepper_name() {
if (this.kinematics === 'delta') return 'stepper_a'

return 'stepper_z'
}

get endstop_pin() {
const stepperConfig = this.settings[this.stepper_name] ?? {}

return stepperConfig?.endstop_pin
}

get zOffset(): number {
return this.$store.state.printer?.gcode_move?.homing_origin[2].toFixed(3)
}
get isEndstopProbe() {
return this.endstop_pin.search('probe:z_virtual_endstop') !== -1
}

get existZOffsetApplyProbe() {
return this.helplist.findIndex((gcode: CommandHelp) => gcode.commandLow === 'z_offset_apply_probe') !== -1
}

get existZOffsetApplyEndstop() {
return this.helplist.findIndex((gcode: CommandHelp) => gcode.commandLow === 'z_offset_apply_endstop') !== -1
}

get showSaveButton() {
// hide button when offset is 0
if (this.z_gcode_offset === 0) return false

// show button when z endstop is probe and probe gcode exists
if (this.isEndstopProbe && this.existZOffsetApplyProbe) return true

// show button when z endstop is endstop and endstop gcode exists
return !this.isEndstopProbe && this.existZOffsetApplyEndstop
}

get autoSaveZOffsetOption() {
if (this.isEndstopProbe && this.existZOffsetApplyProbe) return 'Z_OFFSET_APPLY_PROBE'

return 'Z_OFFSET_APPLY_ENDSTOP'
}
}
29 changes: 22 additions & 7 deletions src/components/panels/ToolheadControlPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
:collapsible="true"
card-class="toolhead-control-panel">
<!-- PANEL-HEADER 3-DOT-MENU -->
<template v-if="showButtons" #buttons>
<v-menu left offset-y :close-on-content-click="false" class="pa-0">
<template #buttons>
<v-menu v-if="showButtons" left offset-y :close-on-content-click="false" class="pa-0">
<template #activator="{ on, attrs }">
<v-btn icon tile v-bind="attrs" :disabled="['printing'].includes(printer_state)" v-on="on">
<v-icon>{{ mdiDotsVertical }}</v-icon>
Expand Down Expand Up @@ -82,21 +82,22 @@
</v-list-item>
</v-list>
</v-menu>
<toolhead-panel-settings />
</template>
<!-- MOVE TO CONTROL -->
<move-to-control class="py-0 pt-3" />
<move-to-control />
<!-- AXIS CONTROL -->
<v-container v-if="axisControlVisible">
<component :is="`${controlStyle}-control`" />
</v-container>
<!-- Z-OFFSET CONTROL -->
<v-divider :class="{ 'mt-3': !axisControlVisible }" />
<v-container>
<v-divider v-if="showZOffset" />
<v-container v-if="showZOffset">
<zoffset-control />
</v-container>
<!-- SPEED FACTOR -->
<v-divider />
<v-container>
<v-divider v-if="showSpeedFactor" />
<v-container v-if="showSpeedFactor">
<tool-slider
:label="$t('Panels.ToolheadControlPanel.SpeedFactor')"
:icon="mdiSpeedometer"
Expand Down Expand Up @@ -162,6 +163,8 @@ export default class ToolheadControlPanel extends Mixins(BaseMixin, ControlMixin
}
get axisControlVisible() {
if (!this.showControl) return false
return !(this.isPrinting && (this.$store.state.gui.control.hideDuringPrint ?? false))
}
Expand All @@ -170,5 +173,17 @@ export default class ToolheadControlPanel extends Mixins(BaseMixin, ControlMixin
return this.existsBedScrews || this.existsBedTilt || this.existsDeltaCalibrate || this.existsScrewsTilt
}
get showControl(): boolean {
return this.$store.state.gui.view.toolhead.showControl ?? true
}
get showZOffset(): boolean {
return this.$store.state.gui.view.toolhead.showZOffset ?? true
}
get showSpeedFactor(): boolean {
return this.$store.state.gui.view.toolhead.showSpeedFactor ?? true
}
}
</script>
44 changes: 30 additions & 14 deletions src/components/panels/ToolheadControls/MoveToControl.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<template>
<responsive
:breakpoints="{
xsmall: (el) => el.width <= 320,
small: (el) => el.width > 320 && el.width <= 460,
medium: (el) => el.width > 460 && el.width <= 560,
large: (el) => el.width > 560,
}">
<template #default="{ el }">
<v-container class="py-0">
<v-row class="flex-nowrap pb-1">
<v-container v-if="showCoordinates || showPosition" :class="containerClass">
<responsive
:breakpoints="{
xsmall: (el) => el.width <= 320,
small: (el) => el.width > 320 && el.width <= 460,
medium: (el) => el.width > 460 && el.width <= 560,
large: (el) => el.width > 560,
}">
<template #default="{ el }">
<v-row v-if="showPosition" class="flex-nowrap pb-1">
<v-col
:class="{
'col-5': el.is.small,
Expand All @@ -35,7 +35,7 @@
</span>
</v-col>
</v-row>
<v-row dense>
<v-row v-if="showCoordinates" dense>
<v-col :class="el.is.xsmall ? 'col-12' : 'col-4'">
<move-to-input
v-model="input.x.pos"
Expand Down Expand Up @@ -70,9 +70,9 @@
@submit="sendCmd"></move-to-input>
</v-col>
</v-row>
</v-container>
</template>
</responsive>
</template>
</responsive>
</v-container>
</template>

<script lang="ts">
Expand Down Expand Up @@ -153,6 +153,22 @@ export default class MoveToControl extends Mixins(BaseMixin, ControlMixin) {
return this.bed_mesh?.profile_name ?? ''
}
get showPosition() {
return this.$store.state.gui.view.toolhead.showPosition ?? true
}
get showCoordinates() {
return this.$store.state.gui.view.toolhead.showCoordinates ?? true
}
get showControl() {
return this.$store.state.gui.view.toolhead.showControl ?? true
}
get containerClass() {
return this.showControl ? 'pb-0' : ''
}
sendCmd(): void {
const xPos = this.input.x.pos !== this.gcodePositions.x ? ` X${this.input.x.pos}` : ''
const yPos = this.input.y.pos !== this.gcodePositions.y ? ` Y${this.input.y.pos}` : ''
Expand Down
98 changes: 98 additions & 0 deletions src/components/panels/ToolheadControls/ToolheadPanelSettings.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
<template>
<v-menu :offset-y="true" :left="true" :close-on-content-click="false">
<template #activator="{ on, attrs }">
<v-btn icon tile v-bind="attrs" v-on="on">
<v-icon small>{{ mdiCog }}</v-icon>
</v-btn>
</template>
<v-list>
<v-list-item class="minHeight36">
<v-checkbox
v-model="showPosition"
class="mt-0"
hide-details
:label="$t('Panels.ToolheadControlPanel.PositionOutput')" />
</v-list-item>
<v-list-item class="minHeight36">
<v-checkbox
v-model="showCoordinates"
class="mt-0"
hide-details
:label="$t('Panels.ToolheadControlPanel.CoordinateFields')" />
</v-list-item>
<v-list-item class="minHeight36">
<v-checkbox
v-model="showControl"
class="mt-0"
hide-details
:label="$t('Panels.ToolheadControlPanel.ControlButtons')" />
</v-list-item>
<v-list-item class="minHeight36">
<v-checkbox
v-model="showZOffset"
class="mt-0"
hide-details
:label="$t('Panels.ToolheadControlPanel.ZOffset')" />
</v-list-item>
<v-list-item class="minHeight36">
<v-checkbox
v-model="showSpeedFactor"
class="mt-0"
hide-details
:label="$t('Panels.ToolheadControlPanel.SpeedFactor')" />
</v-list-item>
</v-list>
</v-menu>
</template>

<script lang="ts">
import Component from 'vue-class-component'
import { Mixins } from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
import { mdiCog } from '@mdi/js'
@Component
export default class ToolheadPanelSettings extends Mixins(BaseMixin) {
mdiCog = mdiCog
get showPosition(): boolean {
return this.$store.state.gui.view.toolhead.showPosition ?? true
}
set showPosition(newVal: boolean) {
this.$store.dispatch('gui/saveSetting', { name: 'view.toolhead.showPosition', value: newVal })
}
get showCoordinates(): boolean {
return this.$store.state.gui.view.toolhead.showCoordinates ?? true
}
set showCoordinates(newVal: boolean) {
this.$store.dispatch('gui/saveSetting', { name: 'view.toolhead.showCoordinates', value: newVal })
}
get showControl(): boolean {
return this.$store.state.gui.view.toolhead.showControl ?? true
}
set showControl(newVal: boolean) {
this.$store.dispatch('gui/saveSetting', { name: 'view.toolhead.showControl', value: newVal })
}
get showZOffset(): boolean {
return this.$store.state.gui.view.toolhead.showZOffset ?? true
}
set showZOffset(newVal: boolean) {
this.$store.dispatch('gui/saveSetting', { name: 'view.toolhead.showZOffset', value: newVal })
}
get showSpeedFactor(): boolean {
return this.$store.state.gui.view.toolhead.showSpeedFactor ?? true
}
set showSpeedFactor(newVal: boolean) {
this.$store.dispatch('gui/saveSetting', { name: 'view.toolhead.showSpeedFactor', value: newVal })
}
}
</script>
Loading

0 comments on commit ae3abef

Please sign in to comment.