reprap: Some more updates, also a Marlin binary to test
[simavr] / examples / board_reprap / marlin / Configuration_adv.h
1 #ifndef __CONFIGURATION_ADV_H
2 #define __CONFIGURATION_ADV_H
3
4 //===========================================================================
5 //=============================Thermal Settings  ============================
6 //===========================================================================
7
8 // Select one of these only to define how the bed temp is read.
9 //
10 //#define BED_LIMIT_SWITCHING
11 #ifdef BED_LIMIT_SWITCHING
12   #define BED_HYSTERESIS 2 //only disable heating if T>target+BED_HYSTERESIS and enable heating if T>target-BED_HYSTERESIS
13 #endif
14 #define BED_CHECK_INTERVAL 5000 //ms
15
16 //// Heating sanity check:
17 // This waits for the watchperiod in milliseconds whenever an M104 or M109 increases the target temperature
18 // If the temperature has not increased at the end of that period, the target temperature is set to zero. 
19 // It can be reset with another M104/M109
20 //#define WATCHPERIOD 20000 //20 seconds
21
22 // Wait for Cooldown
23 // This defines if the M109 call should not block if it is cooling down.
24 // example: From a current temp of 220, you set M109 S200. 
25 // if CooldownNoWait is defined M109 will not wait for the cooldown to finish
26 #define CooldownNoWait true
27
28 #ifdef PIDTEMP
29   // this adds an experimental additional term to the heatingpower, proportional to the extrusion speed.
30   // if Kc is choosen well, the additional required power due to increased melting should be compensated.
31   #define PID_ADD_EXTRUSION_RATE  
32   #ifdef PID_ADD_EXTRUSION_RATE
33     #define  DEFAULT_Kc (1) //heatingpower=Kc*(e_speed)
34   #endif
35 #endif
36
37
38 //automatic temperature: The hot end target temperature is calculated by all the buffered lines of gcode.
39 //The maximum buffered steps/sec of the extruder motor are called "se".
40 //You enter the autotemp mode by a M109 S<mintemp> T<maxtemp> F<factor>
41 // the target temperature is set to mintemp+factor*se[steps/sec] and limited by mintemp and maxtemp
42 // you exit the value by any M109 without F*
43 // Also, if the temperature is set to a value <mintemp, it is not changed by autotemp.
44 // on an ultimaker, some initial testing worked with M109 S215 T260 F0.1 in the start.gcode
45 //#define AUTOTEMP
46 #ifdef AUTOTEMP
47   #define AUTOTEMP_OLDWEIGHT 0.98
48 #endif
49
50 //  extruder run-out prevention. 
51 //if the machine is idle, and the temperature over MINTEMP, every couple of SECONDS some filament is extruded
52 //#define EXTRUDER_RUNOUT_PREVENT  
53 #define EXTRUDER_RUNOUT_MINTEMP 190  
54 #define EXTRUDER_RUNOUT_SECONDS 30.
55 #define EXTRUDER_RUNOUT_ESTEPS 14. //mm filament
56 #define EXTRUDER_RUNOUT_SPEED 1500.  //extrusion speed
57 #define EXTRUDER_RUNOUT_EXTRUDE 100
58
59 //These defines help to calibrate the AD595 sensor in case you get wrong temperature measurements.
60 //The measured temperature is defined as "actualTemp = (measuredTemp * TEMP_SENSOR_AD595_GAIN) + TEMP_SENSOR_AD595_OFFSET"
61 #define TEMP_SENSOR_AD595_OFFSET 0.0
62 #define TEMP_SENSOR_AD595_GAIN   1.0
63
64 //This is for controlling a fan to cool down the stepper drivers
65 //it will turn on when any driver is enabled
66 //and turn off after the set amount of seconds from last driver being disabled again
67 //#define CONTROLLERFAN_PIN 23 //Pin used for the fan to cool controller, comment out to disable this function
68 #define CONTROLLERFAN_SEC 60 //How many seconds, after all motors were disabled, the fan should run
69
70 //===========================================================================
71 //=============================Mechanical Settings===========================
72 //===========================================================================
73
74 // This defines the number of extruders
75 #define EXTRUDERS 1
76
77 //#define ENDSTOPS_ONLY_FOR_HOMING // If defined the endstops will only be used for homing
78
79 //#define Z_LATE_ENABLE // Enable Z the last moment. Needed if your Z driver overheats.
80
81 //homing hits the endstop, then retracts by this distance, before it tries to slowly bump again:
82 #define X_HOME_RETRACT_MM 5 
83 #define Y_HOME_RETRACT_MM 5 
84 #define Z_HOME_RETRACT_MM 1 
85 #define QUICK_HOME  //if this is defined, if both x and y are to be homed, a diagonal move will be performed initially.
86
87 #define AXIS_RELATIVE_MODES {false, false, false, false}
88
89 #ifdef CONFIG_STEPPERS_TOSHIBA
90 #define MAX_STEP_FREQUENCY 10000 // Max step frequency for Toshiba Stepper Controllers
91 #else
92 #define MAX_STEP_FREQUENCY 40000 // Max step frequency for Ultimaker (5000 pps / half step)
93 #endif
94
95 //default stepper release if idle
96 #define DEFAULT_STEPPER_DEACTIVE_TIME 60
97
98 #define DEFAULT_MINIMUMFEEDRATE       0.0     // minimum feedrate
99 #define DEFAULT_MINTRAVELFEEDRATE     0.0
100
101 // 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.
102 #define DEFAULT_MINSEGMENTTIME        20000   // Obsolete delete this
103
104 // If defined the movements slow down when the look ahead buffer is only half full
105 #define SLOWDOWN
106
107 // Frequency limit
108 // See nophead's blog for more info
109 // Not working O
110 //#define XY_FREQUENCY_LIMIT  15
111
112 // Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end
113 // of the buffer and all stops. This should not be much greater than zero and should only be changed
114 // if unwanted behavior is observed on a user's machine when running at very slow speeds.
115 #define MINIMUM_PLANNER_SPEED 0.05// (mm/sec)
116
117 //===========================================================================
118 //=============================Additional Features===========================
119 //===========================================================================
120
121
122 #define SD_FINISHED_STEPPERRELEASE true  //if sd support and the file is finished: disable steppers?
123 #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // no z because of layer shift.
124
125 // The hardware watchdog should halt the Microcontroller, in case the firmware gets stuck somewhere. However:
126 // the Watchdog is not working well, so please only enable this for testing
127 // this enables the watchdog interrupt.
128 //#define USE_WATCHDOG
129 //#ifdef USE_WATCHDOG
130   // you cannot reboot on a mega2560 due to a bug in he bootloader. Hence, you have to reset manually, and this is done hereby:
131 //#define RESET_MANUAL
132 //#define WATCHDOG_TIMEOUT 4  //seconds
133 //#endif
134
135 // extruder advance constant (s2/mm3)
136 //
137 // advance (steps) = STEPS_PER_CUBIC_MM_E * EXTUDER_ADVANCE_K * cubic mm per second ^ 2
138 //
139 // hooke's law says:            force = k * distance
140 // bernoulli's priniciple says: v ^ 2 / 2 + g . h + pressure / density = constant
141 // so: v ^ 2 is proportional to number of steps we advance the extruder
142 //#define ADVANCE
143
144 #ifdef ADVANCE
145   #define EXTRUDER_ADVANCE_K .0
146
147   #define D_FILAMENT 2.85
148   #define STEPS_MM_E 836
149   #define EXTRUTION_AREA (0.25 * D_FILAMENT * D_FILAMENT * 3.14159)
150   #define STEPS_PER_CUBIC_MM_E (axis_steps_per_unit[E_AXIS]/ EXTRUTION_AREA)
151
152 #endif // ADVANCE
153
154 // A debugging feature to compare calculated vs performed steps, to see if steps are lost by the software.
155 //#define DEBUG_STEPS
156
157 // Arc interpretation settings:
158 #define MM_PER_ARC_SEGMENT 1
159 #define N_ARC_CORRECTION 25
160
161 const int dropsegments=5; //everything with less than this number of steps will be ignored as move and joined with the next movement
162
163 // If you are using a RAMPS board or cheap E-bay purchased boards that do not detect when an SD card is inserted
164 // You can get round this by connecting a push button or single throw switch to the pin defined as SDCARDCARDDETECT 
165 // in the pins.h file.  When using a push button pulling the pin to ground this will need inverted.  This setting should
166 // be commented out otherwise
167 #define SDCARDDETECTINVERTED 
168
169 #ifdef ULTIPANEL
170  #undef SDCARDDETECTINVERTED
171 #endif
172 //===========================================================================
173 //=============================Buffers           ============================
174 //===========================================================================
175
176 // The number of linear motions that can be in the plan at any give time.  
177 // 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.
178 #if defined SDSUPPORT
179   #define BLOCK_BUFFER_SIZE 16   // SD,LCD,Buttons take more memory, block buffer needs to be smaller
180 #else
181   #define BLOCK_BUFFER_SIZE 16 // maximize block buffer
182 #endif
183
184
185 //The ASCII buffer for recieving from the serial:
186 #define MAX_CMD_SIZE 96
187 #define BUFSIZE 4
188
189 //===========================================================================
190 //=============================  Define Defines  ============================
191 //===========================================================================
192
193 #if TEMP_SENSOR_0 > 0
194   #define THERMISTORHEATER_0 TEMP_SENSOR_0
195   #define HEATER_0_USES_THERMISTOR
196 #endif
197 #if TEMP_SENSOR_1 > 0
198   #define THERMISTORHEATER_1 TEMP_SENSOR_1
199   #define HEATER_1_USES_THERMISTOR
200 #endif
201 #if TEMP_SENSOR_2 > 0
202   #define THERMISTORHEATER_2 TEMP_SENSOR_2
203   #define HEATER_2_USES_THERMISTOR
204 #endif
205 #if TEMP_SENSOR_BED > 0
206   #define THERMISTORBED TEMP_SENSOR_BED
207   #define BED_USES_THERMISTOR
208 #endif
209 #if TEMP_SENSOR_0 == -1
210   #define HEATER_0_USES_AD595
211 #endif
212 #if TEMP_SENSOR_1 == -1
213   #define HEATER_1_USES_AD595
214 #endif
215 #if TEMP_SENSOR_2 == -1
216   #define HEATER_2_USES_AD595
217 #endif
218 #if TEMP_SENSOR_BED == -1
219   #define BED_USES_AD595
220 #endif
221 #if TEMP_SENSOR_0 == -2
222   #define HEATER_0_USES_MAX6675
223 #endif
224 #if TEMP_SENSOR_0 == 0
225   #undef HEATER_0_MINTEMP
226   #undef HEATER_0_MAXTEMP
227 #endif
228 #if TEMP_SENSOR_1 == 0
229   #undef HEATER_1_MINTEMP
230   #undef HEATER_1_MAXTEMP
231 #endif
232 #if TEMP_SENSOR_2 == 0
233   #undef HEATER_2_MINTEMP
234   #undef HEATER_2_MAXTEMP
235 #endif
236 #if TEMP_SENSOR_BED == 0
237   #undef BED_MINTEMP
238   #undef BED_MAXTEMP
239 #endif
240
241
242 #endif //__CONFIGURATION_ADV_H