-
-
Notifications
You must be signed in to change notification settings - Fork 390
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'mainsail-crew:develop' into develop
- Loading branch information
Showing
18 changed files
with
692 additions
and
352 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
98 changes: 98 additions & 0 deletions
98
src/components/panels/ToolheadControls/ToolheadPanelSettings.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
Oops, something went wrong.