jschuh / klipper-macros

A collection of useful macros for the Klipper 3D printer firmware
GNU General Public License v3.0
928 stars 168 forks source link

[BUG] Existing command 'M106' not found in gcode_macro rename #66

Closed mintjberry closed 1 year ago

mintjberry commented 1 year ago

Hello,

I'm getting this error after installing klipper-macros "Existing command 'M106' not found in gcode_macro rename" It is related to moonraker somehow, as it shows in the logs:

"2023-04-12 14:09:39,515 [app.py:log_request()] - 201 POST /server/files/upload (10.1.1.2) [_TRUSTEDUSER] 32.37ms 2023-04-12 14:09:54,553 [app.py:log_request()] - 201 POST /server/files/upload (10.1.1.2) [_TRUSTEDUSER] 38.62ms 2023-04-12 14:10:08,592 [app.py:log_request()] - 201 POST /server/files/upload (10.1.1.2) [_TRUSTEDUSER] 42.31ms 2023-04-12 14:10:41,689 [app.py:log_request()] - 201 POST /server/files/upload (10.1.1.2) [_TRUSTEDUSER] 32.33ms 2023-04-12 14:10:42,751 [klippy_connection.py:_on_connection_closed()] - Klippy Connection Removed 2023-04-12 14:10:44,016 [klippy_connection.py:_do_connect()] - Klippy Connection Established 2023-04-12 14:10:48,924 [klippy_connection.py:_request_initial_subscriptions()] - Webhooks Subscribed 2023-04-12 14:10:48,928 [klippy_connection.py:_request_initial_subscriptions()] - GCode Output Subscribed 2023-04-12 14:10:48,934 [klippy_connection.py:_check_ready()] - Existing command 'M106' not found in gcode_macro rename Once the underlying issue is corrected, use the "RESTART" command to reload the config and restart the host software. Printer is halted"

I've created a 'klipper-macros.cfg' file in the same directory as my config files and pasted the code in. As soon as I comment out the code to include the klipper-macros.cfg file, klipper runs fine without error.

Any help would be appreciated.

mintjberry commented 1 year ago

In addition to this, two other people have the same issue, as confirmed in the comments of this YouTube video, which details installing klipper-macros: https://www.youtube.com/watch?v=rbiBIV1gY0A

mintjberry commented 1 year ago

Figured it out - for some reason not having a fan in my printer.cfg causes this error. This is the code I added (for the BTT SKR 3):

[fan] pin: PB7

jschuh commented 1 year ago

Ah, modules in extras aren't loaded until the parser hits an appropriately named config section, so the M106 command isn't registered unless the config includes a fan section.

I'll probably just add a comment to the readme noting that a fan is required (similar to the extruder and bed heater). I could move fans.cfg into optional, but I'd rather not deal with the hassle of detection wrappers.