mirror of
https://github.com/grblHAL/core.git
synced 2026-02-06 09:02:33 +08:00
Fixes for backlash compensation: no longer resets current direction on a soft reset/stop, added handling of backlash setting changes per axis.
This commit is contained in:
@@ -11,7 +11,7 @@ It has been written to complement grblHAL and has features such as proper keyboa
|
||||
|
||||
---
|
||||
|
||||
Latest build date is 20220131, see the [changelog](changelog.md) for details.
|
||||
Latest build date is 20220210, see the [changelog](changelog.md) for details.
|
||||
__NOTE:__ A settings reset will be performed on an update for versions earlier than 20211122. Backup and restore of settings is recommended.
|
||||
__IMPORTANT!__ A new setting has been introduced for ganged axes motors in version 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.
|
||||
@@ -83,4 +83,4 @@ List of Supported G-Codes:
|
||||
Some [plugins](https://github.com/grblHAL/plugins) implements additional M-codes.
|
||||
|
||||
---
|
||||
2022-01-23
|
||||
2022-02-10
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
## grblHAL changelog
|
||||
|
||||
Build 20220210:
|
||||
|
||||
Core:
|
||||
|
||||
* Fixes for backlash compensation: no longer resets current direction on a soft reset/stop, added handling of backlash setting changes per axis.
|
||||
|
||||
---
|
||||
|
||||
20220209:
|
||||
|
||||
Plugins:
|
||||
|
||||
2
grbl.h
2
grbl.h
@@ -34,7 +34,7 @@
|
||||
#else
|
||||
#define GRBL_VERSION "1.1f"
|
||||
#endif
|
||||
#define GRBL_BUILD 20220204
|
||||
#define GRBL_BUILD 20220210
|
||||
|
||||
// The following symbols are set here if not already set by the compiler or in config.h
|
||||
// Do NOT change here!
|
||||
|
||||
@@ -263,9 +263,7 @@ int grbl_enter (void)
|
||||
plan_reset(); // Clear block buffer and planner variables
|
||||
st_reset(); // Clear stepper subsystem variables.
|
||||
limits_set_homing_axes(); // Set axes to be homed from settings.
|
||||
#ifdef ENABLE_BACKLASH_COMPENSATION
|
||||
mc_backlash_init(); // Init backlash configuration.
|
||||
#endif
|
||||
|
||||
// Sync cleared gcode and planner positions to current system position.
|
||||
sync_position();
|
||||
|
||||
|
||||
4
limits.c
4
limits.c
@@ -3,7 +3,7 @@
|
||||
|
||||
Part of grblHAL
|
||||
|
||||
Copyright (c) 2017-2021 Terje Io
|
||||
Copyright (c) 2017-2022 Terje Io
|
||||
Copyright (c) 2012-2016 Sungeun K. Jeon for Gnea Research LLC
|
||||
Copyright (c) 2009-2011 Simen Svale Skogsrud
|
||||
|
||||
@@ -454,7 +454,7 @@ static bool limits_homing_cycle (axes_signals_t cycle, axes_signals_t auto_squar
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_BACKLASH_COMPENSATION
|
||||
mc_backlash_init();
|
||||
mc_backlash_init(cycle);
|
||||
#endif
|
||||
sys.step_control.flags = 0; // Return step control to normal operation.
|
||||
sys.homed.mask |= cycle.mask;
|
||||
|
||||
@@ -59,22 +59,20 @@
|
||||
#ifdef ENABLE_BACKLASH_COMPENSATION
|
||||
|
||||
static float target_prev[N_AXIS];
|
||||
static axes_signals_t dir_negative, backlash_enabled;
|
||||
static axes_signals_t dir_negative = {0}, backlash_enabled = {0};
|
||||
|
||||
void mc_backlash_init (void)
|
||||
void mc_backlash_init (axes_signals_t axes)
|
||||
{
|
||||
uint_fast8_t idx = N_AXIS;
|
||||
|
||||
backlash_enabled.mask = dir_negative.value = 0;
|
||||
|
||||
do {
|
||||
if(settings.axis[--idx].backlash > 0.0001f)
|
||||
backlash_enabled.mask |= bit(idx);
|
||||
dir_negative.value |= bit(idx);
|
||||
idx--;
|
||||
if(bit_istrue(axes.mask, bit(idx))) {
|
||||
BIT_SET(backlash_enabled.mask, bit(idx), settings.axis[idx].backlash > 0.0001f);
|
||||
BIT_SET(dir_negative.mask, bit(idx), bit_isfalse(settings.homing.dir_mask.mask, bit(idx)));
|
||||
}
|
||||
} while(idx);
|
||||
|
||||
dir_negative.value ^= settings.homing.dir_mask.value;
|
||||
|
||||
mc_sync_backlash_position();
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
Part of grblHAL
|
||||
|
||||
Copyright (c) 2017-2019 Terje Io
|
||||
Copyright (c) 2017-2022 Terje Io
|
||||
Copyright (c) 2011-2016 Sungeun K. Jeon for Gnea Research LLC
|
||||
Copyright (c) 2009-2011 Simen Svale Skogsrud
|
||||
|
||||
@@ -75,7 +75,7 @@ void mc_cubic_b_spline(float *target, plan_line_data_t *pl_data, float *position
|
||||
void mc_reset (void);
|
||||
|
||||
#ifdef ENABLE_BACKLASH_COMPENSATION
|
||||
void mc_backlash_init (void);
|
||||
void mc_backlash_init (axes_signals_t axes);
|
||||
void mc_sync_backlash_position (void);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
Part of grblHAL
|
||||
|
||||
Copyright (c) 2017-2021 Terje Io
|
||||
Copyright (c) 2017-2022 Terje Io
|
||||
Copyright (c) 2011-2016 Sungeun K. Jeon for Gnea Research LLC
|
||||
Copyright (c) 2009-2011 Simen Svale Skogsrud
|
||||
Copyright (c) 2011 Jens Geisler
|
||||
@@ -32,13 +32,15 @@
|
||||
#ifdef KINEMATICS_API
|
||||
#include "kinematics.h"
|
||||
#endif
|
||||
|
||||
#ifndef MINIMUM_JUNCTION_SPEED
|
||||
#define MINIMUM_JUNCTION_SPEED 0.0f
|
||||
#endif
|
||||
#ifndef MINIMUM_FEED_RATE
|
||||
#define MINIMUM_FEED_RATE 1.0f
|
||||
#endif
|
||||
#ifdef ENABLE_BACKLASH_COMPENSATION
|
||||
void mc_sync_backlash_position (void);
|
||||
#endif
|
||||
|
||||
static plan_block_t block_buffer[BLOCK_BUFFER_SIZE]; // A ring buffer for motion instructions
|
||||
static plan_block_t *block_buffer_tail = NULL; // Pointer to the block to process now
|
||||
@@ -542,6 +544,9 @@ bool plan_buffer_line (float *target, plan_line_data_t *pl_data)
|
||||
void plan_sync_position ()
|
||||
{
|
||||
memcpy(pl.position, sys.position, sizeof(pl.position));
|
||||
#ifdef ENABLE_BACKLASH_COMPENSATION
|
||||
mc_sync_backlash_position();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
17
settings.c
17
settings.c
@@ -1106,7 +1106,12 @@ static status_code_t set_axis_setting (setting_id_t setting, float value)
|
||||
|
||||
case Setting_AxisBacklash:
|
||||
#ifdef ENABLE_BACKLASH_COMPENSATION
|
||||
settings.axis[idx].backlash = value;
|
||||
if(settings.axis[idx].backlash != value) {
|
||||
axes_signals_t axes;
|
||||
axes.mask = bit(idx);
|
||||
settings.axis[idx].backlash = value;
|
||||
mc_backlash_init(axes);
|
||||
}
|
||||
#else
|
||||
status = Status_SettingDisabled;
|
||||
#endif
|
||||
@@ -1619,7 +1624,9 @@ void settings_restore (settings_restore_t restore)
|
||||
settings.control_invert.mask &= hal.signals_cap.mask;
|
||||
settings.spindle.invert.ccw &= hal.driver_cap.spindle_dir;
|
||||
settings.spindle.invert.pwm &= hal.driver_cap.spindle_pwm_invert;
|
||||
|
||||
#ifdef ENABLE_BACKLASH_COMPENSATION
|
||||
mc_backlash_init((axes_signals_t){AXES_BITMASK});
|
||||
#endif
|
||||
settings_write_global();
|
||||
}
|
||||
|
||||
@@ -2153,10 +2160,6 @@ status_code_t settings_store_setting (setting_id_t id, char *svalue)
|
||||
if(set->save)
|
||||
set->save();
|
||||
|
||||
#ifdef ENABLE_BACKLASH_COMPENSATION
|
||||
mc_backlash_init();
|
||||
#endif
|
||||
|
||||
if(set->on_changed)
|
||||
set->on_changed(&settings);
|
||||
|
||||
@@ -2191,7 +2194,7 @@ void settings_init (void)
|
||||
#endif
|
||||
report_init();
|
||||
#ifdef ENABLE_BACKLASH_COMPENSATION
|
||||
mc_backlash_init();
|
||||
mc_backlash_init((axes_signals_t){AXES_BITMASK});
|
||||
#endif
|
||||
hal.settings_changed(&settings);
|
||||
|
||||
|
||||
@@ -363,9 +363,6 @@ static void state_await_motion_cancel (uint_fast16_t rt_exec)
|
||||
plan_reset();
|
||||
st_reset();
|
||||
sync_position();
|
||||
#ifdef ENABLE_BACKLASH_COMPENSATION
|
||||
mc_sync_backlash_position();
|
||||
#endif
|
||||
sys.suspend = false;
|
||||
}
|
||||
state_set(pending_state);
|
||||
|
||||
Reference in New Issue
Block a user