Skip to content

Commit ab09d4b

Browse files
moggieukmeteyou
andauthored
feat(HappyHare): Addition of heater and climate to the MMU unit footer (#2429)
Co-authored-by: Stefan Dej <meteyou@gmail.com>
1 parent 9e0d31b commit ab09d4b

12 files changed

Lines changed: 339 additions & 53 deletions

File tree

src/components/mixins/mmu.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ export interface Mmu {
8989
spoolman_support: 'off' | 'readonly' | 'push' | 'pull'
9090
bowden_progress: number
9191
espooler_active: MmuEspoolerState
92+
drying_state: MmuDryingState[]
9293
sensors: {
9394
mmu_pre_gate?: boolean
9495
mmu_gear?: boolean
@@ -145,7 +146,23 @@ export interface MmuMachineUnit {
145146
can_crossload: boolean
146147
has_bypass: boolean
147148
multi_gear: boolean
148-
environment_sensor: string
149+
environment_sensor?: string
150+
environment_sensors?: string[]
151+
filament_heater?: string
152+
filament_heaters?: string[]
153+
}
154+
155+
export type MmuDryingState = '' | 'active' | 'queued' | 'complete' | 'cancelled'
156+
157+
export interface MmuFilamentHeater {
158+
temperature: number
159+
target: number
160+
power: number
161+
}
162+
163+
export interface MmuEnvironmentSensor {
164+
temperature?: number
165+
humidity?: number
149166
}
150167

151168
export interface MmuSlicerToolMap {

src/components/panels/Mmu/MmuPanelSettings.vue

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,13 @@
4343
<v-list-item class="minHeight36">
4444
<v-checkbox v-model="showLogos" class="mt-0" hide-details :label="$t('Panels.MmuPanel.ShowLogos')" />
4545
</v-list-item>
46+
<v-list-item class="minHeight36">
47+
<v-checkbox
48+
v-model="showClimate"
49+
class="mt-0"
50+
hide-details
51+
:label="$t('Panels.MmuPanel.ShowClimate')" />
52+
</v-list-item>
4653
</v-list>
4754
</v-menu>
4855
</template>
@@ -105,6 +112,14 @@ export default class MmuPanelSettings extends Mixins(BaseMixin, MmuMixin) {
105112
return this.$store.state.gui.view.mmu.showName
106113
}
107114
115+
set showClimate(newVal: boolean) {
116+
this.$store.dispatch('gui/saveSetting', { name: 'view.mmu.showClimate', value: newVal })
117+
}
118+
119+
get showClimate(): boolean {
120+
return this.$store.state.gui.view.mmu.showClimate
121+
}
122+
108123
get showUnavailableSpoolColor(): boolean {
109124
return this.$store.state.gui.view.mmu.showUnavailableSpoolColor
110125
}

src/components/panels/Mmu/MmuUnit.vue

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div class="mmu-unit d-inline-flex flex-column mx-1 rounded-lg mb-3">
2+
<div :class="mmuUnitClass" class="d-inline-flex flex-column mx-1 mb-3 mmu-unit">
33
<div class="d-flex flex-wrap pt-3 px-4 position-relative">
44
<mmu-unit-gate
55
v-for="gateIndex in numGates"
@@ -21,7 +21,13 @@
2121
:selected-gate="selectedGate"
2222
@select-gate="selectGate" />
2323
</div>
24-
<mmu-unit-footer class="pt-0 position-relative" :mmu-machine-unit="mmuMachineUnit" :unit-index="unitIndex" />
24+
<mmu-unit-footer
25+
class="pt-0 position-relative"
26+
:style="footerStyle"
27+
:mmu-machine-unit="mmuMachineUnit"
28+
:show-details="showDetails"
29+
:show-footer="showFooter"
30+
:unit-index="unitIndex" />
2531
</div>
2632
</template>
2733
<script lang="ts">
@@ -37,9 +43,14 @@ export default class MmuUnit extends Mixins(BaseMixin, MmuMixin) {
3743
@Prop({ required: true }) readonly unitIndex!: number
3844
@Prop({ default: false }) readonly showDetails!: boolean
3945
@Prop({ default: true }) readonly showContextMenu!: boolean
46+
@Prop({ default: true }) readonly showFooter!: boolean
4047
@Prop({ default: false }) readonly hideBypass!: boolean
4148
@Prop({ default: false }) readonly unhighlightSpools!: boolean
4249
50+
get mmuUnitClass() {
51+
return this.unitIndex < 0 ? 'mmu-unit-clear' : ''
52+
}
53+
4354
get mmuMachineUnit() {
4455
return this.getMmuMachineUnit(this.unitIndex)
4556
}
@@ -58,6 +69,12 @@ export default class MmuUnit extends Mixins(BaseMixin, MmuMixin) {
5869
return this.mmuMachineUnit?.has_bypass ?? true
5970
}
6071
72+
get footerStyle() {
73+
const numSpools = this.numGates + (this.hasBypass ? 1 : 0)
74+
const maxWidth = this.spoolWidth * numSpools + 32
75+
return `max-width: ${maxWidth}px;`
76+
}
77+
6178
editFilament(gateIndex: number) {
6279
this.$emit('edit-filament', gateIndex)
6380
}
@@ -69,12 +86,20 @@ export default class MmuUnit extends Mixins(BaseMixin, MmuMixin) {
6986
</script>
7087

7188
<style scoped>
89+
.mmu-unit-clear {
90+
background: none !important;
91+
box-shadow: none !important;
92+
}
93+
7294
.mmu-unit {
7395
background: #2c2c2c;
7496
overflow: hidden;
97+
border-radius: 32px 32px 8px 8px;
98+
box-shadow: inset 0 4px 4px -4px #ffffff80;
7599
}
76100
77101
html.theme--light .mmu-unit {
78102
background: #f0f0f0;
103+
box-shadow: inset 0 4px 2px -4px #2c2c2c80;
79104
}
80105
</style>

src/components/panels/Mmu/MmuUnitFooter.vue

Lines changed: 12 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
<template>
2-
<div class="mmu-unit-footer zindex-4 d-flex flex-row align-center px-4 pb-1">
2+
<div class="mmu-unit-footer zindex-4 d-flex flex-row align-center px-2 pb-1">
33
<v-icon
4-
v-if="showLogos"
4+
v-if="showFooter && showLogos"
55
class="mr-4 flex-grow-0 flex-shrink-0 opacity-70"
66
:class="logoClasses"
77
:size="logoHeight">
88
{{ logo }}
99
</v-icon>
10-
<div class="flex-grow-1 flex-shrink-1 min-width-0 text-caption">
10+
<div v-if="showFooter" class="flex-grow-1 flex-shrink-1 min-width-0 text-caption">
1111
<div v-if="showName" class="text-truncate">{{ unitDisplayName }}</div>
12-
<div v-if="unitClimateInfo" class="text-truncate">{{ unitClimateInfo }}</div>
12+
<mmu-unit-footer-climate v-if="showDetails && showClimate" :mmu-machine-unit="mmuMachineUnit" />
1313
</div>
1414
</div>
1515
</template>
1616
<script lang="ts">
1717
import { Component, Mixins, Prop } from 'vue-property-decorator'
1818
import BaseMixin from '@/components/mixins/base'
1919
import MmuMixin, { MmuMachineUnit } from '@/components/mixins/mmu'
20+
import MmuUnitFooterClimate from '@/components/panels/Mmu/MmuUnitFooterClimate.vue'
2021
import {
2122
mmuIcon3MS,
2223
mmuIconAngryBeaver,
@@ -32,14 +33,17 @@ import {
3233
mmuIconVvd,
3334
mmuThemeIcons,
3435
} from '@/plugins/mmuIcons'
35-
import { additionalSensors } from '@/store/variables'
3636
3737
const squareLogoVendors = ['3MS', 'AngryBeaver', 'EMU', 'ERCF', 'KMS']
3838
39-
@Component
39+
@Component({
40+
components: { MmuUnitFooterClimate },
41+
})
4042
export default class MmuUnitFooter extends Mixins(BaseMixin, MmuMixin) {
4143
@Prop({ required: true }) readonly unitIndex!: number
4244
@Prop({ required: true }) readonly mmuMachineUnit!: MmuMachineUnit
45+
@Prop({ default: true }) readonly showDetails!: boolean
46+
@Prop({ default: true }) readonly showFooter!: boolean
4347
4448
get unitDisplayName(): string {
4549
const name = this.mmuMachineUnit?.name
@@ -55,43 +59,8 @@ export default class MmuUnitFooter extends Mixins(BaseMixin, MmuMixin) {
5559
return this.$store.state.gui.view.mmu.showName ?? true
5660
}
5761
58-
get unitClimateSensorName() {
59-
const name = this.mmuMachineUnit?.environment_sensor?.replace(/^"(.*)"$/, '$1') ?? undefined
60-
if (!name) return undefined
61-
62-
const parts = name.split(' ')
63-
if (parts.length !== 2) return undefined
64-
65-
return parts[1]
66-
}
67-
68-
get unitClimateSensor() {
69-
if (!this.unitClimateSensorName) return undefined
70-
71-
for (const key of additionalSensors) {
72-
const objectName: string = `${key} ${this.unitClimateSensorName}`
73-
if (!(objectName in this.$store.state.printer)) continue
74-
75-
return this.$store.state.printer[objectName]
76-
}
77-
78-
return undefined
79-
}
80-
81-
get unitClimateInfo() {
82-
if (!this.unitClimateSensor) return undefined
83-
84-
const values: string[] = []
85-
86-
if ('temperature' in this.unitClimateSensor && this.unitClimateSensor.temperature !== null) {
87-
values.push(`${this.unitClimateSensor.temperature.toFixed(0)}°C`)
88-
}
89-
90-
if ('humidity' in this.unitClimateSensor && this.unitClimateSensor.humidity !== null) {
91-
values.push(`${this.unitClimateSensor.humidity.toFixed(0)}%`)
92-
}
93-
94-
return values.length > 0 ? values.join(' / ') : undefined
62+
get showClimate(): boolean {
63+
return this.$store.state.gui.view.mmu.showClimate ?? true
9564
}
9665
9766
get mmuVendor() {

0 commit comments

Comments
 (0)