Browse Source

Merge pull request #6537 from thinkyhead/rc_cleanup_sunday

Various leveling-related patches
Scott Lahteine 8 years ago
parent
commit
99b11db1a1

+ 3
- 4
Marlin/Conditionals_post.h View File

718
   #endif
718
   #endif
719
 
719
 
720
   /**
720
   /**
721
-   * Set ABL options based on the specific type of leveling
721
+   * Set granular options based on the specific type of leveling
722
    */
722
    */
723
   #define ABL_PLANAR (ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_3POINT))
723
   #define ABL_PLANAR (ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_3POINT))
724
   #define ABL_GRID   (ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR))
724
   #define ABL_GRID   (ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR))
725
   #define HAS_ABL    (ABL_PLANAR || ABL_GRID || ENABLED(AUTO_BED_LEVELING_UBL))
725
   #define HAS_ABL    (ABL_PLANAR || ABL_GRID || ENABLED(AUTO_BED_LEVELING_UBL))
726
-
727
-  #define PLANNER_LEVELING      (HAS_ABL || ENABLED(MESH_BED_LEVELING))
726
+  #define HAS_LEVELING          (HAS_ABL || ENABLED(MESH_BED_LEVELING))
727
+  #define PLANNER_LEVELING      (ABL_PLANAR || ABL_GRID || ENABLED(MESH_BED_LEVELING))
728
   #define HAS_PROBING_PROCEDURE (HAS_ABL || ENABLED(Z_MIN_PROBE_REPEATABILITY_TEST))
728
   #define HAS_PROBING_PROCEDURE (HAS_ABL || ENABLED(Z_MIN_PROBE_REPEATABILITY_TEST))
729
-
730
   #if HAS_PROBING_PROCEDURE
729
   #if HAS_PROBING_PROCEDURE
731
     #define PROBE_BED_WIDTH abs(RIGHT_PROBE_BED_POSITION - (LEFT_PROBE_BED_POSITION))
730
     #define PROBE_BED_WIDTH abs(RIGHT_PROBE_BED_POSITION - (LEFT_PROBE_BED_POSITION))
732
     #define PROBE_BED_HEIGHT abs(BACK_PROBE_BED_POSITION - (FRONT_PROBE_BED_POSITION))
731
     #define PROBE_BED_HEIGHT abs(BACK_PROBE_BED_POSITION - (FRONT_PROBE_BED_POSITION))

+ 20
- 19
Marlin/G26_Mesh_Validation_Tool.cpp View File

115
    *   Y #  Y coordinate  Specify the starting location of the drawing activity.
115
    *   Y #  Y coordinate  Specify the starting location of the drawing activity.
116
    */
116
    */
117
 
117
 
118
+  // External references
119
+
118
   extern float feedrate;
120
   extern float feedrate;
119
   extern Planner planner;
121
   extern Planner planner;
120
-  //#if ENABLED(ULTRA_LCD)
122
+  #if ENABLED(ULTRA_LCD)
121
     extern char lcd_status_message[];
123
     extern char lcd_status_message[];
122
-  //#endif
124
+  #endif
123
   extern float destination[XYZE];
125
   extern float destination[XYZE];
124
-  extern void set_destination_to_current();
125
-  extern void set_current_to_destination();
126
-  extern float code_value_float();
127
-  extern bool code_value_bool();
128
-  extern bool code_has_value();
129
-  extern void lcd_init();
130
-  extern void lcd_setstatuspgm(const char* const message, const uint8_t level);
131
-  #define PLANNER_XY_FEEDRATE() (min(planner.max_feedrate_mm_s[X_AXIS], planner.max_feedrate_mm_s[Y_AXIS])) //bob
126
+  void set_destination_to_current();
127
+  void set_current_to_destination();
128
+  float code_value_float();
129
+  bool code_value_bool();
130
+  bool code_has_value();
131
+  void lcd_init();
132
+  void lcd_setstatuspgm(const char* const message, const uint8_t level);
132
   bool prepare_move_to_destination_cartesian();
133
   bool prepare_move_to_destination_cartesian();
133
   void line_to_destination();
134
   void line_to_destination();
134
-  void line_to_destination(float );
135
-  void gcode_G28();
135
+  void line_to_destination(float);
136
   void sync_plan_position_e();
136
   void sync_plan_position_e();
137
+  void chirp_at_user();
138
+
139
+  // Private functions
140
+
137
   void un_retract_filament(float where[XYZE]);
141
   void un_retract_filament(float where[XYZE]);
138
   void retract_filament(float where[XYZE]);
142
   void retract_filament(float where[XYZE]);
139
   void look_for_lines_to_connect();
143
   void look_for_lines_to_connect();
142
   void print_line_from_here_to_there(const float&, const float&, const float&, const float&, const float&, const float&);
146
   void print_line_from_here_to_there(const float&, const float&, const float&, const float&, const float&, const float&);
143
   bool turn_on_heaters();
147
   bool turn_on_heaters();
144
   bool prime_nozzle();
148
   bool prime_nozzle();
145
-  void chirp_at_user();
146
 
149
 
147
   static uint16_t circle_flags[16], horizontal_mesh_line_flags[16], vertical_mesh_line_flags[16], continue_with_closest = 0;
150
   static uint16_t circle_flags[16], horizontal_mesh_line_flags[16], vertical_mesh_line_flags[16], continue_with_closest = 0;
148
   float g26_e_axis_feedrate = 0.020,
151
   float g26_e_axis_feedrate = 0.020,
149
         random_deviation = 0.0,
152
         random_deviation = 0.0,
150
         layer_height = LAYER_HEIGHT;
153
         layer_height = LAYER_HEIGHT;
151
 
154
 
152
-  bool g26_retracted = false; // We keep track of the state of the nozzle to know if it
153
-                              // is currently retracted or not.  This allows us to be
154
-                              // less careful because mis-matched retractions and un-retractions
155
-                              // won't leave us in a bad state.
155
+  static bool g26_retracted = false; // Track the retracted state of the nozzle so mismatched
156
+                                     // retracts/recovers won't result in a bad state.
156
 
157
 
157
   float valid_trig_angle(float);
158
   float valid_trig_angle(float);
158
   mesh_index_pair find_closest_circle_to_print(const float&, const float&);
159
   mesh_index_pair find_closest_circle_to_print(const float&, const float&);
167
                hotend_temp = HOTEND_TEMP,
168
                hotend_temp = HOTEND_TEMP,
168
                ooze_amount = OOZE_AMOUNT;
169
                ooze_amount = OOZE_AMOUNT;
169
 
170
 
170
-  int8_t prime_flag = 0;
171
+  static int8_t prime_flag = 0;
171
 
172
 
172
-  bool keep_heaters_on = false;
173
+  static bool keep_heaters_on = false;
173
 
174
 
174
   /**
175
   /**
175
    * G26: Mesh Validation Pattern generation.
176
    * G26: Mesh Validation Pattern generation.

+ 1
- 1
Marlin/Marlin.h View File

324
   linear_fit* lsf_linear_fit(double x[], double y[], double z[], const int);
324
   linear_fit* lsf_linear_fit(double x[], double y[], double z[], const int);
325
 #endif
325
 #endif
326
 
326
 
327
-#if PLANNER_LEVELING
327
+#if HAS_LEVELING
328
   void reset_bed_level();
328
   void reset_bed_level();
329
 #endif
329
 #endif
330
 
330
 

+ 51
- 61
Marlin/Marlin_main.cpp View File

490
   float zprobe_zoffset = Z_PROBE_OFFSET_FROM_EXTRUDER;
490
   float zprobe_zoffset = Z_PROBE_OFFSET_FROM_EXTRUDER;
491
 #endif
491
 #endif
492
 
492
 
493
-#define PLANNER_XY_FEEDRATE() (min(planner.max_feedrate_mm_s[X_AXIS], planner.max_feedrate_mm_s[Y_AXIS]))
494
-
495
 #if HAS_ABL
493
 #if HAS_ABL
496
   float xy_probe_feedrate_mm_s = MMM_TO_MMS(XY_PROBE_SPEED);
494
   float xy_probe_feedrate_mm_s = MMM_TO_MMS(XY_PROBE_SPEED);
497
   #define XY_PROBE_FEEDRATE_MM_S xy_probe_feedrate_mm_s
495
   #define XY_PROBE_FEEDRATE_MM_S xy_probe_feedrate_mm_s
2405
 
2403
 
2406
 #endif // HAS_BED_PROBE
2404
 #endif // HAS_BED_PROBE
2407
 
2405
 
2408
-#if PLANNER_LEVELING
2406
+#if HAS_LEVELING
2409
   /**
2407
   /**
2410
    * Turn bed leveling on or off, fixing the current
2408
    * Turn bed leveling on or off, fixing the current
2411
    * position as-needed.
2409
    * position as-needed.
2426
         if (enable && mbl.has_mesh()) planner.unapply_leveling(current_position);
2424
         if (enable && mbl.has_mesh()) planner.unapply_leveling(current_position);
2427
       }
2425
       }
2428
 
2426
 
2429
-    #elif HAS_ABL && !ENABLED(AUTO_BED_LEVELING_UBL)
2427
+    #elif ENABLED(AUTO_BED_LEVELING_UBL)
2428
+
2429
+      ubl.state.active = enable;
2430
+      //set_current_from_steppers_for_axis(Z_AXIS);
2431
+
2432
+    #else
2430
 
2433
 
2431
       #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
2434
       #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
2432
         const bool can_change = (!enable || (bilinear_grid_spacing[0] && bilinear_grid_spacing[1]));
2435
         const bool can_change = (!enable || (bilinear_grid_spacing[0] && bilinear_grid_spacing[1]));
2454
         else
2457
         else
2455
           planner.unapply_leveling(current_position);
2458
           planner.unapply_leveling(current_position);
2456
       }
2459
       }
2457
-    #elif ENABLED(AUTO_BED_LEVELING_UBL)
2458
-      ubl.state.active = enable;
2459
-      //set_current_from_steppers_for_axis(Z_AXIS);
2460
     #endif
2460
     #endif
2461
   }
2461
   }
2462
 
2462
 
2513
     #endif
2513
     #endif
2514
   }
2514
   }
2515
 
2515
 
2516
-#endif // PLANNER_LEVELING
2516
+#endif // HAS_LEVELING
2517
 
2517
 
2518
 #if ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(MESH_BED_LEVELING)
2518
 #if ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(MESH_BED_LEVELING)
2519
 
2519
 
3749
   #endif
3749
   #endif
3750
 
3750
 
3751
   // Disable the leveling matrix before homing
3751
   // Disable the leveling matrix before homing
3752
-  #if PLANNER_LEVELING
3753
-    #if ENABLED(AUTO_BED_LEVELING_UBL)
3754
-      const bool bed_leveling_state_at_entry = ubl.state.active;
3755
-    #endif
3752
+  #if HAS_LEVELING
3756
     set_bed_leveling_enabled(false);
3753
     set_bed_leveling_enabled(false);
3757
   #endif
3754
   #endif
3758
 
3755
 
3895
     do_blocking_move_to_z(delta_clip_start_height);
3892
     do_blocking_move_to_z(delta_clip_start_height);
3896
   #endif
3893
   #endif
3897
 
3894
 
3898
-  #if ENABLED(AUTO_BED_LEVELING_UBL)
3899
-    set_bed_leveling_enabled(bed_leveling_state_at_entry);
3900
-  #endif
3901
-
3902
-  // Enable mesh leveling again
3903
-  #if ENABLED(MESH_BED_LEVELING)
3904
-    if (mbl.reactivate()) {
3905
-      set_bed_leveling_enabled(true);
3906
-      if (home_all_axis || (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && homeZ)) {
3907
-        #if ENABLED(MESH_G28_REST_ORIGIN)
3908
-          current_position[Z_AXIS] = LOGICAL_Z_POSITION(Z_MIN_POS);
3909
-          set_destination_to_current();
3910
-          line_to_destination(homing_feedrate_mm_s[Z_AXIS]);
3911
-          stepper.synchronize();
3912
-        #endif
3913
-      }
3914
-    }
3915
-  #endif
3916
-
3917
   clean_up_after_endstop_or_probe_move();
3895
   clean_up_after_endstop_or_probe_move();
3918
 
3896
 
3919
   // Restore the active tool after homing
3897
   // Restore the active tool after homing
3928
   #endif
3906
   #endif
3929
 }
3907
 }
3930
 
3908
 
3909
+void home_all_axes() { gcode_G28(); }
3910
+
3931
 #if HAS_PROBING_PROCEDURE
3911
 #if HAS_PROBING_PROCEDURE
3932
 
3912
 
3933
   void out_of_range_error(const char* p_edge) {
3913
   void out_of_range_error(const char* p_edge) {
3980
     );
3960
     );
3981
   }
3961
   }
3982
 
3962
 
3963
+  void mesh_probing_done() {
3964
+    mbl.set_has_mesh(true);
3965
+    home_all_axes();
3966
+    set_bed_leveling_enabled(true);
3967
+    #if ENABLED(MESH_G28_REST_ORIGIN)
3968
+      current_position[Z_AXIS] = LOGICAL_Z_POSITION(Z_MIN_POS);
3969
+      set_destination_to_current();
3970
+      line_to_destination(homing_feedrate_mm_s[Z_AXIS]);
3971
+      stepper.synchronize();
3972
+    #endif
3973
+  }
3974
+
3983
   /**
3975
   /**
3984
    * G29: Mesh-based Z probe, probes a grid and produces a
3976
    * G29: Mesh-based Z probe, probes a grid and produces a
3985
    *      mesh to compensate for variable bed height
3977
    *      mesh to compensate for variable bed height
4070
           line_to_current_position();
4062
           line_to_current_position();
4071
           stepper.synchronize();
4063
           stepper.synchronize();
4072
 
4064
 
4073
-          // After recording the last point, activate the mbl and home
4074
-          SERIAL_PROTOCOLLNPGM("Mesh probing done.");
4065
+          // After recording the last point, activate home and activate
4075
           mbl_probe_index = -1;
4066
           mbl_probe_index = -1;
4076
-          mbl.set_has_mesh(true);
4077
-          mbl.set_reactivate(true);
4078
-          enqueue_and_echo_commands_P(PSTR("G28"));
4067
+          SERIAL_PROTOCOLLNPGM("Mesh probing done.");
4079
           BUZZ(100, 659);
4068
           BUZZ(100, 659);
4080
           BUZZ(100, 698);
4069
           BUZZ(100, 698);
4070
+          mesh_probing_done();
4081
         }
4071
         }
4082
         break;
4072
         break;
4083
 
4073
 
4368
 
4358
 
4369
       #endif
4359
       #endif
4370
 
4360
 
4371
-      #if PLANNER_LEVELING
4361
+      #if HAS_LEVELING
4372
 
4362
 
4373
         // Jettison bed leveling data
4363
         // Jettison bed leveling data
4374
         if (code_seen('J')) {
4364
         if (code_seen('J')) {
5013
       SYNC_PLAN_POSITION_KINEMATIC();
5003
       SYNC_PLAN_POSITION_KINEMATIC();
5014
   }
5004
   }
5015
 
5005
 
5016
-#endif // HAS_ABL && DISABLED(AUTO_BED_LEVELING_UBL)
5006
+#endif // HAS_ABL && !AUTO_BED_LEVELING_UBL
5017
 
5007
 
5018
 #if HAS_BED_PROBE
5008
 #if HAS_BED_PROBE
5019
 
5009
 
5034
     if (!position_is_reachable(pos, true)) return;
5024
     if (!position_is_reachable(pos, true)) return;
5035
 
5025
 
5036
     // Disable leveling so the planner won't mess with us
5026
     // Disable leveling so the planner won't mess with us
5037
-    #if PLANNER_LEVELING
5027
+    #if HAS_LEVELING
5038
       set_bed_leveling_enabled(false);
5028
       set_bed_leveling_enabled(false);
5039
     #endif
5029
     #endif
5040
 
5030
 
5091
 
5081
 
5092
       stepper.synchronize();
5082
       stepper.synchronize();
5093
 
5083
 
5094
-      #if PLANNER_LEVELING
5084
+      #if HAS_LEVELING
5095
         set_bed_leveling_enabled(false);
5085
         set_bed_leveling_enabled(false);
5096
       #endif
5086
       #endif
5097
 
5087
 
6198
    * regenerated.
6188
    * regenerated.
6199
    */
6189
    */
6200
   inline void gcode_M48() {
6190
   inline void gcode_M48() {
6201
-  #if ENABLED(AUTO_BED_LEVELING_UBL)
6202
-  bool bed_leveling_state_at_entry=0;
6203
-    bed_leveling_state_at_entry = ubl.state.active;
6204
-  #endif
6205
 
6191
 
6206
     if (axis_unhomed_error(true, true, true)) return;
6192
     if (axis_unhomed_error(true, true, true)) return;
6207
 
6193
 
6220
       return;
6206
       return;
6221
     }
6207
     }
6222
 
6208
 
6223
-    float  X_current = current_position[X_AXIS],
6224
-           Y_current = current_position[Y_AXIS];
6209
+    float X_current = current_position[X_AXIS],
6210
+          Y_current = current_position[Y_AXIS];
6225
 
6211
 
6226
     bool stow_probe_after_each = code_seen('E');
6212
     bool stow_probe_after_each = code_seen('E');
6227
 
6213
 
6267
       SERIAL_PROTOCOLLNPGM("Positioning the probe...");
6253
       SERIAL_PROTOCOLLNPGM("Positioning the probe...");
6268
 
6254
 
6269
     // Disable bed level correction in M48 because we want the raw data when we probe
6255
     // Disable bed level correction in M48 because we want the raw data when we probe
6270
-    #if HAS_ABL
6271
-      const bool abl_was_enabled = planner.abl_enabled;
6256
+
6257
+    #if HAS_LEVELING
6258
+      const bool was_enabled =
6259
+        #if ENABLED(AUTO_BED_LEVELING_UBL)
6260
+          ubl.state.active
6261
+        #elif ENABLED(MESH_BED_LEVELING)
6262
+          mbl.active()
6263
+        #else
6264
+          planner.abl_enabled
6265
+        #endif
6266
+      ;
6272
       set_bed_leveling_enabled(false);
6267
       set_bed_leveling_enabled(false);
6273
     #endif
6268
     #endif
6274
 
6269
 
6420
 
6415
 
6421
     clean_up_after_endstop_or_probe_move();
6416
     clean_up_after_endstop_or_probe_move();
6422
 
6417
 
6423
-    // Re-enable bed level correction if it has been on
6418
+    // Re-enable bed level correction if it had been on
6424
     #if HAS_ABL
6419
     #if HAS_ABL
6425
-      set_bed_leveling_enabled(abl_was_enabled);
6426
-    #endif
6427
-
6428
-    #if ENABLED(AUTO_BED_LEVELING_UBL)
6429
-      set_bed_leveling_enabled(bed_leveling_state_at_entry);
6430
-      ubl.state.active = bed_leveling_state_at_entry;
6420
+      set_bed_leveling_enabled(was_enabled);
6431
     #endif
6421
     #endif
6432
 
6422
 
6433
     report_current_position();
6423
     report_current_position();
7294
     #endif
7284
     #endif
7295
 
7285
 
7296
     // MESH_REPORT (M420 V)
7286
     // MESH_REPORT (M420 V)
7297
-    #if PLANNER_LEVELING
7287
+    #if HAS_LEVELING
7298
       SERIAL_PROTOCOLLNPGM("Cap:LEVELING_DATA:1");
7288
       SERIAL_PROTOCOLLNPGM("Cap:LEVELING_DATA:1");
7299
     #else
7289
     #else
7300
       SERIAL_PROTOCOLLNPGM("Cap:LEVELING_DATA:0");
7290
       SERIAL_PROTOCOLLNPGM("Cap:LEVELING_DATA:0");
8336
   SYNC_PLAN_POSITION_KINEMATIC();
8326
   SYNC_PLAN_POSITION_KINEMATIC();
8337
 }
8327
 }
8338
 
8328
 
8339
-#if PLANNER_LEVELING
8329
+#if HAS_LEVELING
8340
   /**
8330
   /**
8341
    * M420: Enable/Disable Bed Leveling and/or set the Z fade height.
8331
    * M420: Enable/Disable Bed Leveling and/or set the Z fade height.
8342
    *
8332
    *
9857
         gcode_G28();
9847
         gcode_G28();
9858
         break;
9848
         break;
9859
 
9849
 
9860
-      #if PLANNER_LEVELING || ENABLED(AUTO_BED_LEVELING_UBL)
9850
+      #if HAS_LEVELING
9861
         case 29: // G29 Detailed Z probe, probes the bed at 3 or more points,
9851
         case 29: // G29 Detailed Z probe, probes the bed at 3 or more points,
9862
                  // or provides access to the UBL System if enabled.
9852
                  // or provides access to the UBL System if enabled.
9863
           gcode_G29();
9853
           gcode_G29();
9864
           break;
9854
           break;
9865
-      #endif // PLANNER_LEVELING
9855
+      #endif // HAS_LEVELING
9866
 
9856
 
9867
       #if HAS_BED_PROBE
9857
       #if HAS_BED_PROBE
9868
 
9858
 
10363
           break;
10353
           break;
10364
       #endif // FILAMENT_WIDTH_SENSOR
10354
       #endif // FILAMENT_WIDTH_SENSOR
10365
 
10355
 
10366
-      #if PLANNER_LEVELING
10356
+      #if HAS_LEVELING
10367
         case 420: // M420: Enable/Disable Bed Leveling
10357
         case 420: // M420: Enable/Disable Bed Leveling
10368
           gcode_M420();
10358
           gcode_M420();
10369
           break;
10359
           break;
10917
  */
10907
  */
10918
 void set_current_from_steppers_for_axis(const AxisEnum axis) {
10908
 void set_current_from_steppers_for_axis(const AxisEnum axis) {
10919
   get_cartesian_from_steppers();
10909
   get_cartesian_from_steppers();
10920
-  #if PLANNER_LEVELING && DISABLED(AUTO_BED_LEVELING_UBL)
10910
+  #if PLANNER_LEVELING
10921
     planner.unapply_leveling(cartes);
10911
     planner.unapply_leveling(cartes);
10922
   #endif
10912
   #endif
10923
   if (axis == ALL_AXES)
10913
   if (axis == ALL_AXES)

+ 1
- 1
Marlin/configuration_store.cpp View File

1071
   #endif
1071
   #endif
1072
 
1072
 
1073
   // Applies to all MBL and ABL
1073
   // Applies to all MBL and ABL
1074
-  #if PLANNER_LEVELING
1074
+  #if HAS_LEVELING
1075
     reset_bed_level();
1075
     reset_bed_level();
1076
   #endif
1076
   #endif
1077
 
1077
 

+ 1
- 4
Marlin/mesh_bed_leveling.h View File

36
   enum MBLStatus {
36
   enum MBLStatus {
37
     MBL_STATUS_NONE = 0,
37
     MBL_STATUS_NONE = 0,
38
     MBL_STATUS_HAS_MESH_BIT = 0,
38
     MBL_STATUS_HAS_MESH_BIT = 0,
39
-    MBL_STATUS_ACTIVE_BIT = 1,
40
-    MBL_STATUS_REACTIVATE_BIT = 2
39
+    MBL_STATUS_ACTIVE_BIT = 1
41
   };
40
   };
42
 
41
 
43
   #define MESH_X_DIST ((MESH_MAX_X - (MESH_MIN_X)) / (GRID_MAX_POINTS_X - 1))
42
   #define MESH_X_DIST ((MESH_MAX_X - (MESH_MIN_X)) / (GRID_MAX_POINTS_X - 1))
61
     static void set_active(const bool onOff)   { onOff ? SBI(status, MBL_STATUS_ACTIVE_BIT) : CBI(status, MBL_STATUS_ACTIVE_BIT); }
60
     static void set_active(const bool onOff)   { onOff ? SBI(status, MBL_STATUS_ACTIVE_BIT) : CBI(status, MBL_STATUS_ACTIVE_BIT); }
62
     static bool has_mesh()                     { return TEST(status, MBL_STATUS_HAS_MESH_BIT); }
61
     static bool has_mesh()                     { return TEST(status, MBL_STATUS_HAS_MESH_BIT); }
63
     static void set_has_mesh(const bool onOff) { onOff ? SBI(status, MBL_STATUS_HAS_MESH_BIT) : CBI(status, MBL_STATUS_HAS_MESH_BIT); }
62
     static void set_has_mesh(const bool onOff) { onOff ? SBI(status, MBL_STATUS_HAS_MESH_BIT) : CBI(status, MBL_STATUS_HAS_MESH_BIT); }
64
-    static bool reactivate()                   { bool b = TEST(status, MBL_STATUS_REACTIVATE_BIT); CBI(status, MBL_STATUS_REACTIVATE_BIT); return b; }
65
-    static void set_reactivate(const bool onOff) { onOff ? SBI(status, MBL_STATUS_REACTIVATE_BIT) : CBI(status, MBL_STATUS_REACTIVATE_BIT); }
66
 
63
 
67
     static inline void zigzag(const int8_t index, int8_t &px, int8_t &py) {
64
     static inline void zigzag(const int8_t index, int8_t &px, int8_t &py) {
68
       px = index % (GRID_MAX_POINTS_X);
65
       px = index % (GRID_MAX_POINTS_X);

+ 3
- 3
Marlin/planner.cpp View File

530
   #endif
530
   #endif
531
 }
531
 }
532
 
532
 
533
-#if PLANNER_LEVELING && DISABLED(AUTO_BED_LEVELING_UBL)
533
+#if PLANNER_LEVELING
534
   /**
534
   /**
535
    * lx, ly, lz - logical (cartesian, not delta) positions in mm
535
    * lx, ly, lz - logical (cartesian, not delta) positions in mm
536
    */
536
    */
634
     #endif
634
     #endif
635
   }
635
   }
636
 
636
 
637
-#endif // PLANNER_LEVELING && !AUTO_BED_LEVELING_UBL
637
+#endif // PLANNER_LEVELING
638
 
638
 
639
 /**
639
 /**
640
  * Planner::_buffer_line
640
  * Planner::_buffer_line
1434
 }
1434
 }
1435
 
1435
 
1436
 void Planner::set_position_mm_kinematic(const float position[NUM_AXIS]) {
1436
 void Planner::set_position_mm_kinematic(const float position[NUM_AXIS]) {
1437
-  #if PLANNER_LEVELING && DISABLED(AUTO_BED_LEVELING_UBL)
1437
+  #if PLANNER_LEVELING
1438
     float lpos[XYZ] = { position[X_AXIS], position[Y_AXIS], position[Z_AXIS] };
1438
     float lpos[XYZ] = { position[X_AXIS], position[Y_AXIS], position[Z_AXIS] };
1439
     apply_leveling(lpos);
1439
     apply_leveling(lpos);
1440
   #else
1440
   #else

+ 6
- 4
Marlin/planner.h View File

246
 
246
 
247
     static bool is_full() { return (block_buffer_tail == BLOCK_MOD(block_buffer_head + 1)); }
247
     static bool is_full() { return (block_buffer_tail == BLOCK_MOD(block_buffer_head + 1)); }
248
 
248
 
249
-    #if PLANNER_LEVELING && DISABLED(AUTO_BED_LEVELING_UBL)
249
+    #if PLANNER_LEVELING
250
 
250
 
251
       #define ARG_X float lx
251
       #define ARG_X float lx
252
       #define ARG_Y float ly
252
       #define ARG_Y float ly
296
      *  extruder     - target extruder
296
      *  extruder     - target extruder
297
      */
297
      */
298
     static FORCE_INLINE void buffer_line(ARG_X, ARG_Y, ARG_Z, const float &e, const float &fr_mm_s, const uint8_t extruder) {
298
     static FORCE_INLINE void buffer_line(ARG_X, ARG_Y, ARG_Z, const float &e, const float &fr_mm_s, const uint8_t extruder) {
299
-      #if PLANNER_LEVELING && DISABLED(AUTO_BED_LEVELING_UBL) && IS_CARTESIAN
299
+      #if PLANNER_LEVELING && IS_CARTESIAN
300
         apply_leveling(lx, ly, lz);
300
         apply_leveling(lx, ly, lz);
301
       #endif
301
       #endif
302
       _buffer_line(lx, ly, lz, e, fr_mm_s, extruder);
302
       _buffer_line(lx, ly, lz, e, fr_mm_s, extruder);
312
      *  extruder - target extruder
312
      *  extruder - target extruder
313
      */
313
      */
314
     static FORCE_INLINE void buffer_line_kinematic(const float ltarget[XYZE], const float &fr_mm_s, const uint8_t extruder) {
314
     static FORCE_INLINE void buffer_line_kinematic(const float ltarget[XYZE], const float &fr_mm_s, const uint8_t extruder) {
315
-      #if PLANNER_LEVELING && DISABLED(AUTO_BED_LEVELING_UBL)
315
+      #if PLANNER_LEVELING
316
         float lpos[XYZ] = { ltarget[X_AXIS], ltarget[Y_AXIS], ltarget[Z_AXIS] };
316
         float lpos[XYZ] = { ltarget[X_AXIS], ltarget[Y_AXIS], ltarget[Z_AXIS] };
317
         apply_leveling(lpos);
317
         apply_leveling(lpos);
318
       #else
318
       #else
336
      * Clears previous speed values.
336
      * Clears previous speed values.
337
      */
337
      */
338
     static FORCE_INLINE void set_position_mm(ARG_X, ARG_Y, ARG_Z, const float &e) {
338
     static FORCE_INLINE void set_position_mm(ARG_X, ARG_Y, ARG_Z, const float &e) {
339
-      #if PLANNER_LEVELING && DISABLED(AUTO_BED_LEVELING_UBL) && IS_CARTESIAN
339
+      #if PLANNER_LEVELING && IS_CARTESIAN
340
         apply_leveling(lx, ly, lz);
340
         apply_leveling(lx, ly, lz);
341
       #endif
341
       #endif
342
       _set_position_mm(lx, ly, lz, e);
342
       _set_position_mm(lx, ly, lz, e);
469
 
469
 
470
 };
470
 };
471
 
471
 
472
+#define PLANNER_XY_FEEDRATE() (min(planner.max_feedrate_mm_s[X_AXIS], planner.max_feedrate_mm_s[Y_AXIS]))
473
+
472
 extern Planner planner;
474
 extern Planner planner;
473
 
475
 
474
 #endif // PLANNER_H
476
 #endif // PLANNER_H

+ 2
- 1
Marlin/ubl.h View File

61
   bool is_bit_set(uint16_t bits[16], uint8_t x, uint8_t y);
61
   bool is_bit_set(uint16_t bits[16], uint8_t x, uint8_t y);
62
   char *ftostr43sign(const float&, char);
62
   char *ftostr43sign(const float&, char);
63
 
63
 
64
+  void home_all_axes();
65
+
64
   void gcode_G26();
66
   void gcode_G26();
65
-  void gcode_G28();
66
   void gcode_G29();
67
   void gcode_G29();
67
 
68
 
68
   extern int ubl_cnt;
69
   extern int ubl_cnt;

+ 1
- 1
Marlin/ubl_G29.cpp View File

324
     }
324
     }
325
 
325
 
326
     if (!code_seen('N') && axis_unhomed_error(true, true, true))  // Don't allow auto-leveling without homing first
326
     if (!code_seen('N') && axis_unhomed_error(true, true, true))  // Don't allow auto-leveling without homing first
327
-      gcode_G28();
327
+      home_all_axes();
328
 
328
 
329
     if (g29_parameter_parsing()) return; // abort if parsing the simple parameters causes a problem,
329
     if (g29_parameter_parsing()) return; // abort if parsing the simple parameters causes a problem,
330
 
330
 

+ 3
- 2
Marlin/ultralcd.cpp View File

162
 
162
 
163
   #if ENABLED(MESH_BED_LEVELING) && ENABLED(LCD_BED_LEVELING)
163
   #if ENABLED(MESH_BED_LEVELING) && ENABLED(LCD_BED_LEVELING)
164
     #include "mesh_bed_leveling.h"
164
     #include "mesh_bed_leveling.h"
165
+    extern void mesh_probing_done();
165
   #endif
166
   #endif
166
 
167
 
167
   ////////////////////////////////////////////
168
   ////////////////////////////////////////////
1539
           // Enable leveling, if needed
1540
           // Enable leveling, if needed
1540
           #if ENABLED(MESH_BED_LEVELING)
1541
           #if ENABLED(MESH_BED_LEVELING)
1541
 
1542
 
1543
+            lcd_synchronize();
1542
             mbl.set_has_mesh(true);
1544
             mbl.set_has_mesh(true);
1543
-            mbl.set_reactivate(true);
1544
-            enqueue_and_echo_commands_P(PSTR("G28"));
1545
+            mesh_probing_done();
1545
 
1546
 
1546
           #elif ENABLED(AUTO_BED_LEVELING_UBL)
1547
           #elif ENABLED(AUTO_BED_LEVELING_UBL)
1547
 
1548
 

Loading…
Cancel
Save