From b6e43d6c194fa0f830ff3987a4aa1cd78b310dd6 Mon Sep 17 00:00:00 2001 From: Terje Io Date: Tue, 11 Apr 2023 20:47:45 +0200 Subject: [PATCH] Fix for issue #236, dual axis offsets. Changes to allow use of M4 for laser capable spindles in laser mode even if direction control is not available. --- README.md | 2 +- changelog.md | 23 ++++++++++++++++++++++- gcode.c | 4 ++-- grbl.h | 2 +- machine_limits.c | 4 ++-- stream.c | 9 +++++++++ stream.h | 1 + 7 files changed, 38 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index d0d5cc1..600f38c 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ It has been written to complement grblHAL and has features such as proper keyboa --- -Latest build date is 20230311, see the [changelog](changelog.md) for details. +Latest build date is 20230411, see the [changelog](changelog.md) for details. __NOTE:__ A settings reset will be performed on an update of builds earlier than 20230125. Backup and restore of settings is recommended. __IMPORTANT!__ A new setting has been introduced for ganged axes motors in build 20211121. I have only bench tested this for a couple of drivers, correct function should be verified after updating by those who have more than three motors configured. diff --git a/changelog.md b/changelog.md index 9e9712c..3128c82 100644 --- a/changelog.md +++ b/changelog.md @@ -1,10 +1,31 @@ ## grblHAL changelog +Build 20230411 + +Core: + +* Fix for issue #236, dual axis offsets. +__NOTE:__ handling of negative offset values has changed. The primary motor will now be run to correct for negative offset values by moving away from the limit switch. +Prior to this build the secondary motor was run to move towards the limit switch for negative values. +* Changes to allow use of M4 for laser capable spindles in laser mode even if direction control is not available. + +Drivers: + +* STM32F4xx: pin mappings fix for [BTT SKR Pro 1.x](https://github.com/grblHAL/STM32F4xx/blob/master/Inc/btt_skr_pro_v1_1_map.h) to avoid IRQ conflicts. + +Plugins: + +* Networking: improved handling of .gz compressed files by httpd daemon. + +* Webui: more fixes for [issue #10](https://github.com/grblHAL/Plugin_WebUI/issues/10), cannot download any file from local FS but preferences.json. + +--- + 20230409 Plugins: -* Networking: fix for incorrect header returned for plain .gz files. +* Networking: fix for incorrect header returned by httpd daemon for plain .gz files. * Webui: fixes for [issue #10](https://github.com/grblHAL/Plugin_WebUI/issues/10), cannot download any file from local FS but preferences.json. diff --git a/gcode.c b/gcode.c index d8c40ab..df6851f 100644 --- a/gcode.c +++ b/gcode.c @@ -1608,10 +1608,10 @@ status_code_t gc_execute_block (char *block) uint_fast8_t idx = N_SYS_SPINDLE; do { idx--; - if(spindle_is_enabled(idx) && !spindle_get(idx)->cap.direction) + if(spindle_is_enabled(idx) && !(spindle_get(idx)->cap.direction || spindle_get(idx)->cap.laser)) FAIL(Status_GcodeUnsupportedCommand); } while(idx); - } else if(!gc_block.spindle->cap.direction) + } else if(!(gc_block.spindle->cap.direction || gc_block.spindle->cap.laser)) FAIL(Status_GcodeUnsupportedCommand); } diff --git a/grbl.h b/grbl.h index 59e180c..02d743a 100644 --- a/grbl.h +++ b/grbl.h @@ -42,7 +42,7 @@ #else #define GRBL_VERSION "1.1f" #endif -#define GRBL_BUILD 20230401 +#define GRBL_BUILD 20230411 #define GRBL_URL "https://github.com/grblHAL" diff --git a/machine_limits.c b/machine_limits.c index f7d4d89..0b5cb99 100644 --- a/machine_limits.c +++ b/machine_limits.c @@ -459,8 +459,8 @@ static bool limits_homing_cycle (axes_signals_t cycle, axes_signals_t auto_squar // Pull off B motor to compensate for switch inaccuracy when configured. if(auto_square.mask && settings.axis[dual_motor_axis].dual_axis_offset != 0.0f) { - hal.stepper.disable_motors(auto_square, SquaringMode_A); - if(!limits_pull_off(auto_square, settings.axis[dual_motor_axis].dual_axis_offset)) + hal.stepper.disable_motors(auto_square, settings.axis[dual_motor_axis].dual_axis_offset < 0.0f ? SquaringMode_B : SquaringMode_A); + if(!limits_pull_off(auto_square, fabs(settings.axis[dual_motor_axis].dual_axis_offset))) return false; hal.stepper.disable_motors((axes_signals_t){0}, SquaringMode_Both); } diff --git a/stream.c b/stream.c index aac6cdb..c7caaf0 100644 --- a/stream.c +++ b/stream.c @@ -565,6 +565,15 @@ void debug_write (const char *s) } } +void debug_writeln (const char *s) +{ + if(dbg_write) { + dbg_write(s); + dbg_write(ASCII_EOL); + while(hal.debug.get_tx_buffer_count()); // Wait until message is delivered + } +} + static bool debug_claim_stream (io_stream_properties_t const *stream) { io_stream_t const *claimed = NULL; diff --git a/stream.h b/stream.h index c7b7a1c..fa7678d 100644 --- a/stream.h +++ b/stream.h @@ -342,6 +342,7 @@ io_stream_t const *stream_open_instance (uint8_t instance, uint32_t baud_rate, s #ifdef DEBUGOUT void debug_write (const char *s); +void debug_writeln (const char *s); bool debug_stream_init (void); #endif