Untested! Soft limits, max travel, homing changes, new settings.
- WARNING: Completely untested. Will later when there is time. Settings WILL be overwritten, as there are new settings. - Soft limits installed. Homing must be enabled for soft limits to work correctly. Errors out much like a hard limit, locking out everything and bringing up the alarm mode. Only difference is it forces a feed hold before doing so. Position is not lost. - IMPORTANT: Homing had to be updated so that soft limits work better with less CPU overhead. When homing completes, all axes are assumed to exist in negative space. If your limit switch is other side, the homing cycle with set this axis location to the max travel value, rather than zero. - Update mc_line() to accept an array, rather than individual variables. - Added an mc_auto_cycle_start() function handle this feature. Organization only. -
This commit is contained in:
28
limits.c
28
limits.c
@@ -3,7 +3,7 @@
|
||||
Part of Grbl
|
||||
|
||||
Copyright (c) 2009-2011 Simen Svale Skogsrud
|
||||
Copyright (c) 2012 Sungeun K. Jeon
|
||||
Copyright (c) 2012-2013 Sungeun K. Jeon
|
||||
|
||||
Grbl is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -244,3 +244,29 @@ void limits_go_home()
|
||||
|
||||
st_go_idle(); // Call main stepper shutdown routine.
|
||||
}
|
||||
|
||||
|
||||
// Performs a soft limit check. Called from mc_line() only. Assumes the machine has been homed,
|
||||
// and the workspace volume is in all negative space.
|
||||
void limits_soft_check(float *target)
|
||||
{
|
||||
if ( target[X_AXIS] > 0 || target[X_AXIS] < -settings.max_travel[X_AXIS] ||
|
||||
target[Y_AXIS] > 0 || target[Y_AXIS] < -settings.max_travel[Y_AXIS] ||
|
||||
target[Z_AXIS] > 0 || target[Z_AXIS] < -settings.max_travel[Z_AXIS] ) {
|
||||
|
||||
// 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
|
||||
// enter alarm mode.
|
||||
if (sys.state == STATE_CYCLE) {
|
||||
st_feed_hold();
|
||||
while (sys.state == STATE_HOLD) {
|
||||
protocol_execute_runtime();
|
||||
if (sys.abort) { return; }
|
||||
}
|
||||
}
|
||||
|
||||
mc_reset(); // Issue system reset and ensure spindle and coolant are shutdown.
|
||||
sys.execute |= EXEC_CRIT_EVENT; // Indicate soft limit critical event
|
||||
protocol_execute_runtime(); // Execute to enter critical event loop and system abort
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user