Skip to content

Commit 71dc5ac

Browse files
committed
Changed safety door/parking handling to be compliant with legacy Grbl.
Added $384 setting for controlling G92 offset persistence. Improved $help command output and handling. Moved the optional tool table in non-volatile storage. Added gcode parameter support and optional expression support.
1 parent 11640ad commit 71dc5ac

30 files changed

+2480
-410
lines changed

CMakeLists.txt

+3
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ target_sources(grbl INTERFACE
2323
${CMAKE_CURRENT_LIST_DIR}/tool_change.c
2424
${CMAKE_CURRENT_LIST_DIR}/alarms.c
2525
${CMAKE_CURRENT_LIST_DIR}/errors.c
26+
${CMAKE_CURRENT_LIST_DIR}/ngc_params.c
27+
${CMAKE_CURRENT_LIST_DIR}/ngc_expr.c
28+
${CMAKE_CURRENT_LIST_DIR}/regex.c
2629
)
2730

2831
target_include_directories(grbl INTERFACE ${CMAKE_CURRENT_LIST_DIR})

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ It has been written to complement grblHAL and has features such as proper keyboa
1111

1212
---
1313

14-
Latest build date is 20210907, see the [changelog](changelog.md) for details.
14+
Latest build date is 20210928, see the [changelog](changelog.md) for details.
1515
__NOTE:__ Drivers built with more than three axes configured \(`N_AXIS` > `3`\) will force a settings reset when upgraded. Backup and restore of settings is recommended for these.
1616

1717
---
@@ -68,7 +68,7 @@ List of Supported G-Codes:
6868
- Coolant Control: M7, M8, M9
6969
- Spindle Control: M3, M4, M5
7070
- Tool Change: M6* (Two modes possible: manual** - supports jogging, ATC), M61
71-
- Switches: M49, M50, M51, M53
71+
- Switches: M48, M49, M50, M51, M53
7272
- Output control***: M62, M63, M64, M65, M66, M67, M68
7373
- Valid Non-Command Words: A*, B*, C*, F, H*, I, J, K, L, N, P, Q*, R, S, T, X, Y, Z
7474
@@ -80,4 +80,4 @@ List of Supported G-Codes:
8080
Some [plugins](https://github.com/grblHAL/plugins) implements additional M-codes.
8181

8282
---
83-
2021-09-08
83+
2021-09-28

changelog.md

+21
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,26 @@
11
## grblHAL changelog
22

3+
Build 20210928:
4+
5+
Core:
6+
* Changed safety door/parking handling to be compliant with legacy Grbl - now a cycle start command has to be issued to resume after the door is closed.
7+
* Added `$384` setting for controlling G92 offset persistence, set to `1` to disable persistence across a reboot, `0` to enable. Only available if [compatibility level](https://github.com/grblHAL/core/wiki/Compatibility-level) is < 2, default value is `0`.
8+
* Improved `$help` command output and handling, added description to `$$=<n>` output.
9+
* Moved the optional tool table in non-volatile storage \(typically EEPROM\) to above the core area. This allows a larger number of tools \(max. 16\) to be defined.
10+
__NOTE:__ If you have tool table support enabled before upgrading the current table will be lost and possibly also all other settings. Backup and restore!
11+
* Added gcode parameter support. All [NIST RS274NGC version 3](https://www.nist.gov/publications/nist-rs274ngc-interpreter-version-3) parameters (see section 3.2.1) and most [LinuxCNC](http://www.linuxcnc.org/docs/html/gcode/overview.html#_parameters) parameters are supported.
12+
The `$#=<n>` or `$#=<name>` commands can be used to output a parameter value. Replace `<n>` with a parameter number, `<name>` with a parameter name.
13+
__NOTE 1:__ Named parameters and parameters in the range 1 to 5160 are volatile and will not persist across a reboot.
14+
__NOTE 2:__ Space for the volatile parameters is allocated at run-time, available memory \(heap\) sets a limit to how many can be set.
15+
__NOTE 3:__ Maximum name length is 20 characters, maximum number of parameters that can be set in a block \(line\) is 10.
16+
* Added gcode [expression](http://www.linuxcnc.org/docs/html/gcode/overview.html#gcode:expressions) support. This has to be enabled in [grbl/config.h](./config.h) by uncommenting `//#define NGC_EXPRESSIONS_ENABLE 1`. _Experimental_.
17+
__NOTE:__ Processors with limited memory may not compile with this enabled.
18+
19+
Drivers & plugins:
20+
21+
* Added [WebUI plugin](https://github.com/grblHAL/Plugin_WebUI) support for some networking capable boards.
22+
* Updated some drivers for internal API changes. Some minor bug fixes.
23+
324
Build 20210907:
425

526
Core:

config.h

+21-3
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ __NOTE:__ if switching to a level > 1 please reset non-volatile storage with \a
8383
// immediately forces a feed hold and then safely de-energizes the machine. Resuming is blocked until
8484
// the safety door is re-engaged. When it is, Grbl will re-energize the machine and then resume on the
8585
// previous tool path, as if nothing happened.
86-
// #define ENABLE_SAFETY_DOOR_INPUT_PIN // Default disabled. Uncomment to enable.
86+
//#define ENABLE_SAFETY_DOOR_INPUT_PIN // Default disabled. Uncomment to enable.
8787

8888
// After the safety door switch has been toggled and restored, this setting sets the power-up delay
8989
// between restoring the spindle and coolant and resuming the cycle.
@@ -472,9 +472,24 @@ __NOTE:__ these definitions are only referenced in this file. Do __NOT__ change!
472472
//#define DEFAULT_REPORT_PARSER_STATE
473473
//#define DEFAULT_REPORT_ALARM_SUBSTATE
474474

475+
// G92 offsets is by default stored to non-volatile storage (NVS) on changes and restored on startup
476+
// if COMPATIBILITY_LEVEL is <= 1. If COMPATIBILITY_LEVEL is <= 1 then setting $384 can be used to change this at run-time.
477+
// To allow store/restore of the G92 offset when COMPATIBILITY_LEVEL > 1 uncomment the line below and reset settings with $RST=*.
478+
//#define DISABLE_G92_PERSISTENCE 0
479+
475480
#if COMPATIBILITY_LEVEL == 0
476-
// Number of tools in ATC tool table, comment out to disable
477-
// #define N_TOOLS 8
481+
// Number of tools in tool table, uncomment and edit if neccesary to enable (max. 16 allowed)
482+
//#define N_TOOLS 8
483+
#endif
484+
485+
// Sanity checks - N_TOOLS may have been defined on the compiler command line.
486+
#if defined(N_TOOLS) && N_TOOLS == 0
487+
#undef N_TOOLS
488+
#endif
489+
490+
#if defined(N_TOOLS) && N_TOOLS > 16
491+
#undef N_TOOLS
492+
#define N_TOOLS 16
478493
#endif
479494

480495
// Max number of entries in log for PID data reporting, to be used for tuning
@@ -624,4 +639,7 @@ __NOTE:__ these definitions are only referenced in this file. Do __NOT__ change!
624639

625640
#endif // DEFAULT_HOMING_ENABLE
626641

642+
// Uncomment to enable experimental support for parameters and expressions
643+
//#define NGC_EXPRESSIONS_ENABLE 1
644+
627645
#endif

defaults.h

+14
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@
3737
// Note: DEFAULT_ACCELERATION is only referenced in this file
3838
#define DEFAULT_ACCELERATION (10.0f * 60.0f * 60.0f) // 10*60*60 mm/min^2 = 10 mm/sec^2
3939

40+
#ifndef DISABLE_G92_PERSISTENCE
41+
#if COMPATIBILITY_LEVEL <= 1
42+
#define DISABLE_G92_PERSISTENCE 0
43+
#else
44+
#define DISABLE_G92_PERSISTENCE 1
45+
#endif
46+
#endif
47+
4048
#ifdef DEFAULT_REPORT_MACHINE_POSITION
4149
#undef DEFAULT_REPORT_MACHINE_POSITION
4250
#define DEFAULT_REPORT_MACHINE_POSITION 1
@@ -609,6 +617,12 @@
609617
#define INVERT_COOLANT_MIST_PIN 0
610618
#endif
611619

620+
#ifndef NGC_EXPRESSIONS_ENABLE
621+
#define NGC_EXPRESSIONS_ENABLE 0
622+
#else
623+
#define NGC_N_ASSIGN_PARAMETERS_PER_BLOCK 10
624+
#endif
625+
612626
// ---------------------------------------------------------------------------------------
613627
// COMPILE-TIME ERROR CHECKING OF DEFINE VALUES:
614628

driver_opts.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@
240240
#if NETWORK_IPMODE < 0 || NETWORK_IPMODE > 2
241241
#error "Invalid IP mode selected!"
242242
#endif
243-
#if NETWORK_WEBSOCKET_PORT == NETWORK_HTTP_PORT
243+
#if HTTP_ENABLE && NETWORK_WEBSOCKET_PORT == NETWORK_HTTP_PORT
244244
#warning "HTTP and WebSocket protocols cannot share the same port!"
245245
#endif
246246
#endif

errors.c

+9-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,15 @@ PROGMEM static const status_detail_t status_detail[] = {
8181
{ Status_MotorFault, "Motor fault", "Motor fault." },
8282
{ Status_SettingValueOutOfRange, "Value out of range.", "Setting value is out of range." },
8383
{ Status_SettingDisabled, "Setting disabled", "Setting is not available, possibly due to limited driver support." },
84-
{ Status_GcodeInvalidRetractPosition, "Invalid gcode ID:54", "Retract position is less than drill depth." }
84+
{ Status_GcodeInvalidRetractPosition, "Invalid gcode ID:54", "Retract position is less than drill depth." },
85+
#if NGC_EXPRESSIONS_ENABLE
86+
{ Status_ExpressionUknownOp, "Unknown operation found in expression", "Unknown operation found in expression." },
87+
{ Status_ExpressionDivideByZero, "Divide by zero in expression", "Divide by zero in expression attempted." },
88+
{ Status_ExpressionArgumentOutOfRange, "Expression argument out of range", "Too large or too small argrument provided." },
89+
{ Status_ExpressionInvalidArgument, "Invalid expression argument", "Argument is not valid for the operation" },
90+
{ Status_ExpressionSyntaxError, "Syntax error in expression", "Expression is not valid." },
91+
{ Status_ExpressionInvalidResult, "Invalid result returned from expression", "Either NAN (not a number) or infinity was returned from expression." }
92+
#endif
8593
};
8694

8795
static error_details_t details = {

errors.h

+9
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,15 @@ typedef enum {
9393
Status_SDFileEmpty = 64,
9494

9595
Status_BTInitError = 70,
96+
97+
//
98+
Status_ExpressionUknownOp = 71,
99+
Status_ExpressionDivideByZero = 72,
100+
Status_ExpressionArgumentOutOfRange = 73,
101+
Status_ExpressionInvalidArgument = 74,
102+
Status_ExpressionSyntaxError = 75,
103+
Status_ExpressionInvalidResult = 76,
104+
96105
Status_Unhandled, // For internal use only
97106
Status_StatusMax = Status_Unhandled
98107
} status_code_t;

0 commit comments

Comments
 (0)