Updated $N0 and $N1 startup commands to allow multi-block (line) gcode commands by using | (vertical bar) as the separator.

No longer configures auxiliary output pins claimed for basic functions in order to avoid affecting any previously set alternate pin function.
This commit is contained in:
Terje Io
2025-04-25 17:13:42 +02:00
parent b41018543b
commit 390c11bb7e
6 changed files with 50 additions and 16 deletions

View File

@@ -1,6 +1,6 @@
## grblHAL ##
Latest build date is 20250424, see the [changelog](changelog.md) for details.
Latest build date is 20250425, see the [changelog](changelog.md) for details.
> [!NOTE]
> A settings reset will be performed on an update of builds prior to 20241208. Backup and restore of settings is recommended.
@@ -89,4 +89,4 @@ G/M-codes not supported by [legacy Grbl](https://github.com/gnea/grbl/wiki) are
Some [plugins](https://github.com/grblHAL/plugins) implements additional M-codes.
---
20250424
20250425

View File

@@ -1,17 +1,32 @@
## grblHAL changelog
<a name="20250425">20250425
Core:
* Updated `$N0` and `$N1` startup commands to allow multi-block \(line\) gcode commands by using `|` \(vertical bar\) as the separator.
* No longer configures auxiliary output pins claimed for basic functions in order to avoid affecting any previously set alternate pin function.
Drivers:
* iMXRT1062: fix for issue [#95](https://github.com/grblHAL/iMXRT1062/issues/95), spindle PWM output missing.
---
<a name="20250424">20250424
Core:
* Moved part of the driver based spindle sync code to the core. Spindle sync now has to be enabled in _grbl/config.h_.
* Moved part of the driver based spindle sync code to the core.
Spindle sync now has to be enabled in [grbl/config.h}(https://github.com/grblHAL/core/blob/b41018543b35b0f14f9ab29d9ccc43bd0e4045dc/config.h#L526-L534).
Drivers:
* iMXRT1062, MSP432P401R, STM32F4xx, STM32F7xx: removed spindle sync code now in the core.
* RP2040: Added tentative support for spindle sync, board maps has to be updated for spindle encoder inputs - not all can be due to pin restrictions.
Fixed regression causing the Pico CNC board to lose spindle PWM output.
Fixed regression causing the PicoCNC board to lose spindle PWM output.
* LPC176x, ESP32, TM4C123, STM32F1xx: replaced deprecated code.

2
grbl.h
View File

@@ -42,7 +42,7 @@
#else
#define GRBL_VERSION "1.1f"
#endif
#define GRBL_BUILD 20250424
#define GRBL_BUILD 20250425
#define GRBL_URL "https://github.com/grblHAL"

View File

@@ -351,7 +351,7 @@ bool ioport_set_function (xbar_t *pin, pin_function_t function, driver_caps_t ca
{
bool ok = false;
io_ports_list_t *io_port = ports;
io_ports_private_t *cfg = get_port_data(!pin->mode.analog, pin->mode.output);
io_ports_private_t *cfg = get_port_data((io_port_type_t)!pin->mode.analog, (io_port_direction_t)pin->mode.output);
if(io_port) do {
if(io_port->ports_id == pin->ports_id && (ok = pin->set_function && pin->set_function(pin, function))) {
@@ -1382,13 +1382,13 @@ static void ioports_configure (settings_t *settings)
if(cfg->ports && (port = cfg->n_ports)) do {
if((xbar = hal.port.get_pin_info(Port_Digital, Port_Output, map_reverse(cfg, --port)))) {
if(xbar->config && !(xbar->mode.pwm || xbar->mode.servo_pwm)) {
if(xbar->config && (cfg->bus.mask & (1 << port)) && !(xbar->mode.pwm || xbar->mode.servo_pwm)) {
out_config.inverted = (settings->ioport.invert_out.mask & (1 << port)) && is_aux(cfg, xbar->function);
out_config.open_drain = !!(settings->ioport.od_enable_out.mask & (1 << port));
xbar->config(xbar, &out_config, false);
} else { // TODO: same for inputs?
ioport_bus_t bus;
bus.mask = cfg->bus.mask & ~(1 << port);
bus.mask = cfg->bus.mask & (1 << port);
setting_remove_elements(Settings_IoPort_InvertOut, bus.mask);
}
}

View File

@@ -55,7 +55,7 @@ void mc_backlash_init (axes_signals_t axes)
if(bit_istrue(axes.mask, bit(idx))) {
if((steps = lroundf(settings.axis[idx].backlash * settings.axis[idx].steps_per_mm))) {
backlash_comp.values[idx] = (float)steps / settings.axis[idx].steps_per_mm;
BIT_SET(backlash_enabled.mask, bit(idx), settings.axis[idx].backlash > 0.0001f);
bit_true(backlash_enabled.mask, bit(idx));
BIT_SET(dir_negative.mask, bit(idx), bit_isfalse(settings.homing.dir_mask.mask, bit(idx)));
}
}

View File

@@ -135,14 +135,18 @@ void system_execute_startup (void *data)
{
if(hal.nvs.type != NVS_None) {
uint_fast8_t idx;
char line[sizeof(stored_line_t)];
uint_fast8_t n;
for (n = 0; n < N_STARTUP_LINE; n++) {
if (!settings_read_startup_line(n, line))
for(idx = 0; idx < N_STARTUP_LINE; idx++) {
if(!settings_read_startup_line(idx, line))
report_execute_startup_message(line, Status_SettingReadFail);
else if (*line != '\0')
report_execute_startup_message(line, gc_execute_block(line));
else if(*line != '\0') {
char *block = strtok(line, "|");
do {
report_execute_startup_message(block, gc_execute_block(block));
} while((block = strtok(NULL, "|")));
}
}
}
}
@@ -703,8 +707,23 @@ static status_code_t set_startup_line (sys_state_t state, char *args, uint_fast8
if(retval == Status_OK) {
if(strlen(args) >= (sizeof(stored_line_t) - 1))
retval = Status_Overflow;
else if ((retval = gc_execute_block(args)) == Status_OK) // Execute gcode block to ensure block is valid.
settings_write_startup_line(lnr, args);
else {
if(*args) {
char line[sizeof(stored_line_t)], *block;
strcpy(line, args);
block = strtok(line, "|");
do {
retval = gc_execute_block(block); // Execute gcode block to ensure block is valid.
} while(retval == Status_OK && (block = strtok(NULL, "|")));
}
if(retval == Status_OK)
settings_write_startup_line(lnr, args);
}
}
return retval;