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
   #if ENABLED(NEWPANEL)
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
     bool user_canceled() {
171
     bool user_canceled() {
172
       if (!is_lcd_clicked()) return false; // Return if the button isn't pressed
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
         lcd_quick_feedback();
175
         lcd_quick_feedback();
177
       #endif
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
       wait_for_release();
177
       wait_for_release();
186
-      lcd_reset_status();
187
       return true;
178
       return true;
188
     }
179
     }
189
 
180
 

+ 0
- 2
Marlin/Marlin_main.cpp View File

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

+ 1
- 3
Marlin/planner.cpp View File

92
   uint8_t Planner::last_extruder = 0;     // Respond to extruder change
92
   uint8_t Planner::last_extruder = 0;     // Respond to extruder change
93
 #endif
93
 #endif
94
 
94
 
95
-bool Planner::split_first_move = true;
96
-
97
 int16_t Planner::flow_percentage[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(100); // Extrusion factor for each extruder
95
 int16_t Planner::flow_percentage[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(100); // Extrusion factor for each extruder
98
 
96
 
99
 float Planner::e_factor[EXTRUDERS],               // The flow percentage and volumetric multiplier combine to scale E movement
97
 float Planner::e_factor[EXTRUDERS],               // The flow percentage and volumetric multiplier combine to scale E movement
1441
     position[E_AXIS] = target[E_AXIS];
1439
     position[E_AXIS] = target[E_AXIS];
1442
 
1440
 
1443
   // Always split the first move into two (if not homing or probing)
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
     #define _BETWEEN(A) (position[A##_AXIS] + target[A##_AXIS]) >> 1
1443
     #define _BETWEEN(A) (position[A##_AXIS] + target[A##_AXIS]) >> 1
1446
     const int32_t between[XYZE] = { _BETWEEN(X), _BETWEEN(Y), _BETWEEN(Z), _BETWEEN(E) };
1444
     const int32_t between[XYZE] = { _BETWEEN(X), _BETWEEN(Y), _BETWEEN(Z), _BETWEEN(E) };
1447
     DISABLE_STEPPER_DRIVER_INTERRUPT();
1445
     DISABLE_STEPPER_DRIVER_INTERRUPT();

+ 0
- 1
Marlin/planner.h View File

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

+ 2
- 6
Marlin/stepper.cpp View File

1224
 }
1224
 }
1225
 
1225
 
1226
 void Stepper::quick_stop() {
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
   DISABLE_STEPPER_DRIVER_INTERRUPT();
1228
   DISABLE_STEPPER_DRIVER_INTERRUPT();
1234
   while (planner.blocks_queued()) planner.discard_current_block();
1229
   while (planner.blocks_queued()) planner.discard_current_block();
1235
   current_block = NULL;
1230
   current_block = NULL;
1255
   #endif // !COREXY && !COREXZ && !COREYZ
1250
   #endif // !COREXY && !COREXZ && !COREYZ
1256
 
1251
 
1257
   kill_current_block();
1252
   kill_current_block();
1253
+  cleaning_buffer_counter = -(BLOCK_BUFFER_SIZE - 1); // Ignore remaining blocks
1258
 }
1254
 }
1259
 
1255
 
1260
 void Stepper::report_positions() {
1256
 void Stepper::report_positions() {

+ 2
- 1
Marlin/stepper.h View File

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

+ 1
- 2
Marlin/ubl_G29.cpp View File

311
   void unified_bed_leveling::G29() {
311
   void unified_bed_leveling::G29() {
312
 
312
 
313
     if (!settings.calc_num_meshes()) {
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
       return;
315
       return;
317
     }
316
     }
318
 
317
 

+ 17
- 9
Marlin/ultralcd.cpp View File

559
     if (no_reentry) return;
559
     if (no_reentry) return;
560
     // Make this the current handler till all moves are done
560
     // Make this the current handler till all moves are done
561
     no_reentry = true;
561
     no_reentry = true;
562
-    screenFunc_t old_screen = currentScreen;
562
+    const screenFunc_t old_screen = currentScreen;
563
     lcd_goto_screen(_lcd_synchronize);
563
     lcd_goto_screen(_lcd_synchronize);
564
     stepper.synchronize();
564
     stepper.synchronize();
565
     no_reentry = false;
565
     no_reentry = false;
2336
     void set_current_from_steppers_for_axis(const AxisEnum axis);
2336
     void set_current_from_steppers_for_axis(const AxisEnum axis);
2337
     void sync_plan_position();
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
     void _lcd_ubl_output_map_lcd() {
2352
     void _lcd_ubl_output_map_lcd() {
2340
       static int16_t step_scaler = 0;
2353
       static int16_t step_scaler = 0;
2341
 
2354
 
2380
       if (lcdDrawUpdate) {
2393
       if (lcdDrawUpdate) {
2381
         lcd_implementation_ubl_plot(x_plot, y_plot);
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