A port of the Sprinter Firmware to the mbed.

Dependencies:   mbed

Committer:
nullsub
Date:
Sun Jul 08 16:17:09 2012 +0000
Revision:
0:1e3ffdfd19ec
Working

Who changed what in which revision?

UserRevisionLine numberNew contents of line
nullsub 0:1e3ffdfd19ec 1 #ifndef PARAMETERS_H
nullsub 0:1e3ffdfd19ec 2 #define PARAMETERS_H
nullsub 0:1e3ffdfd19ec 3
nullsub 0:1e3ffdfd19ec 4 //// Thermistor settings:
nullsub 0:1e3ffdfd19ec 5 // 1 is 100k thermistor
nullsub 0:1e3ffdfd19ec 6 // 2 is 200k thermistor
nullsub 0:1e3ffdfd19ec 7 // 3 is mendel-parts thermistor
nullsub 0:1e3ffdfd19ec 8 // 4 is 10k thermistor
nullsub 0:1e3ffdfd19ec 9 // 5 is ParCan supplied 104GT-2 100K
nullsub 0:1e3ffdfd19ec 10 // 6 is EPCOS 100k
nullsub 0:1e3ffdfd19ec 11 // 7 is 100k Honeywell thermistor 135-104LAG-J01
nullsub 0:1e3ffdfd19ec 12 #define THERMISTORHEATER 1
nullsub 0:1e3ffdfd19ec 13 #define THERMISTORBED 1 // I use a custom resistor voltage devider network with a 100k vDividerresitor!
nullsub 0:1e3ffdfd19ec 14
nullsub 0:1e3ffdfd19ec 15 //// Calibration variables
nullsub 0:1e3ffdfd19ec 16 // X, Y, Z, E steps per unit - Metric Prusa Mendel with Wade extruder:
nullsub 0:1e3ffdfd19ec 17 float axis_steps_per_unit[] = {1280.00, 1280.00, 1280.00, 368.421}; //476.8
nullsub 0:1e3ffdfd19ec 18 // Metric Prusa Mendel with Makergear geared stepper extruder:
nullsub 0:1e3ffdfd19ec 19 //float axis_steps_per_unit[] = {80,80,3200/1.25,1380};
nullsub 0:1e3ffdfd19ec 20 // MakerGear Hybrid Prusa Mendel:
nullsub 0:1e3ffdfd19ec 21 // Z axis value is for .9 stepper(if you have 1.8 steppers for Z, you need to use 2272.7272)
nullsub 0:1e3ffdfd19ec 22 //float axis_steps_per_unit[] = {104.987, 104.987, 4545.4544, 1487};
nullsub 0:1e3ffdfd19ec 23
nullsub 0:1e3ffdfd19ec 24 // The pullups are needed if you directly connect a mechanical endswitch between the signal and ground pins.
nullsub 0:1e3ffdfd19ec 25 //If your axes are only moving in one direction, make sure the endstops are connected properly.
nullsub 0:1e3ffdfd19ec 26 //If your axes move in one direction ONLY when the endstops are triggered, set [XYZ]_ENDSTOP_INVERT to true here:
nullsub 0:1e3ffdfd19ec 27 const bool X_ENDSTOP_INVERT = false;
nullsub 0:1e3ffdfd19ec 28 const bool Y_ENDSTOP_INVERT = false;
nullsub 0:1e3ffdfd19ec 29 const bool Z_ENDSTOP_INVERT = false;
nullsub 0:1e3ffdfd19ec 30
nullsub 0:1e3ffdfd19ec 31
nullsub 0:1e3ffdfd19ec 32 //// ADVANCED SETTINGS - to tweak parameters
nullsub 0:1e3ffdfd19ec 33
nullsub 0:1e3ffdfd19ec 34 #include "thermistortables.h"
nullsub 0:1e3ffdfd19ec 35
nullsub 0:1e3ffdfd19ec 36 // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
nullsub 0:1e3ffdfd19ec 37 #define X_ENABLE_ON 0
nullsub 0:1e3ffdfd19ec 38 #define Y_ENABLE_ON 0
nullsub 0:1e3ffdfd19ec 39 #define Z_ENABLE_ON 0
nullsub 0:1e3ffdfd19ec 40 #define E_ENABLE_ON 0
nullsub 0:1e3ffdfd19ec 41
nullsub 0:1e3ffdfd19ec 42 // Disables axis when it's not being used.
nullsub 0:1e3ffdfd19ec 43 const bool DISABLE_X = false;
nullsub 0:1e3ffdfd19ec 44 const bool DISABLE_Y = false;
nullsub 0:1e3ffdfd19ec 45 const bool DISABLE_Z = false;
nullsub 0:1e3ffdfd19ec 46 const bool DISABLE_E = false;
nullsub 0:1e3ffdfd19ec 47
nullsub 0:1e3ffdfd19ec 48 // Inverting axis direction
nullsub 0:1e3ffdfd19ec 49 const bool INVERT_X_DIR = true;
nullsub 0:1e3ffdfd19ec 50 const bool INVERT_Y_DIR = true;
nullsub 0:1e3ffdfd19ec 51 const bool INVERT_Z_DIR = true;
nullsub 0:1e3ffdfd19ec 52 const bool INVERT_E_DIR = false;
nullsub 0:1e3ffdfd19ec 53
nullsub 0:1e3ffdfd19ec 54 //// ENDSTOP SETTINGS:
nullsub 0:1e3ffdfd19ec 55 // Sets direction of endstops when homing; 1=MAX, -1=MIN
nullsub 0:1e3ffdfd19ec 56 #define X_HOME_DIR -1
nullsub 0:1e3ffdfd19ec 57 #define Y_HOME_DIR -1
nullsub 0:1e3ffdfd19ec 58 #define Z_HOME_DIR -1
nullsub 0:1e3ffdfd19ec 59
nullsub 0:1e3ffdfd19ec 60 const bool min_software_endstops = true; //If true, axis won't move to coordinates less than zero.
nullsub 0:1e3ffdfd19ec 61 const bool max_software_endstops = true; //If true, axis won't move to coordinates greater than the defined lengths below.
nullsub 0:1e3ffdfd19ec 62 const int X_MAX_LENGTH = 180;
nullsub 0:1e3ffdfd19ec 63 const int Y_MAX_LENGTH = 150;
nullsub 0:1e3ffdfd19ec 64 const int Z_MAX_LENGTH = 110; //not full height because of too much tension in the bearings..//190;
nullsub 0:1e3ffdfd19ec 65
nullsub 0:1e3ffdfd19ec 66 //// MOVEMENT SETTINGS
nullsub 0:1e3ffdfd19ec 67 const int NUM_AXIS = 4; // The axis order in all axis related arrays is X, Y, Z, E
nullsub 0:1e3ffdfd19ec 68 float max_feedrate[] ={200, 200, 50, 200}; //{200000, 200000, 240, 500000}; //X=200, Y=230, Z=230
nullsub 0:1e3ffdfd19ec 69 float homing_feedrate[] = {150,150,50};
nullsub 0:1e3ffdfd19ec 70 bool axis_relative_modes[] = {false, false, false, false};
nullsub 0:1e3ffdfd19ec 71
nullsub 0:1e3ffdfd19ec 72 // Min step delay in microseconds. If you are experiencing missing steps, try to raise the delay microseconds, but be aware this
nullsub 0:1e3ffdfd19ec 73 // If you enable this, make sure STEP_DELAY_RATIO is disabled.
nullsub 0:1e3ffdfd19ec 74 //#define STEP_DELAY_MICROS 1
nullsub 0:1e3ffdfd19ec 75
nullsub 0:1e3ffdfd19ec 76 // Step delay over interval ratio. If you are still experiencing missing steps, try to uncomment the following line, but be aware this
nullsub 0:1e3ffdfd19ec 77 // If you enable this, make sure STEP_DELAY_MICROS is disabled. (except for Gen6: both need to be enabled.)
nullsub 0:1e3ffdfd19ec 78 //#define STEP_DELAY_RATIO 0.25
nullsub 0:1e3ffdfd19ec 79
nullsub 0:1e3ffdfd19ec 80 // Comment this to disable ramp acceleration
nullsub 0:1e3ffdfd19ec 81 #define RAMP_ACCELERATION
nullsub 0:1e3ffdfd19ec 82
nullsub 0:1e3ffdfd19ec 83 //// Acceleration settings
nullsub 0:1e3ffdfd19ec 84 #ifdef RAMP_ACCELERATION
nullsub 0:1e3ffdfd19ec 85 // 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.
nullsub 0:1e3ffdfd19ec 86 float max_start_speed_units_per_second[] = {25.0,25.0,0.2,10.0};
nullsub 0:1e3ffdfd19ec 87 long max_acceleration_units_per_sq_second[] = {1000,1000,50,10000}; // X, Y, Z and E max acceleration in mm/s^2 for printing moves or retracts
nullsub 0:1e3ffdfd19ec 88 long max_travel_acceleration_units_per_sq_second[] = {500,500,50,500}; // X, Y, Z max acceleration in mm/s^2 for travel moves
nullsub 0:1e3ffdfd19ec 89 #endif
nullsub 0:1e3ffdfd19ec 90
nullsub 0:1e3ffdfd19ec 91 // Machine UUID
nullsub 0:1e3ffdfd19ec 92 // This may be useful if you have multiple machines and wish to identify them by using the M115 command.
nullsub 0:1e3ffdfd19ec 93 // By default we set it to zeros.
nullsub 0:1e3ffdfd19ec 94 char uuid[] = "00000000-0000-0000-0000-000000000001";
nullsub 0:1e3ffdfd19ec 95
nullsub 0:1e3ffdfd19ec 96 //// PID settings:
nullsub 0:1e3ffdfd19ec 97 // Uncomment the following line to enable PID support. This is untested and could be disastrous. Be careful.
nullsub 0:1e3ffdfd19ec 98 //#define PIDTEMP 1
nullsub 0:1e3ffdfd19ec 99 #ifdef PIDTEMP
nullsub 0:1e3ffdfd19ec 100 #define PID_INTEGRAL_DRIVE_MAX 80 // too big, and heater will lag after changing temperature, too small and it might not compensate enough for long-term errors
nullsub 0:1e3ffdfd19ec 101 #define PID_PGAIN 2560 //256 is 1.0 // value of X means that error of 1 degree is changing PWM duty by X, probably no need to go over 25
nullsub 0:1e3ffdfd19ec 102 #define PID_IGAIN 64 //256 is 1.0 // value of X (e.g 0.25) means that each degree error over 1 sec (2 measurements) changes duty cycle by 2X (=0.5) units (verify?)
nullsub 0:1e3ffdfd19ec 103 #define PID_DGAIN 4096 //256 is 1.0 // value of X means that around reached setpoint, each degree change over one measurement (half second) adjusts PWM by X units to compensate
nullsub 0:1e3ffdfd19ec 104 // magic formula 1, to get approximate "zero error" PWM duty. Take few measurements with low PWM duty and make linear fit to get the formula
nullsub 0:1e3ffdfd19ec 105 #define HEATER_DUTY_FOR_SETPOINT(setpoint) ((int)((187L*(long)setpoint)>>8)-27) // for my makergear hot-end: linear fit {50,10},{60,20},{80,30},{105,50},{176,100},{128,64},{208,128}
nullsub 0:1e3ffdfd19ec 106 // magic formula 2, to make led brightness approximately linear
nullsub 0:1e3ffdfd19ec 107 #define LED_PWM_FOR_BRIGHTNESS(brightness) ((64*brightness-1384)/(300-brightness))
nullsub 0:1e3ffdfd19ec 108 #endif
nullsub 0:1e3ffdfd19ec 109
nullsub 0:1e3ffdfd19ec 110 // Change this value (range 1-255) to limit the current to the nozzle
nullsub 0:1e3ffdfd19ec 111 #define HEATER_CURRENT 255
nullsub 0:1e3ffdfd19ec 112
nullsub 0:1e3ffdfd19ec 113 // How often should the heater check for new temp readings, in milliseconds
nullsub 0:1e3ffdfd19ec 114 #define HEATER_CHECK_INTERVAL 150 // down to 10 should be possible??? // 500
nullsub 0:1e3ffdfd19ec 115 #define BED_CHECK_INTERVAL 5000
nullsub 0:1e3ffdfd19ec 116 // Comment the following line to enable heat management during acceleration
nullsub 0:1e3ffdfd19ec 117 #define DISABLE_CHECK_DURING_ACC
nullsub 0:1e3ffdfd19ec 118 #ifndef DISABLE_CHECK_DURING_ACC
nullsub 0:1e3ffdfd19ec 119 // Uncomment the following line to disable heat management during moves
nullsub 0:1e3ffdfd19ec 120 //#define DISABLE_CHECK_DURING_MOVE
nullsub 0:1e3ffdfd19ec 121 #endif
nullsub 0:1e3ffdfd19ec 122 // Uncomment the following line to disable heat management during travel moves (and extruder-only moves, eg: retracts), strongly recommended if you are missing steps mid print.
nullsub 0:1e3ffdfd19ec 123 // Probably this should remain commented if are using PID.
nullsub 0:1e3ffdfd19ec 124 // It also defines the max milliseconds interval after which a travel move is not considered so for the sake of this feature.
nullsub 0:1e3ffdfd19ec 125 #define DISABLE_CHECK_DURING_TRAVEL 1000
nullsub 0:1e3ffdfd19ec 126
nullsub 0:1e3ffdfd19ec 127 //// Temperature smoothing - only uncomment this if your temp readings are noisy (Gen6 without EvdZ's 5V hack)
nullsub 0:1e3ffdfd19ec 128 #define SMOOTHING //--> NEW
nullsub 0:1e3ffdfd19ec 129 #define SMOOTHFACTOR 8 //16 //best to use a power of two here - determines how many values are averaged together by the smoothing algorithm
nullsub 0:1e3ffdfd19ec 130
nullsub 0:1e3ffdfd19ec 131 //// Experimental watchdog and minimal temp
nullsub 0:1e3ffdfd19ec 132 // The watchdog waits for the watchperiod in milliseconds whenever an M104 or M109 increases the target temperature
nullsub 0:1e3ffdfd19ec 133 // If the temperature has not increased at the end of that period, the target temperature is set to zero. It can be reset with another M104/M109
nullsub 0:1e3ffdfd19ec 134 //#define WATCHPERIOD 5000 //5 seconds
nullsub 0:1e3ffdfd19ec 135
nullsub 0:1e3ffdfd19ec 136 // Actual temperature must be close to target for this long before M109 returns success
nullsub 0:1e3ffdfd19ec 137 //#define TEMP_RESIDENCY_TIME 20 // (seconds)
nullsub 0:1e3ffdfd19ec 138 //#define TEMP_HYSTERESIS 5 // (C�) range of +/- temperatures considered "close" to the target one
nullsub 0:1e3ffdfd19ec 139
nullsub 0:1e3ffdfd19ec 140 //// The minimal temperature defines the temperature below which the heater will not be enabled
nullsub 0:1e3ffdfd19ec 141 #define MINTEMP 10 //5
nullsub 0:1e3ffdfd19ec 142
nullsub 0:1e3ffdfd19ec 143 //// Experimental max temp
nullsub 0:1e3ffdfd19ec 144 // When temperature exceeds max temp, your heater will be switched off.
nullsub 0:1e3ffdfd19ec 145 // This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure!
nullsub 0:1e3ffdfd19ec 146 // You should use MINTEMP for thermistor short/failure protection.
nullsub 0:1e3ffdfd19ec 147 #define MAXTEMP 280 //257
nullsub 0:1e3ffdfd19ec 148
nullsub 0:1e3ffdfd19ec 149 // Select one of these only to define how the nozzle temp is read.
nullsub 0:1e3ffdfd19ec 150 #define HEATER_USES_THERMISTOR
nullsub 0:1e3ffdfd19ec 151 // Select one of these only to define how the bed temp is read.
nullsub 0:1e3ffdfd19ec 152 #define BED_USES_THERMISTOR
nullsub 0:1e3ffdfd19ec 153
nullsub 0:1e3ffdfd19ec 154 //This is for controlling a fan to cool down the stepper drivers
nullsub 0:1e3ffdfd19ec 155 //it will turn on when any driver is enabled
nullsub 0:1e3ffdfd19ec 156 //and turn off after the set amount of seconds from last driver being disabled again
nullsub 0:1e3ffdfd19ec 157 //#define CONTROLLERFAN_PIN 23 //Pin used for the fan to cool controller, comment out to disable this function
nullsub 0:1e3ffdfd19ec 158 #define CONTROLLERFAN_SEC 60 //How many seconds, after all motors were disabled, the fan should run
nullsub 0:1e3ffdfd19ec 159
nullsub 0:1e3ffdfd19ec 160 // Uncomment the following line to enable debugging. You can better control debugging below the following line
nullsub 0:1e3ffdfd19ec 161 //#define DEBUG
nullsub 0:1e3ffdfd19ec 162 #ifdef DEBUG
nullsub 0:1e3ffdfd19ec 163 #define DEBUG_PREPARE_MOVE //Enable this to debug prepare_move() function
nullsub 0:1e3ffdfd19ec 164 #define DEBUG_BRESENHAM //Enable this to debug the Bresenham algorithm
nullsub 0:1e3ffdfd19ec 165 #define DEBUG_RAMP_ACCELERATION //Enable this to debug all constant acceleration info
nullsub 0:1e3ffdfd19ec 166 #define DEBUG_MOVE_TIME //Enable this to time each move and print the result
nullsub 0:1e3ffdfd19ec 167 #define DEBUG_HEAT_MGMT //Enable this to debug heat management. WARNING, this will cause axes to jitter!
nullsub 0:1e3ffdfd19ec 168 #define DEBUG_DISABLE_CHECK_DURING_TRAVEL //Debug the namesake feature, see above in this file
nullsub 0:1e3ffdfd19ec 169 #endif
nullsub 0:1e3ffdfd19ec 170
nullsub 0:1e3ffdfd19ec 171 #define BAUDRATE 115200
nullsub 0:1e3ffdfd19ec 172
nullsub 0:1e3ffdfd19ec 173 #endif