From fe9b61a61fa6fb03adbbdb7729fe2d43c7821d55 Mon Sep 17 00:00:00 2001 From: skasti Date: Thu, 26 Sep 2024 07:14:24 +0200 Subject: [PATCH 1/3] use read_real_value for return statements, so that the returned value does not need to be in [] --- ngc_flowctrl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ngc_flowctrl.c b/ngc_flowctrl.c index eba578c..1988638 100644 --- a/ngc_flowctrl.c +++ b/ngc_flowctrl.c @@ -689,7 +689,7 @@ 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(read_real_value(line, pos, &value) == Status_OK) { ngc_named_param_set("_value", value); ngc_named_param_set("_value_returned", 1.0f); } else From 4836af90fe58d5d62265bfa8b2f74ad24b2718c0 Mon Sep 17 00:00:00 2001 From: skasti Date: Thu, 26 Sep 2024 07:20:39 +0200 Subject: [PATCH 2/3] if no return-value is read, set _value to 0.0f so that we don't carry previous returns --- ngc_flowctrl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ngc_flowctrl.c b/ngc_flowctrl.c index 1988638..5ba30ee 100644 --- a/ngc_flowctrl.c +++ b/ngc_flowctrl.c @@ -692,8 +692,10 @@ status_code_t ngc_flowctrl (uint32_t o_label, char *line, uint_fast8_t *pos, boo if(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); ngc_named_param_set("_value_returned", 0.0f); + } if(g65_return) grbl.on_macro_return(); From be6d2501f927e1d067c0fa51ecfb5cca12535d2c Mon Sep 17 00:00:00 2001 From: skasti Date: Wed, 23 Oct 2024 20:03:45 +0200 Subject: [PATCH 3/3] repair after rebase --- ngc_flowctrl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ngc_flowctrl.c b/ngc_flowctrl.c index 5ba30ee..7af70eb 100644 --- a/ngc_flowctrl.c +++ b/ngc_flowctrl.c @@ -689,7 +689,7 @@ 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(read_real_value(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 {