|
@@ -1,10 +1,13 @@
|
1
|
1
|
#ifndef __CONFIGURATION_H
|
2
|
2
|
#define __CONFIGURATION_H
|
3
|
3
|
|
4
|
|
-//#define DEBUG_STEPS
|
5
|
4
|
|
6
|
|
-#define MM_PER_ARC_SEGMENT 1
|
7
|
|
-#define N_ARC_CORRECTION 25
|
|
5
|
+
|
|
6
|
+// This determines the communication speed of the printer
|
|
7
|
+//#define BAUDRATE 250000
|
|
8
|
+#define BAUDRATE 115200
|
|
9
|
+//#define BAUDRATE 230400
|
|
10
|
+
|
8
|
11
|
|
9
|
12
|
// BASIC SETTINGS: select your board type, thermistor type, axis scaling, and endstop configuration
|
10
|
13
|
|
|
@@ -17,7 +20,9 @@
|
17
|
20
|
// Teensylu = 8
|
18
|
21
|
#define MOTHERBOARD 7
|
19
|
22
|
|
20
|
|
-
|
|
23
|
+//===========================================================================
|
|
24
|
+//=============================Thermal Settings ============================
|
|
25
|
+//===========================================================================
|
21
|
26
|
|
22
|
27
|
//// Thermistor settings:
|
23
|
28
|
// 1 is 100k thermistor
|
|
@@ -40,49 +45,103 @@
|
40
|
45
|
//#define BED_USES_THERMISTOR
|
41
|
46
|
//#define BED_USES_AD595
|
42
|
47
|
|
43
|
|
-#define HEATER_CHECK_INTERVAL 50
|
44
|
|
-#define BED_CHECK_INTERVAL 5000
|
|
48
|
+#define HEATER_CHECK_INTERVAL 50 //ms
|
|
49
|
+#define BED_CHECK_INTERVAL 5000 //ms
|
45
|
50
|
|
|
51
|
+//// Experimental watchdog and minimal temp
|
|
52
|
+// The watchdog waits for the watchperiod in milliseconds whenever an M104 or M109 increases the target temperature
|
|
53
|
+// If the temperature has not increased at the end of that period, the target temperature is set to zero. It can be reset with another M104/M109
|
|
54
|
+/// CURRENTLY NOT IMPLEMENTED AND UNUSEABLE
|
|
55
|
+//#define WATCHPERIOD 5000 //5 seconds
|
46
|
56
|
|
47
|
|
-//// Endstop Settings
|
48
|
|
-#define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pullup resistors
|
49
|
|
-// The pullups are needed if you directly connect a mechanical endswitch between the signal and ground pins.
|
50
|
|
-const bool ENDSTOPS_INVERTING = true; // set to true to invert the logic of the endstops.
|
51
|
|
-// For optos H21LOB set to true, for Mendel-Parts newer optos TCST2103 set to false
|
|
57
|
+// Actual temperature must be close to target for this long before M109 returns success
|
|
58
|
+//#define TEMP_RESIDENCY_TIME 20 // (seconds)
|
|
59
|
+//#define TEMP_HYSTERESIS 5 // (C°) range of +/- temperatures considered "close" to the target one
|
52
|
60
|
|
53
|
|
-// This determines the communication speed of the printer
|
54
|
|
-#define BAUDRATE 250000
|
55
|
|
-//#define BAUDRATE 115200
|
56
|
|
-//#define BAUDRATE 230400
|
|
61
|
+//// The minimal temperature defines the temperature below which the heater will not be enabled
|
|
62
|
+#define HEATER_0_MINTEMP 5
|
|
63
|
+//#define HEATER_1_MINTEMP 5
|
|
64
|
+//#define BED_MINTEMP 5
|
57
|
65
|
|
58
|
|
-// Comment out (using // at the start of the line) to disable SD support:
|
59
|
66
|
|
60
|
|
-// #define ULTRA_LCD //any lcd
|
|
67
|
+// When temperature exceeds max temp, your heater will be switched off.
|
|
68
|
+// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure!
|
|
69
|
+// You should use MINTEMP for thermistor short/failure protection.
|
|
70
|
+#define HEATER_0_MAXTEMP 275
|
|
71
|
+//#define_HEATER_1_MAXTEMP 275
|
|
72
|
+//#define BED_MAXTEMP 150
|
61
|
73
|
|
62
|
|
-#define ULTIPANEL
|
63
|
|
-#ifdef ULTIPANEL
|
64
|
|
- //#define NEWPANEL //enable this if you have a click-encoder panel
|
65
|
|
- #define SDSUPPORT
|
66
|
|
- #define ULTRA_LCD
|
67
|
|
- #define LCD_WIDTH 20
|
68
|
|
- #define LCD_HEIGHT 4
|
69
|
|
-#else //no panel but just lcd
|
70
|
|
- #ifdef ULTRA_LCD
|
71
|
|
- #define LCD_WIDTH 16
|
72
|
|
- #define LCD_HEIGHT 2
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+// PID settings:
|
|
77
|
+// Uncomment the following line to enable PID support.
|
|
78
|
+
|
|
79
|
+#define PIDTEMP
|
|
80
|
+#ifdef PIDTEMP
|
|
81
|
+ //#define PID_DEBUG // Sends debug data to the serial port.
|
|
82
|
+ //#define PID_OPENLOOP 1 // Puts PID in open loop. M104 sets the output power in %
|
|
83
|
+
|
|
84
|
+ #define PID_MAX 255 // limits current to nozzle; 255=full current
|
|
85
|
+ #define PID_INTEGRAL_DRIVE_MAX 255 //limit for the integral term
|
|
86
|
+ #define K1 0.95 //smoothing factor withing the PID
|
|
87
|
+ #define PID_dT 0.1 //sampling period of the PID
|
|
88
|
+
|
|
89
|
+ //To develop some PID settings for your machine, you can initiall follow
|
|
90
|
+ // the Ziegler-Nichols method.
|
|
91
|
+ // set Ki and Kd to zero.
|
|
92
|
+ // heat with a defined Kp and see if the temperature stabilizes
|
|
93
|
+ // ideally you do this graphically with repg.
|
|
94
|
+ // the PID_CRITIAL_GAIN should be the Kp at which temperature oscillatins are not dampned out/decreas in amplitutde
|
|
95
|
+ // PID_SWING_AT_CRITIAL is the time for a full period of the oscillations at the critical Gain
|
|
96
|
+ // usually further manual tunine is necessary.
|
|
97
|
+
|
|
98
|
+ #define PID_CRITIAL_GAIN 3000
|
|
99
|
+ #define PID_SWING_AT_CRITIAL 45 //seconds
|
|
100
|
+
|
|
101
|
+ #define PID_PI //no differentail term
|
|
102
|
+ //#define PID_PID //normal PID
|
|
103
|
+
|
|
104
|
+ #ifdef PID_PID
|
|
105
|
+ //PID according to Ziegler-Nichols method
|
|
106
|
+ #define DEFAULT_Kp (0.6*PID_CRITIAL_GAIN)
|
|
107
|
+ #define DEFAULT_Ki (2*Kp/PID_SWING_AT_CRITIAL*PID_dT)
|
|
108
|
+ #define DEFAULT_Kd (PID_SWING_AT_CRITIAL/8./PID_dT)
|
73
|
109
|
#endif
|
74
|
|
-#endif
|
|
110
|
+
|
|
111
|
+ #ifdef PID_PI
|
|
112
|
+ //PI according to Ziegler-Nichols method
|
|
113
|
+ #define DEFAULT_Kp (PID_CRITIAL_GAIN/2.2)
|
|
114
|
+ #define DEFAULT_Ki (1.2*Kp/PID_SWING_AT_CRITIAL*PID_dT)
|
|
115
|
+ #define DEFAULT_Kd (0)
|
|
116
|
+ #endif
|
|
117
|
+
|
|
118
|
+ // this adds an experimental additional term to the heatingpower, proportional to the extrusion speed.
|
|
119
|
+ // if Kc is choosen well, the additional required power due to increased melting should be compensated.
|
|
120
|
+ #define PID_ADD_EXTRUSION_RATE
|
|
121
|
+ #ifdef PID_ADD_EXTRUSION_RATE
|
|
122
|
+ #define DEFAULT_Kc (5) //heatingpower=Kc*(e_speed)
|
|
123
|
+ #endif
|
|
124
|
+#endif // PIDTEMP
|
|
125
|
+
|
75
|
126
|
|
76
|
127
|
|
77
|
|
-//#define SDSUPPORT // Enable SD Card Support in Hardware Console
|
78
|
128
|
|
79
|
129
|
|
80
|
130
|
|
81
|
|
-const int dropsegments=5; //everything with this number of steps will be ignored as move
|
82
|
131
|
|
83
|
|
-//// ADVANCED SETTINGS - to tweak parameters
|
84
|
132
|
|
85
|
|
-#include "thermistortables.h"
|
|
133
|
+
|
|
134
|
+//===========================================================================
|
|
135
|
+//=============================Mechanical Settings===========================
|
|
136
|
+//===========================================================================
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+// Endstop Settings
|
|
140
|
+#define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pullup resistors
|
|
141
|
+// The pullups are needed if you directly connect a mechanical endswitch between the signal and ground pins.
|
|
142
|
+const bool ENDSTOPS_INVERTING = true; // set to true to invert the logic of the endstops.
|
|
143
|
+// For optos H21LOB set to true, for Mendel-Parts newer optos TCST2103 set to false
|
|
144
|
+
|
86
|
145
|
|
87
|
146
|
// For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
|
88
|
147
|
#define X_ENABLE_ON 0
|
|
@@ -141,88 +200,33 @@ const int dropsegments=5; //everything with this number of steps will be ignore
|
141
|
200
|
#define DEFAULT_ZJERK 10.0*60
|
142
|
201
|
|
143
|
202
|
|
144
|
|
-// The watchdog waits for the watchperiod in milliseconds whenever an M104 or M109 increases the target temperature
|
145
|
|
-//this enables the watchdog interrupt.
|
146
|
|
-#define USE_WATCHDOG
|
147
|
|
-//you cannot reboot on a mega2560 due to a bug in he bootloader. Hence, you have to reset manually, and this is done hereby:
|
148
|
|
-#define RESET_MANUAL
|
149
|
|
-
|
150
|
|
-#define WATCHDOG_TIMEOUT 4
|
151
|
|
-
|
152
|
203
|
|
153
|
204
|
|
154
|
|
-//// Experimental watchdog and minimal temp
|
155
|
|
-// The watchdog waits for the watchperiod in milliseconds whenever an M104 or M109 increases the target temperature
|
156
|
|
-// If the temperature has not increased at the end of that period, the target temperature is set to zero. It can be reset with another M104/M109
|
157
|
|
-/// CURRENTLY NOT IMPLEMENTED AND UNUSEABLE
|
158
|
|
-//#define WATCHPERIOD 5000 //5 seconds
|
159
|
|
-
|
160
|
|
-// Actual temperature must be close to target for this long before M109 returns success
|
161
|
|
-//#define TEMP_RESIDENCY_TIME 20 // (seconds)
|
162
|
|
-//#define TEMP_HYSTERESIS 5 // (C°) range of +/- temperatures considered "close" to the target one
|
|
205
|
+//===========================================================================
|
|
206
|
+//=============================Additional Features===========================
|
|
207
|
+//===========================================================================
|
163
|
208
|
|
164
|
|
-//// The minimal temperature defines the temperature below which the heater will not be enabled
|
165
|
|
-#define HEATER_0_MINTEMP 5
|
166
|
|
-//#define HEATER_1_MINTEMP 5
|
167
|
|
-//#define BED_MINTEMP 5
|
|
209
|
+// EEPROM
|
|
210
|
+// the microcontroller can store settings in the EEPROM, e.g. max velocity...
|
|
211
|
+// M500 - stores paramters in EEPROM
|
|
212
|
+// M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily).
|
|
213
|
+// M502 - reverts to the default "factory settings". You still need to store them in EEPROM afterwards if you want to.
|
|
214
|
+//define this to enable eeprom support
|
|
215
|
+#define EEPROM_SETTINGS
|
|
216
|
+//to disable EEPROM Serial responses and decrease program space by ~1700 byte: comment this out:
|
|
217
|
+// please keep turned on if you can.
|
|
218
|
+#define EEPROM_CHITCHAT
|
168
|
219
|
|
169
|
220
|
|
170
|
|
-// When temperature exceeds max temp, your heater will be switched off.
|
171
|
|
-// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure!
|
172
|
|
-// You should use MINTEMP for thermistor short/failure protection.
|
173
|
|
-#define HEATER_0_MAXTEMP 275
|
174
|
|
-//#define_HEATER_1_MAXTEMP 275
|
175
|
|
-//#define BED_MAXTEMP 150
|
|
221
|
+// The watchdog waits for the watchperiod in milliseconds whenever an M104 or M109 increases the target temperature
|
|
222
|
+// this enables the watchdog interrupt.
|
|
223
|
+#define USE_WATCHDOG
|
|
224
|
+// you cannot reboot on a mega2560 due to a bug in he bootloader. Hence, you have to reset manually, and this is done hereby:
|
|
225
|
+#define RESET_MANUAL
|
|
226
|
+#define WATCHDOG_TIMEOUT 4 //seconds
|
176
|
227
|
|
177
|
|
-/// PID settings:
|
178
|
|
-// Uncomment the following line to enable PID support.
|
179
|
|
-
|
180
|
|
-#define PIDTEMP
|
181
|
|
-#ifdef PIDTEMP
|
182
|
|
- //#define PID_DEBUG // Sends debug data to the serial port.
|
183
|
|
- //#define PID_OPENLOOP 1 // Puts PID in open loop. M104 sets the output power in %
|
184
|
|
-
|
185
|
|
- #define PID_MAX 255 // limits current to nozzle; 255=full current
|
186
|
|
- #define PID_INTEGRAL_DRIVE_MAX 255 //limit for the integral term
|
187
|
|
- #define K1 0.95 //smoothing factor withing the PID
|
188
|
|
- #define PID_dT 0.1 //sampling period of the PID
|
189
|
228
|
|
190
|
|
- //To develop some PID settings for your machine, you can initiall follow
|
191
|
|
- // the Ziegler-Nichols method.
|
192
|
|
- // set Ki and Kd to zero.
|
193
|
|
- // heat with a defined Kp and see if the temperature stabilizes
|
194
|
|
- // ideally you do this graphically with repg.
|
195
|
|
- // the PID_CRITIAL_GAIN should be the Kp at which temperature oscillatins are not dampned out/decreas in amplitutde
|
196
|
|
- // PID_SWING_AT_CRITIAL is the time for a full period of the oscillations at the critical Gain
|
197
|
|
- // usually further manual tunine is necessary.
|
198
|
229
|
|
199
|
|
- #define PID_CRITIAL_GAIN 3000
|
200
|
|
- #define PID_SWING_AT_CRITIAL 45 //seconds
|
201
|
|
-
|
202
|
|
- #define PID_PI //no differentail term
|
203
|
|
- //#define PID_PID //normal PID
|
204
|
|
-
|
205
|
|
- #ifdef PID_PID
|
206
|
|
- //PID according to Ziegler-Nichols method
|
207
|
|
- #define DEFAULT_Kp (0.6*PID_CRITIAL_GAIN)
|
208
|
|
- #define DEFAULT_Ki (2*Kp/PID_SWING_AT_CRITIAL*PID_dT)
|
209
|
|
- #define DEFAULT_Kd (PID_SWING_AT_CRITIAL/8./PID_dT)
|
210
|
|
- #endif
|
211
|
|
-
|
212
|
|
- #ifdef PID_PI
|
213
|
|
- //PI according to Ziegler-Nichols method
|
214
|
|
- #define DEFAULT_Kp (PID_CRITIAL_GAIN/2.2)
|
215
|
|
- #define DEFAULT_Ki (1.2*Kp/PID_SWING_AT_CRITIAL*PID_dT)
|
216
|
|
- #define DEFAULT_Kd (0)
|
217
|
|
- #endif
|
218
|
|
-
|
219
|
|
- // this adds an experimental additional term to the heatingpower, proportional to the extrusion speed.
|
220
|
|
- // if Kc is choosen well, the additional required power due to increased melting should be compensated.
|
221
|
|
- #define PID_ADD_EXTRUSION_RATE
|
222
|
|
- #ifdef PID_ADD_EXTRUSION_RATE
|
223
|
|
- #define DEFAULT_Kc (5) //heatingpower=Kc*(e_speed)
|
224
|
|
- #endif
|
225
|
|
-#endif // PIDTEMP
|
226
|
230
|
|
227
|
231
|
// extruder advance constant (s2/mm3)
|
228
|
232
|
//
|
|
@@ -243,6 +247,42 @@ const int dropsegments=5; //everything with this number of steps will be ignore
|
243
|
247
|
|
244
|
248
|
#endif // ADVANCE
|
245
|
249
|
|
|
250
|
+
|
|
251
|
+//LCD and SD support
|
|
252
|
+//#define ULTRA_LCD //general lcd support, also 16x2
|
|
253
|
+//#define SDSUPPORT // Enable SD Card Support in Hardware Console
|
|
254
|
+
|
|
255
|
+#define ULTIPANEL
|
|
256
|
+#ifdef ULTIPANEL
|
|
257
|
+ #define NEWPANEL //enable this if you have a click-encoder panel
|
|
258
|
+ #define SDSUPPORT
|
|
259
|
+ #define ULTRA_LCD
|
|
260
|
+ #define LCD_WIDTH 20
|
|
261
|
+ #define LCD_HEIGHT 4
|
|
262
|
+#else //no panel but just lcd
|
|
263
|
+ #ifdef ULTRA_LCD
|
|
264
|
+ #define LCD_WIDTH 16
|
|
265
|
+ #define LCD_HEIGHT 2
|
|
266
|
+ #endif
|
|
267
|
+#endif
|
|
268
|
+
|
|
269
|
+// A debugging feature to compare calculated vs performed steps, to see if steps are lost by the software.
|
|
270
|
+//#define DEBUG_STEPS
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+// Arc interpretation settings:
|
|
274
|
+#define MM_PER_ARC_SEGMENT 1
|
|
275
|
+#define N_ARC_CORRECTION 25
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+const int dropsegments=0; //everything with less than this number of steps will be ignored as move and joined with the next movement
|
|
279
|
+
|
|
280
|
+//===========================================================================
|
|
281
|
+//=============================Buffers ============================
|
|
282
|
+//===========================================================================
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
|
246
|
286
|
// The number of linear motions that can be in the plan at any give time.
|
247
|
287
|
// 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.
|
248
|
288
|
#if defined SDSUPPORT
|
|
@@ -251,8 +291,12 @@ const int dropsegments=5; //everything with this number of steps will be ignore
|
251
|
291
|
#define BLOCK_BUFFER_SIZE 16 // maximize block buffer
|
252
|
292
|
#endif
|
253
|
293
|
|
|
294
|
+
|
254
|
295
|
//The ASCII buffer for recieving from the serial:
|
255
|
296
|
#define MAX_CMD_SIZE 96
|
256
|
297
|
#define BUFSIZE 4
|
257
|
298
|
|
|
299
|
+
|
|
300
|
+#include "thermistortables.h"
|
|
301
|
+
|
258
|
302
|
#endif //__CONFIGURATION_H
|