Browse Source

Add quickstop_stepper to update current position with stepper.quick_stop()

Scott Lahteine 8 years ago
parent
commit
834ad14c8d
5 changed files with 12 additions and 23 deletions
  1. 1
    3
      Marlin/Marlin.h
  2. 2
    1
      Marlin/MarlinSerial.cpp
  3. 7
    11
      Marlin/Marlin_main.cpp
  4. 1
    4
      Marlin/endstops.cpp
  5. 1
    4
      Marlin/ultralcd.cpp

+ 1
- 3
Marlin/Marlin.h View File

@@ -230,9 +230,7 @@ void ok_to_send();
230 230
 void reset_bed_level();
231 231
 void kill(const char*);
232 232
 
233
-#if DISABLED(DELTA) && DISABLED(SCARA)
234
-  void set_current_position_from_planner();
235
-#endif
233
+void quickstop_stepper();
236 234
 
237 235
 #if ENABLED(FILAMENT_RUNOUT_SENSOR)
238 236
   void handle_filament_runout();

+ 2
- 1
Marlin/MarlinSerial.cpp View File

@@ -450,7 +450,8 @@ MarlinSerial customizedSerial;
450 450
       case state_M41:
451 451
         switch (c) {
452 452
           case '0':
453
-            { state = state_RESET; stepper.quick_stop(); }
453
+            state = state_RESET;
454
+            quickstop_stepper();
454 455
             break;
455 456
           case ';':
456 457
             state = state_IGNORE;

+ 7
- 11
Marlin/Marlin_main.cpp View File

@@ -1109,7 +1109,7 @@ inline void get_serial_commands() {
1109 1109
         // If command was e-stop process now
1110 1110
         if (strcmp(command, "M108") == 0) wait_for_heatup = false;
1111 1111
         if (strcmp(command, "M112") == 0) kill(PSTR(MSG_KILLED));
1112
-        if (strcmp(command, "M410") == 0) stepper.quick_stop();
1112
+        if (strcmp(command, "M410") == 0) { quickstop_stepper(); }
1113 1113
       #endif
1114 1114
 
1115 1115
       #if defined(NO_TIMEOUTS) && NO_TIMEOUTS > 0
@@ -4556,12 +4556,7 @@ inline void gcode_M105() {
4556 4556
    * This will stop the carriages mid-move, so most likely they
4557 4557
    * will be out of sync with the stepper position after this.
4558 4558
    */
4559
-  inline void gcode_M410() {
4560
-    stepper.quick_stop();
4561
-    #if DISABLED(DELTA) && DISABLED(SCARA)
4562
-      set_current_position_from_planner();
4563
-    #endif
4564
-  }
4559
+  inline void gcode_M410() { quickstop_stepper(); }
4565 4560
 
4566 4561
 #endif
4567 4562
 
@@ -5990,8 +5985,9 @@ inline void gcode_M400() { stepper.synchronize(); }
5990 5985
 
5991 5986
 #endif // FILAMENT_WIDTH_SENSOR
5992 5987
 
5993
-#if DISABLED(DELTA) && DISABLED(SCARA)
5994
-  void set_current_position_from_planner() {
5988
+void quickstop_stepper() {
5989
+  stepper.quick_stop();
5990
+  #if DISABLED(DELTA) && DISABLED(SCARA)
5995 5991
     stepper.synchronize();
5996 5992
     #if ENABLED(AUTO_BED_LEVELING_FEATURE)
5997 5993
       vector_3 pos = planner.adjusted_position(); // values directly from steppers...
@@ -6004,8 +6000,8 @@ inline void gcode_M400() { stepper.synchronize(); }
6004 6000
       current_position[Z_AXIS] = stepper.get_axis_position_mm(Z_AXIS);
6005 6001
     #endif
6006 6002
     sync_plan_position();                       // ...re-apply to planner position
6007
-  }
6008
-#endif
6003
+  #endif
6004
+}
6009 6005
 
6010 6006
 #if ENABLED(MESH_BED_LEVELING)
6011 6007
 

+ 1
- 4
Marlin/endstops.cpp View File

@@ -186,10 +186,7 @@ void Endstops::report_state() {
186 186
       if (stepper.abort_on_endstop_hit) {
187 187
         card.sdprinting = false;
188 188
         card.closefile();
189
-        stepper.quick_stop();
190
-        #if DISABLED(DELTA) && DISABLED(SCARA)
191
-          set_current_position_from_planner();
192
-        #endif
189
+        quickstop_stepper();
193 190
         thermalManager.disable_all_heaters(); // switch off all heaters.
194 191
       }
195 192
     #endif

+ 1
- 4
Marlin/ultralcd.cpp View File

@@ -556,14 +556,11 @@ static void lcd_status_screen() {
556 556
     static void lcd_sdcard_stop() {
557 557
       card.stopSDPrint();
558 558
       clear_command_queue();
559
-      stepper.quick_stop();
559
+      quickstop_stepper();
560 560
       print_job_timer.stop();
561 561
       thermalManager.autotempShutdown();
562 562
       wait_for_heatup = false;
563 563
       lcd_setstatus(MSG_PRINT_ABORTED, true);
564
-      #if DISABLED(DELTA) && DISABLED(SCARA)
565
-        set_current_position_from_planner();
566
-      #endif // !DELTA && !SCARA
567 564
     }
568 565
 
569 566
   #endif //SDSUPPORT

Loading…
Cancel
Save