103 Commits

Author SHA1 Message Date
Terje Io
d74d450f2d Reinstated settings definition that somehow was deleted in the 20260202 commit++ 2026-02-04 16:58:19 +01:00
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
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
13145a4a46 Updated to allow Bluetooth serial streams to be used for MPG/pendants.
Parking mode improvements.
Removed requirement for external encoder for spindle sync if stepper spindle is enabled.
Improved handling of $680 stepper enable delay.
2025-12-01 17:55:53 +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
ba222d16aa Previous commit was incorrect, fixed 2025-10-22 08:31:34 +02:00
Terje Io
f5f31e6780 Fix for regression causing no WCO data in the real time report. 2025-10-22 08:20:54 +02:00
Terje Io
106f5fd573 Refactored assignment of of auxiliary I/O for "standard" inputs and outputs to make it more robust and easier to follow for developers.
Moved probe signal handling from drivers to the core, improved handling of probe disconnected signal.
NOTE: The changes above are quite large, please verify probe operation after installation.
2025-10-16 17:22:32 +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
132159a6b6 Workaround for some compilers configured to treat warnings as errors causing compilation failure.
Added $PORTS command for listing serial ports, later I will update all drivers to provide the optional information.
Potential fix for polar kinematics not handling axes > 3 correctly, needs testing. Ref. issue #820.
2025-10-04 20:17:22 +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
a61e5e1089 Added setting options for clearing rapids and feed overrids on soft reset to $676, defaults to on. Ref. issue #803.
Added realtime report of distance-to-go. Ref. PR #802.
2025-09-10 21:34:20 +02:00
Mitchell Grams
50e10ac768 Add setting for including distance-to-go in realtime report 2025-09-07 18:15:42 -06:00
Mitchell Grams
d2d7ddc0c0 Add initial support for distance to go in realtime report 2025-09-07 18:02:50 -06:00
Terje Io
24d802e573 Fix for bug preventing disabling of AMASS, changed the ADAPTIVE_MULTI_AXIS_STEP_SMOOTHING symbol so it can be overridden via compiler argument.
For developers: added output function parameter to signature of report_realtime_status() call to allow routing output to a given stream (or streams).
2025-09-04 08:36:48 +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
e03e594ca5 Fix for typecast issue causing compile failure with some compilers. Ref issue #761. 2025-06-21 07:05:50 +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
f40d5db74a Changed backlash feed rate to be the same as the current motion. Ref. issue #751.
Minor fix for probe availability report in $I output.
2025-05-30 08:53:48 +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
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
4dc17753bb Fixed $help topic search failing if target contains spaces. Ref. issue #664.
Improved default serial port mapping when both MPG mode and keypad plugin are enabled to ensure the port is shared.
Delayed status report output on MPG mode change a few milliseconds to avoid awakening the ESP32 guru that sometimes reboots the controller.
2025-01-24 21:01:56 +01:00
Terje Io
c7c7d5a4cf Added $SDS command for outputting Stepper Driver Status. 2025-01-20 13:11:00 +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
b80cd2f3f8 Changed error code reported when file not found for G65 macro or named O-sub calls from 39 to 84.
Removed IDLE state requirement for executing G65 macros, an error will no longer be returned and the macro will be run.
Added event handler for outputting welcome message on "native" USB connect for drivers that provides the linestate changed event.
2025-01-05 08:18:52 +01:00
Terje Io
8dc30ad89c Improved handling of real-time clock (RTC). 2024-12-23 10:37:14 +01:00
Terje Io
a41790dada Revised core setting structures, changed from 8-bit to 16-bit CRC checksums for improved detection of corruption/version mismatches.
Added option to homing enable setting ($22) for per axis homing feedrates.

!! Backup and restore settings over an update is recommended since all settings will be reset to default. Any odometer data will also be lost.
2024-12-09 19:24:20 +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
43d694917c Added basic core support for toolsetter probe, changes $6 (probe input inversion) and $19
(probe input pullup disable) settings from boolean to bitfield when driver support is available.
Added a few default values for settings in config.h, overridable from the compiler command line.
Added core support for per axis pulloff distance, needs plugin for configuring them.
Added HAL flags for disabling settings for MCU input pins pullup disable, may be set by
drivers/boards that has buffered (optocoupled) inputs that is not possible to change.
2024-11-13 17:32:36 +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
f0eac9d0aa Improved expression and parameter handling, simplified gcode parser related to this. Fixed typo in OR statement decode.
Added clear of return value on CALL statement and added optional return value expression support to ENDSUB.
Improved handling of multiple simultaneous spindles. Still work in progress.
For developers: moved user M-code entry point hooks from the HAL structure to the core handlers and changed signature of the check() function to better support valueless words (letters) when parameter support is enabled. Removed deprecated parameter from the validate() call signature.
2024-10-14 19:02:30 +07:00
Terje Io
5825b36ef6 Fix for M62 - M68 regression. Ref. issue #600.
Fixed incorrect handling of G65 call parameters, axis words had offsets added. Ref. issue #594.
Refactored handling of multiple spindles. There are still some limitations but should work better now. Disabled override delays for now, needs investigation. Ref. issue #598.
NOTE: Please report any erratic behaviour after installing this version since it is a rather major change.
2024-10-06 20:24:34 +07:00
Terje Io
323dd84b79 Added (PRINT, <msg>) support and parameter formatting for DEBUG and PRINT commands.
Added named parameters for getting absolute (G53) position: _abs_x, abs_y, ...
Available when expression support is enabled.

Changed stepper enable HAL signature to allow current reduction when idle.
Added reference id to spindle registration in order to allow configuring default spindle, and possibly additional spindles, at compile time.
2024-09-29 12:38:49 +07:00
Terje Io
7ade244a78 Improved handling of extended M commands (plugin based) command words.
Fixes issues for programs containing extended M-codes using single meaning words (which they as a rule should not do).
Added core support for spindle encoder binding to spindles.
Added sorting of spindle report: enabled spindles are sorted first in order of spindle number, disabled by type then spindle id.
Changed realtime report to report spindle number instead of spindle id on changes in the |S: element.
2024-08-12 15:46:58 +02:00
Terje Io
8b9b7859ee Limited tool change probe moves to be within machine limits. Ref. issue #542.
Added setting $358 to enable experimental functionality for fast rotary 'rewind' to stored G28 position.
Return move should complete in half a rotation or less.
For developers: added option to redirect debug via driver provided function when DEBUGOUT is set to -1 in config.h. Ref. issue #545.
2024-07-19 09:49:46 +02:00
Terje Io
5cff12e660 Added printf style debug output function and corresponding macro.
Added grbl.on_report_ngc_parameters event.
Fixed silly mistakes in CAN code.
2024-07-09 19:34:31 +02:00
Terje Io
eb7610cd39 Added soft limits check for corexy kinematics, ref. discussion #536.
Added high level CANbus API for plugin use. Ref. issue #179.
2024-07-07 06:55:24 +02:00
Terje Io
21329cd03f "Hardened" NGC parameter name case swapping.
Changed to use float precision according to metric/inches setting for parameter reporting.
2024-05-27 13:39:30 +07:00
Terje Io
299eab7f27 Added experimental support for M70-M73, save and restore of modal state.
Added experimental support of LinuxCNC style subroutines.
Available for gcode run from local filesystem such as on a SD card or in littlefs.
Improved handling of G92 when G92 offset is changed while motion is ongoing. Ref. issue #241.
Fix for issue #521, crash when running G65 macro on ESP32.
"Hardened" stream switching code, likely fix for discussion #456.
2024-05-26 17:12:08 +07:00
Terje Io
c6aeef14cf Added config to enable NGC parameter reporting, default on. 2024-04-27 23:33:33 +02:00
Terje Io
5afac36157 Added capability flags to HAL for all coolant outputs.
Hide related settings when no spindle and/or coolant outputs are available. From PR #479.
Fixed typo related to Modbus direction signal. Ref. issue #478.
Fixed typo in handling of aux output port settings. Ref issue #476.
2024-03-30 21:08:48 +01:00
Terje Io
7cf86877f0 Changed signature of grbl.on_homing complete event to include the cycle flags.
Added definitions for up to four additional digital aux I/O ports.
Added real time report of selected spindle in multi spindle configurations. Reported on changes only.
Removed limits override input invert config, for safety reasons it is always active low.
Added HAL entry points for second RGB channel, renamed first from hal.rgb to hal.rgb0.
Added option to setting $22 to force use of limit switches for homing when homing inputs are available in the driver/board combo.
Improved handling of aux I/O pins when claimed for core functions.
Added flag to $9 for disabling laser mode capability for primary PWM spindle. Allows leaving laser mode enabled when a secondary PWM spindle is available and this is used to control a laser.
Added some generic setting definitions for stepper drivers, currently used by the motors plugin.
2024-03-19 20:32:40 +01:00
Terje Io
06f442643a Tentative fix for lathe CSS/feed per rev modes (G96/G95), ref discussion #450.
Fixed incorrect reporting of feed rate modes in $G response.
Added some ioPorts call wrappers, full support for reconfiguring output auxillary pins for PWM output.
2024-02-28 17:36:17 +01:00
Terje Io
a912ce47c7 This build has moved the probe input to the ioPorts pool of inputs and will be allocated from it when configured.
The change is major and potentially dangerous, it may damage your probe, so please verify correct operation after installing.

Fix for STM32F4xx issue 161, Ethernet connection unresponsive if USB port not powered.

Enhanced ioPorts interface: New debounce option for input pins that are interrupt capable, currently only possible to enable via plugin code - later to be made available via a $-setting.
Added some wrapper functions for simpler plugin code++

Added simple task scheduler to the core, allows interrupt routines to dispatch jobs to the foreground process, delayed tasks and repeating tasks attached to the 1 ms system timer.
Some drivers and plugins now uses the scheduler for input pin debouncing, regular polling etc. The core uses it for stepper disabling and sleep monitoring.
2024-02-23 22:54:00 +01:00
Terje Io
e5d088eda7 Added core support for new MPG mode that claims one serial stream and uses the 0x8B real-time command character for switching mode.
Moved RGB API definitions to separate file and added some utilities for drivers and plugins. Fixed minor bug.
stream_open_instance(), signature change - added optional description string.
2024-02-05 23:39:27 +01:00
Terje Io
b200199612 Internal changes that may affect developers, see the changelog for details. 2024-01-26 11:14:39 +01:00
Terje Io
f0ef77435e Enhanced RGB and ioports APIs.
Allowed use of unused (by the core) axis words (ABCUVW) in M-code commands implemented by plugin code.
Added $PINSTATE command, for outputting auxillary pin states, modes and capabilities. Machine readable formatting.
2024-01-24 18:38:08 +01:00