-
-
Notifications
You must be signed in to change notification settings - Fork 564
feat(Happy Hare): Adds sync-feedback buffer rendering in the filament status #1758
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
8ebcb60
7020510
5bfa1fb
d1a3372
b0f1ed3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -20,6 +20,71 @@ | |||||
| /> | ||||||
| </g> | ||||||
|
|
||||||
| <g | ||||||
| id="sync-feedback-buffer-piston" | ||||||
| fill="none" | ||||||
| stroke-linecap="round" | ||||||
| stroke-linejoin="round" | ||||||
| style="stroke: var(--color-outline); fill: var(--color-outline)" | ||||||
| > | ||||||
| <rect | ||||||
| x="3" | ||||||
| y="0" | ||||||
| width="30" | ||||||
| height="40" | ||||||
| rx="3" | ||||||
| ry="3" | ||||||
| fill="none" | ||||||
| stroke-width="1.5" | ||||||
| /> | ||||||
| <path | ||||||
| d="M-15 -4 L-6 0 L-15 4 Z" | ||||||
| stroke-width="1" | ||||||
| fill-opacity="0.6" | ||||||
| /> | ||||||
| <path | ||||||
| d="M8 40 L 28 40" | ||||||
| stroke-width="4" | ||||||
| /> | ||||||
| <text | ||||||
| x="-22" | ||||||
| y="4" | ||||||
| font-size="11px" | ||||||
| text-anchor="end" | ||||||
| > | ||||||
| {{ syncFeedbackPistonText }} | ||||||
| </text> | ||||||
| </g> | ||||||
|
|
||||||
| <g | ||||||
| id="sync-feedback-buffer-box" | ||||||
| fill="none" | ||||||
| stroke-linecap="round" | ||||||
| stroke-linejoin="round" | ||||||
| style="stroke: var(--color-outline)" | ||||||
| > | ||||||
| <rect | ||||||
| x="0" | ||||||
| y="0" | ||||||
| width="36" | ||||||
| height="45" | ||||||
| rx="3" | ||||||
| ry="3" | ||||||
| class="fil-background" | ||||||
| stroke-width="2" | ||||||
| fill-opacity="0.6" | ||||||
| /> | ||||||
| <path | ||||||
| d="M-3 10 0 10 M-3 22 0.5 22 M-3 34.5 0 34.5" | ||||||
| stroke-width="2" | ||||||
| stroke-opacity="0.6" | ||||||
| /> | ||||||
| <path | ||||||
| d="M8 0 L 28 0" | ||||||
| stroke-width="4" | ||||||
| /> | ||||||
| </g> | ||||||
|
|
||||||
| <g | ||||||
| id="sissors" | ||||||
| style="stroke: var(--color-outline); fill: none; stroke-linecap: round; stroke-linejoin: round;" | ||||||
|
|
@@ -93,19 +158,19 @@ | |||||
| <g transform="matrix(23.2058 0 0 23.2058 329.7195 325.9517)"> | ||||||
| <path | ||||||
| style=" | ||||||
| stroke: rgb(0, 0, 0); | ||||||
| stroke-width: 0; | ||||||
| stroke-dasharray: none; | ||||||
| stroke-linecap: butt; | ||||||
| stroke-dashoffset: 0; | ||||||
| stroke-linejoin: miter; | ||||||
| stroke-miterlimit: 4; | ||||||
| is-custom-font: none; | ||||||
| font-file-url: none; | ||||||
| fill: rgb(254, 162, 54); | ||||||
| fill-rule: nonzero; | ||||||
| opacity: 1; | ||||||
| " | ||||||
| stroke: rgb(0, 0, 0); | ||||||
| stroke-width: 0; | ||||||
| stroke-dasharray: none; | ||||||
| stroke-linecap: butt; | ||||||
| stroke-dashoffset: 0; | ||||||
| stroke-linejoin: miter; | ||||||
| stroke-miterlimit: 4; | ||||||
| is-custom-font: none; | ||||||
| font-file-url: none; | ||||||
| fill: rgb(254, 162, 54); | ||||||
| fill-rule: nonzero; | ||||||
| opacity: 1; | ||||||
| " | ||||||
| vector-effect="non-scaling-stroke" | ||||||
| transform=" translate(-15.4288, -16.4198)" | ||||||
| stroke-linecap="round" | ||||||
|
|
@@ -352,56 +417,75 @@ | |||||
| {{ temperatureText }} | ||||||
| </text> | ||||||
|
|
||||||
| <g v-if="hasSyncFeedback && filamentPos >= FILAMENT_POS_END_BOWDEN"> | ||||||
| <transition name="fade"> | ||||||
| <g | ||||||
| v-if="isSensorTriggered('filament_tension') && isSensorTriggered('filament_compression')" | ||||||
| key="neutral" | ||||||
| > | ||||||
| <text | ||||||
| x="288" | ||||||
| y="240" | ||||||
| >Neutral</text> | ||||||
| <use | ||||||
| xlink:href="#sync-feedback" | ||||||
| transform="translate(286, 247.5) scale(1.0,-1.0) rotate(90)" | ||||||
| /> | ||||||
| </g> | ||||||
| <g | ||||||
| v-else-if="isSensorTriggered('filament_tension')" | ||||||
| key="tension" | ||||||
| > | ||||||
| <text | ||||||
| x="288" | ||||||
| y="240" | ||||||
| >Tension</text> | ||||||
| <use | ||||||
| xlink:href="#sync-feedback" | ||||||
| transform="translate(258, 199) scale(1.2)" | ||||||
| /> | ||||||
| <use | ||||||
| xlink:href="#sync-feedback" | ||||||
| transform="translate(258, 271) scale(1.2,-1.2)" | ||||||
| /> | ||||||
| </g> | ||||||
| <g | ||||||
| v-else-if="isSensorTriggered('filament_compression')" | ||||||
| key="compression" | ||||||
| > | ||||||
| <text | ||||||
| x="288" | ||||||
| y="240" | ||||||
| >Compression</text> | ||||||
| <use | ||||||
| xlink:href="#sync-feedback" | ||||||
| transform="translate(258, 235) scale(1.2)" | ||||||
| /> | ||||||
| <use | ||||||
| xlink:href="#sync-feedback" | ||||||
| transform="translate(258, 235) scale(1.2,-1.2)" | ||||||
| /> | ||||||
| </g> | ||||||
| </transition> | ||||||
| <g v-if="hasSyncFeedback"> | ||||||
| <use | ||||||
| xlink:href="#sync-feedback-buffer-piston" | ||||||
| :style="{ | ||||||
| transform: `translate(232px, ${syncFeedbackPistonPos}px)`, | ||||||
| transition: 'transform 250ms ease', | ||||||
| }" | ||||||
| /> | ||||||
| <use | ||||||
| xlink:href="#sync-feedback-buffer-box" | ||||||
| transform="translate(232, 212)" | ||||||
| /> | ||||||
| <g v-if="syncFeedbackActive"> | ||||||
| <transition name="fade"> | ||||||
| <g | ||||||
| v-if="isSensorTriggered('filament_tension') && isSensorTriggered('filament_compression')" | ||||||
| key="neutral" | ||||||
| > | ||||||
| <text | ||||||
| x="298" | ||||||
| y="240" | ||||||
| > | ||||||
| Neutral | ||||||
| </text> | ||||||
| <use | ||||||
| xlink:href="#sync-feedback" | ||||||
| transform="translate(296, 247.5) scale(1.0,-1.0) rotate(90)" | ||||||
| /> | ||||||
| </g> | ||||||
| <g | ||||||
| v-else-if="isSensorTriggered('filament_tension')" | ||||||
| key="tension" | ||||||
| > | ||||||
| <text | ||||||
| x="298" | ||||||
| y="240" | ||||||
| > | ||||||
| Tension | ||||||
| </text> | ||||||
| <use | ||||||
| xlink:href="#sync-feedback" | ||||||
| transform="translate(272, 199) scale(1.2)" | ||||||
| /> | ||||||
| <use | ||||||
| xlink:href="#sync-feedback" | ||||||
| transform="translate(272, 271) scale(1.2,-1.2)" | ||||||
| /> | ||||||
| </g> | ||||||
| <g | ||||||
| v-else-if="isSensorTriggered('filament_compression')" | ||||||
| key="compression" | ||||||
| > | ||||||
| <text | ||||||
| x="298" | ||||||
| y="240" | ||||||
| > | ||||||
| Compression | ||||||
| </text> | ||||||
| <use | ||||||
| xlink:href="#sync-feedback" | ||||||
| transform="translate(272, 235) scale(1.2)" | ||||||
| /> | ||||||
| <use | ||||||
| xlink:href="#sync-feedback" | ||||||
| transform="translate(272, 235) scale(1.2,-1.2)" | ||||||
| /> | ||||||
| </g> | ||||||
| </transition> | ||||||
| </g> | ||||||
| </g> | ||||||
| <text | ||||||
| x="160" | ||||||
|
|
@@ -565,7 +649,9 @@ export default class MmuFilamentStatus extends Mixins(StateMixin, MmuMixin) { | |||||
| } | ||||||
|
|
||||||
| get encoderPosText (): string { | ||||||
| if (this.encoderPos < 10000) return `${this.encoderPos} mm` | ||||||
| if (this.encoderPos < 10000) { | ||||||
| return `${this.encoderPos} mm` | ||||||
| } | ||||||
| return `${this.encoderPos}` | ||||||
| } | ||||||
|
|
||||||
|
|
@@ -624,9 +710,37 @@ export default class MmuFilamentStatus extends Mixins(StateMixin, MmuMixin) { | |||||
| } | ||||||
|
|
||||||
| get hasSyncFeedback (): boolean { | ||||||
| return ( | ||||||
| this.syncFeedbackEnabled && (this.hasSensor('filament_compression') || this.hasSensor('filament_tension')) | ||||||
| ) | ||||||
| return this.hasFilamentCompressionSensor || this.hasFilamentTensionSensor || this.hasFilamentProportionalSensor | ||||||
|
||||||
| return this.hasFilamentCompressionSensor || this.hasFilamentTensionSensor || this.hasFilamentProportionalSensor | |
| return this.syncFeedbackEnabled && (this.hasFilamentCompressionSensor || this.hasFilamentTensionSensor || this.hasFilamentProportionalSensor) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is correct behavior because the sync-feedback "buffer" is also used as an endstop for homing the filament to the extruder. The actual enabled flag is simply whether dynamic rotation_distance adjustment is taking place and not about the existence of the sync feedback sensors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Vue template interpolation inside SVG defs may not work as expected. The text element with {{ syncFeedbackPistonText }} is defined in defs and referenced via use, which means the interpolation will only evaluate once during definition, not dynamically update when syncFeedbackPistonText changes. Consider moving the text element outside of defs and positioning it directly where needed, or use a different approach for dynamic text in reusable SVG elements.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think Copilot is mistaken (or it is with older Vue implementations) because I tested on Chrome, Safari, Firefox (on Mac) and Safari/Chrome on iPhone and it is reactive as expected(?)
I don't understand Vue well enough to know why, but I have validated it works as designed...