Browse Source

Add conditionals for kinematics, leveling

Scott Lahteine 8 years ago
parent
commit
6ab54c60b1

+ 37
- 15
Marlin/Conditionals_post.h View File

61
     #define NORMAL_AXIS X_AXIS
61
     #define NORMAL_AXIS X_AXIS
62
   #endif
62
   #endif
63
 
63
 
64
+  #define IS_SCARA (ENABLED(MORGAN_SCARA) || ENABLED(MAKERARM_SCARA))
65
+  #define IS_KINEMATIC (ENABLED(DELTA) || IS_SCARA)
66
+  #define IS_CARTESIAN !IS_KINEMATIC
67
+
64
   /**
68
   /**
65
-   * SCARA
69
+   * SCARA cannot use SLOWDOWN and requires QUICKHOME
66
    */
70
    */
67
-  #if ENABLED(SCARA)
71
+  #if IS_SCARA
68
     #undef SLOWDOWN
72
     #undef SLOWDOWN
69
-    #define QUICK_HOME //SCARA needs Quickhome
73
+    #define QUICK_HOME
70
   #endif
74
   #endif
71
 
75
 
72
   /**
76
   /**
132
 
136
 
133
   #define HOMING_Z_WITH_PROBE (HAS_BED_PROBE && Z_HOME_DIR < 0 && ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN))
137
   #define HOMING_Z_WITH_PROBE (HAS_BED_PROBE && Z_HOME_DIR < 0 && ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN))
134
 
138
 
135
-  // Boundaries for probing based on set limits
136
-  #define MIN_PROBE_X (max(X_MIN_POS, X_MIN_POS + X_PROBE_OFFSET_FROM_EXTRUDER))
137
-  #define MAX_PROBE_X (min(X_MAX_POS, X_MAX_POS + X_PROBE_OFFSET_FROM_EXTRUDER))
138
-  #define MIN_PROBE_Y (max(Y_MIN_POS, Y_MIN_POS + Y_PROBE_OFFSET_FROM_EXTRUDER))
139
-  #define MAX_PROBE_Y (min(Y_MAX_POS, Y_MAX_POS + Y_PROBE_OFFSET_FROM_EXTRUDER))
140
-
141
   #define HAS_Z_SERVO_ENDSTOP (defined(Z_ENDSTOP_SERVO_NR) && Z_ENDSTOP_SERVO_NR >= 0)
139
   #define HAS_Z_SERVO_ENDSTOP (defined(Z_ENDSTOP_SERVO_NR) && Z_ENDSTOP_SERVO_NR >= 0)
142
 
140
 
143
   /**
141
   /**
657
     #ifndef DELTA_DIAGONAL_ROD_TRIM_TOWER_3
655
     #ifndef DELTA_DIAGONAL_ROD_TRIM_TOWER_3
658
       #define DELTA_DIAGONAL_ROD_TRIM_TOWER_3 0.0
656
       #define DELTA_DIAGONAL_ROD_TRIM_TOWER_3 0.0
659
     #endif
657
     #endif
660
-    #if ENABLED(AUTO_BED_LEVELING_GRID)
661
-      #define DELTA_BED_LEVELING_GRID
662
-    #endif
663
   #endif
658
   #endif
664
 
659
 
665
   /**
660
   /**
666
-   * When not using other bed leveling...
661
+   * Specify the exact style of auto bed leveling
662
+   *
663
+   *  3POINT    - 3 Point Probing with the least-squares solution.
664
+   *  LINEAR    - Grid Probing with the least-squares solution.
665
+   *  NONLINEAR - Grid Probing with a mesh solution. Best for large beds.
667
    */
666
    */
668
-  #if ENABLED(AUTO_BED_LEVELING_FEATURE) && DISABLED(AUTO_BED_LEVELING_GRID) && DISABLED(DELTA_BED_LEVELING_GRID)
669
-    #define AUTO_BED_LEVELING_3POINT
667
+  #if ENABLED(AUTO_BED_LEVELING_FEATURE)
668
+    #if DISABLED(AUTO_BED_LEVELING_GRID)
669
+      #define AUTO_BED_LEVELING_LINEAR
670
+      #define AUTO_BED_LEVELING_3POINT
671
+    #elif IS_KINEMATIC
672
+      #define AUTO_BED_LEVELING_NONLINEAR
673
+    #else
674
+      #define AUTO_BED_LEVELING_LINEAR
675
+    #endif
670
   #endif
676
   #endif
671
 
677
 
678
+  #define PLANNER_LEVELING (ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_LINEAR))
679
+
672
   /**
680
   /**
673
    * Buzzer/Speaker
681
    * Buzzer/Speaker
674
    */
682
    */
702
     #define Z_PROBE_TRAVEL_HEIGHT Z_HOMING_HEIGHT
710
     #define Z_PROBE_TRAVEL_HEIGHT Z_HOMING_HEIGHT
703
   #endif
711
   #endif
704
 
712
 
713
+  #if IS_KINEMATIC
714
+    // Check for this in the code instead
715
+    #define MIN_PROBE_X X_MIN_POS
716
+    #define MAX_PROBE_X X_MAX_POS
717
+    #define MIN_PROBE_Y Y_MIN_POS
718
+    #define MAX_PROBE_Y Y_MAX_POS
719
+  #else
720
+    // Boundaries for probing based on set limits
721
+    #define MIN_PROBE_X (max(X_MIN_POS, X_MIN_POS + X_PROBE_OFFSET_FROM_EXTRUDER))
722
+    #define MAX_PROBE_X (min(X_MAX_POS, X_MAX_POS + X_PROBE_OFFSET_FROM_EXTRUDER))
723
+    #define MIN_PROBE_Y (max(Y_MIN_POS, Y_MIN_POS + Y_PROBE_OFFSET_FROM_EXTRUDER))
724
+    #define MAX_PROBE_Y (min(Y_MAX_POS, Y_MAX_POS + Y_PROBE_OFFSET_FROM_EXTRUDER))
725
+  #endif
726
+
705
 #endif // CONDITIONALS_POST_H
727
 #endif // CONDITIONALS_POST_H

+ 1
- 1
Marlin/Marlin.h View File

313
     extern int delta_grid_spacing[2];
313
     extern int delta_grid_spacing[2];
314
     void adjust_delta(float cartesian[XYZ]);
314
     void adjust_delta(float cartesian[XYZ]);
315
   #endif
315
   #endif
316
-#elif ENABLED(SCARA)
316
+#elif IS_SCARA
317
   extern float delta[ABC];
317
   extern float delta[ABC];
318
   extern float axis_scaling[ABC];  // Build size scaling
318
   extern float axis_scaling[ABC];  // Build size scaling
319
   void inverse_kinematics(const float cartesian[XYZ]);
319
   void inverse_kinematics(const float cartesian[XYZ]);

+ 63
- 52
Marlin/Marlin_main.cpp View File

36
 
36
 
37
 #if ENABLED(AUTO_BED_LEVELING_FEATURE)
37
 #if ENABLED(AUTO_BED_LEVELING_FEATURE)
38
   #include "vector_3.h"
38
   #include "vector_3.h"
39
-  #if ENABLED(AUTO_BED_LEVELING_GRID)
40
-    #include "qr_solve.h"
41
-  #endif
42
-#endif // AUTO_BED_LEVELING_FEATURE
39
+#endif
43
 
40
 
44
-#if ENABLED(MESH_BED_LEVELING)
41
+#if ENABLED(AUTO_BED_LEVELING_LINEAR)
42
+  #include "qr_solve.h"
43
+#elif ENABLED(MESH_BED_LEVELING)
45
   #include "mesh_bed_leveling.h"
44
   #include "mesh_bed_leveling.h"
46
 #endif
45
 #endif
47
 
46
 
497
 
496
 
498
 #endif
497
 #endif
499
 
498
 
500
-#if ENABLED(SCARA)
499
+#if IS_SCARA
500
+  // Float constants for SCARA calculations
501
+  const float L1 = SCARA_LINKAGE_1, L2 = SCARA_LINKAGE_2,
502
+              L1_2 = sq(float(L1)), L1_2_2 = 2.0 * L1_2,
503
+              L2_2 = sq(float(L2));
504
+
501
   float delta_segments_per_second = SCARA_SEGMENTS_PER_SECOND,
505
   float delta_segments_per_second = SCARA_SEGMENTS_PER_SECOND,
502
         delta[ABC],
506
         delta[ABC],
503
         axis_scaling[ABC] = { 1, 1, 1 },    // Build size scaling, default to 1
507
         axis_scaling[ABC] = { 1, 1, 1 },    // Build size scaling, default to 1
651
 }
655
 }
652
 inline void sync_plan_position_e() { planner.set_e_position_mm(current_position[E_AXIS]); }
656
 inline void sync_plan_position_e() { planner.set_e_position_mm(current_position[E_AXIS]); }
653
 
657
 
654
-#if ENABLED(DELTA) || ENABLED(SCARA)
658
+#if IS_KINEMATIC
655
   inline void sync_plan_position_delta() {
659
   inline void sync_plan_position_delta() {
656
     #if ENABLED(DEBUG_LEVELING_FEATURE)
660
     #if ENABLED(DEBUG_LEVELING_FEATURE)
657
       if (DEBUGGING(LEVELING)) DEBUG_POS("sync_plan_position_delta", current_position);
661
       if (DEBUGGING(LEVELING)) DEBUG_POS("sync_plan_position_delta", current_position);
2161
     // Prevent stepper_inactive_time from running out and EXTRUDER_RUNOUT_PREVENT from extruding
2165
     // Prevent stepper_inactive_time from running out and EXTRUDER_RUNOUT_PREVENT from extruding
2162
     refresh_cmd_timeout();
2166
     refresh_cmd_timeout();
2163
 
2167
 
2164
-    #if ENABLED(AUTO_BED_LEVELING_FEATURE)
2168
+    #if ENABLED(AUTO_BED_LEVELING_LINEAR)
2165
       planner.bed_level_matrix.set_to_identity();
2169
       planner.bed_level_matrix.set_to_identity();
2166
     #endif
2170
     #endif
2167
 
2171
 
2272
 
2276
 
2273
 #if ENABLED(AUTO_BED_LEVELING_FEATURE)
2277
 #if ENABLED(AUTO_BED_LEVELING_FEATURE)
2274
 
2278
 
2275
-  #if DISABLED(DELTA)
2279
+  #if ENABLED(AUTO_BED_LEVELING_LINEAR)
2276
 
2280
 
2277
     /**
2281
     /**
2278
      * Get the stepper positions, apply the rotation matrix
2282
      * Get the stepper positions, apply the rotation matrix
2302
       return pos;
2306
       return pos;
2303
     }
2307
     }
2304
 
2308
 
2305
-  #endif // !DELTA
2306
-
2307
-  #if ENABLED(DELTA)
2309
+  #elif ENABLED(AUTO_BED_LEVELING_NONLINEAR)
2308
 
2310
 
2309
     /**
2311
     /**
2310
      * All DELTA leveling in the Marlin uses NONLINEAR_BED_LEVELING
2312
      * All DELTA leveling in the Marlin uses NONLINEAR_BED_LEVELING
2870
     SERIAL_ECHOPGM("Machine Type: ");
2872
     SERIAL_ECHOPGM("Machine Type: ");
2871
     #if ENABLED(DELTA)
2873
     #if ENABLED(DELTA)
2872
       SERIAL_ECHOLNPGM("Delta");
2874
       SERIAL_ECHOLNPGM("Delta");
2873
-    #elif ENABLED(SCARA)
2875
+    #elif IS_SCARA
2874
       SERIAL_ECHOLNPGM("SCARA");
2876
       SERIAL_ECHOLNPGM("SCARA");
2875
     #elif ENABLED(COREXY) || ENABLED(COREXZ) || ENABLED(COREYZ)
2877
     #elif ENABLED(COREXY) || ENABLED(COREXZ) || ENABLED(COREYZ)
2876
       SERIAL_ECHOLNPGM("Core");
2878
       SERIAL_ECHOLNPGM("Core");
2947
   stepper.synchronize();
2949
   stepper.synchronize();
2948
 
2950
 
2949
   // For auto bed leveling, clear the level matrix
2951
   // For auto bed leveling, clear the level matrix
2950
-  #if ENABLED(AUTO_BED_LEVELING_FEATURE)
2952
+  #if ENABLED(AUTO_BED_LEVELING_LINEAR)
2951
     planner.bed_level_matrix.set_to_identity();
2953
     planner.bed_level_matrix.set_to_identity();
2952
-    #if ENABLED(DELTA)
2953
-      reset_bed_level();
2954
-    #endif
2954
+  #endif
2955
+
2956
+  #if ENABLED(AUTO_BED_LEVELING_NONLINEAR)
2957
+    reset_bed_level();
2955
   #endif
2958
   #endif
2956
 
2959
 
2957
   // Always home with tool 0 active
2960
   // Always home with tool 0 active
3533
 
3536
 
3534
     #if ENABLED(AUTO_BED_LEVELING_GRID)
3537
     #if ENABLED(AUTO_BED_LEVELING_GRID)
3535
 
3538
 
3536
-      #if DISABLED(DELTA)
3539
+      #if ENABLED(AUTO_BED_LEVELING_LINEAR)
3537
         bool do_topography_map = verbose_level > 2 || code_seen('T');
3540
         bool do_topography_map = verbose_level > 2 || code_seen('T');
3538
       #endif
3541
       #endif
3539
 
3542
 
3544
 
3547
 
3545
       int auto_bed_leveling_grid_points = AUTO_BED_LEVELING_GRID_POINTS;
3548
       int auto_bed_leveling_grid_points = AUTO_BED_LEVELING_GRID_POINTS;
3546
 
3549
 
3547
-      #if DISABLED(DELTA)
3550
+      #if ENABLED(AUTO_BED_LEVELING_LINEAR)
3548
         if (code_seen('P')) auto_bed_leveling_grid_points = code_value_int();
3551
         if (code_seen('P')) auto_bed_leveling_grid_points = code_value_int();
3549
         if (auto_bed_leveling_grid_points < 2) {
3552
         if (auto_bed_leveling_grid_points < 2) {
3550
           SERIAL_PROTOCOLLNPGM("?Number of probed (P)oints is implausible (2 minimum).");
3553
           SERIAL_PROTOCOLLNPGM("?Number of probed (P)oints is implausible (2 minimum).");
3594
 
3597
 
3595
     if (!dryrun) {
3598
     if (!dryrun) {
3596
 
3599
 
3597
-      // Reset the bed_level_matrix because leveling
3598
-      // needs to be done without leveling enabled.
3599
-      planner.bed_level_matrix.set_to_identity();
3600
+      #if ENABLED(AUTO_BED_LEVELING_LINEAR)
3601
+        // Reset the bed_level_matrix because leveling
3602
+        // needs to be done without leveling enabled.
3603
+        planner.bed_level_matrix.set_to_identity();
3604
+      #endif
3600
 
3605
 
3601
       //
3606
       //
3602
       // Re-orient the current position without leveling
3607
       // Re-orient the current position without leveling
3603
       // based on where the steppers are positioned.
3608
       // based on where the steppers are positioned.
3604
       //
3609
       //
3605
-      #if ENABLED(DELTA) || ENABLED(SCARA)
3610
+      #if IS_KINEMATIC
3606
 
3611
 
3607
-        #if ENABLED(DELTA)
3612
+        #if ENABLED(AUTO_BED_LEVELING_NONLINEAR)
3608
           reset_bed_level();
3613
           reset_bed_level();
3609
         #endif
3614
         #endif
3610
 
3615
 
3639
       const float xGridSpacing = (right_probe_bed_position - left_probe_bed_position) / (auto_bed_leveling_grid_points - 1),
3644
       const float xGridSpacing = (right_probe_bed_position - left_probe_bed_position) / (auto_bed_leveling_grid_points - 1),
3640
                   yGridSpacing = (back_probe_bed_position - front_probe_bed_position) / (auto_bed_leveling_grid_points - 1);
3645
                   yGridSpacing = (back_probe_bed_position - front_probe_bed_position) / (auto_bed_leveling_grid_points - 1);
3641
 
3646
 
3642
-      #if ENABLED(DELTA)
3647
+      #if ENABLED(AUTO_BED_LEVELING_NONLINEAR)
3643
         delta_grid_spacing[X_AXIS] = xGridSpacing;
3648
         delta_grid_spacing[X_AXIS] = xGridSpacing;
3644
         delta_grid_spacing[Y_AXIS] = yGridSpacing;
3649
         delta_grid_spacing[Y_AXIS] = yGridSpacing;
3645
         float zoffset = zprobe_zoffset;
3650
         float zoffset = zprobe_zoffset;
3646
         if (code_seen('Z')) zoffset += code_value_axis_units(Z_AXIS);
3651
         if (code_seen('Z')) zoffset += code_value_axis_units(Z_AXIS);
3647
-      #else // !DELTA
3652
+
3653
+      #elif ENABLED(AUTO_BED_LEVELING_LINEAR)
3654
+
3648
         /**
3655
         /**
3649
          * solve the plane equation ax + by + d = z
3656
          * solve the plane equation ax + by + d = z
3650
          * A is the matrix with rows [x y 1] for all the probed points
3657
          * A is the matrix with rows [x y 1] for all the probed points
3660
                eqnBVector[abl2],     // "B" vector of Z points
3667
                eqnBVector[abl2],     // "B" vector of Z points
3661
                mean = 0.0;
3668
                mean = 0.0;
3662
         int8_t indexIntoAB[auto_bed_leveling_grid_points][auto_bed_leveling_grid_points];
3669
         int8_t indexIntoAB[auto_bed_leveling_grid_points][auto_bed_leveling_grid_points];
3663
-      #endif // !DELTA
3670
+
3671
+      #endif // AUTO_BED_LEVELING_LINEAR
3664
 
3672
 
3665
       int probePointCounter = 0;
3673
       int probePointCounter = 0;
3666
       bool zig = auto_bed_leveling_grid_points & 1; //always end at [RIGHT_PROBE_BED_POSITION, BACK_PROBE_BED_POSITION]
3674
       bool zig = auto_bed_leveling_grid_points & 1; //always end at [RIGHT_PROBE_BED_POSITION, BACK_PROBE_BED_POSITION]
3694
 
3702
 
3695
           float measured_z = probe_pt(xProbe, yProbe, stow_probe_after_each, verbose_level);
3703
           float measured_z = probe_pt(xProbe, yProbe, stow_probe_after_each, verbose_level);
3696
 
3704
 
3697
-          #if DISABLED(DELTA)
3698
-            mean += measured_z;
3705
+          #if ENABLED(AUTO_BED_LEVELING_LINEAR)
3699
 
3706
 
3707
+            mean += measured_z;
3700
             eqnBVector[probePointCounter] = measured_z;
3708
             eqnBVector[probePointCounter] = measured_z;
3701
             eqnAMatrix[probePointCounter + 0 * abl2] = xProbe;
3709
             eqnAMatrix[probePointCounter + 0 * abl2] = xProbe;
3702
             eqnAMatrix[probePointCounter + 1 * abl2] = yProbe;
3710
             eqnAMatrix[probePointCounter + 1 * abl2] = yProbe;
3703
             eqnAMatrix[probePointCounter + 2 * abl2] = 1;
3711
             eqnAMatrix[probePointCounter + 2 * abl2] = 1;
3704
             indexIntoAB[xCount][yCount] = probePointCounter;
3712
             indexIntoAB[xCount][yCount] = probePointCounter;
3705
-          #else
3713
+
3714
+          #elif ENABLED(AUTO_BED_LEVELING_NONLINEAR)
3715
+
3706
             bed_level[xCount][yCount] = measured_z + zoffset;
3716
             bed_level[xCount][yCount] = measured_z + zoffset;
3717
+
3707
           #endif
3718
           #endif
3708
 
3719
 
3709
           probePointCounter++;
3720
           probePointCounter++;
3713
         } //xProbe
3724
         } //xProbe
3714
       } //yProbe
3725
       } //yProbe
3715
 
3726
 
3716
-    #else // !AUTO_BED_LEVELING_GRID
3727
+    #elif ENABLED(AUTO_BED_LEVELING_3POINT)
3717
 
3728
 
3718
       #if ENABLED(DEBUG_LEVELING_FEATURE)
3729
       #if ENABLED(DEBUG_LEVELING_FEATURE)
3719
         if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> 3-point Leveling");
3730
         if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> 3-point Leveling");
3759
 
3770
 
3760
     // Calculate leveling, print reports, correct the position
3771
     // Calculate leveling, print reports, correct the position
3761
     #if ENABLED(AUTO_BED_LEVELING_GRID)
3772
     #if ENABLED(AUTO_BED_LEVELING_GRID)
3762
-      #if ENABLED(DELTA)
3773
+      #if ENABLED(AUTO_BED_LEVELING_NONLINEAR)
3763
 
3774
 
3764
         if (!dryrun) extrapolate_unprobed_bed_level();
3775
         if (!dryrun) extrapolate_unprobed_bed_level();
3765
         print_bed_level();
3776
         print_bed_level();
3766
 
3777
 
3767
-      #else // !DELTA
3778
+      #elif ENABLED(AUTO_BED_LEVELING_LINEAR)
3768
 
3779
 
3769
         // solve lsq problem
3780
         // solve lsq problem
3770
         double plane_equation_coefficients[3];
3781
         double plane_equation_coefficients[3];
3860
           }
3871
           }
3861
         } //do_topography_map
3872
         } //do_topography_map
3862
 
3873
 
3863
-      #endif //!DELTA
3874
+      #endif // AUTO_BED_LEVELING_LINEAR
3864
 
3875
 
3865
     #endif // AUTO_BED_LEVELING_GRID
3876
     #endif // AUTO_BED_LEVELING_GRID
3866
 
3877
 
3867
-    #if DISABLED(DELTA)
3878
+    #if ENABLED(AUTO_BED_LEVELING_LINEAR)
3868
 
3879
 
3869
       if (verbose_level > 0)
3880
       if (verbose_level > 0)
3870
         planner.bed_level_matrix.debug("\n\nBed Level Correction Matrix:");
3881
         planner.bed_level_matrix.debug("\n\nBed Level Correction Matrix:");
4358
     if (verbose_level > 2)
4369
     if (verbose_level > 2)
4359
       SERIAL_PROTOCOLLNPGM("Positioning the probe...");
4370
       SERIAL_PROTOCOLLNPGM("Positioning the probe...");
4360
 
4371
 
4361
-    #if ENABLED(DELTA)
4372
+    #if ENABLED(AUTO_BED_LEVELING_NONLINEAR)
4362
       // we don't do bed level correction in M48 because we want the raw data when we probe
4373
       // we don't do bed level correction in M48 because we want the raw data when we probe
4363
       reset_bed_level();
4374
       reset_bed_level();
4364
-    #elif ENABLED(AUTO_BED_LEVELING_FEATURE)
4375
+    #elif ENABLED(AUTO_BED_LEVELING_LINEAR)
4365
       // we don't do bed level correction in M48 because we want the raw data when we probe
4376
       // we don't do bed level correction in M48 because we want the raw data when we probe
4366
       planner.bed_level_matrix.set_to_identity();
4377
       planner.bed_level_matrix.set_to_identity();
4367
     #endif
4378
     #endif
6361
       lastpos[i] = destination[i] = current_position[i];
6372
       lastpos[i] = destination[i] = current_position[i];
6362
 
6373
 
6363
     // Define runplan for move axes
6374
     // Define runplan for move axes
6364
-    #if ENABLED(DELTA)
6375
+    #if IS_KINEMATIC
6365
       #define RUNPLAN(RATE_MM_S) inverse_kinematics(destination); \
6376
       #define RUNPLAN(RATE_MM_S) inverse_kinematics(destination); \
6366
                                  planner.buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], destination[E_AXIS], RATE_MM_S, active_extruder);
6377
                                  planner.buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], destination[E_AXIS], RATE_MM_S, active_extruder);
6367
     #else
6378
     #else
6482
     destination[E_AXIS] = lastpos[E_AXIS];
6493
     destination[E_AXIS] = lastpos[E_AXIS];
6483
     planner.set_e_position_mm(current_position[E_AXIS]);
6494
     planner.set_e_position_mm(current_position[E_AXIS]);
6484
 
6495
 
6485
-    #if ENABLED(DELTA)
6496
+    #if IS_KINEMATIC
6486
       // Move XYZ to starting position, then E
6497
       // Move XYZ to starting position, then E
6487
       inverse_kinematics(lastpos);
6498
       inverse_kinematics(lastpos);
6488
       planner.buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], destination[E_AXIS], FILAMENT_CHANGE_XY_FEEDRATE, active_extruder);
6499
       planner.buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], destination[E_AXIS], FILAMENT_CHANGE_XY_FEEDRATE, active_extruder);
6925
            * Z software endstop. But this is technically correct (and
6936
            * Z software endstop. But this is technically correct (and
6926
            * there is no viable alternative).
6937
            * there is no viable alternative).
6927
            */
6938
            */
6928
-          #if ENABLED(AUTO_BED_LEVELING_FEATURE)
6939
+          #if ENABLED(AUTO_BED_LEVELING_LINEAR)
6929
             // Offset extruder, make sure to apply the bed level rotation matrix
6940
             // Offset extruder, make sure to apply the bed level rotation matrix
6930
             vector_3 tmp_offset_vec = vector_3(hotend_offset[X_AXIS][tmp_extruder],
6941
             vector_3 tmp_offset_vec = vector_3(hotend_offset[X_AXIS][tmp_extruder],
6931
                                                hotend_offset[Y_AXIS][tmp_extruder],
6942
                                                hotend_offset[Y_AXIS][tmp_extruder],
7961
                              stepper.get_axis_position_mm(C_AXIS));
7972
                              stepper.get_axis_position_mm(C_AXIS));
7962
   }
7973
   }
7963
 
7974
 
7964
-  #if ENABLED(AUTO_BED_LEVELING_FEATURE)
7975
+  #if ENABLED(AUTO_BED_LEVELING_NONLINEAR)
7965
 
7976
 
7966
     // Adjust print surface height by linear interpolation over the bed_level array.
7977
     // Adjust print surface height by linear interpolation over the bed_level array.
7967
     void adjust_delta(float cartesian[XYZ]) {
7978
     void adjust_delta(float cartesian[XYZ]) {
8001
       SERIAL_ECHOPGM(" offset="); SERIAL_ECHOLN(offset);
8012
       SERIAL_ECHOPGM(" offset="); SERIAL_ECHOLN(offset);
8002
       */
8013
       */
8003
     }
8014
     }
8004
-  #endif // AUTO_BED_LEVELING_FEATURE
8015
+  #endif // AUTO_BED_LEVELING_NONLINEAR
8005
 
8016
 
8006
 #endif // DELTA
8017
 #endif // DELTA
8007
 
8018
 
8076
 }
8087
 }
8077
 #endif  // MESH_BED_LEVELING
8088
 #endif  // MESH_BED_LEVELING
8078
 
8089
 
8079
-#if ENABLED(DELTA) || ENABLED(SCARA)
8090
+#if IS_KINEMATIC
8080
 
8091
 
8081
   inline bool prepare_kinematic_move_to(float target[NUM_AXIS]) {
8092
   inline bool prepare_kinematic_move_to(float target[NUM_AXIS]) {
8082
     float difference[NUM_AXIS];
8093
     float difference[NUM_AXIS];
8103
 
8114
 
8104
       inverse_kinematics(target);
8115
       inverse_kinematics(target);
8105
 
8116
 
8106
-      #if ENABLED(DELTA) && ENABLED(AUTO_BED_LEVELING_FEATURE)
8117
+      #if ENABLED(DELTA) && ENABLED(AUTO_BED_LEVELING_NONLINEAR)
8107
         if (!bed_leveling_in_progress) adjust_delta(target);
8118
         if (!bed_leveling_in_progress) adjust_delta(target);
8108
       #endif
8119
       #endif
8109
 
8120
 
8115
     return true;
8126
     return true;
8116
   }
8127
   }
8117
 
8128
 
8118
-#endif // DELTA || SCARA
8129
+#endif // IS_KINEMATIC
8119
 
8130
 
8120
 #if ENABLED(DUAL_X_CARRIAGE)
8131
 #if ENABLED(DUAL_X_CARRIAGE)
8121
 
8132
 
8161
 
8172
 
8162
 #endif // DUAL_X_CARRIAGE
8173
 #endif // DUAL_X_CARRIAGE
8163
 
8174
 
8164
-#if DISABLED(DELTA) && DISABLED(SCARA)
8175
+#if !IS_KINEMATIC
8165
 
8176
 
8166
   inline bool prepare_move_to_destination_cartesian() {
8177
   inline bool prepare_move_to_destination_cartesian() {
8167
     // Do not use feedrate_percentage for E or Z only moves
8178
     // Do not use feedrate_percentage for E or Z only moves
8181
     return true;
8192
     return true;
8182
   }
8193
   }
8183
 
8194
 
8184
-#endif // !DELTA && !SCARA
8195
+#endif // !IS_KINEMATIC
8185
 
8196
 
8186
 #if ENABLED(PREVENT_COLD_EXTRUSION)
8197
 #if ENABLED(PREVENT_COLD_EXTRUSION)
8187
 
8198
 
8220
     prevent_dangerous_extrude(current_position[E_AXIS], destination[E_AXIS]);
8231
     prevent_dangerous_extrude(current_position[E_AXIS], destination[E_AXIS]);
8221
   #endif
8232
   #endif
8222
 
8233
 
8223
-  #if ENABLED(DELTA) || ENABLED(SCARA)
8234
+  #if IS_KINEMATIC
8224
     if (!prepare_kinematic_move_to(destination)) return;
8235
     if (!prepare_kinematic_move_to(destination)) return;
8225
   #else
8236
   #else
8226
     #if ENABLED(DUAL_X_CARRIAGE)
8237
     #if ENABLED(DUAL_X_CARRIAGE)
8356
 
8367
 
8357
       clamp_to_software_endstops(arc_target);
8368
       clamp_to_software_endstops(arc_target);
8358
 
8369
 
8359
-      #if ENABLED(DELTA) || ENABLED(SCARA)
8370
+      #if IS_KINEMATIC
8360
         inverse_kinematics(arc_target);
8371
         inverse_kinematics(arc_target);
8361
-        #if ENABLED(DELTA) && ENABLED(AUTO_BED_LEVELING_FEATURE)
8372
+        #if ENABLED(DELTA) && ENABLED(AUTO_BED_LEVELING_NONLINEAR)
8362
           adjust_delta(arc_target);
8373
           adjust_delta(arc_target);
8363
         #endif
8374
         #endif
8364
         planner.buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], arc_target[E_AXIS], fr_mm_s, active_extruder);
8375
         planner.buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], arc_target[E_AXIS], fr_mm_s, active_extruder);
8368
     }
8379
     }
8369
 
8380
 
8370
     // Ensure last segment arrives at target location.
8381
     // Ensure last segment arrives at target location.
8371
-    #if ENABLED(DELTA) || ENABLED(SCARA)
8382
+    #if IS_KINEMATIC
8372
       inverse_kinematics(target);
8383
       inverse_kinematics(target);
8373
-      #if ENABLED(DELTA) && ENABLED(AUTO_BED_LEVELING_FEATURE)
8384
+      #if ENABLED(DELTA) && ENABLED(AUTO_BED_LEVELING_NONLINEAR)
8374
         adjust_delta(target);
8385
         adjust_delta(target);
8375
       #endif
8386
       #endif
8376
       planner.buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], target[E_AXIS], fr_mm_s, active_extruder);
8387
       planner.buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], target[E_AXIS], fr_mm_s, active_extruder);

+ 4
- 4
Marlin/configuration_store.cpp View File

330
   #endif
330
   #endif
331
   EEPROM_WRITE(lcd_contrast);
331
   EEPROM_WRITE(lcd_contrast);
332
 
332
 
333
-  #if ENABLED(SCARA)
333
+  #if IS_SCARA
334
     EEPROM_WRITE(axis_scaling); // 3 floats
334
     EEPROM_WRITE(axis_scaling); // 3 floats
335
   #else
335
   #else
336
     dummy = 1.0f;
336
     dummy = 1.0f;
520
     #endif
520
     #endif
521
     EEPROM_READ(lcd_contrast);
521
     EEPROM_READ(lcd_contrast);
522
 
522
 
523
-    #if ENABLED(SCARA)
523
+    #if IS_SCARA
524
       EEPROM_READ(axis_scaling);  // 3 floats
524
       EEPROM_READ(axis_scaling);  // 3 floats
525
     #else
525
     #else
526
       EEPROM_READ(dummy);
526
       EEPROM_READ(dummy);
584
     planner.axis_steps_per_mm[i] = tmp1[i];
584
     planner.axis_steps_per_mm[i] = tmp1[i];
585
     planner.max_feedrate_mm_s[i] = tmp2[i];
585
     planner.max_feedrate_mm_s[i] = tmp2[i];
586
     planner.max_acceleration_mm_per_s2[i] = tmp3[i];
586
     planner.max_acceleration_mm_per_s2[i] = tmp3[i];
587
-    #if ENABLED(SCARA)
587
+    #if IS_SCARA
588
       if (i < COUNT(axis_scaling))
588
       if (i < COUNT(axis_scaling))
589
         axis_scaling[i] = 1;
589
         axis_scaling[i] = 1;
590
     #endif
590
     #endif
716
 
716
 
717
   CONFIG_ECHO_START;
717
   CONFIG_ECHO_START;
718
 
718
 
719
-  #if ENABLED(SCARA)
719
+  #if IS_SCARA
720
     if (!forReplay) {
720
     if (!forReplay) {
721
       SERIAL_ECHOLNPGM("Scaling factors:");
721
       SERIAL_ECHOLNPGM("Scaling factors:");
722
       CONFIG_ECHO_START;
722
       CONFIG_ECHO_START;

+ 5
- 5
Marlin/planner.cpp View File

98
       Planner::max_e_jerk,
98
       Planner::max_e_jerk,
99
       Planner::min_travel_feedrate_mm_s;
99
       Planner::min_travel_feedrate_mm_s;
100
 
100
 
101
-#if ENABLED(AUTO_BED_LEVELING_FEATURE)
101
+#if ENABLED(AUTO_BED_LEVELING_LINEAR)
102
   matrix_3x3 Planner::bed_level_matrix; // Transform to compensate for bed level
102
   matrix_3x3 Planner::bed_level_matrix; // Transform to compensate for bed level
103
 #endif
103
 #endif
104
 
104
 
138
   memset(position, 0, sizeof(position)); // clear position
138
   memset(position, 0, sizeof(position)); // clear position
139
   LOOP_XYZE(i) previous_speed[i] = 0.0;
139
   LOOP_XYZE(i) previous_speed[i] = 0.0;
140
   previous_nominal_speed = 0.0;
140
   previous_nominal_speed = 0.0;
141
-  #if ENABLED(AUTO_BED_LEVELING_FEATURE)
141
+  #if ENABLED(AUTO_BED_LEVELING_LINEAR)
142
     bed_level_matrix.set_to_identity();
142
     bed_level_matrix.set_to_identity();
143
   #endif
143
   #endif
144
 }
144
 }
521
   #endif
521
   #endif
522
 }
522
 }
523
 
523
 
524
-#if ENABLED(AUTO_BED_LEVELING_FEATURE) || ENABLED(MESH_BED_LEVELING)
524
+#if PLANNER_LEVELING
525
 
525
 
526
   void Planner::apply_leveling(
526
   void Planner::apply_leveling(
527
     #if ENABLED(MESH_BED_LEVELING)
527
     #if ENABLED(MESH_BED_LEVELING)
551
     #endif
551
     #endif
552
   }
552
   }
553
 
553
 
554
-#endif
554
+#endif // PLANNER_LEVELING
555
 
555
 
556
 /**
556
 /**
557
  * Planner::buffer_line
557
  * Planner::buffer_line
1193
 // Recalculate position, steps_to_mm if axis_steps_per_mm changes!
1193
 // Recalculate position, steps_to_mm if axis_steps_per_mm changes!
1194
 void Planner::refresh_positioning() {
1194
 void Planner::refresh_positioning() {
1195
   LOOP_XYZE(i) steps_to_mm[i] = 1.0 / axis_steps_per_mm[i];
1195
   LOOP_XYZE(i) steps_to_mm[i] = 1.0 / axis_steps_per_mm[i];
1196
-  #if ENABLED(DELTA) || ENABLED(SCARA)
1196
+  #if IS_KINEMATIC
1197
     inverse_kinematics(current_position);
1197
     inverse_kinematics(current_position);
1198
     set_position_mm(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS]);
1198
     set_position_mm(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS]);
1199
   #else
1199
   #else

+ 1
- 1
Marlin/planner_bezier.cpp View File

188
     bez_target[E_AXIS] = interp(position[E_AXIS], target[E_AXIS], t);
188
     bez_target[E_AXIS] = interp(position[E_AXIS], target[E_AXIS], t);
189
     clamp_to_software_endstops(bez_target);
189
     clamp_to_software_endstops(bez_target);
190
 
190
 
191
-    #if ENABLED(DELTA) || ENABLED(SCARA)
191
+    #if IS_KINEMATIC
192
       inverse_kinematics(bez_target);
192
       inverse_kinematics(bez_target);
193
       #if ENABLED(DELTA) && ENABLED(AUTO_BED_LEVELING_FEATURE)
193
       #if ENABLED(DELTA) && ENABLED(AUTO_BED_LEVELING_FEATURE)
194
         adjust_delta(bez_target);
194
         adjust_delta(bez_target);

+ 1
- 1
Marlin/qr_solve.cpp View File

22
 
22
 
23
 #include "qr_solve.h"
23
 #include "qr_solve.h"
24
 
24
 
25
-#if ENABLED(AUTO_BED_LEVELING_GRID)
25
+#if ENABLED(AUTO_BED_LEVELING_LINEAR)
26
 
26
 
27
 #include <stdlib.h>
27
 #include <stdlib.h>
28
 #include <math.h>
28
 #include <math.h>

+ 2
- 2
Marlin/ultralcd.cpp View File

1418
    *
1418
    *
1419
    */
1419
    */
1420
 
1420
 
1421
-  #if ENABLED(DELTA) || ENABLED(SCARA)
1421
+  #if IS_KINEMATIC
1422
     #define _MOVE_XYZ_ALLOWED (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS])
1422
     #define _MOVE_XYZ_ALLOWED (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS])
1423
   #else
1423
   #else
1424
     #define _MOVE_XYZ_ALLOWED true
1424
     #define _MOVE_XYZ_ALLOWED true
1823
     #if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
1823
     #if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
1824
       MENU_ITEM_EDIT(bool, MSG_ENDSTOP_ABORT, &stepper.abort_on_endstop_hit);
1824
       MENU_ITEM_EDIT(bool, MSG_ENDSTOP_ABORT, &stepper.abort_on_endstop_hit);
1825
     #endif
1825
     #endif
1826
-    #if ENABLED(SCARA)
1826
+    #if IS_SCARA
1827
       MENU_ITEM_EDIT(float74, MSG_XSCALE, &axis_scaling[X_AXIS], 0.5, 2);
1827
       MENU_ITEM_EDIT(float74, MSG_XSCALE, &axis_scaling[X_AXIS], 0.5, 2);
1828
       MENU_ITEM_EDIT(float74, MSG_YSCALE, &axis_scaling[Y_AXIS], 0.5, 2);
1828
       MENU_ITEM_EDIT(float74, MSG_YSCALE, &axis_scaling[Y_AXIS], 0.5, 2);
1829
     #endif
1829
     #endif

Loading…
Cancel
Save