-
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
Allow return without expression #602
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -689,11 +689,13 @@ status_code_t ngc_flowctrl (uint32_t o_label, char *line, uint_fast8_t *pos, boo | |
else if((g65_return = !!grbl.on_macro_return)) | ||
ngc_flowctrl_unwind_stack(stack[stack_idx].file); | ||
|
||
if(ngc_eval_expression(line, pos, &value) == Status_OK) { | ||
if(ngc_read_real_value(line, pos, &value) == Status_OK) { | ||
ngc_named_param_set("_value", value); | ||
ngc_named_param_set("_value_returned", 1.0f); | ||
} else | ||
} else { | ||
ngc_named_param_set("_value", 0.0f); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The reason for setting If this is also how it works in other gcode dialects, and it is done on purpose as a feature, I will agree that setting it to zero is a breaking change, and I will remove it 😅 |
||
ngc_named_param_set("_value_returned", 0.0f); | ||
} | ||
|
||
if(g65_return) | ||
grbl.on_macro_return(); | ||
|
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.
ngc_read_real_value will call ngc_eval_expression if the first character encountered is [, so this should not break compatibility with current usage. It only adds some flexibility 😅