Added config to enable NGC parameter reporting, default on.

This commit is contained in:
Terje Io
2024-04-27 23:33:33 +02:00
parent 3a7a65ea7c
commit c6aeef14cf
8 changed files with 56 additions and 6 deletions
+20 -4
View File
@@ -1,5 +1,23 @@
## grblHAL changelog
<a name="20240427"/>Build 20240427
Core:
* Added config to enable NGC parameter reporting, default on.
Drivers:
* STM32F1xx: disabled NGC parameter reporting in order free up some flash space \(for 128K variants\).
Plugins:
* SD card (file system macros): added inbuilt `G65P2Q<tool>R<axis>` macro for reading tool offset from tool table. `<tool>` is tool number, `<axis>` is axis number: 0 = X, 1 = Y, ...
* Keypad: allow MPG to take control when estop state is active.
---
<a name="20240425"/>Build 20240425
Core:
@@ -8,13 +26,11 @@ Core:
Drivers:
STM32F1xx:
* Fix for broken handling of control signals for RC variant processors. Ref. issue [#51](https://github.com/grblHAL/STM32F1xx/issues/51) and discussion [#499](https://github.com/grblHAL/core/discussions/499).
* STM32F1xx: fix for broken handling of control signals for RC variant processors. Ref. issue [#51](https://github.com/grblHAL/STM32F1xx/issues/51) and discussion [#499](https://github.com/grblHAL/core/discussions/499).
Plugins:
* File system macros: added inbuilt `G65P1Q<n>` macro for reading numeric setting value. `<n>` is setting number. Ref. issue [#493](https://github.com/grblHAL/core/issues/493).
* SD card (file system macros): added inbuilt `G65P1Q<n>` macro for reading numeric setting value. `<n>` is setting number. Ref. issue [#493](https://github.com/grblHAL/core/issues/493).
---
+14 -1
View File
@@ -513,7 +513,7 @@ Number of tools in tool table, edit to enable (max. 32 allowed)
/*! \def NGC_EXPRESSIONS_ENABLE
\brief
Set to \ref On or 1 to enable experimental support for parameters and expressions.
Set to \ref On or 1 to enable experimental support for expressions.
Some LinuxCNC extensions are supported, conditionals and subroutines are not.
*/
@@ -521,6 +521,14 @@ Some LinuxCNC extensions are supported, conditionals and subroutines are not.
#define NGC_EXPRESSIONS_ENABLE Off
#endif
/*! \def NGC_PARAMETERS_ENABLE
\brief
Set to \ref On or 1 to enable experimental support for parameters.
*/
#if !defined NGC_PARAMETERS_ENABLE || defined __DOXYGEN__
#define NGC_PARAMETERS_ENABLE On
#endif
/*! \def NGC_N_ASSIGN_PARAMETERS_PER_BLOCK
\brief
Maximum number of parameters allowed in a block.
@@ -1953,6 +1961,11 @@ __NOTE:__ Must be a positive values.
#define N_SYS_SPINDLE 8
#endif
#if NGC_EXPRESSIONS_ENABLE && !NGC_PARAMETERS_ENABLE
#undef NGC_PARAMETERS_ENABLE
#define NGC_PARAMETERS_ENABLE On
#endif
#if (REPORT_WCO_REFRESH_BUSY_COUNT < REPORT_WCO_REFRESH_IDLE_COUNT)
#error "WCO busy refresh is less than idle refresh."
#endif
+2
View File
@@ -3355,8 +3355,10 @@ status_code_t gc_execute_block (char *block)
case NonModal_MacroCall:
{
#if NGC_PARAMETERS_ENABLE
ngc_named_param_set("_value", 0.0f);
ngc_named_param_set("_value_returned", 0.0f);
#endif
status_code_t status = grbl.on_macro_execute((macro_id_t)gc_block.values.p);
return status == Status_Unhandled ? Status_GcodeValueOutOfRange : status;
+1 -1
View File
@@ -42,7 +42,7 @@
#else
#define GRBL_VERSION "1.1f"
#endif
#define GRBL_BUILD 20240425
#define GRBL_BUILD 20240427
#define GRBL_URL "https://github.com/grblHAL"
+6
View File
@@ -24,6 +24,10 @@
Most additional predefined parameters defined by LinuxCNC (ref section 5.2.3.1) are implemented.
*/
#include "hal.h"
#if NGC_PARAMETERS_ENABLE
#include <stdint.h>
#include <stdbool.h>
#include <stdlib.h>
@@ -655,3 +659,5 @@ bool ngc_named_param_set (char *name, float value)
return ok;
}
#endif // NGC_PARAMETERS_ENABLE
+3
View File
@@ -542,6 +542,8 @@ void report_tool_offsets (void)
hal.stream.write("]" ASCII_EOL);
}
#if NGC_PARAMETERS_ENABLE
// Prints NIST/LinuxCNC NGC parameter value
status_code_t report_ngc_parameter (ngc_param_id_t id)
{
@@ -576,6 +578,7 @@ status_code_t report_named_ngc_parameter (char *arg)
return Status_OK;
}
#endif
// Prints Grbl NGC parameters (coordinate offsets, probing, tool table)
void report_ngc_parameters (void)
+4
View File
@@ -70,12 +70,16 @@ void report_probe_parameters (void);
// Prints current tool offsets.
void report_tool_offsets (void);
#if NGC_PARAMETERS_ENABLE
// Prints NIST/LinuxCNC NGC parameter value
status_code_t report_ngc_parameter (ngc_param_id_t id);
// Prints named LinuxCNC NGC parameter value
status_code_t report_named_ngc_parameter (char *arg);
#endif
// Prints Grbl NGC parameters (coordinate offsets, probe).
void report_ngc_parameters (void);
+6
View File
@@ -558,12 +558,16 @@ static status_code_t output_ngc_parameters (sys_state_t state, char *args)
status_code_t retval = Status_OK;
if(args) {
#if NGC_PARAMETERS_ENABLE
int32_t id;
retval = read_int(args, &id);
if(retval == Status_OK && id >= 0)
retval = report_ngc_parameter((ngc_param_id_t)id);
else
retval = report_named_ngc_parameter(args);
#else
retval = Status_InvalidStatement;
#endif
} else
report_ngc_parameters();
@@ -831,7 +835,9 @@ PROGMEM static const sys_command_t sys_commands[] = {
{ "J", jog, {}, { .str = "$J=<gcode> - jog machine" } },
{ "#", output_ngc_parameters, { .allow_blocking = On }, {
.str = "output offsets, tool table, probing and home position"
#if NGC_PARAMETERS_ENABLE
ASCII_EOL "$#=<n> - output value for parameter <n>"
#endif
} },
{ "$", output_settings, { .allow_blocking = On }, {
.str = "$<n> - output setting <n> value"