Przeglądaj źródła

Merge pull request #2061 from thinkyhead/wait_before_g28

Always do st_synchronize() before G28
Scott Lahteine 10 lat temu
rodzic
commit
9ba8cf5fe3
2 zmienionych plików z 17 dodań i 20 usunięć
  1. 4
    0
      Marlin/Marlin.h
  2. 13
    20
      Marlin/Marlin_main.cpp

+ 4
- 0
Marlin/Marlin.h Wyświetl plik

21
 #include "fastio.h"
21
 #include "fastio.h"
22
 #include "Configuration.h"
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
 #if (ARDUINO >= 100)
28
 #if (ARDUINO >= 100)
25
   #include "Arduino.h"
29
   #include "Arduino.h"
26
 #else
30
 #else

+ 13
- 20
Marlin/Marlin_main.cpp Wyświetl plik

1096
 inline void set_current_to_destination() { memcpy(current_position, destination, sizeof(current_position)); }
1096
 inline void set_current_to_destination() { memcpy(current_position, destination, sizeof(current_position)); }
1097
 inline void set_destination_to_current() { memcpy(destination, current_position, sizeof(destination)); }
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
 #ifdef ENABLE_AUTO_BED_LEVELING
1107
 #ifdef ENABLE_AUTO_BED_LEVELING
1100
 
1108
 
1101
   #ifdef DELTA
1109
   #ifdef DELTA
1256
     feedrate = oldFeedRate;
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
   static void clean_up_after_endstop_move() {
1267
   static void clean_up_after_endstop_move() {
1268
     #ifdef ENDSTOPS_ONLY_FOR_HOMING
1268
     #ifdef ENDSTOPS_ONLY_FOR_HOMING
1269
       enable_endstops(false);
1269
       enable_endstops(false);
1845
  */
1845
  */
1846
 inline void gcode_G28() {
1846
 inline void gcode_G28() {
1847
 
1847
 
1848
+  // Wait for planner moves to finish!
1849
+  st_synchronize();
1850
+
1848
   // For auto bed leveling, clear the level matrix
1851
   // For auto bed leveling, clear the level matrix
1849
   #ifdef ENABLE_AUTO_BED_LEVELING
1852
   #ifdef ENABLE_AUTO_BED_LEVELING
1850
     plan_bed_level_matrix.set_to_identity();
1853
     plan_bed_level_matrix.set_to_identity();
1859
     mbl.active = 0;
1862
     mbl.active = 0;
1860
   #endif
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
   set_destination_to_current();
1867
   set_destination_to_current();
1870
 
1868
 
3150
 
3148
 
3151
     clean_up_after_endstop_move();
3149
     clean_up_after_endstop_move();
3152
 
3150
 
3153
-    // enable_endstops(true);
3154
-
3155
     if (verbose_level > 0) {
3151
     if (verbose_level > 0) {
3156
       SERIAL_PROTOCOLPGM("Mean: ");
3152
       SERIAL_PROTOCOLPGM("Mean: ");
3157
       SERIAL_PROTOCOL_F(mean, 6);
3153
       SERIAL_PROTOCOL_F(mean, 6);
5739
 
5735
 
5740
 #ifdef PREVENT_DANGEROUS_EXTRUDE
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
     float de = dest_e - curr_e;
5739
     float de = dest_e - curr_e;
5744
     if (de) {
5740
     if (de) {
5745
       if (degHotend(active_extruder) < extrude_min_temp) {
5741
       if (degHotend(active_extruder) < extrude_min_temp) {
5746
         curr_e = dest_e; // Behave as if the move really took place, but ignore E part
5742
         curr_e = dest_e; // Behave as if the move really took place, but ignore E part
5747
         SERIAL_ECHO_START;
5743
         SERIAL_ECHO_START;
5748
         SERIAL_ECHOLNPGM(MSG_ERR_COLD_EXTRUDE_STOP);
5744
         SERIAL_ECHOLNPGM(MSG_ERR_COLD_EXTRUDE_STOP);
5749
-        return 0;
5750
       }
5745
       }
5751
       #ifdef PREVENT_LENGTHY_EXTRUDE
5746
       #ifdef PREVENT_LENGTHY_EXTRUDE
5752
         if (labs(de) > EXTRUDE_MAXLENGTH) {
5747
         if (labs(de) > EXTRUDE_MAXLENGTH) {
5753
           curr_e = dest_e; // Behave as if the move really took place, but ignore E part
5748
           curr_e = dest_e; // Behave as if the move really took place, but ignore E part
5754
           SERIAL_ECHO_START;
5749
           SERIAL_ECHO_START;
5755
           SERIAL_ECHOLNPGM(MSG_ERR_LONG_EXTRUDE_STOP);
5750
           SERIAL_ECHOLNPGM(MSG_ERR_LONG_EXTRUDE_STOP);
5756
-          return 0;
5757
         }
5751
         }
5758
       #endif
5752
       #endif
5759
     }
5753
     }
5760
-    return de;
5761
   }
5754
   }
5762
 
5755
 
5763
 #endif // PREVENT_DANGEROUS_EXTRUDE
5756
 #endif // PREVENT_DANGEROUS_EXTRUDE

Ładowanie…
Anuluj
Zapisz