Skip to content

Commit 0cb2650

Browse files
moggieukpedrolamas
andauthored
fix(HappyHare): Retains the correct font size for filament status messages (#1788)
Signed-off-by: Paul Morgan <moggieuk@hotmail.com> Co-authored-by: Pedro Lamas <pedrolamas@gmail.com>
1 parent ea4e7e0 commit 0cb2650

File tree

3 files changed

+60
-60
lines changed

3 files changed

+60
-60
lines changed

src/components/widgets/mmu/MmuCard.vue

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,6 @@
172172
<div class="text--disabled smaller-font">
173173
{{ toolchangeText }}
174174
</div>
175-
<div class="min-height-text">
176-
{{ statusText }}
177-
</div>
178175
<mmu-filament-status />
179176
<template v-if="showClogDetection">
180177
<div class="text-center">
@@ -318,31 +315,6 @@ export default class MmuCard extends Mixins(StateMixin, MmuMixin) {
318315
return this.$typedState.config.uiSettings.mmu.showDetails
319316
}
320317
321-
get statusText (): string {
322-
let posStr: string = ''
323-
if (['complete', 'error', 'cancelled', 'started'].includes(this.printState)) {
324-
posStr = this.capitalize(this.printState)
325-
} else if (this.action === 'Idle') {
326-
if (this.printState === 'printing') {
327-
posStr = `Printing (${this.numToolchanges}`
328-
if (this.slicerToolMap?.total_toolchanges) posStr += `/${this.slicerToolMap.total_toolchanges}`
329-
posStr += ' swaps)'
330-
} else {
331-
posStr = this.filament !== 'Unloaded' ? `Filament: ${this.filamentPosition}mm` : 'Filament: Unloaded'
332-
}
333-
} else if (this.action === 'Loading' || this.action === 'Unloading') {
334-
posStr = `${this.action}: ${this.filamentPosition}mm`
335-
} else {
336-
posStr = this.action ?? ''
337-
}
338-
return posStr
339-
}
340-
341-
private capitalize (str: string): string {
342-
if (!str) return str
343-
return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase()
344-
}
345-
346318
handleSyncSpoolman () {
347319
this.sendGcode('MMU_SPOOLMAN REFRESH=1 QUIET=1', this.$waits.onMmuSpoolman)
348320
}
@@ -390,9 +362,4 @@ export default class MmuCard extends Mixins(StateMixin, MmuMixin) {
390362
min-height: 1.0em;
391363
line-height: 1.0em;
392364
}
393-
394-
.min-height-text {
395-
min-height: 1.1em;
396-
line-height: 1.1em;
397-
}
398365
</style>

src/components/widgets/mmu/MmuFilamentStatus.vue

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<svg
33
ref="filStatusSvg"
4-
viewBox="140 20 285 421"
4+
viewBox="140 0 285 441"
55
preserveAspectRatio="xMidYMid meet"
66
class="svg-colors"
77
>
@@ -38,12 +38,12 @@
3838
stroke-width="1.5"
3939
/>
4040
<path
41-
d="M-15 -4 L-6 0 L-15 4 Z"
41+
d="m-15-4 9 4-9 4Z"
4242
stroke-width="1"
4343
fill-opacity="0.6"
4444
/>
4545
<path
46-
d="M8 40 L 28 40"
46+
d="M8 40h20"
4747
stroke-width="4"
4848
/>
4949
<text
@@ -75,12 +75,12 @@
7575
fill-opacity="0.6"
7676
/>
7777
<path
78-
d="M-3 10 0 10 M-3 22 0.5 22 M-3 34.5 0 34.5"
78+
d="M-3 10h3m-3 12H.5M-3 34.5h3"
7979
stroke-width="2"
8080
stroke-opacity="0.6"
8181
/>
8282
<path
83-
d="M8 0 L 28 0"
83+
d="M8 0h20"
8484
stroke-width="4"
8585
/>
8686
</g>
@@ -211,6 +211,14 @@
211211
</g>
212212
</defs>
213213

214+
<text
215+
x="282"
216+
y="18"
217+
font-size="16px"
218+
text-anchor="middle"
219+
>
220+
{{ statusText }}
221+
</text>
214222
<rect
215223
x="150"
216224
y="30"
@@ -644,6 +652,31 @@ export default class MmuFilamentStatus extends Mixins(StateMixin, MmuMixin) {
644652
return POSITIONS.END_BOWDEN
645653
}
646654
655+
get statusText (): string {
656+
let posStr: string = ''
657+
if (['complete', 'error', 'cancelled', 'started'].includes(this.printState)) {
658+
posStr = this.capitalize(this.printState)
659+
} else if (this.action === this.ACTION_IDLE) {
660+
if (this.printState === 'printing') {
661+
posStr = `Printing (${this.numToolchanges}`
662+
if (this.slicerToolMap?.total_toolchanges) posStr += `/${this.slicerToolMap?.total_toolchanges}`
663+
posStr += ' swaps)'
664+
} else {
665+
posStr = this.filament !== 'Unloaded' ? `Filament: ${this.filamentPosition} mm` : 'Filament: Unloaded'
666+
}
667+
} else if (this.action === this.ACTION_LOADING || this.action === this.ACTION_UNLOADING) {
668+
posStr = `${this.action}: ${this.filamentPosition} mm`
669+
} else {
670+
posStr = this.action ?? ''
671+
}
672+
return posStr
673+
}
674+
675+
private capitalize (str: string): string {
676+
if (!str) return str
677+
return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase()
678+
}
679+
647680
get toolheadSensor () {
648681
return this.sensors['toolhead']
649682
}

src/mixins/mmu.ts

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -348,19 +348,19 @@ export default class MmuMixin extends Vue {
348348
return this.mmuState?.action
349349
}
350350

351-
readonly ACTION_IDLE: string = 'Idle'
352-
readonly ACTION_LOADING: string = 'Loading'
353-
readonly ACTION_LOADING_EXTRUDER: string = 'Loading Ext'
354-
readonly ACTION_UNLOADING: string = 'Unloading'
355-
readonly ACTION_UNLOADING_EXTRUDER: string = 'Unloading Ext'
356-
readonly ACTION_FORMING_TIP: string = 'Forming Tip'
357-
readonly ACTION_CUTTING_TIP: string = 'Cutting Tip'
358-
readonly ACTION_HEATING: string = 'Heating'
359-
readonly ACTION_CHECKING: string = 'Checking'
360-
readonly ACTION_HOMING: string = 'Homing'
361-
readonly ACTION_SELECTING: string = 'Selecting'
362-
readonly ACTION_CUTTING_FILAMENT: string = 'Cutting Filament'
363-
readonly ACTION_PURGING: string = 'Purging'
351+
readonly ACTION_IDLE = 'Idle'
352+
readonly ACTION_LOADING = 'Loading'
353+
readonly ACTION_LOADING_EXTRUDER = 'Loading Ext'
354+
readonly ACTION_UNLOADING = 'Unloading'
355+
readonly ACTION_UNLOADING_EXTRUDER = 'Unloading Ext'
356+
readonly ACTION_FORMING_TIP = 'Forming Tip'
357+
readonly ACTION_CUTTING_TIP = 'Cutting Tip'
358+
readonly ACTION_HEATING = 'Heating'
359+
readonly ACTION_CHECKING = 'Checking'
360+
readonly ACTION_HOMING = 'Homing'
361+
readonly ACTION_SELECTING = 'Selecting'
362+
readonly ACTION_CUTTING_FILAMENT = 'Cutting Filament'
363+
readonly ACTION_PURGING = 'Purging'
364364

365365
get hasBypass (): boolean {
366366
return this.mmuState?.has_bypass ?? false
@@ -407,10 +407,10 @@ export default class MmuMixin extends Vue {
407407
return this.mmuState?.spoolman_support ?? 'off'
408408
}
409409

410-
readonly SPOOLMAN_OFF: string = 'off' // Spoolman disabled
411-
readonly SPOOLMAN_READONLY: string = 'readonly' // Get filament attributes only
412-
readonly SPOOLMAN_PUSH: string = 'push' // Local gatemap is the source or truth
413-
readonly SPOOLMAN_PULL: string = 'pull' // Spoolman db is the source of truth
410+
readonly SPOOLMAN_OFF = 'off' // Spoolman disabled
411+
readonly SPOOLMAN_READONLY = 'readonly' // Get filament attributes only
412+
readonly SPOOLMAN_PUSH = 'push' // Local gatemap is the source of truth
413+
readonly SPOOLMAN_PULL = 'pull' // Spoolman db is the source of truth
414414

415415
get sensors (): Record<string, boolean | null> {
416416
return this.mmuState?.sensors ?? {}
@@ -420,8 +420,8 @@ export default class MmuMixin extends Vue {
420420
return this.mmuState?.espooler_active ?? ''
421421
}
422422

423-
readonly ESPOOLER_REWIND: string = 'rewind'
424-
readonly ESPOOLER_ASSIST: string = 'assist'
423+
readonly ESPOOLER_REWIND = 'rewind'
424+
readonly ESPOOLER_ASSIST = 'assist'
425425

426426
/*
427427
* Optional printer variables based on selector type
@@ -494,14 +494,14 @@ export default class MmuMixin extends Vue {
494494
return this.$typedState.printer.printer['gcode_macro _MMU_LED_VARS']?.default_status_effect ?? 'off'
495495
}
496496

497-
readonly LED_OPTIONS: string[] = ['off', 'gate_status', 'filament_color', 'slicer_color']
498-
readonly LED_STATUS_OPTIONS: string[] = [...this.LED_OPTIONS, 'on']
497+
readonly LED_OPTIONS = ['off', 'gate_status', 'filament_color', 'slicer_color'] as const
498+
readonly LED_STATUS_OPTIONS = [...this.LED_OPTIONS, 'on'] as const
499499

500500
get macroVarsAutomapStrategy (): string {
501501
return this.$typedState.printer.printer['gcode_macro _MMU_SOFTWARE_VARS']?.automap_strategy ?? 'none'
502502
}
503503

504-
readonly AUTOMAP_OPTIONS: string[] = ['none', 'filament_name', 'material', 'color', 'closest_color', 'spool_id']
504+
readonly AUTOMAP_OPTIONS = ['none', 'filament_name', 'material', 'color', 'closest_color', 'spool_id'] as const
505505

506506
/*
507507
* Miscellaneous

0 commit comments

Comments
 (0)