Merge pull request #8691 from thinkyhead/bf2_clean_blocks_on_trigger

[2.0.x] Purge blocks on endstop/probe hit
This commit is contained in:
Scott Lahteine 2017-12-06 22:39:43 -06:00 committed by GitHub
commit 60e7951312
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 24 additions and 23 deletions

View File

@ -2307,11 +2307,12 @@ void kill_screen(const char* lcd_msg) {
void _lcd_ubl_map_homing() {
defer_return_to_status = true;
ubl.lcd_map_control = true; // Return to the map screen
if (lcdDrawUpdate) lcd_implementation_drawmenu_static(LCD_HEIGHT < 3 ? 0 : (LCD_HEIGHT > 4 ? 2 : 1), PSTR(MSG_LEVEL_BED_HOMING));
lcdDrawUpdate = LCDVIEW_CALL_NO_REDRAW;
if (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS])
if (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS]) {
ubl.lcd_map_control = true; // Return to the map screen
lcd_goto_screen(_lcd_ubl_output_map_lcd);
}
}
/**
@ -2341,6 +2342,19 @@ void kill_screen(const char* lcd_msg) {
void set_current_from_steppers_for_axis(const AxisEnum axis);
void sync_plan_position();
void _lcd_do_nothing() {}
void _lcd_hard_stop() {
stepper.quick_stop();
const screenFunc_t old_screen = currentScreen;
currentScreen = _lcd_do_nothing;
while (planner.movesplanned()) idle();
currentScreen = old_screen;
stepper.cleaning_buffer_counter = 0;
set_current_from_steppers_for_axis(ALL_AXES);
sync_plan_position();
gcode.refresh_cmd_timeout();
}
void _lcd_ubl_output_map_lcd() {
static int16_t step_scaler = 0;
@ -2385,15 +2399,10 @@ void kill_screen(const char* lcd_msg) {
if (lcdDrawUpdate) {
lcd_implementation_ubl_plot(x_plot, y_plot);
ubl_map_move_to_xy(); // Move to current location
if (planner.movesplanned()) // If the nozzle is already moving, cancel the move.
_lcd_hard_stop();
if (planner.movesplanned() > 1) { // if the nozzle is moving, cancel the move. There is a new location
stepper.quick_stop();
set_current_from_steppers_for_axis(ALL_AXES);
sync_plan_position();
ubl_map_move_to_xy(); // Move to new location
gcode.refresh_cmd_timeout();
}
ubl_map_move_to_xy(); // Move to new location
}
}

View File

@ -426,13 +426,11 @@ void bracket_probe_move(const bool before) {
saved_feedrate_percentage = feedrate_percentage;
feedrate_percentage = 100;
gcode.refresh_cmd_timeout();
planner.split_first_move = false;
}
else {
feedrate_mm_s = saved_feedrate_mm_s;
feedrate_percentage = saved_feedrate_percentage;
gcode.refresh_cmd_timeout();
planner.split_first_move = true;
}
}

View File

@ -103,8 +103,6 @@ float Planner::max_feedrate_mm_s[XYZE_N], // Max speeds in mm per second
uint8_t Planner::last_extruder = 0; // Respond to extruder change
#endif
bool Planner::split_first_move = true;
int16_t Planner::flow_percentage[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(100); // Extrusion factor for each extruder
float Planner::e_factor[EXTRUDERS], // The flow percentage and volumetric multiplier combine to scale E movement
@ -1452,7 +1450,7 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
position[E_AXIS] = target[E_AXIS];
// Always split the first move into two (if not homing or probing)
if (!blocks_queued() && split_first_move) {
if (!blocks_queued()) {
#define _BETWEEN(A) (position[A##_AXIS] + target[A##_AXIS]) >> 1
const int32_t between[XYZE] = { _BETWEEN(X), _BETWEEN(Y), _BETWEEN(Z), _BETWEEN(E) };
DISABLE_STEPPER_DRIVER_INTERRUPT();

View File

@ -165,7 +165,6 @@ class Planner {
travel_acceleration, // Travel acceleration mm/s^2 DEFAULT ACCELERATION for all NON printing moves. M204 MXXXX
max_jerk[XYZE], // The largest speed change requiring no acceleration
min_travel_feedrate_mm_s;
static bool split_first_move;
#if HAS_LEVELING
static bool leveling_active; // Flag that bed leveling is enabled

View File

@ -1219,12 +1219,7 @@ void Stepper::finish_and_disable() {
}
void Stepper::quick_stop() {
#if ENABLED(AUTO_BED_LEVELING_UBL) && ENABLED(ULTIPANEL)
if (!ubl.lcd_map_control)
#endif
cleaning_buffer_counter = 5000;
cleaning_buffer_counter = 5000;
DISABLE_STEPPER_DRIVER_INTERRUPT();
while (planner.blocks_queued()) planner.discard_current_block();
current_block = NULL;
@ -1250,6 +1245,7 @@ void Stepper::endstop_triggered(AxisEnum axis) {
#endif // !COREXY && !COREXZ && !COREYZ
kill_current_block();
cleaning_buffer_counter = -(BLOCK_BUFFER_SIZE - 1); // Ignore remaining blocks
}
void Stepper::report_positions() {

View File

@ -77,10 +77,11 @@ class Stepper {
static uint32_t motor_current_setting[3];
#endif
static int16_t cleaning_buffer_counter;
private:
static uint8_t last_direction_bits; // The next stepping-bits to be output
static int16_t cleaning_buffer_counter;
#if ENABLED(X_DUAL_ENDSTOPS)
static bool locked_x_motor, locked_x2_motor;