Kaynağa Gözat

Merge pull request #2061 from thinkyhead/wait_before_g28

Always do st_synchronize() before G28
Scott Lahteine 10 yıl önce
ebeveyn
işleme
9ba8cf5fe3
2 değiştirilmiş dosya ile 17 ekleme ve 20 silme
  1. 4
    0
      Marlin/Marlin.h
  2. 13
    20
      Marlin/Marlin_main.cpp

+ 4
- 0
Marlin/Marlin.h Dosyayı Görüntüle

@@ -21,6 +21,10 @@
21 21
 #include "fastio.h"
22 22
 #include "Configuration.h"
23 23
 
24
+#ifndef SANITYCHECK_H
25
+  #error Your Configuration.h and Configuration_adv.h files are outdated!
26
+#endif
27
+
24 28
 #if (ARDUINO >= 100)
25 29
   #include "Arduino.h"
26 30
 #else

+ 13
- 20
Marlin/Marlin_main.cpp Dosyayı Görüntüle

@@ -1096,6 +1096,14 @@ inline void sync_plan_position() {
1096 1096
 inline void set_current_to_destination() { memcpy(current_position, destination, sizeof(current_position)); }
1097 1097
 inline void set_destination_to_current() { memcpy(destination, current_position, sizeof(destination)); }
1098 1098
 
1099
+static void setup_for_endstop_move() {
1100
+  saved_feedrate = feedrate;
1101
+  saved_feedrate_multiplier = feedrate_multiplier;
1102
+  feedrate_multiplier = 100;
1103
+  refresh_cmd_timeout();
1104
+  enable_endstops(true);
1105
+}
1106
+
1099 1107
 #ifdef ENABLE_AUTO_BED_LEVELING
1100 1108
 
1101 1109
   #ifdef DELTA
@@ -1256,14 +1264,6 @@ inline void set_destination_to_current() { memcpy(destination, current_position,
1256 1264
     feedrate = oldFeedRate;
1257 1265
   }
1258 1266
 
1259
-  static void setup_for_endstop_move() {
1260
-    saved_feedrate = feedrate;
1261
-    saved_feedrate_multiplier = feedrate_multiplier;
1262
-    feedrate_multiplier = 100;
1263
-    refresh_cmd_timeout();
1264
-    enable_endstops(true);
1265
-  }
1266
-
1267 1267
   static void clean_up_after_endstop_move() {
1268 1268
     #ifdef ENDSTOPS_ONLY_FOR_HOMING
1269 1269
       enable_endstops(false);
@@ -1845,6 +1845,9 @@ inline void gcode_G4() {
1845 1845
  */
1846 1846
 inline void gcode_G28() {
1847 1847
 
1848
+  // Wait for planner moves to finish!
1849
+  st_synchronize();
1850
+
1848 1851
   // For auto bed leveling, clear the level matrix
1849 1852
   #ifdef ENABLE_AUTO_BED_LEVELING
1850 1853
     plan_bed_level_matrix.set_to_identity();
@@ -1859,12 +1862,7 @@ inline void gcode_G28() {
1859 1862
     mbl.active = 0;
1860 1863
   #endif
1861 1864
 
1862
-  saved_feedrate = feedrate;
1863
-  saved_feedrate_multiplier = feedrate_multiplier;
1864
-  feedrate_multiplier = 100;
1865
-  refresh_cmd_timeout();
1866
-
1867
-  enable_endstops(true);
1865
+  setup_for_endstop_move();
1868 1866
 
1869 1867
   set_destination_to_current();
1870 1868
 
@@ -3150,8 +3148,6 @@ inline void gcode_M42() {
3150 3148
 
3151 3149
     clean_up_after_endstop_move();
3152 3150
 
3153
-    // enable_endstops(true);
3154
-
3155 3151
     if (verbose_level > 0) {
3156 3152
       SERIAL_PROTOCOLPGM("Mean: ");
3157 3153
       SERIAL_PROTOCOL_F(mean, 6);
@@ -5739,25 +5735,22 @@ void mesh_plan_buffer_line(float x, float y, float z, const float e, float feed_
5739 5735
 
5740 5736
 #ifdef PREVENT_DANGEROUS_EXTRUDE
5741 5737
 
5742
-  inline float prevent_dangerous_extrude(float &curr_e, float &dest_e) {
5738
+  inline void prevent_dangerous_extrude(float &curr_e, float &dest_e) {
5743 5739
     float de = dest_e - curr_e;
5744 5740
     if (de) {
5745 5741
       if (degHotend(active_extruder) < extrude_min_temp) {
5746 5742
         curr_e = dest_e; // Behave as if the move really took place, but ignore E part
5747 5743
         SERIAL_ECHO_START;
5748 5744
         SERIAL_ECHOLNPGM(MSG_ERR_COLD_EXTRUDE_STOP);
5749
-        return 0;
5750 5745
       }
5751 5746
       #ifdef PREVENT_LENGTHY_EXTRUDE
5752 5747
         if (labs(de) > EXTRUDE_MAXLENGTH) {
5753 5748
           curr_e = dest_e; // Behave as if the move really took place, but ignore E part
5754 5749
           SERIAL_ECHO_START;
5755 5750
           SERIAL_ECHOLNPGM(MSG_ERR_LONG_EXTRUDE_STOP);
5756
-          return 0;
5757 5751
         }
5758 5752
       #endif
5759 5753
     }
5760
-    return de;
5761 5754
   }
5762 5755
 
5763 5756
 #endif // PREVENT_DANGEROUS_EXTRUDE

Loading…
İptal
Kaydet