I couldn't use the custom macros that i created with gcode_shell command in a gcode file #447

Closed
opened 2024-03-06 12:53:56 +01:00 by Dalinaffeti · 1 comment
Dalinaffeti commented 2024-03-06 12:53:56 +01:00 (Migrated from github.com)

So i made a custom macro called SET_POWER, which sets the power for the laser. This macro calls a python script with the given parameter(POWER) for example POWER=75%. I manged to do all of that. Now what is missing me is to use it. I tought this will be called like this inside a gcode file: SET_POWER POWER=75.0. But i got nothing

Describe the solution you'd like

I want to konw how to use custom gcode macros that i created with gcode_shell_command

Describe alternatives you've considered

No response

Additional information

No response

### Is your feature request related to a problem? Please describe So i made a custom macro called SET_POWER, which sets the power for the laser. This macro calls a python script with the given parameter(POWER) for example POWER=75%. I manged to do all of that. Now what is missing me is to use it. I tought this will be called like this inside a gcode file: SET_POWER POWER=75.0. But i got nothing ### Describe the solution you'd like I want to konw how to use custom gcode macros that i created with gcode_shell_command ### Describe alternatives you've considered _No response_ ### Additional information _No response_
Dalinaffeti commented 2024-03-06 12:55:10 +01:00 (Migrated from github.com)

code for it:
[gcode_shell_command set_power]
command: sh /home/pi/printer_data/config/set_power.sh

[gcode_macro SET_POWER]
gcode:
{% set power = params.POWER %}
{ action_respond_info("%s" % (power)) }
RUN_SHELL_COMMAND CMD=set_power PARAMS={power}

code for it: [gcode_shell_command set_power] command: sh /home/pi/printer_data/config/set_power.sh [gcode_macro SET_POWER] gcode: {% set power = params.POWER %} { action_respond_info("%s" % (power)) } RUN_SHELL_COMMAND CMD=set_power PARAMS={power}
Sign in to join this conversation.