Skip to content

Add multiline gcode configuration#56

Open
Raschmaschine wants to merge 2 commits intoLuckyX182:masterfrom
Raschmaschine:feature/multiple-gcode-lines
Open

Add multiline gcode configuration#56
Raschmaschine wants to merge 2 commits intoLuckyX182:masterfrom
Raschmaschine:feature/multiple-gcode-lines

Conversation

@Raschmaschine
Copy link
Contributor

@Raschmaschine Raschmaschine 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.

@Raschmaschine
Copy link
Contributor Author

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