From 4dc17753bb6bb7d5878ebe8d01bcea82e23e23b5 Mon Sep 17 00:00:00 2001 From: Terje Io Date: Fri, 24 Jan 2025 21:01:56 +0100 Subject: [PATCH] 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. --- README.md | 4 ++-- changelog.md | 31 +++++++++++++++++++++++++++++++ driver_opts2.h | 26 ++++++++++++++------------ grbl.h | 2 +- report.c | 17 ++++++++--------- stream.c | 9 +++++++-- 6 files changed, 63 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 4b2acf0..17d0ccb 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ## grblHAL ## -Latest build date is 20250118, see the [changelog](changelog.md) for details. +Latest build date is 20250124, 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. @@ -93,4 +93,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. --- -20250118 +20250124 diff --git a/changelog.md b/changelog.md index b09b65a..4c39814 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,36 @@ ## grblHAL changelog +Build 20250124 + +Core: + +* Fixed `$help` topic search failing if target contains spaces. Ref. issue [#664](https://github.com/grblHAL/core/issues/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. + +Drivers: + +* iMXRT1062: harmonized code guard for enabling MCP3221 code with other drivers. Ref. discussion [#645](https://github.com/grblHAL/core/discussions/645#discussioncomment-11942596). + +* MSP432P401R: fixed Trinamic I2C interface bridge, added support for one auxiliary PWM output. + +* STM32F4xx: fixed typo and added PWM port to BTT SKR 2 map. Ref. issue [#190](https://github.com/grblHAL/STM32F4xx/issues/190#issuecomment-2563926583). +Some changes for the MKS Robin Nano board map. Ref. issue [#213](https://github.com/grblHAL/STM32F4xx/issues/213). + +Plugins: + +* Misc, RGB LED strips: fixed regression. + +* Keypad: added better description for serial port pins shared with MPG. This will change the `$PIN` output to be more precise sometime in the future. + +* Motors: fixed the Trinamic I2C interface. AFAIK noone besides me uses this... + +* Trinamic: fixed regression in the TMC1230 driver. + +--- + 20250122 Core: diff --git a/driver_opts2.h b/driver_opts2.h index 5cf18fd..dbb4d27 100644 --- a/driver_opts2.h +++ b/driver_opts2.h @@ -153,18 +153,6 @@ #undef KEYPAD_TEST #undef TRINAMIC_TEST -#if KEYPAD_ENABLE == 2 && !defined(KEYPAD_STREAM) -#if USB_SERIAL_CDC -#define KEYPAD_STREAM 0 -#else -#define KEYPAD_STREAM 1 -#endif -#if (MODBUS_ENABLE & MODBUS_RTU_ENABLED) && defined(MODBUS_RTU_STREAM) && MODBUS_RTU_STREAM == MPG_STREAM -#undef KEYPAD_STREAM -#define KEYPAD_STREAM (MODBUS_RTU_STREAM + 1) -#endif -#endif - #if MPG_ENABLE && !defined(MPG_STREAM) #if USB_SERIAL_CDC #define MPG_STREAM 0 @@ -177,6 +165,20 @@ #endif #endif +#if KEYPAD_ENABLE == 2 && !defined(KEYPAD_STREAM) +#if MPG_ENABLE +#define KEYPAD_STREAM MPG_STREAM +#elif USB_SERIAL_CDC +#define KEYPAD_STREAM 0 +#else +#define KEYPAD_STREAM 1 +#endif +#if (MODBUS_ENABLE & MODBUS_RTU_ENABLED) && defined(MODBUS_RTU_STREAM) && MODBUS_RTU_STREAM == MPG_STREAM +#undef KEYPAD_STREAM +#define KEYPAD_STREAM (MODBUS_RTU_STREAM + 1) +#endif +#endif + #if defined(COPROC_RESET_PIN) && defined(COPROC_BOOT0_PIN) #define COPROC_PASSTHRU 1 #else diff --git a/grbl.h b/grbl.h index 3134db6..899f49c 100644 --- a/grbl.h +++ b/grbl.h @@ -42,7 +42,7 @@ #else #define GRBL_VERSION "1.1f" #endif -#define GRBL_BUILD 20250120 +#define GRBL_BUILD 20250124 #define GRBL_URL "https://github.com/grblHAL" diff --git a/report.c b/report.c index a193ad7..aebb071 100644 --- a/report.c +++ b/report.c @@ -354,16 +354,19 @@ static bool report_group_settings (const setting_group_detail_t *groups, const u { bool found = false; uint_fast8_t idx; - char c, *s, group[26]; + char c, *s1, *s2, group[26]; for(idx = 0; idx < n_groups; idx++) { - s = group; + s1 = s2 = group; strncpy(group, groups[idx].name, sizeof(group) - 1); - // Uppercase group name - while((c = *s)) - *s++ = CAPS(c); + // Remove spaces and uppercase group name + while((c = *s1++)) { + if(c != ' ') + *s2++ = CAPS(c); + } + *s2 = '\0'; if((found = matchhere(args, group))) { hal.stream.write(ASCII_EOL "---- "); @@ -379,10 +382,6 @@ static bool report_group_settings (const setting_group_detail_t *groups, const u status_code_t report_help (char *args) { - // Strip leading spaces - while(*args == ' ') - args++; - if(*args == '\0') { hal.stream.write("Help topics:" ASCII_EOL); diff --git a/stream.c b/stream.c index c0e4b9d..765c025 100644 --- a/stream.c +++ b/stream.c @@ -526,6 +526,11 @@ bool stream_mpg_register (const io_stream_t *stream, bool rx_only, stream_write_ return connection != NULL; } +static void report_mpg_mode (void *data) +{ + protocol_enqueue_realtime_command((char)((uint32_t)data)); +} + bool stream_mpg_enable (bool on) { static io_stream_t org_stream = { @@ -539,7 +544,7 @@ bool stream_mpg_enable (bool on) // Deny entering MPG mode if busy if(on == sys.mpg_mode || (on && (gc_state.file_run || !(state == STATE_IDLE || (state & (STATE_ALARM|STATE_ESTOP)))))) { - protocol_enqueue_realtime_command(CMD_STATUS_REPORT_ALL); + task_add_delayed(report_mpg_mode, (void *)CMD_STATUS_REPORT_ALL, 5); return false; } @@ -576,7 +581,7 @@ bool stream_mpg_enable (bool on) system_add_rt_report(Report_MPGMode); // Force a realtime status report, all reports when MPG mode active - protocol_enqueue_realtime_command(on ? CMD_STATUS_REPORT_ALL : CMD_STATUS_REPORT); + task_add_delayed(report_mpg_mode, (void *)(on ? CMD_STATUS_REPORT_ALL : CMD_STATUS_REPORT), 5); return true; }