Skip to content

Add PrusaMMU Support. Fixes #1176#5371

Open
FieldofClay wants to merge 22 commits intoUnchartedBull:mainfrom
FieldofClay:main
Open

Add PrusaMMU Support. Fixes #1176#5371
FieldofClay wants to merge 22 commits intoUnchartedBull:mainfrom
FieldofClay:main

Conversation

@FieldofClay
Copy link

Firstly full credit goes to @AndersWinther-Dahl, this is just their prusammu branch with a few tweaks to merge it into the current OctoDash code base.

This PR adds support for the PrusaMMU OctoPrint plugin. When enabled it will prompt the user to select which filament to use and sends through the selection to the PrusaMMU plugin. @AndersWinther-Dahl did a nice demo of the functionality in this comment: #1176 (comment)

@Hillshum
Copy link
Collaborator

Hillshum commented Oct 3, 2025

Hey, thanks to both of you for working on this!

I'll be giving this a proper review in the coming days, and I'll try to think up some ways to test it. Meanwhile, there's some linter issues that need to be fixed. You can run that check locally with npm run lint (or npm run lint:fix to enable autofix).

@Hillshum
Copy link
Collaborator

Hillshum commented Oct 4, 2025

Looks like npm run locale:update is needed...

Copy link
Collaborator

@Hillshum Hillshum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this (both of you really)!

I still need to spend some time making sure some of the internals work so don't consider these findings to be exhaustive.

Also I need to do some testing

@FieldofClay FieldofClay marked this pull request as draft October 6, 2025 07:10
@FieldofClay
Copy link
Author

I've added in some error handling, with notifications and a close button. The close button does the same thing as the close button in the PrusaMMU modal within Octoprint, hides the dialog/modal and allows it to fallback to the printer for selection after the configured timeout.

Let me know if there are anything else that needs tweaks, I'll try to sort it out. Node isn't something I've done much with in the past.

Copy link
Collaborator

@Hillshum Hillshum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, the error handling looks good.

I will keep an eye out for changes and approving the checks. When you have things ready, mark this as ready to review and I'll inspect things thoroughly.

catchError(error => {
this.notificationService.error(
$localize`:@@prusammu-init-failed:Failed to load filament settings`,
error.message || 'Unable to fetch PrusaMMU configuration',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be localized

@Hillshum
Copy link
Collaborator

Oh another thing needed: In app.service.ts, add the logic needed to add the default MMU settings to an existing config file

@FieldofClay FieldofClay marked this pull request as ready for review October 19, 2025 23:03
@FieldofClay
Copy link
Author

I've been using it for the past few weeks without issue, let me know if it needs any further changes.

@FieldofClay FieldofClay requested a review from Hillshum November 5, 2025 01:10
Copy link
Collaborator

@Hillshum Hillshum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, this is a thorough review, but I haven't tested. Hopefully I can do that in a couple of days

}
const sourceSpools = spools.selectedSpools?.some(spool => spool !== null)
? spools.selectedSpools
: spools.allSpools?.slice(0, 5) || [];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So if no spools are selected, this just assumes the first five overall spools are selected? If that's truly correct behavior, I think some explanation should be included as a comment.

Additionally, I know the MMU plugin has a capacity setting to accommodate modded MMUs, and I think the count here should respect that.

@@ -0,0 +1,40 @@
export interface Filament {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be named PrusaFilament or something similar?

name: string;
}

export interface FilamentSource {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
export interface FilamentSource {
export interface PrusaFilamentSource {

map((selection: FilamentManagerSelections): Array<FilamentSpool> => {
if (selection.selections.length > 0) {
return selection.selections.map((sel): FilamentSpool => this.convertFilamentManagerSpool(sel.spool));
return selection.selections.map(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So prior to your changes, the array index represented the tool. Is there a need for all this or can the index be used instead when preparing the spools in the MMU service?


return sourceSpools.length > 0
? sourceSpools
.map((spool, index) => (spool ? this.convertFilamentManagerSpool(spool, index + 1) : null))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can the id + 1 be done in the MMU service? Tweaks for MMU compatibility should be limited to the scope of MMU code.

this.source = this.configService.isSpoolManagerPluginEnabled() ? 'SpoolManager' : 'Filament Manager';
this.filaments = currentSpools.map(filament => {
return {
id: filament.tool,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While the types don't indicate this, the filament service can send null as a value indicating a tool has no filament selected, so this block needs to handle that case.

@Hillshum
Copy link
Collaborator

Hillshum commented Nov 8, 2025

One other thing: app.service.ts needs to have a bit to automatically migrate existing user configs to add the mmu config

if (prusaMMUSettings.filamentSource === 'prusammu' && prusaMMUSettings?.filament?.length) {
this.filaments = prusaMMUSettings.filament;
this.source = 'PrusaMMU';
} else if (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens when these two conditionals both miss? What if the MMU plugin is configured to use Spool Manager but then OctoDash isn't using a filament manager?

Perhaps the solution is an else clause below that leads to the user being informed that the configs don't match up?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants