Soft limit error bug fix.

- Soft limit errors were stuck in a feed hold without notifying the
user why it was in a hold. When resumed, the soft limit error would
kick in. Issue should be fixed to behave as intended. To automatically
hold and issue a soft limit alarm once the machine has come to a stop.
This commit is contained in:
Sonny Jeon 2016-03-11 09:42:07 -07:00
parent 111d28dc9a
commit 81adc202cd
6 changed files with 28 additions and 7 deletions

View File

@ -1,3 +1,23 @@
----------------
Date: 2016-03-04
Author: Sonny Jeon
Subject: Applied master branch bug fixes.
- Planner was under-estimating maximum speeds through straight
junctions in certain cases. The calculations have been updated to be
more accurate.
- Strange sizeof() bug in the most recent releases. Manifested as an
alarm upon a power up even when homing was disabled. Fixed by declaring
sizeof() with struct types, rather than variable names, even though
they were validated to give the same value.
- Spindle speed zero should disable the spindle. Now fixed.
- New configuration option for inverting certain limit pins. Handy for
mixed NO and NC switch machines. See config.h for details.
---------------- ----------------
Date: 2015-11-09 Date: 2015-11-09
Author: Sonny Jeon Author: Sonny Jeon

View File

@ -23,7 +23,7 @@
// Grbl versioning system // Grbl versioning system
#define GRBL_VERSION "1.0c" #define GRBL_VERSION "1.0c"
#define GRBL_VERSION_BUILD "20160304" #define GRBL_VERSION_BUILD "20160311"
// Define standard libraries used by Grbl. // Define standard libraries used by Grbl.
#include <avr/io.h> #include <avr/io.h>

View File

@ -317,23 +317,22 @@ void limits_go_home(uint8_t cycle_mask)
void limits_soft_check(float *target) void limits_soft_check(float *target)
{ {
uint8_t idx; uint8_t idx;
uint8_t soft_limit_error = false;
for (idx=0; idx<N_AXIS; idx++) { for (idx=0; idx<N_AXIS; idx++) {
#ifdef HOMING_FORCE_SET_ORIGIN #ifdef HOMING_FORCE_SET_ORIGIN
// When homing forced set origin is enabled, soft limits checks need to account for directionality. // When homing forced set origin is enabled, soft limits checks need to account for directionality.
// NOTE: max_travel is stored as negative // NOTE: max_travel is stored as negative
if (bit_istrue(settings.homing_dir_mask,bit(idx))) { if (bit_istrue(settings.homing_dir_mask,bit(idx))) {
if (target[idx] < 0 || target[idx] > -settings.max_travel[idx]) { soft_limit_error = true; } if (target[idx] < 0 || target[idx] > -settings.max_travel[idx]) { sys.soft_limit = true; }
} else { } else {
if (target[idx] > 0 || target[idx] < settings.max_travel[idx]) { soft_limit_error = true; } if (target[idx] > 0 || target[idx] < settings.max_travel[idx]) { sys.soft_limit = true; }
} }
#else #else
// NOTE: max_travel is stored as negative // NOTE: max_travel is stored as negative
if (target[idx] > 0 || target[idx] < settings.max_travel[idx]) { soft_limit_error = true; } if (target[idx] > 0 || target[idx] < settings.max_travel[idx]) { sys.soft_limit = true; }
#endif #endif
if (soft_limit_error) { if (sys.soft_limit) {
// Force feed hold if cycle is active. All buffered blocks are guaranteed to be within // Force feed hold if cycle is active. All buffered blocks are guaranteed to be within
// workspace volume so just come to a controlled stop so position is not lost. When complete // workspace volume so just come to a controlled stop so position is not lost. When complete
// enter alarm mode. // enter alarm mode.

View File

@ -80,6 +80,7 @@ int main(void)
sys_rt_exec_state = 0; sys_rt_exec_state = 0;
sys_rt_exec_alarm = 0; sys_rt_exec_alarm = 0;
sys.suspend = false; sys.suspend = false;
sys.soft_limit = false;
// Start Grbl main loop. Processes program inputs and executes them. // Start Grbl main loop. Processes program inputs and executes them.
protocol_main_loop(); protocol_main_loop();

View File

@ -389,7 +389,7 @@ void protocol_exec_rt_system()
// NOTE: Bresenham algorithm variables are still maintained through both the planner and stepper // NOTE: Bresenham algorithm variables are still maintained through both the planner and stepper
// cycle reinitializations. The stepper path should continue exactly as if nothing has happened. // cycle reinitializations. The stepper path should continue exactly as if nothing has happened.
// NOTE: EXEC_CYCLE_STOP is set by the stepper subsystem when a cycle or feed hold completes. // NOTE: EXEC_CYCLE_STOP is set by the stepper subsystem when a cycle or feed hold completes.
if (sys.state & (STATE_HOLD | STATE_SAFETY_DOOR)) { if ((sys.state & (STATE_HOLD | STATE_SAFETY_DOOR)) && !(sys.soft_limit)) {
// Hold complete. Set to indicate ready to resume. Remain in HOLD or DOOR states until user // Hold complete. Set to indicate ready to resume. Remain in HOLD or DOOR states until user
// has issued a resume command or reset. // has issued a resume command or reset.
plan_cycle_reinitialize(); plan_cycle_reinitialize();

View File

@ -96,6 +96,7 @@ typedef struct {
uint8_t abort; // System abort flag. Forces exit back to main loop for reset. uint8_t abort; // System abort flag. Forces exit back to main loop for reset.
uint8_t state; // Tracks the current state of Grbl. uint8_t state; // Tracks the current state of Grbl.
uint8_t suspend; // System suspend bitflag variable that manages holds, cancels, and safety door. uint8_t suspend; // System suspend bitflag variable that manages holds, cancels, and safety door.
uint8_t soft_limit; // Tracks soft limit errors for the state machine (Boolean)
uint8_t step_control; uint8_t step_control;
int32_t position[N_AXIS]; // Real-time machine (aka home) position vector in steps. int32_t position[N_AXIS]; // Real-time machine (aka home) position vector in steps.