Browse Source

Merge pull request #4789 from thinkyhead/rc_better_leveling_etc

Various cleanups ahead of more…
Scott Lahteine 8 years ago
parent
commit
94d5cf8721
35 changed files with 1753 additions and 1404 deletions
  1. 37
    15
      Marlin/Conditionals_post.h
  2. 9
    7
      Marlin/Configuration_adv.h
  3. 23
    17
      Marlin/Marlin.h
  4. 3
    0
      Marlin/MarlinSerial.cpp
  5. 1203
    1116
      Marlin/Marlin_main.cpp
  6. 171
    10
      Marlin/SanityCheck.h
  7. 4
    4
      Marlin/configuration_store.cpp
  8. 2
    1
      Marlin/enum.h
  9. 9
    7
      Marlin/example_configurations/Cartesio/Configuration_adv.h
  10. 9
    7
      Marlin/example_configurations/Felix/Configuration_adv.h
  11. 9
    7
      Marlin/example_configurations/Hephestos/Configuration_adv.h
  12. 9
    7
      Marlin/example_configurations/Hephestos_2/Configuration_adv.h
  13. 9
    7
      Marlin/example_configurations/K8200/Configuration_adv.h
  14. 9
    7
      Marlin/example_configurations/K8400/Configuration_adv.h
  15. 9
    7
      Marlin/example_configurations/RigidBot/Configuration_adv.h
  16. 25
    23
      Marlin/example_configurations/SCARA/Configuration.h
  17. 9
    7
      Marlin/example_configurations/SCARA/Configuration_adv.h
  18. 9
    7
      Marlin/example_configurations/TAZ4/Configuration_adv.h
  19. 9
    7
      Marlin/example_configurations/WITBOX/Configuration_adv.h
  20. 9
    7
      Marlin/example_configurations/delta/biv2.5/Configuration_adv.h
  21. 9
    7
      Marlin/example_configurations/delta/generic/Configuration_adv.h
  22. 9
    7
      Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h
  23. 9
    7
      Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h
  24. 9
    7
      Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h
  25. 9
    7
      Marlin/example_configurations/makibox/Configuration_adv.h
  26. 9
    7
      Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h
  27. 3
    3
      Marlin/language.h
  28. 3
    0
      Marlin/language_en.h
  29. 6
    1
      Marlin/macros.h
  30. 63
    53
      Marlin/planner.cpp
  31. 32
    26
      Marlin/planner.h
  32. 1
    1
      Marlin/planner_bezier.cpp
  33. 1
    1
      Marlin/qr_solve.cpp
  34. 12
    5
      Marlin/stepper.h
  35. 2
    2
      Marlin/ultralcd.cpp

+ 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

+ 9
- 7
Marlin/Configuration_adv.h View File

168
 
168
 
169
 // @section extruder
169
 // @section extruder
170
 
170
 
171
-//  extruder run-out prevention.
172
-//if the machine is idle, and the temperature over MINTEMP, every couple of SECONDS some filament is extruded
171
+// Extruder runout prevention.
172
+// If the machine is idle and the temperature over MINTEMP
173
+// then extrude some filament every couple of SECONDS.
173
 //#define EXTRUDER_RUNOUT_PREVENT
174
 //#define EXTRUDER_RUNOUT_PREVENT
174
-#define EXTRUDER_RUNOUT_MINTEMP 190
175
-#define EXTRUDER_RUNOUT_SECONDS 30
176
-#define EXTRUDER_RUNOUT_ESTEPS 14   // mm filament
177
-#define EXTRUDER_RUNOUT_SPEED 1500  // extrusion speed
178
-#define EXTRUDER_RUNOUT_EXTRUDE 100
175
+#if ENABLED(EXTRUDER_RUNOUT_PREVENT)
176
+  #define EXTRUDER_RUNOUT_MINTEMP 190
177
+  #define EXTRUDER_RUNOUT_SECONDS 30
178
+  #define EXTRUDER_RUNOUT_SPEED 1500  // mm/m
179
+  #define EXTRUDER_RUNOUT_EXTRUDE 5   // mm
180
+#endif
179
 
181
 
180
 // @section temperature
182
 // @section temperature
181
 
183
 

+ 23
- 17
Marlin/Marlin.h View File

220
 void FlushSerialRequestResend();
220
 void FlushSerialRequestResend();
221
 void ok_to_send();
221
 void ok_to_send();
222
 
222
 
223
-void reset_bed_level();
224
 void kill(const char*);
223
 void kill(const char*);
225
 
224
 
226
 void quickstop_stepper();
225
 void quickstop_stepper();
266
 extern bool axis_homed[XYZ]; // axis[n].is_homed
265
 extern bool axis_homed[XYZ]; // axis[n].is_homed
267
 extern volatile bool wait_for_heatup;
266
 extern volatile bool wait_for_heatup;
268
 
267
 
268
+#if ENABLED(EMERGENCY_PARSER) && DISABLED(ULTIPANEL)
269
+  extern volatile bool wait_for_user;
270
+#endif
271
+
269
 extern float current_position[NUM_AXIS];
272
 extern float current_position[NUM_AXIS];
270
 extern float position_shift[XYZ];
273
 extern float position_shift[XYZ];
271
 extern float home_offset[XYZ];
274
 extern float home_offset[XYZ];
298
 float code_value_temp_abs();
301
 float code_value_temp_abs();
299
 float code_value_temp_diff();
302
 float code_value_temp_diff();
300
 
303
 
301
-#if ENABLED(DELTA)
304
+#if IS_KINEMATIC
302
   extern float delta[ABC];
305
   extern float delta[ABC];
303
-  extern float endstop_adj[ABC]; // axis[n].endstop_adj
304
-  extern float delta_radius;
305
-  extern float delta_diagonal_rod;
306
-  extern float delta_segments_per_second;
307
-  extern float delta_diagonal_rod_trim_tower_1;
308
-  extern float delta_diagonal_rod_trim_tower_2;
309
-  extern float delta_diagonal_rod_trim_tower_3;
310
   void inverse_kinematics(const float cartesian[XYZ]);
306
   void inverse_kinematics(const float cartesian[XYZ]);
307
+#endif
308
+
309
+#if ENABLED(DELTA)
310
+  extern float delta[ABC],
311
+               endstop_adj[ABC],
312
+               delta_radius,
313
+               delta_diagonal_rod,
314
+               delta_segments_per_second,
315
+               delta_diagonal_rod_trim_tower_1,
316
+               delta_diagonal_rod_trim_tower_2,
317
+               delta_diagonal_rod_trim_tower_3;
311
   void recalc_delta_settings(float radius, float diagonal_rod);
318
   void recalc_delta_settings(float radius, float diagonal_rod);
312
-  #if ENABLED(AUTO_BED_LEVELING_FEATURE)
313
-    extern int delta_grid_spacing[2];
314
-    void adjust_delta(float cartesian[XYZ]);
315
-  #endif
316
-#elif ENABLED(SCARA)
317
-  extern float delta[ABC];
319
+#elif IS_SCARA
318
   extern float axis_scaling[ABC];  // Build size scaling
320
   extern float axis_scaling[ABC];  // Build size scaling
319
-  void inverse_kinematics(const float cartesian[XYZ]);
320
-  void forward_kinematics_SCARA(float f_scara[ABC]);
321
+  void forward_kinematics_SCARA(const float &a, const float &b);
322
+#endif
323
+
324
+#if ENABLED(AUTO_BED_LEVELING_NONLINEAR)
325
+  extern int nonlinear_grid_spacing[2];
326
+  void adjust_delta(float cartesian[XYZ]);
321
 #endif
327
 #endif
322
 
328
 
323
 #if ENABLED(Z_DUAL_ENDSTOPS)
329
 #if ENABLED(Z_DUAL_ENDSTOPS)

+ 3
- 0
Marlin/MarlinSerial.cpp View File

509
           switch (state) {
509
           switch (state) {
510
             case state_M108:
510
             case state_M108:
511
               wait_for_heatup = false;
511
               wait_for_heatup = false;
512
+              #if DISABLED(ULTIPANEL)
513
+                wait_for_user = false;
514
+              #endif
512
               break;
515
               break;
513
             case state_M112:
516
             case state_M112:
514
               kill(PSTR(MSG_KILLED));
517
               kill(PSTR(MSG_KILLED));

+ 1203
- 1116
Marlin/Marlin_main.cpp
File diff suppressed because it is too large
View File


+ 171
- 10
Marlin/SanityCheck.h View File

137
   #error Please replace "const int dropsegments" with "#define MIN_STEPS_PER_SEGMENT" (and increase by 1) in Configuration_adv.h.
137
   #error Please replace "const int dropsegments" with "#define MIN_STEPS_PER_SEGMENT" (and increase by 1) in Configuration_adv.h.
138
 #elif defined(PREVENT_DANGEROUS_EXTRUDE)
138
 #elif defined(PREVENT_DANGEROUS_EXTRUDE)
139
   #error "PREVENT_DANGEROUS_EXTRUDE is now PREVENT_COLD_EXTRUSION. Please update your configuration."
139
   #error "PREVENT_DANGEROUS_EXTRUDE is now PREVENT_COLD_EXTRUSION. Please update your configuration."
140
+#elif defined(SCARA)
141
+  #error "SCARA is now MORGAN_SCARA. Please update your configuration."
140
 #endif
142
 #endif
141
 
143
 
142
 /**
144
 /**
179
 #if ENABLED(LCD_PROGRESS_BAR)
181
 #if ENABLED(LCD_PROGRESS_BAR)
180
   #if DISABLED(SDSUPPORT)
182
   #if DISABLED(SDSUPPORT)
181
     #error "LCD_PROGRESS_BAR requires SDSUPPORT."
183
     #error "LCD_PROGRESS_BAR requires SDSUPPORT."
182
-  #endif
183
-  #if ENABLED(DOGLCD)
184
+  #elif ENABLED(DOGLCD)
184
     #error "LCD_PROGRESS_BAR does not apply to graphical displays."
185
     #error "LCD_PROGRESS_BAR does not apply to graphical displays."
185
-  #endif
186
-  #if ENABLED(FILAMENT_LCD_DISPLAY)
186
+  #elif ENABLED(FILAMENT_LCD_DISPLAY)
187
     #error "LCD_PROGRESS_BAR and FILAMENT_LCD_DISPLAY are not fully compatible. Comment out this line to use both."
187
     #error "LCD_PROGRESS_BAR and FILAMENT_LCD_DISPLAY are not fully compatible. Comment out this line to use both."
188
   #endif
188
   #endif
189
 #endif
189
 #endif
573
 /**
573
 /**
574
  * Don't set more than one kinematic type
574
  * Don't set more than one kinematic type
575
  */
575
  */
576
-#if (ENABLED(DELTA) && (ENABLED(SCARA) || ENABLED(COREXY) || ENABLED(COREXZ) || ENABLED(COREYZ))) \
577
- || (ENABLED(SCARA) && (ENABLED(COREXY) || ENABLED(COREXZ) || ENABLED(COREYZ))) \
578
- || (ENABLED(COREXY) && (ENABLED(COREXZ) || ENABLED(COREYZ))) \
579
- || (ENABLED(COREXZ) && ENABLED(COREYZ))
580
-  #error "Please enable only one of DELTA, SCARA, COREXY, COREXZ, or COREYZ."
576
+#define COUNT_KIN_1 0
577
+#if ENABLED(DELTA)
578
+  #define COUNT_KIN_2 INCREMENT(COUNT_KIN_1)
579
+#else
580
+  #define COUNT_KIN_2 COUNT_KIN_1
581
+#endif
582
+#if ENABLED(MORGAN_SCARA)
583
+  #define COUNT_KIN_3 INCREMENT(COUNT_KIN_2)
584
+#else
585
+  #define COUNT_KIN_3 COUNT_KIN_2
586
+#endif
587
+#if ENABLED(MAKERARM_SCARA)
588
+  #define COUNT_KIN_4 INCREMENT(COUNT_KIN_3)
589
+#else
590
+  #define COUNT_KIN_4 COUNT_KIN_3
591
+#endif
592
+#if ENABLED(COREXY)
593
+  #define COUNT_KIN_5 INCREMENT(COUNT_KIN_4)
594
+#else
595
+  #define COUNT_KIN_5 COUNT_KIN_4
596
+#endif
597
+#if ENABLED(COREXZ)
598
+  #define COUNT_KIN_6 INCREMENT(COUNT_KIN_5)
599
+#else
600
+  #define COUNT_KIN_6 COUNT_KIN_5
601
+#endif
602
+#if ENABLED(COREYZ)
603
+  #define COUNT_KIN_7 INCREMENT(COUNT_KIN_6)
604
+#else
605
+  #define COUNT_KIN_7 COUNT_KIN_6
606
+#endif
607
+#if COUNT_KIN_7 > 1
608
+  #error "Please enable only one of DELTA, MORGAN_SCARA, MAKERARM_SCARA, COREXY, COREXZ, or COREYZ."
581
 #endif
609
 #endif
582
 
610
 
583
 /**
611
 /**
750
   #elif ENABLED(DELTA)
778
   #elif ENABLED(DELTA)
751
     #error "Z_DUAL_ENDSTOPS is not compatible with DELTA."
779
     #error "Z_DUAL_ENDSTOPS is not compatible with DELTA."
752
   #endif
780
   #endif
753
-#elif DISABLED(SCARA)
781
+#elif !IS_SCARA
754
   #if X_HOME_DIR < 0 && DISABLED(USE_XMIN_PLUG)
782
   #if X_HOME_DIR < 0 && DISABLED(USE_XMIN_PLUG)
755
     #error "Enable USE_XMIN_PLUG when homing X to MIN."
783
     #error "Enable USE_XMIN_PLUG when homing X to MIN."
756
   #elif X_HOME_DIR > 0 && DISABLED(USE_XMAX_PLUG)
784
   #elif X_HOME_DIR > 0 && DISABLED(USE_XMAX_PLUG)
783
     #error "I2C_SLAVE_ADDRESS can't be over 127. (Only 7 bits allowed.)"
811
     #error "I2C_SLAVE_ADDRESS can't be over 127. (Only 7 bits allowed.)"
784
   #endif
812
   #endif
785
 #endif
813
 #endif
814
+
815
+/**
816
+ * Make sure only one display is enabled
817
+ *
818
+ * Note: BQ_LCD_SMART_CONTROLLER => REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER
819
+ *       REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER => REPRAP_DISCOUNT_SMART_CONTROLLER
820
+ *       SAV_3DGLCD => U8GLIB_SH1106 => ULTIMAKERCONTROLLER
821
+ *       miniVIKI => ULTIMAKERCONTROLLER
822
+ *       VIKI2 => ULTIMAKERCONTROLLER
823
+ *       ELB_FULL_GRAPHIC_CONTROLLER => ULTIMAKERCONTROLLER
824
+ *       PANEL_ONE => ULTIMAKERCONTROLLER
825
+ */
826
+#define COUNT_LCD_1 0
827
+#if ENABLED(ULTIMAKERCONTROLLER) \
828
+    && DISABLED(SAV_3DGLCD) && DISABLED(miniVIKI) && DISABLED(VIKI2) \
829
+    && DISABLED(ELB_FULL_GRAPHIC_CONTROLLER) && DISABLED(PANEL_ONE)
830
+  #define COUNT_LCD_2 INCREMENT(COUNT_LCD_1)
831
+#else
832
+  #define COUNT_LCD_2 COUNT_LCD_1
833
+#endif
834
+#if ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER) && DISABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER)
835
+  #define COUNT_LCD_3 INCREMENT(COUNT_LCD_2)
836
+#else
837
+  #define COUNT_LCD_3 COUNT_LCD_2
838
+#endif
839
+#if ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) && DISABLED(BQ_LCD_SMART_CONTROLLER)
840
+  #define COUNT_LCD_4 INCREMENT(COUNT_LCD_3)
841
+#else
842
+  #define COUNT_LCD_4 COUNT_LCD_3
843
+#endif
844
+#if ENABLED(CARTESIO_UI)
845
+  #define COUNT_LCD_5 INCREMENT(COUNT_LCD_4)
846
+#else
847
+  #define COUNT_LCD_5 COUNT_LCD_4
848
+#endif
849
+#if ENABLED(PANEL_ONE)
850
+  #define COUNT_LCD_6 INCREMENT(COUNT_LCD_5)
851
+#else
852
+  #define COUNT_LCD_6 COUNT_LCD_5
853
+#endif
854
+#if ENABLED(MAKRPANEL)
855
+  #define COUNT_LCD_7 INCREMENT(COUNT_LCD_6)
856
+#else
857
+  #define COUNT_LCD_7 COUNT_LCD_6
858
+#endif
859
+#if ENABLED(REPRAPWORLD_GRAPHICAL_LCD)
860
+  #define COUNT_LCD_8 INCREMENT(COUNT_LCD_7)
861
+#else
862
+  #define COUNT_LCD_8 COUNT_LCD_7
863
+#endif
864
+#if ENABLED(VIKI2)
865
+  #define COUNT_LCD_9 INCREMENT(COUNT_LCD_8)
866
+#else
867
+  #define COUNT_LCD_9 COUNT_LCD_8
868
+#endif
869
+#if ENABLED(miniVIKI)
870
+  #define COUNT_LCD_10 INCREMENT(COUNT_LCD_9)
871
+#else
872
+  #define COUNT_LCD_10 COUNT_LCD_9
873
+#endif
874
+#if ENABLED(ELB_FULL_GRAPHIC_CONTROLLER)
875
+  #define COUNT_LCD_11 INCREMENT(COUNT_LCD_10)
876
+#else
877
+  #define COUNT_LCD_11 COUNT_LCD_10
878
+#endif
879
+#if ENABLED(G3D_PANEL)
880
+  #define COUNT_LCD_12 INCREMENT(COUNT_LCD_11)
881
+#else
882
+  #define COUNT_LCD_12 COUNT_LCD_11
883
+#endif
884
+#if ENABLED(MINIPANEL)
885
+  #define COUNT_LCD_13 INCREMENT(COUNT_LCD_12)
886
+#else
887
+  #define COUNT_LCD_13 COUNT_LCD_12
888
+#endif
889
+#if ENABLED(REPRAPWORLD_KEYPAD)
890
+  #define COUNT_LCD_14 INCREMENT(COUNT_LCD_13)
891
+#else
892
+  #define COUNT_LCD_14 COUNT_LCD_13
893
+#endif
894
+#if ENABLED(RIGIDBOT_PANEL)
895
+  #define COUNT_LCD_15 INCREMENT(COUNT_LCD_14)
896
+#else
897
+  #define COUNT_LCD_15 COUNT_LCD_14
898
+#endif
899
+#if ENABLED(RA_CONTROL_PANEL)
900
+  #define COUNT_LCD_16 INCREMENT(COUNT_LCD_15)
901
+#else
902
+  #define COUNT_LCD_16 COUNT_LCD_15
903
+#endif
904
+#if ENABLED(LCD_I2C_SAINSMART_YWROBOT)
905
+  #define COUNT_LCD_17 INCREMENT(COUNT_LCD_16)
906
+#else
907
+  #define COUNT_LCD_17 COUNT_LCD_16
908
+#endif
909
+#if ENABLED(LCM1602)
910
+  #define COUNT_LCD_18 INCREMENT(COUNT_LCD_17)
911
+#else
912
+  #define COUNT_LCD_18 COUNT_LCD_17
913
+#endif
914
+#if ENABLED(LCD_I2C_PANELOLU2)
915
+  #define COUNT_LCD_19 INCREMENT(COUNT_LCD_18)
916
+#else
917
+  #define COUNT_LCD_19 COUNT_LCD_18
918
+#endif
919
+#if ENABLED(LCD_I2C_VIKI)
920
+  #define COUNT_LCD_20 INCREMENT(COUNT_LCD_19)
921
+#else
922
+  #define COUNT_LCD_20 COUNT_LCD_19
923
+#endif
924
+#if ENABLED(U8GLIB_SSD1306)
925
+  #define COUNT_LCD_21 INCREMENT(COUNT_LCD_20)
926
+#else
927
+  #define COUNT_LCD_21 COUNT_LCD_20
928
+#endif
929
+#if ENABLED(SAV_3DLCD)
930
+  #define COUNT_LCD_22 INCREMENT(COUNT_LCD_21)
931
+#else
932
+  #define COUNT_LCD_22 COUNT_LCD_21
933
+#endif
934
+#if ENABLED(BQ_LCD_SMART_CONTROLLER)
935
+  #define COUNT_LCD_23 INCREMENT(COUNT_LCD_22)
936
+#else
937
+  #define COUNT_LCD_23 COUNT_LCD_22
938
+#endif
939
+#if ENABLED(SAV_3DGLCD)
940
+  #define COUNT_LCD_24 INCREMENT(COUNT_LCD_23)
941
+#else
942
+  #define COUNT_LCD_24 COUNT_LCD_23
943
+#endif
944
+#if COUNT_LCD_24 > 1
945
+  #error "Please select no more than one LCD controller option."
946
+#endif

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

+ 2
- 1
Marlin/enum.h View File

42
   E_AXIS  = 3,
42
   E_AXIS  = 3,
43
   X_HEAD  = 4,
43
   X_HEAD  = 4,
44
   Y_HEAD  = 5,
44
   Y_HEAD  = 5,
45
-  Z_HEAD  = 6
45
+  Z_HEAD  = 6,
46
+  ALL_AXES = 100
46
 };
47
 };
47
 
48
 
48
 #define LOOP_XYZ(VAR)  for (uint8_t VAR=X_AXIS; VAR<=Z_AXIS; VAR++)
49
 #define LOOP_XYZ(VAR)  for (uint8_t VAR=X_AXIS; VAR<=Z_AXIS; VAR++)

+ 9
- 7
Marlin/example_configurations/Cartesio/Configuration_adv.h View File

168
 
168
 
169
 // @section extruder
169
 // @section extruder
170
 
170
 
171
-//  extruder run-out prevention.
172
-//if the machine is idle, and the temperature over MINTEMP, every couple of SECONDS some filament is extruded
171
+// Extruder runout prevention.
172
+// If the machine is idle and the temperature over MINTEMP
173
+// then extrude some filament every couple of SECONDS.
173
 //#define EXTRUDER_RUNOUT_PREVENT
174
 //#define EXTRUDER_RUNOUT_PREVENT
174
-#define EXTRUDER_RUNOUT_MINTEMP 190
175
-#define EXTRUDER_RUNOUT_SECONDS 30
176
-#define EXTRUDER_RUNOUT_ESTEPS 14   // mm filament
177
-#define EXTRUDER_RUNOUT_SPEED 1500  // extrusion speed
178
-#define EXTRUDER_RUNOUT_EXTRUDE 100
175
+#if ENABLED(EXTRUDER_RUNOUT_PREVENT)
176
+  #define EXTRUDER_RUNOUT_MINTEMP 190
177
+  #define EXTRUDER_RUNOUT_SECONDS 30
178
+  #define EXTRUDER_RUNOUT_SPEED 1500  // mm/m
179
+  #define EXTRUDER_RUNOUT_EXTRUDE 5   // mm
180
+#endif
179
 
181
 
180
 // @section temperature
182
 // @section temperature
181
 
183
 

+ 9
- 7
Marlin/example_configurations/Felix/Configuration_adv.h View File

168
 
168
 
169
 // @section extruder
169
 // @section extruder
170
 
170
 
171
-//  extruder run-out prevention.
172
-//if the machine is idle, and the temperature over MINTEMP, every couple of SECONDS some filament is extruded
171
+// Extruder runout prevention.
172
+// If the machine is idle and the temperature over MINTEMP
173
+// then extrude some filament every couple of SECONDS.
173
 //#define EXTRUDER_RUNOUT_PREVENT
174
 //#define EXTRUDER_RUNOUT_PREVENT
174
-#define EXTRUDER_RUNOUT_MINTEMP 190
175
-#define EXTRUDER_RUNOUT_SECONDS 30
176
-#define EXTRUDER_RUNOUT_ESTEPS 14   // mm filament
177
-#define EXTRUDER_RUNOUT_SPEED 1500  // extrusion speed
178
-#define EXTRUDER_RUNOUT_EXTRUDE 100
175
+#if ENABLED(EXTRUDER_RUNOUT_PREVENT)
176
+  #define EXTRUDER_RUNOUT_MINTEMP 190
177
+  #define EXTRUDER_RUNOUT_SECONDS 30
178
+  #define EXTRUDER_RUNOUT_SPEED 1500  // mm/m
179
+  #define EXTRUDER_RUNOUT_EXTRUDE 5   // mm
180
+#endif
179
 
181
 
180
 // @section temperature
182
 // @section temperature
181
 
183
 

+ 9
- 7
Marlin/example_configurations/Hephestos/Configuration_adv.h View File

168
 
168
 
169
 // @section extruder
169
 // @section extruder
170
 
170
 
171
-//  extruder run-out prevention.
172
-//if the machine is idle, and the temperature over MINTEMP, every couple of SECONDS some filament is extruded
171
+// Extruder runout prevention.
172
+// If the machine is idle and the temperature over MINTEMP
173
+// then extrude some filament every couple of SECONDS.
173
 //#define EXTRUDER_RUNOUT_PREVENT
174
 //#define EXTRUDER_RUNOUT_PREVENT
174
-#define EXTRUDER_RUNOUT_MINTEMP 190
175
-#define EXTRUDER_RUNOUT_SECONDS 30
176
-#define EXTRUDER_RUNOUT_ESTEPS 14   // mm filament
177
-#define EXTRUDER_RUNOUT_SPEED 1500  // extrusion speed
178
-#define EXTRUDER_RUNOUT_EXTRUDE 100
175
+#if ENABLED(EXTRUDER_RUNOUT_PREVENT)
176
+  #define EXTRUDER_RUNOUT_MINTEMP 190
177
+  #define EXTRUDER_RUNOUT_SECONDS 30
178
+  #define EXTRUDER_RUNOUT_SPEED 1500  // mm/m
179
+  #define EXTRUDER_RUNOUT_EXTRUDE 5   // mm
180
+#endif
179
 
181
 
180
 // @section temperature
182
 // @section temperature
181
 
183
 

+ 9
- 7
Marlin/example_configurations/Hephestos_2/Configuration_adv.h View File

168
 
168
 
169
 // @section extruder
169
 // @section extruder
170
 
170
 
171
-//  extruder run-out prevention.
172
-//if the machine is idle, and the temperature over MINTEMP, every couple of SECONDS some filament is extruded
171
+// Extruder runout prevention.
172
+// If the machine is idle and the temperature over MINTEMP
173
+// then extrude some filament every couple of SECONDS.
173
 //#define EXTRUDER_RUNOUT_PREVENT
174
 //#define EXTRUDER_RUNOUT_PREVENT
174
-#define EXTRUDER_RUNOUT_MINTEMP 190
175
-#define EXTRUDER_RUNOUT_SECONDS 30
176
-#define EXTRUDER_RUNOUT_ESTEPS 14   // mm filament
177
-#define EXTRUDER_RUNOUT_SPEED 1500  // extrusion speed
178
-#define EXTRUDER_RUNOUT_EXTRUDE 100
175
+#if ENABLED(EXTRUDER_RUNOUT_PREVENT)
176
+  #define EXTRUDER_RUNOUT_MINTEMP 190
177
+  #define EXTRUDER_RUNOUT_SECONDS 30
178
+  #define EXTRUDER_RUNOUT_SPEED 1500  // mm/m
179
+  #define EXTRUDER_RUNOUT_EXTRUDE 5   // mm
180
+#endif
179
 
181
 
180
 // @section temperature
182
 // @section temperature
181
 
183
 

+ 9
- 7
Marlin/example_configurations/K8200/Configuration_adv.h View File

174
 
174
 
175
 // @section extruder
175
 // @section extruder
176
 
176
 
177
-//  extruder run-out prevention.
178
-//if the machine is idle, and the temperature over MINTEMP, every couple of SECONDS some filament is extruded
177
+// Extruder runout prevention.
178
+// If the machine is idle and the temperature over MINTEMP
179
+// then extrude some filament every couple of SECONDS.
179
 //#define EXTRUDER_RUNOUT_PREVENT
180
 //#define EXTRUDER_RUNOUT_PREVENT
180
-#define EXTRUDER_RUNOUT_MINTEMP 190
181
-#define EXTRUDER_RUNOUT_SECONDS 30
182
-#define EXTRUDER_RUNOUT_ESTEPS 14   // mm filament
183
-#define EXTRUDER_RUNOUT_SPEED 1500  // extrusion speed
184
-#define EXTRUDER_RUNOUT_EXTRUDE 100
181
+#if ENABLED(EXTRUDER_RUNOUT_PREVENT)
182
+  #define EXTRUDER_RUNOUT_MINTEMP 190
183
+  #define EXTRUDER_RUNOUT_SECONDS 30
184
+  #define EXTRUDER_RUNOUT_SPEED 1500  // mm/m
185
+  #define EXTRUDER_RUNOUT_EXTRUDE 5   // mm
186
+#endif
185
 
187
 
186
 // @section temperature
188
 // @section temperature
187
 
189
 

+ 9
- 7
Marlin/example_configurations/K8400/Configuration_adv.h View File

168
 
168
 
169
 // @section extruder
169
 // @section extruder
170
 
170
 
171
-//  extruder run-out prevention.
172
-//if the machine is idle, and the temperature over MINTEMP, every couple of SECONDS some filament is extruded
171
+// Extruder runout prevention.
172
+// If the machine is idle and the temperature over MINTEMP
173
+// then extrude some filament every couple of SECONDS.
173
 //#define EXTRUDER_RUNOUT_PREVENT
174
 //#define EXTRUDER_RUNOUT_PREVENT
174
-#define EXTRUDER_RUNOUT_MINTEMP 190
175
-#define EXTRUDER_RUNOUT_SECONDS 30
176
-#define EXTRUDER_RUNOUT_ESTEPS 14   // mm filament
177
-#define EXTRUDER_RUNOUT_SPEED 1500  // extrusion speed
178
-#define EXTRUDER_RUNOUT_EXTRUDE 100
175
+#if ENABLED(EXTRUDER_RUNOUT_PREVENT)
176
+  #define EXTRUDER_RUNOUT_MINTEMP 190
177
+  #define EXTRUDER_RUNOUT_SECONDS 30
178
+  #define EXTRUDER_RUNOUT_SPEED 1500  // mm/m
179
+  #define EXTRUDER_RUNOUT_EXTRUDE 5   // mm
180
+#endif
179
 
181
 
180
 // @section temperature
182
 // @section temperature
181
 
183
 

+ 9
- 7
Marlin/example_configurations/RigidBot/Configuration_adv.h View File

168
 
168
 
169
 // @section extruder
169
 // @section extruder
170
 
170
 
171
-//  extruder run-out prevention.
172
-//if the machine is idle, and the temperature over MINTEMP, every couple of SECONDS some filament is extruded
171
+// Extruder runout prevention.
172
+// If the machine is idle and the temperature over MINTEMP
173
+// then extrude some filament every couple of SECONDS.
173
 //#define EXTRUDER_RUNOUT_PREVENT
174
 //#define EXTRUDER_RUNOUT_PREVENT
174
-#define EXTRUDER_RUNOUT_MINTEMP 190
175
-#define EXTRUDER_RUNOUT_SECONDS 30
176
-#define EXTRUDER_RUNOUT_ESTEPS 14   // mm filament
177
-#define EXTRUDER_RUNOUT_SPEED 1500  // extrusion speed
178
-#define EXTRUDER_RUNOUT_EXTRUDE 100
175
+#if ENABLED(EXTRUDER_RUNOUT_PREVENT)
176
+  #define EXTRUDER_RUNOUT_MINTEMP 190
177
+  #define EXTRUDER_RUNOUT_SECONDS 30
178
+  #define EXTRUDER_RUNOUT_SPEED 1500  // mm/m
179
+  #define EXTRUDER_RUNOUT_EXTRUDE 5   // mm
180
+#endif
179
 
181
 
180
 // @section temperature
182
 // @section temperature
181
 
183
 

+ 25
- 23
Marlin/example_configurations/SCARA/Configuration.h View File

75
 //
75
 //
76
 
76
 
77
 //===========================================================================
77
 //===========================================================================
78
-//========================= SCARA Settings ==================================
78
+//============================= SCARA Printer ===============================
79
 //===========================================================================
79
 //===========================================================================
80
-// SCARA-mode for Marlin has been developed by QHARLEY in ZA in 2012/2013. Implemented
80
+// MORGAN_SCARA for Marlin was developed by QHARLEY in ZA in 2012/2013. Implemented
81
 // and slightly reworked by JCERNY in 06/2014 with the goal to bring it into Master-Branch
81
 // and slightly reworked by JCERNY in 06/2014 with the goal to bring it into Master-Branch
82
 // QHARLEYS Autobedlevelling has not been ported, because Marlin has now Bed-levelling
82
 // QHARLEYS Autobedlevelling has not been ported, because Marlin has now Bed-levelling
83
 // You might need Z-Min endstop on SCARA-Printer to use this feature. Actually untested!
83
 // You might need Z-Min endstop on SCARA-Printer to use this feature. Actually untested!
84
-// Uncomment to use Morgan scara mode
85
-#define SCARA
86
-#define SCARA_SEGMENTS_PER_SECOND 200 // If movement is choppy try lowering this value
87
-// Length of inner support arm
88
-#define Linkage_1 150 //mm      Preprocessor cannot handle decimal point...
89
-// Length of outer support arm     Measure arm lengths precisely and enter
90
-#define Linkage_2 150 //mm
91
-
92
-// SCARA tower offset (position of Tower relative to bed zero position)
93
-// This needs to be reasonably accurate as it defines the printbed position in the SCARA space.
94
-#define SCARA_offset_x 100 //mm
95
-#define SCARA_offset_y -56 //mm
96
-#define SCARA_RAD2DEG 57.2957795  // to convert RAD to degrees
97
-
98
-#define THETA_HOMING_OFFSET 0  //calculatated from Calibration Guide and command M360 / M114 see picture in http://reprap.harleystudio.co.za/?page_id=1073
99
-#define PSI_HOMING_OFFSET   0  //calculatated from Calibration Guide and command M364 / M114 see picture in http://reprap.harleystudio.co.za/?page_id=1073
100
-
101
-//some helper variables to make kinematics faster
102
-#define L1_2 sq(Linkage_1) // do not change
103
-#define L2_2 sq(Linkage_2) // do not change
84
+
85
+// Specify the specific SCARA model
86
+#define MORGAN_SCARA
87
+//#define MAKERARM_SCARA
88
+
89
+#if ENABLED(MORGAN_SCARA) || ENABLED(MAKERARM_SCARA)
90
+  //#define DEBUG_SCARA_KINEMATICS
91
+
92
+  #define SCARA_SEGMENTS_PER_SECOND 200 // If movement is choppy try lowering this value
93
+  // Length of inner support arm
94
+  #define SCARA_LINKAGE_1 150 //mm      Preprocessor cannot handle decimal point...
95
+  // Length of outer support arm     Measure arm lengths precisely and enter
96
+  #define SCARA_LINKAGE_2 150 //mm
97
+
98
+  // SCARA tower offset (position of Tower relative to bed zero position)
99
+  // This needs to be reasonably accurate as it defines the printbed position in the SCARA space.
100
+  #define SCARA_OFFSET_X 100 //mm
101
+  #define SCARA_OFFSET_Y -56 //mm
102
+
103
+  #define THETA_HOMING_OFFSET 0  //calculatated from Calibration Guide and command M360 / M114 see picture in http://reprap.harleystudio.co.za/?page_id=1073
104
+  #define PSI_HOMING_OFFSET   0  //calculatated from Calibration Guide and command M364 / M114 see picture in http://reprap.harleystudio.co.za/?page_id=1073
105
+#endif
104
 
106
 
105
 //===========================================================================
107
 //===========================================================================
106
-//========================= SCARA Settings end ==============================
108
+//==================== END ==== SCARA Printer ==== END ======================
107
 //===========================================================================
109
 //===========================================================================
108
 
110
 
109
 // @section info
111
 // @section info

+ 9
- 7
Marlin/example_configurations/SCARA/Configuration_adv.h View File

168
 
168
 
169
 // @section extruder
169
 // @section extruder
170
 
170
 
171
-//  extruder run-out prevention.
172
-//if the machine is idle, and the temperature over MINTEMP, every couple of SECONDS some filament is extruded
171
+// Extruder runout prevention.
172
+// If the machine is idle and the temperature over MINTEMP
173
+// then extrude some filament every couple of SECONDS.
173
 //#define EXTRUDER_RUNOUT_PREVENT
174
 //#define EXTRUDER_RUNOUT_PREVENT
174
-#define EXTRUDER_RUNOUT_MINTEMP 180
175
-#define EXTRUDER_RUNOUT_SECONDS 30
176
-#define EXTRUDER_RUNOUT_ESTEPS 14   // mm filament
177
-#define EXTRUDER_RUNOUT_SPEED 180   // extrusion speed
178
-#define EXTRUDER_RUNOUT_EXTRUDE 100
175
+#if ENABLED(EXTRUDER_RUNOUT_PREVENT)
176
+  #define EXTRUDER_RUNOUT_MINTEMP 190
177
+  #define EXTRUDER_RUNOUT_SECONDS 30
178
+  #define EXTRUDER_RUNOUT_SPEED 180  // mm/m
179
+  #define EXTRUDER_RUNOUT_EXTRUDE 5  // mm
180
+#endif
179
 
181
 
180
 // @section temperature
182
 // @section temperature
181
 
183
 

+ 9
- 7
Marlin/example_configurations/TAZ4/Configuration_adv.h View File

168
 
168
 
169
 // @section extruder
169
 // @section extruder
170
 
170
 
171
-//  extruder run-out prevention.
172
-//if the machine is idle, and the temperature over MINTEMP, every couple of SECONDS some filament is extruded
171
+// Extruder runout prevention.
172
+// If the machine is idle and the temperature over MINTEMP
173
+// then extrude some filament every couple of SECONDS.
173
 //#define EXTRUDER_RUNOUT_PREVENT
174
 //#define EXTRUDER_RUNOUT_PREVENT
174
-#define EXTRUDER_RUNOUT_MINTEMP 190
175
-#define EXTRUDER_RUNOUT_SECONDS 30
176
-#define EXTRUDER_RUNOUT_ESTEPS 14   // mm filament
177
-#define EXTRUDER_RUNOUT_SPEED 1500  // extrusion speed
178
-#define EXTRUDER_RUNOUT_EXTRUDE 100
175
+#if ENABLED(EXTRUDER_RUNOUT_PREVENT)
176
+  #define EXTRUDER_RUNOUT_MINTEMP 190
177
+  #define EXTRUDER_RUNOUT_SECONDS 30
178
+  #define EXTRUDER_RUNOUT_SPEED 1500  // mm/m
179
+  #define EXTRUDER_RUNOUT_EXTRUDE 5   // mm
180
+#endif
179
 
181
 
180
 // @section temperature
182
 // @section temperature
181
 
183
 

+ 9
- 7
Marlin/example_configurations/WITBOX/Configuration_adv.h View File

168
 
168
 
169
 // @section extruder
169
 // @section extruder
170
 
170
 
171
-//  extruder run-out prevention.
172
-//if the machine is idle, and the temperature over MINTEMP, every couple of SECONDS some filament is extruded
171
+// Extruder runout prevention.
172
+// If the machine is idle and the temperature over MINTEMP
173
+// then extrude some filament every couple of SECONDS.
173
 //#define EXTRUDER_RUNOUT_PREVENT
174
 //#define EXTRUDER_RUNOUT_PREVENT
174
-#define EXTRUDER_RUNOUT_MINTEMP 190
175
-#define EXTRUDER_RUNOUT_SECONDS 30
176
-#define EXTRUDER_RUNOUT_ESTEPS 14   // mm filament
177
-#define EXTRUDER_RUNOUT_SPEED 1500  // extrusion speed
178
-#define EXTRUDER_RUNOUT_EXTRUDE 100
175
+#if ENABLED(EXTRUDER_RUNOUT_PREVENT)
176
+  #define EXTRUDER_RUNOUT_MINTEMP 190
177
+  #define EXTRUDER_RUNOUT_SECONDS 30
178
+  #define EXTRUDER_RUNOUT_SPEED 1500  // mm/m
179
+  #define EXTRUDER_RUNOUT_EXTRUDE 5   // mm
180
+#endif
179
 
181
 
180
 // @section temperature
182
 // @section temperature
181
 
183
 

+ 9
- 7
Marlin/example_configurations/delta/biv2.5/Configuration_adv.h View File

168
 
168
 
169
 // @section extruder
169
 // @section extruder
170
 
170
 
171
-//  extruder run-out prevention.
172
-//if the machine is idle, and the temperature over MINTEMP, every couple of SECONDS some filament is extruded
171
+// Extruder runout prevention.
172
+// If the machine is idle and the temperature over MINTEMP
173
+// then extrude some filament every couple of SECONDS.
173
 //#define EXTRUDER_RUNOUT_PREVENT
174
 //#define EXTRUDER_RUNOUT_PREVENT
174
-#define EXTRUDER_RUNOUT_MINTEMP 190
175
-#define EXTRUDER_RUNOUT_SECONDS 30
176
-#define EXTRUDER_RUNOUT_ESTEPS 14   // mm filament
177
-#define EXTRUDER_RUNOUT_SPEED 1500  // extrusion speed
178
-#define EXTRUDER_RUNOUT_EXTRUDE 100
175
+#if ENABLED(EXTRUDER_RUNOUT_PREVENT)
176
+  #define EXTRUDER_RUNOUT_MINTEMP 190
177
+  #define EXTRUDER_RUNOUT_SECONDS 30
178
+  #define EXTRUDER_RUNOUT_SPEED 1500  // mm/m
179
+  #define EXTRUDER_RUNOUT_EXTRUDE 5   // mm
180
+#endif
179
 
181
 
180
 // @section temperature
182
 // @section temperature
181
 
183
 

+ 9
- 7
Marlin/example_configurations/delta/generic/Configuration_adv.h View File

168
 
168
 
169
 // @section extruder
169
 // @section extruder
170
 
170
 
171
-//  extruder run-out prevention.
172
-//if the machine is idle, and the temperature over MINTEMP, every couple of SECONDS some filament is extruded
171
+// Extruder runout prevention.
172
+// If the machine is idle and the temperature over MINTEMP
173
+// then extrude some filament every couple of SECONDS.
173
 //#define EXTRUDER_RUNOUT_PREVENT
174
 //#define EXTRUDER_RUNOUT_PREVENT
174
-#define EXTRUDER_RUNOUT_MINTEMP 190
175
-#define EXTRUDER_RUNOUT_SECONDS 30
176
-#define EXTRUDER_RUNOUT_ESTEPS 14   // mm filament
177
-#define EXTRUDER_RUNOUT_SPEED 1500  // extrusion speed
178
-#define EXTRUDER_RUNOUT_EXTRUDE 100
175
+#if ENABLED(EXTRUDER_RUNOUT_PREVENT)
176
+  #define EXTRUDER_RUNOUT_MINTEMP 190
177
+  #define EXTRUDER_RUNOUT_SECONDS 30
178
+  #define EXTRUDER_RUNOUT_SPEED 1500  // mm/m
179
+  #define EXTRUDER_RUNOUT_EXTRUDE 5   // mm
180
+#endif
179
 
181
 
180
 // @section temperature
182
 // @section temperature
181
 
183
 

+ 9
- 7
Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h View File

168
 
168
 
169
 // @section extruder
169
 // @section extruder
170
 
170
 
171
-//  extruder run-out prevention.
172
-//if the machine is idle, and the temperature over MINTEMP, every couple of SECONDS some filament is extruded
171
+// Extruder runout prevention.
172
+// If the machine is idle and the temperature over MINTEMP
173
+// then extrude some filament every couple of SECONDS.
173
 //#define EXTRUDER_RUNOUT_PREVENT
174
 //#define EXTRUDER_RUNOUT_PREVENT
174
-#define EXTRUDER_RUNOUT_MINTEMP 190
175
-#define EXTRUDER_RUNOUT_SECONDS 30
176
-#define EXTRUDER_RUNOUT_ESTEPS 14   // mm filament
177
-#define EXTRUDER_RUNOUT_SPEED 1500  // extrusion speed
178
-#define EXTRUDER_RUNOUT_EXTRUDE 100
175
+#if ENABLED(EXTRUDER_RUNOUT_PREVENT)
176
+  #define EXTRUDER_RUNOUT_MINTEMP 190
177
+  #define EXTRUDER_RUNOUT_SECONDS 30
178
+  #define EXTRUDER_RUNOUT_SPEED 1500  // mm/m
179
+  #define EXTRUDER_RUNOUT_EXTRUDE 5   // mm
180
+#endif
179
 
181
 
180
 // @section temperature
182
 // @section temperature
181
 
183
 

+ 9
- 7
Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h View File

173
 
173
 
174
 // @section extruder
174
 // @section extruder
175
 
175
 
176
-//  extruder run-out prevention.
177
-//if the machine is idle, and the temperature over MINTEMP, every couple of SECONDS some filament is extruded
176
+// Extruder runout prevention.
177
+// If the machine is idle and the temperature over MINTEMP
178
+// then extrude some filament every couple of SECONDS.
178
 //#define EXTRUDER_RUNOUT_PREVENT
179
 //#define EXTRUDER_RUNOUT_PREVENT
179
-#define EXTRUDER_RUNOUT_MINTEMP 190
180
-#define EXTRUDER_RUNOUT_SECONDS 30
181
-#define EXTRUDER_RUNOUT_ESTEPS 14   // mm filament
182
-#define EXTRUDER_RUNOUT_SPEED 1500  // extrusion speed
183
-#define EXTRUDER_RUNOUT_EXTRUDE 100
180
+#if ENABLED(EXTRUDER_RUNOUT_PREVENT)
181
+  #define EXTRUDER_RUNOUT_MINTEMP 190
182
+  #define EXTRUDER_RUNOUT_SECONDS 30
183
+  #define EXTRUDER_RUNOUT_SPEED 1500  // mm/m
184
+  #define EXTRUDER_RUNOUT_EXTRUDE 5   // mm
185
+#endif
184
 
186
 
185
 // @section temperature
187
 // @section temperature
186
 
188
 

+ 9
- 7
Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h View File

168
 
168
 
169
 // @section extruder
169
 // @section extruder
170
 
170
 
171
-//  extruder run-out prevention.
172
-//if the machine is idle, and the temperature over MINTEMP, every couple of SECONDS some filament is extruded
171
+// Extruder runout prevention.
172
+// If the machine is idle and the temperature over MINTEMP
173
+// then extrude some filament every couple of SECONDS.
173
 //#define EXTRUDER_RUNOUT_PREVENT
174
 //#define EXTRUDER_RUNOUT_PREVENT
174
-#define EXTRUDER_RUNOUT_MINTEMP 190
175
-#define EXTRUDER_RUNOUT_SECONDS 30
176
-#define EXTRUDER_RUNOUT_ESTEPS 14   // mm filament
177
-#define EXTRUDER_RUNOUT_SPEED 1500  // extrusion speed
178
-#define EXTRUDER_RUNOUT_EXTRUDE 100
175
+#if ENABLED(EXTRUDER_RUNOUT_PREVENT)
176
+  #define EXTRUDER_RUNOUT_MINTEMP 190
177
+  #define EXTRUDER_RUNOUT_SECONDS 30
178
+  #define EXTRUDER_RUNOUT_SPEED 1500  // mm/m
179
+  #define EXTRUDER_RUNOUT_EXTRUDE 5   // mm
180
+#endif
179
 
181
 
180
 // @section temperature
182
 // @section temperature
181
 
183
 

+ 9
- 7
Marlin/example_configurations/makibox/Configuration_adv.h View File

168
 
168
 
169
 // @section extruder
169
 // @section extruder
170
 
170
 
171
-//  extruder run-out prevention.
172
-//if the machine is idle, and the temperature over MINTEMP, every couple of SECONDS some filament is extruded
171
+// Extruder runout prevention.
172
+// If the machine is idle and the temperature over MINTEMP
173
+// then extrude some filament every couple of SECONDS.
173
 //#define EXTRUDER_RUNOUT_PREVENT
174
 //#define EXTRUDER_RUNOUT_PREVENT
174
-#define EXTRUDER_RUNOUT_MINTEMP 190
175
-#define EXTRUDER_RUNOUT_SECONDS 30
176
-#define EXTRUDER_RUNOUT_ESTEPS 14   // mm filament
177
-#define EXTRUDER_RUNOUT_SPEED 1500  // extrusion speed
178
-#define EXTRUDER_RUNOUT_EXTRUDE 100
175
+#if ENABLED(EXTRUDER_RUNOUT_PREVENT)
176
+  #define EXTRUDER_RUNOUT_MINTEMP 190
177
+  #define EXTRUDER_RUNOUT_SECONDS 30
178
+  #define EXTRUDER_RUNOUT_SPEED 1500  // mm/m
179
+  #define EXTRUDER_RUNOUT_EXTRUDE 5   // mm
180
+#endif
179
 
181
 
180
 // @section temperature
182
 // @section temperature
181
 
183
 

+ 9
- 7
Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h View File

168
 
168
 
169
 // @section extruder
169
 // @section extruder
170
 
170
 
171
-//  extruder run-out prevention.
172
-//if the machine is idle, and the temperature over MINTEMP, every couple of SECONDS some filament is extruded
171
+// Extruder runout prevention.
172
+// If the machine is idle and the temperature over MINTEMP
173
+// then extrude some filament every couple of SECONDS.
173
 //#define EXTRUDER_RUNOUT_PREVENT
174
 //#define EXTRUDER_RUNOUT_PREVENT
174
-#define EXTRUDER_RUNOUT_MINTEMP 190
175
-#define EXTRUDER_RUNOUT_SECONDS 30
176
-#define EXTRUDER_RUNOUT_ESTEPS 14   // mm filament
177
-#define EXTRUDER_RUNOUT_SPEED 1500  // extrusion speed
178
-#define EXTRUDER_RUNOUT_EXTRUDE 100
175
+#if ENABLED(EXTRUDER_RUNOUT_PREVENT)
176
+  #define EXTRUDER_RUNOUT_MINTEMP 190
177
+  #define EXTRUDER_RUNOUT_SECONDS 30
178
+  #define EXTRUDER_RUNOUT_SPEED 1500  // mm/m
179
+  #define EXTRUDER_RUNOUT_EXTRUDE 5   // mm
180
+#endif
179
 
181
 
180
 // @section temperature
182
 // @section temperature
181
 
183
 

+ 3
- 3
Marlin/language.h View File

157
 #define MSG_ENDSTOP_OPEN                    "open"
157
 #define MSG_ENDSTOP_OPEN                    "open"
158
 #define MSG_HOTEND_OFFSET                   "Hotend offsets:"
158
 #define MSG_HOTEND_OFFSET                   "Hotend offsets:"
159
 #define MSG_DUPLICATION_MODE                "Duplication mode: "
159
 #define MSG_DUPLICATION_MODE                "Duplication mode: "
160
-#define MSG_SOFT_ENDSTOPS                   "Soft endstops"
161
-#define MSG_SOFT_MIN                        "Min"
162
-#define MSG_SOFT_MAX                        "Max"
160
+#define MSG_SOFT_ENDSTOPS                   "Soft endstops: "
161
+#define MSG_SOFT_MIN                        "  Min: "
162
+#define MSG_SOFT_MAX                        "  Max: "
163
 
163
 
164
 #define MSG_SD_CANT_OPEN_SUBDIR             "Cannot open subdir "
164
 #define MSG_SD_CANT_OPEN_SUBDIR             "Cannot open subdir "
165
 #define MSG_SD_INIT_FAIL                    "SD init fail"
165
 #define MSG_SD_INIT_FAIL                    "SD init fail"

+ 3
- 0
Marlin/language_en.h View File

408
 #ifndef MSG_ERR_MINTEMP_BED
408
 #ifndef MSG_ERR_MINTEMP_BED
409
   #define MSG_ERR_MINTEMP_BED                 "Err: MINTEMP BED"
409
   #define MSG_ERR_MINTEMP_BED                 "Err: MINTEMP BED"
410
 #endif
410
 #endif
411
+#ifndef MSG_ERR_Z_HOMING
412
+  #define MSG_ERR_Z_HOMING                    "G28 Z Forbidden"
413
+#endif
411
 #ifndef MSG_HALTED
414
 #ifndef MSG_HALTED
412
   #define MSG_HALTED                          "PRINTER HALTED"
415
   #define MSG_HALTED                          "PRINTER HALTED"
413
 #endif
416
 #endif

+ 6
- 1
Marlin/macros.h View File

55
 #endif
55
 #endif
56
 #define RADIANS(d) ((d)*M_PI/180.0)
56
 #define RADIANS(d) ((d)*M_PI/180.0)
57
 #define DEGREES(r) ((r)*180.0/M_PI)
57
 #define DEGREES(r) ((r)*180.0/M_PI)
58
-#define HYPOT(x,y) sqrt(sq(x)+sq(y))
58
+#define HYPOT2(x,y) (sq(x)+sq(y))
59
+#define HYPOT(x,y) sqrt(HYPOT2(x,y))
59
 
60
 
60
 // Macros to contrain values
61
 // Macros to contrain values
61
 #define NOLESS(v,n) do{ if (v < n) v = n; }while(0)
62
 #define NOLESS(v,n) do{ if (v < n) v = n; }while(0)
124
 #define MAX3(a, b, c)    max(max(a, b), c)
125
 #define MAX3(a, b, c)    max(max(a, b), c)
125
 #define MAX4(a, b, c, d) max(max(max(a, b), c), d)
126
 #define MAX4(a, b, c, d) max(max(max(a, b), c), d)
126
 
127
 
128
+#define UNEAR_ZERO(x) ((x) < 0.000001)
129
+#define NEAR_ZERO(x) ((x) > -0.000001 && (x) < 0.000001)
130
+#define NEAR(x,y) NEAR_ZERO((x)-(y))
131
+
127
 #endif //__MACROS_H
132
 #endif //__MACROS_H

+ 63
- 53
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(float &lx, float &ly, float &lz) {
527
     #if ENABLED(MESH_BED_LEVELING)
527
     #if ENABLED(MESH_BED_LEVELING)
528
-      const float &x, const float &y
529
-    #else
530
-      float &x, float &y
528
+
529
+      if (mbl.active())
530
+        lz += mbl.get_z(RAW_X_POSITION(lx), RAW_Y_POSITION(ly));
531
+
532
+    #elif ENABLED(AUTO_BED_LEVELING_LINEAR)
533
+
534
+      float dx = RAW_X_POSITION(lx) - (X_TILT_FULCRUM),
535
+            dy = RAW_Y_POSITION(ly) - (Y_TILT_FULCRUM),
536
+            dz = RAW_Z_POSITION(lz);
537
+
538
+      apply_rotation_xyz(bed_level_matrix, dx, dy, dz);
539
+
540
+      lx = LOGICAL_X_POSITION(dx + X_TILT_FULCRUM);
541
+      ly = LOGICAL_Y_POSITION(dy + Y_TILT_FULCRUM);
542
+      lz = LOGICAL_Z_POSITION(dz);
543
+
531
     #endif
544
     #endif
532
-    , float &z
533
-  ) {
545
+  }
546
+
547
+  void Planner::unapply_leveling(float &lx, float &ly, float &lz) {
534
     #if ENABLED(MESH_BED_LEVELING)
548
     #if ENABLED(MESH_BED_LEVELING)
535
 
549
 
536
       if (mbl.active())
550
       if (mbl.active())
537
-        z += mbl.get_z(RAW_X_POSITION(x), RAW_Y_POSITION(y));
551
+        lz -= mbl.get_z(RAW_X_POSITION(lx), RAW_Y_POSITION(ly));
552
+
553
+    #elif ENABLED(AUTO_BED_LEVELING_LINEAR)
538
 
554
 
539
-    #elif ENABLED(AUTO_BED_LEVELING_FEATURE)
555
+      matrix_3x3 inverse = matrix_3x3::transpose(bed_level_matrix);
540
 
556
 
541
-      float tx = RAW_X_POSITION(x) - (X_TILT_FULCRUM),
542
-            ty = RAW_Y_POSITION(y) - (Y_TILT_FULCRUM),
543
-            tz = RAW_Z_POSITION(z);
557
+      float dx = lx - (X_TILT_FULCRUM), dy = ly - (Y_TILT_FULCRUM), dz = lz;
544
 
558
 
545
-      apply_rotation_xyz(bed_level_matrix, tx, ty, tz);
559
+      apply_rotation_xyz(inverse, dx, dy, dz);
546
 
560
 
547
-      x = LOGICAL_X_POSITION(tx + X_TILT_FULCRUM);
548
-      y = LOGICAL_Y_POSITION(ty + Y_TILT_FULCRUM);
549
-      z = LOGICAL_Z_POSITION(tz);
561
+      lx = LOGICAL_X_POSITION(dx + X_TILT_FULCRUM);
562
+      ly = LOGICAL_Y_POSITION(dy + Y_TILT_FULCRUM);
563
+      lz = LOGICAL_Z_POSITION(dz);
550
 
564
 
551
     #endif
565
     #endif
552
   }
566
   }
553
 
567
 
554
-#endif
568
+#endif // PLANNER_LEVELING
555
 
569
 
556
 /**
570
 /**
557
  * Planner::buffer_line
571
  * Planner::buffer_line
562
  *  fr_mm_s   - (target) speed of the move
576
  *  fr_mm_s   - (target) speed of the move
563
  *  extruder  - target extruder
577
  *  extruder  - target extruder
564
  */
578
  */
565
-
566
-void Planner::buffer_line(
567
-  #if ENABLED(AUTO_BED_LEVELING_FEATURE) || ENABLED(MESH_BED_LEVELING)
568
-    float x, float y, float z
569
-  #else
570
-    const float& x, const float& y, const float& z
571
-  #endif
572
-  , const float& e, float fr_mm_s, const uint8_t extruder
573
-) {
579
+void Planner::buffer_line(ARG_X, ARG_Y, ARG_Z, const float &e, float fr_mm_s, const uint8_t extruder) {
574
   // Calculate the buffer head after we push this byte
580
   // Calculate the buffer head after we push this byte
575
   int next_buffer_head = next_block_index(block_buffer_head);
581
   int next_buffer_head = next_block_index(block_buffer_head);
576
 
582
 
578
   // Rest here until there is room in the buffer.
584
   // Rest here until there is room in the buffer.
579
   while (block_buffer_tail == next_buffer_head) idle();
585
   while (block_buffer_tail == next_buffer_head) idle();
580
 
586
 
581
-  #if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_FEATURE)
582
-    apply_leveling(x, y, z);
587
+  #if PLANNER_LEVELING
588
+    apply_leveling(lx, ly, lz);
583
   #endif
589
   #endif
584
 
590
 
585
   // The target position of the tool in absolute steps
591
   // The target position of the tool in absolute steps
586
   // Calculate target position in absolute steps
592
   // Calculate target position in absolute steps
587
   //this should be done after the wait, because otherwise a M92 code within the gcode disrupts this calculation somehow
593
   //this should be done after the wait, because otherwise a M92 code within the gcode disrupts this calculation somehow
588
   long target[NUM_AXIS] = {
594
   long target[NUM_AXIS] = {
589
-    lround(x * axis_steps_per_mm[X_AXIS]),
590
-    lround(y * axis_steps_per_mm[Y_AXIS]),
591
-    lround(z * axis_steps_per_mm[Z_AXIS]),
595
+    lround(lx * axis_steps_per_mm[X_AXIS]),
596
+    lround(ly * axis_steps_per_mm[Y_AXIS]),
597
+    lround(lz * axis_steps_per_mm[Z_AXIS]),
592
     lround(e * axis_steps_per_mm[E_AXIS])
598
     lround(e * axis_steps_per_mm[E_AXIS])
593
   };
599
   };
594
 
600
 
598
 
604
 
599
   /*
605
   /*
600
   SERIAL_ECHO_START;
606
   SERIAL_ECHO_START;
601
-  SERIAL_ECHOPAIR("Planner X:", x);
602
-  SERIAL_ECHOPAIR(" (", dx);
603
-  SERIAL_ECHOPAIR(") Y:", y);
607
+  SERIAL_ECHOPGM("Planner ", x);
608
+  #if IS_KINEMATIC
609
+    SERIAL_ECHOPAIR("A:", x);
610
+    SERIAL_ECHOPAIR(" (", dx);
611
+    SERIAL_ECHOPAIR(") B:", y);
612
+  #else
613
+    SERIAL_ECHOPAIR("X:", x);
614
+    SERIAL_ECHOPAIR(" (", dx);
615
+    SERIAL_ECHOPAIR(") Y:", y);
616
+  #endif
604
   SERIAL_ECHOPAIR(" (", dy);
617
   SERIAL_ECHOPAIR(" (", dy);
605
-  SERIAL_ECHOPAIR(") Z:", z);
618
+  #elif ENABLED(DELTA)
619
+    SERIAL_ECHOPAIR(") C:", z);
620
+  #else
621
+    SERIAL_ECHOPAIR(") Z:", z);
622
+  #endif
606
   SERIAL_ECHOPAIR(" (", dz);
623
   SERIAL_ECHOPAIR(" (", dz);
607
   SERIAL_ECHOLNPGM(")");
624
   SERIAL_ECHOLNPGM(")");
608
   //*/
625
   //*/
671
   // For a mixing extruder, get a magnified step_event_count for each
688
   // For a mixing extruder, get a magnified step_event_count for each
672
   #if ENABLED(MIXING_EXTRUDER)
689
   #if ENABLED(MIXING_EXTRUDER)
673
     for (uint8_t i = 0; i < MIXING_STEPPERS; i++)
690
     for (uint8_t i = 0; i < MIXING_STEPPERS; i++)
674
-      block->mix_event_count[i] = (mixing_factor[i] < 0.0001) ? 0 : block->step_event_count / mixing_factor[i];
691
+      block->mix_event_count[i] = UNEAR_ZERO(mixing_factor[i]) ? 0 : block->step_event_count / mixing_factor[i];
675
   #endif
692
   #endif
676
 
693
 
677
   #if FAN_COUNT > 0
694
   #if FAN_COUNT > 0
1124
       block->advance_rate = acc_dist ? advance / (float)acc_dist : 0;
1141
       block->advance_rate = acc_dist ? advance / (float)acc_dist : 0;
1125
     }
1142
     }
1126
     /**
1143
     /**
1127
-      SERIAL_ECHO_START;
1144
+     SERIAL_ECHO_START;
1128
      SERIAL_ECHOPGM("advance :");
1145
      SERIAL_ECHOPGM("advance :");
1129
      SERIAL_ECHO(block->advance/256.0);
1146
      SERIAL_ECHO(block->advance/256.0);
1130
      SERIAL_ECHOPGM("advance rate :");
1147
      SERIAL_ECHOPGM("advance rate :");
1152
  *
1169
  *
1153
  * On CORE machines stepper ABC will be translated from the given XYZ.
1170
  * On CORE machines stepper ABC will be translated from the given XYZ.
1154
  */
1171
  */
1155
-void Planner::set_position_mm(
1156
-  #if ENABLED(AUTO_BED_LEVELING_FEATURE) || ENABLED(MESH_BED_LEVELING)
1157
-    float x, float y, float z
1158
-  #else
1159
-    const float& x, const float& y, const float& z
1160
-  #endif
1161
-  , const float& e
1162
-) {
1172
+void Planner::set_position_mm(ARG_X, ARG_Y, ARG_Z, const float &e) {
1163
 
1173
 
1164
-  #if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_FEATURE)
1165
-    apply_leveling(x, y, z);
1174
+  #if PLANNER_LEVELING
1175
+    apply_leveling(lx, ly, lz);
1166
   #endif
1176
   #endif
1167
 
1177
 
1168
-  long nx = position[X_AXIS] = lround(x * axis_steps_per_mm[X_AXIS]),
1169
-       ny = position[Y_AXIS] = lround(y * axis_steps_per_mm[Y_AXIS]),
1170
-       nz = position[Z_AXIS] = lround(z * axis_steps_per_mm[Z_AXIS]),
1178
+  long nx = position[X_AXIS] = lround(lx * axis_steps_per_mm[X_AXIS]),
1179
+       ny = position[Y_AXIS] = lround(ly * axis_steps_per_mm[Y_AXIS]),
1180
+       nz = position[Z_AXIS] = lround(lz * axis_steps_per_mm[Z_AXIS]),
1171
        ne = position[E_AXIS] = lround(e * axis_steps_per_mm[E_AXIS]);
1181
        ne = position[E_AXIS] = lround(e * axis_steps_per_mm[E_AXIS]);
1172
   stepper.set_position(nx, ny, nz, ne);
1182
   stepper.set_position(nx, ny, nz, ne);
1173
   previous_nominal_speed = 0.0; // Resets planner junction speeds. Assumes start from rest.
1183
   previous_nominal_speed = 0.0; // Resets planner junction speeds. Assumes start from rest.
1193
 // Recalculate position, steps_to_mm if axis_steps_per_mm changes!
1203
 // Recalculate position, steps_to_mm if axis_steps_per_mm changes!
1194
 void Planner::refresh_positioning() {
1204
 void Planner::refresh_positioning() {
1195
   LOOP_XYZE(i) steps_to_mm[i] = 1.0 / axis_steps_per_mm[i];
1205
   LOOP_XYZE(i) steps_to_mm[i] = 1.0 / axis_steps_per_mm[i];
1196
-  #if ENABLED(DELTA) || ENABLED(SCARA)
1206
+  #if IS_KINEMATIC
1197
     inverse_kinematics(current_position);
1207
     inverse_kinematics(current_position);
1198
     set_position_mm(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS]);
1208
     set_position_mm(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS]);
1199
   #else
1209
   #else

+ 32
- 26
Marlin/planner.h View File

202
     static bool is_full() { return (block_buffer_tail == BLOCK_MOD(block_buffer_head + 1)); }
202
     static bool is_full() { return (block_buffer_tail == BLOCK_MOD(block_buffer_head + 1)); }
203
 
203
 
204
     #if ENABLED(AUTO_BED_LEVELING_FEATURE) || ENABLED(MESH_BED_LEVELING)
204
     #if ENABLED(AUTO_BED_LEVELING_FEATURE) || ENABLED(MESH_BED_LEVELING)
205
+      #define ARG_X float lx
206
+      #define ARG_Y float ly
207
+      #define ARG_Z float lz
208
+    #else
209
+      #define ARG_X const float &lx
210
+      #define ARG_Y const float &ly
211
+      #define ARG_Z const float &lz
212
+    #endif
205
 
213
 
206
-      #if ENABLED(MESH_BED_LEVELING)
207
-        static void apply_leveling(const float &x, const float &y, float &z);
208
-      #else
209
-        static void apply_leveling(float &x, float &y, float &z);
210
-      #endif
214
+    #if PLANNER_LEVELING
211
 
215
 
212
       /**
216
       /**
213
-       * Add a new linear movement to the buffer.
214
-       *
215
-       *  x,y,z,e   - target position in mm
216
-       *  fr_mm_s   - (target) speed of the move (mm/s)
217
-       *  extruder  - target extruder
217
+       * Apply leveling to transform a cartesian position
218
+       * as it will be given to the planner and steppers.
218
        */
219
        */
219
-      static void buffer_line(float x, float y, float z, const float& e, float fr_mm_s, const uint8_t extruder);
220
+      static void apply_leveling(float &lx, float &ly, float &lz);
221
+      static void unapply_leveling(float &lx, float &ly, float &lz);
220
 
222
 
221
-      /**
222
-       * Set the planner.position and individual stepper positions.
223
-       * Used by G92, G28, G29, and other procedures.
224
-       *
225
-       * Multiplies by axis_steps_per_mm[] and does necessary conversion
226
-       * for COREXY / COREXZ / COREYZ to set the corresponding stepper positions.
227
-       *
228
-       * Clears previous speed values.
229
-       */
230
-      static void set_position_mm(float x, float y, float z, const float& e);
231
-
232
-    #else
223
+    #endif
233
 
224
 
234
-      static void buffer_line(const float& x, const float& y, const float& z, const float& e, float fr_mm_s, const uint8_t extruder);
235
-      static void set_position_mm(const float& x, const float& y, const float& z, const float& e);
225
+    /**
226
+     * Add a new linear movement to the buffer.
227
+     *
228
+     *  x,y,z,e   - target position in mm
229
+     *  fr_mm_s   - (target) speed of the move (mm/s)
230
+     *  extruder  - target extruder
231
+     */
232
+    static void buffer_line(ARG_X, ARG_Y, ARG_Z, const float& e, float fr_mm_s, const uint8_t extruder);
236
 
233
 
237
-    #endif // AUTO_BED_LEVELING_FEATURE || MESH_BED_LEVELING
234
+    /**
235
+     * Set the planner.position and individual stepper positions.
236
+     * Used by G92, G28, G29, and other procedures.
237
+     *
238
+     * Multiplies by axis_steps_per_mm[] and does necessary conversion
239
+     * for COREXY / COREXZ / COREYZ to set the corresponding stepper positions.
240
+     *
241
+     * Clears previous speed values.
242
+     */
243
+    static void set_position_mm(ARG_X, ARG_Y, ARG_Z, const float& e);
238
 
244
 
239
     /**
245
     /**
240
      * Set the E position (mm) of the planner (and the E stepper)
246
      * Set the E position (mm) of the planner (and the E stepper)

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

+ 12
- 5
Marlin/stepper.h View File

91
       static bool performing_homing;
91
       static bool performing_homing;
92
     #endif
92
     #endif
93
 
93
 
94
+    //
95
+    // Positions of stepper motors, in step units
96
+    //
97
+    static volatile long count_position[NUM_AXIS];
98
+
94
   private:
99
   private:
95
 
100
 
96
     static unsigned char last_direction_bits;        // The next stepping-bits to be output
101
     static unsigned char last_direction_bits;        // The next stepping-bits to be output
139
     #endif
144
     #endif
140
 
145
 
141
     //
146
     //
142
-    // Positions of stepper motors, in step units
143
-    //
144
-    static volatile long count_position[NUM_AXIS];
145
-
146
-    //
147
     // Current direction of stepper motors (+1 or -1)
147
     // Current direction of stepper motors (+1 or -1)
148
     //
148
     //
149
     static volatile signed char count_direction[NUM_AXIS];
149
     static volatile signed char count_direction[NUM_AXIS];
212
     static float get_axis_position_mm(AxisEnum axis);
212
     static float get_axis_position_mm(AxisEnum axis);
213
 
213
 
214
     //
214
     //
215
+    // SCARA AB axes are in degrees, not mm
216
+    //
217
+    #if IS_SCARA
218
+      static FORCE_INLINE float get_axis_position_degrees(AxisEnum axis) { return get_axis_position_mm(axis); }
219
+    #endif
220
+
221
+    //
215
     // The stepper subsystem goes to sleep when it runs out of things to execute. Call this
222
     // The stepper subsystem goes to sleep when it runs out of things to execute. Call this
216
     // to notify the subsystem that it is time to go to work.
223
     // to notify the subsystem that it is time to go to work.
217
     //
224
     //

+ 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