Browse Source

Merge remote-tracking branch 'upstream/Marlin_v1' into Marlin_v1

Conflicts:
	Marlin/Configuration.h
Christian Thalhammer 13 years ago
parent
commit
d309565b56

+ 64
- 257
Marlin/Configuration.h View File

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

+ 0
- 397
Marlin/Configuration.h.GEN7 View File

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

+ 221
- 0
Marlin/Configuration_adv.h View File

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

+ 160
- 264
Marlin/Makefile View File

@@ -1,76 +1,70 @@
1
+# Sprinter Arduino Project Makefile
2
+# 
3
+# Makefile Based on:
4
+# Arduino 0011 Makefile
5
+# Arduino adaptation by mellis, eighthave, oli.keller
6
+#
7
+# This has been tested with Arduino 0022.
8
+# 
9
+# This makefile allows you to build sketches from the command line
10
+# without the Arduino environment (or Java).
11
+#
12
+# Detailed instructions for using the makefile:
13
+#
14
+#  1. Modify the line containg "INSTALL_DIR" to point to the directory that
15
+#     contains the Arduino installation (for example, under Mac OS X, this
16
+#     might be /Applications/arduino-0012).
17
+#
18
+#  2. Modify the line containing "PORT" to refer to the filename
19
+#     representing the USB or serial connection to your Arduino board
20
+#     (e.g. PORT = /dev/tty.USB0).  If the exact name of this file
21
+#     changes, you can use * as a wildcard (e.g. PORT = /dev/tty.usb*).
22
+#
23
+#  3. Set the line containing "MCU" to match your board's processor. 
24
+#     Older one's are atmega8 based, newer ones like Arduino Mini, Bluetooth
25
+#     or Diecimila have the atmega168.  If you're using a LilyPad Arduino,
26
+#     change F_CPU to 8000000.
27
+#
28
+#  4. Type "make" and press enter to compile/verify your program.
29
+#
30
+#  5. Type "make upload", reset your Arduino board, and press enter to
31
+#     upload your program to the Arduino board.
32
+#
33
+# $Id$
34
+
35
+#For "old" Arduino Mega
36
+MCU = atmega1280
37
+#For Arduino Mega2560
38
+#MCU = atmega2560
39
+#For Sanguinololu
40
+#MCU = atmega644p 
41
+
42
+#Arduino install directory
43
+INSTALL_DIR = ../../arduino-0022/
44
+
45
+F_CPU = 16000000
46
+
47
+UPLOAD_RATE = 115200
48
+AVRDUDE_PROGRAMMER = arduino
49
+PORT = /dev/arduino
50
+
1 51
 TARGET = $(notdir $(CURDIR))
2
-# CHANGE BELOW:
3
-#~ INSTALL_DIR = /Applications/Arduino.app/Contents/Resources/Java
4
-INSTALL_DIR = /home/bkubicek/software/arduino-0023
5
-#~ PORT = /dev/cu.usbserial*
6
-PORT = /dev/ttyACM0
7
-
8
-# Get these values from:
9
-#     $(INSTALL_DIR)/hardware/boards.txt
10
-#     (arduino-0022/hardware/arduino/boards.txt)
11
-# The values below are for the "Arduino Duemilanove or Nano w/ ATmega328"
12
-# now for "Arduino Mega 2560"
13
-UPLOAD_SPEED = 115200
14
-UPLOAD_PROTOCOL = stk500v2
15
-BUILD_MCU = atmega2560
16
-BUILD_F_CPU = 16000000L
17
-TERM=bash
18
-
19
-# getting undefined reference to `__cxa_pure_virtual'
20
-#~ [http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1254180518 Arduino Forum - Makefile]
21
-#~ http://www.arduino.cc/playground/OpenBSD/CLI
22
-#~ [http://arduino.cc/forum/index.php?topic=52041.0 A "simple" makefile for Arduino]
23
-#~ [http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1275488191 Arduino Forum - Configuring avr-gcc options in arduino IDE]
24
-# found in /usr/lib/gcc/avr/4.3.5/cc1plus; fixed with -Wl,--gc-section
52
+
25 53
 
26 54
 ############################################################################
27 55
 # Below here nothing should be changed...
28 56
 
29
-LINKORDER=\
30
-applet/Marlin.cpp.o \
31
-applet/EEPROM.o  \
32
-applet/main.o \
33
-applet/MarlinSerial.o \
34
-applet/motion_control.o\
35
-applet/pins_arduino.o\
36
-applet/planner.o\
37
-applet/Print.o\
38
-applet/Sd2Card.o\
39
-applet/SdBaseFile.o\
40
-applet/SdFatUtil.o\
41
-applet/SdFile.o\
42
-applet/SdVolume.o\
43
-applet/stepper.o\
44
-applet/temperature.o\
45
-applet/WInterrupts.o\
46
-applet/wiring_analog.o\
47
-applet/wiring_digital.o\
48
-applet/wiring.o\
49
-applet/wiring_pulse.o\
50
-applet/wiring_shift.o\
51
-applet/WMath.o
52
-
53
-PDES=Marlin.pde  ultralcd.pde  watchdog.pde cardreader.pde  
54 57
 ARDUINO = $(INSTALL_DIR)/hardware/arduino/cores/arduino
55
-#
56
-#~ AVR_TOOLS_PATH = $(INSTALL_DIR)/hardware/tools/avr/bin
57
-# in Ubuntu, avr-gcc is installed separate;
58
-# only avrdude comes with the IDE
59
-AVR_TOOLS_PATH = /usr/bin
60
-AVR_DUDE_PATH = $(INSTALL_DIR)/hardware/tools
61
-#
62
-SRC = $(ARDUINO)/pins_arduino.c $(ARDUINO)/wiring.c \
63
-    $(ARDUINO)/wiring_analog.c $(ARDUINO)/wiring_digital.c \
64
-    $(ARDUINO)/wiring_pulse.c \
65
-    $(ARDUINO)/wiring_shift.c $(ARDUINO)/WInterrupts.c
66
-# added applet/$(TARGET).cpp as in IDE 0022
67
-CXXSRC = $(ARDUINO)/HardwareSerial.cpp $(ARDUINO)/WMath.cpp \
68
-    $(ARDUINO)/Print.cpp \
69
-    $(ARDUINO)/main.cpp
70
-#    applet/$(TARGET).cpp # no need, having a rule now for applet/$(TARGET).cpp.o
71
-# added main.cpp, as in 0022
58
+AVR_TOOLS_PATH = 
59
+SRC =  $(ARDUINO)/pins_arduino.c $(ARDUINO)/wiring.c \
60
+	$(ARDUINO)/wiring_analog.c $(ARDUINO)/wiring_digital.c \
61
+	$(ARDUINO)/wiring_pulse.c \
62
+	$(ARDUINO)/wiring_shift.c $(ARDUINO)/WInterrupts.c
63
+CXXSRC = $(ARDUINO)/WMath.cpp $(ARDUINO)/WString.cpp\
64
+	$(ARDUINO)/Print.cpp Marlin.cpp MarlinSerial.cpp Sd2Card.cpp SdBaseFile.cpp SdFatUtil.cpp SdFile.cpp SdVolume.cpp motion_control.cpp planner.cpp stepper.cpp temperature.cpp cardreader.cpp
72 65
 FORMAT = ihex
73 66
 
67
+
74 68
 # Name of this Makefile (used for "make depend").
75 69
 MAKEFILE = Makefile
76 70
 
@@ -79,192 +73,133 @@ MAKEFILE = Makefile
79 73
 # AVR (extended) COFF requires stabs, plus an avr-objcopy run.
80 74
 DEBUG = stabs
81 75
 
82
-OPT = 2
76
+OPT = s
83 77
 
84 78
 # Place -D or -U options here
85
-#~ CDEFS = -DBUILD_F_CPU=$(BUILD_F_CPU)
86
-#~ CXXDEFS = -DBUILD_F_CPU=$(BUILD_F_CPU)
87
-# now called DF_CPU
88
-CDEFS = -DF_CPU=$(BUILD_F_CPU) -DARDUINO=23
89
-CXXDEFS = -DF_CPU=$(BUILD_F_CPU) -DARDUINO=23
79
+CDEFS = -DF_CPU=$(F_CPU)
80
+CXXDEFS = -DF_CPU=$(F_CPU)
90 81
 
91 82
 # Place -I options here
92
-CINCS = -I$(ARDUINO) -I$(INSTALL_DIR)/libraries/LiquidCrystal/ -I$(INSTALL_DIR)/libraries/EEPROM/
83
+CINCS = -I$(ARDUINO)
93 84
 CXXINCS = -I$(ARDUINO)
94 85
 
95 86
 # Compiler flag to set the C Standard level.
96
-# c89 - "ANSI" C
87
+# c89   - "ANSI" C
97 88
 # gnu89 - c89 plus GCC extensions
98
-# c99 - ISO C99 standard (not yet fully implemented)
89
+# c99   - ISO C99 standard (not yet fully implemented)
99 90
 # gnu99 - c99 plus GCC extensions
100
-CSTANDARD = -std=gnu99
91
+#CSTANDARD = -std=gnu99
101 92
 CDEBUG = -g$(DEBUG)
102
-# note that typically, IDE 0022 uses -w to suppress warnings (both in cpp and c)!
103
-CWARN = -Wall
104
-#~ CWARN = -w
105
-#  "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++:
106
-CCWARN = -Wstrict-prototypes
107
-CTUNING = -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums
93
+CWARN = -Wall -Wstrict-prototypes
94
+CTUNING = -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -w -ffunction-sections -fdata-sections -DARDUINO=22
108 95
 #CEXTRA = -Wa,-adhlns=$(<:.c=.lst)
109 96
 
110
-# to eliminate pins_ardiuno warnings:
111
-# http://arduino.cc/pipermail/developers_arduino.cc/2010-December/004005.html
112
-
113
-# [http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1254180518 Arduino Forum - Makefile]
114
-#~ For building the objects files "-ffunction-sections -fdata-sections" was missing
115
-#~ and the final avr-gcc call needs "-Wl,--gc-section".
116
-CXSECTF = -fno-exceptions -ffunction-sections -fdata-sections
117
-CFINALF = -Wl,--gc-section
118
-
119
-CFLAGS = $(CDEBUG) $(CDEFS) $(CINCS) -O$(OPT) $(CWARN) $(CCWARN) $(CSTANDARD) $(CEXTRA)
120
-# added CWARN also to .cpp
121
-CXXFLAGS = $(CDEFS) $(CINCS) -O$(OPT) $(CWARN) $(CXSECTF)
122
-#ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs
97
+CFLAGS = $(CDEBUG) $(CDEFS) $(CINCS) -O$(OPT) $(CWARN) $(CEXTRA) $(CTUNING)
98
+CXXFLAGS =         $(CDEFS) $(CINCS) -O$(OPT) -Wall    $(CEXTRA) $(CTUNING)
99
+#ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs 
123 100
 LDFLAGS = -lm
124 101
 
102
+
125 103
 # Programming support using avrdude. Settings and variables.
126 104
 AVRDUDE_PORT = $(PORT)
127
-AVRDUDE_WRITE_FLASH = -U flash:w:applet/$(TARGET).hex
128
-AVRDUDE_FLAGS = -V -F \
129
-    -p $(BUILD_MCU) -P $(AVRDUDE_PORT) -c $(UPLOAD_PROTOCOL) \
130
-    -b $(UPLOAD_SPEED) -C $(INSTALL_DIR)/hardware/tools/avrdude.conf
131
-#    -b $(UPLOAD_SPEED) -C $(INSTALL_DIR)/hardware/tools/avr/etc/avrdude.conf
105
+AVRDUDE_WRITE_FLASH = -U flash:w:applet/$(TARGET).hex:i
106
+AVRDUDE_FLAGS = -D -C $(INSTALL_DIR)/hardware/tools/avrdude.conf \
107
+	-p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) \
108
+	-b $(UPLOAD_RATE)
132 109
 
133 110
 # Program settings
134
-CC = $(AVR_TOOLS_PATH)/avr-gcc
135
-CXX = $(AVR_TOOLS_PATH)/avr-g++
136
-OBJCOPY = $(AVR_TOOLS_PATH)/avr-objcopy
137
-OBJDUMP = $(AVR_TOOLS_PATH)/avr-objdump
138
-AR = $(AVR_TOOLS_PATH)/avr-ar
139
-SIZE = $(AVR_TOOLS_PATH)/avr-size
140
-NM = $(AVR_TOOLS_PATH)/avr-nm
141
-#~ AVRDUDE = $(AVR_TOOLS_PATH)/avrdude
142
-AVRDUDE = $(AVR_DUDE_PATH)/avrdude
111
+CC = $(AVR_TOOLS_PATH)avr-gcc
112
+CXX = $(AVR_TOOLS_PATH)avr-g++
113
+OBJCOPY = $(AVR_TOOLS_PATH)avr-objcopy
114
+OBJDUMP = $(AVR_TOOLS_PATH)avr-objdump
115
+AR  = $(AVR_TOOLS_PATH)avr-ar
116
+SIZE = $(AVR_TOOLS_PATH)avr-size
117
+NM = $(AVR_TOOLS_PATH)avr-nm
118
+AVRDUDE = avrdude
143 119
 REMOVE = rm -f
144 120
 MV = mv -f
145 121
 
146 122
 # Define all object files.
147
-# NOTE: obj files will be created in respective src directories (libraries or $(INSTALL_DIR));
148
-#  make clean deletes them fine
149
-# note that srcs are in libraries or other directories;
150
-# $(CXXSRC:.cpp=.o) will cause obj files to be in same loc as src files
151
-#~ OBJ = $(SRC:.c=.o) $(CXXSRC:.cpp=.o) $(ASRC:.S=.o)
152
-# to change the output directory for object files;
153
-# must change the obj list here!
154
-# and then, match to corresponding rule somehow?
155
-# or leave this - and parse in rule (auth automatic variable $(@F))?
156
-# "Suffix Replacement"
157
-CXXSRC+=MarlinSerial.cpp    SdBaseFile.cpp  stepper.cpp motion_control.cpp SdFatUtil.cpp temperature.cpp planner.cpp SdFile.cpp Sd2Card.cpp SdVolume.cpp
158
-OBJ = $(SRC:.c=.o) $(CXXSRC:.cpp=.o) $(ASRC:.S=.o)
159
-
160
-# added - OBJ list, transformed into applet/
161
-OBJT = $(addprefix applet/,$(notdir $(OBJ)))
162
-ALLSRC = $(SRC) $(CXXSRC) $(ASRC)
123
+OBJ = $(SRC:.c=.o) $(CXXSRC:.cpp=.o) $(ASRC:.S=.o) 
163 124
 
164 125
 # Define all listing files.
165 126
 LST = $(ASRC:.S=.lst) $(CXXSRC:.cpp=.lst) $(SRC:.c=.lst)
166 127
 
167 128
 # Combine all necessary flags and optional flags.
168 129
 # Add target processor to flags.
169
-ALL_CFLAGS = -mmcu=$(BUILD_MCU) -I. $(CFLAGS)
170
-ALL_CXXFLAGS = -mmcu=$(BUILD_MCU) -I. $(CXXFLAGS)
171
-ALL_ASFLAGS = -mmcu=$(BUILD_MCU) -I. -x assembler-with-cpp $(ASFLAGS)
172
-
173
-# depended libraries of .pde need to be added from
174
-# $(INSTALL_DIR)/libraries (TODO: and/or ~/sketchbook/libraries)
175
-# grep for 'include', test if exists, add...
176
-# note: prefix "a real tab character" http://www.delorie.com/djgpp/doc/ug/larger/makefiles.html
177
-# $$ to escape $ for shell;
178
-# note: must NOT put comments # inside bash execution;
179
-# those would get removed by make; making shell see "EOF in backquote substitution"
180
-#		 echo $$ix ; \
181
-# 'shell' twice - for each subprocess! Backtick doesn't get expanded?
182
-GREPRES:=$(shell for ix in $(shell grep include $(TARGET).pde | sed 's/.*[<"]\(.*\).h[>"].*/\1/'); do \
183
-		if [ -d $(INSTALL_DIR)/libraries/$$ix ] ; then \
184
-			LINCS="$$LINCS -I$(INSTALL_DIR)/libraries/$$ix" ;\
185
-		fi; \
186
-	done; \
187
-	echo $$LINCS)
188
-# append includes:
189
-CINCS += $(GREPRES)
190
-CXXINCS += $(GREPRES)
191
-# append library source .cpp files too (CXXSRC)
192
-GREPRESB:=$(shell for ix in $(shell grep include $(TARGET).pde | sed 's/.*[<"]\(.*\).h[>"].*/\1/'); do \
193
-		if [ -d $(INSTALL_DIR)/libraries/$$ix ] ; then \
194
-			CPPSRCS="$$CPPSRCS $(INSTALL_DIR)/libraries/$$ix/*.cpp" ;\
195
-		fi; \
196
-	done; \
197
-	echo $$CPPSRCS)
198
-CXXSRC += $(GREPRESB)
199
-# added - only CXX obj from libraries:
200
-CXXLIBOBJ = $(GREPRESB:.cpp=.o)
130
+ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS)
131
+ALL_CXXFLAGS = -mmcu=$(MCU) -I. $(CXXFLAGS)
132
+ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
201 133
 
202
-# Default target.
203
-all: applet_files build sizeafter
204
-
205
-build: elf hex
206
-
207
-applet_files: $(TARGET).pde
208
-    # Here is the "preprocessing".
209
-    # It creates a .cpp file based with the same name as the .pde file.
210
-    # On top of the new .cpp file comes the WProgram.h header.
211
-    # At the end there is a generic main() function attached.
212
-    # Then the .cpp file will be compiled. Errors during compile will
213
-    # refer to this new, automatically generated, file.
214
-    # Not the original .pde file you actually edit...
215
-	test -d applet || mkdir applet
216
-    # @ supresses printout of the cmdline itself; so only the out of echo is printed
217
-	@echo ALL OBJT: $(OBJT)
218
-	@echo ALL CXXLIBOBJ: $(CXXLIBOBJ)
219
-#	echo '#include "WProgram.h"' > applet/$(TARGET).cpp
220
-	@echo "#include \"WProgram.h\"\nvoid setup();\nvoid loop();\n" > applet/$(TARGET).cpp
221
-	##cat $(TARGET).pde >> applet/$(TARGET).cpp
222
-	cat ${PDES}>> applet/$(TARGET).cpp
223
-	cp *.cpp applet/
224
-    # no more need to cat main.cpp (v0022) - now it is compiled in
225
-#	cat $(ARDUINO)/main.cpp >> applet/$(TARGET).cpp
226 134
 
135
+# Default target.
136
+all: build sizeafter
137
+
138
+build: elf hex 
139
+
140
+applet/$(TARGET).cpp: $(TARGET).pde $(MAKEFILE)
141
+# Here is the "preprocessing".
142
+# It creates a .cpp file based with the same name as the .pde file.
143
+# On top of the new .cpp file comes the WProgram.h header.
144
+# At the end there is a generic main() function attached.
145
+# Then the .cpp file will be compiled. Errors during compile will
146
+# refer to this new, automatically generated, file. 
147
+# Not the original .pde file you actually edit...
148
+	@echo "  WR    applet/$(TARGET).cpp"
149
+	@test -d applet || mkdir applet
150
+	@echo '#include "WProgram.h"' > applet/$(TARGET).cpp
151
+	@cat $(TARGET).pde >> applet/$(TARGET).cpp
152
+	@cat $(ARDUINO)/main.cpp >> applet/$(TARGET).cpp
227 153
 
228 154
 elf: applet/$(TARGET).elf
229 155
 hex: applet/$(TARGET).hex
230 156
 eep: applet/$(TARGET).eep
231
-lss: applet/$(TARGET).lss
157
+lss: applet/$(TARGET).lss 
232 158
 sym: applet/$(TARGET).sym
233 159
 
234
-# Program the device.
160
+# Program the device.  
235 161
 upload: applet/$(TARGET).hex
162
+	stty hup < $(PORT); true
236 163
 	$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH)
164
+	stty -hup < $(PORT); true
237 165
 
238
-# Display size of file.
166
+
167
+	# Display size of file.
239 168
 HEXSIZE = $(SIZE) --target=$(FORMAT) applet/$(TARGET).hex
240
-ELFSIZE = $(SIZE) applet/$(TARGET).elf
169
+ELFSIZE = $(SIZE)  applet/$(TARGET).elf
241 170
 sizebefore:
242 171
 	@if [ -f applet/$(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(HEXSIZE); echo; fi
243 172
 
244 173
 sizeafter:
245
-	@if [ -f applet/$(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(HEXSIZE); echo; fi
174
+	@if [ -f applet/$(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi
175
+
246 176
 
247 177
 # Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
248 178
 COFFCONVERT=$(OBJCOPY) --debugging \
249
-    --change-section-address .data-0x800000 \
250
-    --change-section-address .bss-0x800000 \
251
-    --change-section-address .noinit-0x800000 \
252
-    --change-section-address .eeprom-0x810000
179
+	--change-section-address .data-0x800000 \
180
+	--change-section-address .bss-0x800000 \
181
+	--change-section-address .noinit-0x800000 \
182
+	--change-section-address .eeprom-0x810000 
183
+
253 184
 
254 185
 coff: applet/$(TARGET).elf
255 186
 	$(COFFCONVERT) -O coff-avr applet/$(TARGET).elf $(TARGET).cof
256 187
 
188
+
257 189
 extcoff: $(TARGET).elf
258 190
 	$(COFFCONVERT) -O coff-ext-avr applet/$(TARGET).elf $(TARGET).cof
259 191
 
192
+
260 193
 .SUFFIXES: .elf .hex .eep .lss .sym
194
+.PRECIOUS: .o
261 195
 
262 196
 .elf.hex:
263
-	$(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
197
+	@echo "  COPY  $@"
198
+	@$(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
264 199
 
265 200
 .elf.eep:
266
-    -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
267
-    --change-section-lma .eeprom=0 -O $(FORMAT) $< $@
201
+	-$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
202
+		--change-section-lma .eeprom=0 -O $(FORMAT) $< $@
268 203
 
269 204
 # Create extended listing file from ELF output file.
270 205
 .elf.lss:
@@ -274,79 +209,40 @@ extcoff: $(TARGET).elf
274 209
 .elf.sym:
275 210
 	$(NM) -n $< > $@
276 211
 
277
-# Link: create ELF output file from library.
278
-# NOTE: applet/$(TARGET).cpp.o MUST BE BEFORE applet/core.a
279
-#  in the dependency list, so its rule runs first!
280
-applet/$(TARGET).elf: $(TARGET).pde applet/$(TARGET).cpp.o applet/core.a
281
-#	$(CC) $(ALL_CFLAGS) -o $@ applet/$(TARGET).cpp -L. applet/core.a $(LDFLAGS)
282
-# changed as in IDE v0022: link cpp obj files
283
-	@echo $$(tput bold)$$(tput setaf 2) $(CC) $$(tput sgr0) $(ALL_CFLAGS) $(CFINALF) -o $@ applet/$(TARGET).cpp.o $(CXXOBJ) -L. applet/core.a $(LDFLAGS)
284
-	echo ${OBJT}
285
-	#$(CC) $(ALL_CFLAGS) $(CFINALF) -o $@  applet/$(TARGET).cpp.o  -L. applet/core.a $(LDFLAGS)
286
-	$(CC) $(ALL_CFLAGS) $(CFINALF) -o $@ ${LINKORDER}   $(LDFLAGS)
287
-	#@$(CC) $(ALL_CFLAGS) $(CFINALF) -o $@ applet/*.o applet/$(TARGET).cpp.o $(CXXOBJ) -L. applet/core.a $(LDFLAGS)
288
-
289
-# added: cpp.o depends on cpp (and .pde which generates it)
290
-# $< "first item in the dependencies list"; $@ "left side of the :"; $^ "right side of the :"
291
-# http://www.cs.colby.edu/maxwell/courses/tutorials/maketutor/
292
-applet/$(TARGET).cpp.o: applet/$(TARGET).cpp
293
-	@echo $$(tput bold) $(CXX) $$(tput sgr0) -c $(ALL_CXXFLAGS) $< -o $@
294
-	@$(CXX) -c $(ALL_CXXFLAGS) $< -o $@
212
+	# Link: create ELF output file from library.
213
+applet/$(TARGET).elf: applet/$(TARGET).cpp applet/core.a Configuration.h
214
+	@echo "  CXX   $@"
215
+	@$(CC) $(ALL_CXXFLAGS) -Wl,--gc-sections -o $@ applet/$(TARGET).cpp -L. applet/core.a $(LDFLAGS)
295 216
 
296
-#~ applet/core.a: $(OBJ)
297
-#~	 @for i in $(OBJ); do echo $(AR) rcs applet/core.a $$i; $(AR) rcs applet/core.a $$i; done
298
-
299
-applet/core.a: $(OBJT)
300
-	 @for i in $(OBJT); do echo $(AR) rcs applet/core.a $$i; $(AR) rcs applet/core.a $$i; done
301
-
302
-# iterate through OBJ to find the original location; then build depending on source extension
303
-# TODO: add handling of assembler files
304
-applet/%.o:
305
-	@for iob in $(OBJ); do \
306
-		if [ "`basename $$iob`" = "`basename $@`" ]; then \
307
-			for ios in $(ALLSRC); do \
308
-				if [ "$${iob%%.*}" = "$${ios%%.*}" ]; then \
309
-					case $${ios##*.} in \
310
-						"cpp") \
311
-							echo "$$(tput bold)$$(tput setaf 1) $(CXX) $$(tput sgr0) -c $(ALL_CXXFLAGS) $$ios -o $@"; \
312
-							$(CXX) -c $(ALL_CXXFLAGS) $$ios -o $@;; \
313
-						"c") \
314
-							echo "$$(tput bold)$$(tput setaf 1) $(CC) $$(tput sgr0) -c $(ALL_CFLAGS) $$ios -o $@"; \
315
-							$(CC) -c $(ALL_CFLAGS) $$ios -o $@;; \
316
-					esac; \
317
-				fi; \
318
-			done; \
319
-		fi; \
320
-	done;
321
-
322
-#~ # Compile: create object files from C++ source files.
323
-#~ .cpp.o:
324
-#~	 $(CXX) -c $(ALL_CXXFLAGS) $< -o $@
325
-
326
-#~ # Compile: create object files from C source files.
327
-#~ .c.o:
328
-#~	 $(CC) -c $(ALL_CFLAGS) $< -o $@
329
-
330
-#~ # Compile: create assembler files from C source files.
331
-#~ .c.s:
332
-#~	 $(CC) -S $(ALL_CFLAGS) $< -o $@
333
-
334
-#~ # Assemble: create object files from assembler source files.
335
-#~ .S.o:
336
-#~	 $(CC) -c $(ALL_ASFLAGS) $< -o $@
337
-
338
-#~ # Automatic dependencies
339
-#~ %.d: %.c
340
-#~	 $(CC) -M $(ALL_CFLAGS) $< | sed "s;$(notdir $*).o:;$*.o $*.d:;" > $@
341
-
342
-#~ %.d: %.cpp
343
-#~	 $(CXX) -M $(ALL_CXXFLAGS) $< | sed "s;$(notdir $*).o:;$*.o $*.d:;" > $@
217
+applet/core.a: $(OBJ) Configuration.h
218
+	@for i in $(OBJ); do echo "  AR    $$i"; $(AR) rcs applet/core.a $$i; done
219
+
220
+%.o: %.c Configuration.h $(MAKEFILE)
221
+	@echo "  CC    $@"
222
+	@$(CC) -c $(ALL_CFLAGS) $< -o $@
223
+
224
+%.o: %.cpp Configuration.h $(MAKEFILE)
225
+	@echo "  CXX   $@"
226
+	@$(CXX) -c $(ALL_CXXFLAGS) $< -o $@
344 227
 
345 228
 # Target: clean project.
346 229
 clean:
347
-	$(REMOVE) applet/$(TARGET).hex applet/$(TARGET).eep applet/$(TARGET).cof applet/$(TARGET).elf \
348
-        applet/$(TARGET).map applet/$(TARGET).sym applet/$(TARGET).lss applet/core.a \
349
-        $(OBJT) applet/$(TARGET).cpp.o \
350
-        $(OBJ) $(LST) $(SRC:.c=.s) $(SRC:.c=.d) $(CXXSRC:.cpp=.s) $(CXXSRC:.cpp=.d)
351
-
352
-.PHONY: all build elf hex eep lss sym program coff extcoff clean applet_files sizebefore sizeafter
230
+	@echo "  RM    applet/*"
231
+	@$(REMOVE) applet/$(TARGET).hex applet/$(TARGET).eep applet/$(TARGET).cof applet/$(TARGET).elf \
232
+		applet/$(TARGET).map applet/$(TARGET).sym applet/$(TARGET).lss applet/$(TARGET).cpp applet/core.a \
233
+		$(OBJ) $(LST) $(SRC:.c=.s) $(SRC:.c=.d) $(CXXSRC:.cpp=.s) $(CXXSRC:.cpp=.d)
234
+	@echo "  RMDIR applet/"
235
+	@rmdir applet
236
+
237
+depend:
238
+	if grep '^# DO NOT DELETE' $(MAKEFILE) >/dev/null; \
239
+	then \
240
+		sed -e '/^# DO NOT DELETE/,$$d' $(MAKEFILE) > \
241
+			$(MAKEFILE).$$$$ && \
242
+		$(MV) $(MAKEFILE).$$$$ $(MAKEFILE); \
243
+	fi
244
+	echo '# DO NOT DELETE THIS LINE -- make depend depends on it.' \
245
+		>> $(MAKEFILE); \
246
+	$(CC) -M -mmcu=$(MCU) $(CDEFS) $(CINCS) $(SRC) $(ASRC) >> $(MAKEFILE)
247
+
248
+.PHONY:	all build elf hex eep lss sym program coff extcoff clean depend applet_files sizebefore sizeafter

+ 14
- 10
Marlin/Marlin.h View File

@@ -14,7 +14,7 @@
14 14
 #include <string.h>
15 15
 #include <inttypes.h>
16 16
 
17
-#include <avr/delay.h>
17
+#include <util/delay.h>
18 18
 #include <avr/pgmspace.h>
19 19
 #include <avr/eeprom.h>
20 20
 #include  <avr/wdt.h>
@@ -46,7 +46,11 @@
46 46
 
47 47
 #include "WString.h"
48 48
 
49
-
49
+#if MOTHERBOARD == 8  // Teensylu
50
+  #define MYSERIAL Serial
51
+#else
52
+  #define MYSERIAL MSerial
53
+#endif
50 54
 
51 55
 //this is a unfinsihed attemp to removes a lot of warning messages, see:
52 56
 // http://www.avrfreaks.net/index.php?name=PNphpBB2&file=printview&t=57011
@@ -54,19 +58,19 @@
54 58
 // //#define PSTR    (s )        ((const PROGMEM char *)(s))
55 59
 // //# define MYPGM(s) (__extension__({static prog_char __c[] = (s); &__c[0];})) 
56 60
 // //#define MYPGM(s) ((const prog_char *g PROGMEM=s))
57
-// //#define MYPGM(s) PSTR(s)
58
-#define MYPGM(s)  (__extension__({static char __c[] __attribute__((__progmem__)) = (s); &__c[0];}))  //This is the normal behaviour
61
+#define MYPGM(s) PSTR(s)
62
+//#define MYPGM(s)  (__extension__({static char __c[] __attribute__((__progmem__)) = (s); &__c[0];}))  //This is the normal behaviour
59 63
 //#define MYPGM(s)  (__extension__({static prog_char __c[]  = (s); &__c[0];})) //this does not work but hides the warnings
60 64
 
61 65
 
62
-#define SERIAL_PROTOCOL(x) MSerial.print(x);
66
+#define SERIAL_PROTOCOL(x) MYSERIAL.print(x);
63 67
 #define SERIAL_PROTOCOLPGM(x) serialprintPGM(MYPGM(x));
64
-#define SERIAL_PROTOCOLLN(x) {MSerial.print(x);MSerial.write('\n');}
65
-#define SERIAL_PROTOCOLLNPGM(x) {serialprintPGM(MYPGM(x));MSerial.write('\n');}
68
+#define SERIAL_PROTOCOLLN(x) {MYSERIAL.print(x);MYSERIAL.write('\n');}
69
+#define SERIAL_PROTOCOLLNPGM(x) {serialprintPGM(MYPGM(x));MYSERIAL.write('\n');}
66 70
 
67 71
 
68
-const prog_char errormagic[] PROGMEM ="Error:";
69
-const prog_char echomagic[] PROGMEM ="echo:";
72
+const char errormagic[] PROGMEM ="Error:";
73
+const char echomagic[] PROGMEM ="echo:";
70 74
 #define SERIAL_ERROR_START serialprintPGM(errormagic);
71 75
 #define SERIAL_ERROR(x) SERIAL_PROTOCOL(x)
72 76
 #define SERIAL_ERRORPGM(x) SERIAL_PROTOCOLPGM(x)
@@ -89,7 +93,7 @@ FORCE_INLINE void serialprintPGM(const char *str)
89 93
   char ch=pgm_read_byte(str);
90 94
   while(ch)
91 95
   {
92
-    MSerial.write(ch);
96
+    MYSERIAL.write(ch);
93 97
     ch=pgm_read_byte(++str);
94 98
   }
95 99
 }

+ 49
- 51
Marlin/Marlin.pde View File

@@ -27,8 +27,6 @@
27 27
 
28 28
 #include "Marlin.h"
29 29
 
30
-
31
-
32 30
 #include "ultralcd.h"
33 31
 #include "planner.h"
34 32
 #include "stepper.h"
@@ -38,12 +36,7 @@
38 36
 #include "watchdog.h"
39 37
 #include "EEPROMwrite.h"
40 38
 
41
-
42
-
43
-#define VERSION_STRING  "1.0.0 Beta 1"
44
-
45
-
46
-
39
+#define VERSION_STRING  "1.0.0 RC1"
47 40
 
48 41
 // look here for descriptions of gcodes: http://linuxcnc.org/handbook/gcode/g-code.html
49 42
 // http://objects.reprap.org/wiki/Mendel_User_Manual:_RepRapGCodes
@@ -147,15 +140,11 @@ static bool home_all_axis = true;
147 140
 static float feedrate = 1500.0, next_feedrate, saved_feedrate;
148 141
 static long gcode_N, gcode_LastN;
149 142
 
150
-
151
-
152 143
 static bool relative_mode = false;  //Determines Absolute or Relative Coordinates
153 144
 static bool relative_mode_e = false;  //Determines Absolute or Relative E Codes while in Absolute Coordinates mode. E is always relative in Relative Coordinates mode.
154 145
 
155 146
 static uint8_t fanpwm=0;
156 147
 
157
-
158
-
159 148
 static char cmdbuffer[BUFSIZE][MAX_CMD_SIZE];
160 149
 static bool fromsd[BUFSIZE];
161 150
 static int bufindr = 0;
@@ -175,8 +164,7 @@ const int sensitive_pins[] = SENSITIVE_PINS; // Sensitive pin list for M42
175 164
 //Inactivity shutdown variables
176 165
 static unsigned long previous_millis_cmd = 0;
177 166
 static unsigned long max_inactive_time = 0;
178
-static unsigned long stepper_inactive_time = DEFAULT_STEPPER_DEACTIVE_TIME*1000;
179
-static unsigned long last_stepperdisabled_time=30*1000; //first release check after 30 seconds
167
+static unsigned long stepper_inactive_time = DEFAULT_STEPPER_DEACTIVE_TIME*1000l;
180 168
 
181 169
 static unsigned long starttime=0;
182 170
 static unsigned long stoptime=0;
@@ -224,6 +212,7 @@ void enquecommand(const char *cmd)
224 212
     buflen += 1;
225 213
   }
226 214
 }
215
+
227 216
 void setup_photpin()
228 217
 {
229 218
   #ifdef PHOTOGRAPH_PIN
@@ -257,10 +246,20 @@ void suicide()
257 246
 void setup()
258 247
 { 
259 248
   setup_powerhold();
260
-  MSerial.begin(BAUDRATE);
249
+  MYSERIAL.begin(BAUDRATE);
250
+  SERIAL_PROTOCOLLNPGM("start");
261 251
   SERIAL_ECHO_START;
252
+  SERIAL_ECHOPGM("Marlin: ");
262 253
   SERIAL_ECHOLNPGM(VERSION_STRING);
263
-  SERIAL_PROTOCOLLNPGM("start");
254
+  #ifdef STRING_VERSION_CONFIG_H
255
+    #ifdef STRING_CONFIG_H_AUTHOR
256
+      SERIAL_ECHO_START;
257
+      SERIAL_ECHOPGM("Configuration.h: ");
258
+      SERIAL_ECHOPGM(STRING_VERSION_CONFIG_H);
259
+      SERIAL_ECHOPGM(" | Author: ");
260
+      SERIAL_ECHOLNPGM(STRING_CONFIG_H_AUTHOR);
261
+    #endif
262
+  #endif
264 263
   SERIAL_ECHO_START;
265 264
   SERIAL_ECHOPGM("Free Memory:");
266 265
   SERIAL_ECHO(freeMemory());
@@ -326,11 +325,10 @@ void loop()
326 325
   LCD_STATUS;
327 326
 }
328 327
 
329
-
330
-FORCE_INLINE void get_command() 
328
+void get_command() 
331 329
 { 
332
-  while( MSerial.available() > 0  && buflen < BUFSIZE) {
333
-    serial_char = MSerial.read();
330
+  while( MYSERIAL.available() > 0  && buflen < BUFSIZE) {
331
+    serial_char = MYSERIAL.read();
334 332
     if(serial_char == '\n' || serial_char == '\r' || serial_char == ':' || serial_count >= (MAX_CMD_SIZE - 1) ) 
335 333
     {
336 334
       if(!serial_count) return; //if empty line
@@ -474,20 +472,20 @@ FORCE_INLINE void get_command()
474 472
 }
475 473
 
476 474
 
477
-FORCE_INLINE float code_value() 
475
+float code_value() 
478 476
 { 
479 477
   return (strtod(&cmdbuffer[bufindr][strchr_pointer - cmdbuffer[bufindr] + 1], NULL)); 
480 478
 }
481
-FORCE_INLINE long code_value_long() 
479
+long code_value_long() 
482 480
 { 
483 481
   return (strtol(&cmdbuffer[bufindr][strchr_pointer - cmdbuffer[bufindr] + 1], NULL, 10)); 
484 482
 }
485
-FORCE_INLINE bool code_seen(char code_string[]) //Return True if the string was found
483
+bool code_seen(char code_string[]) //Return True if the string was found
486 484
 { 
487 485
   return (strstr(cmdbuffer[bufindr], code_string) != NULL); 
488 486
 }  
489 487
 
490
-FORCE_INLINE bool code_seen(char code)
488
+bool code_seen(char code)
491 489
 {
492 490
   strchr_pointer = strchr(cmdbuffer[bufindr], code);
493 491
   return (strchr_pointer != NULL);  //Return True if a character was found
@@ -519,7 +517,7 @@ FORCE_INLINE bool code_seen(char code)
519 517
     endstops_hit_on_purpose();\
520 518
   }
521 519
 
522
-FORCE_INLINE void process_commands()
520
+void process_commands()
523 521
 {
524 522
   unsigned long codenum; //throw away variable
525 523
   char *starpos = NULL;
@@ -789,7 +787,7 @@ FORCE_INLINE void process_commands()
789 787
       #if (TEMP_0_PIN > -1)
790 788
         SERIAL_PROTOCOLPGM("ok T:");
791 789
         SERIAL_PROTOCOL(degHotend(tmp_extruder)); 
792
-        #if TEMP_BED_PIN > -1 
790
+        #if TEMP_BED_PIN > -1
793 791
           SERIAL_PROTOCOLPGM(" B:");  
794 792
           SERIAL_PROTOCOL(degBed());
795 793
         #endif //TEMP_BED_PIN
@@ -843,11 +841,11 @@ FORCE_INLINE void process_commands()
843 841
         /* continue to loop until we have reached the target temp   
844 842
           _and_ until TEMP_RESIDENCY_TIME hasn't passed since we reached it */
845 843
         while((residencyStart == -1) ||
846
-              (residencyStart > -1 && (millis() - residencyStart) < TEMP_RESIDENCY_TIME*1000) ) {
844
+              (residencyStart >= 0 && (((unsigned int) (millis() - residencyStart)) < (TEMP_RESIDENCY_TIME * 1000UL))) ) {
847 845
       #else
848 846
         while ( target_direction ? (isHeatingHotend(tmp_extruder)) : (isCoolingHotend(tmp_extruder)&&(CooldownNoWait==false)) ) {
849 847
       #endif //TEMP_RESIDENCY_TIME
850
-          if( (millis() - codenum) > 1000 ) 
848
+          if( (millis() - codenum) > 1000UL )
851 849
           { //Print Temp Reading and remaining time every 1 second while heating up/cooling down
852 850
             SERIAL_PROTOCOLPGM("T:");
853 851
             SERIAL_PROTOCOL( degHotend(tmp_extruder) ); 
@@ -857,13 +855,15 @@ FORCE_INLINE void process_commands()
857 855
               SERIAL_PROTOCOLPGM(" W:");
858 856
               if(residencyStart > -1)
859 857
               {
860
-                 codenum = TEMP_RESIDENCY_TIME - ((millis() - residencyStart) / 1000);
858
+                 codenum = ((TEMP_RESIDENCY_TIME * 1000UL) - (millis() - residencyStart)) / 1000UL;
861 859
                  SERIAL_PROTOCOLLN( codenum );
862 860
               }
863 861
               else 
864 862
               {
865 863
                  SERIAL_PROTOCOLLN( "?" );
866 864
               }
865
+            #else
866
+              SERIAL_PROTOCOLLN("");
867 867
             #endif
868 868
             codenum = millis();
869 869
           }
@@ -893,7 +893,7 @@ FORCE_INLINE void process_commands()
893 893
         codenum = millis(); 
894 894
         while(isHeatingBed()) 
895 895
         {
896
-          if( (millis()-codenum) > 1000 ) //Print Temp Reading every 1 second while heating up.
896
+          if(( millis() - codenum) > 1000 ) //Print Temp Reading every 1 second while heating up.
897 897
           {
898 898
             float tt=degHotend(active_extruder);
899 899
             SERIAL_PROTOCOLPGM("T:");
@@ -909,7 +909,7 @@ FORCE_INLINE void process_commands()
909 909
         LCD_MESSAGEPGM("Bed done.");
910 910
         previous_millis_cmd = millis();
911 911
     #endif
912
-    break;
912
+        break;
913 913
 
914 914
     #if FAN_PIN > -1
915 915
       case 106: //M106 Fan On
@@ -938,14 +938,13 @@ FORCE_INLINE void process_commands()
938 938
       
939 939
       case 81: // M81 - ATX Power Off
940 940
       
941
-      #if (SUICIDE_PIN >-1)
941
+      #if defined SUICIDE_PIN && SUICIDE_PIN > -1
942 942
         st_synchronize();
943 943
         suicide();
944
-      #else
945
-        #if (PS_ON_PIN > -1) 
946
-          SET_INPUT(PS_ON_PIN); //Floating
947
-        #endif
944
+      #elif (PS_ON_PIN > -1)
945
+        SET_INPUT(PS_ON_PIN); //Floating
948 946
       #endif
947
+		break;
949 948
         
950 949
     case 82:
951 950
       axis_relative_modes[3] = false;
@@ -963,6 +962,7 @@ FORCE_INLINE void process_commands()
963 962
         bool all_axis = !((code_seen(axis_codes[0])) || (code_seen(axis_codes[1])) || (code_seen(axis_codes[2]))|| (code_seen(axis_codes[3])));
964 963
         if(all_axis)
965 964
         {
965
+          st_synchronize();
966 966
           disable_e0();
967 967
           disable_e1();
968 968
           disable_e2();
@@ -1217,7 +1217,7 @@ FORCE_INLINE void process_commands()
1217 1217
 void FlushSerialRequestResend()
1218 1218
 {
1219 1219
   //char cmdbuffer[bufindr][100]="Resend:";
1220
-  MSerial.flush();
1220
+  MYSERIAL.flush();
1221 1221
   SERIAL_PROTOCOLPGM("Resend:");
1222 1222
   SERIAL_PROTOCOLLN(gcode_LastN + 1);
1223 1223
   ClearToSend();
@@ -1233,7 +1233,7 @@ void ClearToSend()
1233 1233
   SERIAL_PROTOCOLLNPGM("ok"); 
1234 1234
 }
1235 1235
 
1236
-FORCE_INLINE void get_coordinates()
1236
+void get_coordinates()
1237 1237
 {
1238 1238
   for(int8_t i=0; i < NUM_AXIS; i++) {
1239 1239
     if(code_seen(axis_codes[i])) destination[i] = (float)code_value() + (axis_relative_modes[i] || relative_mode)*current_position[i];
@@ -1245,7 +1245,7 @@ FORCE_INLINE void get_coordinates()
1245 1245
   }
1246 1246
 }
1247 1247
 
1248
-FORCE_INLINE void get_arc_coordinates()
1248
+void get_arc_coordinates()
1249 1249
 {
1250 1250
    get_coordinates();
1251 1251
    if(code_seen('I')) offset[0] = code_value();
@@ -1291,23 +1291,22 @@ void prepare_arc_move(char isclockwise) {
1291 1291
 
1292 1292
 void manage_inactivity(byte debug) 
1293 1293
 { 
1294
-  if( (millis()-previous_millis_cmd) >  max_inactive_time ) 
1294
+  if( (millis() - previous_millis_cmd) >  max_inactive_time ) 
1295 1295
     if(max_inactive_time) 
1296 1296
       kill(); 
1297
-  if(stepper_inactive_time)  
1298
-  if( (millis()-last_stepperdisabled_time) >  stepper_inactive_time ) 
1299
-  {
1300
-    if(previous_millis_cmd>last_stepperdisabled_time)
1301
-      last_stepperdisabled_time=previous_millis_cmd;
1302
-    else
1297
+  if(stepper_inactive_time)  {
1298
+    if( (millis() - previous_millis_cmd) >  stepper_inactive_time ) 
1303 1299
     {
1304
-      if(  (X_ENABLE_ON && (READ(X_ENABLE_PIN)!=0))  ||  (!X_ENABLE_ON && READ(X_ENABLE_PIN)==0)  )
1305
-        enquecommand(DEFAULT_STEPPER_DEACTIVE_COMMAND); 
1306
-      last_stepperdisabled_time=millis();
1300
+      disable_x();
1301
+      disable_y();
1302
+      disable_z();
1303
+      disable_e0();
1304
+      disable_e1();
1305
+      disable_e2();
1307 1306
     }
1308 1307
   }
1309 1308
   #ifdef EXTRUDER_RUNOUT_PREVENT
1310
-    if( (millis()-previous_millis_cmd) >  EXTRUDER_RUNOUT_SECONDS*1000 ) 
1309
+    if( (millis() - previous_millis_cmd) >  EXTRUDER_RUNOUT_SECONDS*1000 ) 
1311 1310
     if(degHotend(active_extruder)>EXTRUDER_RUNOUT_MINTEMP)
1312 1311
     {
1313 1312
      bool oldstatus=READ(E0_ENABLE_PIN);
@@ -1321,7 +1320,6 @@ void manage_inactivity(byte debug)
1321 1320
      destination[E_AXIS]=oldedes;
1322 1321
      plan_set_e_position(oldepos);
1323 1322
      previous_millis_cmd=millis();
1324
-     //enquecommand(DEFAULT_STEPPER_DEACTIVE_COMMAND);
1325 1323
      st_synchronize();
1326 1324
      WRITE(E0_ENABLE_PIN,oldstatus);
1327 1325
     }

+ 3
- 8
Marlin/MarlinSerial.cpp View File

@@ -23,20 +23,15 @@
23 23
 #include "Marlin.h"
24 24
 #include "MarlinSerial.h"
25 25
 
26
+#if MOTHERBOARD != 8 // !teensylu
26 27
 // this next line disables the entire HardwareSerial.cpp, 
27 28
 // this is so I can support Attiny series and any other chip without a uart
28 29
 #if defined(UBRRH) || defined(UBRR0H) || defined(UBRR1H) || defined(UBRR2H) || defined(UBRR3H)
29 30
 
30
-
31
-
32
-
33
-
34
-
35 31
 #if defined(UBRRH) || defined(UBRR0H)
36 32
   ring_buffer rx_buffer  =  { { 0 }, 0, 0 };
37 33
 #endif
38 34
 
39
-
40 35
 FORCE_INLINE void store_char(unsigned char c)
41 36
 {
42 37
   int i = (unsigned int)(rx_buffer.head + 1) % RX_BUFFER_SIZE;
@@ -324,11 +319,11 @@ void MarlinSerial::printFloat(double number, uint8_t digits)
324 319
     remainder -= toPrint; 
325 320
   } 
326 321
 }
327
-
328 322
 // Preinstantiate Objects //////////////////////////////////////////////////////
329 323
 
330
-MarlinSerial MSerial;
331 324
 
325
+MarlinSerial MSerial;
332 326
 
333 327
 #endif // whole file
328
+#endif //teensylu
334 329
 

+ 3
- 4
Marlin/MarlinSerial.h View File

@@ -31,7 +31,7 @@
31 31
 #define BYTE 0
32 32
 
33 33
 
34
-
34
+#if MOTHERBOARD != 8 // ! teensylu
35 35
 // Define constants and variables for buffering incoming serial data.  We're
36 36
 // using a ring buffer (I think), in which rx_buffer_head is the index of the
37 37
 // location to which to write the next incoming character and rx_buffer_tail
@@ -144,8 +144,7 @@ class MarlinSerial //: public Stream
144 144
     void println(void);
145 145
 };
146 146
 
147
-#if defined(UBRRH) || defined(UBRR0H)
148
-  extern MarlinSerial MSerial;
149
-#endif
147
+extern MarlinSerial MSerial;
148
+#endif // ! teensylu
150 149
 
151 150
 #endif

+ 23
- 25
Marlin/SdBaseFile.cpp View File

@@ -18,8 +18,6 @@
18 18
  * <http://www.gnu.org/licenses/>.
19 19
  */
20 20
 
21
-#define SERIAL MSerial
22
-
23 21
 #include "Marlin.h"
24 22
 #ifdef SDSUPPORT
25 23
 
@@ -345,38 +343,38 @@ int8_t SdBaseFile::lsPrintNext( uint8_t flags, uint8_t indent) {
345 343
       && DIR_IS_FILE_OR_SUBDIR(&dir)) break;
346 344
   }
347 345
   // indent for dir level
348
-  for (uint8_t i = 0; i < indent; i++) MSerial.write(' ');
346
+  for (uint8_t i = 0; i < indent; i++) MYSERIAL.write(' ');
349 347
 
350 348
   // print name
351 349
   for (uint8_t i = 0; i < 11; i++) {
352 350
     if (dir.name[i] == ' ')continue;
353 351
     if (i == 8) {
354
-      MSerial.write('.');
352
+      MYSERIAL.write('.');
355 353
       w++;
356 354
     }
357
-    MSerial.write(dir.name[i]);
355
+    MYSERIAL.write(dir.name[i]);
358 356
     w++;
359 357
   }
360 358
   if (DIR_IS_SUBDIR(&dir)) {
361
-    MSerial.write('/');
359
+    MYSERIAL.write('/');
362 360
     w++;
363 361
   }
364 362
   if (flags & (LS_DATE | LS_SIZE)) {
365
-    while (w++ < 14) MSerial.write(' ');
363
+    while (w++ < 14) MYSERIAL.write(' ');
366 364
   }
367 365
   // print modify date/time if requested
368 366
   if (flags & LS_DATE) {
369
-    MSerial.write(' ');
367
+    MYSERIAL.write(' ');
370 368
     printFatDate( dir.lastWriteDate);
371
-    MSerial.write(' ');
369
+    MYSERIAL.write(' ');
372 370
     printFatTime( dir.lastWriteTime);
373 371
   }
374 372
   // print size if requested
375 373
   if (!DIR_IS_SUBDIR(&dir) && (flags & LS_SIZE)) {
376
-    MSerial.write(' ');
377
-    MSerial.print(dir.fileSize);
374
+    MYSERIAL.write(' ');
375
+    MYSERIAL.print(dir.fileSize);
378 376
   }
379
-  MSerial.println();
377
+  MYSERIAL.println();
380 378
   return DIR_IS_FILE(&dir) ? 1 : 2;
381 379
 }
382 380
 //------------------------------------------------------------------------------
@@ -947,26 +945,26 @@ void SdBaseFile::printDirName(const dir_t& dir,
947 945
   for (uint8_t i = 0; i < 11; i++) {
948 946
     if (dir.name[i] == ' ')continue;
949 947
     if (i == 8) {
950
-      MSerial.write('.');
948
+      MYSERIAL.write('.');
951 949
       w++;
952 950
     }
953
-    MSerial.write(dir.name[i]);
951
+    MYSERIAL.write(dir.name[i]);
954 952
     w++;
955 953
   }
956 954
   if (DIR_IS_SUBDIR(&dir) && printSlash) {
957
-    MSerial.write('/');
955
+    MYSERIAL.write('/');
958 956
     w++;
959 957
   }
960 958
   while (w < width) {
961
-    MSerial.write(' ');
959
+    MYSERIAL.write(' ');
962 960
     w++;
963 961
   }
964 962
 }
965 963
 //------------------------------------------------------------------------------
966 964
 // print uint8_t with width 2
967 965
 static void print2u( uint8_t v) {
968
-  if (v < 10) MSerial.write('0');
969
-  MSerial.print(v, DEC);
966
+  if (v < 10) MYSERIAL.write('0');
967
+  MYSERIAL.print(v, DEC);
970 968
 }
971 969
 //------------------------------------------------------------------------------
972 970
 /** %Print a directory date field to Serial.
@@ -985,10 +983,10 @@ static void print2u( uint8_t v) {
985 983
  * \param[in] fatDate The date field from a directory entry.
986 984
  */
987 985
 void SdBaseFile::printFatDate(uint16_t fatDate) {
988
-  MSerial.print(FAT_YEAR(fatDate));
989
-  MSerial.write('-');
986
+  MYSERIAL.print(FAT_YEAR(fatDate));
987
+  MYSERIAL.write('-');
990 988
   print2u( FAT_MONTH(fatDate));
991
-  MSerial.write('-');
989
+  MYSERIAL.write('-');
992 990
   print2u( FAT_DAY(fatDate));
993 991
 }
994 992
 
@@ -1002,9 +1000,9 @@ void SdBaseFile::printFatDate(uint16_t fatDate) {
1002 1000
  */
1003 1001
 void SdBaseFile::printFatTime( uint16_t fatTime) {
1004 1002
   print2u( FAT_HOUR(fatTime));
1005
-  MSerial.write(':');
1003
+  MYSERIAL.write(':');
1006 1004
   print2u( FAT_MINUTE(fatTime));
1007
-  MSerial.write(':');
1005
+  MYSERIAL.write(':');
1008 1006
   print2u( FAT_SECOND(fatTime));
1009 1007
 }
1010 1008
 //------------------------------------------------------------------------------
@@ -1016,7 +1014,7 @@ void SdBaseFile::printFatTime( uint16_t fatTime) {
1016 1014
 bool SdBaseFile::printName() {
1017 1015
   char name[13];
1018 1016
   if (!getFilename(name)) return false;
1019
-  MSerial.print(name);
1017
+  MYSERIAL.print(name);
1020 1018
   return true;
1021 1019
 }
1022 1020
 //------------------------------------------------------------------------------
@@ -1790,4 +1788,4 @@ void (*SdBaseFile::oldDateTime_)(uint16_t& date, uint16_t& time) = 0;  // NOLINT
1790 1788
 #endif  // ALLOW_DEPRECATED_FUNCTIONS
1791 1789
 
1792 1790
 
1793
-#endif
1791
+#endif

+ 2
- 2
Marlin/SdFatUtil.cpp View File

@@ -48,7 +48,7 @@ int SdFatUtil::FreeRam() {
48 48
  * \param[in] str Pointer to string stored in flash memory.
49 49
  */
50 50
 void SdFatUtil::print_P( PGM_P str) {
51
-  for (uint8_t c; (c = pgm_read_byte(str)); str++) MSerial.write(c);
51
+  for (uint8_t c; (c = pgm_read_byte(str)); str++) MYSERIAL.write(c);
52 52
 }
53 53
 //------------------------------------------------------------------------------
54 54
 /** %Print a string in flash memory followed by a CR/LF.
@@ -58,7 +58,7 @@ void SdFatUtil::print_P( PGM_P str) {
58 58
  */
59 59
 void SdFatUtil::println_P( PGM_P str) {
60 60
   print_P( str);
61
-  MSerial.println();
61
+  MYSERIAL.println();
62 62
 }
63 63
 //------------------------------------------------------------------------------
64 64
 /** %Print a string in flash memory to Serial.

Marlin/cardreader.pde → Marlin/cardreader.cpp View File

@@ -1,5 +1,8 @@
1 1
 #include "Marlin.h"
2 2
 #include "cardreader.h"
3
+#include "ultralcd.h"
4
+#include "stepper.h"
5
+#include "temperature.h"
3 6
 #ifdef SDSUPPORT
4 7
 
5 8
 
@@ -444,7 +447,9 @@ void CardReader::printingHasFinished()
444 447
  st_synchronize();
445 448
  quickStop();
446 449
  sdprinting = false;
450
+ #ifdef STOP_HEATING_WAIT_FOR_SD_PRINTING
447 451
  stop_heating_wait=true;
452
+ #endif
448 453
  if(SD_FINISHED_STEPPERRELEASE)
449 454
  {
450 455
    //finishAndDisableSteppers();

+ 1
- 1
Marlin/fastio.h View File

@@ -1928,7 +1928,7 @@ pins
1928 1928
 
1929 1929
 #endif
1930 1930
 
1931
-#if defined (__AVR_AT90USB1287__)
1931
+#if defined (__AVR_AT90USB1287__) || defined (__AVR_AT90USB1286__)
1932 1932
 // SPI
1933 1933
 #define	SCK					DIO9
1934 1934
 #define	MISO				DIO11

+ 1
- 1
Marlin/motion_control.cpp View File

@@ -45,7 +45,7 @@ void mc_arc(float *position, float *target, float *offset, uint8_t axis_0, uint8
45 45
   if (isclockwise) { angular_travel -= 2*M_PI; }
46 46
   
47 47
   float millimeters_of_travel = hypot(angular_travel*radius, fabs(linear_travel));
48
-  if (millimeters_of_travel == 0.0) { return; }
48
+  if (millimeters_of_travel < 0.001) { return; }
49 49
   uint16_t segments = floor(millimeters_of_travel/MM_PER_ARC_SEGMENT);
50 50
   /*  
51 51
     // Multiply inverse feed_rate to compensate for the fact that this movement is approximated

+ 174
- 9
Marlin/pins.h View File

@@ -1,6 +1,49 @@
1 1
 #ifndef PINS_H
2 2
 #define PINS_H
3 3
 
4
+#if MOTHERBOARD == 99
5
+#define	KNOWN_BOARD 1
6
+
7
+#define X_STEP_PIN          2
8
+#define X_DIR_PIN           3
9
+#define X_ENABLE_PIN        -1
10
+#define X_MIN_PIN           -1
11
+#define X_MAX_PIN           16
12
+
13
+#define Y_STEP_PIN          5
14
+#define Y_DIR_PIN           6
15
+#define Y_ENABLE_PIN       -1
16
+#define Y_MIN_PIN           67
17
+#define Y_MAX_PIN          -1
18
+
19
+#define Z_STEP_PIN          62
20
+#define Z_DIR_PIN           63
21
+#define Z_ENABLE_PIN       -1
22
+#define Z_MIN_PIN           59
23
+#define Z_MAX_PIN          -1
24
+
25
+#define E0_STEP_PIN         65
26
+#define E0_DIR_PIN          66
27
+#define E0_ENABLE_PIN      -1
28
+
29
+#define SDPOWER            -1
30
+#define SDSS               53
31
+#define LED_PIN            -1
32
+#define FAN_PIN            -1
33
+#define PS_ON_PIN           9
34
+#define KILL_PIN           -1
35
+
36
+#define HEATER_0_PIN        13
37
+#define HEATER_1_PIN       -1
38
+#define HEATER_2_PIN       -1
39
+#define TEMP_0_PIN          6   // MUST USE ANALOG INPUT NUMBERING NOT DIGITAL OUTPUT NUMBERING!!!!!!!!!
40
+#define TEMP_1_PIN         -1   // MUST USE ANALOG INPUT NUMBERING NOT DIGITAL OUTPUT NUMBERING!!!!!!!!!
41
+#define TEMP_2_PIN         -1   // MUST USE ANALOG INPUT NUMBERING NOT DIGITAL OUTPUT NUMBERING!!!!!!!!!
42
+#define HEATER_BED_PIN      4
43
+#define TEMP_BED_PIN       10
44
+
45
+#endif /* 99 */
46
+
4 47
 /****************************************************************************************
5 48
 * Arduino pin assignment
6 49
 *
@@ -331,16 +374,17 @@
331 374
 // SPI for Max6675 Thermocouple 
332 375
 
333 376
 #ifndef SDSUPPORT
334
-// these pins are defined in the SD library if building with SD support  #define SCK_PIN          52
335
-  #define MISO_PIN         50
336
-  #define MOSI_PIN         51
377
+// these pins are defined in the SD library if building with SD support  
378
+  #define MAX_SCK_PIN          52
379
+  #define MAX_MISO_PIN         50
380
+  #define MAX_MOSI_PIN         51
337 381
   #define MAX6675_SS       53
338 382
 #else
339 383
   #define MAX6675_SS       49
340 384
 #endif
341 385
 
342
-
343 386
 #endif
387
+
344 388
 /****************************************************************************************
345 389
 * Duemilanove w/ ATMega328P pin assignment
346 390
 *
@@ -470,7 +514,7 @@
470 514
 #define X_STEP_PIN         15
471 515
 #define X_DIR_PIN          21
472 516
 #define X_MIN_PIN          18
473
-#define X_MAX_PIN           -2
517
+#define X_MAX_PIN           -1
474 518
 
475 519
 #define Y_STEP_PIN         22
476 520
 #define Y_DIR_PIN          23
@@ -658,10 +702,8 @@
658 702
 #define HEATER_0_PIN  2
659 703
 #define TEMP_0_PIN 8   
660 704
 
661
-#define EXTRUDER_1_HEATER_PIN 3
662
-#define EXTRUDER_1_TEMPERATURE_PIN 10 
663
-#define HEATER_1_PIN 51
664
-#define TEMP_1_PIN 3
705
+#define HEATER_1_PIN 3
706
+#define TEMP_1_PIN 9
665 707
 
666 708
 #define HEATER_2_PIN -1
667 709
 #define TEMP_2_PIN -1
@@ -751,6 +793,73 @@
751 793
 
752 794
 #endif
753 795
 
796
+#if MOTHERBOARD == 71
797
+#define KNOWN_BOARD
798
+/*****************************************************************
799
+* Ultimaker pin assignment (Old electronics)
800
+******************************************************************/
801
+
802
+#ifndef __AVR_ATmega1280__
803
+ #ifndef __AVR_ATmega2560__
804
+ #error Oops!  Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu.
805
+ #endif
806
+#endif
807
+
808
+#define X_STEP_PIN 25
809
+#define X_DIR_PIN 23
810
+#define X_MIN_PIN 15
811
+#define X_MAX_PIN 14
812
+#define X_ENABLE_PIN 27
813
+
814
+#define Y_STEP_PIN 31
815
+#define Y_DIR_PIN 33
816
+#define Y_MIN_PIN 17
817
+#define Y_MAX_PIN 16
818
+#define Y_ENABLE_PIN 29
819
+
820
+#define Z_STEP_PIN 37 
821
+#define Z_DIR_PIN 39
822
+#define Z_MIN_PIN 19
823
+#define Z_MAX_PIN 18
824
+#define Z_ENABLE_PIN 35
825
+
826
+#define HEATER_BED_PIN -1 
827
+#define TEMP_BED_PIN -1  
828
+
829
+#define HEATER_0_PIN  2
830
+#define TEMP_0_PIN 8   
831
+
832
+#define HEATER_1_PIN 1
833
+#define TEMP_1_PIN 1
834
+
835
+#define HEATER_2_PIN -1
836
+#define TEMP_2_PIN -1
837
+
838
+#define E0_STEP_PIN         43
839
+#define E0_DIR_PIN          45
840
+#define E0_ENABLE_PIN       41
841
+
842
+#define E1_STEP_PIN         -1
843
+#define E1_DIR_PIN          -1
844
+#define E1_ENABLE_PIN       -1
845
+
846
+#define SDPOWER            -1
847
+#define SDSS               -1
848
+#define LED_PIN            -1
849
+#define FAN_PIN            -1
850
+#define PS_ON_PIN          -1
851
+#define KILL_PIN           -1
852
+#define SUICIDE_PIN        -1  //PIN that has to be turned on right after start, to keep power flowing.
853
+
854
+#define LCD_PINS_RS 24 
855
+#define LCD_PINS_ENABLE 22
856
+#define LCD_PINS_D4 36
857
+#define LCD_PINS_D5 34 
858
+#define LCD_PINS_D6 32
859
+#define LCD_PINS_D7 30
860
+
861
+#endif
862
+
754 863
 /****************************************************************************************
755 864
 * Teensylu 0.7 pin assingments (ATMEGA90USB)
756 865
 * Requires the Teensyduino software with Teensy2.0++ selected in arduino IDE!
@@ -810,6 +919,62 @@
810 919
 #endif
811 920
 #endif
812 921
 
922
+/****************************************************************************************
923
+* Gen3+ pin assignment
924
+*
925
+****************************************************************************************/
926
+#if MOTHERBOARD == 9
927
+#define MOTHERBOARD 6
928
+#define KNOWN_BOARD 1
929
+#ifndef __AVR_ATmega644P__
930
+#error Oops!  Make sure you have 'Sanguino' selected from the 'Tools -> Boards' menu.
931
+#endif
932
+
933
+#define X_STEP_PIN         15
934
+#define X_DIR_PIN          18
935
+#define X_MIN_PIN          20
936
+#define X_MAX_PIN           -1
937
+
938
+#define Y_STEP_PIN         23
939
+#define Y_DIR_PIN          22
940
+#define Y_MIN_PIN          25
941
+#define Y_MAX_PIN          -1
942
+
943
+#define Z_STEP_PIN         27
944
+#define Z_DIR_PIN          28
945
+#define Z_MIN_PIN          30
946
+#define Z_MAX_PIN          -1
947
+
948
+#define E_STEP_PIN         17
949
+#define E_DIR_PIN          21
950
+
951
+#define LED_PIN            -1
952
+
953
+#define FAN_PIN            -1 
954
+
955
+#define PS_ON_PIN         14
956
+#define KILL_PIN           -1
957
+
958
+#define HEATER_0_PIN       12 // (extruder)
959
+
960
+#define HEATER_1_PIN       16 // (bed)
961
+#define X_ENABLE_PIN       19
962
+#define Y_ENABLE_PIN       24
963
+#define Z_ENABLE_PIN       29
964
+#define E_ENABLE_PIN       13
965
+
966
+#define TEMP_0_PIN          0   // MUST USE ANALOG INPUT NUMBERING NOT DIGITAL OUTPUT NUMBERING!!!!!!!!! (pin 33 extruder)
967
+#define TEMP_1_PIN          5   // MUST USE ANALOG INPUT NUMBERING NOT DIGITAL OUTPUT NUMBERING!!!!!!!!! (pin 34 bed)
968
+#define TEMP_2_PIN         -1
969
+#define SDPOWER            -1
970
+#define SDSS               4
971
+#define HEATER_2_PIN       -1
972
+
973
+#endif
974
+
975
+
976
+
977
+
813 978
 #ifndef KNOWN_BOARD
814 979
 #error Unknown MOTHERBOARD value in configuration.h
815 980
 #endif

+ 10
- 9
Marlin/planner.cpp View File

@@ -505,7 +505,9 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa
505 505
   //enable active axes
506 506
   if(block->steps_x != 0) enable_x();
507 507
   if(block->steps_y != 0) enable_y();
508
-  if(block->steps_z != 0) enable_z();
508
+  #ifndef Z_LATE_ENABLE
509
+    if(block->steps_z != 0) enable_z();
510
+  #endif
509 511
 
510 512
   // Enable all
511 513
   if(block->steps_e != 0) { enable_e0();enable_e1();enable_e2(); }
@@ -515,8 +517,11 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa
515 517
   delta_mm[Y_AXIS] = (target[Y_AXIS]-position[Y_AXIS])/axis_steps_per_unit[Y_AXIS];
516 518
   delta_mm[Z_AXIS] = (target[Z_AXIS]-position[Z_AXIS])/axis_steps_per_unit[Z_AXIS];
517 519
   delta_mm[E_AXIS] = (target[E_AXIS]-position[E_AXIS])/axis_steps_per_unit[E_AXIS];
518
-  block->millimeters = sqrt(square(delta_mm[X_AXIS]) + square(delta_mm[Y_AXIS]) +
519
-                            square(delta_mm[Z_AXIS]) + square(delta_mm[E_AXIS]));
520
+  if ( block->steps_x == 0 && block->steps_y == 0 && block->steps_z == 0 ) {
521
+    block->millimeters = abs(delta_mm[E_AXIS]);
522
+  } else {
523
+    block->millimeters = sqrt(square(delta_mm[X_AXIS]) + square(delta_mm[Y_AXIS]) + square(delta_mm[Z_AXIS]));
524
+  }
520 525
   float inverse_millimeters = 1.0/block->millimeters;  // Inverse millimeters to remove multiple divides 
521 526
   
522 527
   // Calculate speed in mm/second for each axis. No divide by zero due to previous checks.
@@ -525,9 +530,6 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa
525 530
   block->nominal_speed = block->millimeters * inverse_second; // (mm/sec) Always > 0
526 531
   block->nominal_rate = ceil(block->step_event_count * inverse_second); // (step/sec) Always > 0
527 532
 
528
-  
529
- 
530
-
531 533
   if (block->steps_e == 0) {
532 534
         if(feed_rate<mintravelfeedrate) feed_rate=mintravelfeedrate;
533 535
   }
@@ -535,10 +537,9 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa
535 537
     	if(feed_rate<minimumfeedrate) feed_rate=minimumfeedrate;
536 538
   } 
537 539
 
538
-#ifdef SLOWDOWN
539 540
   // slow down when de buffer starts to empty, rather than wait at the corner for a buffer refill
540 541
   int moves_queued=(block_buffer_head-block_buffer_tail + BLOCK_BUFFER_SIZE) & (BLOCK_BUFFER_SIZE - 1);
541
-  
542
+#ifdef SLOWDOWN
542 543
   if(moves_queued < (BLOCK_BUFFER_SIZE * 0.5) && moves_queued > 1) feed_rate = feed_rate*moves_queued / (BLOCK_BUFFER_SIZE * 0.5); 
543 544
 #endif
544 545
 
@@ -686,7 +687,7 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa
686 687
     vmax_junction = max_z_jerk/2;
687 688
   vmax_junction = min(vmax_junction, block->nominal_speed);
688 689
 
689
-  if ((block_buffer_head != block_buffer_tail) && (previous_nominal_speed > 0.0)) {
690
+  if ((moves_queued > 1) && (previous_nominal_speed > 0.0)) {
690 691
     float jerk = sqrt(pow((current_speed[X_AXIS]-previous_speed[X_AXIS]), 2)+pow((current_speed[Y_AXIS]-previous_speed[Y_AXIS]), 2));
691 692
     if((previous_speed[X_AXIS] != 0.0) || (previous_speed[Y_AXIS] != 0.0)) {
692 693
       vmax_junction = block->nominal_speed;

+ 76
- 76
Marlin/speed_lookuptable.h View File

@@ -1,76 +1,76 @@
1
-#ifndef SPEED_LOOKUPTABLE_H
2
-#define SPEED_LOOKUPTABLE_H
3
-
4
-#include "Marlin.h"
5
-
6
-uint16_t speed_lookuptable_fast[256][2] PROGMEM = {\
7
-{ 62500, 55556}, { 6944, 3268}, { 3676, 1176}, { 2500, 607}, { 1893, 369}, { 1524, 249}, { 1275, 179}, { 1096, 135}, 
8
-{ 961, 105}, { 856, 85}, { 771, 69}, { 702, 58}, { 644, 49}, { 595, 42}, { 553, 37}, { 516, 32}, 
9
-{ 484, 28}, { 456, 25}, { 431, 23}, { 408, 20}, { 388, 19}, { 369, 16}, { 353, 16}, { 337, 14}, 
10
-{ 323, 13}, { 310, 11}, { 299, 11}, { 288, 11}, { 277, 9}, { 268, 9}, { 259, 8}, { 251, 8}, 
11
-{ 243, 8}, { 235, 7}, { 228, 6}, { 222, 6}, { 216, 6}, { 210, 6}, { 204, 5}, { 199, 5}, 
12
-{ 194, 5}, { 189, 4}, { 185, 4}, { 181, 4}, { 177, 4}, { 173, 4}, { 169, 4}, { 165, 3}, 
13
-{ 162, 3}, { 159, 4}, { 155, 3}, { 152, 3}, { 149, 2}, { 147, 3}, { 144, 3}, { 141, 2}, 
14
-{ 139, 3}, { 136, 2}, { 134, 2}, { 132, 3}, { 129, 2}, { 127, 2}, { 125, 2}, { 123, 2}, 
15
-{ 121, 2}, { 119, 1}, { 118, 2}, { 116, 2}, { 114, 1}, { 113, 2}, { 111, 2}, { 109, 1}, 
16
-{ 108, 2}, { 106, 1}, { 105, 2}, { 103, 1}, { 102, 1}, { 101, 1}, { 100, 2}, { 98, 1}, 
17
-{ 97, 1}, { 96, 1}, { 95, 2}, { 93, 1}, { 92, 1}, { 91, 1}, { 90, 1}, { 89, 1}, 
18
-{ 88, 1}, { 87, 1}, { 86, 1}, { 85, 1}, { 84, 1}, { 83, 0}, { 83, 1}, { 82, 1}, 
19
-{ 81, 1}, { 80, 1}, { 79, 1}, { 78, 0}, { 78, 1}, { 77, 1}, { 76, 1}, { 75, 0}, 
20
-{ 75, 1}, { 74, 1}, { 73, 1}, { 72, 0}, { 72, 1}, { 71, 1}, { 70, 0}, { 70, 1}, 
21
-{ 69, 0}, { 69, 1}, { 68, 1}, { 67, 0}, { 67, 1}, { 66, 0}, { 66, 1}, { 65, 0}, 
22
-{ 65, 1}, { 64, 1}, { 63, 0}, { 63, 1}, { 62, 0}, { 62, 1}, { 61, 0}, { 61, 1}, 
23
-{ 60, 0}, { 60, 0}, { 60, 1}, { 59, 0}, { 59, 1}, { 58, 0}, { 58, 1}, { 57, 0}, 
24
-{ 57, 1}, { 56, 0}, { 56, 0}, { 56, 1}, { 55, 0}, { 55, 1}, { 54, 0}, { 54, 0}, 
25
-{ 54, 1}, { 53, 0}, { 53, 0}, { 53, 1}, { 52, 0}, { 52, 0}, { 52, 1}, { 51, 0}, 
26
-{ 51, 0}, { 51, 1}, { 50, 0}, { 50, 0}, { 50, 1}, { 49, 0}, { 49, 0}, { 49, 1}, 
27
-{ 48, 0}, { 48, 0}, { 48, 1}, { 47, 0}, { 47, 0}, { 47, 0}, { 47, 1}, { 46, 0}, 
28
-{ 46, 0}, { 46, 1}, { 45, 0}, { 45, 0}, { 45, 0}, { 45, 1}, { 44, 0}, { 44, 0}, 
29
-{ 44, 0}, { 44, 1}, { 43, 0}, { 43, 0}, { 43, 0}, { 43, 1}, { 42, 0}, { 42, 0}, 
30
-{ 42, 0}, { 42, 1}, { 41, 0}, { 41, 0}, { 41, 0}, { 41, 0}, { 41, 1}, { 40, 0}, 
31
-{ 40, 0}, { 40, 0}, { 40, 0}, { 40, 1}, { 39, 0}, { 39, 0}, { 39, 0}, { 39, 0}, 
32
-{ 39, 1}, { 38, 0}, { 38, 0}, { 38, 0}, { 38, 0}, { 38, 1}, { 37, 0}, { 37, 0}, 
33
-{ 37, 0}, { 37, 0}, { 37, 0}, { 37, 1}, { 36, 0}, { 36, 0}, { 36, 0}, { 36, 0}, 
34
-{ 36, 1}, { 35, 0}, { 35, 0}, { 35, 0}, { 35, 0}, { 35, 0}, { 35, 0}, { 35, 1}, 
35
-{ 34, 0}, { 34, 0}, { 34, 0}, { 34, 0}, { 34, 0}, { 34, 1}, { 33, 0}, { 33, 0}, 
36
-{ 33, 0}, { 33, 0}, { 33, 0}, { 33, 0}, { 33, 1}, { 32, 0}, { 32, 0}, { 32, 0}, 
37
-{ 32, 0}, { 32, 0}, { 32, 0}, { 32, 0}, { 32, 1}, { 31, 0}, { 31, 0}, { 31, 0}, 
38
-{ 31, 0}, { 31, 0}, { 31, 0}, { 31, 1}, { 30, 0}, { 30, 0}, { 30, 0}, { 30, 0}
39
-};
40
-
41
-uint16_t speed_lookuptable_slow[256][2] PROGMEM = {\
42
-{ 62500, 12500}, { 50000, 8334}, { 41666, 5952}, { 35714, 4464}, { 31250, 3473}, { 27777, 2777}, { 25000, 2273}, { 22727, 1894}, 
43
-{ 20833, 1603}, { 19230, 1373}, { 17857, 1191}, { 16666, 1041}, { 15625, 920}, { 14705, 817}, { 13888, 731}, { 13157, 657}, 
44
-{ 12500, 596}, { 11904, 541}, { 11363, 494}, { 10869, 453}, { 10416, 416}, { 10000, 385}, { 9615, 356}, { 9259, 331}, 
45
-{ 8928, 308}, { 8620, 287}, { 8333, 269}, { 8064, 252}, { 7812, 237}, { 7575, 223}, { 7352, 210}, { 7142, 198}, 
46
-{ 6944, 188}, { 6756, 178}, { 6578, 168}, { 6410, 160}, { 6250, 153}, { 6097, 145}, { 5952, 139}, { 5813, 132}, 
47
-{ 5681, 126}, { 5555, 121}, { 5434, 115}, { 5319, 111}, { 5208, 106}, { 5102, 102}, { 5000, 99}, { 4901, 94}, 
48
-{ 4807, 91}, { 4716, 87}, { 4629, 84}, { 4545, 81}, { 4464, 79}, { 4385, 75}, { 4310, 73}, { 4237, 71}, 
49
-{ 4166, 68}, { 4098, 66}, { 4032, 64}, { 3968, 62}, { 3906, 60}, { 3846, 59}, { 3787, 56}, { 3731, 55}, 
50
-{ 3676, 53}, { 3623, 52}, { 3571, 50}, { 3521, 49}, { 3472, 48}, { 3424, 46}, { 3378, 45}, { 3333, 44}, 
51
-{ 3289, 43}, { 3246, 41}, { 3205, 41}, { 3164, 39}, { 3125, 39}, { 3086, 38}, { 3048, 36}, { 3012, 36}, 
52
-{ 2976, 35}, { 2941, 35}, { 2906, 33}, { 2873, 33}, { 2840, 32}, { 2808, 31}, { 2777, 30}, { 2747, 30}, 
53
-{ 2717, 29}, { 2688, 29}, { 2659, 28}, { 2631, 27}, { 2604, 27}, { 2577, 26}, { 2551, 26}, { 2525, 25}, 
54
-{ 2500, 25}, { 2475, 25}, { 2450, 23}, { 2427, 24}, { 2403, 23}, { 2380, 22}, { 2358, 22}, { 2336, 22}, 
55
-{ 2314, 21}, { 2293, 21}, { 2272, 20}, { 2252, 20}, { 2232, 20}, { 2212, 20}, { 2192, 19}, { 2173, 18}, 
56
-{ 2155, 19}, { 2136, 18}, { 2118, 18}, { 2100, 17}, { 2083, 17}, { 2066, 17}, { 2049, 17}, { 2032, 16}, 
57
-{ 2016, 16}, { 2000, 16}, { 1984, 16}, { 1968, 15}, { 1953, 16}, { 1937, 14}, { 1923, 15}, { 1908, 15}, 
58
-{ 1893, 14}, { 1879, 14}, { 1865, 14}, { 1851, 13}, { 1838, 14}, { 1824, 13}, { 1811, 13}, { 1798, 13}, 
59
-{ 1785, 12}, { 1773, 13}, { 1760, 12}, { 1748, 12}, { 1736, 12}, { 1724, 12}, { 1712, 12}, { 1700, 11}, 
60
-{ 1689, 12}, { 1677, 11}, { 1666, 11}, { 1655, 11}, { 1644, 11}, { 1633, 10}, { 1623, 11}, { 1612, 10}, 
61
-{ 1602, 10}, { 1592, 10}, { 1582, 10}, { 1572, 10}, { 1562, 10}, { 1552, 9}, { 1543, 10}, { 1533, 9}, 
62
-{ 1524, 9}, { 1515, 9}, { 1506, 9}, { 1497, 9}, { 1488, 9}, { 1479, 9}, { 1470, 9}, { 1461, 8}, 
63
-{ 1453, 8}, { 1445, 9}, { 1436, 8}, { 1428, 8}, { 1420, 8}, { 1412, 8}, { 1404, 8}, { 1396, 8}, 
64
-{ 1388, 7}, { 1381, 8}, { 1373, 7}, { 1366, 8}, { 1358, 7}, { 1351, 7}, { 1344, 8}, { 1336, 7}, 
65
-{ 1329, 7}, { 1322, 7}, { 1315, 7}, { 1308, 6}, { 1302, 7}, { 1295, 7}, { 1288, 6}, { 1282, 7}, 
66
-{ 1275, 6}, { 1269, 7}, { 1262, 6}, { 1256, 6}, { 1250, 7}, { 1243, 6}, { 1237, 6}, { 1231, 6}, 
67
-{ 1225, 6}, { 1219, 6}, { 1213, 6}, { 1207, 6}, { 1201, 5}, { 1196, 6}, { 1190, 6}, { 1184, 5}, 
68
-{ 1179, 6}, { 1173, 5}, { 1168, 6}, { 1162, 5}, { 1157, 5}, { 1152, 6}, { 1146, 5}, { 1141, 5}, 
69
-{ 1136, 5}, { 1131, 5}, { 1126, 5}, { 1121, 5}, { 1116, 5}, { 1111, 5}, { 1106, 5}, { 1101, 5}, 
70
-{ 1096, 5}, { 1091, 5}, { 1086, 4}, { 1082, 5}, { 1077, 5}, { 1072, 4}, { 1068, 5}, { 1063, 4}, 
71
-{ 1059, 5}, { 1054, 4}, { 1050, 4}, { 1046, 5}, { 1041, 4}, { 1037, 4}, { 1033, 5}, { 1028, 4}, 
72
-{ 1024, 4}, { 1020, 4}, { 1016, 4}, { 1012, 4}, { 1008, 4}, { 1004, 4}, { 1000, 4}, { 996, 4}, 
73
-{ 992, 4}, { 988, 4}, { 984, 4}, { 980, 4}, { 976, 4}, { 972, 4}, { 968, 3}, { 965, 3}
74
-};
75
-
76
-#endif
1
+#ifndef SPEED_LOOKUPTABLE_H
2
+#define SPEED_LOOKUPTABLE_H
3
+
4
+#include "Marlin.h"
5
+
6
+const uint16_t speed_lookuptable_fast[256][2] PROGMEM = {\
7
+{ 62500, 55556}, { 6944, 3268}, { 3676, 1176}, { 2500, 607}, { 1893, 369}, { 1524, 249}, { 1275, 179}, { 1096, 135}, 
8
+{ 961, 105}, { 856, 85}, { 771, 69}, { 702, 58}, { 644, 49}, { 595, 42}, { 553, 37}, { 516, 32}, 
9
+{ 484, 28}, { 456, 25}, { 431, 23}, { 408, 20}, { 388, 19}, { 369, 16}, { 353, 16}, { 337, 14}, 
10
+{ 323, 13}, { 310, 11}, { 299, 11}, { 288, 11}, { 277, 9}, { 268, 9}, { 259, 8}, { 251, 8}, 
11
+{ 243, 8}, { 235, 7}, { 228, 6}, { 222, 6}, { 216, 6}, { 210, 6}, { 204, 5}, { 199, 5}, 
12
+{ 194, 5}, { 189, 4}, { 185, 4}, { 181, 4}, { 177, 4}, { 173, 4}, { 169, 4}, { 165, 3}, 
13
+{ 162, 3}, { 159, 4}, { 155, 3}, { 152, 3}, { 149, 2}, { 147, 3}, { 144, 3}, { 141, 2}, 
14
+{ 139, 3}, { 136, 2}, { 134, 2}, { 132, 3}, { 129, 2}, { 127, 2}, { 125, 2}, { 123, 2}, 
15
+{ 121, 2}, { 119, 1}, { 118, 2}, { 116, 2}, { 114, 1}, { 113, 2}, { 111, 2}, { 109, 1}, 
16
+{ 108, 2}, { 106, 1}, { 105, 2}, { 103, 1}, { 102, 1}, { 101, 1}, { 100, 2}, { 98, 1}, 
17
+{ 97, 1}, { 96, 1}, { 95, 2}, { 93, 1}, { 92, 1}, { 91, 1}, { 90, 1}, { 89, 1}, 
18
+{ 88, 1}, { 87, 1}, { 86, 1}, { 85, 1}, { 84, 1}, { 83, 0}, { 83, 1}, { 82, 1}, 
19
+{ 81, 1}, { 80, 1}, { 79, 1}, { 78, 0}, { 78, 1}, { 77, 1}, { 76, 1}, { 75, 0}, 
20
+{ 75, 1}, { 74, 1}, { 73, 1}, { 72, 0}, { 72, 1}, { 71, 1}, { 70, 0}, { 70, 1}, 
21
+{ 69, 0}, { 69, 1}, { 68, 1}, { 67, 0}, { 67, 1}, { 66, 0}, { 66, 1}, { 65, 0}, 
22
+{ 65, 1}, { 64, 1}, { 63, 0}, { 63, 1}, { 62, 0}, { 62, 1}, { 61, 0}, { 61, 1}, 
23
+{ 60, 0}, { 60, 0}, { 60, 1}, { 59, 0}, { 59, 1}, { 58, 0}, { 58, 1}, { 57, 0}, 
24
+{ 57, 1}, { 56, 0}, { 56, 0}, { 56, 1}, { 55, 0}, { 55, 1}, { 54, 0}, { 54, 0}, 
25
+{ 54, 1}, { 53, 0}, { 53, 0}, { 53, 1}, { 52, 0}, { 52, 0}, { 52, 1}, { 51, 0}, 
26
+{ 51, 0}, { 51, 1}, { 50, 0}, { 50, 0}, { 50, 1}, { 49, 0}, { 49, 0}, { 49, 1}, 
27
+{ 48, 0}, { 48, 0}, { 48, 1}, { 47, 0}, { 47, 0}, { 47, 0}, { 47, 1}, { 46, 0}, 
28
+{ 46, 0}, { 46, 1}, { 45, 0}, { 45, 0}, { 45, 0}, { 45, 1}, { 44, 0}, { 44, 0}, 
29
+{ 44, 0}, { 44, 1}, { 43, 0}, { 43, 0}, { 43, 0}, { 43, 1}, { 42, 0}, { 42, 0}, 
30
+{ 42, 0}, { 42, 1}, { 41, 0}, { 41, 0}, { 41, 0}, { 41, 0}, { 41, 1}, { 40, 0}, 
31
+{ 40, 0}, { 40, 0}, { 40, 0}, { 40, 1}, { 39, 0}, { 39, 0}, { 39, 0}, { 39, 0}, 
32
+{ 39, 1}, { 38, 0}, { 38, 0}, { 38, 0}, { 38, 0}, { 38, 1}, { 37, 0}, { 37, 0}, 
33
+{ 37, 0}, { 37, 0}, { 37, 0}, { 37, 1}, { 36, 0}, { 36, 0}, { 36, 0}, { 36, 0}, 
34
+{ 36, 1}, { 35, 0}, { 35, 0}, { 35, 0}, { 35, 0}, { 35, 0}, { 35, 0}, { 35, 1}, 
35
+{ 34, 0}, { 34, 0}, { 34, 0}, { 34, 0}, { 34, 0}, { 34, 1}, { 33, 0}, { 33, 0}, 
36
+{ 33, 0}, { 33, 0}, { 33, 0}, { 33, 0}, { 33, 1}, { 32, 0}, { 32, 0}, { 32, 0}, 
37
+{ 32, 0}, { 32, 0}, { 32, 0}, { 32, 0}, { 32, 1}, { 31, 0}, { 31, 0}, { 31, 0}, 
38
+{ 31, 0}, { 31, 0}, { 31, 0}, { 31, 1}, { 30, 0}, { 30, 0}, { 30, 0}, { 30, 0}
39
+};
40
+
41
+const uint16_t speed_lookuptable_slow[256][2] PROGMEM = {\
42
+{ 62500, 12500}, { 50000, 8334}, { 41666, 5952}, { 35714, 4464}, { 31250, 3473}, { 27777, 2777}, { 25000, 2273}, { 22727, 1894}, 
43
+{ 20833, 1603}, { 19230, 1373}, { 17857, 1191}, { 16666, 1041}, { 15625, 920}, { 14705, 817}, { 13888, 731}, { 13157, 657}, 
44
+{ 12500, 596}, { 11904, 541}, { 11363, 494}, { 10869, 453}, { 10416, 416}, { 10000, 385}, { 9615, 356}, { 9259, 331}, 
45
+{ 8928, 308}, { 8620, 287}, { 8333, 269}, { 8064, 252}, { 7812, 237}, { 7575, 223}, { 7352, 210}, { 7142, 198}, 
46
+{ 6944, 188}, { 6756, 178}, { 6578, 168}, { 6410, 160}, { 6250, 153}, { 6097, 145}, { 5952, 139}, { 5813, 132}, 
47
+{ 5681, 126}, { 5555, 121}, { 5434, 115}, { 5319, 111}, { 5208, 106}, { 5102, 102}, { 5000, 99}, { 4901, 94}, 
48
+{ 4807, 91}, { 4716, 87}, { 4629, 84}, { 4545, 81}, { 4464, 79}, { 4385, 75}, { 4310, 73}, { 4237, 71}, 
49
+{ 4166, 68}, { 4098, 66}, { 4032, 64}, { 3968, 62}, { 3906, 60}, { 3846, 59}, { 3787, 56}, { 3731, 55}, 
50
+{ 3676, 53}, { 3623, 52}, { 3571, 50}, { 3521, 49}, { 3472, 48}, { 3424, 46}, { 3378, 45}, { 3333, 44}, 
51
+{ 3289, 43}, { 3246, 41}, { 3205, 41}, { 3164, 39}, { 3125, 39}, { 3086, 38}, { 3048, 36}, { 3012, 36}, 
52
+{ 2976, 35}, { 2941, 35}, { 2906, 33}, { 2873, 33}, { 2840, 32}, { 2808, 31}, { 2777, 30}, { 2747, 30}, 
53
+{ 2717, 29}, { 2688, 29}, { 2659, 28}, { 2631, 27}, { 2604, 27}, { 2577, 26}, { 2551, 26}, { 2525, 25}, 
54
+{ 2500, 25}, { 2475, 25}, { 2450, 23}, { 2427, 24}, { 2403, 23}, { 2380, 22}, { 2358, 22}, { 2336, 22}, 
55
+{ 2314, 21}, { 2293, 21}, { 2272, 20}, { 2252, 20}, { 2232, 20}, { 2212, 20}, { 2192, 19}, { 2173, 18}, 
56
+{ 2155, 19}, { 2136, 18}, { 2118, 18}, { 2100, 17}, { 2083, 17}, { 2066, 17}, { 2049, 17}, { 2032, 16}, 
57
+{ 2016, 16}, { 2000, 16}, { 1984, 16}, { 1968, 15}, { 1953, 16}, { 1937, 14}, { 1923, 15}, { 1908, 15}, 
58
+{ 1893, 14}, { 1879, 14}, { 1865, 14}, { 1851, 13}, { 1838, 14}, { 1824, 13}, { 1811, 13}, { 1798, 13}, 
59
+{ 1785, 12}, { 1773, 13}, { 1760, 12}, { 1748, 12}, { 1736, 12}, { 1724, 12}, { 1712, 12}, { 1700, 11}, 
60
+{ 1689, 12}, { 1677, 11}, { 1666, 11}, { 1655, 11}, { 1644, 11}, { 1633, 10}, { 1623, 11}, { 1612, 10}, 
61
+{ 1602, 10}, { 1592, 10}, { 1582, 10}, { 1572, 10}, { 1562, 10}, { 1552, 9}, { 1543, 10}, { 1533, 9}, 
62
+{ 1524, 9}, { 1515, 9}, { 1506, 9}, { 1497, 9}, { 1488, 9}, { 1479, 9}, { 1470, 9}, { 1461, 8}, 
63
+{ 1453, 8}, { 1445, 9}, { 1436, 8}, { 1428, 8}, { 1420, 8}, { 1412, 8}, { 1404, 8}, { 1396, 8}, 
64
+{ 1388, 7}, { 1381, 8}, { 1373, 7}, { 1366, 8}, { 1358, 7}, { 1351, 7}, { 1344, 8}, { 1336, 7}, 
65
+{ 1329, 7}, { 1322, 7}, { 1315, 7}, { 1308, 6}, { 1302, 7}, { 1295, 7}, { 1288, 6}, { 1282, 7}, 
66
+{ 1275, 6}, { 1269, 7}, { 1262, 6}, { 1256, 6}, { 1250, 7}, { 1243, 6}, { 1237, 6}, { 1231, 6}, 
67
+{ 1225, 6}, { 1219, 6}, { 1213, 6}, { 1207, 6}, { 1201, 5}, { 1196, 6}, { 1190, 6}, { 1184, 5}, 
68
+{ 1179, 6}, { 1173, 5}, { 1168, 6}, { 1162, 5}, { 1157, 5}, { 1152, 6}, { 1146, 5}, { 1141, 5}, 
69
+{ 1136, 5}, { 1131, 5}, { 1126, 5}, { 1121, 5}, { 1116, 5}, { 1111, 5}, { 1106, 5}, { 1101, 5}, 
70
+{ 1096, 5}, { 1091, 5}, { 1086, 4}, { 1082, 5}, { 1077, 5}, { 1072, 4}, { 1068, 5}, { 1063, 4}, 
71
+{ 1059, 5}, { 1054, 4}, { 1050, 4}, { 1046, 5}, { 1041, 4}, { 1037, 4}, { 1033, 5}, { 1028, 4}, 
72
+{ 1024, 4}, { 1020, 4}, { 1016, 4}, { 1012, 4}, { 1008, 4}, { 1004, 4}, { 1000, 4}, { 996, 4}, 
73
+{ 992, 4}, { 988, 4}, { 984, 4}, { 980, 4}, { 976, 4}, { 972, 4}, { 968, 3}, { 965, 3}
74
+};
75
+
76
+#endif

+ 14
- 2
Marlin/stepper.cpp View File

@@ -254,7 +254,7 @@ FORCE_INLINE unsigned short calc_timer(unsigned short step_rate) {
254 254
     timer = (unsigned short)pgm_read_word_near(table_address);
255 255
     timer -= (((unsigned short)pgm_read_word_near(table_address+2) * (unsigned char)(step_rate & 0x0007))>>3);
256 256
   }
257
-  if(timer < 100) { timer = 100; MSerial.print("Steprate to high : "); MSerial.println(step_rate); }//(20kHz this should never happen)
257
+  if(timer < 100) { timer = 100; MYSERIAL.print("Steprate to high : "); MYSERIAL.println(step_rate); }//(20kHz this should never happen)
258 258
   return timer;
259 259
 }
260 260
 
@@ -275,6 +275,8 @@ FORCE_INLINE void trapezoid_generator_reset() {
275 275
   OCR1A = acceleration_time;
276 276
   OCR1A_nominal = calc_timer(current_block->nominal_rate);
277 277
   
278
+
279
+  
278 280
 //    SERIAL_ECHO_START;
279 281
 //    SERIAL_ECHOPGM("advance :");
280 282
 //    SERIAL_ECHO(current_block->advance/256.0);
@@ -302,6 +304,14 @@ ISR(TIMER1_COMPA_vect)
302 304
       counter_z = counter_x;
303 305
       counter_e = counter_x;
304 306
       step_events_completed = 0;
307
+      #ifdef Z_LATE_ENABLE 
308
+        if(current_block->steps_z > 0) {
309
+          enable_z();
310
+          OCR1A = 2000; //1ms wait
311
+          return;
312
+        }
313
+      #endif
314
+      
305 315
 //      #ifdef ADVANCE
306 316
 //      e_steps[current_block->active_extruder] = 0;
307 317
 //      #endif
@@ -429,7 +439,9 @@ ISR(TIMER1_COMPA_vect)
429 439
 
430 440
     
431 441
     for(int8_t i=0; i < step_loops; i++) { // Take multiple steps per interrupt (For high speed moves) 
432
-      MSerial.checkRx(); // Check for serial chars. 
442
+      #if MOTHERBOARD != 8 // !teensylu
443
+      MSerial.checkRx(); // Check for serial chars.
444
+      #endif 
433 445
       
434 446
       #ifdef ADVANCE
435 447
       counter_e += current_block->steps_e;

+ 95
- 7
Marlin/temperature.cpp View File

@@ -85,9 +85,9 @@ static unsigned long  previous_millis_bed_heater;
85 85
   static unsigned char soft_pwm[EXTRUDERS];
86 86
   
87 87
 #ifdef WATCHPERIOD
88
-  static int watch_raw[EXTRUDERS] = { -1000 }; // the first value used for all
89
-  static int watch_oldtemp[3] = {0,0,0};
90
-  static unsigned long watchmillis = 0;
88
+  int watch_raw[EXTRUDERS] = { -1000 }; // the first value used for all
89
+  int watch_oldtemp[3] = {0,0,0};
90
+  unsigned long watchmillis = 0;
91 91
 #endif //WATCHPERIOD
92 92
 
93 93
 // Init min and max temp with extreme values to prevent false errors during startup
@@ -218,7 +218,7 @@ void manage_heater()
218 218
   
219 219
   #ifdef WATCHPERIOD
220 220
     if(watchmillis && millis() - watchmillis > WATCHPERIOD){
221
-        if(watch_oldtemp[TEMPSENSOR_HOTEND_0] >= degHotend(active_extruder)){
221
+        if(watch_oldtemp[0] >= degHotend(active_extruder)){
222 222
             setTargetHotend(0,active_extruder);
223 223
             LCD_MESSAGEPGM("Heating failed");
224 224
             SERIAL_ECHO_START;
@@ -283,6 +283,12 @@ int temp2analog(int celsius, uint8_t e) {
283 283
       SERIAL_ERRORLNPGM(" - Invalid extruder number!");
284 284
       kill();
285 285
   }
286
+  #ifdef HEATER_0_USES_MAX6675
287
+    if (e == 0)
288
+    {
289
+      return celsius * 4;
290
+    }
291
+  #endif
286 292
   if(heater_ttbl_map[e] != 0)
287 293
   {
288 294
     int raw = 0;
@@ -352,7 +358,14 @@ float analog2temp(int raw, uint8_t e) {
352 358
       SERIAL_ERROR((int)e);
353 359
       SERIAL_ERRORLNPGM(" - Invalid extruder number !");
354 360
       kill();
355
-  }
361
+  } 
362
+  #ifdef HEATER_0_USES_MAX6675
363
+    if (e == 0)
364
+    {
365
+      return 0.25 * raw;
366
+    }
367
+  #endif
368
+
356 369
   if(heater_ttbl_map[e] != 0)
357 370
   {
358 371
     float celsius = 0;
@@ -446,6 +459,22 @@ void tp_init()
446 459
     SET_OUTPUT(FAN_PIN);
447 460
   #endif  
448 461
 
462
+  #ifdef HEATER_0_USES_MAX6675
463
+    #ifndef SDSUPPORT
464
+      SET_OUTPUT(MAX_SCK_PIN);
465
+      WRITE(MAX_SCK_PIN,0);
466
+    
467
+      SET_OUTPUT(MAX_MOSI_PIN);
468
+      WRITE(MAX_MOSI_PIN,1);
469
+    
470
+      SET_INPUT(MAX_MISO_PIN);
471
+      WRITE(MAX_MISO_PIN,1);
472
+    #endif
473
+    
474
+    SET_OUTPUT(MAX6675_SS);
475
+    WRITE(MAX6675_SS,1);
476
+  #endif
477
+
449 478
   // Set analog inputs
450 479
   ADCSRA = 1<<ADEN | 1<<ADSC | 1<<ADIF | 0x07;
451 480
   DIDR0 = 0;
@@ -527,7 +556,7 @@ void setWatch()
527 556
   for (int e = 0; e < EXTRUDERS; e++)
528 557
   {
529 558
     if(isHeatingHotend(e))
530
-    watch_oldtemp[TEMPSENSOR_HOTEND_0] = degHotend(0);
559
+    watch_oldtemp[0] = degHotend(0);
531 560
     {
532 561
       t = max(t,millis());
533 562
       watch_raw[e] = current_raw[e];
@@ -595,6 +624,62 @@ void bed_max_temp_error(void) {
595 624
   SERIAL_ERRORLNPGM("Temperature heated bed switched off. MAXTEMP triggered !!");
596 625
 }
597 626
 
627
+#define HEAT_INTERVAL 250
628
+#ifdef HEATER_0_USES_MAX6675
629
+long max6675_previous_millis = -HEAT_INTERVAL;
630
+int max6675_temp = 2000;
631
+
632
+int read_max6675()
633
+{
634
+  if (millis() - max6675_previous_millis < HEAT_INTERVAL) 
635
+    return max6675_temp;
636
+  
637
+  max6675_previous_millis = millis();
638
+  max6675_temp = 0;
639
+    
640
+  #ifdef	PRR
641
+    PRR &= ~(1<<PRSPI);
642
+  #elif defined PRR0
643
+    PRR0 &= ~(1<<PRSPI);
644
+  #endif
645
+  
646
+  SPCR = (1<<MSTR) | (1<<SPE) | (1<<SPR0);
647
+  
648
+  // enable TT_MAX6675
649
+  WRITE(MAX6675_SS, 0);
650
+  
651
+  // ensure 100ns delay - a bit extra is fine
652
+  delay(1);
653
+  
654
+  // read MSB
655
+  SPDR = 0;
656
+  for (;(SPSR & (1<<SPIF)) == 0;);
657
+  max6675_temp = SPDR;
658
+  max6675_temp <<= 8;
659
+  
660
+  // read LSB
661
+  SPDR = 0;
662
+  for (;(SPSR & (1<<SPIF)) == 0;);
663
+  max6675_temp |= SPDR;
664
+  
665
+  // disable TT_MAX6675
666
+  WRITE(MAX6675_SS, 1);
667
+
668
+  if (max6675_temp & 4) 
669
+  {
670
+    // thermocouple open
671
+    max6675_temp = 2000;
672
+  }
673
+  else 
674
+  {
675
+    max6675_temp = max6675_temp >> 3;
676
+  }
677
+
678
+  return max6675_temp;
679
+}
680
+#endif
681
+
682
+
598 683
 // Timer 0 is shared with millies
599 684
 ISR(TIMER0_COMPB_vect)
600 685
 {
@@ -653,6 +738,9 @@ ISR(TIMER0_COMPB_vect)
653 738
       #if (TEMP_0_PIN > -1)
654 739
         raw_temp_0_value += ADC;
655 740
       #endif
741
+      #ifdef HEATER_0_USES_MAX6675 // TODO remove the blocking
742
+        raw_temp_0_value = read_max6675();
743
+      #endif
656 744
       temp_state = 2;
657 745
       break;
658 746
     case 2: // Prepare TEMP_BED
@@ -732,7 +820,7 @@ ISR(TIMER0_COMPB_vect)
732 820
     #endif
733 821
 
734 822
 #if EXTRUDERS > 1    
735
-    #ifdef HEATER_1_USES_AD595
823
+    #ifdef HEATER_1_USES_AD595 || defined HEATER_0_USES_MAX6675
736 824
       current_raw[1] = raw_temp_1_value;
737 825
     #else
738 826
       current_raw[1] = 16383 - raw_temp_1_value;

+ 1
- 1
Marlin/ultralcd.pde View File

@@ -59,7 +59,7 @@ void lcdProgMemprint(const char *str)
59 59
 //=============================functions         ============================
60 60
 //===========================================================================
61 61
 
62
-FORCE_INLINE int intround(const float &x){return int(0.5+x);}
62
+int intround(const float &x){return int(0.5+x);}
63 63
 
64 64
 void lcd_status(const char* message)
65 65
 {

+ 5
- 1
README.md View File

@@ -1,6 +1,10 @@
1 1
 WARNING: 
2 2
 --------
3
-THIS IS THE BETA 1 FOR MARLIN 1.0.0
3
+THIS IS RELEASE CANDIDATE 1 FOR MARLIN 1.0.0
4
+
5
+The configuration is now split in two files
6
+Configuration.h for the normal settings
7
+Configuration_adv.h for the advanced settings
4 8
 
5 9
 Quick Information
6 10
 ===================

Loading…
Cancel
Save