Merge pull request #4789 from thinkyhead/rc_better_leveling_etc

Various cleanups ahead of more…
master
Scott Lahteine 8 years ago committed by GitHub
commit 94d5cf8721

@ -61,12 +61,16 @@
#define NORMAL_AXIS X_AXIS #define NORMAL_AXIS X_AXIS
#endif #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 #undef SLOWDOWN
#define QUICK_HOME //SCARA needs Quickhome #define QUICK_HOME
#endif #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)) #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) #define HAS_Z_SERVO_ENDSTOP (defined(Z_ENDSTOP_SERVO_NR) && Z_ENDSTOP_SERVO_NR >= 0)
/** /**
@ -657,17 +655,27 @@
#ifndef DELTA_DIAGONAL_ROD_TRIM_TOWER_3 #ifndef DELTA_DIAGONAL_ROD_TRIM_TOWER_3
#define DELTA_DIAGONAL_ROD_TRIM_TOWER_3 0.0 #define DELTA_DIAGONAL_ROD_TRIM_TOWER_3 0.0
#endif #endif
#if ENABLED(AUTO_BED_LEVELING_GRID)
#define DELTA_BED_LEVELING_GRID
#endif
#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) #if ENABLED(AUTO_BED_LEVELING_FEATURE)
#if DISABLED(AUTO_BED_LEVELING_GRID)
#define AUTO_BED_LEVELING_LINEAR
#define AUTO_BED_LEVELING_3POINT #define AUTO_BED_LEVELING_3POINT
#elif IS_KINEMATIC
#define AUTO_BED_LEVELING_NONLINEAR
#else
#define AUTO_BED_LEVELING_LINEAR
#endif #endif
#endif
#define PLANNER_LEVELING (ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_LINEAR))
/** /**
* Buzzer/Speaker * Buzzer/Speaker
@ -702,4 +710,18 @@
#define Z_PROBE_TRAVEL_HEIGHT Z_HOMING_HEIGHT #define Z_PROBE_TRAVEL_HEIGHT Z_HOMING_HEIGHT
#endif #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 #endif // CONDITIONALS_POST_H

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

@ -220,7 +220,6 @@ void disable_all_steppers();
void FlushSerialRequestResend(); void FlushSerialRequestResend();
void ok_to_send(); void ok_to_send();
void reset_bed_level();
void kill(const char*); void kill(const char*);
void quickstop_stepper(); 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 bool axis_homed[XYZ]; // axis[n].is_homed
extern volatile bool wait_for_heatup; 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 current_position[NUM_AXIS];
extern float position_shift[XYZ]; extern float position_shift[XYZ];
extern float home_offset[XYZ]; extern float home_offset[XYZ];
@ -298,26 +301,29 @@ int code_value_int();
float code_value_temp_abs(); float code_value_temp_abs();
float code_value_temp_diff(); float code_value_temp_diff();
#if ENABLED(DELTA) #if IS_KINEMATIC
extern float delta[ABC]; 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]); 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); void recalc_delta_settings(float radius, float diagonal_rod);
#if ENABLED(AUTO_BED_LEVELING_FEATURE) #elif IS_SCARA
extern int delta_grid_spacing[2];
void adjust_delta(float cartesian[XYZ]);
#endif
#elif ENABLED(SCARA)
extern float delta[ABC];
extern float axis_scaling[ABC]; // Build size scaling extern float axis_scaling[ABC]; // Build size scaling
void inverse_kinematics(const float cartesian[XYZ]); void forward_kinematics_SCARA(const float &a, const float &b);
void forward_kinematics_SCARA(float f_scara[ABC]); #endif
#if ENABLED(AUTO_BED_LEVELING_NONLINEAR)
extern int nonlinear_grid_spacing[2];
void adjust_delta(float cartesian[XYZ]);
#endif #endif
#if ENABLED(Z_DUAL_ENDSTOPS) #if ENABLED(Z_DUAL_ENDSTOPS)

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

File diff suppressed because it is too large Load Diff

@ -137,6 +137,8 @@
#error Please replace "const int dropsegments" with "#define MIN_STEPS_PER_SEGMENT" (and increase by 1) in Configuration_adv.h. #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) #elif defined(PREVENT_DANGEROUS_EXTRUDE)
#error "PREVENT_DANGEROUS_EXTRUDE is now PREVENT_COLD_EXTRUSION. Please update your configuration." #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 #endif
/** /**
@ -179,11 +181,9 @@
#if ENABLED(LCD_PROGRESS_BAR) #if ENABLED(LCD_PROGRESS_BAR)
#if DISABLED(SDSUPPORT) #if DISABLED(SDSUPPORT)
#error "LCD_PROGRESS_BAR requires SDSUPPORT." #error "LCD_PROGRESS_BAR requires SDSUPPORT."
#endif #elif ENABLED(DOGLCD)
#if ENABLED(DOGLCD)
#error "LCD_PROGRESS_BAR does not apply to graphical displays." #error "LCD_PROGRESS_BAR does not apply to graphical displays."
#endif #elif ENABLED(FILAMENT_LCD_DISPLAY)
#if ENABLED(FILAMENT_LCD_DISPLAY)
#error "LCD_PROGRESS_BAR and FILAMENT_LCD_DISPLAY are not fully compatible. Comment out this line to use both." #error "LCD_PROGRESS_BAR and FILAMENT_LCD_DISPLAY are not fully compatible. Comment out this line to use both."
#endif #endif
#endif #endif
@ -573,11 +573,39 @@
/** /**
* Don't set more than one kinematic type * Don't set more than one kinematic type
*/ */
#if (ENABLED(DELTA) && (ENABLED(SCARA) || ENABLED(COREXY) || ENABLED(COREXZ) || ENABLED(COREYZ))) \ #define COUNT_KIN_1 0
|| (ENABLED(SCARA) && (ENABLED(COREXY) || ENABLED(COREXZ) || ENABLED(COREYZ))) \ #if ENABLED(DELTA)
|| (ENABLED(COREXY) && (ENABLED(COREXZ) || ENABLED(COREYZ))) \ #define COUNT_KIN_2 INCREMENT(COUNT_KIN_1)
|| (ENABLED(COREXZ) && ENABLED(COREYZ)) #else
#error "Please enable only one of DELTA, SCARA, COREXY, COREXZ, or COREYZ." #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 #endif
/** /**
@ -750,7 +778,7 @@
#elif ENABLED(DELTA) #elif ENABLED(DELTA)
#error "Z_DUAL_ENDSTOPS is not compatible with DELTA." #error "Z_DUAL_ENDSTOPS is not compatible with DELTA."
#endif #endif
#elif DISABLED(SCARA) #elif !IS_SCARA
#if X_HOME_DIR < 0 && DISABLED(USE_XMIN_PLUG) #if X_HOME_DIR < 0 && DISABLED(USE_XMIN_PLUG)
#error "Enable USE_XMIN_PLUG when homing X to MIN." #error "Enable USE_XMIN_PLUG when homing X to MIN."
#elif X_HOME_DIR > 0 && DISABLED(USE_XMAX_PLUG) #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.)" #error "I2C_SLAVE_ADDRESS can't be over 127. (Only 7 bits allowed.)"
#endif #endif
#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

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

@ -42,7 +42,8 @@ enum AxisEnum {
E_AXIS = 3, E_AXIS = 3,
X_HEAD = 4, X_HEAD = 4,
Y_HEAD = 5, 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++) #define LOOP_XYZ(VAR) for (uint8_t VAR=X_AXIS; VAR<=Z_AXIS; VAR++)

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

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

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

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

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

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

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

@ -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 // 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 // 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! // You might need Z-Min endstop on SCARA-Printer to use this feature. Actually untested!
// Uncomment to use Morgan scara mode
#define SCARA // Specify the specific SCARA model
#define SCARA_SEGMENTS_PER_SECOND 200 // If movement is choppy try lowering this value #define MORGAN_SCARA
// Length of inner support arm //#define MAKERARM_SCARA
#define Linkage_1 150 //mm Preprocessor cannot handle decimal point...
// Length of outer support arm Measure arm lengths precisely and enter #if ENABLED(MORGAN_SCARA) || ENABLED(MAKERARM_SCARA)
#define Linkage_2 150 //mm //#define DEBUG_SCARA_KINEMATICS
// SCARA tower offset (position of Tower relative to bed zero position) #define SCARA_SEGMENTS_PER_SECOND 200 // If movement is choppy try lowering this value
// This needs to be reasonably accurate as it defines the printbed position in the SCARA space. // Length of inner support arm
#define SCARA_offset_x 100 //mm #define SCARA_LINKAGE_1 150 //mm Preprocessor cannot handle decimal point...
#define SCARA_offset_y -56 //mm // Length of outer support arm Measure arm lengths precisely and enter
#define SCARA_RAD2DEG 57.2957795 // to convert RAD to degrees #define SCARA_LINKAGE_2 150 //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 // SCARA tower offset (position of Tower relative to bed zero position)
#define PSI_HOMING_OFFSET 0 //calculatated from Calibration Guide and command M364 / M114 see picture in http://reprap.harleystudio.co.za/?page_id=1073 // This needs to be reasonably accurate as it defines the printbed position in the SCARA space.
#define SCARA_OFFSET_X 100 //mm
//some helper variables to make kinematics faster #define SCARA_OFFSET_Y -56 //mm
#define L1_2 sq(Linkage_1) // do not change
#define L2_2 sq(Linkage_2) // do not change #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 // @section info

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

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

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

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

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

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

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

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

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

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

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

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

@ -55,7 +55,8 @@
#endif #endif
#define RADIANS(d) ((d)*M_PI/180.0) #define RADIANS(d) ((d)*M_PI/180.0)
#define DEGREES(r) ((r)*180.0/M_PI) #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 // Macros to contrain values
#define NOLESS(v,n) do{ if (v < n) v = n; }while(0) #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 MAX3(a, b, c) max(max(a, b), c)
#define MAX4(a, b, c, d) max(max(max(a, b), c), d) #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 #endif //__MACROS_H

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

@ -202,11 +202,24 @@ class Planner {
static bool is_full() { return (block_buffer_tail == BLOCK_MOD(block_buffer_head + 1)); } static bool is_full() { return (block_buffer_tail == BLOCK_MOD(block_buffer_head + 1)); }
#if ENABLED(AUTO_BED_LEVELING_FEATURE) || ENABLED(MESH_BED_LEVELING) #if ENABLED(AUTO_BED_LEVELING_FEATURE) || ENABLED(MESH_BED_LEVELING)
#define ARG_X float lx
#if ENABLED(MESH_BED_LEVELING) #define ARG_Y float ly
static void apply_leveling(const float &x, const float &y, float &z); #define ARG_Z float lz
#else #else
static void apply_leveling(float &x, float &y, float &z); #define ARG_X const float &lx
#define ARG_Y const float &ly
#define ARG_Z const float &lz
#endif
#if PLANNER_LEVELING
/**
* Apply leveling to transform a cartesian position
* as it will be given to the planner and steppers.
*/
static void apply_leveling(float &lx, float &ly, float &lz);
static void unapply_leveling(float &lx, float &ly, float &lz);
#endif #endif
/** /**
@ -216,7 +229,7 @@ class Planner {
* fr_mm_s - (target) speed of the move (mm/s) * fr_mm_s - (target) speed of the move (mm/s)
* extruder - target extruder * extruder - target extruder
*/ */
static void buffer_line(float x, float y, float z, const float& e, float fr_mm_s, const uint8_t extruder); static void buffer_line(ARG_X, ARG_Y, ARG_Z, const float& e, float fr_mm_s, const uint8_t extruder);
/** /**
* Set the planner.position and individual stepper positions. * Set the planner.position and individual stepper positions.
@ -227,14 +240,7 @@ class Planner {
* *
* Clears previous speed values. * Clears previous speed values.
*/ */
static void set_position_mm(float x, float y, float z, const float& e); static void set_position_mm(ARG_X, ARG_Y, ARG_Z, const float& e);
#else
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);
#endif // AUTO_BED_LEVELING_FEATURE || MESH_BED_LEVELING
/** /**
* Set the E position (mm) of the planner (and the E stepper) * Set the E position (mm) of the planner (and the E stepper)

@ -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); bez_target[E_AXIS] = interp(position[E_AXIS], target[E_AXIS], t);
clamp_to_software_endstops(bez_target); clamp_to_software_endstops(bez_target);
#if ENABLED(DELTA) || ENABLED(SCARA) #if IS_KINEMATIC
inverse_kinematics(bez_target); inverse_kinematics(bez_target);
#if ENABLED(DELTA) && ENABLED(AUTO_BED_LEVELING_FEATURE) #if ENABLED(DELTA) && ENABLED(AUTO_BED_LEVELING_FEATURE)
adjust_delta(bez_target); adjust_delta(bez_target);

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

@ -91,6 +91,11 @@ class Stepper {
static bool performing_homing; static bool performing_homing;
#endif #endif
//
// Positions of stepper motors, in step units
//
static volatile long count_position[NUM_AXIS];
private: private:
static unsigned char last_direction_bits; // The next stepping-bits to be output 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; static constexpr int motor_current_setting[3] = PWM_MOTOR_CURRENT;
#endif #endif
//
// Positions of stepper motors, in step units
//
static volatile long count_position[NUM_AXIS];
// //
// Current direction of stepper motors (+1 or -1) // Current direction of stepper motors (+1 or -1)
// //
@ -211,6 +211,13 @@ class Stepper {
// //
static float get_axis_position_mm(AxisEnum axis); 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 // 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. // to notify the subsystem that it is time to go to work.

@ -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]) #define _MOVE_XYZ_ALLOWED (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS])
#else #else
#define _MOVE_XYZ_ALLOWED true #define _MOVE_XYZ_ALLOWED true
@ -1823,7 +1823,7 @@ void kill_screen(const char* lcd_msg) {
#if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED) #if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
MENU_ITEM_EDIT(bool, MSG_ENDSTOP_ABORT, &stepper.abort_on_endstop_hit); MENU_ITEM_EDIT(bool, MSG_ENDSTOP_ABORT, &stepper.abort_on_endstop_hit);
#endif #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_XSCALE, &axis_scaling[X_AXIS], 0.5, 2);
MENU_ITEM_EDIT(float74, MSG_YSCALE, &axis_scaling[Y_AXIS], 0.5, 2); MENU_ITEM_EDIT(float74, MSG_YSCALE, &axis_scaling[Y_AXIS], 0.5, 2);
#endif #endif

Loading…
Cancel
Save