-
Notifications
You must be signed in to change notification settings - Fork 88
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 experimental support for string registers #603
Open
skasti
wants to merge
34
commits into
grblHAL:master
Choose a base branch
from
skasti:string-registers
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
fe9b61a
use read_real_value for return statements, so that the returned value…
skasti 4836af9
if no return-value is read, set _value to 0.0f so that we don't carry…
skasti b148a09
Initial attempt at adding string registers backend-functionality
skasti 33bfb1a
fix warnings from build
skasti 9b2d7b6
rename from ngc_string_registers to string_registers,
skasti 3b05088
remove debug-messages
skasti 58b66f4
Allow setting string-registers using expression
skasti 6b3f6dd
allow exressions
skasti efe1a6b
combine ifs
skasti d4951ff
Do not allow setting string registers to values longer than 40 charac…
skasti 3782260
Substitute characters before creating a string register. This allows …
skasti be6d916
use ampersand as the special character
skasti 9c95b8f
Update copyright header of string_registers.c
skasti 78d8458
cleaning up some leftovers from params, and renaming to MAX_SR_LENGTH
skasti e6979fb
some code style changes
skasti 59952af
Ensure string registers are not enabled by default, since this is exp…
skasti dea24e3
reverting stuf from other branch
skasti 012950c
Use realloc to allocate new memory.
skasti 4102648
Set max-length to 256
skasti 072fdb3
Shift neopixel bit pattern
dresco f830979
Changed _vminor named parameter to contain build date in YYMMDD forma…
terjeio 2c88911
Added init call for new ESP-AT plugin.
terjeio fe23364
Removed deprecated stream flags, added stream event for line state (R…
terjeio e769418
Updated changelog
terjeio a29ae43
Move substitution to a grbl core handler. Move setting of string regi…
skasti c4febb7
Merge branch 'master' into string-registers
skasti ba86b00
move init to the end, so the substitution function is declared first
skasti cd187dc
Use different function names in the files. use correct parameter type
skasti ba912fa
convert back to other return values
skasti 8ca467b
Base string_register_id_t on ngc_param_id_t, so that they stay in sync
skasti d3e8b1d
simplify logic for handling setting string-registers, since it now re…
skasti b2786db
remove newline before {
skasti 5e58e02
linting document for more consistent code style
skasti 8beb863
linting header-file for consistent code-style
skasti File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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
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
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
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
Oops, something went wrong.
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.
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.
@terjeio Should handling of
(DEBUG,
and(PRINT,
be moved tongc_flowctrl
'sonGcodeComment
? 🤔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.
No. Since substitution is done in ngc_expr.c it belongs there, and also because the
grbl.on_gcode_comment()
event is not able to return a string (and should not be changed to accomodate that).Your
grbl.on_string_substitution()
event could be set up at startup to point to a new function in ngc_expr.c, making it overridable. And then your string register handling could (or rather should?) be moved to a plugin, in this repo?grbl.on_string_substitution
has to be changed to a more descriptive name if doing so...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.
Aha, maybe I should make a separate PR with just the string substitution-stuff, and move string registers to a plugin-repo? 🤔
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.
The previous comment was somehow posted before I finished, trying again:
I'll update the core, you add a plugin for string registers and string substitution that includes string registers. This since I'll make comment handling completely overridable even for (MSG, ...), in gcode.c:
grbl.on_process_gcode_comment
will be defaulted to handle (PRINT, ..) and (DEBUG, ...) when expressions is enabled.You can choose to do string replacements only and use the default handler for numeric ones, or replace the handler completely. Note that the
grbl.on_process_gcode_comment
signature does not allow for a status code return - this is deliberate since message comments should never fail with an error.You may choose where to publish a string register plugin, you can add it to your own repo or make a PR for the misc plugins repo. The Web Builder can build with repos located outside grblHAL, but local builds cannot without manually adding your code to the source tree - at least not without adding it as a submodule which I am reluctant to do.
FYI I have already added string parameter support to ngc_param.c (not yet comitted) in order to handle named o calls, you may build string registers on top of this or add your version to your plugin. It is different from your string register code in that it does not return status codes and it will remove a string parameter on failure to allocate for it. Also, it will not reallocate on changes if the new length is less than the previous, this as an attempt to reduce heap fragmentation.