chiark / gitweb /
febc3bcca6fcf8c46ef21adb3d9eb74b0f9ff172
[marlin.git] / Marlin / Configuration.h
1 #ifndef __CONFIGURATION_H
2 #define __CONFIGURATION_H
3
4
5
6 // This determines the communication speed of the printer
7 #define BAUDRATE 250000
8 //#define BAUDRATE 115200
9 //#define BAUDRATE 230400
10
11 #define EXTRUDERS 1
12
13 // Frequency limit
14 // See nophead's blog for more info
15 // Not working O
16 //#define XY_FREQUENCY_LIMIT  15
17
18 // Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end
19 // of the buffer and all stops. This should not be much greater than zero and should only be changed
20 // if unwanted behavior is observed on a user's machine when running at very slow speeds.
21 #define MINIMUM_PLANNER_SPEED 2.0 // (mm/sec)
22
23 // If defined the movements slow down when the look ahead buffer is only half full
24 #define SLOWDOWN
25
26 // BASIC SETTINGS: select your board type, thermistor type, axis scaling, and endstop configuration
27
28 //// The following define selects which electronics board you have. Please choose the one that matches your setup
29 // MEGA/RAMPS up to 1.2 = 3,
30 // RAMPS 1.3 = 33
31 // Gen6 = 5,
32 // Sanguinololu 1.2 and above = 62
33 // Ultimaker = 7,
34 // Teensylu = 8
35 #define MOTHERBOARD 7
36
37 //===========================================================================
38 //=============================Thermal Settings  ============================
39 //===========================================================================
40
41 //// Thermistor settings:
42 // 1 is 100k thermistor
43 // 2 is 200k thermistor
44 // 3 is mendel-parts thermistor
45 // 4 is 10k thermistor
46 // 5 is ParCan supplied 104GT-2 100K
47 // 6 is EPCOS 100k
48 // 7 is 100k Honeywell thermistor 135-104LAG-J01
49 //#define THERMISTORHEATER_0 3
50 //#define THERMISTORHEATER_1 3
51 //#define THERMISTORBED 3
52
53 //#define HEATER_0_USES_THERMISTOR
54 //#define HEATER_1_USES_THERMISTOR
55 #define HEATER_0_USES_AD595
56 //#define HEATER_1_USES_AD595
57
58 // Select one of these only to define how the bed temp is read.
59 //#define BED_USES_THERMISTOR
60 //#define BED_USES_AD595
61
62 #define BED_CHECK_INTERVAL 5000 //ms
63
64 //// Experimental watchdog and minimal temp
65 // The watchdog waits for the watchperiod in milliseconds whenever an M104 or M109 increases the target temperature
66 // 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
67 /// CURRENTLY NOT IMPLEMENTED AND UNUSEABLE
68 //#define WATCHPERIOD 5000 //5 seconds
69
70 // Actual temperature must be close to target for this long before M109 returns success
71 //#define TEMP_RESIDENCY_TIME 20  // (seconds)
72 //#define TEMP_HYSTERESIS 5       // (C°) range of +/- temperatures considered "close" to the target one
73
74 //// The minimal temperature defines the temperature below which the heater will not be enabled
75 #define HEATER_0_MINTEMP 5
76 //#define HEATER_1_MINTEMP 5
77 //#define BED_MINTEMP 5
78
79
80 // When temperature exceeds max temp, your heater will be switched off.
81 // This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure!
82 // You should use MINTEMP for thermistor short/failure protection.
83 #define HEATER_0_MAXTEMP 275
84 //#define HEATER_1_MAXTEMP 275
85 //#define BED_MAXTEMP 150
86
87
88 // Wait for Cooldown
89 // This defines if the M109 call should not block if it is cooling down.
90 // example: From a current temp of 220, you set M109 S200. 
91 // if CooldownNoWait is defined M109 will not wait for the cooldown to finish
92 #define CooldownNoWait true
93
94 // Heating is finished if a temperature close to this degree shift is reached
95 #define HEATING_EARLY_FINISH_DEG_OFFSET 1 //Degree
96 // PID settings:
97 // Uncomment the following line to enable PID support.
98   
99 #define PIDTEMP
100 #ifdef PIDTEMP
101   #if MOTHERBOARD == 62
102     #error Sanguinololu does not support PID, sorry. Please disable it.
103   #endif
104   //#define PID_DEBUG // Sends debug data to the serial port. 
105   //#define PID_OPENLOOP 1 // Puts PID in open loop. M104 sets the output power in %
106   
107   #define PID_MAX 255 // limits current to nozzle; 255=full current
108   #define PID_INTEGRAL_DRIVE_MAX 255  //limit for the integral term
109   #define K1 0.95 //smoothing factor withing the PID
110   #define PID_dT 0.1 //sampling period of the PID
111
112   //To develop some PID settings for your machine, you can initiall follow 
113   // the Ziegler-Nichols method.
114   // set Ki and Kd to zero. 
115   // heat with a defined Kp and see if the temperature stabilizes
116   // ideally you do this graphically with repg.
117   // the PID_CRITIAL_GAIN should be the Kp at which temperature oscillatins are not dampned out/decreas in amplitutde
118   // PID_SWING_AT_CRITIAL is the time for a full period of the oscillations at the critical Gain
119   // usually further manual tunine is necessary.
120
121   #define PID_CRITIAL_GAIN 50
122   #define PID_SWING_AT_CRITIAL 47 //seconds
123   
124   //#define PID_PI    //no differentail term
125   #define PID_PID //normal PID
126
127   #ifdef PID_PID
128     //PID according to Ziegler-Nichols method
129 //    #define  DEFAULT_Kp  (0.6*PID_CRITIAL_GAIN)
130 //    #define  DEFAULT_Ki (2*Kp/PID_SWING_AT_CRITIAL*PID_dT)  
131 //    #define  DEFAULT_Kd (PID_SWING_AT_CRITIAL/8./PID_dT)  
132
133 // Ultitmaker
134     #define  DEFAULT_Kp  22.2
135     #define  DEFAULT_Ki (1.25*PID_dT)  
136     #define  DEFAULT_Kd (99/PID_dT)  
137
138 // Mendel Parts V9 on 12V    
139 //    #define  DEFAULT_Kp  63.0
140 //    #define  DEFAULT_Ki (2.25*PID_dT)  
141 //    #define  DEFAULT_Kd (440/PID_dT)  
142   #endif
143    
144   #ifdef PID_PI
145     //PI according to Ziegler-Nichols method
146     #define  DEFAULT_Kp (PID_CRITIAL_GAIN/2.2) 
147     #define  DEFAULT_Ki (1.2*Kp/PID_SWING_AT_CRITIAL*PID_dT)
148     #define  DEFAULT_Kd (0)
149   #endif
150   
151   // this adds an experimental additional term to the heatingpower, proportional to the extrusion speed.
152   // if Kc is choosen well, the additional required power due to increased melting should be compensated.
153   #define PID_ADD_EXTRUSION_RATE  
154   #ifdef PID_ADD_EXTRUSION_RATE
155     #define  DEFAULT_Kc (3) //heatingpower=Kc*(e_speed)
156   #endif
157 #endif // PIDTEMP
158
159
160 //===========================================================================
161 //=============================Mechanical Settings===========================
162 //===========================================================================
163
164
165 // Endstop Settings
166 #define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pullup resistors
167 // The pullups are needed if you directly connect a mechanical endswitch between the signal and ground pins.
168 const bool X_ENDSTOPS_INVERTING = true; // set to true to invert the logic of the endstops. 
169 const bool Y_ENDSTOPS_INVERTING = true; // set to true to invert the logic of the endstops. 
170 const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of the endstops. 
171 // For optos H21LOB set to true, for Mendel-Parts newer optos TCST2103 set to false
172
173 //#define ENDSTOPS_ONLY_FOR_HOMING // If defined the endstops will only be used for homing
174
175 // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
176 #define X_ENABLE_ON 0
177 #define Y_ENABLE_ON 0
178 #define Z_ENABLE_ON 0
179 #define E_ENABLE_ON 0
180
181 // Disables axis when it's not being used.
182 #define DISABLE_X false
183 #define DISABLE_Y false
184 #define DISABLE_Z false
185 #define DISABLE_E false
186
187 // Inverting axis direction
188 //#define INVERT_X_DIR false    // for Mendel set to false, for Orca set to true
189 //#define INVERT_Y_DIR true   // for Mendel set to true, for Orca set to false
190 //#define INVERT_Z_DIR false    // for Mendel set to false, for Orca set to true
191 //#define INVERT_E_DIR true   // for direct drive extruder v9 set to true, for geared extruder set to false
192
193 #define INVERT_X_DIR true     // for Mendel set to false, for Orca set to true
194 #define INVERT_Y_DIR false    // for Mendel set to true, for Orca set to false
195 #define INVERT_Z_DIR true     // for Mendel set to false, for Orca set to true
196 #define INVERT_E_DIR false    // for direct drive extruder v9 set to true, for geared extruder set to false
197
198 //// ENDSTOP SETTINGS:
199 // Sets direction of endstops when homing; 1=MAX, -1=MIN
200 #define X_HOME_DIR -1
201 #define Y_HOME_DIR -1
202 #define Z_HOME_DIR -1
203
204 #define min_software_endstops false //If true, axis won't move to coordinates less than zero.
205 #define max_software_endstops false  //If true, axis won't move to coordinates greater than the defined lengths below.
206 #define X_MAX_LENGTH 210
207 #define Y_MAX_LENGTH 210
208 #define Z_MAX_LENGTH 210
209
210 //// MOVEMENT SETTINGS
211 #define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E
212 #define HOMING_FEEDRATE {50*60, 50*60, 4*60, 0}  // set the homing speeds (mm/min)
213
214 //homing hits the endstop, then retracts by this distance, before it tries to slowly bump again:
215 #define X_HOME_RETRACT_MM 5 
216 #define Y_HOME_RETRACT_MM 5 
217 #define Z_HOME_RETRACT_MM 1 
218 #define QUICK_HOME  //if this is defined, if both x and y are to be homed, a diagonal move will be performed initially.
219
220 #define AXIS_RELATIVE_MODES {false, false, false, false}
221
222 #define MAX_STEP_FREQUENCY 40000 // Max step frequency for Ultimaker (5000 pps / half step)
223
224 // default settings 
225
226 #define DEFAULT_AXIS_STEPS_PER_UNIT   {78.7402,78.7402,200*8/3,760*1.1}                    // default steps per unit for ultimaker 
227 //#define DEFAULT_AXIS_STEPS_PER_UNIT   {40, 40, 3333.92, 67} //sells mendel with v9 extruder
228 #define DEFAULT_MAX_FEEDRATE          {500, 500, 5, 45}    // (mm/sec)    
229 #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.
230
231 #define DEFAULT_ACCELERATION          3000    // X, Y, Z and E max acceleration in mm/s^2 for printing moves 
232 #define DEFAULT_RETRACT_ACCELERATION  3000   // X, Y, Z and E max acceleration in mm/s^2 for r retracts
233
234 #define DEFAULT_MINIMUMFEEDRATE       0.0     // minimum feedrate
235 #define DEFAULT_MINTRAVELFEEDRATE     0.0
236
237 // minimum time in microseconds that a movement needs to take if the buffer is emptied.   Increase this number if you see blobs while printing high speed & high detail.  It will slowdown on the detailed stuff.
238 #define DEFAULT_MINSEGMENTTIME        20000   // Obsolete delete this
239 #define DEFAULT_XYJERK                20.0    // (mm/sec)
240 #define DEFAULT_ZJERK                 0.4     // (mm/sec)
241
242
243
244
245 //===========================================================================
246 //=============================Additional Features===========================
247 //===========================================================================
248
249 // EEPROM
250 // the microcontroller can store settings in the EEPROM, e.g. max velocity...
251 // M500 - stores paramters in EEPROM
252 // M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily).  
253 // M502 - reverts to the default "factory settings".  You still need to store them in EEPROM afterwards if you want to.
254 //define this to enable eeprom support
255 #define EEPROM_SETTINGS
256 //to disable EEPROM Serial responses and decrease program space by ~1700 byte: comment this out:
257 // please keep turned on if you can.
258 #define EEPROM_CHITCHAT
259
260
261 // The hardware watchdog should halt the Microcontroller, in case the firmware gets stuck somewhere. However:
262 // the Watchdog is not working well, so please only enable this for testing
263 // this enables the watchdog interrupt.
264 //#define USE_WATCHDOG
265 //#ifdef USE_WATCHDOG
266   // you cannot reboot on a mega2560 due to a bug in he bootloader. Hence, you have to reset manually, and this is done hereby:
267 //#define RESET_MANUAL
268 //#define WATCHDOG_TIMEOUT 4  //seconds
269 //#endif
270
271 // extruder advance constant (s2/mm3)
272 //
273 // advance (steps) = STEPS_PER_CUBIC_MM_E * EXTUDER_ADVANCE_K * cubic mm per second ^ 2
274 //
275 // hooke's law says:            force = k * distance
276 // bernoulli's priniciple says: v ^ 2 / 2 + g . h + pressure / density = constant
277 // so: v ^ 2 is proportional to number of steps we advance the extruder
278 //#define ADVANCE
279
280 #ifdef ADVANCE
281   #define EXTRUDER_ADVANCE_K .3
282
283   #define D_FILAMENT 2.85
284   #define STEPS_MM_E 836
285   #define EXTRUTION_AREA (0.25 * D_FILAMENT * D_FILAMENT * 3.14159)
286   #define STEPS_PER_CUBIC_MM_E (axis_steps_per_unit[E_AXIS]/ EXTRUTION_AREA)
287
288 #endif // ADVANCE
289
290
291 //LCD and SD support
292 //#define ULTRA_LCD  //general lcd support, also 16x2
293 //#define SDSUPPORT // Enable SD Card Support in Hardware Console
294 #define SD_FINISHED_STEPPERRELEASE true  //if sd support and the file is finished: disable steppers?
295 #define SD_FINISHED_RELEASECOMMAND "M84 X Y E" // no z because of layer shift.
296
297 //#define ULTIPANEL
298 #ifdef ULTIPANEL
299   //#define NEWPANEL  //enable this if you have a click-encoder panel
300   #define SDSUPPORT
301   #define ULTRA_LCD
302   #define LCD_WIDTH 20
303   #define LCD_HEIGHT 4
304 #else //no panel but just lcd 
305   #ifdef ULTRA_LCD
306     #define LCD_WIDTH 16
307     #define LCD_HEIGHT 2
308   #endif
309 #endif
310
311 // A debugging feature to compare calculated vs performed steps, to see if steps are lost by the software.
312 //#define DEBUG_STEPS
313
314
315 // Arc interpretation settings:
316 #define MM_PER_ARC_SEGMENT 1
317 #define N_ARC_CORRECTION 25
318
319
320 //automatic temperature: The hot end target temperature is calculated by all the buffered lines of gcode.
321 //The maximum buffered steps/sec of the extruder motor are called "se".
322 //You enter the autotemp mode by a M109 S<mintemp> T<maxtemp> F<factor>
323 // the target temperature is set to mintemp+factor*se[steps/sec] and limited by mintemp and maxtemp
324 // you exit the value by any M109 without F*
325 // Also, if the temperature is set to a value <mintemp, it is not changed by autotemp.
326 // on an ultimaker, some initial testing worked with M109 S215 T260 F0.1 in the start.gcode
327 //#define AUTOTEMP
328 #ifdef AUTOTEMP
329   #define AUTOTEMP_OLDWEIGHT 0.98
330 #endif
331
332
333 const int dropsegments=5; //everything with less than this number of steps will be ignored as move and joined with the next movement
334
335 //===========================================================================
336 //=============================Buffers           ============================
337 //===========================================================================
338
339
340
341 // The number of linear motions that can be in the plan at any give time.  
342 // THE BLOCK_BUFFER_SIZE NEEDS TO BE A POWER OF 2, i.g. 8,16,32 because shifts and ors are used to do the ringbuffering.
343 #if defined SDSUPPORT
344   #define BLOCK_BUFFER_SIZE 16   // SD,LCD,Buttons take more memory, block buffer needs to be smaller
345 #else
346   #define BLOCK_BUFFER_SIZE 16 // maximize block buffer
347 #endif
348
349
350 //The ASCII buffer for recieving from the serial:
351 #define MAX_CMD_SIZE 96
352 #define BUFSIZE 4
353
354
355 #include "thermistortables.h"
356
357 #endif //__CONFIGURATION_H