Browse Source

Merge pull request #4789 from thinkyhead/rc_better_leveling_etc

Various cleanups ahead of more…
pull/1/head
Scott Lahteine 8 years ago
committed by GitHub
parent
commit
94d5cf8721
  1. 52
      Marlin/Conditionals_post.h
  2. 16
      Marlin/Configuration_adv.h
  3. 40
      Marlin/Marlin.h
  4. 3
      Marlin/MarlinSerial.cpp
  5. 2319
      Marlin/Marlin_main.cpp
  6. 181
      Marlin/SanityCheck.h
  7. 8
      Marlin/configuration_store.cpp
  8. 3
      Marlin/enum.h
  9. 16
      Marlin/example_configurations/Cartesio/Configuration_adv.h
  10. 16
      Marlin/example_configurations/Felix/Configuration_adv.h
  11. 16
      Marlin/example_configurations/Hephestos/Configuration_adv.h
  12. 16
      Marlin/example_configurations/Hephestos_2/Configuration_adv.h
  13. 16
      Marlin/example_configurations/K8200/Configuration_adv.h
  14. 16
      Marlin/example_configurations/K8400/Configuration_adv.h
  15. 16
      Marlin/example_configurations/RigidBot/Configuration_adv.h
  16. 48
      Marlin/example_configurations/SCARA/Configuration.h
  17. 16
      Marlin/example_configurations/SCARA/Configuration_adv.h
  18. 16
      Marlin/example_configurations/TAZ4/Configuration_adv.h
  19. 16
      Marlin/example_configurations/WITBOX/Configuration_adv.h
  20. 16
      Marlin/example_configurations/delta/biv2.5/Configuration_adv.h
  21. 16
      Marlin/example_configurations/delta/generic/Configuration_adv.h
  22. 16
      Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h
  23. 16
      Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h
  24. 16
      Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h
  25. 16
      Marlin/example_configurations/makibox/Configuration_adv.h
  26. 16
      Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h
  27. 6
      Marlin/language.h
  28. 3
      Marlin/language_en.h
  29. 7
      Marlin/macros.h
  30. 116
      Marlin/planner.cpp
  31. 58
      Marlin/planner.h
  32. 2
      Marlin/planner_bezier.cpp
  33. 2
      Marlin/qr_solve.cpp
  34. 17
      Marlin/stepper.h
  35. 4
      Marlin/ultralcd.cpp

52
Marlin/Conditionals_post.h

@ -61,12 +61,16 @@
#define NORMAL_AXIS X_AXIS
#endif
#define IS_SCARA (ENABLED(MORGAN_SCARA) || ENABLED(MAKERARM_SCARA))
#define IS_KINEMATIC (ENABLED(DELTA) || IS_SCARA)
#define IS_CARTESIAN !IS_KINEMATIC
/**
* SCARA
* SCARA cannot use SLOWDOWN and requires QUICKHOME
*/
#if ENABLED(SCARA)
#if IS_SCARA
#undef SLOWDOWN
#define QUICK_HOME //SCARA needs Quickhome
#define QUICK_HOME
#endif
/**
@ -132,12 +136,6 @@
#define HOMING_Z_WITH_PROBE (HAS_BED_PROBE && Z_HOME_DIR < 0 && ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN))
// Boundaries for probing based on set limits
#define MIN_PROBE_X (max(X_MIN_POS, X_MIN_POS + X_PROBE_OFFSET_FROM_EXTRUDER))
#define MAX_PROBE_X (min(X_MAX_POS, X_MAX_POS + X_PROBE_OFFSET_FROM_EXTRUDER))
#define MIN_PROBE_Y (max(Y_MIN_POS, Y_MIN_POS + Y_PROBE_OFFSET_FROM_EXTRUDER))
#define MAX_PROBE_Y (min(Y_MAX_POS, Y_MAX_POS + Y_PROBE_OFFSET_FROM_EXTRUDER))
#define HAS_Z_SERVO_ENDSTOP (defined(Z_ENDSTOP_SERVO_NR) && Z_ENDSTOP_SERVO_NR >= 0)
/**
@ -657,18 +655,28 @@
#ifndef DELTA_DIAGONAL_ROD_TRIM_TOWER_3
#define DELTA_DIAGONAL_ROD_TRIM_TOWER_3 0.0
#endif
#if ENABLED(AUTO_BED_LEVELING_GRID)
#define DELTA_BED_LEVELING_GRID
#endif
#endif
/**
* When not using other bed leveling...
* Specify the exact style of auto bed leveling
*
* 3POINT - 3 Point Probing with the least-squares solution.
* LINEAR - Grid Probing with the least-squares solution.
* NONLINEAR - Grid Probing with a mesh solution. Best for large beds.
*/
#if ENABLED(AUTO_BED_LEVELING_FEATURE) && DISABLED(AUTO_BED_LEVELING_GRID) && DISABLED(DELTA_BED_LEVELING_GRID)
#define AUTO_BED_LEVELING_3POINT
#if ENABLED(AUTO_BED_LEVELING_FEATURE)
#if DISABLED(AUTO_BED_LEVELING_GRID)
#define AUTO_BED_LEVELING_LINEAR
#define AUTO_BED_LEVELING_3POINT
#elif IS_KINEMATIC
#define AUTO_BED_LEVELING_NONLINEAR
#else
#define AUTO_BED_LEVELING_LINEAR
#endif
#endif
#define PLANNER_LEVELING (ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_LINEAR))
/**
* Buzzer/Speaker
*/
@ -702,4 +710,18 @@
#define Z_PROBE_TRAVEL_HEIGHT Z_HOMING_HEIGHT
#endif
#if IS_KINEMATIC
// Check for this in the code instead
#define MIN_PROBE_X X_MIN_POS
#define MAX_PROBE_X X_MAX_POS
#define MIN_PROBE_Y Y_MIN_POS
#define MAX_PROBE_Y Y_MAX_POS
#else
// Boundaries for probing based on set limits
#define MIN_PROBE_X (max(X_MIN_POS, X_MIN_POS + X_PROBE_OFFSET_FROM_EXTRUDER))
#define MAX_PROBE_X (min(X_MAX_POS, X_MAX_POS + X_PROBE_OFFSET_FROM_EXTRUDER))
#define MIN_PROBE_Y (max(Y_MIN_POS, Y_MIN_POS + Y_PROBE_OFFSET_FROM_EXTRUDER))
#define MAX_PROBE_Y (min(Y_MAX_POS, Y_MAX_POS + Y_PROBE_OFFSET_FROM_EXTRUDER))
#endif
#endif // CONDITIONALS_POST_H

16
Marlin/Configuration_adv.h

@ -168,14 +168,16 @@
// @section extruder
// extruder run-out prevention.
//if the machine is idle, and the temperature over MINTEMP, every couple of SECONDS some filament is extruded
// Extruder runout prevention.
// If the machine is idle and the temperature over MINTEMP
// then extrude some filament every couple of SECONDS.
//#define EXTRUDER_RUNOUT_PREVENT
#define EXTRUDER_RUNOUT_MINTEMP 190
#define EXTRUDER_RUNOUT_SECONDS 30
#define EXTRUDER_RUNOUT_ESTEPS 14 // mm filament
#define EXTRUDER_RUNOUT_SPEED 1500 // extrusion speed
#define EXTRUDER_RUNOUT_EXTRUDE 100
#if ENABLED(EXTRUDER_RUNOUT_PREVENT)
#define EXTRUDER_RUNOUT_MINTEMP 190
#define EXTRUDER_RUNOUT_SECONDS 30
#define EXTRUDER_RUNOUT_SPEED 1500 // mm/m
#define EXTRUDER_RUNOUT_EXTRUDE 5 // mm
#endif
// @section temperature

40
Marlin/Marlin.h

@ -220,7 +220,6 @@ void disable_all_steppers();
void FlushSerialRequestResend();
void ok_to_send();
void reset_bed_level();
void kill(const char*);
void quickstop_stepper();
@ -266,6 +265,10 @@ extern bool axis_known_position[XYZ]; // axis[n].is_known
extern bool axis_homed[XYZ]; // axis[n].is_homed
extern volatile bool wait_for_heatup;
#if ENABLED(EMERGENCY_PARSER) && DISABLED(ULTIPANEL)
extern volatile bool wait_for_user;
#endif
extern float current_position[NUM_AXIS];
extern float position_shift[XYZ];
extern float home_offset[XYZ];
@ -298,26 +301,29 @@ int code_value_int();
float code_value_temp_abs();
float code_value_temp_diff();
#if ENABLED(DELTA)
#if IS_KINEMATIC
extern float delta[ABC];
extern float endstop_adj[ABC]; // axis[n].endstop_adj
extern float delta_radius;
extern float delta_diagonal_rod;
extern float delta_segments_per_second;
extern float delta_diagonal_rod_trim_tower_1;
extern float delta_diagonal_rod_trim_tower_2;
extern float delta_diagonal_rod_trim_tower_3;
void inverse_kinematics(const float cartesian[XYZ]);
#endif
#if ENABLED(DELTA)
extern float delta[ABC],
endstop_adj[ABC],
delta_radius,
delta_diagonal_rod,
delta_segments_per_second,
delta_diagonal_rod_trim_tower_1,
delta_diagonal_rod_trim_tower_2,
delta_diagonal_rod_trim_tower_3;
void recalc_delta_settings(float radius, float diagonal_rod);
#if ENABLED(AUTO_BED_LEVELING_FEATURE)
extern int delta_grid_spacing[2];
void adjust_delta(float cartesian[XYZ]);
#endif
#elif ENABLED(SCARA)
extern float delta[ABC];
#elif IS_SCARA
extern float axis_scaling[ABC]; // Build size scaling
void inverse_kinematics(const float cartesian[XYZ]);
void forward_kinematics_SCARA(float f_scara[ABC]);
void forward_kinematics_SCARA(const float &a, const float &b);
#endif
#if ENABLED(AUTO_BED_LEVELING_NONLINEAR)
extern int nonlinear_grid_spacing[2];
void adjust_delta(float cartesian[XYZ]);
#endif
#if ENABLED(Z_DUAL_ENDSTOPS)

3
Marlin/MarlinSerial.cpp

@ -509,6 +509,9 @@ MarlinSerial customizedSerial;
switch (state) {
case state_M108:
wait_for_heatup = false;
#if DISABLED(ULTIPANEL)
wait_for_user = false;
#endif
break;
case state_M112:
kill(PSTR(MSG_KILLED));

2319
Marlin/Marlin_main.cpp

File diff suppressed because it is too large

181
Marlin/SanityCheck.h

@ -137,6 +137,8 @@
#error Please replace "const int dropsegments" with "#define MIN_STEPS_PER_SEGMENT" (and increase by 1) in Configuration_adv.h.
#elif defined(PREVENT_DANGEROUS_EXTRUDE)
#error "PREVENT_DANGEROUS_EXTRUDE is now PREVENT_COLD_EXTRUSION. Please update your configuration."
#elif defined(SCARA)
#error "SCARA is now MORGAN_SCARA. Please update your configuration."
#endif
/**
@ -179,11 +181,9 @@
#if ENABLED(LCD_PROGRESS_BAR)
#if DISABLED(SDSUPPORT)
#error "LCD_PROGRESS_BAR requires SDSUPPORT."
#endif
#if ENABLED(DOGLCD)
#elif ENABLED(DOGLCD)
#error "LCD_PROGRESS_BAR does not apply to graphical displays."
#endif
#if ENABLED(FILAMENT_LCD_DISPLAY)
#elif ENABLED(FILAMENT_LCD_DISPLAY)
#error "LCD_PROGRESS_BAR and FILAMENT_LCD_DISPLAY are not fully compatible. Comment out this line to use both."
#endif
#endif
@ -573,11 +573,39 @@
/**
* Don't set more than one kinematic type
*/
#if (ENABLED(DELTA) && (ENABLED(SCARA) || ENABLED(COREXY) || ENABLED(COREXZ) || ENABLED(COREYZ))) \
|| (ENABLED(SCARA) && (ENABLED(COREXY) || ENABLED(COREXZ) || ENABLED(COREYZ))) \
|| (ENABLED(COREXY) && (ENABLED(COREXZ) || ENABLED(COREYZ))) \
|| (ENABLED(COREXZ) && ENABLED(COREYZ))
#error "Please enable only one of DELTA, SCARA, COREXY, COREXZ, or COREYZ."
#define COUNT_KIN_1 0
#if ENABLED(DELTA)
#define COUNT_KIN_2 INCREMENT(COUNT_KIN_1)
#else
#define COUNT_KIN_2 COUNT_KIN_1
#endif
#if ENABLED(MORGAN_SCARA)
#define COUNT_KIN_3 INCREMENT(COUNT_KIN_2)
#else
#define COUNT_KIN_3 COUNT_KIN_2
#endif
#if ENABLED(MAKERARM_SCARA)
#define COUNT_KIN_4 INCREMENT(COUNT_KIN_3)
#else
#define COUNT_KIN_4 COUNT_KIN_3
#endif
#if ENABLED(COREXY)
#define COUNT_KIN_5 INCREMENT(COUNT_KIN_4)
#else
#define COUNT_KIN_5 COUNT_KIN_4
#endif
#if ENABLED(COREXZ)
#define COUNT_KIN_6 INCREMENT(COUNT_KIN_5)
#else
#define COUNT_KIN_6 COUNT_KIN_5
#endif
#if ENABLED(COREYZ)
#define COUNT_KIN_7 INCREMENT(COUNT_KIN_6)
#else
#define COUNT_KIN_7 COUNT_KIN_6
#endif
#if COUNT_KIN_7 > 1
#error "Please enable only one of DELTA, MORGAN_SCARA, MAKERARM_SCARA, COREXY, COREXZ, or COREYZ."
#endif
/**
@ -750,7 +778,7 @@
#elif ENABLED(DELTA)
#error "Z_DUAL_ENDSTOPS is not compatible with DELTA."
#endif
#elif DISABLED(SCARA)
#elif !IS_SCARA
#if X_HOME_DIR < 0 && DISABLED(USE_XMIN_PLUG)
#error "Enable USE_XMIN_PLUG when homing X to MIN."
#elif X_HOME_DIR > 0 && DISABLED(USE_XMAX_PLUG)
@ -783,3 +811,136 @@
#error "I2C_SLAVE_ADDRESS can't be over 127. (Only 7 bits allowed.)"
#endif
#endif
/**
* Make sure only one display is enabled
*
* Note: BQ_LCD_SMART_CONTROLLER => REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER
* REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER => REPRAP_DISCOUNT_SMART_CONTROLLER
* SAV_3DGLCD => U8GLIB_SH1106 => ULTIMAKERCONTROLLER
* miniVIKI => ULTIMAKERCONTROLLER
* VIKI2 => ULTIMAKERCONTROLLER
* ELB_FULL_GRAPHIC_CONTROLLER => ULTIMAKERCONTROLLER
* PANEL_ONE => ULTIMAKERCONTROLLER
*/
#define COUNT_LCD_1 0
#if ENABLED(ULTIMAKERCONTROLLER) \
&& DISABLED(SAV_3DGLCD) && DISABLED(miniVIKI) && DISABLED(VIKI2) \
&& DISABLED(ELB_FULL_GRAPHIC_CONTROLLER) && DISABLED(PANEL_ONE)
#define COUNT_LCD_2 INCREMENT(COUNT_LCD_1)
#else
#define COUNT_LCD_2 COUNT_LCD_1
#endif
#if ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER) && DISABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER)
#define COUNT_LCD_3 INCREMENT(COUNT_LCD_2)
#else
#define COUNT_LCD_3 COUNT_LCD_2
#endif
#if ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) && DISABLED(BQ_LCD_SMART_CONTROLLER)
#define COUNT_LCD_4 INCREMENT(COUNT_LCD_3)
#else
#define COUNT_LCD_4 COUNT_LCD_3
#endif
#if ENABLED(CARTESIO_UI)
#define COUNT_LCD_5 INCREMENT(COUNT_LCD_4)
#else
#define COUNT_LCD_5 COUNT_LCD_4
#endif
#if ENABLED(PANEL_ONE)
#define COUNT_LCD_6 INCREMENT(COUNT_LCD_5)
#else
#define COUNT_LCD_6 COUNT_LCD_5
#endif
#if ENABLED(MAKRPANEL)
#define COUNT_LCD_7 INCREMENT(COUNT_LCD_6)
#else
#define COUNT_LCD_7 COUNT_LCD_6
#endif
#if ENABLED(REPRAPWORLD_GRAPHICAL_LCD)
#define COUNT_LCD_8 INCREMENT(COUNT_LCD_7)
#else
#define COUNT_LCD_8 COUNT_LCD_7
#endif
#if ENABLED(VIKI2)
#define COUNT_LCD_9 INCREMENT(COUNT_LCD_8)
#else
#define COUNT_LCD_9 COUNT_LCD_8
#endif
#if ENABLED(miniVIKI)
#define COUNT_LCD_10 INCREMENT(COUNT_LCD_9)
#else
#define COUNT_LCD_10 COUNT_LCD_9
#endif
#if ENABLED(ELB_FULL_GRAPHIC_CONTROLLER)
#define COUNT_LCD_11 INCREMENT(COUNT_LCD_10)
#else
#define COUNT_LCD_11 COUNT_LCD_10
#endif
#if ENABLED(G3D_PANEL)
#define COUNT_LCD_12 INCREMENT(COUNT_LCD_11)
#else
#define COUNT_LCD_12 COUNT_LCD_11
#endif
#if ENABLED(MINIPANEL)
#define COUNT_LCD_13 INCREMENT(COUNT_LCD_12)
#else
#define COUNT_LCD_13 COUNT_LCD_12
#endif
#if ENABLED(REPRAPWORLD_KEYPAD)
#define COUNT_LCD_14 INCREMENT(COUNT_LCD_13)
#else
#define COUNT_LCD_14 COUNT_LCD_13
#endif
#if ENABLED(RIGIDBOT_PANEL)
#define COUNT_LCD_15 INCREMENT(COUNT_LCD_14)
#else
#define COUNT_LCD_15 COUNT_LCD_14
#endif
#if ENABLED(RA_CONTROL_PANEL)
#define COUNT_LCD_16 INCREMENT(COUNT_LCD_15)
#else
#define COUNT_LCD_16 COUNT_LCD_15
#endif
#if ENABLED(LCD_I2C_SAINSMART_YWROBOT)
#define COUNT_LCD_17 INCREMENT(COUNT_LCD_16)
#else
#define COUNT_LCD_17 COUNT_LCD_16
#endif
#if ENABLED(LCM1602)
#define COUNT_LCD_18 INCREMENT(COUNT_LCD_17)
#else
#define COUNT_LCD_18 COUNT_LCD_17
#endif
#if ENABLED(LCD_I2C_PANELOLU2)
#define COUNT_LCD_19 INCREMENT(COUNT_LCD_18)
#else
#define COUNT_LCD_19 COUNT_LCD_18
#endif
#if ENABLED(LCD_I2C_VIKI)
#define COUNT_LCD_20 INCREMENT(COUNT_LCD_19)
#else
#define COUNT_LCD_20 COUNT_LCD_19
#endif
#if ENABLED(U8GLIB_SSD1306)
#define COUNT_LCD_21 INCREMENT(COUNT_LCD_20)
#else
#define COUNT_LCD_21 COUNT_LCD_20
#endif
#if ENABLED(SAV_3DLCD)
#define COUNT_LCD_22 INCREMENT(COUNT_LCD_21)
#else
#define COUNT_LCD_22 COUNT_LCD_21
#endif
#if ENABLED(BQ_LCD_SMART_CONTROLLER)
#define COUNT_LCD_23 INCREMENT(COUNT_LCD_22)
#else
#define COUNT_LCD_23 COUNT_LCD_22
#endif
#if ENABLED(SAV_3DGLCD)
#define COUNT_LCD_24 INCREMENT(COUNT_LCD_23)
#else
#define COUNT_LCD_24 COUNT_LCD_23
#endif
#if COUNT_LCD_24 > 1
#error "Please select no more than one LCD controller option."
#endif

8
Marlin/configuration_store.cpp

@ -330,7 +330,7 @@ void Config_StoreSettings() {
#endif
EEPROM_WRITE(lcd_contrast);
#if ENABLED(SCARA)
#if IS_SCARA
EEPROM_WRITE(axis_scaling); // 3 floats
#else
dummy = 1.0f;
@ -520,7 +520,7 @@ void Config_RetrieveSettings() {
#endif
EEPROM_READ(lcd_contrast);
#if ENABLED(SCARA)
#if IS_SCARA
EEPROM_READ(axis_scaling); // 3 floats
#else
EEPROM_READ(dummy);
@ -584,7 +584,7 @@ void Config_ResetDefault() {
planner.axis_steps_per_mm[i] = tmp1[i];
planner.max_feedrate_mm_s[i] = tmp2[i];
planner.max_acceleration_mm_per_s2[i] = tmp3[i];
#if ENABLED(SCARA)
#if IS_SCARA
if (i < COUNT(axis_scaling))
axis_scaling[i] = 1;
#endif
@ -716,7 +716,7 @@ void Config_PrintSettings(bool forReplay) {
CONFIG_ECHO_START;
#if ENABLED(SCARA)
#if IS_SCARA
if (!forReplay) {
SERIAL_ECHOLNPGM("Scaling factors:");
CONFIG_ECHO_START;

3
Marlin/enum.h

@ -42,7 +42,8 @@ enum AxisEnum {
E_AXIS = 3,
X_HEAD = 4,
Y_HEAD = 5,
Z_HEAD = 6
Z_HEAD = 6,
ALL_AXES = 100
};
#define LOOP_XYZ(VAR) for (uint8_t VAR=X_AXIS; VAR<=Z_AXIS; VAR++)

16
Marlin/example_configurations/Cartesio/Configuration_adv.h

@ -168,14 +168,16 @@
// @section extruder
// extruder run-out prevention.
//if the machine is idle, and the temperature over MINTEMP, every couple of SECONDS some filament is extruded
// Extruder runout prevention.
// If the machine is idle and the temperature over MINTEMP
// then extrude some filament every couple of SECONDS.
//#define EXTRUDER_RUNOUT_PREVENT
#define EXTRUDER_RUNOUT_MINTEMP 190
#define EXTRUDER_RUNOUT_SECONDS 30
#define EXTRUDER_RUNOUT_ESTEPS 14 // mm filament
#define EXTRUDER_RUNOUT_SPEED 1500 // extrusion speed
#define EXTRUDER_RUNOUT_EXTRUDE 100
#if ENABLED(EXTRUDER_RUNOUT_PREVENT)
#define EXTRUDER_RUNOUT_MINTEMP 190
#define EXTRUDER_RUNOUT_SECONDS 30
#define EXTRUDER_RUNOUT_SPEED 1500 // mm/m
#define EXTRUDER_RUNOUT_EXTRUDE 5 // mm
#endif
// @section temperature

16
Marlin/example_configurations/Felix/Configuration_adv.h

@ -168,14 +168,16 @@
// @section extruder
// extruder run-out prevention.
//if the machine is idle, and the temperature over MINTEMP, every couple of SECONDS some filament is extruded
// Extruder runout prevention.
// If the machine is idle and the temperature over MINTEMP
// then extrude some filament every couple of SECONDS.
//#define EXTRUDER_RUNOUT_PREVENT
#define EXTRUDER_RUNOUT_MINTEMP 190
#define EXTRUDER_RUNOUT_SECONDS 30
#define EXTRUDER_RUNOUT_ESTEPS 14 // mm filament
#define EXTRUDER_RUNOUT_SPEED 1500 // extrusion speed
#define EXTRUDER_RUNOUT_EXTRUDE 100
#if ENABLED(EXTRUDER_RUNOUT_PREVENT)
#define EXTRUDER_RUNOUT_MINTEMP 190
#define EXTRUDER_RUNOUT_SECONDS 30
#define EXTRUDER_RUNOUT_SPEED 1500 // mm/m
#define EXTRUDER_RUNOUT_EXTRUDE 5 // mm
#endif
// @section temperature

16
Marlin/example_configurations/Hephestos/Configuration_adv.h

@ -168,14 +168,16 @@
// @section extruder
// extruder run-out prevention.
//if the machine is idle, and the temperature over MINTEMP, every couple of SECONDS some filament is extruded
// Extruder runout prevention.
// If the machine is idle and the temperature over MINTEMP
// then extrude some filament every couple of SECONDS.
//#define EXTRUDER_RUNOUT_PREVENT
#define EXTRUDER_RUNOUT_MINTEMP 190
#define EXTRUDER_RUNOUT_SECONDS 30
#define EXTRUDER_RUNOUT_ESTEPS 14 // mm filament
#define EXTRUDER_RUNOUT_SPEED 1500 // extrusion speed
#define EXTRUDER_RUNOUT_EXTRUDE 100
#if ENABLED(EXTRUDER_RUNOUT_PREVENT)
#define EXTRUDER_RUNOUT_MINTEMP 190
#define EXTRUDER_RUNOUT_SECONDS 30
#define EXTRUDER_RUNOUT_SPEED 1500 // mm/m
#define EXTRUDER_RUNOUT_EXTRUDE 5 // mm
#endif
// @section temperature

16
Marlin/example_configurations/Hephestos_2/Configuration_adv.h

@ -168,14 +168,16 @@
// @section extruder
// extruder run-out prevention.
//if the machine is idle, and the temperature over MINTEMP, every couple of SECONDS some filament is extruded
// Extruder runout prevention.
// If the machine is idle and the temperature over MINTEMP
// then extrude some filament every couple of SECONDS.
//#define EXTRUDER_RUNOUT_PREVENT
#define EXTRUDER_RUNOUT_MINTEMP 190
#define EXTRUDER_RUNOUT_SECONDS 30
#define EXTRUDER_RUNOUT_ESTEPS 14 // mm filament
#define EXTRUDER_RUNOUT_SPEED 1500 // extrusion speed
#define EXTRUDER_RUNOUT_EXTRUDE 100
#if ENABLED(EXTRUDER_RUNOUT_PREVENT)
#define EXTRUDER_RUNOUT_MINTEMP 190
#define EXTRUDER_RUNOUT_SECONDS 30
#define EXTRUDER_RUNOUT_SPEED 1500 // mm/m
#define EXTRUDER_RUNOUT_EXTRUDE 5 // mm
#endif
// @section temperature

16
Marlin/example_configurations/K8200/Configuration_adv.h

@ -174,14 +174,16 @@
// @section extruder
// extruder run-out prevention.
//if the machine is idle, and the temperature over MINTEMP, every couple of SECONDS some filament is extruded
// Extruder runout prevention.
// If the machine is idle and the temperature over MINTEMP
// then extrude some filament every couple of SECONDS.
//#define EXTRUDER_RUNOUT_PREVENT
#define EXTRUDER_RUNOUT_MINTEMP 190
#define EXTRUDER_RUNOUT_SECONDS 30
#define EXTRUDER_RUNOUT_ESTEPS 14 // mm filament
#define EXTRUDER_RUNOUT_SPEED 1500 // extrusion speed
#define EXTRUDER_RUNOUT_EXTRUDE 100
#if ENABLED(EXTRUDER_RUNOUT_PREVENT)
#define EXTRUDER_RUNOUT_MINTEMP 190
#define EXTRUDER_RUNOUT_SECONDS 30
#define EXTRUDER_RUNOUT_SPEED 1500 // mm/m
#define EXTRUDER_RUNOUT_EXTRUDE 5 // mm
#endif
// @section temperature

16
Marlin/example_configurations/K8400/Configuration_adv.h

@ -168,14 +168,16 @@
// @section extruder
// extruder run-out prevention.
//if the machine is idle, and the temperature over MINTEMP, every couple of SECONDS some filament is extruded
// Extruder runout prevention.
// If the machine is idle and the temperature over MINTEMP
// then extrude some filament every couple of SECONDS.
//#define EXTRUDER_RUNOUT_PREVENT
#define EXTRUDER_RUNOUT_MINTEMP 190
#define EXTRUDER_RUNOUT_SECONDS 30
#define EXTRUDER_RUNOUT_ESTEPS 14 // mm filament
#define EXTRUDER_RUNOUT_SPEED 1500 // extrusion speed
#define EXTRUDER_RUNOUT_EXTRUDE 100
#if ENABLED(EXTRUDER_RUNOUT_PREVENT)
#define EXTRUDER_RUNOUT_MINTEMP 190
#define EXTRUDER_RUNOUT_SECONDS 30
#define EXTRUDER_RUNOUT_SPEED 1500 // mm/m
#define EXTRUDER_RUNOUT_EXTRUDE 5 // mm
#endif
// @section temperature

16
Marlin/example_configurations/RigidBot/Configuration_adv.h

@ -168,14 +168,16 @@
// @section extruder
// extruder run-out prevention.
//if the machine is idle, and the temperature over MINTEMP, every couple of SECONDS some filament is extruded
// Extruder runout prevention.
// If the machine is idle and the temperature over MINTEMP
// then extrude some filament every couple of SECONDS.
//#define EXTRUDER_RUNOUT_PREVENT
#define EXTRUDER_RUNOUT_MINTEMP 190
#define EXTRUDER_RUNOUT_SECONDS 30
#define EXTRUDER_RUNOUT_ESTEPS 14 // mm filament
#define EXTRUDER_RUNOUT_SPEED 1500 // extrusion speed
#define EXTRUDER_RUNOUT_EXTRUDE 100
#if ENABLED(EXTRUDER_RUNOUT_PREVENT)
#define EXTRUDER_RUNOUT_MINTEMP 190
#define EXTRUDER_RUNOUT_SECONDS 30
#define EXTRUDER_RUNOUT_SPEED 1500 // mm/m
#define EXTRUDER_RUNOUT_EXTRUDE 5 // mm
#endif
// @section temperature

48
Marlin/example_configurations/SCARA/Configuration.h

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

16
Marlin/example_configurations/SCARA/Configuration_adv.h

@ -168,14 +168,16 @@
// @section extruder
// extruder run-out prevention.
//if the machine is idle, and the temperature over MINTEMP, every couple of SECONDS some filament is extruded
// Extruder runout prevention.
// If the machine is idle and the temperature over MINTEMP
// then extrude some filament every couple of SECONDS.
//#define EXTRUDER_RUNOUT_PREVENT
#define EXTRUDER_RUNOUT_MINTEMP 180
#define EXTRUDER_RUNOUT_SECONDS 30
#define EXTRUDER_RUNOUT_ESTEPS 14 // mm filament
#define EXTRUDER_RUNOUT_SPEED 180 // extrusion speed
#define EXTRUDER_RUNOUT_EXTRUDE 100
#if ENABLED(EXTRUDER_RUNOUT_PREVENT)
#define EXTRUDER_RUNOUT_MINTEMP 190
#define EXTRUDER_RUNOUT_SECONDS 30
#define EXTRUDER_RUNOUT_SPEED 180 // mm/m
#define EXTRUDER_RUNOUT_EXTRUDE 5 // mm
#endif
// @section temperature

16
Marlin/example_configurations/TAZ4/Configuration_adv.h

@ -168,14 +168,16 @@
// @section extruder
// extruder run-out prevention.
//if the machine is idle, and the temperature over MINTEMP, every couple of SECONDS some filament is extruded
// Extruder runout prevention.
// If the machine is idle and the temperature over MINTEMP
// then extrude some filament every couple of SECONDS.
//#define EXTRUDER_RUNOUT_PREVENT
#define EXTRUDER_RUNOUT_MINTEMP 190
#define EXTRUDER_RUNOUT_SECONDS 30
#define EXTRUDER_RUNOUT_ESTEPS 14 // mm filament
#define EXTRUDER_RUNOUT_SPEED 1500 // extrusion speed
#define EXTRUDER_RUNOUT_EXTRUDE 100
#if ENABLED(EXTRUDER_RUNOUT_PREVENT)
#define EXTRUDER_RUNOUT_MINTEMP 190
#define EXTRUDER_RUNOUT_SECONDS 30
#define EXTRUDER_RUNOUT_SPEED 1500 // mm/m
#define EXTRUDER_RUNOUT_EXTRUDE 5 // mm
#endif
// @section temperature

16
Marlin/example_configurations/WITBOX/Configuration_adv.h

@ -168,14 +168,16 @@
// @section extruder
// extruder run-out prevention.
//if the machine is idle, and the temperature over MINTEMP, every couple of SECONDS some filament is extruded
// Extruder runout prevention.
// If the machine is idle and the temperature over MINTEMP
// then extrude some filament every couple of SECONDS.
//#define EXTRUDER_RUNOUT_PREVENT
#define EXTRUDER_RUNOUT_MINTEMP 190
#define EXTRUDER_RUNOUT_SECONDS 30
#define EXTRUDER_RUNOUT_ESTEPS 14 // mm filament
#define EXTRUDER_RUNOUT_SPEED 1500 // extrusion speed
#define EXTRUDER_RUNOUT_EXTRUDE 100
#if ENABLED(EXTRUDER_RUNOUT_PREVENT)
#define EXTRUDER_RUNOUT_MINTEMP 190
#define EXTRUDER_RUNOUT_SECONDS 30
#define EXTRUDER_RUNOUT_SPEED 1500 // mm/m
#define EXTRUDER_RUNOUT_EXTRUDE 5 // mm
#endif
// @section temperature

16
Marlin/example_configurations/delta/biv2.5/Configuration_adv.h

@ -168,14 +168,16 @@
// @section extruder
// extruder run-out prevention.
//if the machine is idle, and the temperature over MINTEMP, every couple of SECONDS some filament is extruded
// Extruder runout prevention.
// If the machine is idle and the temperature over MINTEMP
// then extrude some filament every couple of SECONDS.
//#define EXTRUDER_RUNOUT_PREVENT
#define EXTRUDER_RUNOUT_MINTEMP 190
#define EXTRUDER_RUNOUT_SECONDS 30
#define EXTRUDER_RUNOUT_ESTEPS 14 // mm filament
#define EXTRUDER_RUNOUT_SPEED 1500 // extrusion speed
#define EXTRUDER_RUNOUT_EXTRUDE 100
#if ENABLED(EXTRUDER_RUNOUT_PREVENT)
#define EXTRUDER_RUNOUT_MINTEMP 190
#define EXTRUDER_RUNOUT_SECONDS 30
#define EXTRUDER_RUNOUT_SPEED 1500 // mm/m
#define EXTRUDER_RUNOUT_EXTRUDE 5 // mm
#endif
// @section temperature

16
Marlin/example_configurations/delta/generic/Configuration_adv.h

@ -168,14 +168,16 @@
// @section extruder
// extruder run-out prevention.
//if the machine is idle, and the temperature over MINTEMP, every couple of SECONDS some filament is extruded
// Extruder runout prevention.
// If the machine is idle and the temperature over MINTEMP
// then extrude some filament every couple of SECONDS.
//#define EXTRUDER_RUNOUT_PREVENT
#define EXTRUDER_RUNOUT_MINTEMP 190
#define EXTRUDER_RUNOUT_SECONDS 30
#define EXTRUDER_RUNOUT_ESTEPS 14 // mm filament
#define EXTRUDER_RUNOUT_SPEED 1500 // extrusion speed
#define EXTRUDER_RUNOUT_EXTRUDE 100
#if ENABLED(EXTRUDER_RUNOUT_PREVENT)
#define EXTRUDER_RUNOUT_MINTEMP 190
#define EXTRUDER_RUNOUT_SECONDS 30
#define EXTRUDER_RUNOUT_SPEED 1500 // mm/m
#define EXTRUDER_RUNOUT_EXTRUDE 5 // mm
#endif
// @section temperature

16
Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h

@ -168,14 +168,16 @@
// @section extruder
// extruder run-out prevention.
//if the machine is idle, and the temperature over MINTEMP, every couple of SECONDS some filament is extruded
// Extruder runout prevention.
// If the machine is idle and the temperature over MINTEMP
// then extrude some filament every couple of SECONDS.
//#define EXTRUDER_RUNOUT_PREVENT
#define EXTRUDER_RUNOUT_MINTEMP 190
#define EXTRUDER_RUNOUT_SECONDS 30
#define EXTRUDER_RUNOUT_ESTEPS 14 // mm filament
#define EXTRUDER_RUNOUT_SPEED 1500 // extrusion speed
#define EXTRUDER_RUNOUT_EXTRUDE 100
#if ENABLED(EXTRUDER_RUNOUT_PREVENT)
#define EXTRUDER_RUNOUT_MINTEMP 190
#define EXTRUDER_RUNOUT_SECONDS 30
#define EXTRUDER_RUNOUT_SPEED 1500 // mm/m
#define EXTRUDER_RUNOUT_EXTRUDE 5 // mm
#endif
// @section temperature

16
Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h

@ -173,14 +173,16 @@
// @section extruder
// extruder run-out prevention.
//if the machine is idle, and the temperature over MINTEMP, every couple of SECONDS some filament is extruded
// Extruder runout prevention.
// If the machine is idle and the temperature over MINTEMP
// then extrude some filament every couple of SECONDS.
//#define EXTRUDER_RUNOUT_PREVENT
#define EXTRUDER_RUNOUT_MINTEMP 190
#define EXTRUDER_RUNOUT_SECONDS 30
#define EXTRUDER_RUNOUT_ESTEPS 14 // mm filament
#define EXTRUDER_RUNOUT_SPEED 1500 // extrusion speed
#define EXTRUDER_RUNOUT_EXTRUDE 100
#if ENABLED(EXTRUDER_RUNOUT_PREVENT)
#define EXTRUDER_RUNOUT_MINTEMP 190
#define EXTRUDER_RUNOUT_SECONDS 30
#define EXTRUDER_RUNOUT_SPEED 1500 // mm/m
#define EXTRUDER_RUNOUT_EXTRUDE 5 // mm
#endif
// @section temperature

16
Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h

@ -168,14 +168,16 @@
// @section extruder
// extruder run-out prevention.
//if the machine is idle, and the temperature over MINTEMP, every couple of SECONDS some filament is extruded
// Extruder runout prevention.
// If the machine is idle and the temperature over MINTEMP
// then extrude some filament every couple of SECONDS.
//#define EXTRUDER_RUNOUT_PREVENT
#define EXTRUDER_RUNOUT_MINTEMP 190
#define EXTRUDER_RUNOUT_SECONDS 30
#define EXTRUDER_RUNOUT_ESTEPS 14 // mm filament
#define EXTRUDER_RUNOUT_SPEED 1500 // extrusion speed
#define EXTRUDER_RUNOUT_EXTRUDE 100
#if ENABLED(EXTRUDER_RUNOUT_PREVENT)
#define EXTRUDER_RUNOUT_MINTEMP 190
#define EXTRUDER_RUNOUT_SECONDS 30
#define EXTRUDER_RUNOUT_SPEED 1500 // mm/m
#define EXTRUDER_RUNOUT_EXTRUDE 5 // mm
#endif
// @section temperature

16
Marlin/example_configurations/makibox/Configuration_adv.h

@ -168,14 +168,16 @@
// @section extruder
// extruder run-out prevention.
//if the machine is idle, and the temperature over MINTEMP, every couple of SECONDS some filament is extruded
// Extruder runout prevention.
// If the machine is idle and the temperature over MINTEMP
// then extrude some filament every couple of SECONDS.
//#define EXTRUDER_RUNOUT_PREVENT
#define EXTRUDER_RUNOUT_MINTEMP 190
#define EXTRUDER_RUNOUT_SECONDS 30
#define EXTRUDER_RUNOUT_ESTEPS 14 // mm filament
#define EXTRUDER_RUNOUT_SPEED 1500 // extrusion speed
#define EXTRUDER_RUNOUT_EXTRUDE 100
#if ENABLED(EXTRUDER_RUNOUT_PREVENT)
#define EXTRUDER_RUNOUT_MINTEMP 190
#define EXTRUDER_RUNOUT_SECONDS 30
#define EXTRUDER_RUNOUT_SPEED 1500 // mm/m
#define EXTRUDER_RUNOUT_EXTRUDE 5 // mm
#endif
// @section temperature

16
Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h

@ -168,14 +168,16 @@
// @section extruder
// extruder run-out prevention.
//if the machine is idle, and the temperature over MINTEMP, every couple of SECONDS some filament is extruded
// Extruder runout prevention.
// If the machine is idle and the temperature over MINTEMP
// then extrude some filament every couple of SECONDS.
//#define EXTRUDER_RUNOUT_PREVENT
#define EXTRUDER_RUNOUT_MINTEMP 190
#define EXTRUDER_RUNOUT_SECONDS 30
#define EXTRUDER_RUNOUT_ESTEPS 14 // mm filament
#define EXTRUDER_RUNOUT_SPEED 1500 // extrusion speed
#define EXTRUDER_RUNOUT_EXTRUDE 100
#if ENABLED(EXTRUDER_RUNOUT_PREVENT)
#define EXTRUDER_RUNOUT_MINTEMP 190
#define EXTRUDER_RUNOUT_SECONDS 30
#define EXTRUDER_RUNOUT_SPEED 1500 // mm/m
#define EXTRUDER_RUNOUT_EXTRUDE 5 // mm
#endif
// @section temperature

6
Marlin/language.h

@ -157,9 +157,9 @@
#define MSG_ENDSTOP_OPEN "open"
#define MSG_HOTEND_OFFSET "Hotend offsets:"
#define MSG_DUPLICATION_MODE "Duplication mode: "
#define MSG_SOFT_ENDSTOPS "Soft endstops"
#define MSG_SOFT_MIN "Min"
#define MSG_SOFT_MAX "Max"
#define MSG_SOFT_ENDSTOPS "Soft endstops: "
#define MSG_SOFT_MIN " Min: "
#define MSG_SOFT_MAX " Max: "
#define MSG_SD_CANT_OPEN_SUBDIR "Cannot open subdir "
#define MSG_SD_INIT_FAIL "SD init fail"

3
Marlin/language_en.h

@ -408,6 +408,9 @@
#ifndef MSG_ERR_MINTEMP_BED
#define MSG_ERR_MINTEMP_BED "Err: MINTEMP BED"
#endif
#ifndef MSG_ERR_Z_HOMING
#define MSG_ERR_Z_HOMING "G28 Z Forbidden"
#endif
#ifndef MSG_HALTED
#define MSG_HALTED "PRINTER HALTED"
#endif

7
Marlin/macros.h

@ -55,7 +55,8 @@
#endif
#define RADIANS(d) ((d)*M_PI/180.0)
#define DEGREES(r) ((r)*180.0/M_PI)
#define HYPOT(x,y) sqrt(sq(x)+sq(y))
#define HYPOT2(x,y) (sq(x)+sq(y))
#define HYPOT(x,y) sqrt(HYPOT2(x,y))
// Macros to contrain values
#define NOLESS(v,n) do{ if (v < n) v = n; }while(0)
@ -124,4 +125,8 @@
#define MAX3(a, b, c) max(max(a, b), c)
#define MAX4(a, b, c, d) max(max(max(a, b), c), d)
#define UNEAR_ZERO(x) ((x) < 0.000001)
#define NEAR_ZERO(x) ((x) > -0.000001 && (x) < 0.000001)
#define NEAR(x,y) NEAR_ZERO((x)-(y))
#endif //__MACROS_H

116
Marlin/planner.cpp

@ -98,7 +98,7 @@ float Planner::min_feedrate_mm_s,
Planner::max_e_jerk,
Planner::min_travel_feedrate_mm_s;
#if ENABLED(AUTO_BED_LEVELING_FEATURE)
#if ENABLED(AUTO_BED_LEVELING_LINEAR)
matrix_3x3 Planner::bed_level_matrix; // Transform to compensate for bed level
#endif
@ -138,7 +138,7 @@ void Planner::init() {
memset(position, 0, sizeof(position)); // clear position
LOOP_XYZE(i) previous_speed[i] = 0.0;
previous_nominal_speed = 0.0;
#if ENABLED(AUTO_BED_LEVELING_FEATURE)
#if ENABLED(AUTO_BED_LEVELING_LINEAR)
bed_level_matrix.set_to_identity();
#endif
}
@ -521,37 +521,51 @@ void Planner::check_axes_activity() {
#endif
}
#if ENABLED(AUTO_BED_LEVELING_FEATURE) || ENABLED(MESH_BED_LEVELING)
#if PLANNER_LEVELING
void Planner::apply_leveling(
void Planner::apply_leveling(float &lx, float &ly, float &lz) {
#if ENABLED(MESH_BED_LEVELING)
const float &x, const float &y
#else
float &x, float &y
if (mbl.active())
lz += mbl.get_z(RAW_X_POSITION(lx), RAW_Y_POSITION(ly));
#elif ENABLED(AUTO_BED_LEVELING_LINEAR)
float dx = RAW_X_POSITION(lx) - (X_TILT_FULCRUM),
dy = RAW_Y_POSITION(ly) - (Y_TILT_FULCRUM),
dz = RAW_Z_POSITION(lz);
apply_rotation_xyz(bed_level_matrix, dx, dy, dz);
lx = LOGICAL_X_POSITION(dx + X_TILT_FULCRUM);
ly = LOGICAL_Y_POSITION(dy + Y_TILT_FULCRUM);
lz = LOGICAL_Z_POSITION(dz);
#endif
, float &z
) {
}
void Planner::unapply_leveling(float &lx, float &ly, float &lz) {
#if ENABLED(MESH_BED_LEVELING)
if (mbl.active())
z += mbl.get_z(RAW_X_POSITION(x), RAW_Y_POSITION(y));
lz -= mbl.get_z(RAW_X_POSITION(lx), RAW_Y_POSITION(ly));
#elif ENABLED(AUTO_BED_LEVELING_LINEAR)
#elif ENABLED(AUTO_BED_LEVELING_FEATURE)
matrix_3x3 inverse = matrix_3x3::transpose(bed_level_matrix);
float tx = RAW_X_POSITION(x) - (X_TILT_FULCRUM),
ty = RAW_Y_POSITION(y) - (Y_TILT_FULCRUM),
tz = RAW_Z_POSITION(z);
float dx = lx - (X_TILT_FULCRUM), dy = ly - (Y_TILT_FULCRUM), dz = lz;
apply_rotation_xyz(bed_level_matrix, tx, ty, tz);
apply_rotation_xyz(inverse, dx, dy, dz);
x = LOGICAL_X_POSITION(tx + X_TILT_FULCRUM);
y = LOGICAL_Y_POSITION(ty + Y_TILT_FULCRUM);
z = LOGICAL_Z_POSITION(tz);
lx = LOGICAL_X_POSITION(dx + X_TILT_FULCRUM);
ly = LOGICAL_Y_POSITION(dy + Y_TILT_FULCRUM);
lz = LOGICAL_Z_POSITION(dz);
#endif
}
#endif
#endif // PLANNER_LEVELING
/**
* Planner::buffer_line
@ -562,15 +576,7 @@ void Planner::check_axes_activity() {
* fr_mm_s - (target) speed of the move
* extruder - target extruder
*/
void Planner::buffer_line(
#if ENABLED(AUTO_BED_LEVELING_FEATURE) || ENABLED(MESH_BED_LEVELING)
float x, float y, float z
#else
const float& x, const float& y, const float& z
#endif
, const float& e, float fr_mm_s, const uint8_t extruder
) {
void Planner::buffer_line(ARG_X, ARG_Y, ARG_Z, const float &e, float fr_mm_s, const uint8_t extruder) {
// Calculate the buffer head after we push this byte
int next_buffer_head = next_block_index(block_buffer_head);
@ -578,17 +584,17 @@ void Planner::buffer_line(
// Rest here until there is room in the buffer.
while (block_buffer_tail == next_buffer_head) idle();
#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_FEATURE)
apply_leveling(x, y, z);
#if PLANNER_LEVELING
apply_leveling(lx, ly, lz);
#endif
// The target position of the tool in absolute steps
// Calculate target position in absolute steps
//this should be done after the wait, because otherwise a M92 code within the gcode disrupts this calculation somehow
long target[NUM_AXIS] = {
lround(x * axis_steps_per_mm[X_AXIS]),
lround(y * axis_steps_per_mm[Y_AXIS]),
lround(z * axis_steps_per_mm[Z_AXIS]),
lround(lx * axis_steps_per_mm[X_AXIS]),
lround(ly * axis_steps_per_mm[Y_AXIS]),
lround(lz * axis_steps_per_mm[Z_AXIS]),
lround(e * axis_steps_per_mm[E_AXIS])
};
@ -598,11 +604,22 @@ void Planner::buffer_line(
/*
SERIAL_ECHO_START;
SERIAL_ECHOPAIR("Planner X:", x);
SERIAL_ECHOPAIR(" (", dx);
SERIAL_ECHOPAIR(") Y:", y);
SERIAL_ECHOPGM("Planner ", x);
#if IS_KINEMATIC
SERIAL_ECHOPAIR("A:", x);
SERIAL_ECHOPAIR(" (", dx);
SERIAL_ECHOPAIR(") B:", y);
#else
SERIAL_ECHOPAIR("X:", x);
SERIAL_ECHOPAIR(" (", dx);
SERIAL_ECHOPAIR(") Y:", y);
#endif
SERIAL_ECHOPAIR(" (", dy);
SERIAL_ECHOPAIR(") Z:", z);
#elif ENABLED(DELTA)
SERIAL_ECHOPAIR(") C:", z);
#else
SERIAL_ECHOPAIR(") Z:", z);
#endif
SERIAL_ECHOPAIR(" (", dz);
SERIAL_ECHOLNPGM(")");
//*/
@ -671,7 +688,7 @@ void Planner::buffer_line(
// For a mixing extruder, get a magnified step_event_count for each
#if ENABLED(MIXING_EXTRUDER)
for (uint8_t i = 0; i < MIXING_STEPPERS; i++)
block->mix_event_count[i] = (mixing_factor[i] < 0.0001) ? 0 : block->step_event_count / mixing_factor[i];
block->mix_event_count[i] = UNEAR_ZERO(mixing_factor[i]) ? 0 : block->step_event_count / mixing_factor[i];
#endif
#if FAN_COUNT > 0
@ -1124,7 +1141,7 @@ void Planner::buffer_line(
block->advance_rate = acc_dist ? advance / (float)acc_dist : 0;
}
/**
SERIAL_ECHO_START;
SERIAL_ECHO_START;
SERIAL_ECHOPGM("advance :");
SERIAL_ECHO(block->advance/256.0);
SERIAL_ECHOPGM("advance rate :");
@ -1152,22 +1169,15 @@ void Planner::buffer_line(
*
* On CORE machines stepper ABC will be translated from the given XYZ.
*/
void Planner::set_position_mm(
#if ENABLED(AUTO_BED_LEVELING_FEATURE) || ENABLED(MESH_BED_LEVELING)
float x, float y, float z
#else
const float& x, const float& y, const float& z
#endif
, const float& e
) {
void Planner::set_position_mm(ARG_X, ARG_Y, ARG_Z, const float &e) {
#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_FEATURE)
apply_leveling(x, y, z);
#if PLANNER_LEVELING
apply_leveling(lx, ly, lz);
#endif
long nx = position[X_AXIS] = lround(x * axis_steps_per_mm[X_AXIS]),
ny = position[Y_AXIS] = lround(y * axis_steps_per_mm[Y_AXIS]),
nz = position[Z_AXIS] = lround(z * axis_steps_per_mm[Z_AXIS]),
long nx = position[X_AXIS] = lround(lx * axis_steps_per_mm[X_AXIS]),
ny = position[Y_AXIS] = lround(ly * axis_steps_per_mm[Y_AXIS]),
nz = position[Z_AXIS] = lround(lz * axis_steps_per_mm[Z_AXIS]),
ne = position[E_AXIS] = lround(e * axis_steps_per_mm[E_AXIS]);
stepper.set_position(nx, ny, nz, ne);
previous_nominal_speed = 0.0; // Resets planner junction speeds. Assumes start from rest.
@ -1193,7 +1203,7 @@ void Planner::reset_acceleration_rates() {
// Recalculate position, steps_to_mm if axis_steps_per_mm changes!
void Planner::refresh_positioning() {
LOOP_XYZE(i) steps_to_mm[i] = 1.0 / axis_steps_per_mm[i];
#if ENABLED(DELTA) || ENABLED(SCARA)
#if IS_KINEMATIC
inverse_kinematics(current_position);
set_position_mm(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS]);
#else

58
Marlin/planner.h

@ -202,39 +202,45 @@ class Planner {
static bool is_full() { return (block_buffer_tail == BLOCK_MOD(block_buffer_head + 1)); }
#if ENABLED(AUTO_BED_LEVELING_FEATURE) || ENABLED(MESH_BED_LEVELING)
#define ARG_X float lx
#define ARG_Y float ly
#define ARG_Z float lz
#else
#define ARG_X const float &lx
#define ARG_Y const float &ly
#define ARG_Z const float &lz
#endif
#if ENABLED(MESH_BED_LEVELING)
static void apply_leveling(const float &x, const float &y, float &z);
#else
static void apply_leveling(float &x, float &y, float &z);
#endif
#if PLANNER_LEVELING
/**
* Add a new linear movement to the buffer.
*
* x,y,z,e - target position in mm
* fr_mm_s - (target) speed of the move (mm/s)
* extruder - target extruder
* Apply leveling to transform a cartesian position
* as it will be given to the planner and steppers.
*/
static void buffer_line(float x, float y, float z, const float& e, float fr_mm_s, const uint8_t extruder);
static void apply_leveling(float &lx, float &ly, float &lz);
static void unapply_leveling(float &lx, float &ly, float &lz);
/**
* Set the planner.position and individual stepper positions.
* Used by G92, G28, G29, and other procedures.
*
* Multiplies by axis_steps_per_mm[] and does necessary conversion
* for COREXY / COREXZ / COREYZ to set the corresponding stepper positions.
*
* Clears previous speed values.
*/
static void set_position_mm(float x, float y, float z, const float& e);
#else
#endif
static void buffer_line(const float& x, const float& y, const float& z, const float& e, float fr_mm_s, const uint8_t extruder);
static void set_position_mm(const float& x, const float& y, const float& z, const float& e);
/**
* Add a new linear movement to the buffer.
*
* x,y,z,e - target position in mm
* fr_mm_s - (target) speed of the move (mm/s)
* extruder - target extruder
*/
static void buffer_line(ARG_X, ARG_Y, ARG_Z, const float& e, float fr_mm_s, const uint8_t extruder);
#endif // AUTO_BED_LEVELING_FEATURE || MESH_BED_LEVELING
/**
* Set the planner.position and individual stepper positions.
* Used by G92, G28, G29, and other procedures.
*
* Multiplies by axis_steps_per_mm[] and does necessary conversion
* for COREXY / COREXZ / COREYZ to set the corresponding stepper positions.
*
* Clears previous speed values.
*/
static void set_position_mm(ARG_X, ARG_Y, ARG_Z, const float& e);
/**
* Set the E position (mm) of the planner (and the E stepper)

2
Marlin/planner_bezier.cpp

@ -188,7 +188,7 @@ void cubic_b_spline(const float position[NUM_AXIS], const float target[NUM_AXIS]
bez_target[E_AXIS] = interp(position[E_AXIS], target[E_AXIS], t);
clamp_to_software_endstops(bez_target);
#if ENABLED(DELTA) || ENABLED(SCARA)
#if IS_KINEMATIC
inverse_kinematics(bez_target);
#if ENABLED(DELTA) && ENABLED(AUTO_BED_LEVELING_FEATURE)
adjust_delta(bez_target);

2
Marlin/qr_solve.cpp

@ -22,7 +22,7 @@
#include "qr_solve.h"
#if ENABLED(AUTO_BED_LEVELING_GRID)
#if ENABLED(AUTO_BED_LEVELING_LINEAR)
#include <stdlib.h>
#include <math.h>

17
Marlin/stepper.h

@ -91,6 +91,11 @@ class Stepper {
static bool performing_homing;
#endif
//
// Positions of stepper motors, in step units
//
static volatile long count_position[NUM_AXIS];
private:
static unsigned char last_direction_bits; // The next stepping-bits to be output
@ -138,11 +143,6 @@ class Stepper {
static constexpr int motor_current_setting[3] = PWM_MOTOR_CURRENT;
#endif
//
// Positions of stepper motors, in step units
//
static volatile long count_position[NUM_AXIS];
//
// Current direction of stepper motors (+1 or -1)
//
@ -211,6 +211,13 @@ class Stepper {
//
static float get_axis_position_mm(AxisEnum axis);
//
// SCARA AB axes are in degrees, not mm
//
#if IS_SCARA
static FORCE_INLINE float get_axis_position_degrees(AxisEnum axis) { return get_axis_position_mm(axis); }
#endif
//
// The stepper subsystem goes to sleep when it runs out of things to execute. Call this
// to notify the subsystem that it is time to go to work.

4
Marlin/ultralcd.cpp

@ -1418,7 +1418,7 @@ void kill_screen(const char* lcd_msg) {
*
*/
#if ENABLED(DELTA) || ENABLED(SCARA)
#if IS_KINEMATIC
#define _MOVE_XYZ_ALLOWED (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS])
#else
#define _MOVE_XYZ_ALLOWED true
@ -1823,7 +1823,7 @@ void kill_screen(const char* lcd_msg) {
#if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
MENU_ITEM_EDIT(bool, MSG_ENDSTOP_ABORT, &stepper.abort_on_endstop_hit);
#endif
#if ENABLED(SCARA)
#if IS_SCARA
MENU_ITEM_EDIT(float74, MSG_XSCALE, &axis_scaling[X_AXIS], 0.5, 2);
MENU_ITEM_EDIT(float74, MSG_YSCALE, &axis_scaling[Y_AXIS], 0.5, 2);
#endif

Loading…
Cancel
Save