-
-
Notifications
You must be signed in to change notification settings - Fork 519
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gcode_shell_command: make
RUN_SHELL_COMMAND
accept optional parameters
Thanks @lixxbox for that code
- Loading branch information
Showing
1 changed file
with
3 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f231fa9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the proper format for passing multiple parameters, for example:
{temp}
{speed}
{flow}
f231fa9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am also interested in the correct syntax for this.
f231fa9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand it's an old commit, but I couldn't seem to find any reference or example on how to pass multiple parameters to a command. So I tested it myself and found a solution. Leaving it here just in case anyone else wants the same and runs into this:
PARAM="{argN1} {argN2} {argN}" if using klippper variables. In my case it was something like: RUN_SHELL_COMMAND cmd=graph_raw_values PARAMS="-a {accel} -c {cruiseratio} -x {axis}" for a custom script I was using. Cheers
f231fa9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, I am developing a kiosk interface and I developed a macro command in Mainsail. This command allows the WiFi configuration of the Raspberry Pi. I am using the shell-command plugin here. I managed to pass the SSID information to the command, but. I cannot pass the password information, which is the 2nd params. Does anyone have an idea?
My Macro Command:
[gcode_macro WIFI]
gcode:
{% set ssid = params.SSID %}
{% set password = params.Password %}
RUN_SHELL_COMMAND CMD=wifi_connection PARAMS={ssid}{password}
My .sh File:
nmcli device wifi list
SSID="$1"
PASSWORD="$2"
sudo nmcli device wifi connect "$SSID" password "$PASSWORD"
f231fa9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, so I checked the macro i was using and I have this:
[gcode_shell_command graph_raw_values]
command: bash /home/pi/process-last-accel-raw-values.sh
timeout: 60.
verbose: True
as the shell commands that calls the script. I assume you already defined that gcode_shell_command macro as 'wifi_connection'? If so, the only thing that seems to be missing are the double quotes in the PARAMS= section. Try PARAMS="{ssid} {password}". Add blank space between {ssid} and {password} as I see your script is parsing it as two arguments.
Haven't really played with this in a while, so I'm not exactly sure it will work, but hope it helps. Cheers