Skip to content

Commit

Permalink
Merge pull request #3 from mainsail-crew/develop
Browse files Browse the repository at this point in the history
merge the newest mainsail version into the nozzle overlay branch
  • Loading branch information
HelgeKeck authored Sep 20, 2023
2 parents 80401c6 + 7ae9589 commit 5ac50d8
Show file tree
Hide file tree
Showing 12 changed files with 374 additions and 177 deletions.
277 changes: 184 additions & 93 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"axios": "^0.27.0",
"codemirror": "^6.0.1",
"core-js": "^3.16.0",
"detect-browser": "^5.3.0",
"echarts": "^5.2.2",
"echarts-gl": "^2.0.8",
"hls.js": "^1.3.3",
Expand Down Expand Up @@ -81,7 +82,7 @@
"@typescript-eslint/parser": "^5.11.0",
"@vue/eslint-config-typescript": "^11.0.0",
"autoprefixer": "^10.4.2",
"cypress": "^10.0.0",
"cypress": "^13.2.0",
"eslint": "^8.9.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-jsonc": "^2.2.1",
Expand Down
4 changes: 3 additions & 1 deletion src/components/TheTopCornerMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,9 @@ export default class TheTopCornerMenu extends Mixins(BaseMixin) {
}
get powerDevices() {
return this.$store.getters['server/power/getDevices']
const devices = this.$store.getters['server/power/getDevices'] ?? []
return devices.filter((device: ServerPowerStateDevice) => !device.device.startsWith('_'))
}
get service_states() {
Expand Down
58 changes: 39 additions & 19 deletions src/components/panels/MiniconsolePanel.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
<style scoped lang="scss">
.consoleTable {
border-top: 1px solid rgba(255, 255, 255, 0.12);
}
.gcode-command-field {
font-family: 'Roboto Mono', monospace;
}
</style>

<template>
<panel
v-if="socketIsConnected && klipperState !== 'disconnected'"
Expand All @@ -20,38 +10,45 @@
<v-btn icon tile @click="clearConsole">
<v-icon small>{{ mdiTrashCan }}</v-icon>
</v-btn>
<command-help-modal :in-toolbar="true" @onCommand="gcode = $event"></command-help-modal>
<command-help-modal :in-toolbar="true" @onCommand="gcode = $event" />
<v-menu
:offset-y="true"
:close-on-content-click="false"
:title="$t('Panels.MiniconsolePanel.SetupConsole')">
<template #activator="{ on, attrs }">
<v-btn icon tile v-bind="attrs" v-on="on">
<v-icon small>{{ mdiFilter }}</v-icon>
<v-icon small>{{ mdiCog }}</v-icon>
</v-btn>
</template>
<v-list>
<v-list-item v-if="consoleDirection === 'shell'" class="minHeight36">
<v-checkbox
v-model="autoscroll"
class="mt-0"
hide-details
:label="$t('Panels.MiniconsolePanel.Autoscroll')" />
</v-list-item>
<v-list-item class="minHeight36">
<v-checkbox
v-model="hideWaitTemperatures"
class="mt-0"
hide-details
:label="$t('Panels.MiniconsolePanel.HideTemperatures')"></v-checkbox>
:label="$t('Panels.MiniconsolePanel.HideTemperatures')" />
</v-list-item>
<v-list-item v-if="moonrakerComponents.includes('timelapse')" class="minHeight36">
<v-checkbox
v-model="hideTlCommands"
class="mt-0"
hide-details
:label="$t('Panels.MiniconsolePanel.HideTimelapse')"></v-checkbox>
:label="$t('Panels.MiniconsolePanel.HideTimelapse')" />
</v-list-item>
<v-list-item v-for="(filter, index) in customFilters" :key="index" class="minHeight36">
<v-checkbox
v-model="filter.bool"
class="mt-0"
hide-details
:label="filter.name"
@change="toggleFilter(filter)"></v-checkbox>
@change="toggleFilter(filter)" />
</v-list-item>
</v-list>
</v-menu>
Expand Down Expand Up @@ -93,7 +90,7 @@
:events="events"
:is-mini="true"
@command-click="commandClick" />
<v-divider></v-divider>
<v-divider />
</overlay-scrollbars>
</v-col>
</v-row>
Expand All @@ -109,7 +106,7 @@ import BaseMixin from '@/components/mixins/base'
import { CommandHelp, VTextareaType } from '@/store/printer/types'
import ConsoleTable from '@/components/console/ConsoleTable.vue'
import Panel from '@/components/ui/Panel.vue'
import { mdiChevronDoubleRight, mdiConsoleLine, mdiFilter, mdiSend, mdiTrashCan } from '@mdi/js'
import { mdiChevronDoubleRight, mdiCog, mdiConsoleLine, mdiSend, mdiTrashCan } from '@mdi/js'
import CommandHelpModal from '@/components/CommandHelpModal.vue'
@Component({
Expand All @@ -122,7 +119,7 @@ import CommandHelpModal from '@/components/CommandHelpModal.vue'
export default class MiniconsolePanel extends Mixins(BaseMixin) {
mdiTrashCan = mdiTrashCan
mdiConsoleLine = mdiConsoleLine
mdiFilter = mdiFilter
mdiCog = mdiCog
mdiSend = mdiSend
mdiChevronDoubleRight = mdiChevronDoubleRight
Expand Down Expand Up @@ -155,13 +152,18 @@ export default class MiniconsolePanel extends Mixins(BaseMixin) {
@Watch('events')
eventsChanged() {
if (this.consoleDirection === 'shell') {
if (this.consoleDirection === 'shell' && this.autoscroll) {
setTimeout(() => {
this.scrollToBottom()
}, 50)
}
}
@Watch('autoscroll')
autoscrollChanged(newVal: boolean) {
if (newVal) this.scrollToBottom()
}
clearConsole() {
this.$store.dispatch('gui/console/clear')
}
Expand Down Expand Up @@ -194,6 +196,14 @@ export default class MiniconsolePanel extends Mixins(BaseMixin) {
return this.$store.state.gui.gcodehistory.entries ?? []
}
get autoscroll(): boolean {
return this.$store.state.gui.console.autoscroll ?? true
}
set autoscroll(newVal) {
this.$store.dispatch('gui/saveSetting', { name: 'console.autoscroll', value: newVal })
}
commandClick(msg: string): void {
this.gcode = msg
Expand Down Expand Up @@ -325,3 +335,13 @@ export default class MiniconsolePanel extends Mixins(BaseMixin) {
}
}
</script>

<style scoped>
.consoleTable {
border-top: 1px solid rgba(255, 255, 255, 0.12);
}
.gcode-command-field {
font-family: 'Roboto Mono', monospace;
}
</style>
86 changes: 43 additions & 43 deletions src/components/panels/ToolheadControls/ZoffsetControl.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,7 @@
<span v-if="!el.is.xsmall" class="ml-1">{{ $t('Panels.ZoffsetPanel.Clear') }}</span>
</v-btn>
<v-btn
v-if="
z_gcode_offset !== 0 &&
((existZOffsetApplyProbe && !existZOffsetApplyEndstop) ||
(!existZOffsetApplyProbe && existZOffsetApplyEndstop))
"
v-if="showSaveButton"
color="primary"
text
small
Expand All @@ -41,31 +37,6 @@
<v-icon small>{{ mdiContentSave }}</v-icon>
<span v-if="!el.is.xsmall" class="ml-1">{{ $t('Panels.ZoffsetPanel.Save') }}</span>
</v-btn>
<v-menu v-else-if="z_gcode_offset !== 0" offset-y left :close-on-content-click="false">
<template #activator="{ on, attrs }">
<v-btn plain text small color="primary" v-bind="attrs" class="pl-2 pr-0" v-on="on">
<v-icon small>{{ mdiContentSave }}</v-icon>
<span v-if="!el.is.xsmall" class="ml-1">
{{ $t('Panels.ZoffsetPanel.Save') }}
</span>
<v-icon small>{{ mdiMenuDown }}</v-icon>
</v-btn>
</template>
<v-list dense>
<v-list-item>
<v-btn small style="width: 100%" @click="saveZOffsetToEndstop">
<v-icon left small>{{ mdiElectricSwitch }}</v-icon>
{{ $t('Panels.ZoffsetPanel.ToEndstop') }}
</v-btn>
</v-list-item>
<v-list-item>
<v-btn small style="width: 100%" @click="saveZOffsetToProbe">
<v-icon left small>{{ mdiElevator }}</v-icon>
{{ $t('Panels.ZoffsetPanel.ToProbe') }}
</v-btn>
</v-list-item>
</v-list>
</v-menu>
</div>
</v-col>
</v-row>
Expand Down Expand Up @@ -123,7 +94,7 @@

<v-dialog v-model="saveOffsetDialog" max-width="290">
<panel
:title="$t('Panels.ZoffsetPanel.SaveInfoHeadline').toString()"
:title="$t('Panels.ZoffsetPanel.SaveInfoHeadline')"
:icon="mdiInformation"
card-class="zoffset-saveinfo-dialog"
:margin-bottom="false">
Expand Down Expand Up @@ -160,12 +131,9 @@ import Responsive from '@/components/ui/Responsive.vue'
import {
mdiBroom,
mdiElectricSwitch,
mdiElevator,
mdiContentSave,
mdiArrowCollapseDown,
mdiInformation,
mdiMenuDown,
mdiArrowExpandUp,
mdiLayersOutline,
} from '@mdi/js'
Expand All @@ -174,16 +142,13 @@ import {
})
export default class ZoffsetControl extends Mixins(BaseMixin) {
mdiBroom = mdiBroom
mdiElectricSwitch = mdiElectricSwitch
mdiElevator = mdiElevator
mdiContentSave = mdiContentSave
mdiArrowCollapseDown = mdiArrowCollapseDown
mdiInformation = mdiInformation
mdiMenuDown = mdiMenuDown
mdiArrowExpandUp = mdiArrowExpandUp
mdiLayersOutline = mdiLayersOutline
private saveOffsetDialog = false
saveOffsetDialog = false
get homing_origin() {
return this.$store.state.printer?.gcode_move?.homing_origin ?? []
Expand All @@ -198,13 +163,37 @@ export default class ZoffsetControl extends Mixins(BaseMixin) {
}
get homed_axis() {
return this.$store.state.printer.toolhead.homed_axes ?? ''
return this.$store.state.printer.toolhead?.homed_axes ?? ''
}
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 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
}
Expand All @@ -217,6 +206,17 @@ export default class ZoffsetControl extends Mixins(BaseMixin) {
return this.$store.state.printer?.gcode_move?.homing_origin[2].toFixed(3)
}
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
}
sendBabyStepDown(offset: number): void {
const gcode = `SET_GCODE_OFFSET Z_ADJUST=-${offset} ${this.homed_axis === 'xyz' ? 'MOVE=1' : ''}`
this.$store.dispatch('server/addEvent', { message: gcode, type: 'command' })
Expand All @@ -236,12 +236,12 @@ export default class ZoffsetControl extends Mixins(BaseMixin) {
}
saveZOffset(): void {
if (this.existZOffsetApplyProbe && !this.existZOffsetApplyEndstop) {
if (this.isEndstopProbe && this.existZOffsetApplyProbe) {
this.saveZOffsetToProbe()
return
}
if (!this.existZOffsetApplyProbe && this.existZOffsetApplyEndstop) {
this.saveZOffsetToEndstop()
}
this.saveZOffsetToEndstop()
}
saveZOffsetToEndstop(): void {
Expand Down
4 changes: 4 additions & 0 deletions src/locales/de.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{
"App": {
"Notifications": {
"BrowserWarnings": {
"Headline": "Veralteter Browser",
"Description": "Die verwendete {name} Version ({version}) ist veraltet und wird nicht vollständig unterstützt. Mainsail benötigt die Version {minVersion} oder höher."
},
"DependencyDescription": "Die momentane {name} Version unterstützt nicht alle Funktionen von Mainsail. Aktualisiere {name} mindestens auf Version {neededVersion}.",
"DependencyName": "Abhängigkeit: {name}",
"DismissAll": "Alles verwerfen",
Expand Down
6 changes: 6 additions & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{
"App": {
"Notifications": {
"BrowserWarnings": {
"Headline": "Outdated Browser",
"Description": "{name} is outdated and not fully supported. The current version is {version}, but Mainsail requires version {minVersion} or higher."
},
"DependencyDescription": "The current {name} version does not support all features of Mainsail. Update {name} to at least {neededVersion}.",
"DependencyName": "Dependency: {name}",
"DismissAll": "Dismiss all",
Expand Down Expand Up @@ -133,6 +137,7 @@
"TryAgain": "try again"
},
"Console": {
"Autoscroll": "Autoscroll",
"CommandList": "Command list",
"Empty": "Empty",
"HideTemperatures": "Hide temperatures",
Expand Down Expand Up @@ -584,6 +589,7 @@
"Send": "send"
},
"MiniconsolePanel": {
"Autoscroll": "Autoscroll",
"Headline": "Console",
"HideTemperatures": "Hide temperatures",
"HideTimelapse": "Hide Timelapse",
Expand Down
Loading

0 comments on commit 5ac50d8

Please sign in to comment.