Skip to content
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

feat(spoolman): multi-tool support #1324

Merged
merged 15 commits into from
Feb 3, 2024

Conversation

matmen
Copy link
Member

@matmen matmen commented Jan 25, 2024

Closes #1269

Adds a new tool selection dropdown to the spoolman card when one or more gcode_macros with a spool_id variable are detected. Emits a SET_GCODE_VARIABLE command to update the tools associated spool.

screenshot

Docs

When a tool has a spool ID set, the tools "color dot" will be replaced by a filament spool icon in the corresponding filaments color (like in the spool selection modal).
Persisting settings available using Klipper's [save_variables] module.

Signed-off-by: Mathis Mensing <github@matmen.dev>
@matmen matmen added the FR - Enhancement New feature or request label Jan 25, 2024
Signed-off-by: Mathis Mensing <github@matmen.dev>
Signed-off-by: Mathis Mensing <github@matmen.dev>
Signed-off-by: Mathis Mensing <github@matmen.dev>
Signed-off-by: Mathis Mensing <github@matmen.dev>
@matmen matmen marked this pull request as ready for review January 27, 2024 22:29
@matmen matmen requested a review from pedrolamas January 27, 2024 22:29
matmen and others added 4 commits January 28, 2024 14:54
Signed-off-by: Mathis Mensing <github@matmen.dev>
Signed-off-by: Mathis Mensing <github@matmen.dev>
Signed-off-by: Mathis Mensing <github@matmen.dev>
@pedrolamas
Copy link
Member

When a tool has a spool ID set, the tools "color dot" will be replaced by a filament spool icon in the corresponding filaments color (like in the spool selection modal).

The only issue I see with this is if the spool color is gray, it won't show up if Fluidd is using Dark theme (same for white spool in Light theme), hence why I was using that "dot" thing!

@matmen
Copy link
Member Author

matmen commented Jan 30, 2024

The same issue exists in the spool selection dialog, I think this should be an easy fix by just adding an outline to the spool icon

@pedrolamas
Copy link
Member

...adding an outline to the spool icon

not sure if that is possible, but if you manage to do it, I am very interested! 😁

Signed-off-by: Mathis Mensing <github@matmen.dev>
@matmen
Copy link
Member Author

matmen commented Jan 30, 2024

I think this should work:

image
image
image
image

@pedrolamas
Copy link
Member

I think this should work:

Sure, I personally can see it fine, though I am not sure that we can claim that it is "accessible" to every seeing user!

Also, a 16-bit screen or lower might be problematic... but granted, nowadays these are extremely rare! 😁

@matmen
Copy link
Member Author

matmen commented Jan 31, 2024

Yeah, that was my thought too, but I couldn't really figure out how to make it accessible and have it look decent. Even the current solution is kinda meh (especially on smaller screens), I think ideally we'd want a light or dark background color on the spool icon depending on the lightness of the filament color - or maybe even a multi-tone icon?

@fweber3
Copy link

fweber3 commented Jan 31, 2024

Yeah, that was my thought too, but I couldn't really figure out how to make it accessible and have it look decent. Even the current solution is kinda meh (especially on smaller screens), I think ideally we'd want a light or dark background color on the spool icon depending on the lightness of the filament color - or maybe even a multi-tone icon?

I'm not a big designer, but here's two triggers outside of your box:
How about using a contrasting color for accessibility BUT make it dashed/dotted (lines) or striped/polkadots (areas)? How about a strikethrough? ("big red cross", or something less in-your-face).

@pedrolamas
Copy link
Member

I am not sure what is the best course of action here in terms of layout (I too am not a designer), but I am happy to review this in terms of functionality and we can revisit this topic in a later change!

@pedrolamas
Copy link
Member

I admit I am troubled with the whole SET_GCODE_VARIABLE...

I honestly don't think we should be doing this from Fluidd side because if the user has a KlipperScreen or also uses Mainsail, it will not work until they too make the same changes...

In my view, this should either be done on Moonraker side, or somehow directly from Klipper side.

matmen and others added 2 commits January 31, 2024 20:26
Co-authored-by: Pedro Lamas <pedrolamas@gmail.com>
Signed-off-by: Mathis Mensing <github@matmen.dev>
@matmen
Copy link
Member Author

matmen commented Jan 31, 2024

Any particular reason for that macro.name.toUpperCase()?

That's just so the macro name is displayed in upper case in the modals, in theory we can do this with CSS (or a .toUpperCase() call on every reference) instead.
Either way should be fine I think, as currently only the "change spool" dropdown and spool selection modal consume the targetableMacros result. After all, Klipper reports the command names in upper case too, but gcode macro names are returned in lower case.

I admit I am troubled with the whole SET_GCODE_VARIABLE...

I honestly don't think we should be doing this from Fluidd side because if the user has a KlipperScreen or also uses Mainsail, it will not work until they too make the same changes...

In my view, this should either be done on Moonraker side, or somehow directly from Klipper side.

Well, having an API to set gcode macro variables directly would be optimal, but AFAIK there isn't one right now. I think the spool_id variable name should be fine across frontends, and if the functionality to set gcode macro variables via Moonraker gets added in the future this can still be refactored.
IMO it's the same for all the other gcode commands we send (SET_PIN, EXCLUDE_OBJECT, SET_VELOCITY_LIMIT, ...) - they all modify the printer's state. If there was an option to do it directly via an API call, that'd be preferable, but there isn't.

matmen and others added 2 commits February 2, 2024 18:49
Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>

# Conflicts:
#	src/components/widgets/spoolman/SpoolSelectionDialog.vue
@pedrolamas pedrolamas added this to the 1.28 milestone Feb 3, 2024
Copy link
Member

@pedrolamas pedrolamas left a comment

Choose a reason for hiding this comment

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

Not fully convinced with the usage of the variables to store state (as that will not be reflected in other frontends), but I think we can go with this and revisit later if it comes to a common solution!

@matmen matmen merged commit a7f7622 into fluidd-core:develop Feb 3, 2024
4 checks passed
@matmen matmen deleted the feat/spoolman/multi-tool branch February 3, 2024 20:11
@matmen matmen mentioned this pull request Apr 6, 2024
29 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FR - Enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Spoolman integration: multiple extruders/spools
3 participants