Skip to content

Conversation

@meteyou
Copy link
Member

@meteyou meteyou commented Feb 3, 2025

Description

This PR adds input fields to macro pompts.

Related Tickets & Documents

none

Mobile & Desktop Screenshots/Recordings

none

[optional] Are there any post-deployment tasks we need to perform?

none

@NeighNeighNeigh
Copy link

Any movement with this one? I'd love to be able to hook this up with Eric Zimmerman's autocommit.sh GitHub tool, so I can add commit messages when invoking a commit from the macro panel

@meteyou
Copy link
Member Author

meteyou commented May 27, 2025

@NeighNeighNeigh This PR was initially just a test for a small user group. As I haven't received any feedback since its creation, it's currently stalled. If I update this PR, would you be able to test a build to see if it could work with the input field in the macro prompt?

@NeighNeighNeigh
Copy link

NeighNeighNeigh commented May 27, 2025 via email

@meteyou
Copy link
Member Author

meteyou commented May 27, 2025

@NeighNeighNeigh This branch should be up-to-date now. On this side, you can download a new test build: https://github.com/mainsail-crew/mainsail/actions/runs/15266392902?pr=2136

@NeighNeighNeigh
Copy link

Apologies for being novice, but can I test this by simply replacing the contents of /mainsail on my pi with the contents of the archive? (my pi is running mainsail os)

@meteyou
Copy link
Member Author

meteyou commented May 27, 2025

Yep! Just download this zip, unzip it (pay attention, the GitHub workflow zip a zip, so you have to unzip it twice) and then upload it with FileZilla or other sftp program to your pi in /home//mainsail. Just delete all files in this directory, bevor you upload the new files.

@NeighNeighNeigh
Copy link

Okay, I can confirm it appears to be working. The release installed easily following your instruction, and (via fumbling around) was able to actually show an input prompt via this test macro

[gcode_macro SHOW_INPUT_PROMPT]
gcode:
    RESPOND TYPE=command MSG="action:prompt_begin input a sting"
    RESPOND TYPE=command MSG="action:prompt_input"
    RESPOND TYPE=command MSG="action:prompt_show"

As soon as I type anything into the field I get the following warning in klippers console The value 'null' is not valid for MACRO but I assume this is the expected result, because I need to actually develop the macro.

So things look promising!

At this point, I need to work out how to implement this into my auto commit macro, and pass the entered string into the command (see input_result below). Any pointers here would be super welcome.

 [gcode_shell_command backup_cfg]
 command: ~/printer_data/config/autocommit.sh input_result
 timeout: 30
 verbose: True

 [gcode_macro BACKUP_CFG]
 description: Backs up config directory GitHub
 gcode:
     RUN_SHELL_COMMAND CMD=backup_cfg

More broadly, I feel like being able to set up macros to issue terminal commands with user input like this could be super useful beyond this auto backup macro!! So this is, imo, a great feature for mainsail!

@meteyou
Copy link
Member Author

meteyou commented May 31, 2025

sry for the delay. the input field will write the input value in a macro variable so you should use this syntax to define it:

action:prompt_input|<label>|<macro name>|<variable name>|<default value>|<input placeholder>

default value and placeholder are optional.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants