Are macros to be placed only at the end of the config file under the Macros heading, and does it matter what order they are placed in there?
It doesn't matter where the macros are in any of the config files. Mine are organized the way they are, only for the sake of keeping them organized.
I could put the LED macros in the Fans file, and the levelling/homing macros in the LED file, and it would still work fine. The order is also irrelevant. A lot of guys just have all of the macros in the printer.cfg file, but I opted to create a separate .cfg file for each "type" of macro. Ie, a separate file for LEDs, Fans, printer.cfg (steppers), and a "macros" file, for the customized gantry levelling ( customized by adding w LED status color command), my custom version of the g28 homing ( also customized to add LED homing colors) etc.
Can the macro for the QGL be before the LED macro, or should it be after?
They can be anywhere you want and in any order.
Klipper reads from the printer.cfg file first. If it sees "include mainsail.cfg", then it also treats "mainsail.cfg" as if it is part of "printer cfg". My "printer.cfg" file contains "include mainsail.cfg, include macros cfg, include fans.cfg, include LEDs.cfg", so as far as Klipper is concerned, those are all the same file.
If you look at my "macros.cfg" file, youll notice that I have some macros that mimick some stock klipper routines. Like G28 with a rename "g2828". All this macro does is add some led effects to the stock homing command. I did similar to the levelling command and a few others.
You can kinda trace the LED macros by starting in the macros.cfg file. My quad gantry leveling macro includes the command "led_leveling". Scroll down the the bottom of the file and you'll see a "led_leveling" macro, which contains some LED commands. Those commands reference some individual LED effects, which are defined in the LEDs.cfg file.
Just this morning I added a M600 macro with some LED color changes, to allow klipper to pause/park/resume the print when it encounters PrusaSlicers color change (m600) g-code. Unlike Marlin, Klipper doesn't recognize m600 without the macro.
Those are the general questions I have. I think your LED macros have a macro associated with the probe command, but my probe command is different than yours.
On page 25 of this thread, you posted a link to TeamFDM regarding the LED macros. I started reading that tonight but got distracted by a squirrel or two. I need to hit the hay because tomorrow will be a long day at work.
Yes. I added a "quad gantry level" rename macro. When klipper encounters the gantry level command, it runs my macro instead of its own gantry level routine.
My gantry level macro just gives an LED command first, then runs the default klipper command. I recently added a nozzle brush macro and m600 color change macro the same way.
Basically, I have it all set up so there's a different color/fancy light show effect for each function.
For example, when I start a print, while the nozzle and bed are heating I get red/violet pulsing colors on the logo and enclosure lights. Then when it starts homing the enclosure lights repeatedly chase towards the toolhead, like a comet.
Then when it starts printing, the enclosure lights turn white and the toolhead logo light turn green.
I have something similar set up for pretty much every function the printer does.
For any of my LED macros to work though, you'll need the LED effects plugin from GitHub.