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

Helper macro to mitigate "noise" from restoring state after UI move #38

Open
pedrolamas opened this issue Oct 21, 2024 · 0 comments
Open

Comments

@pedrolamas
Copy link
Contributor

This is a follow up on the work here mainsail-crew/mainsail#1988 and more of a starting point for a discussion - not actually an issue!

I've now implemented that change on the latest release of Fluidd, and it works fine, but does cause a lot of "noise" on the command line which I find distracting!

image

I've quickly discussed this with @meteyou and we believe that we could create a special macro and release it as part of Mainsail and Fluidd configs to mitigate this!

The point here would be that the frontend will check if said macro exists, and if so, will call it and pass whatever parameters we need to do the same as shown on the screenshot above; if the macro is not find, then we fallback to the current commands shown.

I've quickly written an example of what I am proposing:

[gcode_macro LINEAR_MOVE]
gcode:
  {% set x_move = "X" ~ params.X if params.X is defined
             else "" %}
  {% set y_move = "Y" ~ params.Y if params.Y is defined
             else "" %}
  {% set z_move = "Z" ~ params.Z if params.Z is defined
             else "" %}
  {% set e_move = "E" ~ params.E if params.E is defined
             else "" %}
  {% set rate = "F" ~ params.F if params.F is defined
           else "" %}
  {% set ABSOLUTE = params.ABSOLUTE | default(0) | int != 0 %}
  SAVE_GCODE_STATE NAME=_ui_movement
  G9{ 0 if ABSOLUTE else 1 }
  M8{ 2 if ABSOLUTE else 3 }
  G1 { x_move } { y_move } { z_move } { e_move } { rate }
  RESTORE_GCODE_STATE NAME=_ui_movement

Frontend would then check for LINEAR_MOVE macro, and if it does exist, use it for toolhead movement or extrusion/retraction.

Some examples:

  • LINEAR_MOVE X=10 F=200
  • LINEAR_MOVE X=125 Y=125 F=200 ABSOLUTE=1
  • LINEAR_MOVE E=10 F=200

A saner alternative the above would be to have 2 separate macros, one for toolhead movement and another for extrusion/retraction, which might indeed make more sense in the grand scheme of things!

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

No branches or pull requests

1 participant