Merge pull request #8690 from thinkyhead/bf1_clean_blocks_on_trigger

[1.1.x] Purge blocks on endstop/probe hit
master
Scott Lahteine 7 years ago committed by GitHub
commit 6c328ec096
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -166,24 +166,15 @@
#if ENABLED(NEWPANEL) #if ENABLED(NEWPANEL)
/** /**
* Detect is_lcd_clicked, debounce it, and return true for cancel * If the LCD is clicked, cancel, wait for release, return true
*/ */
bool user_canceled() { bool user_canceled() {
if (!is_lcd_clicked()) return false; // Return if the button isn't pressed if (!is_lcd_clicked()) return false; // Return if the button isn't pressed
#if ENABLED(ULTRA_LCD)
lcd_setstatusPGM(PSTR("Mesh Validation Stopped."), 99); lcd_setstatusPGM(PSTR("Mesh Validation Stopped."), 99);
#if ENABLED(ULTIPANEL)
lcd_quick_feedback(); lcd_quick_feedback();
#endif #endif
safe_delay(10); // Wait for click to settle
while (!is_lcd_clicked()) idle(); // Wait for button press again?
// If the button is suddenly pressed again,
// ask the user to resolve the issue
lcd_setstatusPGM(PSTR("Release button"), 99); // will never appear...
wait_for_release(); wait_for_release();
lcd_reset_status();
return true; return true;
} }

@ -1719,7 +1719,6 @@ static void setup_for_endstop_or_probe_move() {
saved_feedrate_percentage = feedrate_percentage; saved_feedrate_percentage = feedrate_percentage;
feedrate_percentage = 100; feedrate_percentage = 100;
refresh_cmd_timeout(); refresh_cmd_timeout();
planner.split_first_move = false;
} }
static void clean_up_after_endstop_or_probe_move() { static void clean_up_after_endstop_or_probe_move() {
@ -1729,7 +1728,6 @@ static void clean_up_after_endstop_or_probe_move() {
feedrate_mm_s = saved_feedrate_mm_s; feedrate_mm_s = saved_feedrate_mm_s;
feedrate_percentage = saved_feedrate_percentage; feedrate_percentage = saved_feedrate_percentage;
refresh_cmd_timeout(); refresh_cmd_timeout();
planner.split_first_move = true;
} }
#if HAS_BED_PROBE #if HAS_BED_PROBE

@ -92,8 +92,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 uint8_t Planner::last_extruder = 0; // Respond to extruder change
#endif #endif
bool Planner::split_first_move = true;
int16_t Planner::flow_percentage[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(100); // Extrusion factor for each extruder 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 float Planner::e_factor[EXTRUDERS], // The flow percentage and volumetric multiplier combine to scale E movement
@ -1441,7 +1439,7 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
position[E_AXIS] = target[E_AXIS]; position[E_AXIS] = target[E_AXIS];
// Always split the first move into two (if not homing or probing) // 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 #define _BETWEEN(A) (position[A##_AXIS] + target[A##_AXIS]) >> 1
const int32_t between[XYZE] = { _BETWEEN(X), _BETWEEN(Y), _BETWEEN(Z), _BETWEEN(E) }; const int32_t between[XYZE] = { _BETWEEN(X), _BETWEEN(Y), _BETWEEN(Z), _BETWEEN(E) };
DISABLE_STEPPER_DRIVER_INTERRUPT(); DISABLE_STEPPER_DRIVER_INTERRUPT();

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

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

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

@ -311,8 +311,7 @@
void unified_bed_leveling::G29() { void unified_bed_leveling::G29() {
if (!settings.calc_num_meshes()) { if (!settings.calc_num_meshes()) {
SERIAL_PROTOCOLLNPGM("?You need to enable your EEPROM and initialize it"); SERIAL_PROTOCOLLNPGM("?Enable EEPROM and init with M502, M500.\n");
SERIAL_PROTOCOLLNPGM("with M502, M500, M501 in that order.\n");
return; return;
} }

@ -559,7 +559,7 @@ uint16_t max_display_update_time = 0;
if (no_reentry) return; if (no_reentry) return;
// Make this the current handler till all moves are done // Make this the current handler till all moves are done
no_reentry = true; no_reentry = true;
screenFunc_t old_screen = currentScreen; const screenFunc_t old_screen = currentScreen;
lcd_goto_screen(_lcd_synchronize); lcd_goto_screen(_lcd_synchronize);
stepper.synchronize(); stepper.synchronize();
no_reentry = false; no_reentry = false;
@ -2336,6 +2336,19 @@ void kill_screen(const char* lcd_msg) {
void set_current_from_steppers_for_axis(const AxisEnum axis); void set_current_from_steppers_for_axis(const AxisEnum axis);
void sync_plan_position(); 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();
refresh_cmd_timeout();
}
void _lcd_ubl_output_map_lcd() { void _lcd_ubl_output_map_lcd() {
static int16_t step_scaler = 0; static int16_t step_scaler = 0;
@ -2380,15 +2393,10 @@ void kill_screen(const char* lcd_msg) {
if (lcdDrawUpdate) { if (lcdDrawUpdate) {
lcd_implementation_ubl_plot(x_plot, y_plot); 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 ubl_map_move_to_xy(); // Move to new location
refresh_cmd_timeout();
}
} }
} }

Loading…
Cancel
Save