forked from MarlinFirmware/Marlin
-
Notifications
You must be signed in to change notification settings - Fork 1
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
Relax Parsing the Commandline #9
Closed
Closed
Conversation
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
20e29f3
to
5f41fa5
Compare
Add a new array ``` static char * command_queue_r[BUFSIZE]; ``` where we pass a the commandline to `process_next_command()` in. The commandline here does not contain the linenumber and the checksum anymore, so `process_next_command()` must not care about them. In `get_command()`: Only care about the checksumm when we have a linenumber. Otherwise we can't handle a '*' inside the command. Terminate the commandline with a '\0' at the '*' position. strtol() has a side effect. It can return the char* just behind the last used digit as the second parameter. Use this to set `command_queue_r[]` when reading the linenumber. Remove throwing the error for MSG_ERR_NO_LINENUMBER_WITH_CHECKSUM - just ignore it. Clean a little bug where the checksum was ignored behind a comment. In `code_has_value()`: Tolerate leading spaces. In `process_next_command()`: Use `command_queue_r[]`. Drop all that skipping of the linenumber. We did that in `get_command()`. Drop all that skipping the chars for the codenum to find the start of `current_command_args` - let strtol do the job. Replace `codenum = code_value_short();` with a direct call to strtol() to have access to the second parameter `code_is_good` now depends on `current_command_args - 1` that is now the last parsed digit, instead of the first. Temporary add some debug code. M113 parses all possible parameters and prints what was read. # Conflicts: # Marlin/Marlin_main.cpp
AnHardt
pushed a commit
that referenced
this pull request
Aug 25, 2019
# This is the 1st commit message: Add Support for ADIMLab Granty # The commit message #2 will be skipped: # Update Configuration.h # The commit message #3 will be skipped: # Add files via upload # # Add Support for ADIMLab Granty # The commit message #4 will be skipped: # Create Configuration.h # The commit message #5 will be skipped: # Delete Configuration.h # The commit message #6 will be skipped: # Create Test.h # The commit message #7 will be skipped: # Add files via upload # The commit message #8 will be skipped: # Delete Test.h # The commit message #9 will be skipped: # Delete Configuration.h # The commit message #10 will be skipped: # Delete Configuration_adv.h # The commit message #11 will be skipped: # Add files via upload # # Add ADIMLab Pins # The commit message #12 will be skipped: # Add files via upload # # Add Bootscreen # The commit message #13 will be skipped: # Update Configuration.h # # Add Bootscreen # The commit message #14 will be skipped: # Update pins.h # # Add ADIMLab Board # The commit message #15 will be skipped: # Update boards.h # # Add ADIMLab Granty # The commit message #16 will be skipped: # Update Makefile # # Add ADIMLab Granty # The commit message #17 will be skipped: # Update boards.h # The commit message #18 will be skipped: # Update Makefile
AnHardt
pushed a commit
that referenced
this pull request
Aug 25, 2019
* # This is a combination of 18 commits. # This is the 1st commit message: Add Support for ADIMLab Granty # The commit message #2 will be skipped: # Update Configuration.h # The commit message #3 will be skipped: # Add files via upload # # Add Support for ADIMLab Granty # The commit message #4 will be skipped: # Create Configuration.h # The commit message #5 will be skipped: # Delete Configuration.h # The commit message #6 will be skipped: # Create Test.h # The commit message #7 will be skipped: # Add files via upload # The commit message #8 will be skipped: # Delete Test.h # The commit message #9 will be skipped: # Delete Configuration.h # The commit message #10 will be skipped: # Delete Configuration_adv.h # The commit message #11 will be skipped: # Add files via upload # # Add ADIMLab Pins # The commit message #12 will be skipped: # Add files via upload # # Add Bootscreen # The commit message #13 will be skipped: # Update Configuration.h # # Add Bootscreen # The commit message #14 will be skipped: # Update pins.h # # Add ADIMLab Board # The commit message #15 will be skipped: # Update boards.h # # Add ADIMLab Granty # The commit message #16 will be skipped: # Update Makefile # # Add ADIMLab Granty # The commit message #17 will be skipped: # Update boards.h # The commit message #18 will be skipped: # Update Makefile * Add Support for ADIMLab Granty * Optimize bootscreen * Update Makefile Updated Description * Update boards.h Updated Description * Update pins_HJC2560C_REV2.h Updated Description * Update Configuration.h Added Author + Custom_Machine_Name * Create _Bootscreen.h Add Bootscreen * Add files via upload Add ADIMLab Granty v1 * Update boards.h Add ADIMLab Granty v1 * Update Makefile Add ADIMLab Granty v1 * Update pins_HJC2560C_REV2.h * Consolidate Granty configs * config updates
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add a new array
where we pass the commandline to
process_next_command()
in. The commandline here does not contain the linenumber and the checksum anymore, soprocess_next_command()
must not care about them.In
get_command()
:Only care about the checksumm when we have a linenumber. Otherwise we can't handle a '*' inside the command.
Terminate the commandline with a '\0' at the '*' position.
strtol() has a side effect. It can return the char* just behind the last used digit as the second parameter. Use this to set
command_queue_r[]
when reading the linenumber.Remove throwing the error for MSG_ERR_NO_LINENUMBER_WITH_CHECKSUM - just ignore it.
Clean a little bug where the checksum was ignored behind a comment.
In
code_has_value()
:Tolerate leading spaces.
In
process_next_command()
:Use
command_queue_r[]
.Drop all that skipping of the linenumber. We did that in
get_command()
.Drop all that skipping the chars for the codenum to find the start of
current_command_args
- let strtol do the job.Replace
codenum = code_value_short();
with a direct call to strtol() to have access to the second parametercode_is_good
now depends oncurrent_command_args - 1
that is now the last parsed digit, instead of the first.Temporary add some debug code.
M113 parses all possible parameters and prints what was read.
We now hopefully tolerate:
any amount of spaces everywhere, including 0.
'N' as a parameter and in M117 and in pathmames
'*' in the commandline - for M117
checksumms behind a comment - no errors for missing checksumm anymore.
Happy testing.
Repetier:
Tries to parse some g-codes, adds linenumbes and checksumms, tries to sanitize the commandline.
Marlin should now understand everything RepetierHost sends - but not all we can send to Marlin is understood by RepetierHost.
Pronterface:
Does not add linenumbers and checksums, tries to parse some g-codes but does not sanitize them, can be confused by codes Marlin does understand.
Octoprint:
Just sends what you write to the send-box, adds linenumbers and checksumms when printing, seems to be very robust about what you can send.
Example debug output: