Browse Source

Adjust leveling conditionals

Scott Lahteine 7 years ago
parent
commit
ed81e9b3d3
6 changed files with 24 additions and 25 deletions
  1. 3
    4
      Marlin/Conditionals_post.h
  2. 1
    1
      Marlin/Marlin.h
  3. 12
    12
      Marlin/Marlin_main.cpp
  4. 1
    1
      Marlin/configuration_store.cpp
  5. 3
    3
      Marlin/planner.cpp
  6. 4
    4
      Marlin/planner.h

+ 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))

+ 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
 

+ 12
- 12
Marlin/Marlin_main.cpp View File

2403
 
2403
 
2404
 #endif // HAS_BED_PROBE
2404
 #endif // HAS_BED_PROBE
2405
 
2405
 
2406
-#if PLANNER_LEVELING
2406
+#if HAS_LEVELING
2407
   /**
2407
   /**
2408
    * Turn bed leveling on or off, fixing the current
2408
    * Turn bed leveling on or off, fixing the current
2409
    * position as-needed.
2409
    * position as-needed.
2511
     #endif
2511
     #endif
2512
   }
2512
   }
2513
 
2513
 
2514
-#endif // PLANNER_LEVELING
2514
+#endif // HAS_LEVELING
2515
 
2515
 
2516
 #if ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(MESH_BED_LEVELING)
2516
 #if ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(MESH_BED_LEVELING)
2517
 
2517
 
3747
   #endif
3747
   #endif
3748
 
3748
 
3749
   // Disable the leveling matrix before homing
3749
   // Disable the leveling matrix before homing
3750
-  #if PLANNER_LEVELING
3750
+  #if HAS_LEVELING
3751
     #if ENABLED(AUTO_BED_LEVELING_UBL)
3751
     #if ENABLED(AUTO_BED_LEVELING_UBL)
3752
       const bool bed_leveling_state_at_entry = ubl.state.active;
3752
       const bool bed_leveling_state_at_entry = ubl.state.active;
3753
     #endif
3753
     #endif
4368
 
4368
 
4369
       #endif
4369
       #endif
4370
 
4370
 
4371
-      #if PLANNER_LEVELING
4371
+      #if HAS_LEVELING
4372
 
4372
 
4373
         // Jettison bed leveling data
4373
         // Jettison bed leveling data
4374
         if (code_seen('J')) {
4374
         if (code_seen('J')) {
5034
     if (!position_is_reachable(pos, true)) return;
5034
     if (!position_is_reachable(pos, true)) return;
5035
 
5035
 
5036
     // Disable leveling so the planner won't mess with us
5036
     // Disable leveling so the planner won't mess with us
5037
-    #if PLANNER_LEVELING
5037
+    #if HAS_LEVELING
5038
       set_bed_leveling_enabled(false);
5038
       set_bed_leveling_enabled(false);
5039
     #endif
5039
     #endif
5040
 
5040
 
5091
 
5091
 
5092
       stepper.synchronize();
5092
       stepper.synchronize();
5093
 
5093
 
5094
-      #if PLANNER_LEVELING
5094
+      #if HAS_LEVELING
5095
         set_bed_leveling_enabled(false);
5095
         set_bed_leveling_enabled(false);
5096
       #endif
5096
       #endif
5097
 
5097
 
7294
     #endif
7294
     #endif
7295
 
7295
 
7296
     // MESH_REPORT (M420 V)
7296
     // MESH_REPORT (M420 V)
7297
-    #if PLANNER_LEVELING
7297
+    #if HAS_LEVELING
7298
       SERIAL_PROTOCOLLNPGM("Cap:LEVELING_DATA:1");
7298
       SERIAL_PROTOCOLLNPGM("Cap:LEVELING_DATA:1");
7299
     #else
7299
     #else
7300
       SERIAL_PROTOCOLLNPGM("Cap:LEVELING_DATA:0");
7300
       SERIAL_PROTOCOLLNPGM("Cap:LEVELING_DATA:0");
8336
   SYNC_PLAN_POSITION_KINEMATIC();
8336
   SYNC_PLAN_POSITION_KINEMATIC();
8337
 }
8337
 }
8338
 
8338
 
8339
-#if PLANNER_LEVELING
8339
+#if HAS_LEVELING
8340
   /**
8340
   /**
8341
    * M420: Enable/Disable Bed Leveling and/or set the Z fade height.
8341
    * M420: Enable/Disable Bed Leveling and/or set the Z fade height.
8342
    *
8342
    *
9857
         gcode_G28();
9857
         gcode_G28();
9858
         break;
9858
         break;
9859
 
9859
 
9860
-      #if PLANNER_LEVELING || ENABLED(AUTO_BED_LEVELING_UBL)
9860
+      #if HAS_LEVELING
9861
         case 29: // G29 Detailed Z probe, probes the bed at 3 or more points,
9861
         case 29: // G29 Detailed Z probe, probes the bed at 3 or more points,
9862
                  // or provides access to the UBL System if enabled.
9862
                  // or provides access to the UBL System if enabled.
9863
           gcode_G29();
9863
           gcode_G29();
9864
           break;
9864
           break;
9865
-      #endif // PLANNER_LEVELING
9865
+      #endif // HAS_LEVELING
9866
 
9866
 
9867
       #if HAS_BED_PROBE
9867
       #if HAS_BED_PROBE
9868
 
9868
 
10363
           break;
10363
           break;
10364
       #endif // FILAMENT_WIDTH_SENSOR
10364
       #endif // FILAMENT_WIDTH_SENSOR
10365
 
10365
 
10366
-      #if PLANNER_LEVELING
10366
+      #if HAS_LEVELING
10367
         case 420: // M420: Enable/Disable Bed Leveling
10367
         case 420: // M420: Enable/Disable Bed Leveling
10368
           gcode_M420();
10368
           gcode_M420();
10369
           break;
10369
           break;
10917
  */
10917
  */
10918
 void set_current_from_steppers_for_axis(const AxisEnum axis) {
10918
 void set_current_from_steppers_for_axis(const AxisEnum axis) {
10919
   get_cartesian_from_steppers();
10919
   get_cartesian_from_steppers();
10920
-  #if PLANNER_LEVELING && DISABLED(AUTO_BED_LEVELING_UBL)
10920
+  #if PLANNER_LEVELING
10921
     planner.unapply_leveling(cartes);
10921
     planner.unapply_leveling(cartes);
10922
   #endif
10922
   #endif
10923
   if (axis == ALL_AXES)
10923
   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
 

+ 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

+ 4
- 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);

Loading…
Cancel
Save