Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add multiline gcode configuration #56

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

CMR-DEV
Copy link
Contributor

@CMR-DEV CMR-DEV commented Jun 28, 2022

Allows #54 by changing the G-code input field to textarea in the settings template.

@LuckyX182
Copy link
Owner

I don't get how this should work - should the user put one gcode per line? Should the user put semicolons on each line? There's no indication to user that tells him how it works. Also I tested this on my test Raspberry and it did not seem to work.

@CMR-DEV
Copy link
Contributor Author

CMR-DEV commented Jul 9, 2022

I don't get how this should work - should the user put one gcode per line? Should the user put semicolons on each line? There's no indication to user that tells him how it works. Also I tested this on my test Raspberry and it did not seem to work.

Correct! One G-Code per line. Semicolons induce a comment. Sending multiline G-Code already seems possible by providing a string that is wrapped by \n line breaks to self._printer.commands. Your backend does not validate the user input of the G-Code field at all. So there is no barrier to injecting \n characters on that side. Only the current text-type settings input trims \n line breaks. Honestly I am unsure whether the behavior of self._printer.commands in terms of handling multiline strings is expected like that but at least it worked for me. Docs are quite imprecise about that. Alternatively one could split the G-Code user input by \n and pass each single line or convert it to a list. What G-Codes did you use for testing on your Pi? My attempts on an Ender 3 resulted as expected with

M117 Hello World
M300 S300 P1000

Both have been processed all fine. M117 is an LCD message and M300 is a beep for one second. See [here].(https://www.reprap.org/wiki/G-code) You may link this documentation if you are worried about the user's comprehension.

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