From 2bdfeb12dc1ea48d2af83a308c1f920b4eecdce1 Mon Sep 17 00:00:00 2001 From: Terje Io Date: Thu, 9 Jul 2026 21:05:29 +0200 Subject: [PATCH] Added support for MPG real time command character stream switching for RX only streams. --- changelog.md | 12 ++++++++++++ crossbar.c | 10 ++++++++++ crossbar.h | 1 + gcode.c | 14 +++++--------- grbl.h | 2 +- stream.c | 3 +++ 6 files changed, 32 insertions(+), 10 deletions(-) diff --git a/changelog.md b/changelog.md index 0d1a41d..c217a59 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,17 @@ ## grblHAL changelog +Build 20260709 + +Core: + +* Added support for MPG real time command character stream switching for RX only streams. + +Drivers: + +* RP2040: added support for optional third PIO based UART port. Added tentative map for Bolangsk board. + +--- + 20260626 Core: diff --git a/crossbar.c b/crossbar.c index 6731850..b92a6c5 100644 --- a/crossbar.c +++ b/crossbar.c @@ -139,6 +139,16 @@ axes_signals_t xbar_fn_to_axismask (pin_function_t fn) return mask; } +bool xbar_fn_for_secondary_motor (pin_function_t fn) +{ + return fn == Input_LimitX_2 || + fn == Input_LimitY_2 || + fn == Input_LimitZ_2 || + fn == Input_MotorFaultX2 || + fn == Input_MotorFaultY2 || + fn == Input_MotorFaultZ2; +} + // Sets limit signals used by homing when home signals are not available. // For internal use, called by settings.c when homing direction mask is changed. void xbar_set_homing_source (void) diff --git a/crossbar.h b/crossbar.h index e46eb42..5ba1b7b 100644 --- a/crossbar.h +++ b/crossbar.h @@ -970,6 +970,7 @@ void xbar_set_homing_source (void); limit_signals_t xbar_get_homing_source (void); limit_signals_t xbar_get_homing_source_from_cycle (axes_signals_t homing_cycle); axes_signals_t xbar_fn_to_axismask (pin_function_t id); +bool xbar_fn_for_secondary_motor (pin_function_t fn); const char *xbar_fn_to_pinname (pin_function_t id); const char *xbar_group_to_description ( pin_group_t group); const char *xbar_resolution_to_string (pin_cap_t cap); diff --git a/gcode.c b/gcode.c index 846a997..fb70084 100644 --- a/gcode.c +++ b/gcode.c @@ -3051,14 +3051,10 @@ status_code_t gc_execute_block (char *block) if((axis_words.mask || gc_block.modal.motion == MotionMode_CwArc || gc_block.modal.motion == MotionMode_CcwArc) && axis_command != AxisCommand_ToolLengthOffset) { // TLO block any axis command. #ifdef ROTATION_ENABLE - axes_signals_t r_axes, r_around; - uint_fast8_t idx_0, idx_1; - r_axes.mask = 0; // keep defined when the transform is bypassed (jog / G53) - // G53 (absolute machine override) must ignore the active WCS entirely - rotation AND offset. Without - // the AbsoluteOverride guard this block adds the g5x offset to the plane axes, so e.g. "G53 G0 X0 Y0" - // goes to the work origin instead of machine 0,0 (and false soft-limits when that lands out of travel). - // A near-zero garbage rotation (stale NVS after enabling ROTATION_ENABLE) is enough to arm it. - if(!gc_parser_flags.jog_motion && gc_block.non_modal_command != NonModal_AbsoluteOverride && (r_axes.mask = (gc_block.modal.g5x_offset.data.rotation == 0.0f ? 0 : (axis_words.mask & (r_around.mask = rotate_axes[gc_block.modal.plane_select].mask))))) { + axes_signals_t r_axes = {0}, r_around; + uint_fast8_t idx_0 = 0, idx_1 = 0; + + if(!(gc_parser_flags.jog_motion || gc_block.non_modal_command == NonModal_AbsoluteOverride) && (r_axes.mask = (gc_block.modal.g5x_offset.data.rotation == 0.0f ? 0 : (axis_words.mask & (r_around.mask = rotate_axes[gc_block.modal.plane_select].mask))))) { if(r_axes.mask != r_around.mask) { point_3d_t pos; @@ -3898,7 +3894,7 @@ status_code_t gc_execute_block (char *block) if(!check_mode) { - bool set_current; + bool set_current; tool_data_t *tool = tool_get_pending(gc_state.tool_pending, NULL); // If M6 not available or M61 commanded set new tool immediately diff --git a/grbl.h b/grbl.h index c88228f..ba387be 100644 --- a/grbl.h +++ b/grbl.h @@ -42,7 +42,7 @@ #else #define GRBL_VERSION "1.1f" #endif -#define GRBL_BUILD 20260622 +#define GRBL_BUILD 20260709 #define GRBL_URL "https://github.com/grblHAL" diff --git a/stream.c b/stream.c index a5e6f90..a094353 100644 --- a/stream.c +++ b/stream.c @@ -664,6 +664,9 @@ FLASHMEM bool stream_mpg_register (const io_stream_t *stream, bool rx_only, stre if(grbl.on_mpg_registered) grbl.on_mpg_registered(&mpg.stream, false); + if(mpg.write_char) + mpg.stream.set_enqueue_rt_handler(mpg.write_char); + return true; }