Browse Source

Merge pull request #8690 from thinkyhead/bf1_clean_blocks_on_trigger

[1.1.x] Purge blocks on endstop/probe hit
Scott Lahteine 7 years ago
parent
commit
6c328ec096
No account linked to committer's email address

+ 3
- 12
Marlin/G26_Mesh_Validation_Tool.cpp View File

@@ -166,24 +166,15 @@
166 166
   #if ENABLED(NEWPANEL)
167 167
 
168 168
     /**
169
-     * Detect is_lcd_clicked, debounce it, and return true for cancel
169
+     * If the LCD is clicked, cancel, wait for release, return true
170 170
      */
171 171
     bool user_canceled() {
172 172
       if (!is_lcd_clicked()) return false; // Return if the button isn't pressed
173
-
174
-      #if ENABLED(ULTRA_LCD)
175
-        lcd_setstatusPGM(PSTR("Mesh Validation Stopped."), 99);
173
+      lcd_setstatusPGM(PSTR("Mesh Validation Stopped."), 99);
174
+      #if ENABLED(ULTIPANEL)
176 175
         lcd_quick_feedback();
177 176
       #endif
178
-
179
-      safe_delay(10);                      // Wait for click to settle
180
-      while (!is_lcd_clicked()) idle();    // Wait for button press again?
181
-
182
-      // If the button is suddenly pressed again,
183
-      // ask the user to resolve the issue
184
-      lcd_setstatusPGM(PSTR("Release button"), 99); // will never appear...
185 177
       wait_for_release();
186
-      lcd_reset_status();
187 178
       return true;
188 179
     }
189 180
 

+ 0
- 2
Marlin/Marlin_main.cpp View File

@@ -1719,7 +1719,6 @@ static void setup_for_endstop_or_probe_move() {
1719 1719
   saved_feedrate_percentage = feedrate_percentage;
1720 1720
   feedrate_percentage = 100;
1721 1721
   refresh_cmd_timeout();
1722
-  planner.split_first_move = false; 
1723 1722
 }
1724 1723
 
1725 1724
 static void clean_up_after_endstop_or_probe_move() {
@@ -1729,7 +1728,6 @@ static void clean_up_after_endstop_or_probe_move() {
1729 1728
   feedrate_mm_s = saved_feedrate_mm_s;
1730 1729
   feedrate_percentage = saved_feedrate_percentage;
1731 1730
   refresh_cmd_timeout();
1732
-  planner.split_first_move = true; 
1733 1731
 }
1734 1732
 
1735 1733
 #if HAS_BED_PROBE

+ 1
- 3
Marlin/planner.cpp View File

@@ -92,8 +92,6 @@ float Planner::max_feedrate_mm_s[XYZE_N], // Max speeds in mm per second
92 92
   uint8_t Planner::last_extruder = 0;     // Respond to extruder change
93 93
 #endif
94 94
 
95
-bool Planner::split_first_move = true;
96
-
97 95
 int16_t Planner::flow_percentage[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(100); // Extrusion factor for each extruder
98 96
 
99 97
 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
1441 1439
     position[E_AXIS] = target[E_AXIS];
1442 1440
 
1443 1441
   // Always split the first move into two (if not homing or probing)
1444
-  if (!blocks_queued() && split_first_move) {
1442
+  if (!blocks_queued()) {
1445 1443
     #define _BETWEEN(A) (position[A##_AXIS] + target[A##_AXIS]) >> 1
1446 1444
     const int32_t between[XYZE] = { _BETWEEN(X), _BETWEEN(Y), _BETWEEN(Z), _BETWEEN(E) };
1447 1445
     DISABLE_STEPPER_DRIVER_INTERRUPT();

+ 0
- 1
Marlin/planner.h View File

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

+ 2
- 6
Marlin/stepper.cpp View File

@@ -1224,12 +1224,7 @@ void Stepper::finish_and_disable() {
1224 1224
 }
1225 1225
 
1226 1226
 void Stepper::quick_stop() {
1227
-  #if ENABLED(AUTO_BED_LEVELING_UBL) && ENABLED(ULTIPANEL)
1228
-    if (!ubl.lcd_map_control)
1229
-      cleaning_buffer_counter = 5000;
1230
-  #else
1231
-    cleaning_buffer_counter = 5000;
1232
-  #endif
1227
+  cleaning_buffer_counter = 5000;
1233 1228
   DISABLE_STEPPER_DRIVER_INTERRUPT();
1234 1229
   while (planner.blocks_queued()) planner.discard_current_block();
1235 1230
   current_block = NULL;
@@ -1255,6 +1250,7 @@ void Stepper::endstop_triggered(AxisEnum axis) {
1255 1250
   #endif // !COREXY && !COREXZ && !COREYZ
1256 1251
 
1257 1252
   kill_current_block();
1253
+  cleaning_buffer_counter = -(BLOCK_BUFFER_SIZE - 1); // Ignore remaining blocks
1258 1254
 }
1259 1255
 
1260 1256
 void Stepper::report_positions() {

+ 2
- 1
Marlin/stepper.h View File

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

+ 1
- 2
Marlin/ubl_G29.cpp View File

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

+ 17
- 9
Marlin/ultralcd.cpp View File

@@ -559,7 +559,7 @@ uint16_t max_display_update_time = 0;
559 559
     if (no_reentry) return;
560 560
     // Make this the current handler till all moves are done
561 561
     no_reentry = true;
562
-    screenFunc_t old_screen = currentScreen;
562
+    const screenFunc_t old_screen = currentScreen;
563 563
     lcd_goto_screen(_lcd_synchronize);
564 564
     stepper.synchronize();
565 565
     no_reentry = false;
@@ -2336,6 +2336,19 @@ void kill_screen(const char* lcd_msg) {
2336 2336
     void set_current_from_steppers_for_axis(const AxisEnum axis);
2337 2337
     void sync_plan_position();
2338 2338
 
2339
+    void _lcd_do_nothing() {}
2340
+    void _lcd_hard_stop() {
2341
+      stepper.quick_stop();
2342
+      const screenFunc_t old_screen = currentScreen;
2343
+      currentScreen = _lcd_do_nothing;
2344
+      while (planner.movesplanned()) idle();
2345
+      currentScreen = old_screen;
2346
+      stepper.cleaning_buffer_counter = 0;
2347
+      set_current_from_steppers_for_axis(ALL_AXES);
2348
+      sync_plan_position();
2349
+      refresh_cmd_timeout();
2350
+    }
2351
+
2339 2352
     void _lcd_ubl_output_map_lcd() {
2340 2353
       static int16_t step_scaler = 0;
2341 2354
 
@@ -2380,15 +2393,10 @@ void kill_screen(const char* lcd_msg) {
2380 2393
       if (lcdDrawUpdate) {
2381 2394
         lcd_implementation_ubl_plot(x_plot, y_plot);
2382 2395
 
2383
-        ubl_map_move_to_xy(); // Move to current location
2396
+        if (planner.movesplanned()) // If the nozzle is already moving, cancel the move.
2397
+          _lcd_hard_stop();
2384 2398
 
2385
-        if (planner.movesplanned() > 1) { // if the nozzle is moving, cancel the move.  There is a new location
2386
-          stepper.quick_stop();
2387
-          set_current_from_steppers_for_axis(ALL_AXES);
2388
-          sync_plan_position();
2389
-          ubl_map_move_to_xy(); // Move to new location
2390
-          refresh_cmd_timeout();
2391
-        }
2399
+        ubl_map_move_to_xy();       // Move to new location
2392 2400
       }
2393 2401
     }
2394 2402
 

Loading…
Cancel
Save