Browse Source

Split the configuration file in two parts.

One for common settings.
One for advanced settings.
Erik van der Zalm 12 years ago
parent
commit
d8a0c6450f
3 changed files with 257 additions and 246 deletions
  1. 34
    237
      Marlin/Configuration.h
  2. 208
    0
      Marlin/Configuration_adv.h
  3. 15
    9
      Marlin/Marlin.pde

+ 34
- 237
Marlin/Configuration.h View File

@@ -1,26 +1,13 @@
1 1
 #ifndef __CONFIGURATION_H
2 2
 #define __CONFIGURATION_H
3 3
 
4
-
4
+// This configurtion file contains the basic settings.
5
+// Advanced settings can be found in Configuration_adv.h 
6
+// BASIC SETTINGS: select your board type, temperature sensor type, axis scaling, and endstop configuration
5 7
 
6 8
 // This determines the communication speed of the printer
7 9
 #define BAUDRATE 250000
8 10
 //#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
-// BASIC SETTINGS: select your board type, thermistor type, axis scaling, and endstop configuration
24 11
 
25 12
 //// The following define selects which electronics board you have. Please choose the one that matches your setup
26 13
 // MEGA/RAMPS up to 1.2 = 3,
@@ -36,7 +23,10 @@
36 23
 //=============================Thermal Settings  ============================
37 24
 //===========================================================================
38 25
 
39
-//// Thermistor settings:
26
+//// Temperature sensor settings:
27
+// -2 is thermocouple with MAX6675 (only for sensor 0)
28
+// -1 is thermocouple with AD595
29
+// 0 is not used
40 30
 // 1 is 100k thermistor
41 31
 // 2 is 200k thermistor
42 32
 // 3 is mendel-parts thermistor
@@ -45,70 +35,33 @@
45 35
 // 6 is EPCOS 100k
46 36
 // 7 is 100k Honeywell thermistor 135-104LAG-J01
47 37
 
48
-//#define THERMISTORHEATER_0 3
49
-//#define THERMISTORHEATER_1 1
50
-//#define THERMISTORHEATER_2 1
51
-
52
-//#define HEATER_0_USES_THERMISTOR
53
-//#define HEATER_1_USES_THERMISTOR
54
-//#define HEATER_2_USES_THERMISTOR
55
-#define HEATER_0_USES_AD595
56
-//#define HEATER_1_USES_AD595
57
-//#define HEATER_2_USES_AD595
58
-//#define HEATER_0_USES_MAX6675
59
- 
60
-
61
-// Select one of these only to define how the bed temp is read.
62
-//#define THERMISTORBED 1
63
-//#define BED_USES_THERMISTOR
64
-//#define BED_LIMIT_SWITCHING
65
-#ifdef BED_LIMIT_SWITCHING
66
-  #define BED_HYSTERESIS 2 //only disable heating if T>target+BED_HYSTERESIS and enable heating if T>target-BED_HYSTERESIS
67
-#endif
68
-//#define BED_USES_AD595
69
-
70
-#define BED_CHECK_INTERVAL 5000 //ms
71
-
72
-//// Heating sanity check:
73
-// This waits for the watchperiod in milliseconds whenever an M104 or M109 increases the target temperature
74
-// If the temperature has not increased at the end of that period, the target temperature is set to zero. 
75
-// It can be reset with another M104/M109
76
-//#define WATCHPERIOD 20000 //20 seconds
38
+#define TEMP_SENSOR_0 -1
39
+#define TEMP_SENSOR_1 0
40
+#define TEMP_SENSOR_2 0
41
+#define TEMP_SENSOR_BED 0
77 42
 
78 43
 // Actual temperature must be close to target for this long before M109 returns success
79 44
 #define TEMP_RESIDENCY_TIME 30  // (seconds)
80 45
 #define TEMP_HYSTERESIS 3       // (C°) range of +/- temperatures considered "close" to the target one
81 46
 
82
-//// The minimal temperature defines the temperature below which the heater will not be enabled
47
+// The minimal temperature defines the temperature below which the heater will not be enabled It is used
48
+// to check that the wiring to the thermistor is not broken. 
49
+// Otherwise this would lead to the heater being powered on all the time.
83 50
 #define HEATER_0_MINTEMP 5
84
-//#define HEATER_1_MINTEMP 5
85
-//#define HEATER_2_MINTEMP 5
86
-//#define BED_MINTEMP 5
87
-
51
+#define HEATER_1_MINTEMP 5
52
+#define HEATER_2_MINTEMP 5
53
+#define BED_MINTEMP 5
88 54
 
89 55
 // When temperature exceeds max temp, your heater will be switched off.
90 56
 // This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure!
91 57
 // You should use MINTEMP for thermistor short/failure protection.
92 58
 #define HEATER_0_MAXTEMP 275
93
-//#define HEATER_1_MAXTEMP 275
94
-//#define HEATER_2_MAXTEMP 275
95
-//#define BED_MAXTEMP 150
96
-
97
-
98
-// Wait for Cooldown
99
-// This defines if the M109 call should not block if it is cooling down.
100
-// example: From a current temp of 220, you set M109 S200. 
101
-// if CooldownNoWait is defined M109 will not wait for the cooldown to finish
102
-#define CooldownNoWait true
103
-
104
-// Heating is finished if a temperature close to this degree shift is reached
105
-#define HEATING_EARLY_FINISH_DEG_OFFSET 1 //Degree
106
-
107
-//Do not wait for M109 to finish when printing from SD card
108
-//#define STOP_HEATING_WAIT_WHEN_SD_PRINTING
59
+#define HEATER_1_MAXTEMP 275
60
+#define HEATER_2_MAXTEMP 275
61
+#define BED_MAXTEMP 150
109 62
 
110 63
 // PID settings:
111
-// Uncomment the following line to enable PID support.
64
+// Comment the following line to disable PID and enable bang-bang.
112 65
 #define PIDTEMP
113 66
 #define PID_MAX 255 // limits current to nozzle; 255=full current
114 67
 #ifdef PIDTEMP
@@ -118,28 +71,8 @@
118 71
   #define K1 0.95 //smoothing factor withing the PID
119 72
   #define PID_dT 0.128 //sampling period of the PID
120 73
 
121
-  //To develop some PID settings for your machine, you can initiall follow 
122
-  // the Ziegler-Nichols method.
123
-  // set Ki and Kd to zero. 
124
-  // heat with a defined Kp and see if the temperature stabilizes
125
-  // ideally you do this graphically with repg.
126
-  // the PID_CRITIAL_GAIN should be the Kp at which temperature oscillatins are not dampned out/decreas in amplitutde
127
-  // PID_SWING_AT_CRITIAL is the time for a full period of the oscillations at the critical Gain
128
-  // usually further manual tunine is necessary.
129
-
130
-  #define PID_CRITIAL_GAIN 50
131
-  #define PID_SWING_AT_CRITIAL 47 //seconds
132
-  
133
-  //#define PID_PI    //no differentail term
134
-  #define PID_PID //normal PID
135
-
136
-  #ifdef PID_PID
137
-    //PID according to Ziegler-Nichols method
138
-//    #define  DEFAULT_Kp  (0.6*PID_CRITIAL_GAIN)
139
-//    #define  DEFAULT_Ki (2*Kp/PID_SWING_AT_CRITIAL*PID_dT)  
140
-//    #define  DEFAULT_Kd (PID_SWING_AT_CRITIAL/8./PID_dT)  
141
-
142
-// Ultitmaker
74
+// If you are using a preconfigured hotend then you can use one of the value sets by uncommenting it
75
+// Ultimaker
143 76
     #define  DEFAULT_Kp  22.2
144 77
     #define  DEFAULT_Ki (1.25*PID_dT)  
145 78
     #define  DEFAULT_Kd (99/PID_dT)  
@@ -152,39 +85,19 @@
152 85
 // Mendel Parts V9 on 12V    
153 86
 //    #define  DEFAULT_Kp  63.0
154 87
 //    #define  DEFAULT_Ki (2.25*PID_dT)  
155
-//    #define  DEFAULT_Kd (440/PID_dT)  
156
-  #endif
157
-   
158
-  #ifdef PID_PI
159
-    //PI according to Ziegler-Nichols method
160
-    #define  DEFAULT_Kp (PID_CRITIAL_GAIN/2.2) 
161
-    #define  DEFAULT_Ki (1.2*Kp/PID_SWING_AT_CRITIAL*PID_dT)
162
-    #define  DEFAULT_Kd (0)
163
-  #endif
164
-  
165
-  // this adds an experimental additional term to the heatingpower, proportional to the extrusion speed.
166
-  // if Kc is choosen well, the additional required power due to increased melting should be compensated.
167
-  #define PID_ADD_EXTRUSION_RATE  
168
-  #ifdef PID_ADD_EXTRUSION_RATE
169
-    #define  DEFAULT_Kc (1) //heatingpower=Kc*(e_speed)
170
-  #endif
88
+//    #define  DEFAULT_Kd (440/PID_dT)
171 89
 #endif // PIDTEMP
172 90
 
173
-//  extruder run-out prevention. 
174
-//if the machine is idle, and the temperature over MINTEMP, every couple of SECONDS some filament is extruded
175
-//#define EXTRUDER_RUNOUT_PREVENT  
176
-#define EXTRUDER_RUNOUT_MINTEMP 190  
177
-#define EXTRUDER_RUNOUT_SECONDS 30.
178
-#define EXTRUDER_RUNOUT_ESTEPS 14. //mm filament
179
-#define EXTRUDER_RUNOUT_SPEED 1500.  //extrusion speed
180
-#define EXTRUDER_RUNOUT_EXTRUDE 100
181
-
91
+//this prevents dangerous Extruder moves, i.e. if the temperature is under the limit
92
+//can be software-disabled for whatever purposes by
93
+#define PREVENT_DANGEROUS_EXTRUDE
94
+#define EXTRUDE_MINTEMP 190
95
+#define EXTRUDE_MAXLENGTH (X_MAX_LENGTH+Y_MAX_LENGTH) //prevent extrusion of very large distances.
182 96
 
183 97
 //===========================================================================
184 98
 //=============================Mechanical Settings===========================
185 99
 //===========================================================================
186 100
 
187
-
188 101
 // Endstop Settings
189 102
 #define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pullup resistors
190 103
 
@@ -192,9 +105,6 @@
192 105
 const bool X_ENDSTOPS_INVERTING = true; // set to true to invert the logic of the endstops. 
193 106
 const bool Y_ENDSTOPS_INVERTING = true; // set to true to invert the logic of the endstops. 
194 107
 const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of the endstops. 
195
-// For optos H21LOB set to true, for Mendel-Parts newer optos TCST2103 set to false
196
-
197
-#define ENDSTOPS_ONLY_FOR_HOMING // If defined the endstops will only be used for homing
198 108
 
199 109
 // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
200 110
 #define X_ENABLE_ON 0
@@ -207,13 +117,6 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
207 117
 #define DISABLE_Y false
208 118
 #define DISABLE_Z false
209 119
 #define DISABLE_E false // For all extruders
210
-//#define Z_LATE_ENABLE // Enable Z the last moment. Needed if your Z driver overheats.
211
-
212
-// Inverting axis direction
213
-//#define INVERT_X_DIR false    // for Mendel set to false, for Orca set to true
214
-//#define INVERT_Y_DIR true   // for Mendel set to true, for Orca set to false
215
-//#define INVERT_Z_DIR false    // for Mendel set to false, for Orca set to true
216
-//#define INVERT_E*_DIR true   // for direct drive extruder v9 set to true, for geared extruder set to false, used for all extruders
217 120
 
218 121
 #define INVERT_X_DIR true    // for Mendel set to false, for Orca set to true
219 122
 #define INVERT_Y_DIR false    // for Mendel set to true, for Orca set to false
@@ -222,7 +125,7 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
222 125
 #define INVERT_E1_DIR false    // for direct drive extruder v9 set to true, for geared extruder set to false
223 126
 #define INVERT_E2_DIR false   // for direct drive extruder v9 set to true, for geared extruder set to false
224 127
 
225
-//// ENDSTOP SETTINGS:
128
+// ENDSTOP SETTINGS:
226 129
 // Sets direction of endstops when homing; 1=MAX, -1=MIN
227 130
 #define X_HOME_DIR -1
228 131
 #define Y_HOME_DIR -1
@@ -238,43 +141,19 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
238 141
 #define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E
239 142
 #define HOMING_FEEDRATE {50*60, 50*60, 4*60, 0}  // set the homing speeds (mm/min)
240 143
 
241
-//homing hits the endstop, then retracts by this distance, before it tries to slowly bump again:
242
-#define X_HOME_RETRACT_MM 5 
243
-#define Y_HOME_RETRACT_MM 5 
244
-#define Z_HOME_RETRACT_MM 1 
245
-#define QUICK_HOME  //if this is defined, if both x and y are to be homed, a diagonal move will be performed initially.
246
-
247
-#define AXIS_RELATIVE_MODES {false, false, false, false}
248
-
249
-#define MAX_STEP_FREQUENCY 40000 // Max step frequency for Ultimaker (5000 pps / half step)
250
-
251 144
 // default settings 
252 145
 
253 146
 #define DEFAULT_AXIS_STEPS_PER_UNIT   {78.7402,78.7402,200*8/3,760*1.1}                    // default steps per unit for ultimaker 
254
-//#define DEFAULT_AXIS_STEPS_PER_UNIT   {40, 40, 3333.92, 360} //sells mendel with v9 extruder
255
-//#define DEFAULT_AXIS_STEPS_PER_UNIT   {80.3232, 80.8900, 2284.7651, 757.2218} // SAE Prusa w/ Wade extruder
256 147
 #define DEFAULT_MAX_FEEDRATE          {500, 500, 5, 45}    // (mm/sec)    
257 148
 #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.
258 149
 
259 150
 #define DEFAULT_ACCELERATION          3000    // X, Y, Z and E max acceleration in mm/s^2 for printing moves 
260 151
 #define DEFAULT_RETRACT_ACCELERATION  3000   // X, Y, Z and E max acceleration in mm/s^2 for r retracts
261 152
 
262
-#define DEFAULT_MINIMUMFEEDRATE       0.0     // minimum feedrate
263
-#define DEFAULT_MINTRAVELFEEDRATE     0.0
264
-
265
-// 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.
266
-#define DEFAULT_MINSEGMENTTIME        20000   // Obsolete delete this
153
+// 
267 154
 #define DEFAULT_XYJERK                20.0    // (mm/sec)
268 155
 #define DEFAULT_ZJERK                 0.4     // (mm/sec)
269 156
 
270
-// If defined the movements slow down when the look ahead buffer is only half full
271
-#define SLOWDOWN
272
-
273
-//default stepper release if idle
274
-#define DEFAULT_STEPPER_DEACTIVE_TIME 60
275
-#define DEFAULT_STEPPER_DEACTIVE_COMMAND "M84 X Y E"  //z stays  powered
276
-
277
-
278 157
 //===========================================================================
279 158
 //=============================Additional Features===========================
280 159
 //===========================================================================
@@ -285,47 +164,14 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
285 164
 // M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily).  
286 165
 // M502 - reverts to the default "factory settings".  You still need to store them in EEPROM afterwards if you want to.
287 166
 //define this to enable eeprom support
288
-#define EEPROM_SETTINGS
167
+//#define EEPROM_SETTINGS
289 168
 //to disable EEPROM Serial responses and decrease program space by ~1700 byte: comment this out:
290 169
 // please keep turned on if you can.
291
-#define EEPROM_CHITCHAT
292
-
293
-
294
-// The hardware watchdog should halt the Microcontroller, in case the firmware gets stuck somewhere. However:
295
-// the Watchdog is not working well, so please only enable this for testing
296
-// this enables the watchdog interrupt.
297
-//#define USE_WATCHDOG
298
-//#ifdef USE_WATCHDOG
299
-  // you cannot reboot on a mega2560 due to a bug in he bootloader. Hence, you have to reset manually, and this is done hereby:
300
-//#define RESET_MANUAL
301
-//#define WATCHDOG_TIMEOUT 4  //seconds
302
-//#endif
303
-
304
-// extruder advance constant (s2/mm3)
305
-//
306
-// advance (steps) = STEPS_PER_CUBIC_MM_E * EXTUDER_ADVANCE_K * cubic mm per second ^ 2
307
-//
308
-// hooke's law says:		force = k * distance
309
-// bernoulli's priniciple says:	v ^ 2 / 2 + g . h + pressure / density = constant
310
-// so: v ^ 2 is proportional to number of steps we advance the extruder
311
-//#define ADVANCE
312
-
313
-#ifdef ADVANCE
314
-  #define EXTRUDER_ADVANCE_K .0
315
-
316
-  #define D_FILAMENT 2.85
317
-  #define STEPS_MM_E 836
318
-  #define EXTRUTION_AREA (0.25 * D_FILAMENT * D_FILAMENT * 3.14159)
319
-  #define STEPS_PER_CUBIC_MM_E (axis_steps_per_unit[E_AXIS]/ EXTRUTION_AREA)
320
-
321
-#endif // ADVANCE
322
-
170
+//#define EEPROM_CHITCHAT
323 171
 
324 172
 //LCD and SD support
325 173
 //#define ULTRA_LCD  //general lcd support, also 16x2
326 174
 //#define SDSUPPORT // Enable SD Card Support in Hardware Console
327
-#define SD_FINISHED_STEPPERRELEASE true  //if sd support and the file is finished: disable steppers?
328
-#define SD_FINISHED_RELEASECOMMAND "M84 X Y E" // no z because of layer shift.
329 175
 
330 176
 //#define ULTIPANEL
331 177
 #ifdef ULTIPANEL
@@ -341,60 +187,11 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
341 187
   #endif
342 188
 #endif
343 189
 
344
-// A debugging feature to compare calculated vs performed steps, to see if steps are lost by the software.
345
-//#define DEBUG_STEPS
346
-
347
-
348
-// Arc interpretation settings:
349
-#define MM_PER_ARC_SEGMENT 1
350
-#define N_ARC_CORRECTION 25
351
-
352
-
353
-//automatic temperature: The hot end target temperature is calculated by all the buffered lines of gcode.
354
-//The maximum buffered steps/sec of the extruder motor are called "se".
355
-//You enter the autotemp mode by a M109 S<mintemp> T<maxtemp> F<factor>
356
-// the target temperature is set to mintemp+factor*se[steps/sec] and limited by mintemp and maxtemp
357
-// you exit the value by any M109 without F*
358
-// Also, if the temperature is set to a value <mintemp, it is not changed by autotemp.
359
-// on an ultimaker, some initial testing worked with M109 S215 T260 F0.1 in the start.gcode
360
-//#define AUTOTEMP
361
-#ifdef AUTOTEMP
362
-  #define AUTOTEMP_OLDWEIGHT 0.98
363
-#endif
364
-
365
-//this prevents dangerous Extruder moves, i.e. if the temperature is under the limit
366
-//can be software-disabled for whatever purposes by
367
-#define PREVENT_DANGEROUS_EXTRUDE
368
-#define EXTRUDE_MINTEMP 190
369
-#define EXTRUDE_MAXLENGTH (X_MAX_LENGTH+Y_MAX_LENGTH) //prevent extrusion of very large distances.
370
-
371
-const int dropsegments=5; //everything with less than this number of steps will be ignored as move and joined with the next movement
372
-
373
-
374 190
 // M240  Triggers a camera by emulating a Canon RC-1 Remote
375 191
 // Data from: http://www.doc-diy.net/photo/rc-1_hacked/
376 192
 // #define PHOTOGRAPH_PIN     23
377 193
 
378
-//===========================================================================
379
-//=============================Buffers           ============================
380
-//===========================================================================
381
-
382
-
383
-
384
-// The number of linear motions that can be in the plan at any give time.  
385
-// 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.
386
-#if defined SDSUPPORT
387
-  #define BLOCK_BUFFER_SIZE 16   // SD,LCD,Buttons take more memory, block buffer needs to be smaller
388
-#else
389
-  #define BLOCK_BUFFER_SIZE 16 // maximize block buffer
390
-#endif
391
-
392
-
393
-//The ASCII buffer for recieving from the serial:
394
-#define MAX_CMD_SIZE 96
395
-#define BUFSIZE 4
396
-
397
-
194
+#include "Configuration_adv.h"
398 195
 #include "thermistortables.h"
399 196
 
400 197
 #endif //__CONFIGURATION_H

+ 208
- 0
Marlin/Configuration_adv.h View File

@@ -0,0 +1,208 @@
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
+// Heating is finished if a temperature close to this degree shift is reached
29
+#define HEATING_EARLY_FINISH_DEG_OFFSET 1 //Degree
30
+
31
+//Do not wait for M109 to finish when printing from SD card
32
+//#define STOP_HEATING_WAIT_WHEN_SD_PRINTING
33
+
34
+#ifdef PIDTEMP
35
+  // this adds an experimental additional term to the heatingpower, proportional to the extrusion speed.
36
+  // if Kc is choosen well, the additional required power due to increased melting should be compensated.
37
+  #define PID_ADD_EXTRUSION_RATE  
38
+  #ifdef PID_ADD_EXTRUSION_RATE
39
+    #define  DEFAULT_Kc (1) //heatingpower=Kc*(e_speed)
40
+  #endif
41
+#endif
42
+
43
+
44
+//automatic temperature: The hot end target temperature is calculated by all the buffered lines of gcode.
45
+//The maximum buffered steps/sec of the extruder motor are called "se".
46
+//You enter the autotemp mode by a M109 S<mintemp> T<maxtemp> F<factor>
47
+// the target temperature is set to mintemp+factor*se[steps/sec] and limited by mintemp and maxtemp
48
+// you exit the value by any M109 without F*
49
+// Also, if the temperature is set to a value <mintemp, it is not changed by autotemp.
50
+// on an ultimaker, some initial testing worked with M109 S215 T260 F0.1 in the start.gcode
51
+//#define AUTOTEMP
52
+#ifdef AUTOTEMP
53
+  #define AUTOTEMP_OLDWEIGHT 0.98
54
+#endif
55
+
56
+//  extruder run-out prevention. 
57
+//if the machine is idle, and the temperature over MINTEMP, every couple of SECONDS some filament is extruded
58
+//#define EXTRUDER_RUNOUT_PREVENT  
59
+#define EXTRUDER_RUNOUT_MINTEMP 190  
60
+#define EXTRUDER_RUNOUT_SECONDS 30.
61
+#define EXTRUDER_RUNOUT_ESTEPS 14. //mm filament
62
+#define EXTRUDER_RUNOUT_SPEED 1500.  //extrusion speed
63
+#define EXTRUDER_RUNOUT_EXTRUDE 100
64
+
65
+//===========================================================================
66
+//=============================Mechanical Settings===========================
67
+//===========================================================================
68
+
69
+// This defines the number of extruders
70
+#define EXTRUDERS 1
71
+
72
+#define ENDSTOPS_ONLY_FOR_HOMING // If defined the endstops will only be used for homing
73
+
74
+//#define Z_LATE_ENABLE // Enable Z the last moment. Needed if your Z driver overheats.
75
+
76
+//homing hits the endstop, then retracts by this distance, before it tries to slowly bump again:
77
+#define X_HOME_RETRACT_MM 5 
78
+#define Y_HOME_RETRACT_MM 5 
79
+#define Z_HOME_RETRACT_MM 1 
80
+#define QUICK_HOME  //if this is defined, if both x and y are to be homed, a diagonal move will be performed initially.
81
+
82
+#define AXIS_RELATIVE_MODES {false, false, false, false}
83
+
84
+#define MAX_STEP_FREQUENCY 40000 // Max step frequency for Ultimaker (5000 pps / half step)
85
+
86
+//default stepper release if idle
87
+#define DEFAULT_STEPPER_DEACTIVE_TIME 60
88
+#define DEFAULT_STEPPER_DEACTIVE_COMMAND "M84 X Y E"  //z stays  powered
89
+
90
+#define DEFAULT_MINIMUMFEEDRATE       0.0     // minimum feedrate
91
+#define DEFAULT_MINTRAVELFEEDRATE     0.0
92
+
93
+// 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.
94
+#define DEFAULT_MINSEGMENTTIME        20000   // Obsolete delete this
95
+
96
+// If defined the movements slow down when the look ahead buffer is only half full
97
+#define SLOWDOWN
98
+
99
+// Frequency limit
100
+// See nophead's blog for more info
101
+// Not working O
102
+//#define XY_FREQUENCY_LIMIT  15
103
+
104
+// Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end
105
+// of the buffer and all stops. This should not be much greater than zero and should only be changed
106
+// if unwanted behavior is observed on a user's machine when running at very slow speeds.
107
+#define MINIMUM_PLANNER_SPEED 2.0 // (mm/sec)
108
+
109
+//===========================================================================
110
+//=============================Additional Features===========================
111
+//===========================================================================
112
+
113
+
114
+#define SD_FINISHED_STEPPERRELEASE true  //if sd support and the file is finished: disable steppers?
115
+#define SD_FINISHED_RELEASECOMMAND "M84 X Y E" // no z because of layer shift.
116
+
117
+// The hardware watchdog should halt the Microcontroller, in case the firmware gets stuck somewhere. However:
118
+// the Watchdog is not working well, so please only enable this for testing
119
+// this enables the watchdog interrupt.
120
+//#define USE_WATCHDOG
121
+//#ifdef USE_WATCHDOG
122
+  // you cannot reboot on a mega2560 due to a bug in he bootloader. Hence, you have to reset manually, and this is done hereby:
123
+//#define RESET_MANUAL
124
+//#define WATCHDOG_TIMEOUT 4  //seconds
125
+//#endif
126
+
127
+// extruder advance constant (s2/mm3)
128
+//
129
+// advance (steps) = STEPS_PER_CUBIC_MM_E * EXTUDER_ADVANCE_K * cubic mm per second ^ 2
130
+//
131
+// hooke's law says:		force = k * distance
132
+// bernoulli's priniciple says:	v ^ 2 / 2 + g . h + pressure / density = constant
133
+// so: v ^ 2 is proportional to number of steps we advance the extruder
134
+//#define ADVANCE
135
+
136
+#ifdef ADVANCE
137
+  #define EXTRUDER_ADVANCE_K .0
138
+
139
+  #define D_FILAMENT 2.85
140
+  #define STEPS_MM_E 836
141
+  #define EXTRUTION_AREA (0.25 * D_FILAMENT * D_FILAMENT * 3.14159)
142
+  #define STEPS_PER_CUBIC_MM_E (axis_steps_per_unit[E_AXIS]/ EXTRUTION_AREA)
143
+
144
+#endif // ADVANCE
145
+
146
+// A debugging feature to compare calculated vs performed steps, to see if steps are lost by the software.
147
+//#define DEBUG_STEPS
148
+
149
+// Arc interpretation settings:
150
+#define MM_PER_ARC_SEGMENT 1
151
+#define N_ARC_CORRECTION 25
152
+
153
+const int dropsegments=5; //everything with less than this number of steps will be ignored as move and joined with the next movement
154
+
155
+//===========================================================================
156
+//=============================Buffers           ============================
157
+//===========================================================================
158
+
159
+// The number of linear motions that can be in the plan at any give time.  
160
+// 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.
161
+#if defined SDSUPPORT
162
+  #define BLOCK_BUFFER_SIZE 16   // SD,LCD,Buttons take more memory, block buffer needs to be smaller
163
+#else
164
+  #define BLOCK_BUFFER_SIZE 16 // maximize block buffer
165
+#endif
166
+
167
+
168
+//The ASCII buffer for recieving from the serial:
169
+#define MAX_CMD_SIZE 96
170
+#define BUFSIZE 4
171
+
172
+//===========================================================================
173
+//=============================  Define Defines  ============================
174
+//===========================================================================
175
+
176
+#if TEMP_SENSOR_0 > 0
177
+  #define THERMISTORHEATER_0 TEMP_SENSOR_0
178
+  #define HEATER_0_USES_THERMISTOR
179
+#endif
180
+#if TEMP_SENSOR_1 > 0
181
+  #define THERMISTORHEATER_1 TEMP_SENSOR_1
182
+  #define HEATER_1_USES_THERMISTOR
183
+#endif
184
+#if TEMP_SENSOR_2 > 0
185
+  #define THERMISTORHEATER_2 TEMP_SENSOR_2
186
+  #define HEATER_2_USES_THERMISTOR
187
+#endif
188
+#if TEMP_SENSOR_BED > 0
189
+  #define THERMISTORBED TEMP_SENSOR_BED
190
+  #define BED_USES_THERMISTOR
191
+#endif
192
+#if TEMP_SENSOR_0 == -1
193
+  #define HEATER_0_USES_AD595
194
+#endif
195
+#if TEMP_SENSOR_1 == -1
196
+  #define HEATER_1_USES_AD595
197
+#endif
198
+#if TEMP_SENSOR_2 == -1
199
+  #define HEATER_2_USES_AD595
200
+#endif
201
+#if TEMP_SENSOR_BED == -1
202
+  #define BED_USES_AD595
203
+#endif
204
+#if TEMP_SENSOR_0 == -2
205
+  #define HEATER_0_USES_MAX6675
206
+#endif
207
+
208
+#endif //__CONFIGURATION_ADV_H

+ 15
- 9
Marlin/Marlin.pde View File

@@ -254,6 +254,12 @@ void suicide()
254 254
   #endif
255 255
 }
256 256
 
257
+long millis_diff(unsigned long starttime) {
258
+  unsigned long difftime = millis() - starttime;
259
+  if (difftime > 0x8000) difftime += 0x8000;
260
+  return difftime;
261
+}
262
+
257 263
 void setup()
258 264
 { 
259 265
   setup_powerhold();
@@ -550,9 +556,9 @@ void process_commands()
550 556
       if(code_seen('S')) codenum = code_value() * 1000; // seconds to wait
551 557
       
552 558
       st_synchronize();
553
-      codenum += millis();  // keep track of when we started waiting
559
+//      codenum += millis();  // keep track of when we started waiting
554 560
       previous_millis_cmd = millis();
555
-      while(millis()  < codenum ){
561
+      while(millis_diff(previous_millis_cmd)  < codenum ){
556 562
         manage_heater();
557 563
       }
558 564
       break;
@@ -843,11 +849,11 @@ void process_commands()
843 849
         /* continue to loop until we have reached the target temp   
844 850
           _and_ until TEMP_RESIDENCY_TIME hasn't passed since we reached it */
845 851
         while((residencyStart == -1) ||
846
-              (residencyStart > -1 && (millis() - residencyStart) < TEMP_RESIDENCY_TIME*1000) ) {
852
+              (residencyStart > -1 && (millis_diff(residencyStart) < TEMP_RESIDENCY_TIME*1000) )) {
847 853
       #else
848 854
         while ( target_direction ? (isHeatingHotend(tmp_extruder)) : (isCoolingHotend(tmp_extruder)&&(CooldownNoWait==false)) ) {
849 855
       #endif //TEMP_RESIDENCY_TIME
850
-          if( (millis() - codenum) > 1000 ) 
856
+          if(millis_diff(codenum) > 1000 ) 
851 857
           { //Print Temp Reading and remaining time every 1 second while heating up/cooling down
852 858
             SERIAL_PROTOCOLPGM("T:");
853 859
             SERIAL_PROTOCOL( degHotend(tmp_extruder) ); 
@@ -857,7 +863,7 @@ void process_commands()
857 863
               SERIAL_PROTOCOLPGM(" W:");
858 864
               if(residencyStart > -1)
859 865
               {
860
-                 codenum = TEMP_RESIDENCY_TIME - ((millis() - residencyStart) / 1000);
866
+                 codenum = TEMP_RESIDENCY_TIME - (millis_diff(residencyStart) / 1000);
861 867
                  SERIAL_PROTOCOLLN( codenum );
862 868
               }
863 869
               else 
@@ -895,7 +901,7 @@ void process_commands()
895 901
         codenum = millis(); 
896 902
         while(isHeatingBed()) 
897 903
         {
898
-          if( (millis()-codenum) > 1000 ) //Print Temp Reading every 1 second while heating up.
904
+          if( millis_diff(codenum) > 1000 ) //Print Temp Reading every 1 second while heating up.
899 905
           {
900 906
             float tt=degHotend(active_extruder);
901 907
             SERIAL_PROTOCOLPGM("T:");
@@ -1293,11 +1299,11 @@ void prepare_arc_move(char isclockwise) {
1293 1299
 
1294 1300
 void manage_inactivity(byte debug) 
1295 1301
 { 
1296
-  if( (millis()-previous_millis_cmd) >  max_inactive_time ) 
1302
+  if( millis_diff(previous_millis_cmd) >  max_inactive_time ) 
1297 1303
     if(max_inactive_time) 
1298 1304
       kill(); 
1299 1305
   if(stepper_inactive_time)  
1300
-  if( (millis()-last_stepperdisabled_time) >  stepper_inactive_time ) 
1306
+  if( millis_diff(last_stepperdisabled_time) >  stepper_inactive_time ) 
1301 1307
   {
1302 1308
     if(previous_millis_cmd>last_stepperdisabled_time)
1303 1309
       last_stepperdisabled_time=previous_millis_cmd;
@@ -1309,7 +1315,7 @@ void manage_inactivity(byte debug)
1309 1315
     }
1310 1316
   }
1311 1317
   #ifdef EXTRUDER_RUNOUT_PREVENT
1312
-    if( (millis()-previous_millis_cmd) >  EXTRUDER_RUNOUT_SECONDS*1000 ) 
1318
+    if( millis_diff(previous_millis_cmd) >  EXTRUDER_RUNOUT_SECONDS*1000 ) 
1313 1319
     if(degHotend(active_extruder)>EXTRUDER_RUNOUT_MINTEMP)
1314 1320
     {
1315 1321
      bool oldstatus=READ(E0_ENABLE_PIN);

Loading…
Cancel
Save