136 Commits

Author SHA1 Message Date
Terje Io
b435b48ec1 Changed real time reporting to allow per connection status for which report elements to output.
Added pragmas to shut up warning from the ESP32 compiler.
2026-02-04 11:28:20 +01:00
Terje Io
c6aa574279 Added experimental support for M98 subroutines, internal subroutines are only supported for programs run from a local file system.
$700 controls whether they are scanned for internally in the main program (1) or always located externally (0).
If scanned for internally the program is run twice, initially in check mode to locate the subroutines before it is rewound and run in normal mode.
If stored externally the file P<macro number>.macro is run, <macro number> is the M98 P value.
2026-02-02 22:25:31 +01:00
Terje Io
4340b3d768 fix for out of sync commit 2026-01-25 08:27:32 +01:00
Terje Io
64c35930c7 Refactored offset handling, for improved readability and in preparation for rotation support.
Added experimental support for G66 (modal macro call) and G67 (end modal macro call).
Made axis letter to axis/motor assignment for axes ABCUVW freely changeable at compile time.
Fix for some G65 arguments being incorrectly validated for normal use (sign, range).
Added repeat support to G65 macro call via the optional L parameter word.
Changed default setting for ABC-axes to rotary.
Changed defaults for jerk settings to 10x acceleration settings.
Disabled jerk for jog, probe and spindle synchronized motion.
Added _active_probe system parameter, returns -1 if no probe inputs available.
Minor bug fix, G5.1 and G33.1 motion commands were not coverted to the correct string equivalent in $G output.
2026-01-25 07:51:44 +01:00
terjeio
779d41b8d8 Fix for regression causing loss of tool offset on soft reset when $676 option is to keep offsets. 2026-01-07 08:49:16 +07:00
Terje Io
e272f773b5 Refactored the tool table HAL API a bit to improve functionality.
Added tool name, pocket number and some lathe specific data fields to the $# tool output when available from the tool table.
If name is available it will be output as a push message on M6 if there is no message in the same block.
Added support for directory up, .., to VFS.
Added new option to $650 - File systems options to enable hierarchical listing of files and directories via $F and $F+ commands.
2025-11-11 16:51:08 +01:00
Terje Io
adba5d031c Refactored M70-M73 modal state handling, should now be fully compatible with LinuxCNC behaviour.
Added ADC/DAC resolution to $pinstate command, changed reported values to integer for ADC/DAC devices and float formatted for PWM devices.
Numeric settings can now be set via G65P1Q<n>S<value>, <n> is the setting number, <value> is the new value.
Changed alarm code for Modbus exceptions (communication errors) from 14 to 19.
Refactored MPG stream code to allow plugins to hook into MPG streams (via event handler).
Added _free memory system parameter, returns value in KBytes or -1 if not available from driver.
Changed basic stream data type from char to uint8_t, added HAL function and core API for releasing/closing UART streams.
2025-11-08 07:52:01 +01:00
Terje Io
1d0d7b41a4 Added preprocessor code and symbols to allow easy assignment of unused/unclaimed limit inputs as auxiliary inputs. 2025-10-12 20:24:35 +02:00
Terje Io
8c3d44bfca Added helper code for plugins claiming auxiliary ports to make plugin coding easier and behaviour consistent.
Some minor bug fixes such as incorrect error code returned for unknown $-commands and temporary incorrect position reporting on in-flight G92 offset changes.
2025-10-11 18:28:21 +02:00
Terje Io
e37572fe02 Improved M70-M73 modal state save and restore, should now handle overrides correctly.
Added lightweight JSON serializer outputting directly to file.
Fix for event handler sometimes called too early. Ref. issue #818.
For developers: added optional device filing system that can redirect file read/write to serial streams.
2025-10-02 15:18:28 +02:00
Terje Io
2f9ba98040 Added G65P6 for disabling spindle on/off delay for the next spindle command (M3, M4 and M5).
For programmers: added grbl.on_control_signals_changed event, fired on some signals: optional stop, single step, block delete and cycle start.
Fix for incorrect handling of arcs when negative scaling is enabled with G51.
2025-09-25 08:29:01 +02:00
Terje Io
43fa98d93b Fix for grbl.on_tool_changed event raised too early when tool change code is in tc.macro. 2025-08-08 20:46:34 +02:00
Terje Io
e35af1abc1 Added setting flag to $675 (Macro ATC options) for enabling error on M6 if tc.macro is not found in the filing system.
Changed $I NEWOPT "ATC" element to ATC=1 when ATC is online and ATC=0 when offline.
For macro based ATC code this is set to ATC=0 if tc.macro is not found and the new $675 flag is set.
2025-06-26 07:25:58 +02:00
Terje Io
5614f505fb Refactored tool table API/HAL, now supports tool > tool rack/carousel pocket mapping.
Named system parameters _current_pocket and _selected_pocket updated to return the correct values.
Moved handling of keeping last tool number over reboot from template plugin to the core.
Added named system parameters _homed_state and _homed_axes.
Fix for failure to claim auxiliary ports in some configurations.
2025-06-19 07:09:49 +02:00
Terje Io
b10b3317d2 Fix for custom M-code commands claiming all axis words even when not using any.
Added setting $680 for configuring delay from stepper enable to first dir/step pulse.
Adds to fixed ~2ms delay provided by most drivers.
2025-05-18 08:03:51 +02:00
Terje Io
6948b0e117 Added initial/enhanced support for toolsetter and second probe input.
Moved inbuilt G65 macros to the core and added macro G65P5Q<n> for selecting probe.
Added probe id to real time report: |P:<n> will be reported on probe select when more than one probe is available.
Fix for WCO and Ov real time status report elements not beeing reported as they should in some circumstances.
2025-05-15 06:23:17 +02:00
Terje Io
e1ea957ca4 Added wrappers/veneers for hal.port functions, plugin code should be changed to use
these instead of calling via hal.port functions or accessing hal.port properties.
Improved the ioports API, updated core code to make use of it.
Flagged some calls and (part of) some stuctures as deprecated.
2025-04-13 20:54:09 +02:00
Terje Io
790cff7036 Increased max number of digital ioports to 24, added some crossbar capabilities (external, async, entry point for setting pin function). 2025-04-07 19:36:50 +02:00
Terje Io
bbd3b69939 Added new mid/low level HAL/API to ioports (auxiliary ports).
Added '$709' setting for second PWM spindle when available - PWM options.
Added properties to PWM spindles to allow "overdriving" PWM output when _RPM controls spindle enable signal is enabled with '$9' or '$709'.
Optimized Modbus CRC calculation, may fix issue with a compiler generating different code compared to most others. Ref. issue #723.
2025-04-05 17:20:44 +02:00
Terje Io
b737687743 Reduced default step pulse length to 5 microseconds.
Added HAL parameter for minimum step pulse length set by driver, used for validation of $0 setting.
Changed HAL API signature for outputting step pulses, optimized to allow drivers to only change direction outputs when there is an actual direction change.
Improved handling of overrides at end of program when all motion is buffered. Possible fix for issue #714.
Some optimizations to allow higher step rates.
2025-03-28 18:02:56 +01:00
Terje Io
3d7cb52d98 Hardened" task handler code, reseved some realtime control characters for macro plugins.
Added missing file to CMakeLists.txt and made private function public for plugin use.
2025-03-20 11:25:25 +01:00
Terje Io
8e2847a6c6 Some ioports HAL wrapper functions refactored. Fixes persisting issue with coprocessor control pins mentioned here.
Changed some parts to no longer reference deprecated code.
Added some display driver symbols (for plugin use).
2025-03-11 19:18:08 +01:00
Terje Io
525a7d322a Fixed issue where aux output commands syncronized with motion was sometimes lost.
Added spindle capability flag for plasma torch and disable of spindle spin up/down delay if set.
2025-02-01 21:50:06 +01:00
Terje Io
d25d2eaa42 Fixed some typos causing compilation failure in some configurations.
No longer copies spindle on delay from door setting ($392) to the new general setting ($340) on update from pre 20250103 builds.
Fixed missed code change when general spindle on delay was implemented causing the delay to be inserted on a simple RPM change with the S word.
2025-01-31 19:15:53 +01:00
Terje Io
fd3438da34 Added API call for overriding jerk settings, symbol for M201.3 gcode. 2025-01-29 15:51:25 +01:00
Terje Io
dfa1b262a4 Added setting definition for macro ATC options.
Now hides core toolchange settings when macro based ATC is active to avoid confusion.
"hardened" parser tool change code a bit.
2025-01-28 09:22:00 +01:00
Terje Io
f4ca082f38 Guarded new code that caused compilation failure if COMPATIBILITY_LEVEL was set > 1. 2025-01-22 08:43:57 +01:00
Terje Io
c7c7d5a4cf Added $SDS command for outputting Stepper Driver Status. 2025-01-20 13:11:00 +01:00
Terje Io
ff0903fd87 Added HAL support for stepper driver status signals (warning and fault) and
new HAL entry point for querying/resetting driver status.
Added driver capability flags and settings, $742 - $745, for enabling and inverting motor warning and fault input signals (per axis).
Improved jerk acceleration. Ref. PR #660.
2025-01-18 21:18:30 +01:00
Terje Io
efe4245a06 "hardened" task deregistration code and changed signature of setting available and ioport_find_free() calls.
Some low-level ioport improvements, added definition for virtual pins/ports.
Deprecated direct access to number of the different ioport ports in hal.port struct, use ioports_unclaimed() instead.
2025-01-14 17:13:56 +01:00
Terje Io
22a8a08a95 Fixed inconsistent handling of auxiliary port numbers when claiming from plugins.
New API call added related to this.
2025-01-09 12:17:25 +01:00
Terje Io
6b4bab82ad Added new handling for spindle spin up and coolant start delays. See the changelog for details. 2025-01-03 23:16:08 +01:00
Terje Io
e8a0aeea26 Fix for laser incorrectly enabled in laser mode when M3S<n> commanded in G0 and G80 modal states. Ref. issue #644.
Added optional support for 3rd order acceleration (jerk) and G187 gcode. Ref. pull request #593.
2024-12-31 08:48:33 +01:00
Dietz0r
84657b4f69 Cleaned up the Switchcase coder after the debugging mess (thanks terje!) added the line for initilizing the acceleration_factor, renamed acceleration_profiles variable to acceleration_factor to match the rest of the code 2024-12-27 17:44:54 +01:00
Dietz0r
9d48143edf Fixed the Unused Values error, removed stray comma, removed settings.h conditional 2024-12-27 12:58:21 +01:00
Dietz0r
c47e6a356e Debugging and Compiling 2024-12-27 02:45:34 +01:00
Dietz0r
ce60b8ff7d adjusted the limit by axis maximum functions to not require the block data 2024-12-26 22:49:34 +01:00
Dietz0r
c4969f1dc0 missed 2 variable names 2024-12-10 22:24:39 +01:00
Dietz0r
e504964dae moved acceleration factor to plan_block_t structure, moved lookup function to plan_data_init, renamed lookup fuction and adjusted the acceleration limit functions to new structure 2024-12-10 22:15:25 +01:00
Dietz0r
075d5cec57 Merge branch 'master' into master 2024-12-10 21:28:16 +01:00
Terje Io
acfd473fce Changed deprecated calls to isinff() and isnanf() to new (C99) versions. 2024-12-04 09:29:23 +01:00
Terje Io
8fee2930f5 Added (or rather repurposed) field for build date to settings structure in preparation for coming changes.
Added code guards in order to free some memory for STM32F103 variants with 128K flash.
Changed Stop (0x19) real-time command behaviour, active tool offset and coordinate system will now be kept. Ref. issue #610.
2024-11-29 18:17:26 +01:00
Terje Io
7e40bf2402 A bit of refactoring related to spindles as a first step for a coming settings structure revision, "hardened" some code. 2024-11-20 19:03:27 +01:00
Terje Io
0b8bce16c6 Added support for named o-sub/o-call to flow control, for calling gcode subroutines stored on SD card or in littlefs.
Sub name matches filename with extension .macro.
Added core event for handling special gcode comments used by expressions and flow control: DEBUG, PRINT and ABORT.
Added overrideable default $-setting values for second PWM spindle to grbl/config.c.
2024-11-16 22:02:00 +01:00
Dietz0r
b7d54d75ee added acceleration profiles to gc_state, adjusted g187 and m2/30 handling accordingly 2024-10-31 21:22:09 +01:00
Terje Io
9a98243fd3 Changed _vminor named parameter to contain build date in YYMMDD format, previously value was 0.
Added support for LinuxCNC style (ABORT,<msg>) comment, requires expressions enabled. Terminates gcode program, outputs message and returns error 253.
Added PRM[<setting>] and PRM[<setting>,<bit>] functions to expressions, returns $-setting value or value of bit in integer type setting.
"hardened" flow control code, fixed bug in repeat...continue handling.
Changed signature of grbl.on_gcode_comment event, now returns status code.
2024-10-27 07:27:25 +07:00
Terje Io
ee8eb2c1eb Fixed some odd bugs in NGC flow control, prepared for file based named O-call subroutines.
Fixed incorrect comment string passed to passed to grbl.on_gcode_comment event.
Added generic redirector for temporarily changing input stream to read from a file. Supports nesting.
2024-10-23 20:18:34 +07:00
Terje Io
c07d63198e Moved message substitution code from gcode.c to ngc_expr.c. 2024-10-19 18:45:13 +07:00
Terje Io
236a40c100 Improved parameter handling some more, now allows indirected O-calls and line numbers with O-word.
Fix for issue #609, homing may cause a controller crash.
2024-10-16 14:13:04 +07:00
Terje Io
a7b82c8041 Removed misplaced code guard 2024-10-14 20:09:56 +07:00