Fix for issue #209, incorrect handling of homing of more than one auto squared axis in each pass.

Error 55 will now be returned.
This commit is contained in:
Terje Io
2022-10-23 07:27:20 +02:00
parent fbef120e94
commit b0d9e9e78a
8 changed files with 34 additions and 23 deletions
+4 -3
View File
@@ -13,13 +13,14 @@ It has been written to complement grblHAL and has features such as proper keyboa
---
Latest build date is 20221021, see the [changelog](changelog.md) for details.
Latest build date is 20221023, 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.
More details in the [changelog](changelog.md).
---
Updated for latest core changes.
__NOTE:__ Arduino drivers has now been converted to Arduino libraries, [installation and compilation procedure](https://github.com/grblHAL/core/wiki/Compiling-GrblHAL) has been changed!
@@ -40,7 +41,7 @@ It is able to maintain up to 300kHz<sup>3</sup> of stable, jitter free control p
It accepts standards-compliant g-code and has been tested with the output of several CAM tools with no problems. Arcs, circles and helical motion are fully supported, as well as, all other primary g-code commands. Macro functions, variables, and some canned cycles are not supported, but we think GUIs can do a much better job at translating them into straight g-code anyhow.
Grbl includes full acceleration management with look ahead. That means the controller will look up motions into the future and plan its velocities ahead to deliver smooth acceleration and jerk-free cornering.
grblHAL includes full acceleration management with look ahead. That means the controller will look up motions into the future and plan its velocities ahead to deliver smooth acceleration and jerk-free cornering.
This is a port/rewrite of [grbl 1.1f](https://github.com/gnea/grbl) and should be compatible with GCode senders compliant with the specifications for that version. It should be possible to change default compile-time configurations if problems arise, eg. the default serial buffer sizes has been increased in some of the [drivers](https://github.com/grblHAL/drivers) provided.
@@ -86,4 +87,4 @@ List of Supported G-Codes:
Some [plugins](https://github.com/grblHAL/plugins) implements additional M-codes.
---
2022-10-21
2022-10-23
+9 -1
View File
@@ -1,5 +1,13 @@
## grblHAL changelog
Build 20221023
Core:
* Fix for issue #209, incorrect handling of homing of more than one auto squared axis in each pass. Error 55 will now be returned.
---
Build 20221022
Core:
@@ -10,7 +18,7 @@ Core:
Drivers:
Many: Fixes for incorrect code related to new spindle type property introduced in build 20221018. Updated [Web Builder](http://svn.io-engineering.com:8080/) data.
* Many: Fixes for incorrect code related to new spindle type property introduced in build 20221018. Updated [Web Builder](http://svn.io-engineering.com:8080/) data.
---
+1
View File
@@ -82,6 +82,7 @@ PROGMEM static const status_detail_t status_detail[] = {
{ Status_SettingValueOutOfRange, "Setting value is out of range." },
{ Status_SettingDisabled, "Setting is not available, possibly due to limited driver support." },
{ Status_GcodeInvalidRetractPosition, "Retract position is less than drill depth." },
{ Status_IllegalHomingConfiguration, "Attempt to home two auto squared axes at the same time." },
#if NGC_EXPRESSIONS_ENABLE
{ Status_ExpressionUknownOp, "Unknown operation found in expression." },
{ Status_ExpressionDivideByZero, "Divide by zero in expression attempted." },
+1
View File
@@ -84,6 +84,7 @@ typedef enum {
Status_SettingValueOutOfRange = 52,
Status_SettingDisabled = 53,
Status_GcodeInvalidRetractPosition = 54,
Status_IllegalHomingConfiguration = 55,
// Some error codes as defined in bdring's ESP32 port
Status_SDMountError = 60,
+1 -1
View File
@@ -34,7 +34,7 @@
#else
#define GRBL_VERSION "1.1f"
#endif
#define GRBL_BUILD 20221022
#define GRBL_BUILD 20221023
#define GRBL_URL "https://github.com/grblHAL"
+5 -9
View File
@@ -489,10 +489,8 @@ static bool limits_homing_cycle (axes_signals_t cycle, axes_signals_t auto_squar
// Perform homing cycle(s) according to configuration.
// NOTE: only one auto squared axis can be homed at a time.
bool limits_go_home (axes_signals_t cycle)
status_code_t limits_go_home (axes_signals_t cycle)
{
bool homed = false;
axes_signals_t auto_square = {0}, auto_squared = {0};
if(hal.stepper.get_ganged)
@@ -503,24 +501,22 @@ bool limits_go_home (axes_signals_t cycle)
if(auto_squared.mask) {
if(!hal.stepper.disable_motors)
return false; // Bad driver!
return Status_IllegalHomingConfiguration; // Bad driver! - should not happen.
auto_square.x = On;
while(!(auto_squared.mask & auto_square.mask))
auto_square.mask <<= 1;
if(auto_squared.mask != auto_square.mask)
return false; // Attempt at squaring more than one auto squared axis at the same time.
return Status_IllegalHomingConfiguration; // Attempt at squaring more than one auto squared axis at the same time.
if((auto_squared.mask & homing_signals_select(hal.homing.get_state(), (axes_signals_t){0}, SquaringMode_Both).mask) && !limits_pull_off(auto_square, settings.homing.pulloff * HOMING_AXIS_LOCATE_SCALAR))
return false; // Auto squaring with limit switch asserted is not allowed.
return Status_LimitsEngaged; // Auto squaring with limit switch asserted is not allowed.
}
tc_clear_tlo_reference(cycle);
homed = limits_homing_cycle(cycle, auto_square);
return homed;
return limits_homing_cycle(cycle, auto_square) ? Status_OK : Status_Unhandled;
}
// Performs a soft limit check. Called from mc_line() only. Assumes the machine has been homed,
+2 -2
View File
@@ -27,10 +27,10 @@
#include "nuts_bolts.h"
// Perform one portion of the homing cycle based on the input settings.
bool limits_go_home(axes_signals_t cycle);
status_code_t limits_go_home (axes_signals_t cycle);
// Check for soft limit violations
void limits_soft_check(float *target);
void limits_soft_check( float *target);
// Check if homing is required.
bool limits_homing_required (void);
+11 -7
View File
@@ -817,6 +817,7 @@ void mc_dwell (float seconds)
status_code_t mc_homing_cycle (axes_signals_t cycle)
{
bool home_all = cycle.mask == 0;
status_code_t homed_status = Status_OK;
memset(&sys.last_event.limits, 0, sizeof(limit_signals_t));
@@ -887,7 +888,7 @@ status_code_t mc_homing_cycle (axes_signals_t cycle)
// Perform homing routine. NOTE: Special motion case. Only system reset works.
if (!home_all) // Perform homing cycle based on mask.
limits_go_home(cycle);
homed_status = !limits_go_home(cycle);
else {
uint_fast8_t idx = 0;
@@ -897,7 +898,7 @@ status_code_t mc_homing_cycle (axes_signals_t cycle)
do {
if(settings.homing.cycle[idx].mask) {
cycle.mask = settings.homing.cycle[idx].mask;
if(!limits_go_home(cycle))
if((homed_status = limits_go_home(cycle)) != Status_OK)
break;
}
} while(++idx < N_AXIS);
@@ -914,6 +915,9 @@ status_code_t mc_homing_cycle (axes_signals_t cycle)
if(!protocol_execute_realtime()) // Check for reset and set system abort.
return Status_Unhandled; // Did not complete. Alarm state set by mc_alarm.
if(homed_status != Status_OK)
return homed_status;
if(home_all && settings.homing.flags.manual)
{
cycle.mask = AXES_BITMASK & ~sys.homing.mask;
@@ -934,14 +938,14 @@ status_code_t mc_homing_cycle (axes_signals_t cycle)
sys.report.homed = On;
status_code_t status = settings.limits.flags.hard_enabled && settings.limits.flags.check_at_init && limit_signals_merge(hal.limits.get_state()).value
? Status_LimitsEngaged
: Status_OK;
homed_status = settings.limits.flags.hard_enabled && settings.limits.flags.check_at_init && limit_signals_merge(hal.limits.get_state()).value
? Status_LimitsEngaged
: Status_OK;
if(status == Status_OK && grbl.on_homing_completed)
if(homed_status == Status_OK && grbl.on_homing_completed)
grbl.on_homing_completed();
return status;
return homed_status;
}
// Perform tool length probe cycle. Requires probe switch.