FluidNC Macros

Could somebody explain how to code and configure macros using the WebUI please? I am trying to create a macro to probe using the code Doug Joseph uses in his video. His script looks like this:

G21 (MSG G21: Metric mode)
G90 (MSG G90: Switching to absolute positioning)
G94 (MSG G94: Feed = per minute)
G92 X0 Y0 (MSG G92: Setting current XY position as workspace origin 0,0)
M0 (MSG Attach probe)
G38.2 G91 Z-124.9 F400 (MSG G38.2: Fast probing to material)
G1 Z5 F400 (MSG G1 move Z up by 5mm, speed 400)
G38.2 G91 Z-6 F100 P0.34 (MSG G38.2: Slow probing to material. Plate thickness: 0.34)
G90 (MSG G90: Switching to absolute positioning)
G1 Z30 F900 (MSG G1: go to Z30, speed 900)
M0 (MSG Remove probe)
M62 P1 (If used start spindle pin27)

The FluidNC wiki for macros says to add &(ampersand) between multiple commands. So I assigned this to a new macro: G21&G90&G94&G92 X0 Y0&M0&G38.2 G91 Z-124.9 F400&G1 Z5 F400&G38.2 G91 Z-6 F100 P0.34&G90 (MSG G90: Switching to absolute positioning)&G1 Z30 F900 (MSG G1: go to Z30, speed 900)&M0 (MSG Remove probe).
This seems to crash the system.

What is the difference between macro’s in config.yaml, in Settings FluidNC features and in Settings ESP3D Interface? Which one should I use?

I am not sure how to do the Macro’s. Haven’t had a need to do one. But if you follow what Ryan has in the Milling Basics page and put the start, tool change and end gocde in Estlcam, then there is no need for a probing macro at all. One less thing to have to remember to do before you start a job.

3 Likes

I agree that putting it right in the gcode is more convenient.

If you want to try out macros, are you using WebUI v2 or v3? Macros are different depending on version.

1 Like

V3.
I am actually just setting up my new LR4. Carrying out Z levelling using multiple probes, the adjusting the pull-off of one of the Z motors depending on the average of several probes across the extents of the X travel would be easier using Dougs macro. The built in probing function resets the Z axis to zero when it probes. So trying to get the actual position is more difficult. I also wish to probe quick, pull off and then probe slow.
My previous LR3 had a SKR Pro controller and was easy to set up macros

It’s too bad my Z leveling macro isn’t quitw ready for primetime. It does all that automatically including averaging multiple probes, and calculating and setting the pulloff values.

I’m not at home to fully answer but I’d just create a regular gcode file and put it on the SD. You can then just have the macro run the gcode file or just run the gcode file like anything else.

$SD/Run=myfile.gcode

2 Likes

Thanks Jason. I’ll do that. It’ll sort me out for now, but I’d still like to understand macros.
Your probing function will be good. Can’t wait

I use the macros on the Settings → ESP3D Interface tab. These get stored in the preferences.json file on Flash.

This is pretty good documentation on the Macros feature.
https://esp3d.io/ESP3D-WebUI/Version_3.X/documentation/macros/

I’ll add a few notes:

  • For your case, you would likely choose the Type of “SD Card” and then specify the Action as the filename.
  • If it was only a single gcode command or a small number, you would use the “GCODE command” type. Note that multiple commands here are separated by a semi-colon.
  • You don’t need to specify a keyboard shortcut.
  • The note about the macro name being hidden in mobile view is true for the default theme, but not if you are using one of my themes. I prefer to have the name always displayed.

The ones in config.yaml are the same as the ones in Settings → FluidNC Features (Config section). If you modify one of those, you would need to click the Save button at the bottom of the page and then use the Save macro in the Macro section on the Dashboard. This is the same process as if you were modifying your pulloff values. The first Save updates the currently running settings, and then the Save macro actually updates the config.yaml file with those settings.

I’m not using these but if you have questions, I could probably answer them.

These macros are documented here:
http://wiki.fluidnc.com/en/config/macros

You can also write advanced macros using the “GCode Parameters and Expressions” functionality. This is what the Z leveling macro I’m working on is using.
http://wiki.fluidnc.com/en/features/gcode_parameters_expressions

Great support Jason.
Thanks

1 Like