From c430906d3b4e49044494fa6c1ea76ec2354b1100 Mon Sep 17 00:00:00 2001 From: Johann Rocholl Date: Mon, 10 Dec 2012 00:10:56 -0800 Subject: [PATCH 1/8] Deltabot settings and configuration adjustments. --- Marlin/Configuration.h | 91 ++++++++++++++++++++++++++------------ Marlin/Configuration_adv.h | 6 +-- 2 files changed, 66 insertions(+), 31 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 9db8dee5f..3035fb763 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -9,7 +9,7 @@ //Implementation of an idea by Prof Braino to inform user that any changes made //to this build by the user have been successfully uploaded into firmware. #define STRING_VERSION_CONFIG_H __DATE__ " " __TIME__ // build date and time -#define STRING_CONFIG_H_AUTHOR "(none, default config)" //Who made the changes. +#define STRING_CONFIG_H_AUTHOR "(jcrocholl, deltabot)" //Who made the changes. // SERIAL_PORT selects which serial port should be used for communication with the host. // This allows the connection of wireless adapters (for instance) to non-default port pins. @@ -46,10 +46,42 @@ // Rambo = 301 #ifndef MOTHERBOARD -#define MOTHERBOARD 7 +#define MOTHERBOARD 33 #endif +//=========================================================================== +//============================== Delta Settings ============================= +//=========================================================================== + +// Make delta curves from many straight lines (linear interpolation). +// This is a trade-off between visible corners (not enough segments) +// and processor overload (too many expensive sqrt calls). +#define DELTA_SEGMENTS_PER_SECOND 200 + +// Center-to-center distance of the holes in the diagonal push rods. +#define DELTA_DIAGONAL_ROD 250.0 // mm + +// Horizontal offset from middle of printer to smooth rod center. +#define DELTA_SMOOTH_ROD_OFFSET 175.0 // mm +// Horizontal offset of the universal joints on the end effector. +#define DELTA_EFFECTOR_OFFSET 33.0 // mm + +// Horizontal offset of the universal joints on the carriages. +#define DELTA_CARRIAGE_OFFSET 18.0 // mm + +// Effective horizontal distance bridged by diagonal push rods. +#define DELTA_RADIUS (DELTA_SMOOTH_ROD_OFFSET-DELTA_EFFECTOR_OFFSET-DELTA_CARRIAGE_OFFSET) + +// Effective X/Y positions of the three vertical towers. +#define SIN_60 0.8660254037844386 +#define COS_60 0.5 +#define DELTA_TOWER1_X -SIN_60*DELTA_RADIUS // front left tower +#define DELTA_TOWER1_Y -COS_60*DELTA_RADIUS +#define DELTA_TOWER2_X SIN_60*DELTA_RADIUS // front right tower +#define DELTA_TOWER2_Y -COS_60*DELTA_RADIUS +#define DELTA_TOWER3_X 0.0 // back middle tower +#define DELTA_TOWER3_Y DELTA_RADIUS //=========================================================================== //=============================Thermal Settings ============================ @@ -75,7 +107,7 @@ // 52 is 200k thermistor - ATC Semitec 204GT-2 (1k pullup) // 55 is 100k thermistor - ATC Semitec 104GT-2 (Used in ParCan) (1k pullup) -#define TEMP_SENSOR_0 -1 +#define TEMP_SENSOR_0 1 #define TEMP_SENSOR_1 0 #define TEMP_SENSOR_2 0 #define TEMP_SENSOR_BED 0 @@ -211,9 +243,9 @@ #endif // The pullups are needed if you directly connect a mechanical endswitch between the signal and ground pins. -const bool X_ENDSTOPS_INVERTING = true; // set to true to invert the logic of the endstops. -const bool Y_ENDSTOPS_INVERTING = true; // set to true to invert the logic of the endstops. -const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of the endstops. +const bool X_ENDSTOPS_INVERTING = false; // set to true to invert the logic of the endstops. +const bool Y_ENDSTOPS_INVERTING = false; // set to true to invert the logic of the endstops. +const bool Z_ENDSTOPS_INVERTING = false; // set to true to invert the logic of the endstops. //#define DISABLE_MAX_ENDSTOPS // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 @@ -228,27 +260,29 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th #define DISABLE_Z false #define DISABLE_E false // For all extruders -#define INVERT_X_DIR true // for Mendel set to false, for Orca set to true +#define INVERT_X_DIR false // for Mendel set to false, for Orca set to true #define INVERT_Y_DIR false // for Mendel set to true, for Orca set to false -#define INVERT_Z_DIR true // for Mendel set to false, for Orca set to true +#define INVERT_Z_DIR false // for Mendel set to false, for Orca set to true #define INVERT_E0_DIR false // for direct drive extruder v9 set to true, for geared extruder set to false -#define INVERT_E1_DIR false // for direct drive extruder v9 set to true, for geared extruder set to false +#define INVERT_E1_DIR false // for direct drive extruder v9 set to true, for geared extruder set to false #define INVERT_E2_DIR false // for direct drive extruder v9 set to true, for geared extruder set to false // ENDSTOP SETTINGS: // Sets direction of endstops when homing; 1=MAX, -1=MIN -#define X_HOME_DIR -1 -#define Y_HOME_DIR -1 -#define Z_HOME_DIR -1 +#define X_HOME_DIR 1 +#define Y_HOME_DIR 1 +#define Z_HOME_DIR 1 + +#define min_software_endstops false //If true, axis won't move to coordinates less than HOME_POS. +#define max_software_endstops false //If true, axis won't move to coordinates greater than the defined lengths below. -#define min_software_endstops true //If true, axis won't move to coordinates less than HOME_POS. -#define max_software_endstops true //If true, axis won't move to coordinates greater than the defined lengths below. // Travel limits after homing -#define X_MAX_POS 205 +// For deltabots, the MAX_POS doesn't have to be exact, it will be recalculated from MANUAL_Z_HOME_POS below. +#define X_MAX_POS 620 #define X_MIN_POS 0 -#define Y_MAX_POS 205 +#define Y_MAX_POS 620 #define Y_MIN_POS 0 -#define Z_MAX_POS 200 +#define Z_MAX_POS 620 #define Z_MIN_POS 0 #define X_MAX_LENGTH (X_MAX_POS - X_MIN_POS) @@ -256,31 +290,32 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th #define Z_MAX_LENGTH (Z_MAX_POS - Z_MIN_POS) // The position of the homing switches -//#define MANUAL_HOME_POSITIONS // If defined, manualy programed locations will be used +#define MANUAL_HOME_POSITIONS // If defined, manualy programed locations will be used //#define BED_CENTER_AT_0_0 // If defined the center of the bed is defined as (0,0) -//Manual homing switch locations: +// Manual homing switch locations: +// For deltabots this means top and center of the cartesian print volume. #define MANUAL_X_HOME_POS 0 #define MANUAL_Y_HOME_POS 0 -#define MANUAL_Z_HOME_POS 0 +#define MANUAL_Z_HOME_POS 402 // Distance between nozzle and print surface after homing. //// MOVEMENT SETTINGS #define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E -#define HOMING_FEEDRATE {50*60, 50*60, 4*60, 0} // set the homing speeds (mm/min) +#define HOMING_FEEDRATE {100*60, 100*60, 100*60, 0} // set the homing speeds (mm/min) // default settings -#define DEFAULT_AXIS_STEPS_PER_UNIT {78.7402,78.7402,200*8/3,760*1.1} // default steps per unit for ultimaker -#define DEFAULT_MAX_FEEDRATE {500, 500, 5, 45} // (mm/sec) -#define DEFAULT_MAX_ACCELERATION {9000,9000,100,10000} // X, Y, Z, E maximum start speed for accelerated moves. E default values are good for skeinforge 40+, for older versions raise them a lot. +#define DEFAULT_AXIS_STEPS_PER_UNIT {40, 40, 40, 100} +#define DEFAULT_MAX_FEEDRATE {300, 300, 300, 300} // (mm/sec) +#define DEFAULT_MAX_ACCELERATION {9000, 9000, 9000, 9000} // X, Y, Z, E maximum start speed for accelerated moves. -#define DEFAULT_ACCELERATION 3000 // X, Y, Z and E max acceleration in mm/s^2 for printing moves +#define DEFAULT_ACCELERATION 3000 // X, Y, Z and E max acceleration in mm/s^2 for printing moves #define DEFAULT_RETRACT_ACCELERATION 3000 // X, Y, Z and E max acceleration in mm/s^2 for r retracts // -#define DEFAULT_XYJERK 20.0 // (mm/sec) -#define DEFAULT_ZJERK 0.4 // (mm/sec) -#define DEFAULT_EJERK 5.0 // (mm/sec) +#define DEFAULT_XYJERK 20.0 // (mm/sec) +#define DEFAULT_ZJERK 20.0 // (mm/sec) +#define DEFAULT_EJERK 20.0 // (mm/sec) //=========================================================================== //=============================Additional Features=========================== diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index be66d1805..842fd40b3 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -140,7 +140,7 @@ //homing hits the endstop, then retracts by this distance, before it tries to slowly bump again: #define X_HOME_RETRACT_MM 5 #define Y_HOME_RETRACT_MM 5 -#define Z_HOME_RETRACT_MM 1 +#define Z_HOME_RETRACT_MM 5 //#define QUICK_HOME //if this is defined, if both x and y are to be homed, a diagonal move will be performed initially. #define AXIS_RELATIVE_MODES {false, false, false, false} @@ -163,7 +163,7 @@ #define DEFAULT_MINSEGMENTTIME 20000 // If defined the movements slow down when the look ahead buffer is only half full -#define SLOWDOWN +//#define SLOWDOWN // Frequency limit // See nophead's blog for more info @@ -250,7 +250,7 @@ const unsigned int dropsegments=5; //everything with less than this number of st #if defined SDSUPPORT #define BLOCK_BUFFER_SIZE 16 // SD,LCD,Buttons take more memory, block buffer needs to be smaller #else - #define BLOCK_BUFFER_SIZE 16 // maximize block buffer + #define BLOCK_BUFFER_SIZE 64 // maximize block buffer #endif From 2292441f0c039cbfb73d3de153127cdd7248e888 Mon Sep 17 00:00:00 2001 From: Johann Rocholl Date: Mon, 10 Dec 2012 00:43:14 -0800 Subject: [PATCH 2/8] Use X/Y/Z_MAX_PIN instead of X/Y/Z_MIN_PIN for top endstops on deltabot. --- Marlin/pins.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Marlin/pins.h b/Marlin/pins.h index 59f86a5ac..af89d5f45 100644 --- a/Marlin/pins.h +++ b/Marlin/pins.h @@ -335,19 +335,19 @@ #define X_STEP_PIN 54 #define X_DIR_PIN 55 #define X_ENABLE_PIN 38 -#define X_MIN_PIN 3 +#define X_MIN_PIN -1 #define X_MAX_PIN 2 //2 //Max endstops default to disabled "-1", set to commented value to enable. #define Y_STEP_PIN 60 #define Y_DIR_PIN 61 #define Y_ENABLE_PIN 56 -#define Y_MIN_PIN 14 +#define Y_MIN_PIN -1 #define Y_MAX_PIN 15 //15 #define Z_STEP_PIN 46 #define Z_DIR_PIN 48 #define Z_ENABLE_PIN 62 -#define Z_MIN_PIN 18 +#define Z_MIN_PIN -1 #define Z_MAX_PIN 19 #define Z2_STEP_PIN 36 @@ -1041,22 +1041,22 @@ #define X_STEP_PIN 27 #define X_DIR_PIN 29 #define X_ENABLE_PIN 28 -#define X_MIN_PIN 7 -#define X_MAX_PIN -1 +#define X_MIN_PIN -1 +#define X_MAX_PIN 7 #define X_ATT_PIN 26 #define Y_STEP_PIN 31 #define Y_DIR_PIN 33 #define Y_ENABLE_PIN 32 -#define Y_MIN_PIN 6 -#define Y_MAX_PIN -1 +#define Y_MIN_PIN -1 +#define Y_MAX_PIN 6 #define Y_ATT_PIN 30 #define Z_STEP_PIN 17 #define Z_DIR_PIN 19 #define Z_ENABLE_PIN 18 -#define Z_MIN_PIN 5 -#define Z_MAX_PIN -1 +#define Z_MIN_PIN -1 +#define Z_MAX_PIN 5 #define Z_ATT_PIN 16 #define E0_STEP_PIN 21 From cec7283b215037f5ce286b0982ff66ac593ac6d7 Mon Sep 17 00:00:00 2001 From: Johann Rocholl Date: Mon, 10 Dec 2012 00:43:47 -0800 Subject: [PATCH 3/8] Enable QUICK_HOME for deltabot. --- Marlin/Configuration_adv.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 842fd40b3..da0d84b04 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -141,7 +141,7 @@ #define X_HOME_RETRACT_MM 5 #define Y_HOME_RETRACT_MM 5 #define Z_HOME_RETRACT_MM 5 -//#define QUICK_HOME //if this is defined, if both x and y are to be homed, a diagonal move will be performed initially. +#define QUICK_HOME //if this is defined, if both x and y are to be homed, a diagonal move will be performed initially. #define AXIS_RELATIVE_MODES {false, false, false, false} From 8e2519e88b29fc6dccf6600a7455e4e49a313aca Mon Sep 17 00:00:00 2001 From: Johann Rocholl Date: Mon, 10 Dec 2012 01:04:12 -0800 Subject: [PATCH 4/8] Add realtime delta geometry in Marlin_main.cpp. --- Marlin/Marlin.h | 1 + Marlin/Marlin_main.cpp | 95 +++++++++++++++++++++++++++++------------- 2 files changed, 66 insertions(+), 30 deletions(-) diff --git a/Marlin/Marlin.h b/Marlin/Marlin.h index a6aa43e00..9b5af9c05 100644 --- a/Marlin/Marlin.h +++ b/Marlin/Marlin.h @@ -159,6 +159,7 @@ void FlushSerialRequestResend(); void ClearToSend(); void get_coordinates(); +void calculate_delta(float cartesian[3]); void prepare_move(); void kill(); void Stop(); diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 7cc574962..a4d09b372 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -169,6 +169,7 @@ int fanSpeed=0; //=========================================================================== const char axis_codes[NUM_AXIS] = {'X', 'Y', 'Z', 'E'}; static float destination[NUM_AXIS] = { 0.0, 0.0, 0.0, 0.0}; +static float delta[3] = {0.0, 0.0, 0.0}; static float offset[3] = {0.0, 0.0, 0.0}; static bool home_all_axis = true; static float feedrate = 1500.0, next_feedrate, saved_feedrate; @@ -731,34 +732,25 @@ void process_commands() feedrate = 0.0; home_all_axis = !((code_seen(axis_codes[0])) || (code_seen(axis_codes[1])) || (code_seen(axis_codes[2]))); - #if Z_HOME_DIR > 0 // If homing away from BED do Z first - if((home_all_axis) || (code_seen(axis_codes[Z_AXIS]))) { - HOMEAXIS(Z); - } - #endif - #ifdef QUICK_HOME - if((home_all_axis)||( code_seen(axis_codes[X_AXIS]) && code_seen(axis_codes[Y_AXIS])) ) //first diagonal move + if (home_all_axis) // Move all carriages up together until the first endstop is hit. { - current_position[X_AXIS] = 0;current_position[Y_AXIS] = 0; - + current_position[X_AXIS] = 0; + current_position[Y_AXIS] = 0; + current_position[Z_AXIS] = 0; plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); - destination[X_AXIS] = 1.5 * X_MAX_LENGTH * X_HOME_DIR;destination[Y_AXIS] = 1.5 * Y_MAX_LENGTH * Y_HOME_DIR; - feedrate = homing_feedrate[X_AXIS]; - if(homing_feedrate[Y_AXIS]