Arduino IDE compatibility and minor homing fixes
- Added an include in the right spot, if a user tries to compile and upload Grbl through the Arduino IDE with the old way. - Fixed a minor bug with homing max travel calculations. It was causing simultaneous axes homing to move slow than it did before.
This commit is contained in:
parent
85b0c7a8b4
commit
76730176da
@ -82,5 +82,5 @@ List of Supported G-Codes in Grbl v0.9
|
||||
-------------
|
||||
Grbl is an open-source project and fueled by the free-time of our intrepid administrators and altruistic users. If you'd like to donate, all proceeds will be used to help fund supporting hardware and testing equipment. Thank you!
|
||||
|
||||
[![Donate](https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=EBQWAWQAAT878)
|
||||
[![Donate](https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=CUGXJHXA36BYW)
|
||||
|
||||
|
@ -27,6 +27,7 @@
|
||||
|
||||
#ifndef config_h
|
||||
#define config_h
|
||||
#include "grbl.h" // For Arduino IDE compatibility.
|
||||
|
||||
|
||||
// Default settings. Used when resetting EEPROM. Change to desired name in defaults.h
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
// Grbl versioning system
|
||||
#define GRBL_VERSION "0.9i"
|
||||
#define GRBL_VERSION_BUILD "20150223"
|
||||
#define GRBL_VERSION_BUILD "20150302"
|
||||
|
||||
// Define standard libraries used by Grbl.
|
||||
#include <avr/io.h>
|
||||
|
@ -134,7 +134,8 @@ void limits_go_home(uint8_t cycle_mask)
|
||||
float target[N_AXIS];
|
||||
|
||||
uint8_t limit_pin[N_AXIS], step_pin[N_AXIS];
|
||||
float max_travel;
|
||||
|
||||
float max_travel = 0.0;
|
||||
for (idx=0; idx<N_AXIS; idx++) {
|
||||
// Initialize limit and step pin masks
|
||||
limit_pin[idx] = get_limit_pin_mask(idx);
|
||||
@ -142,6 +143,13 @@ void limits_go_home(uint8_t cycle_mask)
|
||||
#ifdef COREXY
|
||||
if ((idx==A_MOTOR)||(idx==B_MOTOR)) { step_pin[idx] = (get_step_pin_mask(X_AXIS)|get_step_pin_mask(Y_AXIS)); }
|
||||
#endif
|
||||
|
||||
if (bit_istrue(cycle_mask,bit(idx))) {
|
||||
// Set target based on max_travel setting. Ensure homing switches engaged with search scalar.
|
||||
// NOTE: settings.max_travel[] is stored as a negative value.
|
||||
max_travel = max(max_travel,(-HOMING_AXIS_SEARCH_SCALAR)*settings.max_travel[idx]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
plan_reset(); // Reset planner buffer to zero planner current position and to clear previous motions.
|
||||
@ -153,25 +161,22 @@ void limits_go_home(uint8_t cycle_mask)
|
||||
else { invert_pin = !approach; }
|
||||
|
||||
// Initialize and declare variables needed for homing routine.
|
||||
uint8_t n_active_axis = 0;
|
||||
uint8_t axislock = 0;
|
||||
|
||||
uint8_t n_active_axis = 0;
|
||||
system_convert_array_steps_to_mpos(target,sys.position);
|
||||
for (idx=0; idx<N_AXIS; idx++) {
|
||||
// Set target location for active axes and setup computation for homing rate.
|
||||
if (bit_istrue(cycle_mask,bit(idx))) {
|
||||
n_active_axis++;
|
||||
// Set target based on max_travel setting. Ensure homing switches engaged with search scalar.
|
||||
// NOTE: settings.max_travel[] is stored as a negative value.
|
||||
max_travel = (-HOMING_AXIS_SEARCH_SCALAR)*settings.max_travel[idx];
|
||||
if (bit_istrue(settings.homing_dir_mask,bit(idx))) { max_travel = -max_travel; }
|
||||
if (!approach) { max_travel = -max_travel; }
|
||||
target[idx] += max_travel;
|
||||
|
||||
// Apply axislock to the step port pins active in this cycle.
|
||||
axislock |= step_pin[idx];
|
||||
}
|
||||
|
||||
// Apply axislock to the step port pins active in this cycle.
|
||||
if (bit_istrue(cycle_mask,bit(idx))) { axislock |= step_pin[idx]; }
|
||||
}
|
||||
}
|
||||
homing_rate *= sqrt(n_active_axis); // [sqrt(N_AXIS)] Adjust so individual axes all move at homing rate.
|
||||
sys.homing_axis_lock = axislock;
|
||||
|
||||
@ -197,9 +202,9 @@ void limits_go_home(uint8_t cycle_mask)
|
||||
}
|
||||
sys.homing_axis_lock = axislock;
|
||||
st_prep_buffer(); // Check and prep segment buffer. NOTE: Should take no longer than 200us.
|
||||
// Check only for user reset. No time to run protocol_execute_realtime() in this loop.
|
||||
|
||||
// Exit routines: User abort homing and alarm upon safety door or no limit switch found.
|
||||
// No time to run protocol_execute_realtime() in this loop.
|
||||
if (sys.rt_exec_state & (EXEC_SAFETY_DOOR | EXEC_RESET | EXEC_CYCLE_STOP)) {
|
||||
if (sys.rt_exec_state & (EXEC_SAFETY_DOOR | EXEC_CYCLE_STOP)) { mc_reset(); }
|
||||
protocol_execute_realtime();
|
||||
|
@ -206,6 +206,10 @@ void protocol_execute_realtime()
|
||||
// to do what is needed before resetting, like killing the incoming stream. The
|
||||
// same could be said about soft limits. While the position is not lost, the incoming
|
||||
// stream could be still engaged and cause a serious crash if it continues afterwards.
|
||||
// if (sys.rt_exec_state & EXEC_STATUS_REPORT) {
|
||||
// report_realtime_status();
|
||||
// bit_false_atomic(sys.rt_exec_state,EXEC_STATUS_REPORT);
|
||||
// }
|
||||
} while (bit_isfalse(sys.rt_exec_state,EXEC_RESET));
|
||||
}
|
||||
bit_false_atomic(sys.rt_exec_alarm,0xFF); // Clear all alarm flags
|
||||
|
Loading…
Reference in New Issue
Block a user