Browse Source

Merge https://github.com/MarlinFirmware/Marlin into tm3-utf-minus-kanji

Conflicts:
	Marlin/example_configurations/delta/generic/Configuration.h
	Marlin/example_configurations/delta/kossel_mini/Configuration.h
	Marlin/language.h

Conflicts solved
AnHardt 9 years ago
parent
commit
9d589cbb2a
42 changed files with 2598 additions and 5411 deletions
  1. BIN
      Documentation/Logo/marlinwiki.png
  2. 29
    0
      Documentation/changelog.md
  3. 405
    0
      Marlin/Conditionals.h
  4. 26
    150
      Marlin/Configuration.h
  5. 70
    9
      Marlin/ConfigurationStore.cpp
  6. 47
    244
      Marlin/Configuration_adv.h
  7. 28
    34
      Marlin/Marlin.h
  8. 317
    244
      Marlin/Marlin_main.cpp
  9. 254
    0
      Marlin/SanityCheck.h
  10. 2
    3
      Marlin/Sd2PinMap.h
  11. 33
    163
      Marlin/configurator/config/Configuration.h
  12. 10
    211
      Marlin/configurator/config/Configuration_adv.h
  13. 33
    176
      Marlin/example_configurations/Felix/Configuration.h
  14. 33
    175
      Marlin/example_configurations/Felix/Configuration_DUAL.h
  15. 11
    186
      Marlin/example_configurations/Felix/Configuration_adv.h
  16. 34
    158
      Marlin/example_configurations/Hephestos/Configuration.h
  17. 10
    201
      Marlin/example_configurations/Hephestos/Configuration_adv.h
  18. 34
    158
      Marlin/example_configurations/K8200/Configuration.h
  19. 11
    206
      Marlin/example_configurations/K8200/Configuration_adv.h
  20. 34
    158
      Marlin/example_configurations/SCARA/Configuration.h
  21. 11
    197
      Marlin/example_configurations/SCARA/Configuration_adv.h
  22. 34
    158
      Marlin/example_configurations/WITBOX/Configuration.h
  23. 10
    201
      Marlin/example_configurations/WITBOX/Configuration_adv.h
  24. 45
    163
      Marlin/example_configurations/delta/generic/Configuration.h
  25. 9
    207
      Marlin/example_configurations/delta/generic/Configuration_adv.h
  26. 47
    165
      Marlin/example_configurations/delta/kossel_mini/Configuration.h
  27. 9
    207
      Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h
  28. 34
    158
      Marlin/example_configurations/makibox/Configuration.h
  29. 10
    190
      Marlin/example_configurations/makibox/Configuration_adv.h
  30. 34
    158
      Marlin/example_configurations/tvrrug/Round2/Configuration.h
  31. 10
    186
      Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h
  32. 0
    1
      Marlin/language.h
  33. 3
    0
      Marlin/language_en.h
  34. 20
    0
      Marlin/mesh_bed_leveling.cpp
  35. 61
    0
      Marlin/mesh_bed_leveling.h
  36. 0
    2
      Marlin/pins.h
  37. 523
    641
      Marlin/planner.cpp
  38. 53
    64
      Marlin/planner.h
  39. 61
    68
      Marlin/stepper.cpp
  40. 97
    144
      Marlin/temperature.cpp
  41. 94
    12
      Marlin/ultralcd.cpp
  42. 12
    13
      Marlin/ultralcd.h

BIN
Documentation/Logo/marlinwiki.png View File


+ 29
- 0
Documentation/changelog.md View File

@@ -1 +1,30 @@
1
+### Version 1.0.3
2
+* Reduced code size, maybe a lot depending on your configuration.
3
+* Improved support for Delta, SCARA, and COREXY kinematics.
4
+* Move parts of Configuration files to `Conditionals.h` and `SanityCheck.h`.
5
+* Clean up of temperature code.
6
+* Enhanced `G29` with improved grid bed leveling based on Roxy code. See documentation.
7
+* Various bugs fixed from 1.0.2.
8
+* EEPROM layout updated to `V17`.
9
+* Added `M204` travel acceleration options.
10
+* `M204` "`P`" parameter replaces "`S`." "`S`" retained for backward compatibility.
11
+* Support for more RAMPS-based boards.
12
+* Configurator utility under development.
13
+* `M404` "`N`" parameter replaced with "`W`." ("`N`" is for line numbers only).
14
+* Much cleanup of the code.
15
+* Improved support for Cyrillic and accented languages.
16
+* LCD controller knob acceleration.
17
+* Improved compatibility with various sensors, MAX6675 thermocouple.
18
+* Filament runout sensor support.
19
+* Filament width measurement support.
20
+* Support for TMC and L6470 stepper drivers.
21
+* Better support of G-Code `;` comments, `\`, `N` line numbers, and `*` checksums.
22
+* Moved GCode handling code into individual functions per-code.
1 23
 
24
+### Version 1.0.2
25
+* Progress bar for character-based LCD displays.
26
+
27
+### Version 1.0.1
28
+
29
+### Version 1.0.0
30
+* Initial release

+ 405
- 0
Marlin/Conditionals.h View File

@@ -0,0 +1,405 @@
1
+/**
2
+ * Conditionals.h
3
+ * Defines that depend on configuration but are not editable.
4
+ */
5
+#ifndef CONDITIONALS_H
6
+
7
+#ifndef CONFIGURATION_LCD // Get the LCD defines which are needed first
8
+
9
+  #define CONFIGURATION_LCD
10
+
11
+  #if defined(MAKRPANEL)
12
+    #define DOGLCD
13
+    #define SDSUPPORT
14
+    #define DEFAULT_LCD_CONTRAST 17
15
+    #define ULTIPANEL
16
+    #define NEWPANEL
17
+  #endif
18
+
19
+  #if defined(miniVIKI) || defined(VIKI2)
20
+    #define ULTRA_LCD  //general LCD support, also 16x2
21
+    #define DOGLCD  // Support for SPI LCD 128x64 (Controller ST7565R graphic Display Family)
22
+    #define ULTIMAKERCONTROLLER //as available from the Ultimaker online store.
23
+
24
+    #ifdef miniVIKI
25
+      #define DEFAULT_LCD_CONTRAST 95
26
+    #else
27
+      #define DEFAULT_LCD_CONTRAST 40
28
+    #endif
29
+
30
+    #define ENCODER_PULSES_PER_STEP 4
31
+    #define ENCODER_STEPS_PER_MENU_ITEM 1
32
+  #endif
33
+
34
+  #ifdef PANEL_ONE
35
+    #define SDSUPPORT
36
+    #define ULTIMAKERCONTROLLER
37
+  #endif
38
+
39
+  #ifdef REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER
40
+    #define DOGLCD
41
+    #define U8GLIB_ST7920
42
+    #define REPRAP_DISCOUNT_SMART_CONTROLLER
43
+  #endif
44
+
45
+  #if defined(ULTIMAKERCONTROLLER) || defined(REPRAP_DISCOUNT_SMART_CONTROLLER) || defined(G3D_PANEL)
46
+    #define ULTIPANEL
47
+    #define NEWPANEL
48
+  #endif
49
+
50
+  #ifdef REPRAPWORLD_KEYPAD
51
+    #define ULTIPANEL
52
+    #define NEWPANEL
53
+  #endif
54
+
55
+  #ifdef RA_CONTROL_PANEL
56
+    #define LCD_I2C_TYPE_PCA8574
57
+    #define LCD_I2C_ADDRESS 0x27   // I2C Address of the port expander
58
+    #define ULTIPANEL
59
+    #define NEWPANEL
60
+  #endif
61
+
62
+  /**
63
+   * I2C PANELS
64
+   */
65
+
66
+  #ifdef LCD_I2C_SAINSMART_YWROBOT
67
+    // This uses the LiquidCrystal_I2C library ( https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home )
68
+    // Make sure it is placed in the Arduino libraries directory.
69
+    #define LCD_I2C_TYPE_PCF8575
70
+    #define LCD_I2C_ADDRESS 0x27   // I2C Address of the port expander
71
+    #define ULTIPANEL
72
+    #define NEWPANEL
73
+  #endif
74
+
75
+  // PANELOLU2 LCD with status LEDs, separate encoder and click inputs
76
+  #ifdef LCD_I2C_PANELOLU2
77
+    // This uses the LiquidTWI2 library v1.2.3 or later ( https://github.com/lincomatic/LiquidTWI2 )
78
+    // Make sure the LiquidTWI2 directory is placed in the Arduino or Sketchbook libraries subdirectory.
79
+    // (v1.2.3 no longer requires you to define PANELOLU in the LiquidTWI2.h library header file)
80
+    // Note: The PANELOLU2 encoder click input can either be directly connected to a pin
81
+    //       (if BTN_ENC defined to != -1) or read through I2C (when BTN_ENC == -1).
82
+    #define LCD_I2C_TYPE_MCP23017
83
+    #define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander
84
+    #define LCD_USE_I2C_BUZZER //comment out to disable buzzer on LCD
85
+
86
+    #ifndef ENCODER_PULSES_PER_STEP
87
+      #define ENCODER_PULSES_PER_STEP 4
88
+    #endif
89
+
90
+    #ifndef ENCODER_STEPS_PER_MENU_ITEM
91
+      #define ENCODER_STEPS_PER_MENU_ITEM 1
92
+    #endif
93
+
94
+    #ifdef LCD_USE_I2C_BUZZER
95
+      #define LCD_FEEDBACK_FREQUENCY_HZ 1000
96
+      #define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100
97
+    #endif
98
+
99
+    #define ULTIPANEL
100
+    #define NEWPANEL
101
+  #endif
102
+
103
+  // Panucatt VIKI LCD with status LEDs, integrated click & L/R/U/P buttons, separate encoder inputs
104
+  #ifdef LCD_I2C_VIKI
105
+    // This uses the LiquidTWI2 library v1.2.3 or later ( https://github.com/lincomatic/LiquidTWI2 )
106
+    // Make sure the LiquidTWI2 directory is placed in the Arduino or Sketchbook libraries subdirectory.
107
+    // Note: The pause/stop/resume LCD button pin should be connected to the Arduino
108
+    //       BTN_ENC pin (or set BTN_ENC to -1 if not used)
109
+    #define LCD_I2C_TYPE_MCP23017
110
+    #define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander
111
+    #define LCD_USE_I2C_BUZZER //comment out to disable buzzer on LCD (requires LiquidTWI2 v1.2.3 or later)
112
+    #define ULTIPANEL
113
+    #define NEWPANEL
114
+  #endif
115
+
116
+  // Shift register panels
117
+  // ---------------------
118
+  // 2 wire Non-latching LCD SR from:
119
+  // https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection
120
+
121
+  #ifdef SAV_3DLCD
122
+     #define SR_LCD_2W_NL    // Non latching 2 wire shiftregister
123
+     #define ULTIPANEL
124
+     #define NEWPANEL
125
+  #endif
126
+
127
+
128
+  #ifdef ULTIPANEL
129
+    #define NEWPANEL  //enable this if you have a click-encoder panel
130
+    #define SDSUPPORT
131
+    #define ULTRA_LCD
132
+    #ifdef DOGLCD // Change number of lines to match the DOG graphic display
133
+      #define LCD_WIDTH 22
134
+      #define LCD_HEIGHT 5
135
+    #else
136
+      #define LCD_WIDTH 20
137
+      #define LCD_HEIGHT 4
138
+    #endif
139
+  #else //no panel but just LCD
140
+    #ifdef ULTRA_LCD
141
+    #ifdef DOGLCD // Change number of lines to match the 128x64 graphics display
142
+      #define LCD_WIDTH 22
143
+      #define LCD_HEIGHT 5
144
+    #else
145
+      #define LCD_WIDTH 16
146
+      #define LCD_HEIGHT 2
147
+    #endif
148
+    #endif
149
+  #endif
150
+
151
+  /**
152
+   * Default LCD contrast for dogm-like LCD displays
153
+   */
154
+  #if defined(DOGLCD) && !defined(DEFAULT_LCD_CONTRAST)
155
+    #define DEFAULT_LCD_CONTRAST 32
156
+  #endif
157
+
158
+#else // CONFIGURATION_LCD
159
+
160
+  #define CONDITIONALS_H
161
+
162
+  #ifndef AT90USB
163
+    #define HardwareSerial_h // trick to disable the standard HWserial
164
+  #endif
165
+
166
+  #if (ARDUINO >= 100)
167
+    #include "Arduino.h"
168
+  #else
169
+    #include "WProgram.h"
170
+  #endif
171
+
172
+  #include "pins.h"
173
+
174
+  /**
175
+   * ENDSTOPPULLUPS
176
+   */
177
+  #ifdef ENDSTOPPULLUPS
178
+    #ifndef DISABLE_MAX_ENDSTOPS
179
+      #define ENDSTOPPULLUP_XMAX
180
+      #define ENDSTOPPULLUP_YMAX
181
+      #define ENDSTOPPULLUP_ZMAX
182
+    #endif
183
+    #ifndef DISABLE_MIN_ENDSTOPS
184
+      #define ENDSTOPPULLUP_XMIN
185
+      #define ENDSTOPPULLUP_YMIN
186
+      #define ENDSTOPPULLUP_ZMIN
187
+    #endif
188
+  #endif
189
+
190
+  /**
191
+   * Axis lengths
192
+   */
193
+  #define X_MAX_LENGTH (X_MAX_POS - X_MIN_POS)
194
+  #define Y_MAX_LENGTH (Y_MAX_POS - Y_MIN_POS)
195
+  #define Z_MAX_LENGTH (Z_MAX_POS - Z_MIN_POS)
196
+
197
+  /**
198
+   * SCARA
199
+   */
200
+  #ifdef SCARA
201
+    #undef SLOWDOWN
202
+    #define QUICK_HOME //SCARA needs Quickhome
203
+  #endif
204
+
205
+  /**
206
+   * AUTOSET LOCATIONS OF LIMIT SWITCHES
207
+   * Added by ZetaPhoenix 09-15-2012
208
+   */
209
+  #ifdef MANUAL_HOME_POSITIONS  // Use manual limit switch locations
210
+    #define X_HOME_POS MANUAL_X_HOME_POS
211
+    #define Y_HOME_POS MANUAL_Y_HOME_POS
212
+    #define Z_HOME_POS MANUAL_Z_HOME_POS
213
+  #else //!MANUAL_HOME_POSITIONS – Use home switch positions based on homing direction and travel limits
214
+    #ifdef BED_CENTER_AT_0_0
215
+      #define X_HOME_POS X_MAX_LENGTH * X_HOME_DIR * 0.5
216
+      #define Y_HOME_POS Y_MAX_LENGTH * Y_HOME_DIR * 0.5
217
+    #else
218
+      #define X_HOME_POS (X_HOME_DIR < 0 ? X_MIN_POS : X_MAX_POS)
219
+      #define Y_HOME_POS (Y_HOME_DIR < 0 ? Y_MIN_POS : Y_MAX_POS)
220
+    #endif
221
+    #define Z_HOME_POS (Z_HOME_DIR < 0 ? Z_MIN_POS : Z_MAX_POS)
222
+  #endif //!MANUAL_HOME_POSITIONS
223
+
224
+  /**
225
+   * Auto Bed Leveling
226
+   */
227
+  #ifdef ENABLE_AUTO_BED_LEVELING
228
+    // Boundaries for probing based on set limits
229
+    #define MIN_PROBE_X (max(X_MIN_POS, X_MIN_POS + X_PROBE_OFFSET_FROM_EXTRUDER))
230
+    #define MAX_PROBE_X (min(X_MAX_POS, X_MAX_POS + X_PROBE_OFFSET_FROM_EXTRUDER))
231
+    #define MIN_PROBE_Y (max(Y_MIN_POS, Y_MIN_POS + Y_PROBE_OFFSET_FROM_EXTRUDER))
232
+    #define MAX_PROBE_Y (min(Y_MAX_POS, Y_MAX_POS + Y_PROBE_OFFSET_FROM_EXTRUDER))
233
+  #endif
234
+
235
+  /**
236
+   * MAX_STEP_FREQUENCY differs for TOSHIBA
237
+   */
238
+  #ifdef CONFIG_STEPPERS_TOSHIBA
239
+    #define MAX_STEP_FREQUENCY 10000 // Max step frequency for Toshiba Stepper Controllers
240
+  #else
241
+    #define MAX_STEP_FREQUENCY 40000 // Max step frequency for Ultimaker (5000 pps / half step)
242
+  #endif
243
+
244
+  // MS1 MS2 Stepper Driver Microstepping mode table
245
+  #define MICROSTEP1 LOW,LOW
246
+  #define MICROSTEP2 HIGH,LOW
247
+  #define MICROSTEP4 LOW,HIGH
248
+  #define MICROSTEP8 HIGH,HIGH
249
+  #define MICROSTEP16 HIGH,HIGH
250
+
251
+  /**
252
+   * Advance calculated values
253
+   */
254
+  #ifdef ADVANCE
255
+    #define EXTRUSION_AREA (0.25 * D_FILAMENT * D_FILAMENT * 3.14159)
256
+    #define STEPS_PER_CUBIC_MM_E (axis_steps_per_unit[E_AXIS] / EXTRUSION_AREA)
257
+  #endif
258
+
259
+  #ifdef ULTIPANEL
260
+   #undef SDCARDDETECTINVERTED
261
+  #endif
262
+
263
+  // Power Signal Control Definitions
264
+  // By default use ATX definition
265
+  #ifndef POWER_SUPPLY
266
+    #define POWER_SUPPLY 1
267
+  #endif
268
+  // 1 = ATX
269
+  #if (POWER_SUPPLY == 1)
270
+    #define PS_ON_AWAKE  LOW
271
+    #define PS_ON_ASLEEP HIGH
272
+  #endif
273
+  // 2 = X-Box 360 203W
274
+  #if (POWER_SUPPLY == 2)
275
+    #define PS_ON_AWAKE  HIGH
276
+    #define PS_ON_ASLEEP LOW
277
+  #endif
278
+
279
+  /**
280
+   * Temp Sensor defines
281
+   */
282
+  #if TEMP_SENSOR_0 == -2
283
+    #define HEATER_0_USES_MAX6675
284
+  #elif TEMP_SENSOR_0 == -1
285
+    #define HEATER_0_USES_AD595
286
+  #elif TEMP_SENSOR_0 == 0
287
+    #undef HEATER_0_MINTEMP
288
+    #undef HEATER_0_MAXTEMP
289
+  #elif TEMP_SENSOR_0 > 0
290
+    #define THERMISTORHEATER_0 TEMP_SENSOR_0
291
+    #define HEATER_0_USES_THERMISTOR
292
+  #endif
293
+
294
+  #if TEMP_SENSOR_1 == -1
295
+    #define HEATER_1_USES_AD595
296
+  #elif TEMP_SENSOR_1 == 0
297
+    #undef HEATER_1_MINTEMP
298
+    #undef HEATER_1_MAXTEMP
299
+  #elif TEMP_SENSOR_1 > 0
300
+    #define THERMISTORHEATER_1 TEMP_SENSOR_1
301
+    #define HEATER_1_USES_THERMISTOR
302
+  #endif
303
+
304
+  #if TEMP_SENSOR_2 == -1
305
+    #define HEATER_2_USES_AD595
306
+  #elif TEMP_SENSOR_2 == 0
307
+    #undef HEATER_2_MINTEMP
308
+    #undef HEATER_2_MAXTEMP
309
+  #elif TEMP_SENSOR_2 > 0
310
+    #define THERMISTORHEATER_2 TEMP_SENSOR_2
311
+    #define HEATER_2_USES_THERMISTOR
312
+  #endif
313
+
314
+  #if TEMP_SENSOR_3 == -1
315
+    #define HEATER_3_USES_AD595
316
+  #elif TEMP_SENSOR_3 == 0
317
+    #undef HEATER_3_MINTEMP
318
+    #undef HEATER_3_MAXTEMP
319
+  #elif TEMP_SENSOR_3 > 0
320
+    #define THERMISTORHEATER_3 TEMP_SENSOR_3
321
+    #define HEATER_3_USES_THERMISTOR
322
+  #endif
323
+
324
+  #if TEMP_SENSOR_BED == -1
325
+    #define BED_USES_AD595
326
+  #elif TEMP_SENSOR_BED == 0
327
+    #undef BED_MINTEMP
328
+    #undef BED_MAXTEMP
329
+  #elif TEMP_SENSOR_BED > 0
330
+    #define THERMISTORBED TEMP_SENSOR_BED
331
+    #define BED_USES_THERMISTOR
332
+  #endif
333
+
334
+  /**
335
+   * ARRAY_BY_EXTRUDERS based on EXTRUDERS
336
+   */
337
+  #if EXTRUDERS > 3
338
+    #define ARRAY_BY_EXTRUDERS(v1, v2, v3, v4) { v1, v2, v3, v4 }
339
+  #elif EXTRUDERS > 2
340
+    #define ARRAY_BY_EXTRUDERS(v1, v2, v3, v4) { v1, v2, v3 }
341
+  #elif EXTRUDERS > 1
342
+    #define ARRAY_BY_EXTRUDERS(v1, v2, v3, v4) { v1, v2 }
343
+  #else
344
+    #define ARRAY_BY_EXTRUDERS(v1, v2, v3, v4) { v1 }
345
+  #endif
346
+
347
+  /**
348
+   * Shorthand for pin tests, for temperature.cpp
349
+   */
350
+  #define HAS_TEMP_0 (defined(TEMP_0_PIN) && TEMP_0_PIN >= 0)
351
+  #define HAS_TEMP_1 (defined(TEMP_1_PIN) && TEMP_1_PIN >= 0)
352
+  #define HAS_TEMP_2 (defined(TEMP_2_PIN) && TEMP_2_PIN >= 0)
353
+  #define HAS_TEMP_3 (defined(TEMP_3_PIN) && TEMP_3_PIN >= 0)
354
+  #define HAS_TEMP_BED (defined(TEMP_BED_PIN) && TEMP_BED_PIN >= 0)
355
+  #define HAS_FILAMENT_SENSOR (defined(FILAMENT_SENSOR) && defined(FILWIDTH_PIN) && FILWIDTH_PIN >= 0)
356
+  #define HAS_HEATER_0 (defined(HEATER_0_PIN) && HEATER_0_PIN >= 0)
357
+  #define HAS_HEATER_1 (defined(HEATER_1_PIN) && HEATER_1_PIN >= 0)
358
+  #define HAS_HEATER_2 (defined(HEATER_2_PIN) && HEATER_2_PIN >= 0)
359
+  #define HAS_HEATER_3 (defined(HEATER_3_PIN) && HEATER_3_PIN >= 0)
360
+  #define HAS_HEATER_BED (defined(HEATER_BED_PIN) && HEATER_BED_PIN >= 0)
361
+  #define HAS_AUTO_FAN_0 (defined(EXTRUDER_0_AUTO_FAN_PIN) && EXTRUDER_0_AUTO_FAN_PIN >= 0)
362
+  #define HAS_AUTO_FAN_1 (defined(EXTRUDER_1_AUTO_FAN_PIN) && EXTRUDER_1_AUTO_FAN_PIN >= 0)
363
+  #define HAS_AUTO_FAN_2 (defined(EXTRUDER_2_AUTO_FAN_PIN) && EXTRUDER_2_AUTO_FAN_PIN >= 0)
364
+  #define HAS_AUTO_FAN_3 (defined(EXTRUDER_3_AUTO_FAN_PIN) && EXTRUDER_3_AUTO_FAN_PIN >= 0)
365
+  #define HAS_AUTO_FAN HAS_AUTO_FAN_0 || HAS_AUTO_FAN_1 || HAS_AUTO_FAN_2 || HAS_AUTO_FAN_3
366
+  #define HAS_FAN (defined(FAN_PIN) && FAN_PIN >= 0)
367
+
368
+  /**
369
+   * Helper Macros for heaters and extruder fan
370
+   */
371
+  #define WRITE_HEATER_0P(v) WRITE(HEATER_0_PIN, v)
372
+  #if EXTRUDERS > 1 || defined(HEATERS_PARALLEL)
373
+    #define WRITE_HEATER_1(v) WRITE(HEATER_1_PIN, v)
374
+    #if EXTRUDERS > 2
375
+      #define WRITE_HEATER_2(v) WRITE(HEATER_2_PIN, v)
376
+      #if EXTRUDERS > 3
377
+        #define WRITE_HEATER_3(v) WRITE(HEATER_3_PIN, v)
378
+      #endif
379
+    #endif
380
+  #endif
381
+  #ifdef HEATERS_PARALLEL
382
+    #define WRITE_HEATER_0(v) { WRITE_HEATER_0P(v); WRITE_HEATER_1(v); }
383
+  #else
384
+    #define WRITE_HEATER_0(v) WRITE_HEATER_0P(v)
385
+  #endif
386
+  #if HAS_HEATER_BED
387
+    #define WRITE_HEATER_BED(v) WRITE(HEATER_BED_PIN, v)
388
+  #endif
389
+  #if HAS_FAN
390
+    #define WRITE_FAN(v) WRITE(FAN_PIN, v)
391
+  #endif
392
+
393
+  /**
394
+   * Sampling period of the temperature routine
395
+   * This override comes originally from temperature.cpp
396
+   * The Configuration.h option is basically ignored.
397
+   */
398
+  #ifdef PID_dT
399
+    #undef PID_dT
400
+  #endif
401
+  #define PID_dT ((OVERSAMPLENR * 12.0)/(F_CPU / 64.0 / 256.0))
402
+
403
+
404
+#endif //CONFIGURATION_LCD
405
+#endif //CONDITIONALS_H

+ 26
- 150
Marlin/Configuration.h View File

@@ -360,10 +360,6 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o
360 360
 #define Y_MAX_POS 200
361 361
 #define Z_MAX_POS 200
362 362
 
363
-#define X_MAX_LENGTH (X_MAX_POS - X_MIN_POS)
364
-#define Y_MAX_LENGTH (Y_MAX_POS - Y_MIN_POS)
365
-#define Z_MAX_LENGTH (Z_MAX_POS - Z_MIN_POS)
366
-
367 363
 //===========================================================================
368 364
 //============================= Filament Runout Sensor ======================
369 365
 //===========================================================================
@@ -375,6 +371,23 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o
375 371
 //#define ENDSTOPPULLUP_FIL_RUNOUT // Uncomment to use internal pullup for filament runout pins if the sensor is defined.
376 372
 
377 373
 //===========================================================================
374
+//============================ Manual Bed Leveling ==========================
375
+//===========================================================================
376
+
377
+// #define MANUAL_BED_LEVELING  // Add display menu option for bed leveling
378
+// #define MESH_BED_LEVELING    // Enable mesh bed leveling
379
+
380
+#if defined(MESH_BED_LEVELING)
381
+  #define MESH_MIN_X 10
382
+  #define MESH_MAX_X (X_MAX_POS - MESH_MIN_X)
383
+  #define MESH_MIN_Y 10
384
+  #define MESH_MAX_Y (Y_MAX_POS - MESH_MIN_Y)
385
+  #define MESH_NUM_X_POINTS 3  // Don't use more than 7 points per axis, implementation limited
386
+  #define MESH_NUM_Y_POINTS 3
387
+  #define MESH_HOME_SEARCH_Z 4  // Z after Home, bed somewhere below but above 0.0
388
+#endif  // MESH_BED_LEVELING
389
+
390
+//===========================================================================
378 391
 //============================= Bed Auto Leveling ===========================
379 392
 //===========================================================================
380 393
 
@@ -400,12 +413,6 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o
400 413
 
401 414
   #ifdef AUTO_BED_LEVELING_GRID
402 415
 
403
-    // Use one of these defines to specify the origin
404
-    // for a topographical map to be printed for your bed.
405
-    enum { OriginBackLeft, OriginFrontLeft, OriginBackRight, OriginFrontRight };
406
-    #define TOPO_ORIGIN OriginFrontLeft
407
-
408
-    // The edges of the rectangle in which to probe
409 416
     #define LEFT_PROBE_BED_POSITION 15
410 417
     #define RIGHT_PROBE_BED_POSITION 170
411 418
     #define FRONT_PROBE_BED_POSITION 20
@@ -616,112 +623,17 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o
616 623
 // REMEMBER TO INSTALL LiquidCrystal_I2C.h in your ARDUINO library folder: https://github.com/kiyoshigawa/LiquidCrystal_I2C
617 624
 //#define RA_CONTROL_PANEL
618 625
 
619
-//automatic expansion
620
-#if defined (MAKRPANEL)
621
- #define DOGLCD
622
- #define SDSUPPORT
623
- #define ULTIPANEL
624
- #define NEWPANEL
625
- #define DEFAULT_LCD_CONTRAST 17
626
-#endif
627
-
628
-#if defined(miniVIKI) || defined(VIKI2)
629
- #define ULTRA_LCD  //general LCD support, also 16x2
630
- #define DOGLCD  // Support for SPI LCD 128x64 (Controller ST7565R graphic Display Family)
631
- #define ULTIMAKERCONTROLLER //as available from the Ultimaker online store.
632
- 
633
-  #ifdef miniVIKI
634
-   #define DEFAULT_LCD_CONTRAST 95
635
-  #else
636
-   #define DEFAULT_LCD_CONTRAST 40
637
-  #endif
638
-  
639
- #define ENCODER_PULSES_PER_STEP 4
640
- #define ENCODER_STEPS_PER_MENU_ITEM 1
641
-#endif
642
-
643
-#if defined (PANEL_ONE)
644
- #define SDSUPPORT
645
- #define ULTIMAKERCONTROLLER
646
-#endif
647
-
648
-#if defined (REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER)
649
- #define DOGLCD
650
- #define U8GLIB_ST7920
651
- #define REPRAP_DISCOUNT_SMART_CONTROLLER
652
-#endif
653
-
654
-#if defined(ULTIMAKERCONTROLLER) || defined(REPRAP_DISCOUNT_SMART_CONTROLLER) || defined(G3D_PANEL)
655
- #define ULTIPANEL
656
- #define NEWPANEL
657
-#endif
658
-
659
-#if defined(REPRAPWORLD_KEYPAD)
660
-  #define NEWPANEL
661
-  #define ULTIPANEL
662
-#endif
663
-#if defined(RA_CONTROL_PANEL)
664
- #define ULTIPANEL
665
- #define NEWPANEL
666
- #define LCD_I2C_TYPE_PCA8574
667
- #define LCD_I2C_ADDRESS 0x27   // I2C Address of the port expander
668
-#endif
669
-
670
-//I2C PANELS
626
+/**
627
+ * I2C Panels
628
+ */
671 629
 
672 630
 //#define LCD_I2C_SAINSMART_YWROBOT
673
-#ifdef LCD_I2C_SAINSMART_YWROBOT
674
-  // This uses the LiquidCrystal_I2C library ( https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home )
675
-  // Make sure it is placed in the Arduino libraries directory.
676
-  #define LCD_I2C_TYPE_PCF8575
677
-  #define LCD_I2C_ADDRESS 0x27   // I2C Address of the port expander
678
-  #define NEWPANEL
679
-  #define ULTIPANEL
680
-#endif
681 631
 
682 632
 // PANELOLU2 LCD with status LEDs, separate encoder and click inputs
683 633
 //#define LCD_I2C_PANELOLU2
684
-#ifdef LCD_I2C_PANELOLU2
685
-  // This uses the LiquidTWI2 library v1.2.3 or later ( https://github.com/lincomatic/LiquidTWI2 )
686
-  // Make sure the LiquidTWI2 directory is placed in the Arduino or Sketchbook libraries subdirectory.
687
-  // (v1.2.3 no longer requires you to define PANELOLU in the LiquidTWI2.h library header file)
688
-  // Note: The PANELOLU2 encoder click input can either be directly connected to a pin
689
-  //       (if BTN_ENC defined to != -1) or read through I2C (when BTN_ENC == -1).
690
-  #define LCD_I2C_TYPE_MCP23017
691
-  #define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander
692
-  #define LCD_USE_I2C_BUZZER //comment out to disable buzzer on LCD
693
-  #define NEWPANEL
694
-  #define ULTIPANEL
695
-
696
-  #ifndef ENCODER_PULSES_PER_STEP
697
-	#define ENCODER_PULSES_PER_STEP 4
698
-  #endif
699
-
700
-  #ifndef ENCODER_STEPS_PER_MENU_ITEM
701
-	#define ENCODER_STEPS_PER_MENU_ITEM 1
702
-  #endif
703
-
704
-
705
-  #ifdef LCD_USE_I2C_BUZZER
706
-	#define LCD_FEEDBACK_FREQUENCY_HZ 1000
707
-	#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100
708
-  #endif
709
-
710
-#endif
711 634
 
712 635
 // Panucatt VIKI LCD with status LEDs, integrated click & L/R/U/P buttons, separate encoder inputs
713 636
 //#define LCD_I2C_VIKI
714
-#ifdef LCD_I2C_VIKI
715
-  // This uses the LiquidTWI2 library v1.2.3 or later ( https://github.com/lincomatic/LiquidTWI2 )
716
-  // Make sure the LiquidTWI2 directory is placed in the Arduino or Sketchbook libraries subdirectory.
717
-  // Note: The pause/stop/resume LCD button pin should be connected to the Arduino
718
-  //       BTN_ENC pin (or set BTN_ENC to -1 if not used)
719
-  #define LCD_I2C_TYPE_MCP23017
720
-  #define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander
721
-  #define LCD_USE_I2C_BUZZER //comment out to disable buzzer on LCD (requires LiquidTWI2 v1.2.3 or later)
722
-  #define NEWPANEL
723
-  #define ULTIPANEL
724
-#endif
725 637
 
726 638
 // Shift register panels
727 639
 // ---------------------
@@ -729,51 +641,10 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o
729 641
 // https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection 
730 642
 
731 643
 //#define SAV_3DLCD
732
-#ifdef SAV_3DLCD
733
-   #define SR_LCD_2W_NL    // Non latching 2 wire shiftregister
734
-   #define NEWPANEL
735
-   #define ULTIPANEL
736
-#endif
737
-
738
-
739
-#ifdef ULTIPANEL
740
-//  #define NEWPANEL  //enable this if you have a click-encoder panel
741
-  #define SDSUPPORT
742
-  #define ULTRA_LCD
743
-  #ifdef DOGLCD // Change number of lines to match the DOG graphic display
744
-    #define LCD_WIDTH 22
745
-    #define LCD_HEIGHT 5
746
-  #else
747
-    #define LCD_WIDTH 20
748
-    #define LCD_HEIGHT 4
749
-  #endif
750
-#else //no panel but just LCD
751
-  #ifdef ULTRA_LCD
752
-  #ifdef DOGLCD // Change number of lines to match the 128x64 graphics display
753
-    #define LCD_WIDTH 22
754
-    #define LCD_HEIGHT 5
755
-  #else
756
-    #define LCD_WIDTH 16
757
-    #define LCD_HEIGHT 2
758
-  #endif
759
-  #endif
760
-#endif
761
-
762
-// default LCD contrast for dogm-like LCD displays
763
-#ifdef DOGLCD
764
-# ifndef DEFAULT_LCD_CONTRAST
765
-#  define DEFAULT_LCD_CONTRAST 32
766
-# endif
767
-#endif
768 644
 
769 645
 // Increase the FAN pwm frequency. Removes the PWM noise but increases heating in the FET/Arduino
770 646
 //#define FAST_PWM_FAN
771 647
 
772
-// Temperature status LEDs that display the hotend and bet temperature.
773
-// If all hotends and bed temperature and temperature setpoint are < 54C then the BLUE led is on.
774
-// Otherwise the RED led is on. There is 1C hysteresis.
775
-//#define TEMP_STAT_LEDS
776
-
777 648
 // Use software PWM to drive the fan, as for the heaters. This uses a very low frequency
778 649
 // which is not ass annoying as with the hardware PWM. On the other hand, if this frequency
779 650
 // is too low, you should also increment SOFT_PWM_SCALE.
@@ -785,6 +656,11 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o
785 656
 // at zero value, there are 128 effective control positions.
786 657
 #define SOFT_PWM_SCALE 0
787 658
 
659
+// Temperature status LEDs that display the hotend and bet temperature.
660
+// If all hotends and bed temperature and temperature setpoint are < 54C then the BLUE led is on.
661
+// Otherwise the RED led is on. There is 1C hysteresis.
662
+//#define TEMP_STAT_LEDS
663
+
788 664
 // M240  Triggers a camera by emulating a Canon RC-1 Remote
789 665
 // Data from: http://www.doc-diy.net/photo/rc-1_hacked/
790 666
 // #define PHOTOGRAPH_PIN     23
@@ -856,4 +732,4 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o
856 732
 #include "Configuration_adv.h"
857 733
 #include "thermistortables.h"
858 734
 
859
-#endif //__CONFIGURATION_H
735
+#endif //CONFIGURATION_H

+ 70
- 9
Marlin/ConfigurationStore.cpp View File

@@ -18,7 +18,13 @@
18 18
  *  max_xy_jerk
19 19
  *  max_z_jerk
20 20
  *  max_e_jerk
21
- *  add_homing (x3)
21
+ *  home_offset (x3)
22
+ *
23
+ * Mesh bed leveling:
24
+ *  active
25
+ *  mesh_num_x
26
+ *  mesh_num_y
27
+ *  z_values[][]
22 28
  *
23 29
  * DELTA:
24 30
  *  endstop_adj (x3)
@@ -69,6 +75,10 @@
69 75
 #include "ultralcd.h"
70 76
 #include "ConfigurationStore.h"
71 77
 
78
+#if defined(MESH_BED_LEVELING)
79
+   #include "mesh_bed_leveling.h"
80
+#endif  // MESH_BED_LEVELING
81
+
72 82
 void _EEPROM_writeData(int &pos, uint8_t* value, uint8_t size) {
73 83
   uint8_t c;
74 84
   while(size--) {
@@ -105,7 +115,7 @@ void _EEPROM_readData(int &pos, uint8_t* value, uint8_t size) {
105 115
 // wrong data being written to the variables.
106 116
 // ALSO:  always make sure the variables in the Store and retrieve sections are in the same order.
107 117
 
108
-#define EEPROM_VERSION "V16"
118
+#define EEPROM_VERSION "V17"
109 119
 
110 120
 #ifdef EEPROM_SETTINGS
111 121
 
@@ -126,7 +136,29 @@ void Config_StoreSettings()  {
126 136
   EEPROM_WRITE_VAR(i, max_xy_jerk);
127 137
   EEPROM_WRITE_VAR(i, max_z_jerk);
128 138
   EEPROM_WRITE_VAR(i, max_e_jerk);
129
-  EEPROM_WRITE_VAR(i, add_homing);
139
+  EEPROM_WRITE_VAR(i, home_offset);
140
+
141
+  uint8_t mesh_num_x = 3;
142
+  uint8_t mesh_num_y = 3;
143
+  #if defined(MESH_BED_LEVELING)
144
+    // Compile time test that sizeof(mbl.z_values) is as expected
145
+    typedef char c_assert[(sizeof(mbl.z_values) == MESH_NUM_X_POINTS*MESH_NUM_Y_POINTS*sizeof(dummy)) ? 1 : -1];
146
+    mesh_num_x = MESH_NUM_X_POINTS;
147
+    mesh_num_y = MESH_NUM_Y_POINTS;
148
+    EEPROM_WRITE_VAR(i, mbl.active);
149
+    EEPROM_WRITE_VAR(i, mesh_num_x);
150
+    EEPROM_WRITE_VAR(i, mesh_num_y);
151
+    EEPROM_WRITE_VAR(i, mbl.z_values);
152
+  #else
153
+    uint8_t dummy_uint8 = 0;
154
+    EEPROM_WRITE_VAR(i, dummy_uint8);
155
+    EEPROM_WRITE_VAR(i, mesh_num_x);
156
+    EEPROM_WRITE_VAR(i, mesh_num_y);
157
+    dummy = 0.0f;
158
+    for (int q=0; q<mesh_num_x*mesh_num_y; q++) {
159
+      EEPROM_WRITE_VAR(i, dummy);
160
+    }
161
+  #endif  // MESH_BED_LEVELING
130 162
 
131 163
   #ifdef DELTA
132 164
     EEPROM_WRITE_VAR(i, endstop_adj);               // 3 floats
@@ -250,7 +282,7 @@ void Config_RetrieveSettings() {
250 282
     EEPROM_READ_VAR(i, max_feedrate);
251 283
     EEPROM_READ_VAR(i, max_acceleration_units_per_sq_second);
252 284
 
253
-        // steps per sq second need to be updated to agree with the units per sq second (as they are what is used in the planner)
285
+    // steps per sq second need to be updated to agree with the units per sq second (as they are what is used in the planner)
254 286
     reset_acceleration_rates();
255 287
 
256 288
     EEPROM_READ_VAR(i, acceleration);
@@ -262,7 +294,32 @@ void Config_RetrieveSettings() {
262 294
     EEPROM_READ_VAR(i, max_xy_jerk);
263 295
     EEPROM_READ_VAR(i, max_z_jerk);
264 296
     EEPROM_READ_VAR(i, max_e_jerk);
265
-    EEPROM_READ_VAR(i, add_homing);
297
+    EEPROM_READ_VAR(i, home_offset);
298
+
299
+    uint8_t mesh_num_x = 0;
300
+    uint8_t mesh_num_y = 0;
301
+    #if defined(MESH_BED_LEVELING)
302
+      EEPROM_READ_VAR(i, mbl.active);
303
+      EEPROM_READ_VAR(i, mesh_num_x);
304
+      EEPROM_READ_VAR(i, mesh_num_y);
305
+      if (mesh_num_x != MESH_NUM_X_POINTS ||
306
+          mesh_num_y != MESH_NUM_Y_POINTS) {
307
+        mbl.reset();
308
+        for (int q=0; q<mesh_num_x*mesh_num_y; q++) {
309
+          EEPROM_READ_VAR(i, dummy);
310
+        }
311
+      } else {
312
+        EEPROM_READ_VAR(i, mbl.z_values);
313
+      }
314
+    #else
315
+      uint8_t dummy_uint8 = 0;
316
+      EEPROM_READ_VAR(i, dummy_uint8);
317
+      EEPROM_READ_VAR(i, mesh_num_x);
318
+      EEPROM_READ_VAR(i, mesh_num_y);
319
+      for (int q=0; q<mesh_num_x*mesh_num_y; q++) {
320
+        EEPROM_READ_VAR(i, dummy);
321
+      }
322
+    #endif  // MESH_BED_LEVELING
266 323
 
267 324
     #ifdef DELTA
268 325
       EEPROM_READ_VAR(i, endstop_adj);                // 3 floats
@@ -390,7 +447,11 @@ void Config_ResetDefault() {
390 447
   max_xy_jerk = DEFAULT_XYJERK;
391 448
   max_z_jerk = DEFAULT_ZJERK;
392 449
   max_e_jerk = DEFAULT_EJERK;
393
-  add_homing[X_AXIS] = add_homing[Y_AXIS] = add_homing[Z_AXIS] = 0;
450
+  home_offset[X_AXIS] = home_offset[Y_AXIS] = home_offset[Z_AXIS] = 0;
451
+
452
+  #if defined(MESH_BED_LEVELING)
453
+    mbl.active = 0;
454
+  #endif  // MESH_BED_LEVELING
394 455
 
395 456
   #ifdef DELTA
396 457
     endstop_adj[X_AXIS] = endstop_adj[Y_AXIS] = endstop_adj[Z_AXIS] = 0;
@@ -546,9 +607,9 @@ void Config_PrintSettings(bool forReplay) {
546 607
     SERIAL_ECHOLNPGM("Home offset (mm):");
547 608
     SERIAL_ECHO_START;
548 609
   }
549
-  SERIAL_ECHOPAIR("  M206 X", add_homing[X_AXIS] );
550
-  SERIAL_ECHOPAIR(" Y", add_homing[Y_AXIS] );
551
-  SERIAL_ECHOPAIR(" Z", add_homing[Z_AXIS] );
610
+  SERIAL_ECHOPAIR("  M206 X", home_offset[X_AXIS] );
611
+  SERIAL_ECHOPAIR(" Y", home_offset[Y_AXIS] );
612
+  SERIAL_ECHOPAIR(" Z", home_offset[Z_AXIS] );
552 613
   SERIAL_EOL;
553 614
 
554 615
   #ifdef DELTA

+ 47
- 244
Marlin/Configuration_adv.h View File

@@ -1,6 +1,8 @@
1 1
 #ifndef CONFIGURATION_ADV_H
2 2
 #define CONFIGURATION_ADV_H
3 3
 
4
+#include "Conditionals.h"
5
+
4 6
 //===========================================================================
5 7
 //=============================Thermal Settings  ============================
6 8
 //===========================================================================
@@ -89,54 +91,6 @@
89 91
 
90 92
 #define ENDSTOPS_ONLY_FOR_HOMING // If defined the endstops will only be used for homing
91 93
 
92
-
93
-//// AUTOSET LOCATIONS OF LIMIT SWITCHES
94
-//// Added by ZetaPhoenix 09-15-2012
95
-#ifdef MANUAL_HOME_POSITIONS  // Use manual limit switch locations
96
-  #define X_HOME_POS MANUAL_X_HOME_POS
97
-  #define Y_HOME_POS MANUAL_Y_HOME_POS
98
-  #define Z_HOME_POS MANUAL_Z_HOME_POS
99
-#else //Set min/max homing switch positions based upon homing direction and min/max travel limits
100
-  //X axis
101
-  #if X_HOME_DIR == -1
102
-    #ifdef BED_CENTER_AT_0_0
103
-      #define X_HOME_POS X_MAX_LENGTH * -0.5
104
-    #else
105
-      #define X_HOME_POS X_MIN_POS
106
-    #endif //BED_CENTER_AT_0_0
107
-  #else
108
-    #ifdef BED_CENTER_AT_0_0
109
-      #define X_HOME_POS X_MAX_LENGTH * 0.5
110
-    #else
111
-      #define X_HOME_POS X_MAX_POS
112
-    #endif //BED_CENTER_AT_0_0
113
-  #endif //X_HOME_DIR == -1
114
-
115
-  //Y axis
116
-  #if Y_HOME_DIR == -1
117
-    #ifdef BED_CENTER_AT_0_0
118
-      #define Y_HOME_POS Y_MAX_LENGTH * -0.5
119
-    #else
120
-      #define Y_HOME_POS Y_MIN_POS
121
-    #endif //BED_CENTER_AT_0_0
122
-  #else
123
-    #ifdef BED_CENTER_AT_0_0
124
-      #define Y_HOME_POS Y_MAX_LENGTH * 0.5
125
-    #else
126
-      #define Y_HOME_POS Y_MAX_POS
127
-    #endif //BED_CENTER_AT_0_0
128
-  #endif //Y_HOME_DIR == -1
129
-
130
-  // Z axis
131
-  #if Z_HOME_DIR == -1 //BED_CENTER_AT_0_0 not used
132
-    #define Z_HOME_POS Z_MIN_POS
133
-  #else
134
-    #define Z_HOME_POS Z_MAX_POS
135
-  #endif //Z_HOME_DIR == -1
136
-#endif //End auto min/max positions
137
-//END AUTOSET LOCATIONS OF LIMIT SWITCHES -ZP
138
-
139
-
140 94
 //#define Z_LATE_ENABLE // Enable Z the last moment. Needed if your Z driver overheats.
141 95
 
142 96
 // A single Z stepper driver is usually used to drive 2 stepper motors.
@@ -146,67 +100,53 @@
146 100
 // On a RAMPS (or other 5 driver) motherboard, using this feature will limit you to using 1 extruder.
147 101
 //#define Z_DUAL_STEPPER_DRIVERS
148 102
 
149
-#ifdef Z_DUAL_STEPPER_DRIVERS
150
-  #undef EXTRUDERS
151
-  #define EXTRUDERS 1
152
-#endif
153
-
154 103
 // Same again but for Y Axis.
155 104
 //#define Y_DUAL_STEPPER_DRIVERS
156 105
 
157 106
 // Define if the two Y drives need to rotate in opposite directions
158 107
 #define INVERT_Y2_VS_Y_DIR true
159 108
 
160
-#ifdef Y_DUAL_STEPPER_DRIVERS
161
-  #undef EXTRUDERS
162
-  #define EXTRUDERS 1
163
-#endif
164
-
165
-#if defined (Z_DUAL_STEPPER_DRIVERS) && defined (Y_DUAL_STEPPER_DRIVERS)
166
-  #error "You cannot have dual drivers for both Y and Z"
167
-#endif
168
-
169 109
 // Enable this for dual x-carriage printers.
170 110
 // A dual x-carriage design has the advantage that the inactive extruder can be parked which
171 111
 // prevents hot-end ooze contaminating the print. It also reduces the weight of each x-carriage
172 112
 // allowing faster printing speeds.
173 113
 //#define DUAL_X_CARRIAGE
174 114
 #ifdef DUAL_X_CARRIAGE
175
-// Configuration for second X-carriage
176
-// Note: the first x-carriage is defined as the x-carriage which homes to the minimum endstop;
177
-// the second x-carriage always homes to the maximum endstop.
178
-#define X2_MIN_POS 80     // set minimum to ensure second x-carriage doesn't hit the parked first X-carriage
179
-#define X2_MAX_POS 353    // set maximum to the distance between toolheads when both heads are homed
180
-#define X2_HOME_DIR 1     // the second X-carriage always homes to the maximum endstop position
181
-#define X2_HOME_POS X2_MAX_POS // default home position is the maximum carriage position
182
-    // However: In this mode the EXTRUDER_OFFSET_X value for the second extruder provides a software
183
-    // override for X2_HOME_POS. This also allow recalibration of the distance between the two endstops
184
-    // without modifying the firmware (through the "M218 T1 X???" command).
185
-    // Remember: you should set the second extruder x-offset to 0 in your slicer.
186
-
187
-// Pins for second x-carriage stepper driver (defined here to avoid further complicating pins.h)
188
-#define X2_ENABLE_PIN 29
189
-#define X2_STEP_PIN 25
190
-#define X2_DIR_PIN 23
191
-
192
-// There are a few selectable movement modes for dual x-carriages using M605 S<mode>
193
-//    Mode 0: Full control. The slicer has full control over both x-carriages and can achieve optimal travel results
194
-//                           as long as it supports dual x-carriages. (M605 S0)
195
-//    Mode 1: Auto-park mode. The firmware will automatically park and unpark the x-carriages on tool changes so
196
-//                           that additional slicer support is not required. (M605 S1)
197
-//    Mode 2: Duplication mode. The firmware will transparently make the second x-carriage and extruder copy all
198
-//                           actions of the first x-carriage. This allows the printer to print 2 arbitrary items at
199
-//                           once. (2nd extruder x offset and temp offset are set using: M605 S2 [Xnnn] [Rmmm])
200
-
201
-// This is the default power-up mode which can be later using M605.
202
-#define DEFAULT_DUAL_X_CARRIAGE_MODE 0
203
-
204
-// Default settings in "Auto-park Mode"
205
-#define TOOLCHANGE_PARK_ZLIFT   0.2      // the distance to raise Z axis when parking an extruder
206
-#define TOOLCHANGE_UNPARK_ZLIFT 1        // the distance to raise Z axis when unparking an extruder
207
-
208
-// Default x offset in duplication mode (typically set to half print bed width)
209
-#define DEFAULT_DUPLICATION_X_OFFSET 100
115
+  // Configuration for second X-carriage
116
+  // Note: the first x-carriage is defined as the x-carriage which homes to the minimum endstop;
117
+  // the second x-carriage always homes to the maximum endstop.
118
+  #define X2_MIN_POS 80     // set minimum to ensure second x-carriage doesn't hit the parked first X-carriage
119
+  #define X2_MAX_POS 353    // set maximum to the distance between toolheads when both heads are homed
120
+  #define X2_HOME_DIR 1     // the second X-carriage always homes to the maximum endstop position
121
+  #define X2_HOME_POS X2_MAX_POS // default home position is the maximum carriage position
122
+      // However: In this mode the EXTRUDER_OFFSET_X value for the second extruder provides a software
123
+      // override for X2_HOME_POS. This also allow recalibration of the distance between the two endstops
124
+      // without modifying the firmware (through the "M218 T1 X???" command).
125
+      // Remember: you should set the second extruder x-offset to 0 in your slicer.
126
+
127
+  // Pins for second x-carriage stepper driver (defined here to avoid further complicating pins.h)
128
+  #define X2_ENABLE_PIN 29
129
+  #define X2_STEP_PIN 25
130
+  #define X2_DIR_PIN 23
131
+
132
+  // There are a few selectable movement modes for dual x-carriages using M605 S<mode>
133
+  //    Mode 0: Full control. The slicer has full control over both x-carriages and can achieve optimal travel results
134
+  //                           as long as it supports dual x-carriages. (M605 S0)
135
+  //    Mode 1: Auto-park mode. The firmware will automatically park and unpark the x-carriages on tool changes so
136
+  //                           that additional slicer support is not required. (M605 S1)
137
+  //    Mode 2: Duplication mode. The firmware will transparently make the second x-carriage and extruder copy all
138
+  //                           actions of the first x-carriage. This allows the printer to print 2 arbitrary items at
139
+  //                           once. (2nd extruder x offset and temp offset are set using: M605 S2 [Xnnn] [Rmmm])
140
+
141
+  // This is the default power-up mode which can be later using M605.
142
+  #define DEFAULT_DUAL_X_CARRIAGE_MODE 0
143
+
144
+  // Default settings in "Auto-park Mode"
145
+  #define TOOLCHANGE_PARK_ZLIFT   0.2      // the distance to raise Z axis when parking an extruder
146
+  #define TOOLCHANGE_UNPARK_ZLIFT 1        // the distance to raise Z axis when unparking an extruder
147
+
148
+  // Default x offset in duplication mode (typically set to half print bed width)
149
+  #define DEFAULT_DUPLICATION_X_OFFSET 100
210 150
 
211 151
 #endif //DUAL_X_CARRIAGE
212 152
 
@@ -218,31 +158,22 @@
218 158
 //#define QUICK_HOME  //if this is defined, if both x and y are to be homed, a diagonal move will be performed initially.
219 159
 
220 160
 #define AXIS_RELATIVE_MODES {false, false, false, false}
221
-#ifdef CONFIG_STEPPERS_TOSHIBA
222
-#define MAX_STEP_FREQUENCY 10000 // Max step frequency for Toshiba Stepper Controllers
223
-#else
224
-#define MAX_STEP_FREQUENCY 40000 // Max step frequency for Ultimaker (5000 pps / half step)
225
-#endif
161
+
226 162
 //By default pololu step drivers require an active high signal. However, some high power drivers require an active low signal as step.
227 163
 #define INVERT_X_STEP_PIN false
228 164
 #define INVERT_Y_STEP_PIN false
229 165
 #define INVERT_Z_STEP_PIN false
230 166
 #define INVERT_E_STEP_PIN false
231 167
 
232
-//default stepper release if idle. Set to 0 to deactivate.
168
+// Default stepper release if idle. Set to 0 to deactivate.
233 169
 #define DEFAULT_STEPPER_DEACTIVE_TIME 60
234 170
 
235 171
 #define DEFAULT_MINIMUMFEEDRATE       0.0     // minimum feedrate
236 172
 #define DEFAULT_MINTRAVELFEEDRATE     0.0
237 173
 
238
-// Feedrates for manual moves along X, Y, Z, E from panel
239
-#ifdef ULTIPANEL
240
-#define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60}  // set the speeds for manual moves (mm/min)
241
-#endif
242
-
243
-//Comment to disable setting feedrate multiplier via encoder
244 174
 #ifdef ULTIPANEL
245
-    #define ULTIPANEL_FEEDMULTIPLY
175
+  #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel
176
+  #define ULTIPANEL_FEEDMULTIPLY  // Comment to disable setting feedrate multiplier via encoder
246 177
 #endif
247 178
 
248 179
 // minimum time in microseconds that a movement needs to take if the buffer is emptied.
@@ -261,13 +192,6 @@
261 192
 // if unwanted behavior is observed on a user's machine when running at very slow speeds.
262 193
 #define MINIMUM_PLANNER_SPEED 0.05// (mm/sec)
263 194
 
264
-// MS1 MS2 Stepper Driver Microstepping mode table
265
-#define MICROSTEP1 LOW,LOW
266
-#define MICROSTEP2 HIGH,LOW
267
-#define MICROSTEP4 LOW,HIGH
268
-#define MICROSTEP8 HIGH,HIGH
269
-#define MICROSTEP16 HIGH,HIGH
270
-
271 195
 // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU.
272 196
 #define MICROSTEP_MODES {16,16,16,16,16} // [1,2,4,8,16]
273 197
 
@@ -313,12 +237,6 @@
313 237
   #define PROGRESS_MSG_EXPIRE   0
314 238
   // Enable this to show messages for MSG_TIME then hide them
315 239
   //#define PROGRESS_MSG_ONCE
316
-  #ifdef DOGLCD
317
-    #warning LCD_PROGRESS_BAR does not apply to graphical displays at this time.
318
-  #endif
319
-  #ifdef FILAMENT_LCD_DISPLAY
320
-    #error LCD_PROGRESS_BAR and FILAMENT_LCD_DISPLAY are not fully compatible. Comment out this line to use both.
321
-  #endif
322 240
 #endif
323 241
 
324 242
 // The hardware watchdog should reset the microcontroller disabling all outputs, in case the firmware gets stuck and doesn't do temperature regulation.
@@ -342,16 +260,6 @@
342 260
   #define BABYSTEP_XY  //not only z, but also XY in the menu. more clutter, more functions
343 261
   #define BABYSTEP_INVERT_Z false  //true for inverse movements in Z
344 262
   #define BABYSTEP_Z_MULTIPLICATOR 2 //faster z movements
345
-
346
-  #ifdef COREXY
347
-    #error BABYSTEPPING not implemented for COREXY yet.
348
-  #endif
349
-
350
-  #ifdef DELTA
351
-    #ifdef BABYSTEP_XY
352
-      #error BABYSTEPPING only implemented for Z axis on deltabots.
353
-    #endif
354
-  #endif
355 263
 #endif
356 264
 
357 265
 // extruder advance constant (s2/mm3)
@@ -365,12 +273,8 @@
365 273
 
366 274
 #ifdef ADVANCE
367 275
   #define EXTRUDER_ADVANCE_K .0
368
-
369 276
   #define D_FILAMENT 2.85
370 277
   #define STEPS_MM_E 836
371
-  #define EXTRUSION_AREA (0.25 * D_FILAMENT * D_FILAMENT * 3.14159)
372
-  #define STEPS_PER_CUBIC_MM_E (axis_steps_per_unit[E_AXIS]/ EXTRUSION_AREA)
373
-
374 278
 #endif // ADVANCE
375 279
 
376 280
 // Arc interpretation settings:
@@ -385,26 +289,6 @@ const unsigned int dropsegments=5; //everything with less than this number of st
385 289
 // be commented out otherwise
386 290
 #define SDCARDDETECTINVERTED
387 291
 
388
-#ifdef ULTIPANEL
389
- #undef SDCARDDETECTINVERTED
390
-#endif
391
-
392
-// Power Signal Control Definitions
393
-// By default use ATX definition
394
-#ifndef POWER_SUPPLY
395
-  #define POWER_SUPPLY 1
396
-#endif
397
-// 1 = ATX
398
-#if (POWER_SUPPLY == 1)
399
-  #define PS_ON_AWAKE  LOW
400
-  #define PS_ON_ASLEEP HIGH
401
-#endif
402
-// 2 = X-Box 360 203W
403
-#if (POWER_SUPPLY == 2)
404
-  #define PS_ON_AWAKE  HIGH
405
-  #define PS_ON_ASLEEP LOW
406
-#endif
407
-
408 292
 // Control heater 0 and heater 1 in parallel.
409 293
 //#define HEATERS_PARALLEL
410 294
 
@@ -414,7 +298,7 @@ const unsigned int dropsegments=5; //everything with less than this number of st
414 298
 
415 299
 // The number of linear motions that can be in the plan at any give time.
416 300
 // 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 ring-buffering.
417
-#if defined SDSUPPORT
301
+#ifdef SDSUPPORT
418 302
   #define BLOCK_BUFFER_SIZE 16   // SD,LCD,Buttons take more memory, block buffer needs to be smaller
419 303
 #else
420 304
   #define BLOCK_BUFFER_SIZE 16 // maximize block buffer
@@ -444,9 +328,9 @@ const unsigned int dropsegments=5; //everything with less than this number of st
444 328
   #define RETRACT_RECOVER_FEEDRATE 8     //default feedrate for recovering from retraction (mm/s)
445 329
 #endif
446 330
 
447
-//adds support for experimental filament exchange support M600; requires display
331
+// Add support for experimental filament exchange support M600; requires display
448 332
 #ifdef ULTIPANEL
449
-  #define FILAMENTCHANGEENABLE
333
+  //#define FILAMENTCHANGEENABLE
450 334
   #ifdef FILAMENTCHANGEENABLE
451 335
     #define FILAMENTCHANGE_XPOS 3
452 336
     #define FILAMENTCHANGE_YPOS 3
@@ -456,13 +340,6 @@ const unsigned int dropsegments=5; //everything with less than this number of st
456 340
   #endif
457 341
 #endif
458 342
 
459
-#ifdef FILAMENTCHANGEENABLE
460
-  #ifdef EXTRUDER_RUNOUT_PREVENT
461
-    #error EXTRUDER_RUNOUT_PREVENT currently incompatible with FILAMENTCHANGE
462
-  #endif
463
-#endif
464
-
465
-
466 343
 /******************************************************************************\
467 344
  * enable this section if you have TMC26X motor drivers. 
468 345
  * you need to import the TMC26XStepper library into the arduino IDE for this
@@ -596,81 +473,7 @@ const unsigned int dropsegments=5; //everything with less than this number of st
596 473
 	
597 474
 #endif
598 475
 
476
+#include "Conditionals.h"
477
+#include "SanityCheck.h"
599 478
 
600
-//===========================================================================
601
-//=============================  Define Defines  ============================
602
-//===========================================================================
603
-
604
-#if defined (ENABLE_AUTO_BED_LEVELING) && defined (DELTA)
605
-  #error "Bed Auto Leveling is still not compatible with Delta Kinematics."
606
-#endif
607
-
608
-#if EXTRUDERS > 1 && defined TEMP_SENSOR_1_AS_REDUNDANT
609
-  #error "You cannot use TEMP_SENSOR_1_AS_REDUNDANT if EXTRUDERS > 1"
610
-#endif
611
-
612
-#if EXTRUDERS > 1 && defined HEATERS_PARALLEL
613
-  #error "You cannot use HEATERS_PARALLEL if EXTRUDERS > 1"
614
-#endif
615
-
616
-#if TEMP_SENSOR_0 > 0
617
-  #define THERMISTORHEATER_0 TEMP_SENSOR_0
618
-  #define HEATER_0_USES_THERMISTOR
619
-#endif
620
-#if TEMP_SENSOR_1 > 0
621
-  #define THERMISTORHEATER_1 TEMP_SENSOR_1
622
-  #define HEATER_1_USES_THERMISTOR
623
-#endif
624
-#if TEMP_SENSOR_2 > 0
625
-  #define THERMISTORHEATER_2 TEMP_SENSOR_2
626
-  #define HEATER_2_USES_THERMISTOR
627
-#endif
628
-#if TEMP_SENSOR_3 > 0
629
-  #define THERMISTORHEATER_3 TEMP_SENSOR_3
630
-  #define HEATER_3_USES_THERMISTOR
631
-#endif
632
-#if TEMP_SENSOR_BED > 0
633
-  #define THERMISTORBED TEMP_SENSOR_BED
634
-  #define BED_USES_THERMISTOR
635
-#endif
636
-#if TEMP_SENSOR_0 == -1
637
-  #define HEATER_0_USES_AD595
638
-#endif
639
-#if TEMP_SENSOR_1 == -1
640
-  #define HEATER_1_USES_AD595
641
-#endif
642
-#if TEMP_SENSOR_2 == -1
643
-  #define HEATER_2_USES_AD595
644
-#endif
645
-#if TEMP_SENSOR_3 == -1
646
-  #define HEATER_3_USES_AD595
647
-#endif
648
-#if TEMP_SENSOR_BED == -1
649
-  #define BED_USES_AD595
650
-#endif
651
-#if TEMP_SENSOR_0 == -2
652
-  #define HEATER_0_USES_MAX6675
653
-#endif
654
-#if TEMP_SENSOR_0 == 0
655
-  #undef HEATER_0_MINTEMP
656
-  #undef HEATER_0_MAXTEMP
657
-#endif
658
-#if TEMP_SENSOR_1 == 0
659
-  #undef HEATER_1_MINTEMP
660
-  #undef HEATER_1_MAXTEMP
661
-#endif
662
-#if TEMP_SENSOR_2 == 0
663
-  #undef HEATER_2_MINTEMP
664
-  #undef HEATER_2_MAXTEMP
665
-#endif
666
-#if TEMP_SENSOR_3 == 0
667
-  #undef HEATER_3_MINTEMP
668
-  #undef HEATER_3_MAXTEMP
669
-#endif
670
-#if TEMP_SENSOR_BED == 0
671
-  #undef BED_MINTEMP
672
-  #undef BED_MAXTEMP
673
-#endif
674
-
675
-
676
-#endif //__CONFIGURATION_ADV_H
479
+#endif //CONFIGURATION_ADV_H

+ 28
- 34
Marlin/Marlin.h View File

@@ -20,11 +20,6 @@
20 20
 
21 21
 #include "fastio.h"
22 22
 #include "Configuration.h"
23
-#include "pins.h"
24
-
25
-#ifndef AT90USB
26
-  #define  HardwareSerial_h // trick to disable the standard HWserial
27
-#endif
28 23
 
29 24
 #if (ARDUINO >= 100)
30 25
   #include "Arduino.h"
@@ -183,7 +178,7 @@ void manage_inactivity(bool ignore_stepper_queue=false);
183 178
   #define disable_e3() /* nothing */
184 179
 #endif
185 180
 
186
-enum AxisEnum {X_AXIS=0, Y_AXIS=1, Z_AXIS=2, E_AXIS=3, X_HEAD=4, Y_HEAD=5}; 
181
+enum AxisEnum {X_AXIS=0, Y_AXIS=1, A_AXIS=0, B_AXIS=1, Z_AXIS=2, E_AXIS=3, X_HEAD=4, Y_HEAD=5};
187 182
 //X_HEAD and Y_HEAD is used for systems that don't have a 1:1 relationship between X_AXIS and X Head movement, like CoreXY bots.
188 183
 
189 184
 void FlushSerialRequestResend();
@@ -191,17 +186,17 @@ void ClearToSend();
191 186
 
192 187
 void get_coordinates();
193 188
 #ifdef DELTA
194
-void calculate_delta(float cartesian[3]);
189
+  void calculate_delta(float cartesian[3]);
195 190
   #ifdef ENABLE_AUTO_BED_LEVELING
196
-  extern int delta_grid_spacing[2];
197
-  void adjust_delta(float cartesian[3]);
191
+    extern int delta_grid_spacing[2];
192
+    void adjust_delta(float cartesian[3]);
198 193
   #endif
199
-extern float delta[3];
200
-void prepare_move_raw();
194
+  extern float delta[3];
195
+  void prepare_move_raw();
201 196
 #endif
202 197
 #ifdef SCARA
203
-void calculate_delta(float cartesian[3]);
204
-void calculate_SCARA_forward_Transform(float f_scara[3]);
198
+  void calculate_delta(float cartesian[3]);
199
+  void calculate_SCARA_forward_Transform(float f_scara[3]);
205 200
 #endif
206 201
 void reset_bed_level();
207 202
 void prepare_move();
@@ -209,7 +204,7 @@ void kill();
209 204
 void Stop();
210 205
 
211 206
 #ifdef FILAMENT_RUNOUT_SENSOR
212
-void filrunout();
207
+  void filrunout();
213 208
 #endif
214 209
 
215 210
 bool IsStopped();
@@ -223,7 +218,7 @@ void clamp_to_software_endstops(float target[3]);
223 218
 void refresh_cmd_timeout(void);
224 219
 
225 220
 #ifdef FAST_PWM_FAN
226
-void setPwmFrequency(uint8_t pin, int val);
221
+  void setPwmFrequency(uint8_t pin, int val);
227 222
 #endif
228 223
 
229 224
 #ifndef CRITICAL_SECTION_START
@@ -240,16 +235,16 @@ extern int extruder_multiply[EXTRUDERS]; // sets extrude multiply factor (in per
240 235
 extern float filament_size[EXTRUDERS]; // cross-sectional area of filament (in millimeters), typically around 1.75 or 2.85, 0 disables the volumetric calculations for the extruder.
241 236
 extern float volumetric_multiplier[EXTRUDERS]; // reciprocal of cross-sectional area of filament (in square millimeters), stored this way to reduce computational burden in planner
242 237
 extern float current_position[NUM_AXIS] ;
243
-extern float add_homing[3];
238
+extern float home_offset[3];
244 239
 #ifdef DELTA
245
-extern float endstop_adj[3];
246
-extern float delta_radius;
247
-extern float delta_diagonal_rod;
248
-extern float delta_segments_per_second;
249
-void recalc_delta_settings(float radius, float diagonal_rod);
240
+  extern float endstop_adj[3];
241
+  extern float delta_radius;
242
+  extern float delta_diagonal_rod;
243
+  extern float delta_segments_per_second;
244
+  void recalc_delta_settings(float radius, float diagonal_rod);
250 245
 #endif
251 246
 #ifdef SCARA
252
-extern float axis_scaling[3];  // Build size scaling
247
+  extern float axis_scaling[3];  // Build size scaling
253 248
 #endif
254 249
 extern float min_pos[3];
255 250
 extern float max_pos[3];
@@ -257,12 +252,12 @@ extern bool axis_known_position[3];
257 252
 extern float zprobe_zoffset;
258 253
 extern int fanSpeed;
259 254
 #ifdef BARICUDA
260
-extern int ValvePressure;
261
-extern int EtoPPressure;
255
+  extern int ValvePressure;
256
+  extern int EtoPPressure;
262 257
 #endif
263 258
 
264 259
 #ifdef FAN_SOFT_PWM
265
-extern unsigned char fanSpeedSoftPwm;
260
+  extern unsigned char fanSpeedSoftPwm;
266 261
 #endif
267 262
 
268 263
 #ifdef FILAMENT_SENSOR
@@ -270,16 +265,16 @@ extern unsigned char fanSpeedSoftPwm;
270 265
   extern bool filament_sensor;  //indicates that filament sensor readings should control extrusion
271 266
   extern float filament_width_meas; //holds the filament diameter as accurately measured
272 267
   extern signed char measurement_delay[];  //ring buffer to delay measurement
273
-  extern int delay_index1, delay_index2;  //index into ring buffer
268
+  extern int delay_index1, delay_index2;  //ring buffer index. used by planner, temperature, and main code
274 269
   extern float delay_dist; //delay distance counter
275 270
   extern int meas_delay_cm; //delay distance
276 271
 #endif
277 272
 
278 273
 #ifdef FWRETRACT
279
-extern bool autoretract_enabled;
280
-extern bool retracted[EXTRUDERS];
281
-extern float retract_length, retract_length_swap, retract_feedrate, retract_zlift;
282
-extern float retract_recover_length, retract_recover_length_swap, retract_recover_feedrate;
274
+  extern bool autoretract_enabled;
275
+  extern bool retracted[EXTRUDERS];
276
+  extern float retract_length, retract_length_swap, retract_feedrate, retract_zlift;
277
+  extern float retract_recover_length, retract_recover_length_swap, retract_recover_feedrate;
283 278
 #endif
284 279
 
285 280
 extern unsigned long starttime;
@@ -289,11 +284,10 @@ extern unsigned long stoptime;
289 284
 extern uint8_t active_extruder;
290 285
 
291 286
 #ifdef DIGIPOT_I2C
292
-extern void digipot_i2c_set_current( int channel, float current );
293
-extern void digipot_i2c_init();
294
-#endif
295
-
287
+  extern void digipot_i2c_set_current( int channel, float current );
288
+  extern void digipot_i2c_init();
296 289
 #endif
297 290
 
298 291
 extern void calculate_volumetric_multipliers();
299 292
 
293
+#endif //MARLIN_H

+ 317
- 244
Marlin/Marlin_main.cpp View File

@@ -30,9 +30,6 @@
30 30
 #include "Marlin.h"
31 31
 
32 32
 #ifdef ENABLE_AUTO_BED_LEVELING
33
-  #if Z_MIN_PIN == -1
34
-    #error "You must have a Z_MIN endstop to enable Auto Bed Leveling feature. Z_MIN_PIN must point to a valid hardware pin."
35
-  #endif
36 33
   #include "vector_3.h"
37 34
   #ifdef AUTO_BED_LEVELING_GRID
38 35
     #include "qr_solve.h"
@@ -41,6 +38,10 @@
41 38
 
42 39
 #define SERVO_LEVELING defined(ENABLE_AUTO_BED_LEVELING) && PROBE_SERVO_DEACTIVATION_DELAY > 0
43 40
 
41
+#if defined(MESH_BED_LEVELING)
42
+  #include "mesh_bed_leveling.h"
43
+#endif  // MESH_BED_LEVELING
44
+
44 45
 #include "ultralcd.h"
45 46
 #include "planner.h"
46 47
 #include "stepper.h"
@@ -244,7 +245,7 @@ float volumetric_multiplier[EXTRUDERS] = {1.0
244 245
   #endif
245 246
 };
246 247
 float current_position[NUM_AXIS] = { 0.0, 0.0, 0.0, 0.0 };
247
-float add_homing[3] = { 0, 0, 0 };
248
+float home_offset[3] = { 0, 0, 0 };
248 249
 #ifdef DELTA
249 250
   float endstop_adj[3] = { 0, 0, 0 };
250 251
 #endif
@@ -963,43 +964,36 @@ XYZ_CONSTS_FROM_CONFIG(float, home_retract_mm, HOME_RETRACT_MM);
963 964
 XYZ_CONSTS_FROM_CONFIG(signed char, home_dir,  HOME_DIR);
964 965
 
965 966
 #ifdef DUAL_X_CARRIAGE
966
-  #if EXTRUDERS == 1 || defined(COREXY) \
967
-      || !defined(X2_ENABLE_PIN) || !defined(X2_STEP_PIN) || !defined(X2_DIR_PIN) \
968
-      || !defined(X2_HOME_POS) || !defined(X2_MIN_POS) || !defined(X2_MAX_POS) \
969
-      || !defined(X_MAX_PIN) || X_MAX_PIN < 0
970
-    #error "Missing or invalid definitions for DUAL_X_CARRIAGE mode."
971
-  #endif
972
-  #if X_HOME_DIR != -1 || X2_HOME_DIR != 1
973
-    #error "Please use canonical x-carriage assignment" // the x-carriages are defined by their homing directions
974
-  #endif
975 967
 
976
-#define DXC_FULL_CONTROL_MODE 0
977
-#define DXC_AUTO_PARK_MODE    1
978
-#define DXC_DUPLICATION_MODE  2
979
-static int dual_x_carriage_mode = DEFAULT_DUAL_X_CARRIAGE_MODE;
980
-
981
-static float x_home_pos(int extruder) {
982
-  if (extruder == 0)
983
-    return base_home_pos(X_AXIS) + add_homing[X_AXIS];
984
-  else
985
-    // In dual carriage mode the extruder offset provides an override of the
986
-    // second X-carriage offset when homed - otherwise X2_HOME_POS is used.
987
-    // This allow soft recalibration of the second extruder offset position without firmware reflash
988
-    // (through the M218 command).
989
-    return (extruder_offset[X_AXIS][1] > 0) ? extruder_offset[X_AXIS][1] : X2_HOME_POS;
990
-}
968
+  #define DXC_FULL_CONTROL_MODE 0
969
+  #define DXC_AUTO_PARK_MODE    1
970
+  #define DXC_DUPLICATION_MODE  2
991 971
 
992
-static int x_home_dir(int extruder) {
993
-  return (extruder == 0) ? X_HOME_DIR : X2_HOME_DIR;
994
-}
972
+  static int dual_x_carriage_mode = DEFAULT_DUAL_X_CARRIAGE_MODE;
973
+
974
+  static float x_home_pos(int extruder) {
975
+    if (extruder == 0)
976
+      return base_home_pos(X_AXIS) + add_homing[X_AXIS];
977
+    else
978
+      // In dual carriage mode the extruder offset provides an override of the
979
+      // second X-carriage offset when homed - otherwise X2_HOME_POS is used.
980
+      // This allow soft recalibration of the second extruder offset position without firmware reflash
981
+      // (through the M218 command).
982
+      return (extruder_offset[X_AXIS][1] > 0) ? extruder_offset[X_AXIS][1] : X2_HOME_POS;
983
+  }
984
+
985
+  static int x_home_dir(int extruder) {
986
+    return (extruder == 0) ? X_HOME_DIR : X2_HOME_DIR;
987
+  }
988
+
989
+  static float inactive_extruder_x_pos = X2_MAX_POS; // used in mode 0 & 1
990
+  static bool active_extruder_parked = false; // used in mode 1 & 2
991
+  static float raised_parked_position[NUM_AXIS]; // used in mode 1
992
+  static unsigned long delayed_move_time = 0; // used in mode 1
993
+  static float duplicate_extruder_x_offset = DEFAULT_DUPLICATION_X_OFFSET; // used in mode 2
994
+  static float duplicate_extruder_temp_offset = 0; // used in mode 2
995
+  bool extruder_duplication_enabled = false; // used in mode 2
995 996
 
996
-static float inactive_extruder_x_pos = X2_MAX_POS; // used in mode 0 & 1
997
-static bool active_extruder_parked = false; // used in mode 1 & 2
998
-static float raised_parked_position[NUM_AXIS]; // used in mode 1
999
-static unsigned long delayed_move_time = 0; // used in mode 1
1000
-static float duplicate_extruder_x_offset = DEFAULT_DUPLICATION_X_OFFSET; // used in mode 2
1001
-static float duplicate_extruder_temp_offset = 0; // used in mode 2
1002
-bool extruder_duplication_enabled = false; // used in mode 2
1003 997
 #endif //DUAL_X_CARRIAGE
1004 998
 
1005 999
 static void axis_is_at_home(int axis) {
@@ -1012,9 +1006,9 @@ static void axis_is_at_home(int axis) {
1012 1006
       return;
1013 1007
     }
1014 1008
     else if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && active_extruder == 0) {
1015
-      current_position[X_AXIS] = base_home_pos(X_AXIS) + add_homing[X_AXIS];
1016
-      min_pos[X_AXIS] =          base_min_pos(X_AXIS) + add_homing[X_AXIS];
1017
-      max_pos[X_AXIS] =          min(base_max_pos(X_AXIS) + add_homing[X_AXIS],
1009
+      current_position[X_AXIS] = base_home_pos(X_AXIS) + home_offset[X_AXIS];
1010
+      min_pos[X_AXIS] =          base_min_pos(X_AXIS) + home_offset[X_AXIS];
1011
+      max_pos[X_AXIS] =          min(base_max_pos(X_AXIS) + home_offset[X_AXIS],
1018 1012
                                   max(extruder_offset[X_AXIS][1], X2_MAX_POS) - duplicate_extruder_x_offset);
1019 1013
       return;
1020 1014
     }
@@ -1042,11 +1036,11 @@ static void axis_is_at_home(int axis) {
1042 1036
      
1043 1037
      for (i=0; i<2; i++)
1044 1038
      {
1045
-        delta[i] -= add_homing[i];
1039
+        delta[i] -= home_offset[i];
1046 1040
      } 
1047 1041
      
1048
-    // SERIAL_ECHOPGM("addhome X="); SERIAL_ECHO(add_homing[X_AXIS]);
1049
-  // SERIAL_ECHOPGM(" addhome Y="); SERIAL_ECHO(add_homing[Y_AXIS]);
1042
+    // SERIAL_ECHOPGM("addhome X="); SERIAL_ECHO(home_offset[X_AXIS]);
1043
+  // SERIAL_ECHOPGM(" addhome Y="); SERIAL_ECHO(home_offset[Y_AXIS]);
1050 1044
     // SERIAL_ECHOPGM(" addhome Theta="); SERIAL_ECHO(delta[X_AXIS]);
1051 1045
     // SERIAL_ECHOPGM(" addhome Psi+Theta="); SERIAL_ECHOLN(delta[Y_AXIS]);
1052 1046
       
@@ -1064,14 +1058,14 @@ static void axis_is_at_home(int axis) {
1064 1058
    } 
1065 1059
    else
1066 1060
    {
1067
-      current_position[axis] = base_home_pos(axis) + add_homing[axis];
1068
-      min_pos[axis] =          base_min_pos(axis) + add_homing[axis];
1069
-      max_pos[axis] =          base_max_pos(axis) + add_homing[axis];
1061
+      current_position[axis] = base_home_pos(axis) + home_offset[axis];
1062
+      min_pos[axis] =          base_min_pos(axis) + home_offset[axis];
1063
+      max_pos[axis] =          base_max_pos(axis) + home_offset[axis];
1070 1064
    }
1071 1065
 #else
1072
-  current_position[axis] = base_home_pos(axis) + add_homing[axis];
1073
-  min_pos[axis] =          base_min_pos(axis) + add_homing[axis];
1074
-  max_pos[axis] =          base_max_pos(axis) + add_homing[axis];
1066
+  current_position[axis] = base_home_pos(axis) + home_offset[axis];
1067
+  min_pos[axis] =          base_min_pos(axis) + home_offset[axis];
1068
+  max_pos[axis] =          base_max_pos(axis) + home_offset[axis];
1075 1069
 #endif
1076 1070
 }
1077 1071
 
@@ -1305,7 +1299,13 @@ static void engage_z_probe() {
1305 1299
 static void retract_z_probe() {
1306 1300
   // Retract Z Servo endstop if enabled
1307 1301
   #ifdef SERVO_ENDSTOPS
1308
-    if (servo_endstops[Z_AXIS] > -1) {
1302
+    if (servo_endstops[Z_AXIS] > -1)
1303
+    {
1304
+      #if Z_RAISE_AFTER_PROBING > 0
1305
+        do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], Z_RAISE_AFTER_PROBING);
1306
+        st_synchronize();
1307
+      #endif
1308
+    
1309 1309
       #if SERVO_LEVELING
1310 1310
         servos[servo_endstops[Z_AXIS]].attach(0);
1311 1311
       #endif
@@ -1318,7 +1318,7 @@ static void retract_z_probe() {
1318 1318
   #elif defined(Z_PROBE_ALLEN_KEY)
1319 1319
     // Move up for safety
1320 1320
     feedrate = homing_feedrate[X_AXIS];
1321
-    destination[Z_AXIS] = current_position[Z_AXIS] + 20;
1321
+    destination[Z_AXIS] = current_position[Z_AXIS] + Z_RAISE_AFTER_PROBING;
1322 1322
     prepare_move_raw();
1323 1323
 
1324 1324
     // Move to the start position to initiate retraction
@@ -1360,10 +1360,15 @@ static void retract_z_probe() {
1360 1360
 
1361 1361
 }
1362 1362
 
1363
-enum ProbeAction { ProbeStay, ProbeEngage, ProbeRetract, ProbeEngageRetract };
1363
+enum ProbeAction {
1364
+  ProbeStay             = 0,
1365
+  ProbeEngage           = BIT(0),
1366
+  ProbeRetract          = BIT(1),
1367
+  ProbeEngageAndRetract = (ProbeEngage | ProbeRetract)
1368
+};
1364 1369
 
1365 1370
 /// Probe bed height at position (x,y), returns the measured z value
1366
-static float probe_pt(float x, float y, float z_before, ProbeAction retract_action=ProbeEngageRetract, int verbose_level=1) {
1371
+static float probe_pt(float x, float y, float z_before, ProbeAction retract_action=ProbeEngageAndRetract, int verbose_level=1) {
1367 1372
   // move to right place
1368 1373
   do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], z_before);
1369 1374
   do_blocking_move_to(x - X_PROBE_OFFSET_FROM_EXTRUDER, y - Y_PROBE_OFFSET_FROM_EXTRUDER, current_position[Z_AXIS]);
@@ -1737,6 +1742,11 @@ inline void gcode_G28() {
1737 1742
     #endif
1738 1743
   #endif
1739 1744
 
1745
+  #if defined(MESH_BED_LEVELING)
1746
+    uint8_t mbl_was_active = mbl.active;
1747
+    mbl.active = 0;
1748
+  #endif  // MESH_BED_LEVELING
1749
+
1740 1750
   saved_feedrate = feedrate;
1741 1751
   saved_feedmultiply = feedmultiply;
1742 1752
   feedmultiply = 100;
@@ -1849,7 +1859,7 @@ inline void gcode_G28() {
1849 1859
       if (code_value_long() != 0) {
1850 1860
           current_position[X_AXIS] = code_value()
1851 1861
             #ifndef SCARA
1852
-              + add_homing[X_AXIS]
1862
+              + home_offset[X_AXIS]
1853 1863
             #endif
1854 1864
           ;
1855 1865
       }
@@ -1858,7 +1868,7 @@ inline void gcode_G28() {
1858 1868
     if (code_seen(axis_codes[Y_AXIS]) && code_value_long() != 0) {
1859 1869
       current_position[Y_AXIS] = code_value()
1860 1870
         #ifndef SCARA
1861
-          + add_homing[Y_AXIS]
1871
+          + home_offset[Y_AXIS]
1862 1872
         #endif
1863 1873
       ;
1864 1874
     }
@@ -1932,7 +1942,7 @@ inline void gcode_G28() {
1932 1942
 
1933 1943
 
1934 1944
     if (code_seen(axis_codes[Z_AXIS]) && code_value_long() != 0)
1935
-      current_position[Z_AXIS] = code_value() + add_homing[Z_AXIS];
1945
+      current_position[Z_AXIS] = code_value() + home_offset[Z_AXIS];
1936 1946
 
1937 1947
     #ifdef ENABLE_AUTO_BED_LEVELING
1938 1948
       if (home_all_axis || code_seen(axis_codes[Z_AXIS]))
@@ -1951,51 +1961,113 @@ inline void gcode_G28() {
1951 1961
     enable_endstops(false);
1952 1962
   #endif
1953 1963
 
1964
+  #if defined(MESH_BED_LEVELING)
1965
+    if (mbl_was_active) {
1966
+      current_position[X_AXIS] = mbl.get_x(0);
1967
+      current_position[Y_AXIS] = mbl.get_y(0);
1968
+      destination[X_AXIS] = current_position[X_AXIS];
1969
+      destination[Y_AXIS] = current_position[Y_AXIS];
1970
+      destination[Z_AXIS] = current_position[Z_AXIS];
1971
+      destination[E_AXIS] = current_position[E_AXIS];
1972
+      feedrate = homing_feedrate[X_AXIS];
1973
+      plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate, active_extruder);
1974
+      st_synchronize();
1975
+      current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
1976
+      plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
1977
+      mbl.active = 1;
1978
+    }
1979
+  #endif
1980
+
1954 1981
   feedrate = saved_feedrate;
1955 1982
   feedmultiply = saved_feedmultiply;
1956 1983
   previous_millis_cmd = millis();
1957 1984
   endstops_hit_on_purpose();
1958 1985
 }
1959 1986
 
1960
-#ifdef ENABLE_AUTO_BED_LEVELING
1987
+#if defined(MESH_BED_LEVELING)
1961 1988
 
1962
-  // Define the possible boundaries for probing based on set limits
1963
-  #define MIN_PROBE_X (max(X_MIN_POS, X_MIN_POS + X_PROBE_OFFSET_FROM_EXTRUDER))
1964
-  #define MAX_PROBE_X (min(X_MAX_POS, X_MAX_POS + X_PROBE_OFFSET_FROM_EXTRUDER))
1965
-  #define MIN_PROBE_Y (max(Y_MIN_POS, Y_MIN_POS + Y_PROBE_OFFSET_FROM_EXTRUDER))
1966
-  #define MAX_PROBE_Y (min(Y_MAX_POS, Y_MAX_POS + Y_PROBE_OFFSET_FROM_EXTRUDER))
1989
+  inline void gcode_G29() {
1990
+    static int probe_point = -1;
1991
+    int state = 0;
1992
+    if (code_seen('S') || code_seen('s')) {
1993
+      state = code_value_long();
1994
+      if (state < 0 || state > 2) {
1995
+        SERIAL_PROTOCOLPGM("S out of range (0-2).\n");
1996
+        return;
1997
+      }
1998
+    }
1967 1999
 
1968
-  #ifdef AUTO_BED_LEVELING_GRID
2000
+    if (state == 0) { // Dump mesh_bed_leveling
2001
+      if (mbl.active) {
2002
+        SERIAL_PROTOCOLPGM("Num X,Y: ");
2003
+        SERIAL_PROTOCOL(MESH_NUM_X_POINTS);
2004
+        SERIAL_PROTOCOLPGM(",");
2005
+        SERIAL_PROTOCOL(MESH_NUM_Y_POINTS);
2006
+        SERIAL_PROTOCOLPGM("\nZ search height: ");
2007
+        SERIAL_PROTOCOL(MESH_HOME_SEARCH_Z);
2008
+        SERIAL_PROTOCOLPGM("\nMeasured points:\n");              
2009
+        for (int y=0; y<MESH_NUM_Y_POINTS; y++) {
2010
+          for (int x=0; x<MESH_NUM_X_POINTS; x++) {
2011
+            SERIAL_PROTOCOLPGM("  ");              
2012
+            SERIAL_PROTOCOL_F(mbl.z_values[y][x], 5);
2013
+          }
2014
+          SERIAL_EOL;
2015
+        }
2016
+      } else {
2017
+        SERIAL_PROTOCOLPGM("Mesh bed leveling not active.\n");
2018
+      }
1969 2019
 
1970
-    // Make sure probing points are reachable
2020
+    } else if (state == 1) { // Begin probing mesh points
1971 2021
 
1972
-    #if LEFT_PROBE_BED_POSITION < MIN_PROBE_X
1973
-      #error "The given LEFT_PROBE_BED_POSITION can't be reached by the probe."
1974
-    #elif RIGHT_PROBE_BED_POSITION > MAX_PROBE_X
1975
-      #error "The given RIGHT_PROBE_BED_POSITION can't be reached by the probe."
1976
-    #elif FRONT_PROBE_BED_POSITION < MIN_PROBE_Y
1977
-      #error "The given FRONT_PROBE_BED_POSITION can't be reached by the probe."
1978
-    #elif BACK_PROBE_BED_POSITION > MAX_PROBE_Y
1979
-      #error "The given BACK_PROBE_BED_POSITION can't be reached by the probe."
1980
-    #endif
2022
+      mbl.reset();
2023
+      probe_point = 0;
2024
+      enquecommands_P(PSTR("G28"));
2025
+      enquecommands_P(PSTR("G29 S2"));
1981 2026
 
1982
-  #else // !AUTO_BED_LEVELING_GRID
1983
-
1984
-    #if ABL_PROBE_PT_1_X < MIN_PROBE_X || ABL_PROBE_PT_1_X > MAX_PROBE_X
1985
-      #error "The given ABL_PROBE_PT_1_X can't be reached by the probe."
1986
-    #elif ABL_PROBE_PT_2_X < MIN_PROBE_X || ABL_PROBE_PT_2_X > MAX_PROBE_X
1987
-      #error "The given ABL_PROBE_PT_2_X can't be reached by the probe."
1988
-    #elif ABL_PROBE_PT_3_X < MIN_PROBE_X || ABL_PROBE_PT_3_X > MAX_PROBE_X
1989
-      #error "The given ABL_PROBE_PT_3_X can't be reached by the probe."
1990
-    #elif ABL_PROBE_PT_1_Y < MIN_PROBE_Y || ABL_PROBE_PT_1_Y > MAX_PROBE_Y
1991
-      #error "The given ABL_PROBE_PT_1_Y can't be reached by the probe."
1992
-    #elif ABL_PROBE_PT_2_Y < MIN_PROBE_Y || ABL_PROBE_PT_2_Y > MAX_PROBE_Y
1993
-      #error "The given ABL_PROBE_PT_2_Y can't be reached by the probe."
1994
-    #elif ABL_PROBE_PT_3_Y < MIN_PROBE_Y || ABL_PROBE_PT_3_Y > MAX_PROBE_Y
1995
-      #error "The given ABL_PROBE_PT_3_Y can't be reached by the probe."
1996
-    #endif
2027
+    } else if (state == 2) { // Goto next point
2028
+
2029
+      if (probe_point < 0) {
2030
+        SERIAL_PROTOCOLPGM("Mesh probing not started.\n");
2031
+        return;
2032
+      }
2033
+      int ix, iy;
2034
+      if (probe_point == 0) {
2035
+        current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
2036
+        plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
2037
+      } else {
2038
+        ix = (probe_point-1) % MESH_NUM_X_POINTS;
2039
+        iy = (probe_point-1) / MESH_NUM_X_POINTS;
2040
+        if (iy&1) { // Zig zag
2041
+          ix = (MESH_NUM_X_POINTS - 1) - ix;
2042
+        }
2043
+        mbl.set_z(ix, iy, current_position[Z_AXIS]);
2044
+        current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
2045
+        plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], homing_feedrate[X_AXIS]/60, active_extruder);
2046
+        st_synchronize();
2047
+      }
2048
+      if (probe_point == MESH_NUM_X_POINTS*MESH_NUM_Y_POINTS) {
2049
+        SERIAL_PROTOCOLPGM("Mesh done.\n");
2050
+        probe_point = -1;
2051
+        mbl.active = 1;
2052
+        enquecommands_P(PSTR("G28"));
2053
+        return;
2054
+      }
2055
+      ix = probe_point % MESH_NUM_X_POINTS;
2056
+      iy = probe_point / MESH_NUM_X_POINTS;
2057
+      if (iy&1) { // Zig zag
2058
+        ix = (MESH_NUM_X_POINTS - 1) - ix;
2059
+      }
2060
+      current_position[X_AXIS] = mbl.get_x(ix);
2061
+      current_position[Y_AXIS] = mbl.get_y(iy);
2062
+      plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], homing_feedrate[X_AXIS]/60, active_extruder);
2063
+      st_synchronize();
2064
+      probe_point++;
2065
+    }
2066
+  }
2067
+
2068
+#endif
1997 2069
 
1998
-  #endif // !AUTO_BED_LEVELING_GRID
2070
+#ifdef ENABLE_AUTO_BED_LEVELING
1999 2071
 
2000 2072
   /**
2001 2073
    * G29: Detailed Z-Probe, probes the bed at 3 or more points.
@@ -2057,7 +2129,7 @@ inline void gcode_G28() {
2057 2129
     #ifdef AUTO_BED_LEVELING_GRID
2058 2130
 
2059 2131
     #ifndef DELTA
2060
-      bool topo_flag = verbose_level > 2 || code_seen('T') || code_seen('t');
2132
+      bool do_topography_map = verbose_level > 2 || code_seen('T') || code_seen('t');
2061 2133
     #endif
2062 2134
 
2063 2135
       if (verbose_level > 0)
@@ -2112,15 +2184,16 @@ inline void gcode_G28() {
2112 2184
 
2113 2185
     #ifdef Z_PROBE_SLED
2114 2186
       dock_sled(false); // engage (un-dock) the probe
2115
-    #elif not defined(SERVO_ENDSTOPS)
2187
+    #elif defined(Z_PROBE_ALLEN_KEY)
2116 2188
       engage_z_probe();
2117 2189
     #endif
2118 2190
 
2119 2191
     st_synchronize();
2120 2192
 
2121
-  #ifdef DELTA
2122
-    reset_bed_level();
2123
-  #else
2193
+    #ifdef DELTA
2194
+      reset_bed_level();
2195
+    #else
2196
+
2124 2197
     // make sure the bed_level_rotation_matrix is identity or the planner will get it incorectly
2125 2198
     //vector_3 corrected_position = plan_get_position_mm();
2126 2199
     //corrected_position.debug("position before G29");
@@ -2161,42 +2234,36 @@ inline void gcode_G28() {
2161 2234
       delta_grid_spacing[1] = yGridSpacing;
2162 2235
 
2163 2236
       float z_offset = Z_PROBE_OFFSET_FROM_EXTRUDER;
2164
-      if (code_seen(axis_codes[Z_AXIS])) {
2165
-        z_offset += code_value();
2166
-      }
2237
+      if (code_seen(axis_codes[Z_AXIS])) z_offset += code_value();
2167 2238
     #endif
2168 2239
 
2169 2240
       int probePointCounter = 0;
2170 2241
       bool zig = true;
2171 2242
 
2172
-      for (int yCount=0; yCount < auto_bed_leveling_grid_points; yCount++)
2173
-      {
2243
+      for (int yCount = 0; yCount < auto_bed_leveling_grid_points; yCount++) {
2174 2244
         double yProbe = front_probe_bed_position + yGridSpacing * yCount;
2175 2245
         int xStart, xStop, xInc;
2176 2246
 
2177
-        if (zig)
2178
-        {
2247
+        if (zig) {
2179 2248
           xStart = 0;
2180 2249
           xStop = auto_bed_leveling_grid_points;
2181 2250
           xInc = 1;
2182 2251
           zig = false;
2183 2252
         }
2184
-        else
2185
-        {
2253
+        else {
2186 2254
           xStart = auto_bed_leveling_grid_points - 1;
2187 2255
           xStop = -1;
2188 2256
           xInc = -1;
2189 2257
           zig = true;
2190 2258
         }
2191 2259
 
2192
-      #ifndef DELTA
2193
-        // If topo_flag is set then don't zig-zag. Just scan in one direction.
2194
-        // This gets the probe points in more readable order.
2195
-        if (!topo_flag) zig = !zig;
2196
-      #endif
2260
+        #ifndef DELTA
2261
+          // If do_topography_map is set then don't zig-zag. Just scan in one direction.
2262
+          // This gets the probe points in more readable order.
2263
+          if (!do_topography_map) zig = !zig;
2264
+        #endif
2197 2265
 
2198
-        for (int xCount=xStart; xCount != xStop; xCount += xInc)
2199
-        {
2266
+        for (int xCount = xStart; xCount != xStop; xCount += xInc) {
2200 2267
           double xProbe = left_probe_bed_position + xGridSpacing * xCount;
2201 2268
 
2202 2269
           // raise extruder
@@ -2221,7 +2288,7 @@ inline void gcode_G28() {
2221 2288
               act = ProbeStay;
2222 2289
           }
2223 2290
           else
2224
-            act = ProbeEngageRetract;
2291
+            act = ProbeEngageAndRetract;
2225 2292
 
2226 2293
           measured_z = probe_pt(xProbe, yProbe, z_before, act, verbose_level);
2227 2294
 
@@ -2263,49 +2330,31 @@ inline void gcode_G28() {
2263 2330
         }
2264 2331
       }
2265 2332
 
2266
-      if (topo_flag) {
2267
-
2268
-        int xx, yy;
2333
+      // Show the Topography map if enabled
2334
+      if (do_topography_map) {
2269 2335
 
2270 2336
         SERIAL_PROTOCOLPGM(" \nBed Height Topography: \n");
2271
-        #if TOPO_ORIGIN == OriginFrontLeft
2272
-          SERIAL_PROTOCOLPGM("+-----------+\n");
2273
-          SERIAL_PROTOCOLPGM("|...Back....|\n");
2274
-          SERIAL_PROTOCOLPGM("|Left..Right|\n");
2275
-          SERIAL_PROTOCOLPGM("|...Front...|\n");
2276
-          SERIAL_PROTOCOLPGM("+-----------+\n");
2277
-          for (yy = auto_bed_leveling_grid_points - 1; yy >= 0; yy--)
2278
-        #else
2279
-          for (yy = 0; yy < auto_bed_leveling_grid_points; yy++)
2280
-        #endif
2281
-          {
2282
-            #if TOPO_ORIGIN == OriginBackRight
2283
-              for (xx = 0; xx < auto_bed_leveling_grid_points; xx++)
2284
-            #else
2285
-              for (xx = auto_bed_leveling_grid_points - 1; xx >= 0; xx--)
2286
-            #endif
2287
-              {
2288
-                int ind =
2289
-                  #if TOPO_ORIGIN == OriginBackRight || TOPO_ORIGIN == OriginFrontLeft
2290
-                    yy * auto_bed_leveling_grid_points + xx
2291
-                  #elif TOPO_ORIGIN == OriginBackLeft
2292
-                    xx * auto_bed_leveling_grid_points + yy
2293
-                  #elif TOPO_ORIGIN == OriginFrontRight
2294
-                    abl2 - xx * auto_bed_leveling_grid_points - yy - 1
2295
-                  #endif
2296
-                ;
2297
-                float diff = eqnBVector[ind] - mean;
2298
-                if (diff >= 0.0)
2299
-                  SERIAL_PROTOCOLPGM(" +");   // Include + for column alignment
2300
-                else
2301
-                  SERIAL_PROTOCOLPGM(" ");
2302
-                SERIAL_PROTOCOL_F(diff, 5);
2303
-              } // xx
2304
-              SERIAL_EOL;
2305
-          } // yy
2337
+        SERIAL_PROTOCOLPGM("+-----------+\n");
2338
+        SERIAL_PROTOCOLPGM("|...Back....|\n");
2339
+        SERIAL_PROTOCOLPGM("|Left..Right|\n");
2340
+        SERIAL_PROTOCOLPGM("|...Front...|\n");
2341
+        SERIAL_PROTOCOLPGM("+-----------+\n");
2342
+
2343
+        for (int yy = auto_bed_leveling_grid_points - 1; yy >= 0; yy--) {
2344
+          for (int xx = auto_bed_leveling_grid_points - 1; xx >= 0; xx--) {
2345
+            int ind = yy * auto_bed_leveling_grid_points + xx;
2346
+            float diff = eqnBVector[ind] - mean;
2347
+            if (diff >= 0.0)
2348
+              SERIAL_PROTOCOLPGM(" +");   // Include + for column alignment
2349
+            else
2350
+              SERIAL_PROTOCOLPGM(" ");
2351
+            SERIAL_PROTOCOL_F(diff, 5);
2352
+          } // xx
2306 2353
           SERIAL_EOL;
2354
+        } // yy
2355
+        SERIAL_EOL;
2307 2356
 
2308
-      } //topo_flag
2357
+      } //do_topography_map
2309 2358
 
2310 2359
 
2311 2360
       set_bed_level_equation_lsq(plane_equation_coefficients);
@@ -2327,18 +2376,15 @@ inline void gcode_G28() {
2327 2376
         z_at_pt_3 = probe_pt(ABL_PROBE_PT_3_X, ABL_PROBE_PT_3_Y, current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS, ProbeRetract, verbose_level);
2328 2377
       }
2329 2378
       else {
2330
-        z_at_pt_1 = probe_pt(ABL_PROBE_PT_1_X, ABL_PROBE_PT_1_Y, Z_RAISE_BEFORE_PROBING, verbose_level=verbose_level);
2331
-        z_at_pt_2 = probe_pt(ABL_PROBE_PT_2_X, ABL_PROBE_PT_2_Y, current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS, verbose_level=verbose_level);
2332
-        z_at_pt_3 = probe_pt(ABL_PROBE_PT_3_X, ABL_PROBE_PT_3_Y, current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS, verbose_level=verbose_level);
2379
+        z_at_pt_1 = probe_pt(ABL_PROBE_PT_1_X, ABL_PROBE_PT_1_Y, Z_RAISE_BEFORE_PROBING, ProbeEngageAndRetract, verbose_level);
2380
+        z_at_pt_2 = probe_pt(ABL_PROBE_PT_2_X, ABL_PROBE_PT_2_Y, current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS, ProbeEngageAndRetract, verbose_level);
2381
+        z_at_pt_3 = probe_pt(ABL_PROBE_PT_3_X, ABL_PROBE_PT_3_Y, current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS, ProbeEngageAndRetract, verbose_level);
2333 2382
       }
2334 2383
       clean_up_after_endstop_move();
2335 2384
       set_bed_level_equation_3pts(z_at_pt_1, z_at_pt_2, z_at_pt_3);
2336 2385
 
2337 2386
     #endif // !AUTO_BED_LEVELING_GRID
2338 2387
 
2339
-    do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], Z_RAISE_AFTER_PROBING);
2340
-    st_synchronize();
2341
-
2342 2388
   #ifndef DELTA
2343 2389
     if (verbose_level > 0)
2344 2390
       plan_bed_level_matrix.debug(" \n\nBed Level Correction Matrix:");
@@ -2358,7 +2404,7 @@ inline void gcode_G28() {
2358 2404
 
2359 2405
   #ifdef Z_PROBE_SLED
2360 2406
     dock_sled(true, -SLED_DOCKING_OFFSET); // dock the probe, correcting for over-travel
2361
-  #elif not defined(SERVO_ENDSTOPS)
2407
+  #elif defined(Z_PROBE_ALLEN_KEY)
2362 2408
     retract_z_probe();
2363 2409
   #endif
2364 2410
     
@@ -2403,22 +2449,13 @@ inline void gcode_G92() {
2403 2449
   if (!code_seen(axis_codes[E_AXIS]))
2404 2450
     st_synchronize();
2405 2451
 
2406
-  for (int i=0;i<NUM_AXIS;i++) {
2452
+  for (int i = 0; i < NUM_AXIS; i++) {
2407 2453
     if (code_seen(axis_codes[i])) {
2408
-      if (i == E_AXIS) {
2409
-        current_position[i] = code_value();
2454
+      current_position[i] = code_value();
2455
+      if (i == E_AXIS)
2410 2456
         plan_set_e_position(current_position[E_AXIS]);
2411
-      }
2412
-      else {
2413
-        current_position[i] = code_value() +
2414
-          #ifdef SCARA
2415
-            ((i != X_AXIS && i != Y_AXIS) ? add_homing[i] : 0)
2416
-          #else
2417
-            add_homing[i]
2418
-          #endif
2419
-        ;
2457
+      else
2420 2458
         plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
2421
-      }
2422 2459
     }
2423 2460
   }
2424 2461
 }
@@ -3355,9 +3392,9 @@ inline void gcode_M114() {
3355 3392
     SERIAL_PROTOCOLLN("");
3356 3393
     
3357 3394
     SERIAL_PROTOCOLPGM("SCARA Cal - Theta:");
3358
-    SERIAL_PROTOCOL(delta[X_AXIS]+add_homing[X_AXIS]);
3395
+    SERIAL_PROTOCOL(delta[X_AXIS]+home_offset[X_AXIS]);
3359 3396
     SERIAL_PROTOCOLPGM("   Psi+Theta (90):");
3360
-    SERIAL_PROTOCOL(delta[Y_AXIS]-delta[X_AXIS]-90+add_homing[Y_AXIS]);
3397
+    SERIAL_PROTOCOL(delta[Y_AXIS]-delta[X_AXIS]-90+home_offset[Y_AXIS]);
3361 3398
     SERIAL_PROTOCOLLN("");
3362 3399
     
3363 3400
     SERIAL_PROTOCOLPGM("SCARA step Cal - Theta:");
@@ -3575,12 +3612,12 @@ inline void gcode_M205() {
3575 3612
 inline void gcode_M206() {
3576 3613
   for (int8_t i=X_AXIS; i <= Z_AXIS; i++) {
3577 3614
     if (code_seen(axis_codes[i])) {
3578
-      add_homing[i] = code_value();
3615
+      home_offset[i] = code_value();
3579 3616
     }
3580 3617
   }
3581 3618
   #ifdef SCARA
3582
-    if (code_seen('T')) add_homing[X_AXIS] = code_value(); // Theta
3583
-    if (code_seen('P')) add_homing[Y_AXIS] = code_value(); // Psi
3619
+    if (code_seen('T')) home_offset[X_AXIS] = code_value(); // Theta
3620
+    if (code_seen('P')) home_offset[Y_AXIS] = code_value(); // Psi
3584 3621
   #endif
3585 3622
 }
3586 3623
 
@@ -3967,18 +4004,13 @@ inline void gcode_M303() {
3967 4004
 }
3968 4005
 
3969 4006
 #ifdef SCARA
3970
-
3971
-  /**
3972
-   * M360: SCARA calibration: Move to cal-position ThetaA (0 deg calibration)
3973
-   */
3974
-  inline bool gcode_M360() {
3975
-    SERIAL_ECHOLN(" Cal: Theta 0 ");
4007
+  bool SCARA_move_to_cal(uint8_t delta_x, uint8_t delta_y) {
3976 4008
     //SoftEndsEnabled = false;              // Ignore soft endstops during calibration
3977 4009
     //SERIAL_ECHOLN(" Soft endstops disabled ");
3978 4010
     if (! Stopped) {
3979 4011
       //get_coordinates(); // For X Y Z E F
3980
-      delta[X_AXIS] = 0;
3981
-      delta[Y_AXIS] = 120;
4012
+      delta[X_AXIS] = delta_x;
4013
+      delta[Y_AXIS] = delta_y;
3982 4014
       calculate_SCARA_forward_Transform(delta);
3983 4015
       destination[X_AXIS] = delta[X_AXIS]/axis_scaling[X_AXIS];
3984 4016
       destination[Y_AXIS] = delta[Y_AXIS]/axis_scaling[Y_AXIS];
@@ -3990,24 +4022,19 @@ inline void gcode_M303() {
3990 4022
   }
3991 4023
 
3992 4024
   /**
4025
+   * M360: SCARA calibration: Move to cal-position ThetaA (0 deg calibration)
4026
+   */
4027
+  inline bool gcode_M360() {
4028
+    SERIAL_ECHOLN(" Cal: Theta 0 ");
4029
+    return SCARA_move_to_cal(0, 120);
4030
+  }
4031
+
4032
+  /**
3993 4033
    * M361: SCARA calibration: Move to cal-position ThetaB (90 deg calibration - steps per degree)
3994 4034
    */
3995 4035
   inline bool gcode_M361() {
3996 4036
     SERIAL_ECHOLN(" Cal: Theta 90 ");
3997
-    //SoftEndsEnabled = false;              // Ignore soft endstops during calibration
3998
-    //SERIAL_ECHOLN(" Soft endstops disabled ");
3999
-    if (! Stopped) {
4000
-      //get_coordinates(); // For X Y Z E F
4001
-      delta[X_AXIS] = 90;
4002
-      delta[Y_AXIS] = 130;
4003
-      calculate_SCARA_forward_Transform(delta);
4004
-      destination[X_AXIS] = delta[X_AXIS]/axis_scaling[X_AXIS];
4005
-      destination[Y_AXIS] = delta[Y_AXIS]/axis_scaling[Y_AXIS];
4006
-      prepare_move();
4007
-      //ClearToSend();
4008
-      return true;
4009
-    }
4010
-    return false;
4037
+    return SCARA_move_to_cal(90, 130);
4011 4038
   }
4012 4039
 
4013 4040
   /**
@@ -4015,20 +4042,7 @@ inline void gcode_M303() {
4015 4042
    */
4016 4043
   inline bool gcode_M362() {
4017 4044
     SERIAL_ECHOLN(" Cal: Psi 0 ");
4018
-    //SoftEndsEnabled = false;              // Ignore soft endstops during calibration
4019
-    //SERIAL_ECHOLN(" Soft endstops disabled ");
4020
-    if (! Stopped) {
4021
-      //get_coordinates(); // For X Y Z E F
4022
-      delta[X_AXIS] = 60;
4023
-      delta[Y_AXIS] = 180;
4024
-      calculate_SCARA_forward_Transform(delta);
4025
-      destination[X_AXIS] = delta[X_AXIS]/axis_scaling[X_AXIS];
4026
-      destination[Y_AXIS] = delta[Y_AXIS]/axis_scaling[Y_AXIS];
4027
-      prepare_move();
4028
-      //ClearToSend();
4029
-      return true;
4030
-    }
4031
-    return false;
4045
+    return SCARA_move_to_cal(60, 180);
4032 4046
   }
4033 4047
 
4034 4048
   /**
@@ -4036,20 +4050,7 @@ inline void gcode_M303() {
4036 4050
    */
4037 4051
   inline bool gcode_M363() {
4038 4052
     SERIAL_ECHOLN(" Cal: Psi 90 ");
4039
-    //SoftEndsEnabled = false;              // Ignore soft endstops during calibration
4040
-    //SERIAL_ECHOLN(" Soft endstops disabled ");
4041
-    if (! Stopped) {
4042
-      //get_coordinates(); // For X Y Z E F
4043
-      delta[X_AXIS] = 50;
4044
-      delta[Y_AXIS] = 90;
4045
-      calculate_SCARA_forward_Transform(delta);
4046
-      destination[X_AXIS] = delta[X_AXIS]/axis_scaling[X_AXIS];
4047
-      destination[Y_AXIS] = delta[Y_AXIS]/axis_scaling[Y_AXIS];
4048
-      prepare_move();
4049
-      //ClearToSend();
4050
-      return true;
4051
-    }
4052
-    return false;
4053
+    return SCARA_move_to_cal(50, 90);
4053 4054
   }
4054 4055
 
4055 4056
   /**
@@ -4057,20 +4058,7 @@ inline void gcode_M303() {
4057 4058
    */
4058 4059
   inline bool gcode_M364() {
4059 4060
     SERIAL_ECHOLN(" Cal: Theta-Psi 90 ");
4060
-   // SoftEndsEnabled = false;              // Ignore soft endstops during calibration
4061
-    //SERIAL_ECHOLN(" Soft endstops disabled ");
4062
-    if (! Stopped) {
4063
-      //get_coordinates(); // For X Y Z E F
4064
-      delta[X_AXIS] = 45;
4065
-      delta[Y_AXIS] = 135;
4066
-      calculate_SCARA_forward_Transform(delta);
4067
-      destination[X_AXIS] = delta[X_AXIS] / axis_scaling[X_AXIS];
4068
-      destination[Y_AXIS] = delta[Y_AXIS] / axis_scaling[Y_AXIS];
4069
-      prepare_move();
4070
-      //ClearToSend();
4071
-      return true;
4072
-    }
4073
-    return false;
4061
+    return SCARA_move_to_cal(45, 135);
4074 4062
   }
4075 4063
 
4076 4064
   /**
@@ -4661,6 +4649,12 @@ void process_commands() {
4661 4649
       gcode_G28();
4662 4650
       break;
4663 4651
 
4652
+    #if defined(MESH_BED_LEVELING)
4653
+      case 29: // G29 Handle mesh based leveling
4654
+        gcode_G29();
4655
+        break;
4656
+    #endif
4657
+
4664 4658
     #ifdef ENABLE_AUTO_BED_LEVELING
4665 4659
 
4666 4660
       case 29: // G29 Detailed Z-Probe, probes the bed at 3 or more points.
@@ -5172,7 +5166,7 @@ void clamp_to_software_endstops(float target[3])
5172 5166
     float negative_z_offset = 0;
5173 5167
     #ifdef ENABLE_AUTO_BED_LEVELING
5174 5168
       if (Z_PROBE_OFFSET_FROM_EXTRUDER < 0) negative_z_offset = negative_z_offset + Z_PROBE_OFFSET_FROM_EXTRUDER;
5175
-      if (add_homing[Z_AXIS] < 0) negative_z_offset = negative_z_offset + add_homing[Z_AXIS];
5169
+      if (home_offset[Z_AXIS] < 0) negative_z_offset = negative_z_offset + home_offset[Z_AXIS];
5176 5170
     #endif
5177 5171
     
5178 5172
     if (target[Z_AXIS] < min_pos[Z_AXIS]+negative_z_offset) target[Z_AXIS] = min_pos[Z_AXIS]+negative_z_offset;
@@ -5280,6 +5274,81 @@ void prepare_move_raw()
5280 5274
 }
5281 5275
 #endif //DELTA
5282 5276
 
5277
+#if defined(MESH_BED_LEVELING)
5278
+#if !defined(MIN)
5279
+#define MIN(_v1, _v2) (((_v1) < (_v2)) ? (_v1) : (_v2))
5280
+#endif  // ! MIN
5281
+// This function is used to split lines on mesh borders so each segment is only part of one mesh area
5282
+void mesh_plan_buffer_line(float x, float y, float z, const float e, float feed_rate, const uint8_t &extruder, uint8_t x_splits=0xff, uint8_t y_splits=0xff)
5283
+{
5284
+  if (!mbl.active) {
5285
+    plan_buffer_line(x, y, z, e, feed_rate, extruder);
5286
+    for(int8_t i=0; i < NUM_AXIS; i++) {
5287
+      current_position[i] = destination[i];
5288
+    }
5289
+    return;
5290
+  }
5291
+  int pix = mbl.select_x_index(current_position[X_AXIS]);
5292
+  int piy = mbl.select_y_index(current_position[Y_AXIS]);
5293
+  int ix = mbl.select_x_index(x);
5294
+  int iy = mbl.select_y_index(y);
5295
+  pix = MIN(pix, MESH_NUM_X_POINTS-2);
5296
+  piy = MIN(piy, MESH_NUM_Y_POINTS-2);
5297
+  ix = MIN(ix, MESH_NUM_X_POINTS-2);
5298
+  iy = MIN(iy, MESH_NUM_Y_POINTS-2);
5299
+  if (pix == ix && piy == iy) {
5300
+    // Start and end on same mesh square
5301
+    plan_buffer_line(x, y, z, e, feed_rate, extruder);
5302
+    for(int8_t i=0; i < NUM_AXIS; i++) {
5303
+      current_position[i] = destination[i];
5304
+    }
5305
+    return;
5306
+  }
5307
+  float nx, ny, ne, normalized_dist;
5308
+  if (ix > pix && (x_splits) & BIT(ix)) {
5309
+    nx = mbl.get_x(ix);
5310
+    normalized_dist = (nx - current_position[X_AXIS])/(x - current_position[X_AXIS]);
5311
+    ny = current_position[Y_AXIS] + (y - current_position[Y_AXIS]) * normalized_dist;
5312
+    ne = current_position[E_AXIS] + (e - current_position[E_AXIS]) * normalized_dist;
5313
+    x_splits ^= BIT(ix);
5314
+  } else if (ix < pix && (x_splits) & BIT(pix)) {
5315
+    nx = mbl.get_x(pix);
5316
+    normalized_dist = (nx - current_position[X_AXIS])/(x - current_position[X_AXIS]);
5317
+    ny = current_position[Y_AXIS] + (y - current_position[Y_AXIS]) * normalized_dist;
5318
+    ne = current_position[E_AXIS] + (e - current_position[E_AXIS]) * normalized_dist;
5319
+    x_splits ^= BIT(pix);
5320
+  } else if (iy > piy && (y_splits) & BIT(iy)) {
5321
+    ny = mbl.get_y(iy);
5322
+    normalized_dist = (ny - current_position[Y_AXIS])/(y - current_position[Y_AXIS]);
5323
+    nx = current_position[X_AXIS] + (x - current_position[X_AXIS]) * normalized_dist;
5324
+    ne = current_position[E_AXIS] + (e - current_position[E_AXIS]) * normalized_dist;
5325
+    y_splits ^= BIT(iy);
5326
+  } else if (iy < piy && (y_splits) & BIT(piy)) {
5327
+    ny = mbl.get_y(piy);
5328
+    normalized_dist = (ny - current_position[Y_AXIS])/(y - current_position[Y_AXIS]);
5329
+    nx = current_position[X_AXIS] + (x - current_position[X_AXIS]) * normalized_dist;
5330
+    ne = current_position[E_AXIS] + (e - current_position[E_AXIS]) * normalized_dist;
5331
+    y_splits ^= BIT(piy);
5332
+  } else {
5333
+    // Already split on a border
5334
+    plan_buffer_line(x, y, z, e, feed_rate, extruder);
5335
+    for(int8_t i=0; i < NUM_AXIS; i++) {
5336
+      current_position[i] = destination[i];
5337
+    }
5338
+    return;
5339
+  }
5340
+  // Do the split and look for more borders
5341
+  destination[X_AXIS] = nx;
5342
+  destination[Y_AXIS] = ny;
5343
+  destination[E_AXIS] = ne;
5344
+  mesh_plan_buffer_line(nx, ny, z, ne, feed_rate, extruder, x_splits, y_splits);
5345
+  destination[X_AXIS] = x;
5346
+  destination[Y_AXIS] = y;
5347
+  destination[E_AXIS] = e;
5348
+  mesh_plan_buffer_line(x, y, z, e, feed_rate, extruder, x_splits, y_splits);
5349
+}
5350
+#endif  // MESH_BED_LEVELING
5351
+
5283 5352
 void prepare_move()
5284 5353
 {
5285 5354
   clamp_to_software_endstops(destination);
@@ -5395,10 +5464,14 @@ for (int s = 1; s <= steps; s++) {
5395 5464
 #if ! (defined DELTA || defined SCARA)
5396 5465
   // Do not use feedmultiply for E or Z only moves
5397 5466
   if( (current_position[X_AXIS] == destination [X_AXIS]) && (current_position[Y_AXIS] == destination [Y_AXIS])) {
5398
-      plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
5399
-  }
5400
-  else {
5467
+    plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
5468
+  } else {
5469
+#if defined(MESH_BED_LEVELING)
5470
+    mesh_plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate*feedmultiply/60/100.0, active_extruder);
5471
+    return;
5472
+#else
5401 5473
     plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate*feedmultiply/60/100.0, active_extruder);
5474
+#endif  // MESH_BED_LEVELING
5402 5475
   }
5403 5476
 #endif // !(DELTA || SCARA)
5404 5477
 

+ 254
- 0
Marlin/SanityCheck.h View File

@@ -0,0 +1,254 @@
1
+/**
2
+ * SanityCheck.h
3
+ *
4
+ * Test configuration values for errors at compile-time.
5
+ */
6
+#ifndef SANITYCHECK_H
7
+  #define SANITYCHECK_H
8
+
9
+  /**
10
+   * Dual Stepper Drivers
11
+   */
12
+  #if defined(Z_DUAL_STEPPER_DRIVERS) && defined(Y_DUAL_STEPPER_DRIVERS)
13
+    #error You cannot have dual stepper drivers for both Y and Z.
14
+  #endif
15
+
16
+  /**
17
+   * Progress Bar
18
+   */
19
+  #ifdef LCD_PROGRESS_BAR
20
+    #ifdef DOGLCD
21
+      #warning LCD_PROGRESS_BAR does not apply to graphical displays.
22
+    #endif
23
+    #ifdef FILAMENT_LCD_DISPLAY
24
+      #error LCD_PROGRESS_BAR and FILAMENT_LCD_DISPLAY are not fully compatible. Comment out this line to use both.
25
+    #endif
26
+  #endif
27
+
28
+  /**
29
+   * Babystepping
30
+   */
31
+  #ifdef BABYSTEPPING
32
+    #ifdef COREXY
33
+      #error BABYSTEPPING not implemented for COREXY yet.
34
+    #endif
35
+    #ifdef SCARA
36
+      #error BABYSTEPPING is not implemented for SCARA yet.
37
+    #endif
38
+    #if defined(DELTA) && defined(BABYSTEP_XY)
39
+      #error BABYSTEPPING only implemented for Z axis on deltabots.
40
+    #endif
41
+  #endif
42
+
43
+  /**
44
+   * Filament Change with Extruder Runout Prevention
45
+   */
46
+  #if defined(FILAMENTCHANGEENABLE) && defined(EXTRUDER_RUNOUT_PREVENT)
47
+    #error EXTRUDER_RUNOUT_PREVENT currently incompatible with FILAMENTCHANGE.
48
+  #endif
49
+
50
+  /**
51
+   * Options only for EXTRUDERS == 1
52
+   */
53
+  #if EXTRUDERS > 1
54
+
55
+    #if EXTRUDERS > 4
56
+      #error The maximum number of EXTRUDERS is 4.
57
+    #endif
58
+
59
+    #ifdef TEMP_SENSOR_1_AS_REDUNDANT
60
+      #error EXTRUDERS must be 1 with TEMP_SENSOR_1_AS_REDUNDANT.
61
+    #endif
62
+
63
+    #ifdef HEATERS_PARALLEL
64
+      #error EXTRUDERS must be 1 with HEATERS_PARALLEL.
65
+    #endif
66
+
67
+    #ifdef Y_DUAL_STEPPER_DRIVERS
68
+      #error EXTRUDERS must be 1 with Y_DUAL_STEPPER_DRIVERS.
69
+    #endif
70
+
71
+    #ifdef Z_DUAL_STEPPER_DRIVERS
72
+      #error EXTRUDERS must be 1 with Z_DUAL_STEPPER_DRIVERS.
73
+    #endif
74
+
75
+  #endif // EXTRUDERS > 1
76
+
77
+  /**
78
+   * Required LCD language
79
+   */
80
+  #if !defined(DOGLCD) && defined(ULTRA_LCD) && !defined(DISPLAY_CHARSET_HD44780_JAPAN) && !defined(DISPLAY_CHARSET_HD44780_WESTERN)
81
+    #error You must enable either DISPLAY_CHARSET_HD44780_JAPAN or DISPLAY_CHARSET_HD44780_WESTERN for your LCD controller.
82
+  #endif
83
+
84
+  /**
85
+   * Auto Bed Leveling
86
+   */
87
+  #ifdef ENABLE_AUTO_BED_LEVELING
88
+
89
+    /**
90
+     * Require a Z Min pin
91
+     */
92
+    #if Z_MIN_PIN == -1
93
+      #ifdef Z_PROBE_REPEATABILITY_TEST
94
+        #error You must have a Z_MIN endstop to enable Z_PROBE_REPEATABILITY_TEST.
95
+      #else
96
+        #error ENABLE_AUTO_BED_LEVELING requires a Z_MIN endstop. Z_MIN_PIN must point to a valid hardware pin.
97
+      #endif
98
+    #endif
99
+
100
+    /**
101
+     * Check if Probe_Offset * Grid Points is greater than Probing Range
102
+     */
103
+    #ifdef AUTO_BED_LEVELING_GRID
104
+
105
+      // Make sure probing points are reachable
106
+      #if LEFT_PROBE_BED_POSITION < MIN_PROBE_X
107
+        #error The given LEFT_PROBE_BED_POSITION can't be reached by the probe.
108
+      #elif RIGHT_PROBE_BED_POSITION > MAX_PROBE_X
109
+        #error The given RIGHT_PROBE_BED_POSITION can't be reached by the probe.
110
+      #elif FRONT_PROBE_BED_POSITION < MIN_PROBE_Y
111
+        #error The given FRONT_PROBE_BED_POSITION can't be reached by the probe.
112
+      #elif BACK_PROBE_BED_POSITION > MAX_PROBE_Y
113
+        #error The given BACK_PROBE_BED_POSITION can't be reached by the probe.
114
+      #endif
115
+
116
+      #define PROBE_SIZE_X (X_PROBE_OFFSET_FROM_EXTRUDER * (AUTO_BED_LEVELING_GRID_POINTS-1))
117
+      #define PROBE_SIZE_Y (Y_PROBE_OFFSET_FROM_EXTRUDER * (AUTO_BED_LEVELING_GRID_POINTS-1))
118
+      #define PROBE_AREA_WIDTH (RIGHT_PROBE_BED_POSITION - LEFT_PROBE_BED_POSITION)
119
+      #define PROBE_AREA_DEPTH (BACK_PROBE_BED_POSITION - FRONT_PROBE_BED_POSITION)
120
+      #if X_PROBE_OFFSET_FROM_EXTRUDER < 0
121
+        #if PROBE_SIZE_X <= -PROBE_AREA_WIDTH
122
+          #define X_PROBE_ERROR
123
+        #endif
124
+      #elif PROBE_SIZE_X >= PROBE_AREA_WIDTH
125
+        #define X_PROBE_ERROR
126
+      #endif
127
+      #ifdef X_PROBE_ERROR
128
+        #error The X axis probing range is too small to fit all the points defined in AUTO_BED_LEVELING_GRID_POINTS
129
+      #endif
130
+      #if Y_PROBE_OFFSET_FROM_EXTRUDER < 0
131
+        #if PROBE_SIZE_Y <= -PROBE_AREA_DEPTH
132
+          #define Y_PROBE_ERROR
133
+        #endif
134
+      #elif PROBE_SIZE_Y >= PROBE_AREA_DEPTH
135
+        #define Y_PROBE_ERROR
136
+      #endif
137
+      #ifdef Y_PROBE_ERROR
138
+        #error The Y axis probing range is to small to fit all the points defined in AUTO_BED_LEVELING_GRID_POINTS
139
+      #endif
140
+
141
+      #undef PROBE_SIZE_X
142
+      #undef PROBE_SIZE_Y
143
+      #undef PROBE_AREA_WIDTH
144
+      #undef PROBE_AREA_DEPTH
145
+
146
+    #else // !AUTO_BED_LEVELING_GRID
147
+
148
+      // Check the triangulation points
149
+      #if ABL_PROBE_PT_1_X < MIN_PROBE_X || ABL_PROBE_PT_1_X > MAX_PROBE_X
150
+        #error "The given ABL_PROBE_PT_1_X can't be reached by the probe."
151
+      #elif ABL_PROBE_PT_2_X < MIN_PROBE_X || ABL_PROBE_PT_2_X > MAX_PROBE_X
152
+        #error "The given ABL_PROBE_PT_2_X can't be reached by the probe."
153
+      #elif ABL_PROBE_PT_3_X < MIN_PROBE_X || ABL_PROBE_PT_3_X > MAX_PROBE_X
154
+        #error "The given ABL_PROBE_PT_3_X can't be reached by the probe."
155
+      #elif ABL_PROBE_PT_1_Y < MIN_PROBE_Y || ABL_PROBE_PT_1_Y > MAX_PROBE_Y
156
+        #error "The given ABL_PROBE_PT_1_Y can't be reached by the probe."
157
+      #elif ABL_PROBE_PT_2_Y < MIN_PROBE_Y || ABL_PROBE_PT_2_Y > MAX_PROBE_Y
158
+        #error "The given ABL_PROBE_PT_2_Y can't be reached by the probe."
159
+      #elif ABL_PROBE_PT_3_Y < MIN_PROBE_Y || ABL_PROBE_PT_3_Y > MAX_PROBE_Y
160
+        #error "The given ABL_PROBE_PT_3_Y can't be reached by the probe."
161
+      #endif
162
+
163
+    #endif // !AUTO_BED_LEVELING_GRID
164
+
165
+  #endif // ENABLE_AUTO_BED_LEVELING
166
+
167
+  /**
168
+   * ULTIPANEL encoder
169
+   */
170
+  #if defined(ULTIPANEL) && !defined(NEWPANEL) && !defined(SR_LCD_2W_NL) && !defined(SHIFT_CLK)
171
+    #error ULTIPANEL requires some kind of encoder.
172
+  #endif
173
+
174
+  /**
175
+   * Delta has limited bed leveling options
176
+   */
177
+  #ifdef DELTA
178
+
179
+    #ifdef ENABLE_AUTO_BED_LEVELING
180
+
181
+      #ifndef AUTO_BED_LEVELING_GRID
182
+        #error Only AUTO_BED_LEVELING_GRID is supported with DELTA.
183
+      #endif
184
+
185
+      #ifdef Z_PROBE_SLED
186
+        #error You cannot use Z_PROBE_SLED with DELTA.
187
+      #endif
188
+
189
+      #ifdef Z_PROBE_REPEATABILITY_TEST
190
+        #error Z_PROBE_REPEATABILITY_TEST is not supported with DELTA yet.
191
+      #endif
192
+
193
+    #endif
194
+
195
+  #endif
196
+
197
+  /**
198
+   * Allen Key Z Probe requires Auto Bed Leveling grid and Delta
199
+   */
200
+  #if defined(Z_PROBE_ALLEN_KEY) && !(defined(AUTO_BED_LEVELING_GRID) && defined(DELTA))
201
+    #error Invalid use of Z_PROBE_ALLEN_KEY.
202
+  #endif
203
+
204
+  /**
205
+   * Dual X Carriage requirements
206
+   */
207
+  #ifdef DUAL_X_CARRIAGE
208
+    #if EXTRUDERS == 1 || defined(COREXY) \
209
+        || !defined(X2_ENABLE_PIN) || !defined(X2_STEP_PIN) || !defined(X2_DIR_PIN) \
210
+        || !defined(X2_HOME_POS) || !defined(X2_MIN_POS) || !defined(X2_MAX_POS) \
211
+        || !defined(X_MAX_PIN) || X_MAX_PIN < 0
212
+      #error Missing or invalid definitions for DUAL_X_CARRIAGE mode.
213
+    #endif
214
+    #if X_HOME_DIR != -1 || X2_HOME_DIR != 1
215
+      #error Please use canonical x-carriage assignment.
216
+    #endif
217
+  #endif // DUAL_X_CARRIAGE
218
+
219
+  /**
220
+   * Make sure auto fan pins don't conflict with the fan pin
221
+   */
222
+  #if HAS_AUTO_FAN && HAS_FAN
223
+    #if EXTRUDER_0_AUTO_FAN_PIN == FAN_PIN
224
+      #error You cannot set EXTRUDER_0_AUTO_FAN_PIN equal to FAN_PIN
225
+    #elif EXTRUDER_1_AUTO_FAN_PIN == FAN_PIN
226
+      #error You cannot set EXTRUDER_1_AUTO_FAN_PIN equal to FAN_PIN
227
+    #elif EXTRUDER_2_AUTO_FAN_PIN == FAN_PIN
228
+      #error You cannot set EXTRUDER_2_AUTO_FAN_PIN equal to FAN_PIN
229
+    #elif EXTRUDER_3_AUTO_FAN_PIN == FAN_PIN
230
+      #error You cannot set EXTRUDER_3_AUTO_FAN_PIN equal to FAN_PIN
231
+    #endif
232
+  #endif
233
+
234
+  /**
235
+   * Test required HEATER defines
236
+   */
237
+  #if EXTRUDERS > 3
238
+    #if !HAS_HEATER_3
239
+      #error HEATER_3_PIN not defined for this board
240
+    #endif
241
+  #elif EXTRUDERS > 2
242
+    #if !HAS_HEATER_2
243
+      #error HEATER_2_PIN not defined for this board
244
+    #endif
245
+  #elif EXTRUDERS > 1 || defined(HEATERS_PARALLEL)
246
+    #if !HAS_HEATER_1
247
+      #error HEATER_1_PIN not defined for this board
248
+    #endif
249
+  #endif
250
+  #if !HAS_HEATER_0
251
+    #error HEATER_0_PIN not defined for this board
252
+  #endif
253
+
254
+#endif //SANITYCHECK_H

+ 2
- 3
Marlin/Sd2PinMap.h View File

@@ -33,9 +33,7 @@ struct pin_map_t {
33 33
   uint8_t bit;
34 34
 };
35 35
 //------------------------------------------------------------------------------
36
-#if defined(__AVR_ATmega1280__)\
37
-|| defined(__AVR_ATmega2560__)
38
-// Mega
36
+#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) // Mega
39 37
 
40 38
 // Two Wire (aka I2C) ports
41 39
 uint8_t const SDA_PIN = 20;  // D1
@@ -43,6 +41,7 @@ uint8_t const SCL_PIN = 21;  // D0
43 41
 
44 42
 #undef MOSI_PIN
45 43
 #undef MISO_PIN
44
+#undef SCK_PIN
46 45
 // SPI port
47 46
 uint8_t const SS_PIN = 53;    // B0
48 47
 uint8_t const MOSI_PIN = 51;  // B2

+ 33
- 163
Marlin/configurator/config/Configuration.h View File

@@ -330,15 +330,6 @@ your extruder heater takes 2 minutes to hit the target on heating.
330 330
   // #define ENDSTOPPULLUP_ZMIN
331 331
 #endif
332 332
 
333
-#ifdef ENDSTOPPULLUPS
334
-  #define ENDSTOPPULLUP_XMAX
335
-  #define ENDSTOPPULLUP_YMAX
336
-  #define ENDSTOPPULLUP_ZMAX
337
-  #define ENDSTOPPULLUP_XMIN
338
-  #define ENDSTOPPULLUP_YMIN
339
-  #define ENDSTOPPULLUP_ZMIN
340
-#endif
341
-
342 333
 // The pullups are needed if you directly connect a mechanical endswitch between the signal and ground pins.
343 334
 const bool X_MIN_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop.
344 335
 const bool Y_MIN_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop.
@@ -405,12 +396,32 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
405 396
 #define Y_MAX_POS 205
406 397
 #define Z_MAX_POS 200
407 398
 
408
-// @section hidden
399
+//===========================================================================
400
+//============================= Filament Runout Sensor ======================
401
+//===========================================================================
402
+//#define FILAMENT_RUNOUT_SENSOR // Uncomment for defining a filament runout sensor such as a mechanical or opto endstop to check the existence of filament
403
+                                 // In RAMPS uses servo pin 2. Can be changed in pins file. For other boards pin definition should be made.
404
+                                 // It is assumed that when logic high = filament available
405
+                                 //                    when logic  low = filament ran out
406
+//const bool FIL_RUNOUT_INVERTING = true;  // Should be uncommented and true or false should assigned
407
+//#define ENDSTOPPULLUP_FIL_RUNOUT // Uncomment to use internal pullup for filament runout pins if the sensor is defined.
408
+
409
+//===========================================================================
410
+//============================ Manual Bed Leveling ==========================
411
+//===========================================================================
409 412
 
410
-#define X_MAX_LENGTH (X_MAX_POS - X_MIN_POS)
411
-#define Y_MAX_LENGTH (Y_MAX_POS - Y_MIN_POS)
412
-#define Z_MAX_LENGTH (Z_MAX_POS - Z_MIN_POS)
413
+// #define MANUAL_BED_LEVELING  // Add display menu option for bed leveling
414
+// #define MESH_BED_LEVELING    // Enable mesh bed leveling
413 415
 
416
+#if defined(MESH_BED_LEVELING)
417
+  #define MESH_MIN_X 10
418
+  #define MESH_MAX_X (X_MAX_POS - MESH_MIN_X)
419
+  #define MESH_MIN_Y 10
420
+  #define MESH_MAX_Y (Y_MAX_POS - MESH_MIN_Y)
421
+  #define MESH_NUM_X_POINTS 3  // Don't use more than 7 points per axis, implementation limited
422
+  #define MESH_NUM_Y_POINTS 3
423
+  #define MESH_HOME_SEARCH_Z 4  // Z after Home, bed somewhere below but above 0.0
424
+#endif  // MESH_BED_LEVELING
414 425
 
415 426
 //===========================================================================
416 427
 //============================= Bed Auto Leveling ===========================
@@ -440,12 +451,6 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
440 451
 
441 452
   #ifdef AUTO_BED_LEVELING_GRID
442 453
 
443
-    // Use one of these defines to specify the origin
444
-    // for a topographical map to be printed for your bed.
445
-    enum { OriginBackLeft, OriginFrontLeft, OriginBackRight, OriginFrontRight };
446
-    #define TOPO_ORIGIN OriginFrontLeft
447
-
448
-    // The edges of the rectangle in which to probe
449 454
     #define LEFT_PROBE_BED_POSITION 15
450 455
     #define RIGHT_PROBE_BED_POSITION 170
451 456
     #define FRONT_PROBE_BED_POSITION 20
@@ -656,114 +661,17 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
656 661
 // REMEMBER TO INSTALL LiquidCrystal_I2C.h in your ARDUINO library folder: https://github.com/kiyoshigawa/LiquidCrystal_I2C
657 662
 //#define RA_CONTROL_PANEL
658 663
 
659
-// @section hidden
660
-
661
-//automatic expansion
662
-#if defined (MAKRPANEL)
663
- #define DOGLCD
664
- #define SDSUPPORT
665
- #define ULTIPANEL
666
- #define NEWPANEL
667
- #define DEFAULT_LCD_CONTRAST 17
668
-#endif
669
-
670
-#if defined(miniVIKI) || defined(VIKI2)
671
- #define ULTRA_LCD  //general LCD support, also 16x2
672
- #define DOGLCD  // Support for SPI LCD 128x64 (Controller ST7565R graphic Display Family)
673
- #define ULTIMAKERCONTROLLER //as available from the Ultimaker online store.
674
- 
675
-  #ifdef miniVIKI
676
-   #define DEFAULT_LCD_CONTRAST 95
677
-  #else
678
-   #define DEFAULT_LCD_CONTRAST 40
679
-  #endif
680
-  
681
- #define ENCODER_PULSES_PER_STEP 4
682
- #define ENCODER_STEPS_PER_MENU_ITEM 1
683
-#endif
684
-
685
-#if defined (PANEL_ONE)
686
- #define SDSUPPORT
687
- #define ULTIMAKERCONTROLLER
688
-#endif
689
-
690
-#if defined (REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER)
691
- #define DOGLCD
692
- #define U8GLIB_ST7920
693
- #define REPRAP_DISCOUNT_SMART_CONTROLLER
694
-#endif
695
-
696
-#if defined(ULTIMAKERCONTROLLER) || defined(REPRAP_DISCOUNT_SMART_CONTROLLER) || defined(G3D_PANEL)
697
- #define ULTIPANEL
698
- #define NEWPANEL
699
-#endif
700
-
701
-#if defined(REPRAPWORLD_KEYPAD)
702
-  #define NEWPANEL
703
-  #define ULTIPANEL
704
-#endif
705
-#if defined(RA_CONTROL_PANEL)
706
- #define ULTIPANEL
707
- #define NEWPANEL
708
- #define LCD_I2C_TYPE_PCA8574
709
- #define LCD_I2C_ADDRESS 0x27   // I2C Address of the port expander
710
-#endif
711
-
712
-//I2C PANELS
664
+/**
665
+ * I2C Panels
666
+ */
713 667
 
714 668
 //#define LCD_I2C_SAINSMART_YWROBOT
715
-#ifdef LCD_I2C_SAINSMART_YWROBOT
716
-  // This uses the LiquidCrystal_I2C library ( https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home )
717
-  // Make sure it is placed in the Arduino libraries directory.
718
-  #define LCD_I2C_TYPE_PCF8575
719
-  #define LCD_I2C_ADDRESS 0x27   // I2C Address of the port expander
720
-  #define NEWPANEL
721
-  #define ULTIPANEL
722
-#endif
723 669
 
724 670
 // PANELOLU2 LCD with status LEDs, separate encoder and click inputs
725 671
 //#define LCD_I2C_PANELOLU2
726
-#ifdef LCD_I2C_PANELOLU2
727
-  // This uses the LiquidTWI2 library v1.2.3 or later ( https://github.com/lincomatic/LiquidTWI2 )
728
-  // Make sure the LiquidTWI2 directory is placed in the Arduino or Sketchbook libraries subdirectory.
729
-  // (v1.2.3 no longer requires you to define PANELOLU in the LiquidTWI2.h library header file)
730
-  // Note: The PANELOLU2 encoder click input can either be directly connected to a pin
731
-  //       (if BTN_ENC defined to != -1) or read through I2C (when BTN_ENC == -1).
732
-  #define LCD_I2C_TYPE_MCP23017
733
-  #define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander
734
-  #define LCD_USE_I2C_BUZZER //comment out to disable buzzer on LCD
735
-  #define NEWPANEL
736
-  #define ULTIPANEL
737
-
738
-  #ifndef ENCODER_PULSES_PER_STEP
739
-	#define ENCODER_PULSES_PER_STEP 4
740
-  #endif
741
-
742
-  #ifndef ENCODER_STEPS_PER_MENU_ITEM
743
-	#define ENCODER_STEPS_PER_MENU_ITEM 1
744
-  #endif
745
-
746
-
747
-  #ifdef LCD_USE_I2C_BUZZER
748
-	#define LCD_FEEDBACK_FREQUENCY_HZ 1000
749
-	#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100
750
-  #endif
751
-
752
-#endif
753 672
 
754 673
 // Panucatt VIKI LCD with status LEDs, integrated click & L/R/U/P buttons, separate encoder inputs
755 674
 //#define LCD_I2C_VIKI
756
-#ifdef LCD_I2C_VIKI
757
-  // This uses the LiquidTWI2 library v1.2.3 or later ( https://github.com/lincomatic/LiquidTWI2 )
758
-  // Make sure the LiquidTWI2 directory is placed in the Arduino or Sketchbook libraries subdirectory.
759
-  // Note: The pause/stop/resume LCD button pin should be connected to the Arduino
760
-  //       BTN_ENC pin (or set BTN_ENC to -1 if not used)
761
-  #define LCD_I2C_TYPE_MCP23017
762
-  #define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander
763
-  #define LCD_USE_I2C_BUZZER //comment out to disable buzzer on LCD (requires LiquidTWI2 v1.2.3 or later)
764
-  #define NEWPANEL
765
-  #define ULTIPANEL
766
-#endif
767 675
 
768 676
 // Shift register panels
769 677
 // ---------------------
@@ -771,55 +679,12 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
771 679
 // https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection 
772 680
 
773 681
 //#define SAV_3DLCD
774
-#ifdef SAV_3DLCD
775
-   #define SR_LCD_2W_NL    // Non latching 2 wire shiftregister
776
-   #define NEWPANEL
777
-   #define ULTIPANEL
778
-#endif
779
-
780
-
781
-#ifdef ULTIPANEL
782
-//  #define NEWPANEL  //enable this if you have a click-encoder panel
783
-  #define SDSUPPORT
784
-  #define ULTRA_LCD
785
-  #ifdef DOGLCD // Change number of lines to match the DOG graphic display
786
-    #define LCD_WIDTH 22
787
-    #define LCD_HEIGHT 5
788
-  #else
789
-    #define LCD_WIDTH 20
790
-    #define LCD_HEIGHT 4
791
-  #endif
792
-#else //no panel but just LCD
793
-  #ifdef ULTRA_LCD
794
-  #ifdef DOGLCD // Change number of lines to match the 128x64 graphics display
795
-    #define LCD_WIDTH 22
796
-    #define LCD_HEIGHT 5
797
-  #else
798
-    #define LCD_WIDTH 16
799
-    #define LCD_HEIGHT 2
800
-  #endif
801
-  #endif
802
-#endif
803
-
804
-// @section lcd
805
-
806
-// default LCD contrast for dogm-like LCD displays
807
-#ifdef DOGLCD
808
-# ifndef DEFAULT_LCD_CONTRAST
809
-#  define DEFAULT_LCD_CONTRAST 32
810
-# endif
811
-#endif
812 682
 
813 683
 // @section extras
814 684
 
815 685
 // Increase the FAN pwm frequency. Removes the PWM noise but increases heating in the FET/Arduino
816 686
 //#define FAST_PWM_FAN
817 687
 
818
-// Temperature status LEDs that display the hotend and bet temperature.
819
-// If all hotends and bed temperature and temperature setpoint are < 54C then the BLUE led is on.
820
-// Otherwise the RED led is on. There is 1C hysteresis.
821
-//#define TEMP_STAT_LEDS
822
-
823 688
 // Use software PWM to drive the fan, as for the heaters. This uses a very low frequency
824 689
 // which is not ass annoying as with the hardware PWM. On the other hand, if this frequency
825 690
 // is too low, you should also increment SOFT_PWM_SCALE.
@@ -831,6 +696,11 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
831 696
 // at zero value, there are 128 effective control positions.
832 697
 #define SOFT_PWM_SCALE 0
833 698
 
699
+// Temperature status LEDs that display the hotend and bet temperature.
700
+// If all hotends and bed temperature and temperature setpoint are < 54C then the BLUE led is on.
701
+// Otherwise the RED led is on. There is 1C hysteresis.
702
+//#define TEMP_STAT_LEDS
703
+
834 704
 // M240  Triggers a camera by emulating a Canon RC-1 Remote
835 705
 // Data from: http://www.doc-diy.net/photo/rc-1_hacked/
836 706
 // #define PHOTOGRAPH_PIN     23
@@ -902,4 +772,4 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
902 772
 #include "Configuration_adv.h"
903 773
 #include "thermistortables.h"
904 774
 
905
-#endif //__CONFIGURATION_H
775
+#endif //CONFIGURATION_H

+ 10
- 211
Marlin/configurator/config/Configuration_adv.h View File

@@ -1,6 +1,8 @@
1 1
 #ifndef CONFIGURATION_ADV_H
2 2
 #define CONFIGURATION_ADV_H
3 3
 
4
+#include "Conditionals.h"
5
+
4 6
 // @section temperature
5 7
 
6 8
 //===========================================================================
@@ -99,56 +101,6 @@
99 101
 
100 102
 #define ENDSTOPS_ONLY_FOR_HOMING // If defined the endstops will only be used for homing
101 103
 
102
-
103
-// @section hidden
104
-
105
-
106
-//// AUTOSET LOCATIONS OF LIMIT SWITCHES
107
-//// Added by ZetaPhoenix 09-15-2012
108
-#ifdef MANUAL_HOME_POSITIONS  // Use manual limit switch locations
109
-  #define X_HOME_POS MANUAL_X_HOME_POS
110
-  #define Y_HOME_POS MANUAL_Y_HOME_POS
111
-  #define Z_HOME_POS MANUAL_Z_HOME_POS
112
-#else //Set min/max homing switch positions based upon homing direction and min/max travel limits
113
-  //X axis
114
-  #if X_HOME_DIR == -1
115
-    #ifdef BED_CENTER_AT_0_0
116
-      #define X_HOME_POS X_MAX_LENGTH * -0.5
117
-    #else
118
-      #define X_HOME_POS X_MIN_POS
119
-    #endif //BED_CENTER_AT_0_0
120
-  #else
121
-    #ifdef BED_CENTER_AT_0_0
122
-      #define X_HOME_POS X_MAX_LENGTH * 0.5
123
-    #else
124
-      #define X_HOME_POS X_MAX_POS
125
-    #endif //BED_CENTER_AT_0_0
126
-  #endif //X_HOME_DIR == -1
127
-
128
-  //Y axis
129
-  #if Y_HOME_DIR == -1
130
-    #ifdef BED_CENTER_AT_0_0
131
-      #define Y_HOME_POS Y_MAX_LENGTH * -0.5
132
-    #else
133
-      #define Y_HOME_POS Y_MIN_POS
134
-    #endif //BED_CENTER_AT_0_0
135
-  #else
136
-    #ifdef BED_CENTER_AT_0_0
137
-      #define Y_HOME_POS Y_MAX_LENGTH * 0.5
138
-    #else
139
-      #define Y_HOME_POS Y_MAX_POS
140
-    #endif //BED_CENTER_AT_0_0
141
-  #endif //Y_HOME_DIR == -1
142
-
143
-  // Z axis
144
-  #if Z_HOME_DIR == -1 //BED_CENTER_AT_0_0 not used
145
-    #define Z_HOME_POS Z_MIN_POS
146
-  #else
147
-    #define Z_HOME_POS Z_MAX_POS
148
-  #endif //Z_HOME_DIR == -1
149
-#endif //End auto min/max positions
150
-//END AUTOSET LOCATIONS OF LIMIT SWITCHES -ZP
151
-
152 104
 // @section extras
153 105
 
154 106
 //#define Z_LATE_ENABLE // Enable Z the last moment. Needed if your Z driver overheats.
@@ -160,26 +112,12 @@
160 112
 // On a RAMPS (or other 5 driver) motherboard, using this feature will limit you to using 1 extruder.
161 113
 //#define Z_DUAL_STEPPER_DRIVERS
162 114
 
163
-#ifdef Z_DUAL_STEPPER_DRIVERS
164
-  #undef EXTRUDERS
165
-  #define EXTRUDERS 1
166
-#endif
167
-
168 115
 // Same again but for Y Axis.
169 116
 //#define Y_DUAL_STEPPER_DRIVERS
170 117
 
171 118
 // Define if the two Y drives need to rotate in opposite directions
172 119
 #define INVERT_Y2_VS_Y_DIR true
173 120
 
174
-#ifdef Y_DUAL_STEPPER_DRIVERS
175
-  #undef EXTRUDERS
176
-  #define EXTRUDERS 1
177
-#endif
178
-
179
-#if defined (Z_DUAL_STEPPER_DRIVERS) && defined (Y_DUAL_STEPPER_DRIVERS)
180
-  #error "You cannot have dual drivers for both Y and Z"
181
-#endif
182
-
183 121
 // Enable this for dual x-carriage printers.
184 122
 // A dual x-carriage design has the advantage that the inactive extruder can be parked which
185 123
 // prevents hot-end ooze contaminating the print. It also reduces the weight of each x-carriage
@@ -236,14 +174,6 @@
236 174
 
237 175
 #define AXIS_RELATIVE_MODES {false, false, false, false}
238 176
 
239
-// @section hidden
240
-
241
-#ifdef CONFIG_STEPPERS_TOSHIBA
242
-  #define MAX_STEP_FREQUENCY 10000 // Max step frequency for Toshiba Stepper Controllers
243
-#else
244
-  #define MAX_STEP_FREQUENCY 40000 // Max step frequency for Ultimaker (5000 pps / half step)
245
-#endif
246
-
247 177
 // @section machine
248 178
 
249 179
 //By default pololu step drivers require an active high signal. However, some high power drivers require an active low signal as step.
@@ -252,7 +182,7 @@
252 182
 #define INVERT_Z_STEP_PIN false
253 183
 #define INVERT_E_STEP_PIN false
254 184
 
255
-//default stepper release if idle. Set to 0 to deactivate.
185
+// Default stepper release if idle. Set to 0 to deactivate.
256 186
 #define DEFAULT_STEPPER_DEACTIVE_TIME 60
257 187
 
258 188
 #define DEFAULT_MINIMUMFEEDRATE       0.0     // minimum feedrate
@@ -260,14 +190,9 @@
260 190
 
261 191
 // @section lcd
262 192
 
263
-// Feedrates for manual moves along X, Y, Z, E from panel
264 193
 #ifdef ULTIPANEL
265
-#define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60}  // set the speeds for manual moves (mm/min)
266
-#endif
267
-
268
-//Comment to disable setting feedrate multiplier via encoder
269
-#ifdef ULTIPANEL
270
-    #define ULTIPANEL_FEEDMULTIPLY
194
+  #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel
195
+  #define ULTIPANEL_FEEDMULTIPLY  // Comment to disable setting feedrate multiplier via encoder
271 196
 #endif
272 197
 
273 198
 // @section extras
@@ -288,13 +213,6 @@
288 213
 // if unwanted behavior is observed on a user's machine when running at very slow speeds.
289 214
 #define MINIMUM_PLANNER_SPEED 0.05// (mm/sec)
290 215
 
291
-// MS1 MS2 Stepper Driver Microstepping mode table
292
-#define MICROSTEP1 LOW,LOW
293
-#define MICROSTEP2 HIGH,LOW
294
-#define MICROSTEP4 LOW,HIGH
295
-#define MICROSTEP8 HIGH,HIGH
296
-#define MICROSTEP16 HIGH,HIGH
297
-
298 216
 // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU.
299 217
 #define MICROSTEP_MODES {16,16,16,16,16} // [1,2,4,8,16]
300 218
 
@@ -342,12 +260,6 @@
342 260
   #define PROGRESS_MSG_EXPIRE   0
343 261
   // Enable this to show messages for MSG_TIME then hide them
344 262
   //#define PROGRESS_MSG_ONCE
345
-  #ifdef DOGLCD
346
-    #warning LCD_PROGRESS_BAR does not apply to graphical displays at this time.
347
-  #endif
348
-  #ifdef FILAMENT_LCD_DISPLAY
349
-    #error LCD_PROGRESS_BAR and FILAMENT_LCD_DISPLAY are not fully compatible. Comment out this line to use both.
350
-  #endif
351 263
 #endif
352 264
 
353 265
 // @section more
@@ -373,16 +285,6 @@
373 285
   #define BABYSTEP_XY  //not only z, but also XY in the menu. more clutter, more functions
374 286
   #define BABYSTEP_INVERT_Z false  //true for inverse movements in Z
375 287
   #define BABYSTEP_Z_MULTIPLICATOR 2 //faster z movements
376
-
377
-  #ifdef COREXY
378
-    #error BABYSTEPPING not implemented for COREXY yet.
379
-  #endif
380
-
381
-  #ifdef DELTA
382
-    #ifdef BABYSTEP_XY
383
-      #error BABYSTEPPING only implemented for Z axis on deltabots.
384
-    #endif
385
-  #endif
386 288
 #endif
387 289
 
388 290
 // extruder advance constant (s2/mm3)
@@ -418,28 +320,6 @@ const unsigned int dropsegments=5; //everything with less than this number of st
418 320
 // be commented out otherwise
419 321
 #define SDCARDDETECTINVERTED
420 322
 
421
-// @section hidden
422
-
423
-#ifdef ULTIPANEL
424
- #undef SDCARDDETECTINVERTED
425
-#endif
426
-
427
-// Power Signal Control Definitions
428
-// By default use ATX definition
429
-#ifndef POWER_SUPPLY
430
-  #define POWER_SUPPLY 1
431
-#endif
432
-// 1 = ATX
433
-#if (POWER_SUPPLY == 1)
434
-  #define PS_ON_AWAKE  LOW
435
-  #define PS_ON_ASLEEP HIGH
436
-#endif
437
-// 2 = X-Box 360 203W
438
-#if (POWER_SUPPLY == 2)
439
-  #define PS_ON_AWAKE  HIGH
440
-  #define PS_ON_ASLEEP LOW
441
-#endif
442
-
443 323
 // @section temperature
444 324
 
445 325
 // Control heater 0 and heater 1 in parallel.
@@ -485,9 +365,9 @@ const unsigned int dropsegments=5; //everything with less than this number of st
485 365
   #define RETRACT_RECOVER_FEEDRATE 8     //default feedrate for recovering from retraction (mm/s)
486 366
 #endif
487 367
 
488
-//adds support for experimental filament exchange support M600; requires display
368
+// Add support for experimental filament exchange support M600; requires display
489 369
 #ifdef ULTIPANEL
490
-  #define FILAMENTCHANGEENABLE
370
+  //#define FILAMENTCHANGEENABLE
491 371
   #ifdef FILAMENTCHANGEENABLE
492 372
     #define FILAMENTCHANGE_XPOS 3
493 373
     #define FILAMENTCHANGE_YPOS 3
@@ -497,88 +377,7 @@ const unsigned int dropsegments=5; //everything with less than this number of st
497 377
   #endif
498 378
 #endif
499 379
 
500
-#ifdef FILAMENTCHANGEENABLE
501
-  #ifdef EXTRUDER_RUNOUT_PREVENT
502
-    #error EXTRUDER_RUNOUT_PREVENT currently incompatible with FILAMENTCHANGE
503
-  #endif
504
-#endif
505
-
506
-//===========================================================================
507
-//=============================  Define Defines  ============================
508
-//===========================================================================
509
-
510
-// @section hidden
511
-
512
-#if defined (ENABLE_AUTO_BED_LEVELING) && defined (DELTA)
513
-  #error "Bed Auto Leveling is still not compatible with Delta Kinematics."
514
-#endif
515
-
516
-#if EXTRUDERS > 1 && defined TEMP_SENSOR_1_AS_REDUNDANT
517
-  #error "You cannot use TEMP_SENSOR_1_AS_REDUNDANT if EXTRUDERS > 1"
518
-#endif
519
-
520
-#if EXTRUDERS > 1 && defined HEATERS_PARALLEL
521
-  #error "You cannot use HEATERS_PARALLEL if EXTRUDERS > 1"
522
-#endif
523
-
524
-#if TEMP_SENSOR_0 > 0
525
-  #define THERMISTORHEATER_0 TEMP_SENSOR_0
526
-  #define HEATER_0_USES_THERMISTOR
527
-#endif
528
-#if TEMP_SENSOR_1 > 0
529
-  #define THERMISTORHEATER_1 TEMP_SENSOR_1
530
-  #define HEATER_1_USES_THERMISTOR
531
-#endif
532
-#if TEMP_SENSOR_2 > 0
533
-  #define THERMISTORHEATER_2 TEMP_SENSOR_2
534
-  #define HEATER_2_USES_THERMISTOR
535
-#endif
536
-#if TEMP_SENSOR_3 > 0
537
-  #define THERMISTORHEATER_3 TEMP_SENSOR_3
538
-  #define HEATER_3_USES_THERMISTOR
539
-#endif
540
-#if TEMP_SENSOR_BED > 0
541
-  #define THERMISTORBED TEMP_SENSOR_BED
542
-  #define BED_USES_THERMISTOR
543
-#endif
544
-#if TEMP_SENSOR_0 == -1
545
-  #define HEATER_0_USES_AD595
546
-#endif
547
-#if TEMP_SENSOR_1 == -1
548
-  #define HEATER_1_USES_AD595
549
-#endif
550
-#if TEMP_SENSOR_2 == -1
551
-  #define HEATER_2_USES_AD595
552
-#endif
553
-#if TEMP_SENSOR_3 == -1
554
-  #define HEATER_3_USES_AD595
555
-#endif
556
-#if TEMP_SENSOR_BED == -1
557
-  #define BED_USES_AD595
558
-#endif
559
-#if TEMP_SENSOR_0 == -2
560
-  #define HEATER_0_USES_MAX6675
561
-#endif
562
-#if TEMP_SENSOR_0 == 0
563
-  #undef HEATER_0_MINTEMP
564
-  #undef HEATER_0_MAXTEMP
565
-#endif
566
-#if TEMP_SENSOR_1 == 0
567
-  #undef HEATER_1_MINTEMP
568
-  #undef HEATER_1_MAXTEMP
569
-#endif
570
-#if TEMP_SENSOR_2 == 0
571
-  #undef HEATER_2_MINTEMP
572
-  #undef HEATER_2_MAXTEMP
573
-#endif
574
-#if TEMP_SENSOR_3 == 0
575
-  #undef HEATER_3_MINTEMP
576
-  #undef HEATER_3_MAXTEMP
577
-#endif
578
-#if TEMP_SENSOR_BED == 0
579
-  #undef BED_MINTEMP
580
-  #undef BED_MAXTEMP
581
-#endif
582
-
380
+#include "Conditionals.h"
381
+#include "SanityCheck.h"
583 382
 
584
-#endif //__CONFIGURATION_ADV_H
383
+#endif //CONFIGURATION_ADV_H

+ 33
- 176
Marlin/example_configurations/Felix/Configuration.h View File

@@ -296,15 +296,6 @@ your extruder heater takes 2 minutes to hit the target on heating.
296 296
   // #define ENDSTOPPULLUP_ZMIN
297 297
 #endif
298 298
 
299
-#ifdef ENDSTOPPULLUPS
300
-  #define ENDSTOPPULLUP_XMAX
301
-  #define ENDSTOPPULLUP_YMAX
302
-  #define ENDSTOPPULLUP_ZMAX
303
-  #define ENDSTOPPULLUP_XMIN
304
-  #define ENDSTOPPULLUP_YMIN
305
-  #define ENDSTOPPULLUP_ZMIN
306
-#endif
307
-
308 299
 // The pullups are needed if you directly connect a mechanical endswitch between the signal and ground pins.
309 300
 const bool X_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
310 301
 const bool Y_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
@@ -353,10 +344,32 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
353 344
 #define Z_MAX_POS 235
354 345
 #define Z_MIN_POS 0
355 346
 
356
-#define X_MAX_LENGTH (X_MAX_POS - X_MIN_POS)
357
-#define Y_MAX_LENGTH (Y_MAX_POS - Y_MIN_POS)
358
-#define Z_MAX_LENGTH (Z_MAX_POS - Z_MIN_POS)
347
+//===========================================================================
348
+//============================= Filament Runout Sensor ======================
349
+//===========================================================================
350
+//#define FILAMENT_RUNOUT_SENSOR // Uncomment for defining a filament runout sensor such as a mechanical or opto endstop to check the existence of filament
351
+                                 // In RAMPS uses servo pin 2. Can be changed in pins file. For other boards pin definition should be made.
352
+                                 // It is assumed that when logic high = filament available
353
+                                 //                    when logic  low = filament ran out
354
+//const bool FIL_RUNOUT_INVERTING = true;  // Should be uncommented and true or false should assigned
355
+//#define ENDSTOPPULLUP_FIL_RUNOUT // Uncomment to use internal pullup for filament runout pins if the sensor is defined.
356
+
357
+//===========================================================================
358
+//============================ Manual Bed Leveling ==========================
359
+//===========================================================================
359 360
 
361
+// #define MANUAL_BED_LEVELING  // Add display menu option for bed leveling
362
+// #define MESH_BED_LEVELING    // Enable mesh bed leveling
363
+
364
+#if defined(MESH_BED_LEVELING)
365
+  #define MESH_MIN_X 10
366
+  #define MESH_MAX_X (X_MAX_POS - MESH_MIN_X)
367
+  #define MESH_MIN_Y 10
368
+  #define MESH_MAX_Y (Y_MAX_POS - MESH_MIN_Y)
369
+  #define MESH_NUM_X_POINTS 3  // Don't use more than 7 points per axis, implementation limited
370
+  #define MESH_NUM_Y_POINTS 3
371
+  #define MESH_HOME_SEARCH_Z 4  // Z after Home, bed somewhere below but above 0.0
372
+#endif  // MESH_BED_LEVELING
360 373
 
361 374
 //===========================================================================
362 375
 //============================= Bed Auto Leveling ===========================
@@ -386,12 +399,6 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
386 399
   // Note: this feature occupies 10'206 byte
387 400
   #ifdef AUTO_BED_LEVELING_GRID
388 401
 
389
-    // Use one of these defines to specify the origin
390
-    // for a topographical map to be printed for your bed.
391
-    enum { OriginBackLeft, OriginFrontLeft, OriginBackRight, OriginFrontRight };
392
-    #define TOPO_ORIGIN OriginFrontLeft
393
-
394
-    // set the rectangle in which to probe
395 402
     #define LEFT_PROBE_BED_POSITION 15
396 403
     #define RIGHT_PROBE_BED_POSITION 170
397 404
     #define BACK_PROBE_BED_POSITION 180
@@ -457,29 +464,6 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
457 464
 
458 465
   #endif
459 466
 
460
-  #ifdef AUTO_BED_LEVELING_GRID	// Check if Probe_Offset * Grid Points is greater than Probing Range
461
-    #if X_PROBE_OFFSET_FROM_EXTRUDER < 0
462
-      #if (-(X_PROBE_OFFSET_FROM_EXTRUDER * (AUTO_BED_LEVELING_GRID_POINTS-1)) >= (RIGHT_PROBE_BED_POSITION - LEFT_PROBE_BED_POSITION))
463
-	     #error "The X axis probing range is not enough to fit all the points defined in AUTO_BED_LEVELING_GRID_POINTS"
464
-	  #endif
465
-	#else
466
-      #if ((X_PROBE_OFFSET_FROM_EXTRUDER * (AUTO_BED_LEVELING_GRID_POINTS-1)) >= (RIGHT_PROBE_BED_POSITION - LEFT_PROBE_BED_POSITION))
467
-	     #error "The X axis probing range is not enough to fit all the points defined in AUTO_BED_LEVELING_GRID_POINTS"
468
-	  #endif
469
-	#endif
470
-    #if Y_PROBE_OFFSET_FROM_EXTRUDER < 0
471
-      #if (-(Y_PROBE_OFFSET_FROM_EXTRUDER * (AUTO_BED_LEVELING_GRID_POINTS-1)) >= (BACK_PROBE_BED_POSITION - FRONT_PROBE_BED_POSITION))
472
-	     #error "The Y axis probing range is not enough to fit all the points defined in AUTO_BED_LEVELING_GRID_POINTS"
473
-	  #endif
474
-	#else
475
-      #if ((Y_PROBE_OFFSET_FROM_EXTRUDER * (AUTO_BED_LEVELING_GRID_POINTS-1)) >= (BACK_PROBE_BED_POSITION - FRONT_PROBE_BED_POSITION))
476
-	     #error "The Y axis probing range is not enough to fit all the points defined in AUTO_BED_LEVELING_GRID_POINTS"
477
-	  #endif
478
-	#endif
479
-
480
-
481
-  #endif
482
-
483 467
 #endif // ENABLE_AUTO_BED_LEVELING
484 468
 
485 469
 
@@ -615,112 +599,17 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
615 599
 // REMEMBER TO INSTALL LiquidCrystal_I2C.h in your ARDUINO library folder: https://github.com/kiyoshigawa/LiquidCrystal_I2C
616 600
 //#define RA_CONTROL_PANEL
617 601
 
618
-//automatic expansion
619
-#if defined (MAKRPANEL)
620
- #define DOGLCD
621
- #define SDSUPPORT
622
- #define ULTIPANEL
623
- #define NEWPANEL
624
- #define DEFAULT_LCD_CONTRAST 17
625
-#endif
626
-
627
-#if defined(miniVIKI) || defined(VIKI2)
628
- #define ULTRA_LCD  //general LCD support, also 16x2
629
- #define DOGLCD  // Support for SPI LCD 128x64 (Controller ST7565R graphic Display Family)
630
- #define ULTIMAKERCONTROLLER //as available from the Ultimaker online store.
631
-
632
-  #ifdef miniVIKI
633
-   #define DEFAULT_LCD_CONTRAST 95
634
-  #else
635
-   #define DEFAULT_LCD_CONTRAST 40
636
-  #endif
637
-
638
- #define ENCODER_PULSES_PER_STEP 4
639
- #define ENCODER_STEPS_PER_MENU_ITEM 1
640
-#endif
641
-
642
-#if defined (PANEL_ONE)
643
- #define SDSUPPORT
644
- #define ULTIMAKERCONTROLLER
645
-#endif
646
-
647
-#if defined (REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER)
648
- #define DOGLCD
649
- #define U8GLIB_ST7920
650
- #define REPRAP_DISCOUNT_SMART_CONTROLLER
651
-#endif
652
-
653
-#if defined(ULTIMAKERCONTROLLER) || defined(REPRAP_DISCOUNT_SMART_CONTROLLER) || defined(G3D_PANEL)
654
- #define ULTIPANEL
655
- #define NEWPANEL
656
-#endif
657
-
658
-#if defined(REPRAPWORLD_KEYPAD)
659
-  #define NEWPANEL
660
-  #define ULTIPANEL
661
-#endif
662
-#if defined(RA_CONTROL_PANEL)
663
- #define ULTIPANEL
664
- #define NEWPANEL
665
- #define LCD_I2C_TYPE_PCA8574
666
- #define LCD_I2C_ADDRESS 0x27   // I2C Address of the port expander
667
-#endif
668
-
669
-//I2C PANELS
602
+/**
603
+ * I2C Panels
604
+ */
670 605
 
671 606
 //#define LCD_I2C_SAINSMART_YWROBOT
672
-#ifdef LCD_I2C_SAINSMART_YWROBOT
673
-  // This uses the LiquidCrystal_I2C library ( https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home )
674
-  // Make sure it is placed in the Arduino libraries directory.
675
-  #define LCD_I2C_TYPE_PCF8575
676
-  #define LCD_I2C_ADDRESS 0x27   // I2C Address of the port expander
677
-  #define NEWPANEL
678
-  #define ULTIPANEL
679
-#endif
680 607
 
681 608
 // PANELOLU2 LCD with status LEDs, separate encoder and click inputs
682 609
 //#define LCD_I2C_PANELOLU2
683
-#ifdef LCD_I2C_PANELOLU2
684
-  // This uses the LiquidTWI2 library v1.2.3 or later ( https://github.com/lincomatic/LiquidTWI2 )
685
-  // Make sure the LiquidTWI2 directory is placed in the Arduino or Sketchbook libraries subdirectory.
686
-  // (v1.2.3 no longer requires you to define PANELOLU in the LiquidTWI2.h library header file)
687
-  // Note: The PANELOLU2 encoder click input can either be directly connected to a pin
688
-  //       (if BTN_ENC defined to != -1) or read through I2C (when BTN_ENC == -1).
689
-  #define LCD_I2C_TYPE_MCP23017
690
-  #define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander
691
-  #define LCD_USE_I2C_BUZZER //comment out to disable buzzer on LCD
692
-  #define NEWPANEL
693
-  #define ULTIPANEL
694
-
695
-  #ifndef ENCODER_PULSES_PER_STEP
696
-	#define ENCODER_PULSES_PER_STEP 4
697
-  #endif
698
-
699
-  #ifndef ENCODER_STEPS_PER_MENU_ITEM
700
-	#define ENCODER_STEPS_PER_MENU_ITEM 1
701
-  #endif
702
-
703
-
704
-  #ifdef LCD_USE_I2C_BUZZER
705
-	#define LCD_FEEDBACK_FREQUENCY_HZ 1000
706
-	#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100
707
-  #endif
708
-
709
-#endif
710 610
 
711 611
 // Panucatt VIKI LCD with status LEDs, integrated click & L/R/U/P buttons, separate encoder inputs
712 612
 //#define LCD_I2C_VIKI
713
-#ifdef LCD_I2C_VIKI
714
-  // This uses the LiquidTWI2 library v1.2.3 or later ( https://github.com/lincomatic/LiquidTWI2 )
715
-  // Make sure the LiquidTWI2 directory is placed in the Arduino or Sketchbook libraries subdirectory.
716
-  // Note: The pause/stop/resume LCD button pin should be connected to the Arduino
717
-  //       BTN_ENC pin (or set BTN_ENC to -1 if not used)
718
-  #define LCD_I2C_TYPE_MCP23017
719
-  #define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander
720
-  #define LCD_USE_I2C_BUZZER //comment out to disable buzzer on LCD (requires LiquidTWI2 v1.2.3 or later)
721
-  #define NEWPANEL
722
-  #define ULTIPANEL
723
-#endif
724 613
 
725 614
 // Shift register panels
726 615
 // ---------------------
@@ -728,42 +617,6 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
728 617
 // https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection
729 618
 
730 619
 //#define SAV_3DLCD
731
-#ifdef SAV_3DLCD
732
-   #define SR_LCD_2W_NL    // Non latching 2 wire shiftregister
733
-   #define NEWPANEL
734
-   #define ULTIPANEL
735
-#endif
736
-
737
-
738
-#ifdef ULTIPANEL
739
-  #define NEWPANEL  //enable this if you have a click-encoder panel
740
-  #define SDSUPPORT
741
-  #define ULTRA_LCD
742
-  #ifdef DOGLCD // Change number of lines to match the DOG graphic display
743
-    #define LCD_WIDTH 22
744
-    #define LCD_HEIGHT 5
745
-  #else
746
-    #define LCD_WIDTH 20
747
-    #define LCD_HEIGHT 4
748
-  #endif
749
-#else //no panel but just LCD
750
-  #ifdef ULTRA_LCD
751
-  #ifdef DOGLCD // Change number of lines to match the 128x64 graphics display
752
-    #define LCD_WIDTH 22
753
-    #define LCD_HEIGHT 5
754
-  #else
755
-    #define LCD_WIDTH 16
756
-    #define LCD_HEIGHT 2
757
-  #endif
758
-  #endif
759
-#endif
760
-
761
-// default LCD contrast for dogm-like LCD displays
762
-#ifdef DOGLCD
763
-# ifndef DEFAULT_LCD_CONTRAST
764
-#  define DEFAULT_LCD_CONTRAST 32
765
-# endif
766
-#endif
767 620
 
768 621
 // Increase the FAN pwm frequency. Removes the PWM noise but increases heating in the FET/Arduino
769 622
 #define FAST_PWM_FAN
@@ -848,7 +701,11 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
848 701
 //#define FILAMENT_LCD_DISPLAY
849 702
 
850 703
 
704
+
705
+
706
+
707
+
851 708
 #include "Configuration_adv.h"
852 709
 #include "thermistortables.h"
853 710
 
854
-#endif //__CONFIGURATION_H
711
+#endif //CONFIGURATION_H

+ 33
- 175
Marlin/example_configurations/Felix/Configuration_DUAL.h View File

@@ -296,15 +296,6 @@ your extruder heater takes 2 minutes to hit the target on heating.
296 296
   // #define ENDSTOPPULLUP_ZMIN
297 297
 #endif
298 298
 
299
-#ifdef ENDSTOPPULLUPS
300
-  #define ENDSTOPPULLUP_XMAX
301
-  #define ENDSTOPPULLUP_YMAX
302
-  #define ENDSTOPPULLUP_ZMAX
303
-  #define ENDSTOPPULLUP_XMIN
304
-  #define ENDSTOPPULLUP_YMIN
305
-  #define ENDSTOPPULLUP_ZMIN
306
-#endif
307
-
308 299
 // The pullups are needed if you directly connect a mechanical endswitch between the signal and ground pins.
309 300
 const bool X_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
310 301
 const bool Y_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
@@ -353,10 +344,32 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
353 344
 #define Z_MAX_POS 235
354 345
 #define Z_MIN_POS 0
355 346
 
356
-#define X_MAX_LENGTH (X_MAX_POS - X_MIN_POS)
357
-#define Y_MAX_LENGTH (Y_MAX_POS - Y_MIN_POS)
358
-#define Z_MAX_LENGTH (Z_MAX_POS - Z_MIN_POS)
347
+//===========================================================================
348
+//============================= Filament Runout Sensor ======================
349
+//===========================================================================
350
+//#define FILAMENT_RUNOUT_SENSOR // Uncomment for defining a filament runout sensor such as a mechanical or opto endstop to check the existence of filament
351
+                                 // In RAMPS uses servo pin 2. Can be changed in pins file. For other boards pin definition should be made.
352
+                                 // It is assumed that when logic high = filament available
353
+                                 //                    when logic  low = filament ran out
354
+//const bool FIL_RUNOUT_INVERTING = true;  // Should be uncommented and true or false should assigned
355
+//#define ENDSTOPPULLUP_FIL_RUNOUT // Uncomment to use internal pullup for filament runout pins if the sensor is defined.
356
+
357
+//===========================================================================
358
+//============================ Manual Bed Leveling ==========================
359
+//===========================================================================
359 360
 
361
+// #define MANUAL_BED_LEVELING  // Add display menu option for bed leveling
362
+// #define MESH_BED_LEVELING    // Enable mesh bed leveling
363
+
364
+#if defined(MESH_BED_LEVELING)
365
+  #define MESH_MIN_X 10
366
+  #define MESH_MAX_X (X_MAX_POS - MESH_MIN_X)
367
+  #define MESH_MIN_Y 10
368
+  #define MESH_MAX_Y (Y_MAX_POS - MESH_MIN_Y)
369
+  #define MESH_NUM_X_POINTS 3  // Don't use more than 7 points per axis, implementation limited
370
+  #define MESH_NUM_Y_POINTS 3
371
+  #define MESH_HOME_SEARCH_Z 4  // Z after Home, bed somewhere below but above 0.0
372
+#endif  // MESH_BED_LEVELING
360 373
 
361 374
 //===========================================================================
362 375
 //============================= Bed Auto Leveling ===========================
@@ -386,12 +399,6 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
386 399
   // Note: this feature occupies 10'206 byte
387 400
   #ifdef AUTO_BED_LEVELING_GRID
388 401
 
389
-    // Use one of these defines to specify the origin
390
-    // for a topographical map to be printed for your bed.
391
-    enum { OriginBackLeft, OriginFrontLeft, OriginBackRight, OriginFrontRight };
392
-    #define TOPO_ORIGIN OriginFrontLeft
393
-
394
-    // set the rectangle in which to probe
395 402
     #define LEFT_PROBE_BED_POSITION 15
396 403
     #define RIGHT_PROBE_BED_POSITION 170
397 404
     #define BACK_PROBE_BED_POSITION 180
@@ -457,29 +464,6 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
457 464
 
458 465
   #endif
459 466
 
460
-  #ifdef AUTO_BED_LEVELING_GRID	// Check if Probe_Offset * Grid Points is greater than Probing Range
461
-    #if X_PROBE_OFFSET_FROM_EXTRUDER < 0
462
-      #if (-(X_PROBE_OFFSET_FROM_EXTRUDER * (AUTO_BED_LEVELING_GRID_POINTS-1)) >= (RIGHT_PROBE_BED_POSITION - LEFT_PROBE_BED_POSITION))
463
-	     #error "The X axis probing range is not enough to fit all the points defined in AUTO_BED_LEVELING_GRID_POINTS"
464
-	  #endif
465
-	#else
466
-      #if ((X_PROBE_OFFSET_FROM_EXTRUDER * (AUTO_BED_LEVELING_GRID_POINTS-1)) >= (RIGHT_PROBE_BED_POSITION - LEFT_PROBE_BED_POSITION))
467
-	     #error "The X axis probing range is not enough to fit all the points defined in AUTO_BED_LEVELING_GRID_POINTS"
468
-	  #endif
469
-	#endif
470
-    #if Y_PROBE_OFFSET_FROM_EXTRUDER < 0
471
-      #if (-(Y_PROBE_OFFSET_FROM_EXTRUDER * (AUTO_BED_LEVELING_GRID_POINTS-1)) >= (BACK_PROBE_BED_POSITION - FRONT_PROBE_BED_POSITION))
472
-	     #error "The Y axis probing range is not enough to fit all the points defined in AUTO_BED_LEVELING_GRID_POINTS"
473
-	  #endif
474
-	#else
475
-      #if ((Y_PROBE_OFFSET_FROM_EXTRUDER * (AUTO_BED_LEVELING_GRID_POINTS-1)) >= (BACK_PROBE_BED_POSITION - FRONT_PROBE_BED_POSITION))
476
-	     #error "The Y axis probing range is not enough to fit all the points defined in AUTO_BED_LEVELING_GRID_POINTS"
477
-	  #endif
478
-	#endif
479
-
480
-
481
-  #endif
482
-
483 467
 #endif // ENABLE_AUTO_BED_LEVELING
484 468
 
485 469
 
@@ -615,112 +599,17 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
615 599
 // REMEMBER TO INSTALL LiquidCrystal_I2C.h in your ARDUINO library folder: https://github.com/kiyoshigawa/LiquidCrystal_I2C
616 600
 //#define RA_CONTROL_PANEL
617 601
 
618
-//automatic expansion
619
-#if defined (MAKRPANEL)
620
- #define DOGLCD
621
- #define SDSUPPORT
622
- #define ULTIPANEL
623
- #define NEWPANEL
624
- #define DEFAULT_LCD_CONTRAST 17
625
-#endif
626
-
627
-#if defined(miniVIKI) || defined(VIKI2)
628
- #define ULTRA_LCD  //general LCD support, also 16x2
629
- #define DOGLCD  // Support for SPI LCD 128x64 (Controller ST7565R graphic Display Family)
630
- #define ULTIMAKERCONTROLLER //as available from the Ultimaker online store.
631
-
632
-  #ifdef miniVIKI
633
-   #define DEFAULT_LCD_CONTRAST 95
634
-  #else
635
-   #define DEFAULT_LCD_CONTRAST 40
636
-  #endif
637
-
638
- #define ENCODER_PULSES_PER_STEP 4
639
- #define ENCODER_STEPS_PER_MENU_ITEM 1
640
-#endif
641
-
642
-#if defined (PANEL_ONE)
643
- #define SDSUPPORT
644
- #define ULTIMAKERCONTROLLER
645
-#endif
646
-
647
-#if defined (REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER)
648
- #define DOGLCD
649
- #define U8GLIB_ST7920
650
- #define REPRAP_DISCOUNT_SMART_CONTROLLER
651
-#endif
652
-
653
-#if defined(ULTIMAKERCONTROLLER) || defined(REPRAP_DISCOUNT_SMART_CONTROLLER) || defined(G3D_PANEL)
654
- #define ULTIPANEL
655
- #define NEWPANEL
656
-#endif
657
-
658
-#if defined(REPRAPWORLD_KEYPAD)
659
-  #define NEWPANEL
660
-  #define ULTIPANEL
661
-#endif
662
-#if defined(RA_CONTROL_PANEL)
663
- #define ULTIPANEL
664
- #define NEWPANEL
665
- #define LCD_I2C_TYPE_PCA8574
666
- #define LCD_I2C_ADDRESS 0x27   // I2C Address of the port expander
667
-#endif
668
-
669
-//I2C PANELS
602
+/**
603
+ * I2C Panels
604
+ */
670 605
 
671 606
 //#define LCD_I2C_SAINSMART_YWROBOT
672
-#ifdef LCD_I2C_SAINSMART_YWROBOT
673
-  // This uses the LiquidCrystal_I2C library ( https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home )
674
-  // Make sure it is placed in the Arduino libraries directory.
675
-  #define LCD_I2C_TYPE_PCF8575
676
-  #define LCD_I2C_ADDRESS 0x27   // I2C Address of the port expander
677
-  #define NEWPANEL
678
-  #define ULTIPANEL
679
-#endif
680 607
 
681 608
 // PANELOLU2 LCD with status LEDs, separate encoder and click inputs
682 609
 //#define LCD_I2C_PANELOLU2
683
-#ifdef LCD_I2C_PANELOLU2
684
-  // This uses the LiquidTWI2 library v1.2.3 or later ( https://github.com/lincomatic/LiquidTWI2 )
685
-  // Make sure the LiquidTWI2 directory is placed in the Arduino or Sketchbook libraries subdirectory.
686
-  // (v1.2.3 no longer requires you to define PANELOLU in the LiquidTWI2.h library header file)
687
-  // Note: The PANELOLU2 encoder click input can either be directly connected to a pin
688
-  //       (if BTN_ENC defined to != -1) or read through I2C (when BTN_ENC == -1).
689
-  #define LCD_I2C_TYPE_MCP23017
690
-  #define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander
691
-  #define LCD_USE_I2C_BUZZER //comment out to disable buzzer on LCD
692
-  #define NEWPANEL
693
-  #define ULTIPANEL
694
-
695
-  #ifndef ENCODER_PULSES_PER_STEP
696
-	#define ENCODER_PULSES_PER_STEP 4
697
-  #endif
698
-
699
-  #ifndef ENCODER_STEPS_PER_MENU_ITEM
700
-	#define ENCODER_STEPS_PER_MENU_ITEM 1
701
-  #endif
702
-
703
-
704
-  #ifdef LCD_USE_I2C_BUZZER
705
-	#define LCD_FEEDBACK_FREQUENCY_HZ 1000
706
-	#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100
707
-  #endif
708
-
709
-#endif
710 610
 
711 611
 // Panucatt VIKI LCD with status LEDs, integrated click & L/R/U/P buttons, separate encoder inputs
712 612
 //#define LCD_I2C_VIKI
713
-#ifdef LCD_I2C_VIKI
714
-  // This uses the LiquidTWI2 library v1.2.3 or later ( https://github.com/lincomatic/LiquidTWI2 )
715
-  // Make sure the LiquidTWI2 directory is placed in the Arduino or Sketchbook libraries subdirectory.
716
-  // Note: The pause/stop/resume LCD button pin should be connected to the Arduino
717
-  //       BTN_ENC pin (or set BTN_ENC to -1 if not used)
718
-  #define LCD_I2C_TYPE_MCP23017
719
-  #define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander
720
-  #define LCD_USE_I2C_BUZZER //comment out to disable buzzer on LCD (requires LiquidTWI2 v1.2.3 or later)
721
-  #define NEWPANEL
722
-  #define ULTIPANEL
723
-#endif
724 613
 
725 614
 // Shift register panels
726 615
 // ---------------------
@@ -728,42 +617,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
728 617
 // https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection
729 618
 
730 619
 //#define SAV_3DLCD
731
-#ifdef SAV_3DLCD
732
-   #define SR_LCD_2W_NL    // Non latching 2 wire shiftregister
733
-   #define NEWPANEL
734
-   #define ULTIPANEL
735
-#endif
736
-
737
-
738
-#ifdef ULTIPANEL
739
-  #define NEWPANEL  //enable this if you have a click-encoder panel
740
-  #define SDSUPPORT
741
-  #define ULTRA_LCD
742
-  #ifdef DOGLCD // Change number of lines to match the DOG graphic display
743
-    #define LCD_WIDTH 22
744
-    #define LCD_HEIGHT 5
745
-  #else
746
-    #define LCD_WIDTH 20
747
-    #define LCD_HEIGHT 4
748
-  #endif
749
-#else //no panel but just LCD
750
-  #ifdef ULTRA_LCD
751
-  #ifdef DOGLCD // Change number of lines to match the 128x64 graphics display
752
-    #define LCD_WIDTH 22
753
-    #define LCD_HEIGHT 5
754
-  #else
755
-    #define LCD_WIDTH 16
756
-    #define LCD_HEIGHT 2
757
-  #endif
758
-  #endif
759
-#endif
760 620
 
761
-// default LCD contrast for dogm-like LCD displays
762
-#ifdef DOGLCD
763
-# ifndef DEFAULT_LCD_CONTRAST
764
-#  define DEFAULT_LCD_CONTRAST 32
765
-# endif
766
-#endif
767 621
 
768 622
 // Increase the FAN pwm frequency. Removes the PWM noise but increases heating in the FET/Arduino
769 623
 #define FAST_PWM_FAN
@@ -848,7 +702,11 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
848 702
 //#define FILAMENT_LCD_DISPLAY
849 703
 
850 704
 
705
+
706
+
707
+
708
+
851 709
 #include "Configuration_adv.h"
852 710
 #include "thermistortables.h"
853 711
 
854
-#endif //__CONFIGURATION_H
712
+#endif //CONFIGURATION_H

+ 11
- 186
Marlin/example_configurations/Felix/Configuration_adv.h View File

@@ -1,6 +1,8 @@
1 1
 #ifndef CONFIGURATION_ADV_H
2 2
 #define CONFIGURATION_ADV_H
3 3
 
4
+#include "Conditionals.h"
5
+
4 6
 //===========================================================================
5 7
 //=============================Thermal Settings  ============================
6 8
 //===========================================================================
@@ -89,54 +91,6 @@
89 91
 
90 92
 #define ENDSTOPS_ONLY_FOR_HOMING // If defined the endstops will only be used for homing
91 93
 
92
-
93
-//// AUTOSET LOCATIONS OF LIMIT SWITCHES
94
-//// Added by ZetaPhoenix 09-15-2012
95
-#ifdef MANUAL_HOME_POSITIONS  // Use manual limit switch locations
96
-  #define X_HOME_POS MANUAL_X_HOME_POS
97
-  #define Y_HOME_POS MANUAL_Y_HOME_POS
98
-  #define Z_HOME_POS MANUAL_Z_HOME_POS
99
-#else //Set min/max homing switch positions based upon homing direction and min/max travel limits
100
-  //X axis
101
-  #if X_HOME_DIR == -1
102
-    #ifdef BED_CENTER_AT_0_0
103
-      #define X_HOME_POS X_MAX_LENGTH * -0.5
104
-    #else
105
-      #define X_HOME_POS X_MIN_POS
106
-    #endif //BED_CENTER_AT_0_0
107
-  #else
108
-    #ifdef BED_CENTER_AT_0_0
109
-      #define X_HOME_POS X_MAX_LENGTH * 0.5
110
-    #else
111
-      #define X_HOME_POS X_MAX_POS
112
-    #endif //BED_CENTER_AT_0_0
113
-  #endif //X_HOME_DIR == -1
114
-
115
-  //Y axis
116
-  #if Y_HOME_DIR == -1
117
-    #ifdef BED_CENTER_AT_0_0
118
-      #define Y_HOME_POS Y_MAX_LENGTH * -0.5
119
-    #else
120
-      #define Y_HOME_POS Y_MIN_POS
121
-    #endif //BED_CENTER_AT_0_0
122
-  #else
123
-    #ifdef BED_CENTER_AT_0_0
124
-      #define Y_HOME_POS Y_MAX_LENGTH * 0.5
125
-    #else
126
-      #define Y_HOME_POS Y_MAX_POS
127
-    #endif //BED_CENTER_AT_0_0
128
-  #endif //Y_HOME_DIR == -1
129
-
130
-  // Z axis
131
-  #if Z_HOME_DIR == -1 //BED_CENTER_AT_0_0 not used
132
-    #define Z_HOME_POS Z_MIN_POS
133
-  #else
134
-    #define Z_HOME_POS Z_MAX_POS
135
-  #endif //Z_HOME_DIR == -1
136
-#endif //End auto min/max positions
137
-//END AUTOSET LOCATIONS OF LIMIT SWITCHES -ZP
138
-
139
-
140 94
 //#define Z_LATE_ENABLE // Enable Z the last moment. Needed if your Z driver overheats.
141 95
 
142 96
 // A single Z stepper driver is usually used to drive 2 stepper motors.
@@ -146,26 +100,12 @@
146 100
 // On a RAMPS (or other 5 driver) motherboard, using this feature will limit you to using 1 extruder.
147 101
 //#define Z_DUAL_STEPPER_DRIVERS
148 102
 
149
-#ifdef Z_DUAL_STEPPER_DRIVERS
150
-  #undef EXTRUDERS
151
-  #define EXTRUDERS 1
152
-#endif
153
-
154 103
 // Same again but for Y Axis.
155 104
 //#define Y_DUAL_STEPPER_DRIVERS
156 105
 
157 106
 // Define if the two Y drives need to rotate in opposite directions
158 107
 #define INVERT_Y2_VS_Y_DIR true
159 108
 
160
-#ifdef Y_DUAL_STEPPER_DRIVERS
161
-  #undef EXTRUDERS
162
-  #define EXTRUDERS 1
163
-#endif
164
-
165
-#if defined (Z_DUAL_STEPPER_DRIVERS) && defined (Y_DUAL_STEPPER_DRIVERS)
166
-  #error "You cannot have dual drivers for both Y and Z"
167
-#endif
168
-
169 109
 // Enable this for dual x-carriage printers.
170 110
 // A dual x-carriage design has the advantage that the inactive extruder can be parked which
171 111
 // prevents hot-end ooze contaminating the print. It also reduces the weight of each x-carriage
@@ -218,31 +158,22 @@
218 158
 //#define QUICK_HOME  //if this is defined, if both x and y are to be homed, a diagonal move will be performed initially.
219 159
 
220 160
 #define AXIS_RELATIVE_MODES {false, false, false, false}
221
-#ifdef CONFIG_STEPPERS_TOSHIBA
222
-#define MAX_STEP_FREQUENCY 10000 // Max step frequency for Toshiba Stepper Controllers
223
-#else
224
-#define MAX_STEP_FREQUENCY 40000 // Max step frequency for Ultimaker (5000 pps / half step)
225
-#endif
161
+
226 162
 //By default pololu step drivers require an active high signal. However, some high power drivers require an active low signal as step.
227 163
 #define INVERT_X_STEP_PIN false
228 164
 #define INVERT_Y_STEP_PIN false
229 165
 #define INVERT_Z_STEP_PIN false
230 166
 #define INVERT_E_STEP_PIN false
231 167
 
232
-//default stepper release if idle. Set to 0 to deactivate.
168
+// Default stepper release if idle. Set to 0 to deactivate.
233 169
 #define DEFAULT_STEPPER_DEACTIVE_TIME 60
234 170
 
235 171
 #define DEFAULT_MINIMUMFEEDRATE       0.0     // minimum feedrate
236 172
 #define DEFAULT_MINTRAVELFEEDRATE     0.0
237 173
 
238
-// Feedrates for manual moves along X, Y, Z, E from panel
239 174
 #ifdef ULTIPANEL
240
-#define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60}  // set the speeds for manual moves (mm/min)
241
-#endif
242
-
243
-//Comment to disable setting feedrate multiplier via encoder
244
-#ifdef ULTIPANEL
245
-    #define ULTIPANEL_FEEDMULTIPLY
175
+  #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel
176
+  #define ULTIPANEL_FEEDMULTIPLY  // Comment to disable setting feedrate multiplier via encoder
246 177
 #endif
247 178
 
248 179
 // minimum time in microseconds that a movement needs to take if the buffer is emptied.
@@ -261,13 +192,6 @@
261 192
 // if unwanted behavior is observed on a user's machine when running at very slow speeds.
262 193
 #define MINIMUM_PLANNER_SPEED 0.05// (mm/sec)
263 194
 
264
-// MS1 MS2 Stepper Driver Microstepping mode table
265
-#define MICROSTEP1 LOW,LOW
266
-#define MICROSTEP2 HIGH,LOW
267
-#define MICROSTEP4 LOW,HIGH
268
-#define MICROSTEP8 HIGH,HIGH
269
-#define MICROSTEP16 HIGH,HIGH
270
-
271 195
 // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU.
272 196
 #define MICROSTEP_MODES {16,16,16,16,16} // [1,2,4,8,16]
273 197
 
@@ -313,12 +237,6 @@
313 237
   #define PROGRESS_MSG_EXPIRE   0
314 238
   // Enable this to show messages for MSG_TIME then hide them
315 239
   //#define PROGRESS_MSG_ONCE
316
-  #ifdef DOGLCD
317
-    #warning LCD_PROGRESS_BAR does not apply to graphical displays at this time.
318
-  #endif
319
-  #ifdef FILAMENT_LCD_DISPLAY
320
-    #error LCD_PROGRESS_BAR and FILAMENT_LCD_DISPLAY are not fully compatible. Comment out this line to use both.
321
-  #endif
322 240
 #endif
323 241
 
324 242
 // The hardware watchdog should reset the microcontroller disabling all outputs, in case the firmware gets stuck and doesn't do temperature regulation.
@@ -342,16 +260,6 @@
342 260
   #define BABYSTEP_XY  //not only z, but also XY in the menu. more clutter, more functions
343 261
   #define BABYSTEP_INVERT_Z false  //true for inverse movements in Z
344 262
   #define BABYSTEP_Z_MULTIPLICATOR 2 //faster z movements
345
-
346
-  #ifdef COREXY
347
-    #error BABYSTEPPING not implemented for COREXY yet.
348
-  #endif
349
-
350
-  #ifdef DELTA
351
-    #ifdef BABYSTEP_XY
352
-      #error BABYSTEPPING only implemented for Z axis on deltabots.
353
-    #endif
354
-  #endif
355 263
 #endif
356 264
 
357 265
 // extruder advance constant (s2/mm3)
@@ -365,12 +273,8 @@
365 273
 
366 274
 #ifdef ADVANCE
367 275
   #define EXTRUDER_ADVANCE_K .0
368
-
369 276
   #define D_FILAMENT 2.85
370 277
   #define STEPS_MM_E 836
371
-  #define EXTRUSION_AREA (0.25 * D_FILAMENT * D_FILAMENT * 3.14159)
372
-  #define STEPS_PER_CUBIC_MM_E (axis_steps_per_unit[E_AXIS]/ EXTRUSION_AREA)
373
-
374 278
 #endif // ADVANCE
375 279
 
376 280
 // Arc interpretation settings:
@@ -444,9 +348,9 @@ const unsigned int dropsegments=5; //everything with less than this number of st
444 348
   #define RETRACT_RECOVER_FEEDRATE 8     //default feedrate for recovering from retraction (mm/s)
445 349
 #endif
446 350
 
447
-//adds support for experimental filament exchange support M600; requires display
351
+// Add support for experimental filament exchange support M600; requires display
448 352
 #ifdef ULTIPANEL
449
-  #define FILAMENTCHANGEENABLE
353
+  //#define FILAMENTCHANGEENABLE
450 354
   #ifdef FILAMENTCHANGEENABLE
451 355
     #define FILAMENTCHANGE_XPOS 3
452 356
     #define FILAMENTCHANGE_YPOS 3
@@ -456,86 +360,7 @@ const unsigned int dropsegments=5; //everything with less than this number of st
456 360
   #endif
457 361
 #endif
458 362
 
459
-#ifdef FILAMENTCHANGEENABLE
460
-  #ifdef EXTRUDER_RUNOUT_PREVENT
461
-    #error EXTRUDER_RUNOUT_PREVENT currently incompatible with FILAMENTCHANGE
462
-  #endif
463
-#endif
464
-
465
-//===========================================================================
466
-//=============================  Define Defines  ============================
467
-//===========================================================================
468
-
469
-#if defined (ENABLE_AUTO_BED_LEVELING) && defined (DELTA)
470
-  #error "Bed Auto Leveling is still not compatible with Delta Kinematics."
471
-#endif
472
-
473
-#if EXTRUDERS > 1 && defined TEMP_SENSOR_1_AS_REDUNDANT
474
-  #error "You cannot use TEMP_SENSOR_1_AS_REDUNDANT if EXTRUDERS > 1"
475
-#endif
476
-
477
-#if EXTRUDERS > 1 && defined HEATERS_PARALLEL
478
-  #error "You cannot use HEATERS_PARALLEL if EXTRUDERS > 1"
479
-#endif
480
-
481
-#if TEMP_SENSOR_0 > 0
482
-  #define THERMISTORHEATER_0 TEMP_SENSOR_0
483
-  #define HEATER_0_USES_THERMISTOR
484
-#endif
485
-#if TEMP_SENSOR_1 > 0
486
-  #define THERMISTORHEATER_1 TEMP_SENSOR_1
487
-  #define HEATER_1_USES_THERMISTOR
488
-#endif
489
-#if TEMP_SENSOR_2 > 0
490
-  #define THERMISTORHEATER_2 TEMP_SENSOR_2
491
-  #define HEATER_2_USES_THERMISTOR
492
-#endif
493
-#if TEMP_SENSOR_3 > 0
494
-  #define THERMISTORHEATER_3 TEMP_SENSOR_3
495
-  #define HEATER_3_USES_THERMISTOR
496
-#endif
497
-#if TEMP_SENSOR_BED > 0
498
-  #define THERMISTORBED TEMP_SENSOR_BED
499
-  #define BED_USES_THERMISTOR
500
-#endif
501
-#if TEMP_SENSOR_0 == -1
502
-  #define HEATER_0_USES_AD595
503
-#endif
504
-#if TEMP_SENSOR_1 == -1
505
-  #define HEATER_1_USES_AD595
506
-#endif
507
-#if TEMP_SENSOR_2 == -1
508
-  #define HEATER_2_USES_AD595
509
-#endif
510
-#if TEMP_SENSOR_3 == -1
511
-  #define HEATER_3_USES_AD595
512
-#endif
513
-#if TEMP_SENSOR_BED == -1
514
-  #define BED_USES_AD595
515
-#endif
516
-#if TEMP_SENSOR_0 == -2
517
-  #define HEATER_0_USES_MAX6675
518
-#endif
519
-#if TEMP_SENSOR_0 == 0
520
-  #undef HEATER_0_MINTEMP
521
-  #undef HEATER_0_MAXTEMP
522
-#endif
523
-#if TEMP_SENSOR_1 == 0
524
-  #undef HEATER_1_MINTEMP
525
-  #undef HEATER_1_MAXTEMP
526
-#endif
527
-#if TEMP_SENSOR_2 == 0
528
-  #undef HEATER_2_MINTEMP
529
-  #undef HEATER_2_MAXTEMP
530
-#endif
531
-#if TEMP_SENSOR_3 == 0
532
-  #undef HEATER_3_MINTEMP
533
-  #undef HEATER_3_MAXTEMP
534
-#endif
535
-#if TEMP_SENSOR_BED == 0
536
-  #undef BED_MINTEMP
537
-  #undef BED_MAXTEMP
538
-#endif
539
-
363
+#include "Conditionals.h"
364
+#include "SanityCheck.h"
540 365
 
541
-#endif //__CONFIGURATION_ADV_H
366
+#endif //CONFIGURATION_ADV_H

+ 34
- 158
Marlin/example_configurations/Hephestos/Configuration.h View File

@@ -322,15 +322,6 @@ your extruder heater takes 2 minutes to hit the target on heating.
322 322
   // #define ENDSTOPPULLUP_ZMIN
323 323
 #endif
324 324
 
325
-#ifdef ENDSTOPPULLUPS
326
-  #define ENDSTOPPULLUP_XMAX
327
-  #define ENDSTOPPULLUP_YMAX
328
-  #define ENDSTOPPULLUP_ZMAX
329
-  #define ENDSTOPPULLUP_XMIN
330
-  #define ENDSTOPPULLUP_YMIN
331
-  #define ENDSTOPPULLUP_ZMIN
332
-#endif
333
-
334 325
 // The pullups are needed if you directly connect a mechanical endswitch between the signal and ground pins.
335 326
 const bool X_MIN_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop.
336 327
 const bool Y_MIN_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop.
@@ -379,10 +370,32 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
379 370
 #define Z_MAX_POS 180
380 371
 #define Z_MIN_POS 0
381 372
 
382
-#define X_MAX_LENGTH (X_MAX_POS - X_MIN_POS)
383
-#define Y_MAX_LENGTH (Y_MAX_POS - Y_MIN_POS)
384
-#define Z_MAX_LENGTH (Z_MAX_POS - Z_MIN_POS)
373
+//===========================================================================
374
+//============================= Filament Runout Sensor ======================
375
+//===========================================================================
376
+//#define FILAMENT_RUNOUT_SENSOR // Uncomment for defining a filament runout sensor such as a mechanical or opto endstop to check the existence of filament
377
+                                 // In RAMPS uses servo pin 2. Can be changed in pins file. For other boards pin definition should be made.
378
+                                 // It is assumed that when logic high = filament available
379
+                                 //                    when logic  low = filament ran out
380
+//const bool FIL_RUNOUT_INVERTING = true;  // Should be uncommented and true or false should assigned
381
+//#define ENDSTOPPULLUP_FIL_RUNOUT // Uncomment to use internal pullup for filament runout pins if the sensor is defined.
382
+
383
+//===========================================================================
384
+//============================ Manual Bed Leveling ==========================
385
+//===========================================================================
385 386
 
387
+// #define MANUAL_BED_LEVELING  // Add display menu option for bed leveling
388
+// #define MESH_BED_LEVELING    // Enable mesh bed leveling
389
+
390
+#if defined(MESH_BED_LEVELING)
391
+  #define MESH_MIN_X 10
392
+  #define MESH_MAX_X (X_MAX_POS - MESH_MIN_X)
393
+  #define MESH_MIN_Y 10
394
+  #define MESH_MAX_Y (Y_MAX_POS - MESH_MIN_Y)
395
+  #define MESH_NUM_X_POINTS 3  // Don't use more than 7 points per axis, implementation limited
396
+  #define MESH_NUM_Y_POINTS 3
397
+  #define MESH_HOME_SEARCH_Z 4  // Z after Home, bed somewhere below but above 0.0
398
+#endif  // MESH_BED_LEVELING
386 399
 
387 400
 //===========================================================================
388 401
 //============================= Bed Auto Leveling ===========================
@@ -410,12 +423,6 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
410 423
 
411 424
   #ifdef AUTO_BED_LEVELING_GRID
412 425
 
413
-    // Use one of these defines to specify the origin
414
-    // for a topographical map to be printed for your bed.
415
-    enum { OriginBackLeft, OriginFrontLeft, OriginBackRight, OriginFrontRight };
416
-    #define TOPO_ORIGIN OriginFrontLeft
417
-
418
-    // The edges of the rectangle in which to probe
419 426
     #define LEFT_PROBE_BED_POSITION 15
420 427
     #define RIGHT_PROBE_BED_POSITION 170
421 428
     #define FRONT_PROBE_BED_POSITION 20
@@ -620,112 +627,17 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
620 627
 // REMEMBER TO INSTALL LiquidCrystal_I2C.h in your ARDUINO library folder: https://github.com/kiyoshigawa/LiquidCrystal_I2C
621 628
 //#define RA_CONTROL_PANEL
622 629
 
623
-//automatic expansion
624
-#if defined (MAKRPANEL)
625
- #define DOGLCD
626
- #define SDSUPPORT
627
- #define ULTIPANEL
628
- #define NEWPANEL
629
- #define DEFAULT_LCD_CONTRAST 17
630
-#endif
631
-
632
-#if defined(miniVIKI) || defined(VIKI2)
633
- #define ULTRA_LCD  //general LCD support, also 16x2
634
- #define DOGLCD  // Support for SPI LCD 128x64 (Controller ST7565R graphic Display Family)
635
- #define ULTIMAKERCONTROLLER //as available from the Ultimaker online store.
636
- 
637
-  #ifdef miniVIKI
638
-   #define DEFAULT_LCD_CONTRAST 95
639
-  #else
640
-   #define DEFAULT_LCD_CONTRAST 40
641
-  #endif
642
-  
643
- #define ENCODER_PULSES_PER_STEP 4
644
- #define ENCODER_STEPS_PER_MENU_ITEM 1
645
-#endif
646
-
647
-#if defined (PANEL_ONE)
648
- #define SDSUPPORT
649
- #define ULTIMAKERCONTROLLER
650
-#endif
651
-
652
-#if defined (REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER)
653
- #define DOGLCD
654
- #define U8GLIB_ST7920
655
- #define REPRAP_DISCOUNT_SMART_CONTROLLER
656
-#endif
657
-
658
-#if defined(ULTIMAKERCONTROLLER) || defined(REPRAP_DISCOUNT_SMART_CONTROLLER) || defined(G3D_PANEL)
659
- #define ULTIPANEL
660
- #define NEWPANEL
661
-#endif
662
-
663
-#if defined(REPRAPWORLD_KEYPAD)
664
-  #define NEWPANEL
665
-  #define ULTIPANEL
666
-#endif
667
-#if defined(RA_CONTROL_PANEL)
668
- #define ULTIPANEL
669
- #define NEWPANEL
670
- #define LCD_I2C_TYPE_PCA8574
671
- #define LCD_I2C_ADDRESS 0x27   // I2C Address of the port expander
672
-#endif
673
-
674
-//I2C PANELS
630
+/**
631
+ * I2C Panels
632
+ */
675 633
 
676 634
 //#define LCD_I2C_SAINSMART_YWROBOT
677
-#ifdef LCD_I2C_SAINSMART_YWROBOT
678
-  // This uses the LiquidCrystal_I2C library ( https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home )
679
-  // Make sure it is placed in the Arduino libraries directory.
680
-  #define LCD_I2C_TYPE_PCF8575
681
-  #define LCD_I2C_ADDRESS 0x27   // I2C Address of the port expander
682
-  #define NEWPANEL
683
-  #define ULTIPANEL
684
-#endif
685 635
 
686 636
 // PANELOLU2 LCD with status LEDs, separate encoder and click inputs
687 637
 //#define LCD_I2C_PANELOLU2
688
-#ifdef LCD_I2C_PANELOLU2
689
-  // This uses the LiquidTWI2 library v1.2.3 or later ( https://github.com/lincomatic/LiquidTWI2 )
690
-  // Make sure the LiquidTWI2 directory is placed in the Arduino or Sketchbook libraries subdirectory.
691
-  // (v1.2.3 no longer requires you to define PANELOLU in the LiquidTWI2.h library header file)
692
-  // Note: The PANELOLU2 encoder click input can either be directly connected to a pin
693
-  //       (if BTN_ENC defined to != -1) or read through I2C (when BTN_ENC == -1).
694
-  #define LCD_I2C_TYPE_MCP23017
695
-  #define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander
696
-  #define LCD_USE_I2C_BUZZER //comment out to disable buzzer on LCD
697
-  #define NEWPANEL
698
-  #define ULTIPANEL
699
-
700
-  #ifndef ENCODER_PULSES_PER_STEP
701
-	#define ENCODER_PULSES_PER_STEP 4
702
-  #endif
703
-
704
-  #ifndef ENCODER_STEPS_PER_MENU_ITEM
705
-	#define ENCODER_STEPS_PER_MENU_ITEM 1
706
-  #endif
707
-
708
-
709
-  #ifdef LCD_USE_I2C_BUZZER
710
-	#define LCD_FEEDBACK_FREQUENCY_HZ 1000
711
-	#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100
712
-  #endif
713
-
714
-#endif
715 638
 
716 639
 // Panucatt VIKI LCD with status LEDs, integrated click & L/R/U/P buttons, separate encoder inputs
717 640
 //#define LCD_I2C_VIKI
718
-#ifdef LCD_I2C_VIKI
719
-  // This uses the LiquidTWI2 library v1.2.3 or later ( https://github.com/lincomatic/LiquidTWI2 )
720
-  // Make sure the LiquidTWI2 directory is placed in the Arduino or Sketchbook libraries subdirectory.
721
-  // Note: The pause/stop/resume LCD button pin should be connected to the Arduino
722
-  //       BTN_ENC pin (or set BTN_ENC to -1 if not used)
723
-  #define LCD_I2C_TYPE_MCP23017
724
-  #define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander
725
-  #define LCD_USE_I2C_BUZZER //comment out to disable buzzer on LCD (requires LiquidTWI2 v1.2.3 or later)
726
-  #define NEWPANEL
727
-  #define ULTIPANEL
728
-#endif
729 641
 
730 642
 // Shift register panels
731 643
 // ---------------------
@@ -733,51 +645,10 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
733 645
 // https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection 
734 646
 
735 647
 //#define SAV_3DLCD
736
-#ifdef SAV_3DLCD
737
-   #define SR_LCD_2W_NL    // Non latching 2 wire shiftregister
738
-   #define NEWPANEL
739
-   #define ULTIPANEL
740
-#endif
741
-
742
-
743
-#ifdef ULTIPANEL
744
-//  #define NEWPANEL  //enable this if you have a click-encoder panel
745
-  #define SDSUPPORT
746
-  #define ULTRA_LCD
747
-  #ifdef DOGLCD // Change number of lines to match the DOG graphic display
748
-    #define LCD_WIDTH 22
749
-    #define LCD_HEIGHT 5
750
-  #else
751
-    #define LCD_WIDTH 20
752
-    #define LCD_HEIGHT 4
753
-  #endif
754
-#else //no panel but just LCD
755
-  #ifdef ULTRA_LCD
756
-  #ifdef DOGLCD // Change number of lines to match the 128x64 graphics display
757
-    #define LCD_WIDTH 22
758
-    #define LCD_HEIGHT 5
759
-  #else
760
-    #define LCD_WIDTH 16
761
-    #define LCD_HEIGHT 2
762
-  #endif
763
-  #endif
764
-#endif
765
-
766
-// default LCD contrast for dogm-like LCD displays
767
-#ifdef DOGLCD
768
-# ifndef DEFAULT_LCD_CONTRAST
769
-#  define DEFAULT_LCD_CONTRAST 32
770
-# endif
771
-#endif
772 648
 
773 649
 // Increase the FAN pwm frequency. Removes the PWM noise but increases heating in the FET/Arduino
774 650
 //#define FAST_PWM_FAN
775 651
 
776
-// Temperature status LEDs that display the hotend and bet temperature.
777
-// If all hotends and bed temperature and temperature setpoint are < 54C then the BLUE led is on.
778
-// Otherwise the RED led is on. There is 1C hysteresis.
779
-//#define TEMP_STAT_LEDS
780
-
781 652
 // Use software PWM to drive the fan, as for the heaters. This uses a very low frequency
782 653
 // which is not ass annoying as with the hardware PWM. On the other hand, if this frequency
783 654
 // is too low, you should also increment SOFT_PWM_SCALE.
@@ -789,6 +660,11 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
789 660
 // at zero value, there are 128 effective control positions.
790 661
 #define SOFT_PWM_SCALE 0
791 662
 
663
+// Temperature status LEDs that display the hotend and bet temperature.
664
+// If all hotends and bed temperature and temperature setpoint are < 54C then the BLUE led is on.
665
+// Otherwise the RED led is on. There is 1C hysteresis.
666
+//#define TEMP_STAT_LEDS
667
+
792 668
 // M240  Triggers a camera by emulating a Canon RC-1 Remote
793 669
 // Data from: http://www.doc-diy.net/photo/rc-1_hacked/
794 670
 // #define PHOTOGRAPH_PIN     23
@@ -860,4 +736,4 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
860 736
 #include "Configuration_adv.h"
861 737
 #include "thermistortables.h"
862 738
 
863
-#endif //__CONFIGURATION_H
739
+#endif //CONFIGURATION_H

+ 10
- 201
Marlin/example_configurations/Hephestos/Configuration_adv.h View File

@@ -1,6 +1,8 @@
1 1
 #ifndef CONFIGURATION_ADV_H
2 2
 #define CONFIGURATION_ADV_H
3 3
 
4
+#include "Conditionals.h"
5
+
4 6
 //===========================================================================
5 7
 //=============================Thermal Settings  ============================
6 8
 //===========================================================================
@@ -89,54 +91,6 @@
89 91
 
90 92
 //#define ENDSTOPS_ONLY_FOR_HOMING // If defined the endstops will only be used for homing
91 93
 
92
-
93
-//// AUTOSET LOCATIONS OF LIMIT SWITCHES
94
-//// Added by ZetaPhoenix 09-15-2012
95
-#ifdef MANUAL_HOME_POSITIONS  // Use manual limit switch locations
96
-  #define X_HOME_POS MANUAL_X_HOME_POS
97
-  #define Y_HOME_POS MANUAL_Y_HOME_POS
98
-  #define Z_HOME_POS MANUAL_Z_HOME_POS
99
-#else //Set min/max homing switch positions based upon homing direction and min/max travel limits
100
-  //X axis
101
-  #if X_HOME_DIR == -1
102
-    #ifdef BED_CENTER_AT_0_0
103
-      #define X_HOME_POS X_MAX_LENGTH * -0.5
104
-    #else
105
-      #define X_HOME_POS X_MIN_POS
106
-    #endif //BED_CENTER_AT_0_0
107
-  #else
108
-    #ifdef BED_CENTER_AT_0_0
109
-      #define X_HOME_POS X_MAX_LENGTH * 0.5
110
-    #else
111
-      #define X_HOME_POS X_MAX_POS
112
-    #endif //BED_CENTER_AT_0_0
113
-  #endif //X_HOME_DIR == -1
114
-
115
-  //Y axis
116
-  #if Y_HOME_DIR == -1
117
-    #ifdef BED_CENTER_AT_0_0
118
-      #define Y_HOME_POS Y_MAX_LENGTH * -0.5
119
-    #else
120
-      #define Y_HOME_POS Y_MIN_POS
121
-    #endif //BED_CENTER_AT_0_0
122
-  #else
123
-    #ifdef BED_CENTER_AT_0_0
124
-      #define Y_HOME_POS Y_MAX_LENGTH * 0.5
125
-    #else
126
-      #define Y_HOME_POS Y_MAX_POS
127
-    #endif //BED_CENTER_AT_0_0
128
-  #endif //Y_HOME_DIR == -1
129
-
130
-  // Z axis
131
-  #if Z_HOME_DIR == -1 //BED_CENTER_AT_0_0 not used
132
-    #define Z_HOME_POS Z_MIN_POS
133
-  #else
134
-    #define Z_HOME_POS Z_MAX_POS
135
-  #endif //Z_HOME_DIR == -1
136
-#endif //End auto min/max positions
137
-//END AUTOSET LOCATIONS OF LIMIT SWITCHES -ZP
138
-
139
-
140 94
 //#define Z_LATE_ENABLE // Enable Z the last moment. Needed if your Z driver overheats.
141 95
 
142 96
 // A single Z stepper driver is usually used to drive 2 stepper motors.
@@ -146,26 +100,12 @@
146 100
 // On a RAMPS (or other 5 driver) motherboard, using this feature will limit you to using 1 extruder.
147 101
 //#define Z_DUAL_STEPPER_DRIVERS
148 102
 
149
-#ifdef Z_DUAL_STEPPER_DRIVERS
150
-  #undef EXTRUDERS
151
-  #define EXTRUDERS 1
152
-#endif
153
-
154 103
 // Same again but for Y Axis.
155 104
 //#define Y_DUAL_STEPPER_DRIVERS
156 105
 
157 106
 // Define if the two Y drives need to rotate in opposite directions
158 107
 #define INVERT_Y2_VS_Y_DIR true
159 108
 
160
-#ifdef Y_DUAL_STEPPER_DRIVERS
161
-  #undef EXTRUDERS
162
-  #define EXTRUDERS 1
163
-#endif
164
-
165
-#if defined (Z_DUAL_STEPPER_DRIVERS) && defined (Y_DUAL_STEPPER_DRIVERS)
166
-  #error "You cannot have dual drivers for both Y and Z"
167
-#endif
168
-
169 109
 // Enable this for dual x-carriage printers.
170 110
 // A dual x-carriage design has the advantage that the inactive extruder can be parked which
171 111
 // prevents hot-end ooze contaminating the print. It also reduces the weight of each x-carriage
@@ -229,20 +169,15 @@
229 169
 #define INVERT_Z_STEP_PIN false
230 170
 #define INVERT_E_STEP_PIN false
231 171
 
232
-//default stepper release if idle. Set to 0 to deactivate.
172
+// Default stepper release if idle. Set to 0 to deactivate.
233 173
 #define DEFAULT_STEPPER_DEACTIVE_TIME 60
234 174
 
235 175
 #define DEFAULT_MINIMUMFEEDRATE       0.0     // minimum feedrate
236 176
 #define DEFAULT_MINTRAVELFEEDRATE     0.0
237 177
 
238
-// Feedrates for manual moves along X, Y, Z, E from panel
239 178
 #ifdef ULTIPANEL
240
-#define MANUAL_FEEDRATE {120*60, 120*60, 18*60, 60}  // set the speeds for manual moves (mm/min)
241
-#endif
242
-
243
-//Comment to disable setting feedrate multiplier via encoder
244
-#ifdef ULTIPANEL
245
-    #define ULTIPANEL_FEEDMULTIPLY
179
+  #define MANUAL_FEEDRATE {120*60, 120*60, 18*60, 60}  // Feedrates for manual moves along X, Y, Z, E from panel
180
+  #define ULTIPANEL_FEEDMULTIPLY  // Comment to disable setting feedrate multiplier via encoder
246 181
 #endif
247 182
 
248 183
 // minimum time in microseconds that a movement needs to take if the buffer is emptied.
@@ -261,13 +196,6 @@
261 196
 // if unwanted behavior is observed on a user's machine when running at very slow speeds.
262 197
 #define MINIMUM_PLANNER_SPEED 0.05// (mm/sec)
263 198
 
264
-// MS1 MS2 Stepper Driver Microstepping mode table
265
-#define MICROSTEP1 LOW,LOW
266
-#define MICROSTEP2 HIGH,LOW
267
-#define MICROSTEP4 LOW,HIGH
268
-#define MICROSTEP8 HIGH,HIGH
269
-#define MICROSTEP16 HIGH,HIGH
270
-
271 199
 // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU.
272 200
 #define MICROSTEP_MODES {16,16,16,16,16} // [1,2,4,8,16]
273 201
 
@@ -313,12 +241,6 @@
313 241
   #define PROGRESS_MSG_EXPIRE   0
314 242
   // Enable this to show messages for MSG_TIME then hide them
315 243
   //#define PROGRESS_MSG_ONCE
316
-  #ifdef DOGLCD
317
-    #warning LCD_PROGRESS_BAR does not apply to graphical displays at this time.
318
-  #endif
319
-  #ifdef FILAMENT_LCD_DISPLAY
320
-    #error LCD_PROGRESS_BAR and FILAMENT_LCD_DISPLAY are not fully compatible. Comment out this line to use both.
321
-  #endif
322 244
 #endif
323 245
 
324 246
 // The hardware watchdog should reset the microcontroller disabling all outputs, in case the firmware gets stuck and doesn't do temperature regulation.
@@ -342,16 +264,6 @@
342 264
   #define BABYSTEP_XY  //not only z, but also XY in the menu. more clutter, more functions
343 265
   #define BABYSTEP_INVERT_Z false  //true for inverse movements in Z
344 266
   #define BABYSTEP_Z_MULTIPLICATOR 2 //faster z movements
345
-
346
-  #ifdef COREXY
347
-    #error BABYSTEPPING not implemented for COREXY yet.
348
-  #endif
349
-
350
-  #ifdef DELTA
351
-    #ifdef BABYSTEP_XY
352
-      #error BABYSTEPPING only implemented for Z axis on deltabots.
353
-    #endif
354
-  #endif
355 267
 #endif
356 268
 
357 269
 // extruder advance constant (s2/mm3)
@@ -365,12 +277,8 @@
365 277
 
366 278
 #ifdef ADVANCE
367 279
   #define EXTRUDER_ADVANCE_K .0
368
-
369 280
   #define D_FILAMENT 1.75
370 281
   #define STEPS_MM_E 100.47095761381482
371
-  #define EXTRUSION_AREA (0.25 * D_FILAMENT * D_FILAMENT * 3.14159)
372
-  #define STEPS_PER_CUBIC_MM_E (axis_steps_per_unit[E_AXIS]/ EXTRUSION_AREA)
373
-
374 282
 #endif // ADVANCE
375 283
 
376 284
 // Arc interpretation settings:
@@ -385,26 +293,6 @@ const unsigned int dropsegments=5; //everything with less than this number of st
385 293
 // be commented out otherwise
386 294
 #define SDCARDDETECTINVERTED
387 295
 
388
-#ifdef ULTIPANEL
389
- #undef SDCARDDETECTINVERTED
390
-#endif
391
-
392
-// Power Signal Control Definitions
393
-// By default use ATX definition
394
-#ifndef POWER_SUPPLY
395
-  #define POWER_SUPPLY 1
396
-#endif
397
-// 1 = ATX
398
-#if (POWER_SUPPLY == 1)
399
-  #define PS_ON_AWAKE  LOW
400
-  #define PS_ON_ASLEEP HIGH
401
-#endif
402
-// 2 = X-Box 360 203W
403
-#if (POWER_SUPPLY == 2)
404
-  #define PS_ON_AWAKE  HIGH
405
-  #define PS_ON_ASLEEP LOW
406
-#endif
407
-
408 296
 // Control heater 0 and heater 1 in parallel.
409 297
 //#define HEATERS_PARALLEL
410 298
 
@@ -444,9 +332,9 @@ const unsigned int dropsegments=5; //everything with less than this number of st
444 332
   #define RETRACT_RECOVER_FEEDRATE 8*60     //default feedrate for recovering from retraction (mm/s)
445 333
 #endif
446 334
 
447
-//adds support for experimental filament exchange support M600; requires display
335
+// Add support for experimental filament exchange support M600; requires display
448 336
 #ifdef ULTIPANEL
449
-  #define FILAMENTCHANGEENABLE
337
+  //#define FILAMENTCHANGEENABLE
450 338
   #ifdef FILAMENTCHANGEENABLE
451 339
     #define FILAMENTCHANGE_XPOS 3
452 340
     #define FILAMENTCHANGE_YPOS 3
@@ -456,86 +344,7 @@ const unsigned int dropsegments=5; //everything with less than this number of st
456 344
   #endif
457 345
 #endif
458 346
 
459
-#ifdef FILAMENTCHANGEENABLE
460
-  #ifdef EXTRUDER_RUNOUT_PREVENT
461
-    #error EXTRUDER_RUNOUT_PREVENT currently incompatible with FILAMENTCHANGE
462
-  #endif
463
-#endif
464
-
465
-//===========================================================================
466
-//=============================  Define Defines  ============================
467
-//===========================================================================
468
-
469
-#if defined (ENABLE_AUTO_BED_LEVELING) && defined (DELTA)
470
-  #error "Bed Auto Leveling is still not compatible with Delta Kinematics."
471
-#endif
472
-
473
-#if EXTRUDERS > 1 && defined TEMP_SENSOR_1_AS_REDUNDANT
474
-  #error "You cannot use TEMP_SENSOR_1_AS_REDUNDANT if EXTRUDERS > 1"
475
-#endif
476
-
477
-#if EXTRUDERS > 1 && defined HEATERS_PARALLEL
478
-  #error "You cannot use HEATERS_PARALLEL if EXTRUDERS > 1"
479
-#endif
480
-
481
-#if TEMP_SENSOR_0 > 0
482
-  #define THERMISTORHEATER_0 TEMP_SENSOR_0
483
-  #define HEATER_0_USES_THERMISTOR
484
-#endif
485
-#if TEMP_SENSOR_1 > 0
486
-  #define THERMISTORHEATER_1 TEMP_SENSOR_1
487
-  #define HEATER_1_USES_THERMISTOR
488
-#endif
489
-#if TEMP_SENSOR_2 > 0
490
-  #define THERMISTORHEATER_2 TEMP_SENSOR_2
491
-  #define HEATER_2_USES_THERMISTOR
492
-#endif
493
-#if TEMP_SENSOR_3 > 0
494
-  #define THERMISTORHEATER_3 TEMP_SENSOR_3
495
-  #define HEATER_3_USES_THERMISTOR
496
-#endif
497
-#if TEMP_SENSOR_BED > 0
498
-  #define THERMISTORBED TEMP_SENSOR_BED
499
-  #define BED_USES_THERMISTOR
500
-#endif
501
-#if TEMP_SENSOR_0 == -1
502
-  #define HEATER_0_USES_AD595
503
-#endif
504
-#if TEMP_SENSOR_1 == -1
505
-  #define HEATER_1_USES_AD595
506
-#endif
507
-#if TEMP_SENSOR_2 == -1
508
-  #define HEATER_2_USES_AD595
509
-#endif
510
-#if TEMP_SENSOR_3 == -1
511
-  #define HEATER_3_USES_AD595
512
-#endif
513
-#if TEMP_SENSOR_BED == -1
514
-  #define BED_USES_AD595
515
-#endif
516
-#if TEMP_SENSOR_0 == -2
517
-  #define HEATER_0_USES_MAX6675
518
-#endif
519
-#if TEMP_SENSOR_0 == 0
520
-  #undef HEATER_0_MINTEMP
521
-  #undef HEATER_0_MAXTEMP
522
-#endif
523
-#if TEMP_SENSOR_1 == 0
524
-  #undef HEATER_1_MINTEMP
525
-  #undef HEATER_1_MAXTEMP
526
-#endif
527
-#if TEMP_SENSOR_2 == 0
528
-  #undef HEATER_2_MINTEMP
529
-  #undef HEATER_2_MAXTEMP
530
-#endif
531
-#if TEMP_SENSOR_3 == 0
532
-  #undef HEATER_3_MINTEMP
533
-  #undef HEATER_3_MAXTEMP
534
-#endif
535
-#if TEMP_SENSOR_BED == 0
536
-  #undef BED_MINTEMP
537
-  #undef BED_MAXTEMP
538
-#endif
539
-
347
+#include "Conditionals.h"
348
+#include "SanityCheck.h"
540 349
 
541
-#endif //__CONFIGURATION_ADV_H
350
+#endif //CONFIGURATION_ADV_H

+ 34
- 158
Marlin/example_configurations/K8200/Configuration.h View File

@@ -327,15 +327,6 @@ your extruder heater takes 2 minutes to hit the target on heating.
327 327
   #define ENDSTOPPULLUP_ZMIN
328 328
 #endif
329 329
 
330
-#ifdef ENDSTOPPULLUPS
331
-  // #define ENDSTOPPULLUP_XMAX
332
-  // #define ENDSTOPPULLUP_YMAX
333
-  // #define ENDSTOPPULLUP_ZMAX
334
-  #define ENDSTOPPULLUP_XMIN
335
-  #define ENDSTOPPULLUP_YMIN
336
-  #define ENDSTOPPULLUP_ZMIN
337
-#endif
338
-
339 330
 // The pullups are needed if you directly connect a mechanical endswitch between the signal and ground pins.
340 331
 const bool X_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
341 332
 const bool Y_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
@@ -384,10 +375,32 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
384 375
 #define Z_MAX_POS 200
385 376
 #define Z_MIN_POS 0
386 377
 
387
-#define X_MAX_LENGTH (X_MAX_POS - X_MIN_POS)
388
-#define Y_MAX_LENGTH (Y_MAX_POS - Y_MIN_POS)
389
-#define Z_MAX_LENGTH (Z_MAX_POS - Z_MIN_POS)
378
+//===========================================================================
379
+//============================= Filament Runout Sensor ======================
380
+//===========================================================================
381
+//#define FILAMENT_RUNOUT_SENSOR // Uncomment for defining a filament runout sensor such as a mechanical or opto endstop to check the existence of filament
382
+                                 // In RAMPS uses servo pin 2. Can be changed in pins file. For other boards pin definition should be made.
383
+                                 // It is assumed that when logic high = filament available
384
+                                 //                    when logic  low = filament ran out
385
+//const bool FIL_RUNOUT_INVERTING = true;  // Should be uncommented and true or false should assigned
386
+//#define ENDSTOPPULLUP_FIL_RUNOUT // Uncomment to use internal pullup for filament runout pins if the sensor is defined.
390 387
 
388
+//===========================================================================
389
+//============================ Manual Bed Leveling ==========================
390
+//===========================================================================
391
+
392
+// #define MANUAL_BED_LEVELING  // Add display menu option for bed leveling
393
+// #define MESH_BED_LEVELING    // Enable mesh bed leveling
394
+
395
+#if defined(MESH_BED_LEVELING)
396
+  #define MESH_MIN_X 10
397
+  #define MESH_MAX_X (X_MAX_POS - MESH_MIN_X)
398
+  #define MESH_MIN_Y 10
399
+  #define MESH_MAX_Y (Y_MAX_POS - MESH_MIN_Y)
400
+  #define MESH_NUM_X_POINTS 3  // Don't use more than 7 points per axis, implementation limited
401
+  #define MESH_NUM_Y_POINTS 3
402
+  #define MESH_HOME_SEARCH_Z 4  // Z after Home, bed somewhere below but above 0.0
403
+#endif  // MESH_BED_LEVELING
391 404
 
392 405
 //===========================================================================
393 406
 //============================= Bed Auto Leveling ===========================
@@ -415,12 +428,6 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
415 428
 
416 429
   #ifdef AUTO_BED_LEVELING_GRID
417 430
 
418
-    // Use one of these defines to specify the origin
419
-    // for a topographical map to be printed for your bed.
420
-    enum { OriginBackLeft, OriginFrontLeft, OriginBackRight, OriginFrontRight };
421
-    #define TOPO_ORIGIN OriginFrontLeft
422
-
423
-    // The edges of the rectangle in which to probe
424 431
     #define LEFT_PROBE_BED_POSITION 15
425 432
     #define RIGHT_PROBE_BED_POSITION 170
426 433
     #define FRONT_PROBE_BED_POSITION 20
@@ -624,112 +631,17 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
624 631
 // REMEMBER TO INSTALL LiquidCrystal_I2C.h in your ARDUINO library folder: https://github.com/kiyoshigawa/LiquidCrystal_I2C
625 632
 //#define RA_CONTROL_PANEL
626 633
 
627
-//automatic expansion
628
-#if defined (MAKRPANEL)
629
- #define DOGLCD
630
- #define SDSUPPORT
631
- #define ULTIPANEL
632
- #define NEWPANEL
633
- #define DEFAULT_LCD_CONTRAST 17
634
-#endif
635
-
636
-#if defined(miniVIKI) || defined(VIKI2)
637
- #define ULTRA_LCD  //general LCD support, also 16x2
638
- #define DOGLCD  // Support for SPI LCD 128x64 (Controller ST7565R graphic Display Family)
639
- #define ULTIMAKERCONTROLLER //as available from the Ultimaker online store.
640
- 
641
-  #ifdef miniVIKI
642
-   #define DEFAULT_LCD_CONTRAST 95
643
-  #else
644
-   #define DEFAULT_LCD_CONTRAST 40
645
-  #endif
646
-  
647
- #define ENCODER_PULSES_PER_STEP 4
648
- #define ENCODER_STEPS_PER_MENU_ITEM 1
649
-#endif
650
-
651
-#if defined (PANEL_ONE)
652
- #define SDSUPPORT
653
- #define ULTIMAKERCONTROLLER
654
-#endif
655
-
656
-#if defined (REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER)
657
- #define DOGLCD
658
- #define U8GLIB_ST7920
659
- #define REPRAP_DISCOUNT_SMART_CONTROLLER
660
-#endif
661
-
662
-#if defined(ULTIMAKERCONTROLLER) || defined(REPRAP_DISCOUNT_SMART_CONTROLLER) || defined(G3D_PANEL)
663
- #define ULTIPANEL
664
- #define NEWPANEL
665
-#endif
666
-
667
-#if defined(REPRAPWORLD_KEYPAD)
668
-  #define NEWPANEL
669
-  #define ULTIPANEL
670
-#endif
671
-#if defined(RA_CONTROL_PANEL)
672
- #define ULTIPANEL
673
- #define NEWPANEL
674
- #define LCD_I2C_TYPE_PCA8574
675
- #define LCD_I2C_ADDRESS 0x27   // I2C Address of the port expander
676
-#endif
677
-
678
-//I2C PANELS
634
+/**
635
+ * I2C Panels
636
+ */
679 637
 
680 638
 //#define LCD_I2C_SAINSMART_YWROBOT
681
-#ifdef LCD_I2C_SAINSMART_YWROBOT
682
-  // This uses the LiquidCrystal_I2C library ( https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home )
683
-  // Make sure it is placed in the Arduino libraries directory.
684
-  #define LCD_I2C_TYPE_PCF8575
685
-  #define LCD_I2C_ADDRESS 0x27   // I2C Address of the port expander
686
-  #define NEWPANEL
687
-  #define ULTIPANEL
688
-#endif
689 639
 
690 640
 // PANELOLU2 LCD with status LEDs, separate encoder and click inputs
691 641
 //#define LCD_I2C_PANELOLU2
692
-#ifdef LCD_I2C_PANELOLU2
693
-  // This uses the LiquidTWI2 library v1.2.3 or later ( https://github.com/lincomatic/LiquidTWI2 )
694
-  // Make sure the LiquidTWI2 directory is placed in the Arduino or Sketchbook libraries subdirectory.
695
-  // (v1.2.3 no longer requires you to define PANELOLU in the LiquidTWI2.h library header file)
696
-  // Note: The PANELOLU2 encoder click input can either be directly connected to a pin
697
-  //       (if BTN_ENC defined to != -1) or read through I2C (when BTN_ENC == -1).
698
-  #define LCD_I2C_TYPE_MCP23017
699
-  #define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander
700
-  #define LCD_USE_I2C_BUZZER //comment out to disable buzzer on LCD
701
-  #define NEWPANEL
702
-  #define ULTIPANEL
703
-
704
-  #ifndef ENCODER_PULSES_PER_STEP
705
-	#define ENCODER_PULSES_PER_STEP 4
706
-  #endif
707
-
708
-  #ifndef ENCODER_STEPS_PER_MENU_ITEM
709
-	#define ENCODER_STEPS_PER_MENU_ITEM 1
710
-  #endif
711
-
712
-
713
-  #ifdef LCD_USE_I2C_BUZZER
714
-	#define LCD_FEEDBACK_FREQUENCY_HZ 1000
715
-	#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100
716
-  #endif
717
-
718
-#endif
719 642
 
720 643
 // Panucatt VIKI LCD with status LEDs, integrated click & L/R/U/P buttons, separate encoder inputs
721 644
 //#define LCD_I2C_VIKI
722
-#ifdef LCD_I2C_VIKI
723
-  // This uses the LiquidTWI2 library v1.2.3 or later ( https://github.com/lincomatic/LiquidTWI2 )
724
-  // Make sure the LiquidTWI2 directory is placed in the Arduino or Sketchbook libraries subdirectory.
725
-  // Note: The pause/stop/resume LCD button pin should be connected to the Arduino
726
-  //       BTN_ENC pin (or set BTN_ENC to -1 if not used)
727
-  #define LCD_I2C_TYPE_MCP23017
728
-  #define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander
729
-  #define LCD_USE_I2C_BUZZER //comment out to disable buzzer on LCD (requires LiquidTWI2 v1.2.3 or later)
730
-  #define NEWPANEL
731
-  #define ULTIPANEL
732
-#endif
733 645
 
734 646
 // Shift register panels
735 647
 // ---------------------
@@ -737,51 +649,10 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
737 649
 // https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection 
738 650
 
739 651
 //#define SAV_3DLCD
740
-#ifdef SAV_3DLCD
741
-   #define SR_LCD_2W_NL    // Non latching 2 wire shiftregister
742
-   #define NEWPANEL
743
-   #define ULTIPANEL
744
-#endif
745
-
746
-
747
-#ifdef ULTIPANEL
748
-//  #define NEWPANEL  //enable this if you have a click-encoder panel
749
-  #define SDSUPPORT
750
-  #define ULTRA_LCD
751
-  #ifdef DOGLCD // Change number of lines to match the DOG graphic display
752
-    #define LCD_WIDTH 22
753
-    #define LCD_HEIGHT 5
754
-  #else
755
-    #define LCD_WIDTH 20
756
-    #define LCD_HEIGHT 4
757
-  #endif
758
-#else //no panel but just LCD
759
-  #ifdef ULTRA_LCD
760
-  #ifdef DOGLCD // Change number of lines to match the 128x64 graphics display
761
-    #define LCD_WIDTH 22
762
-    #define LCD_HEIGHT 5
763
-  #else
764
-    #define LCD_WIDTH 16
765
-    #define LCD_HEIGHT 2
766
-  #endif
767
-  #endif
768
-#endif
769
-
770
-// default LCD contrast for dogm-like LCD displays
771
-#ifdef DOGLCD
772
-# ifndef DEFAULT_LCD_CONTRAST
773
-#  define DEFAULT_LCD_CONTRAST 32
774
-# endif
775
-#endif
776 652
 
777 653
 // Increase the FAN pwm frequency. Removes the PWM noise but increases heating in the FET/Arduino
778 654
 //#define FAST_PWM_FAN
779 655
 
780
-// Temperature status LEDs that display the hotend and bet temperature.
781
-// If all hotends and bed temperature and temperature setpoint are < 54C then the BLUE led is on.
782
-// Otherwise the RED led is on. There is 1C hysteresis.
783
-//#define TEMP_STAT_LEDS
784
-
785 656
 // Use software PWM to drive the fan, as for the heaters. This uses a very low frequency
786 657
 // which is not ass annoying as with the hardware PWM. On the other hand, if this frequency
787 658
 // is too low, you should also increment SOFT_PWM_SCALE.
@@ -793,6 +664,11 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
793 664
 // at zero value, there are 128 effective control positions.
794 665
 #define SOFT_PWM_SCALE 0
795 666
 
667
+// Temperature status LEDs that display the hotend and bet temperature.
668
+// If all hotends and bed temperature and temperature setpoint are < 54C then the BLUE led is on.
669
+// Otherwise the RED led is on. There is 1C hysteresis.
670
+//#define TEMP_STAT_LEDS
671
+
796 672
 // M240  Triggers a camera by emulating a Canon RC-1 Remote
797 673
 // Data from: http://www.doc-diy.net/photo/rc-1_hacked/
798 674
 // #define PHOTOGRAPH_PIN     23
@@ -864,4 +740,4 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
864 740
 #include "Configuration_adv.h"
865 741
 #include "thermistortables.h"
866 742
 
867
-#endif //__CONFIGURATION_H
743
+#endif //CONFIGURATION_H

+ 11
- 206
Marlin/example_configurations/K8200/Configuration_adv.h View File

@@ -1,6 +1,8 @@
1 1
 #ifndef CONFIGURATION_ADV_H
2 2
 #define CONFIGURATION_ADV_H
3 3
 
4
+#include "Conditionals.h"
5
+
4 6
 //===========================================================================
5 7
 //=============================Thermal Settings  ============================
6 8
 //===========================================================================
@@ -89,54 +91,6 @@
89 91
 
90 92
 #define ENDSTOPS_ONLY_FOR_HOMING // If defined the endstops will only be used for homing
91 93
 
92
-
93
-//// AUTOSET LOCATIONS OF LIMIT SWITCHES
94
-//// Added by ZetaPhoenix 09-15-2012
95
-#ifdef MANUAL_HOME_POSITIONS  // Use manual limit switch locations
96
-  #define X_HOME_POS MANUAL_X_HOME_POS
97
-  #define Y_HOME_POS MANUAL_Y_HOME_POS
98
-  #define Z_HOME_POS MANUAL_Z_HOME_POS
99
-#else //Set min/max homing switch positions based upon homing direction and min/max travel limits
100
-  //X axis
101
-  #if X_HOME_DIR == -1
102
-    #ifdef BED_CENTER_AT_0_0
103
-      #define X_HOME_POS X_MAX_LENGTH * -0.5
104
-    #else
105
-      #define X_HOME_POS X_MIN_POS
106
-    #endif //BED_CENTER_AT_0_0
107
-  #else
108
-    #ifdef BED_CENTER_AT_0_0
109
-      #define X_HOME_POS X_MAX_LENGTH * 0.5
110
-    #else
111
-      #define X_HOME_POS X_MAX_POS
112
-    #endif //BED_CENTER_AT_0_0
113
-  #endif //X_HOME_DIR == -1
114
-
115
-  //Y axis
116
-  #if Y_HOME_DIR == -1
117
-    #ifdef BED_CENTER_AT_0_0
118
-      #define Y_HOME_POS Y_MAX_LENGTH * -0.5
119
-    #else
120
-      #define Y_HOME_POS Y_MIN_POS
121
-    #endif //BED_CENTER_AT_0_0
122
-  #else
123
-    #ifdef BED_CENTER_AT_0_0
124
-      #define Y_HOME_POS Y_MAX_LENGTH * 0.5
125
-    #else
126
-      #define Y_HOME_POS Y_MAX_POS
127
-    #endif //BED_CENTER_AT_0_0
128
-  #endif //Y_HOME_DIR == -1
129
-
130
-  // Z axis
131
-  #if Z_HOME_DIR == -1 //BED_CENTER_AT_0_0 not used
132
-    #define Z_HOME_POS Z_MIN_POS
133
-  #else
134
-    #define Z_HOME_POS Z_MAX_POS
135
-  #endif //Z_HOME_DIR == -1
136
-#endif //End auto min/max positions
137
-//END AUTOSET LOCATIONS OF LIMIT SWITCHES -ZP
138
-
139
-
140 94
 //#define Z_LATE_ENABLE // Enable Z the last moment. Needed if your Z driver overheats.
141 95
 
142 96
 // A single Z stepper driver is usually used to drive 2 stepper motors.
@@ -146,26 +100,12 @@
146 100
 // On a RAMPS (or other 5 driver) motherboard, using this feature will limit you to using 1 extruder.
147 101
 //#define Z_DUAL_STEPPER_DRIVERS
148 102
 
149
-#ifdef Z_DUAL_STEPPER_DRIVERS
150
-  #undef EXTRUDERS
151
-  #define EXTRUDERS 1
152
-#endif
153
-
154 103
 // Same again but for Y Axis.
155 104
 //#define Y_DUAL_STEPPER_DRIVERS
156 105
 
157 106
 // Define if the two Y drives need to rotate in opposite directions
158 107
 #define INVERT_Y2_VS_Y_DIR true
159 108
 
160
-#ifdef Y_DUAL_STEPPER_DRIVERS
161
-  #undef EXTRUDERS
162
-  #define EXTRUDERS 1
163
-#endif
164
-
165
-#if defined (Z_DUAL_STEPPER_DRIVERS) && defined (Y_DUAL_STEPPER_DRIVERS)
166
-  #error "You cannot have dual drivers for both Y and Z"
167
-#endif
168
-
169 109
 // Enable this for dual x-carriage printers.
170 110
 // A dual x-carriage design has the advantage that the inactive extruder can be parked which
171 111
 // prevents hot-end ooze contaminating the print. It also reduces the weight of each x-carriage
@@ -218,31 +158,22 @@
218 158
 //#define QUICK_HOME  //if this is defined, if both x and y are to be homed, a diagonal move will be performed initially.
219 159
 
220 160
 #define AXIS_RELATIVE_MODES {false, false, false, false}
221
-#ifdef CONFIG_STEPPERS_TOSHIBA
222
-#define MAX_STEP_FREQUENCY 10000 // Max step frequency for Toshiba Stepper Controllers
223
-#else
224
-#define MAX_STEP_FREQUENCY 40000 // Max step frequency for Ultimaker (5000 pps / half step)
225
-#endif
161
+
226 162
 //By default pololu step drivers require an active high signal. However, some high power drivers require an active low signal as step.
227 163
 #define INVERT_X_STEP_PIN false
228 164
 #define INVERT_Y_STEP_PIN false
229 165
 #define INVERT_Z_STEP_PIN false
230 166
 #define INVERT_E_STEP_PIN false
231 167
 
232
-//default stepper release if idle. Set to 0 to deactivate.
168
+// Default stepper release if idle. Set to 0 to deactivate.
233 169
 #define DEFAULT_STEPPER_DEACTIVE_TIME 60
234 170
 
235 171
 #define DEFAULT_MINIMUMFEEDRATE       0.0     // minimum feedrate
236 172
 #define DEFAULT_MINTRAVELFEEDRATE     0.0
237 173
 
238
-// Feedrates for manual moves along X, Y, Z, E from panel
239
-#ifdef ULTIPANEL
240
-#define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60}  // set the speeds for manual moves (mm/min)
241
-#endif
242
-
243
-//Comment to disable setting feedrate multiplier via encoder
244 174
 #ifdef ULTIPANEL
245
-    #define ULTIPANEL_FEEDMULTIPLY
175
+  #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel
176
+  #define ULTIPANEL_FEEDMULTIPLY  // Comment to disable setting feedrate multiplier via encoder
246 177
 #endif
247 178
 
248 179
 // minimum time in microseconds that a movement needs to take if the buffer is emptied.
@@ -261,13 +192,6 @@
261 192
 // if unwanted behavior is observed on a user's machine when running at very slow speeds.
262 193
 #define MINIMUM_PLANNER_SPEED 0.05// (mm/sec)
263 194
 
264
-// MS1 MS2 Stepper Driver Microstepping mode table
265
-#define MICROSTEP1 LOW,LOW
266
-#define MICROSTEP2 HIGH,LOW
267
-#define MICROSTEP4 LOW,HIGH
268
-#define MICROSTEP8 HIGH,HIGH
269
-#define MICROSTEP16 HIGH,HIGH
270
-
271 195
 // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU.
272 196
 #define MICROSTEP_MODES {16,16,16,16,16} // [1,2,4,8,16]
273 197
 
@@ -313,12 +237,6 @@
313 237
   #define PROGRESS_MSG_EXPIRE   0
314 238
   // Enable this to show messages for MSG_TIME then hide them
315 239
   //#define PROGRESS_MSG_ONCE
316
-  #ifdef DOGLCD
317
-    #warning LCD_PROGRESS_BAR does not apply to graphical displays at this time.
318
-  #endif
319
-  #ifdef FILAMENT_LCD_DISPLAY
320
-    #error LCD_PROGRESS_BAR and FILAMENT_LCD_DISPLAY are not fully compatible. Comment out this line to use both.
321
-  #endif
322 240
 #endif
323 241
 
324 242
 // The hardware watchdog should reset the microcontroller disabling all outputs, in case the firmware gets stuck and doesn't do temperature regulation.
@@ -342,16 +260,6 @@
342 260
   #define BABYSTEP_XY  //not only z, but also XY in the menu. more clutter, more functions
343 261
   #define BABYSTEP_INVERT_Z false  //true for inverse movements in Z
344 262
   #define BABYSTEP_Z_MULTIPLICATOR 2 //faster z movements
345
-
346
-  #ifdef COREXY
347
-    #error BABYSTEPPING not implemented for COREXY yet.
348
-  #endif
349
-
350
-  #ifdef DELTA
351
-    #ifdef BABYSTEP_XY
352
-      #error BABYSTEPPING only implemented for Z axis on deltabots.
353
-    #endif
354
-  #endif
355 263
 #endif
356 264
 
357 265
 // extruder advance constant (s2/mm3)
@@ -365,12 +273,8 @@
365 273
 
366 274
 #ifdef ADVANCE
367 275
   #define EXTRUDER_ADVANCE_K .0
368
-
369 276
   #define D_FILAMENT 2.85
370 277
   #define STEPS_MM_E 836
371
-  #define EXTRUSION_AREA (0.25 * D_FILAMENT * D_FILAMENT * 3.14159)
372
-  #define STEPS_PER_CUBIC_MM_E (axis_steps_per_unit[E_AXIS]/ EXTRUSION_AREA)
373
-
374 278
 #endif // ADVANCE
375 279
 
376 280
 // Arc interpretation settings:
@@ -385,26 +289,6 @@ const unsigned int dropsegments=5; //everything with less than this number of st
385 289
 // be commented out otherwise
386 290
 #define SDCARDDETECTINVERTED
387 291
 
388
-#ifdef ULTIPANEL
389
- #undef SDCARDDETECTINVERTED
390
-#endif
391
-
392
-// Power Signal Control Definitions
393
-// By default use ATX definition
394
-#ifndef POWER_SUPPLY
395
-  #define POWER_SUPPLY 1
396
-#endif
397
-// 1 = ATX
398
-#if (POWER_SUPPLY == 1)
399
-  #define PS_ON_AWAKE  LOW
400
-  #define PS_ON_ASLEEP HIGH
401
-#endif
402
-// 2 = X-Box 360 203W
403
-#if (POWER_SUPPLY == 2)
404
-  #define PS_ON_AWAKE  HIGH
405
-  #define PS_ON_ASLEEP LOW
406
-#endif
407
-
408 292
 // Control heater 0 and heater 1 in parallel.
409 293
 //#define HEATERS_PARALLEL
410 294
 
@@ -444,9 +328,9 @@ const unsigned int dropsegments=5; //everything with less than this number of st
444 328
   #define RETRACT_RECOVER_FEEDRATE 8     //default feedrate for recovering from retraction (mm/s)
445 329
 #endif
446 330
 
447
-//adds support for experimental filament exchange support M600; requires display
331
+// Add support for experimental filament exchange support M600; requires display
448 332
 #ifdef ULTIPANEL
449
-  #define FILAMENTCHANGEENABLE
333
+  //#define FILAMENTCHANGEENABLE
450 334
   #ifdef FILAMENTCHANGEENABLE
451 335
     #define FILAMENTCHANGE_XPOS 3
452 336
     #define FILAMENTCHANGE_YPOS 3
@@ -456,86 +340,7 @@ const unsigned int dropsegments=5; //everything with less than this number of st
456 340
   #endif
457 341
 #endif
458 342
 
459
-#ifdef FILAMENTCHANGEENABLE
460
-  #ifdef EXTRUDER_RUNOUT_PREVENT
461
-    #error EXTRUDER_RUNOUT_PREVENT currently incompatible with FILAMENTCHANGE
462
-  #endif
463
-#endif
464
-
465
-//===========================================================================
466
-//=============================  Define Defines  ============================
467
-//===========================================================================
468
-
469
-#if defined (ENABLE_AUTO_BED_LEVELING) && defined (DELTA)
470
-  #error "Bed Auto Leveling is still not compatible with Delta Kinematics."
471
-#endif
472
-
473
-#if EXTRUDERS > 1 && defined TEMP_SENSOR_1_AS_REDUNDANT
474
-  #error "You cannot use TEMP_SENSOR_1_AS_REDUNDANT if EXTRUDERS > 1"
475
-#endif
476
-
477
-#if EXTRUDERS > 1 && defined HEATERS_PARALLEL
478
-  #error "You cannot use HEATERS_PARALLEL if EXTRUDERS > 1"
479
-#endif
480
-
481
-#if TEMP_SENSOR_0 > 0
482
-  #define THERMISTORHEATER_0 TEMP_SENSOR_0
483
-  #define HEATER_0_USES_THERMISTOR
484
-#endif
485
-#if TEMP_SENSOR_1 > 0
486
-  #define THERMISTORHEATER_1 TEMP_SENSOR_1
487
-  #define HEATER_1_USES_THERMISTOR
488
-#endif
489
-#if TEMP_SENSOR_2 > 0
490
-  #define THERMISTORHEATER_2 TEMP_SENSOR_2
491
-  #define HEATER_2_USES_THERMISTOR
492
-#endif
493
-#if TEMP_SENSOR_3 > 0
494
-  #define THERMISTORHEATER_3 TEMP_SENSOR_3
495
-  #define HEATER_3_USES_THERMISTOR
496
-#endif
497
-#if TEMP_SENSOR_BED > 0
498
-  #define THERMISTORBED TEMP_SENSOR_BED
499
-  #define BED_USES_THERMISTOR
500
-#endif
501
-#if TEMP_SENSOR_0 == -1
502
-  #define HEATER_0_USES_AD595
503
-#endif
504
-#if TEMP_SENSOR_1 == -1
505
-  #define HEATER_1_USES_AD595
506
-#endif
507
-#if TEMP_SENSOR_2 == -1
508
-  #define HEATER_2_USES_AD595
509
-#endif
510
-#if TEMP_SENSOR_3 == -1
511
-  #define HEATER_3_USES_AD595
512
-#endif
513
-#if TEMP_SENSOR_BED == -1
514
-  #define BED_USES_AD595
515
-#endif
516
-#if TEMP_SENSOR_0 == -2
517
-  #define HEATER_0_USES_MAX6675
518
-#endif
519
-#if TEMP_SENSOR_0 == 0
520
-  #undef HEATER_0_MINTEMP
521
-  #undef HEATER_0_MAXTEMP
522
-#endif
523
-#if TEMP_SENSOR_1 == 0
524
-  #undef HEATER_1_MINTEMP
525
-  #undef HEATER_1_MAXTEMP
526
-#endif
527
-#if TEMP_SENSOR_2 == 0
528
-  #undef HEATER_2_MINTEMP
529
-  #undef HEATER_2_MAXTEMP
530
-#endif
531
-#if TEMP_SENSOR_3 == 0
532
-  #undef HEATER_3_MINTEMP
533
-  #undef HEATER_3_MAXTEMP
534
-#endif
535
-#if TEMP_SENSOR_BED == 0
536
-  #undef BED_MINTEMP
537
-  #undef BED_MAXTEMP
538
-#endif
539
-
343
+#include "Conditionals.h"
344
+#include "SanityCheck.h"
540 345
 
541
-#endif //__CONFIGURATION_ADV_H
346
+#endif //CONFIGURATION_ADV_H

+ 34
- 158
Marlin/example_configurations/SCARA/Configuration.h View File

@@ -351,15 +351,6 @@ your extruder heater takes 2 minutes to hit the target on heating.
351 351
   // #define ENDSTOPPULLUP_ZMIN
352 352
 #endif
353 353
 
354
-#ifdef ENDSTOPPULLUPS
355
-  #define ENDSTOPPULLUP_XMAX
356
-  #define ENDSTOPPULLUP_YMAX
357
-  #define ENDSTOPPULLUP_ZMAX
358
-  #define ENDSTOPPULLUP_XMIN
359
-  #define ENDSTOPPULLUP_YMIN
360
-  #define ENDSTOPPULLUP_ZMIN
361
-#endif
362
-
363 354
 // The pullups are needed if you directly connect a mechanical endswitch between the signal and ground pins.
364 355
 const bool X_MIN_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop.
365 356
 const bool Y_MIN_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop.
@@ -408,10 +399,32 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
408 399
 #define Z_MAX_POS 225
409 400
 #define Z_MIN_POS MANUAL_Z_HOME_POS
410 401
 
411
-#define X_MAX_LENGTH (X_MAX_POS - X_MIN_POS)
412
-#define Y_MAX_LENGTH (Y_MAX_POS - Y_MIN_POS)
413
-#define Z_MAX_LENGTH (Z_MAX_POS - Z_MIN_POS)
402
+//===========================================================================
403
+//============================= Filament Runout Sensor ======================
404
+//===========================================================================
405
+//#define FILAMENT_RUNOUT_SENSOR // Uncomment for defining a filament runout sensor such as a mechanical or opto endstop to check the existence of filament
406
+                                 // In RAMPS uses servo pin 2. Can be changed in pins file. For other boards pin definition should be made.
407
+                                 // It is assumed that when logic high = filament available
408
+                                 //                    when logic  low = filament ran out
409
+//const bool FIL_RUNOUT_INVERTING = true;  // Should be uncommented and true or false should assigned
410
+//#define ENDSTOPPULLUP_FIL_RUNOUT // Uncomment to use internal pullup for filament runout pins if the sensor is defined.
411
+
412
+//===========================================================================
413
+//============================ Manual Bed Leveling ==========================
414
+//===========================================================================
415
+
416
+// #define MANUAL_BED_LEVELING  // Add display menu option for bed leveling
417
+// #define MESH_BED_LEVELING    // Enable mesh bed leveling
414 418
 
419
+#if defined(MESH_BED_LEVELING)
420
+  #define MESH_MIN_X 10
421
+  #define MESH_MAX_X (X_MAX_POS - MESH_MIN_X)
422
+  #define MESH_MIN_Y 10
423
+  #define MESH_MAX_Y (Y_MAX_POS - MESH_MIN_Y)
424
+  #define MESH_NUM_X_POINTS 3  // Don't use more than 7 points per axis, implementation limited
425
+  #define MESH_NUM_Y_POINTS 3
426
+  #define MESH_HOME_SEARCH_Z 4  // Z after Home, bed somewhere below but above 0.0
427
+#endif  // MESH_BED_LEVELING
415 428
 
416 429
 //===========================================================================
417 430
 //============================= Bed Auto Leveling ===========================
@@ -439,12 +452,6 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
439 452
 
440 453
   #ifdef AUTO_BED_LEVELING_GRID
441 454
 
442
-    // Use one of these defines to specify the origin
443
-    // for a topographical map to be printed for your bed.
444
-    enum { OriginBackLeft, OriginFrontLeft, OriginBackRight, OriginFrontRight };
445
-    #define TOPO_ORIGIN OriginFrontLeft
446
-
447
-    // The edges of the rectangle in which to probe
448 455
     #define LEFT_PROBE_BED_POSITION 15
449 456
     #define RIGHT_PROBE_BED_POSITION 170
450 457
     #define FRONT_PROBE_BED_POSITION 20
@@ -650,112 +657,17 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
650 657
 // REMEMBER TO INSTALL LiquidCrystal_I2C.h in your ARDUINO library folder: https://github.com/kiyoshigawa/LiquidCrystal_I2C
651 658
 //#define RA_CONTROL_PANEL
652 659
 
653
-//automatic expansion
654
-#if defined (MAKRPANEL)
655
- #define DOGLCD
656
- #define SDSUPPORT
657
- #define ULTIPANEL
658
- #define NEWPANEL
659
- #define DEFAULT_LCD_CONTRAST 17
660
-#endif
661
-
662
-#if defined(miniVIKI) || defined(VIKI2)
663
- #define ULTRA_LCD  //general LCD support, also 16x2
664
- #define DOGLCD  // Support for SPI LCD 128x64 (Controller ST7565R graphic Display Family)
665
- #define ULTIMAKERCONTROLLER //as available from the Ultimaker online store.
666
- 
667
-  #ifdef miniVIKI
668
-   #define DEFAULT_LCD_CONTRAST 95
669
-  #else
670
-   #define DEFAULT_LCD_CONTRAST 40
671
-  #endif
672
-  
673
- #define ENCODER_PULSES_PER_STEP 4
674
- #define ENCODER_STEPS_PER_MENU_ITEM 1
675
-#endif
676
-
677
-#if defined (PANEL_ONE)
678
- #define SDSUPPORT
679
- #define ULTIMAKERCONTROLLER
680
-#endif
681
-
682
-#if defined (REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER)
683
- #define DOGLCD
684
- #define U8GLIB_ST7920
685
- #define REPRAP_DISCOUNT_SMART_CONTROLLER
686
-#endif
687
-
688
-#if defined(ULTIMAKERCONTROLLER) || defined(REPRAP_DISCOUNT_SMART_CONTROLLER) || defined(G3D_PANEL)
689
- #define ULTIPANEL
690
- #define NEWPANEL
691
-#endif
692
-
693
-#if defined(REPRAPWORLD_KEYPAD)
694
-  #define NEWPANEL
695
-  #define ULTIPANEL
696
-#endif
697
-#if defined(RA_CONTROL_PANEL)
698
- #define ULTIPANEL
699
- #define NEWPANEL
700
- #define LCD_I2C_TYPE_PCA8574
701
- #define LCD_I2C_ADDRESS 0x27   // I2C Address of the port expander
702
-#endif
703
-
704
-//I2C PANELS
660
+/**
661
+ * I2C Panels
662
+ */
705 663
 
706 664
 //#define LCD_I2C_SAINSMART_YWROBOT
707
-#ifdef LCD_I2C_SAINSMART_YWROBOT
708
-  // This uses the LiquidCrystal_I2C library ( https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home )
709
-  // Make sure it is placed in the Arduino libraries directory.
710
-  #define LCD_I2C_TYPE_PCF8575
711
-  #define LCD_I2C_ADDRESS 0x27   // I2C Address of the port expander
712
-  #define NEWPANEL
713
-  #define ULTIPANEL
714
-#endif
715 665
 
716 666
 // PANELOLU2 LCD with status LEDs, separate encoder and click inputs
717 667
 //#define LCD_I2C_PANELOLU2
718
-#ifdef LCD_I2C_PANELOLU2
719
-  // This uses the LiquidTWI2 library v1.2.3 or later ( https://github.com/lincomatic/LiquidTWI2 )
720
-  // Make sure the LiquidTWI2 directory is placed in the Arduino or Sketchbook libraries subdirectory.
721
-  // (v1.2.3 no longer requires you to define PANELOLU in the LiquidTWI2.h library header file)
722
-  // Note: The PANELOLU2 encoder click input can either be directly connected to a pin
723
-  //       (if BTN_ENC defined to != -1) or read through I2C (when BTN_ENC == -1).
724
-  #define LCD_I2C_TYPE_MCP23017
725
-  #define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander
726
-  #define LCD_USE_I2C_BUZZER //comment out to disable buzzer on LCD
727
-  #define NEWPANEL
728
-  #define ULTIPANEL
729
-
730
-  #ifndef ENCODER_PULSES_PER_STEP
731
-	#define ENCODER_PULSES_PER_STEP 4
732
-  #endif
733
-
734
-  #ifndef ENCODER_STEPS_PER_MENU_ITEM
735
-	#define ENCODER_STEPS_PER_MENU_ITEM 1
736
-  #endif
737
-
738
-
739
-  #ifdef LCD_USE_I2C_BUZZER
740
-	#define LCD_FEEDBACK_FREQUENCY_HZ 1000
741
-	#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100
742
-  #endif
743
-
744
-#endif
745 668
 
746 669
 // Panucatt VIKI LCD with status LEDs, integrated click & L/R/U/P buttons, separate encoder inputs
747 670
 //#define LCD_I2C_VIKI
748
-#ifdef LCD_I2C_VIKI
749
-  // This uses the LiquidTWI2 library v1.2.3 or later ( https://github.com/lincomatic/LiquidTWI2 )
750
-  // Make sure the LiquidTWI2 directory is placed in the Arduino or Sketchbook libraries subdirectory.
751
-  // Note: The pause/stop/resume LCD button pin should be connected to the Arduino
752
-  //       BTN_ENC pin (or set BTN_ENC to -1 if not used)
753
-  #define LCD_I2C_TYPE_MCP23017
754
-  #define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander
755
-  #define LCD_USE_I2C_BUZZER //comment out to disable buzzer on LCD (requires LiquidTWI2 v1.2.3 or later)
756
-  #define NEWPANEL
757
-  #define ULTIPANEL
758
-#endif
759 671
 
760 672
 // Shift register panels
761 673
 // ---------------------
@@ -763,51 +675,10 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
763 675
 // https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection 
764 676
 
765 677
 //#define SAV_3DLCD
766
-#ifdef SAV_3DLCD
767
-   #define SR_LCD_2W_NL    // Non latching 2 wire shiftregister
768
-   #define NEWPANEL
769
-   #define ULTIPANEL
770
-#endif
771
-
772
-
773
-#ifdef ULTIPANEL
774
-//  #define NEWPANEL  //enable this if you have a click-encoder panel
775
-  #define SDSUPPORT
776
-  #define ULTRA_LCD
777
-  #ifdef DOGLCD // Change number of lines to match the DOG graphic display
778
-    #define LCD_WIDTH 22
779
-    #define LCD_HEIGHT 5
780
-  #else
781
-    #define LCD_WIDTH 20
782
-    #define LCD_HEIGHT 4
783
-  #endif
784
-#else //no panel but just LCD
785
-  #ifdef ULTRA_LCD
786
-  #ifdef DOGLCD // Change number of lines to match the 128x64 graphics display
787
-    #define LCD_WIDTH 22
788
-    #define LCD_HEIGHT 5
789
-  #else
790
-    #define LCD_WIDTH 16
791
-    #define LCD_HEIGHT 2
792
-  #endif
793
-  #endif
794
-#endif
795
-
796
-// default LCD contrast for dogm-like LCD displays
797
-#ifdef DOGLCD
798
-# ifndef DEFAULT_LCD_CONTRAST
799
-#  define DEFAULT_LCD_CONTRAST 32
800
-# endif
801
-#endif
802 678
 
803 679
 // Increase the FAN pwm frequency. Removes the PWM noise but increases heating in the FET/Arduino
804 680
 //#define FAST_PWM_FAN
805 681
 
806
-// Temperature status LEDs that display the hotend and bet temperature.
807
-// If all hotends and bed temperature and temperature setpoint are < 54C then the BLUE led is on.
808
-// Otherwise the RED led is on. There is 1C hysteresis.
809
-//#define TEMP_STAT_LEDS
810
-
811 682
 // Use software PWM to drive the fan, as for the heaters. This uses a very low frequency
812 683
 // which is not ass annoying as with the hardware PWM. On the other hand, if this frequency
813 684
 // is too low, you should also increment SOFT_PWM_SCALE.
@@ -819,6 +690,11 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
819 690
 // at zero value, there are 128 effective control positions.
820 691
 #define SOFT_PWM_SCALE 0
821 692
 
693
+// Temperature status LEDs that display the hotend and bet temperature.
694
+// If all hotends and bed temperature and temperature setpoint are < 54C then the BLUE led is on.
695
+// Otherwise the RED led is on. There is 1C hysteresis.
696
+//#define TEMP_STAT_LEDS
697
+
822 698
 // M240  Triggers a camera by emulating a Canon RC-1 Remote
823 699
 // Data from: http://www.doc-diy.net/photo/rc-1_hacked/
824 700
 // #define PHOTOGRAPH_PIN     23
@@ -890,4 +766,4 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
890 766
 #include "Configuration_adv.h"
891 767
 #include "thermistortables.h"
892 768
 
893
-#endif //__CONFIGURATION_H
769
+#endif //CONFIGURATION_H

+ 11
- 197
Marlin/example_configurations/SCARA/Configuration_adv.h View File

@@ -1,6 +1,8 @@
1 1
 #ifndef CONFIGURATION_ADV_H
2 2
 #define CONFIGURATION_ADV_H
3 3
 
4
+#include "Conditionals.h"
5
+
4 6
 //===========================================================================
5 7
 //=============================Thermal Settings  ============================
6 8
 //===========================================================================
@@ -89,54 +91,6 @@
89 91
 
90 92
 #define ENDSTOPS_ONLY_FOR_HOMING // If defined the endstops will only be used for homing
91 93
 
92
-
93
-//// AUTOSET LOCATIONS OF LIMIT SWITCHES
94
-//// Added by ZetaPhoenix 09-15-2012
95
-#ifdef MANUAL_HOME_POSITIONS  // Use manual limit switch locations
96
-  #define X_HOME_POS MANUAL_X_HOME_POS
97
-  #define Y_HOME_POS MANUAL_Y_HOME_POS
98
-  #define Z_HOME_POS MANUAL_Z_HOME_POS
99
-#else //Set min/max homing switch positions based upon homing direction and min/max travel limits
100
-  //X axis
101
-  #if X_HOME_DIR == -1
102
-    #ifdef BED_CENTER_AT_0_0
103
-      #define X_HOME_POS X_MAX_LENGTH * -0.5
104
-    #else
105
-      #define X_HOME_POS X_MIN_POS
106
-    #endif //BED_CENTER_AT_0_0
107
-  #else
108
-    #ifdef BED_CENTER_AT_0_0
109
-      #define X_HOME_POS X_MAX_LENGTH * 0.5
110
-    #else
111
-      #define X_HOME_POS X_MAX_POS
112
-    #endif //BED_CENTER_AT_0_0
113
-  #endif //X_HOME_DIR == -1
114
-
115
-  //Y axis
116
-  #if Y_HOME_DIR == -1
117
-    #ifdef BED_CENTER_AT_0_0
118
-      #define Y_HOME_POS Y_MAX_LENGTH * -0.5
119
-    #else
120
-      #define Y_HOME_POS Y_MIN_POS
121
-    #endif //BED_CENTER_AT_0_0
122
-  #else
123
-    #ifdef BED_CENTER_AT_0_0
124
-      #define Y_HOME_POS Y_MAX_LENGTH * 0.5
125
-    #else
126
-      #define Y_HOME_POS Y_MAX_POS
127
-    #endif //BED_CENTER_AT_0_0
128
-  #endif //Y_HOME_DIR == -1
129
-
130
-  // Z axis
131
-  #if Z_HOME_DIR == -1 //BED_CENTER_AT_0_0 not used
132
-    #define Z_HOME_POS Z_MIN_POS
133
-  #else
134
-    #define Z_HOME_POS Z_MAX_POS
135
-  #endif //Z_HOME_DIR == -1
136
-#endif //End auto min/max positions
137
-//END AUTOSET LOCATIONS OF LIMIT SWITCHES -ZP
138
-
139
-
140 94
 //#define Z_LATE_ENABLE // Enable Z the last moment. Needed if your Z driver overheats.
141 95
 
142 96
 // A single Z stepper driver is usually used to drive 2 stepper motors.
@@ -146,26 +100,12 @@
146 100
 // On a RAMPS (or other 5 driver) motherboard, using this feature will limit you to using 1 extruder.
147 101
 //#define Z_DUAL_STEPPER_DRIVERS
148 102
 
149
-#ifdef Z_DUAL_STEPPER_DRIVERS
150
-  #undef EXTRUDERS
151
-  #define EXTRUDERS 1
152
-#endif
153
-
154 103
 // Same again but for Y Axis.
155 104
 //#define Y_DUAL_STEPPER_DRIVERS
156 105
 
157 106
 // Define if the two Y drives need to rotate in opposite directions
158 107
 #define INVERT_Y2_VS_Y_DIR true
159 108
 
160
-#ifdef Y_DUAL_STEPPER_DRIVERS
161
-  #undef EXTRUDERS
162
-  #define EXTRUDERS 1
163
-#endif
164
-
165
-#if defined (Z_DUAL_STEPPER_DRIVERS) && defined (Y_DUAL_STEPPER_DRIVERS)
166
-  #error "You cannot have dual drivers for both Y and Z"
167
-#endif
168
-
169 109
 // Enable this for dual x-carriage printers.
170 110
 // A dual x-carriage design has the advantage that the inactive extruder can be parked which
171 111
 // prevents hot-end ooze contaminating the print. It also reduces the weight of each x-carriage
@@ -216,9 +156,6 @@
216 156
 #define Z_HOME_RETRACT_MM 3
217 157
 #define HOMING_BUMP_DIVISOR {10, 10, 20}  // Re-Bump Speed Divisor (Divides the Homing Feedrate)
218 158
 //#define QUICK_HOME  //if this is defined, if both x and y are to be homed, a diagonal move will be performed initially.
219
-#ifdef SCARA
220
-	#define QUICK_HOME //SCARA needs Quickhome
221
-#endif
222 159
 
223 160
 #define AXIS_RELATIVE_MODES {false, false, false, false}
224 161
 
@@ -230,20 +167,15 @@
230 167
 #define INVERT_Z_STEP_PIN false
231 168
 #define INVERT_E_STEP_PIN false
232 169
 
233
-//default stepper release if idle. Set to 0 to deactivate.
170
+// Default stepper release if idle. Set to 0 to deactivate.
234 171
 #define DEFAULT_STEPPER_DEACTIVE_TIME 240
235 172
 
236 173
 #define DEFAULT_MINIMUMFEEDRATE       0.0     // minimum feedrate
237 174
 #define DEFAULT_MINTRAVELFEEDRATE     0.0
238 175
 
239
-// Feedrates for manual moves along X, Y, Z, E from panel
240
-#ifdef ULTIPANEL
241
-#define MANUAL_FEEDRATE {50*60, 50*60, 10*60, 60}  // set the speeds for manual moves (mm/min)
242
-#endif
243
-
244
-//Comment to disable setting feedrate multiplier via encoder
245 176
 #ifdef ULTIPANEL
246
-    #define ULTIPANEL_FEEDMULTIPLY
177
+  #define MANUAL_FEEDRATE {50*60, 50*60, 10*60, 60}  // Feedrates for manual moves along X, Y, Z, E from panel
178
+  #define ULTIPANEL_FEEDMULTIPLY  // Comment to disable setting feedrate multiplier via encoder
247 179
 #endif
248 180
 
249 181
 // minimum time in microseconds that a movement needs to take if the buffer is emptied.
@@ -251,9 +183,7 @@
251 183
 
252 184
 // If defined the movements slow down when the look ahead buffer is only half full
253 185
 //#define SLOWDOWN
254
-#ifdef SCARA
255
- #undef SLOWDOWN
256
-#endif
186
+
257 187
 // Frequency limit
258 188
 // See nophead's blog for more info
259 189
 // Not working O
@@ -264,13 +194,6 @@
264 194
 // if unwanted behavior is observed on a user's machine when running at very slow speeds.
265 195
 #define MINIMUM_PLANNER_SPEED 0.05// (mm/sec)
266 196
 
267
-// MS1 MS2 Stepper Driver Microstepping mode table
268
-#define MICROSTEP1 LOW,LOW
269
-#define MICROSTEP2 HIGH,LOW
270
-#define MICROSTEP4 LOW,HIGH
271
-#define MICROSTEP8 HIGH,HIGH
272
-#define MICROSTEP16 HIGH,HIGH
273
-
274 197
 // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU.
275 198
 #define MICROSTEP_MODES {16,16,16,16,16} // [1,2,4,8,16]
276 199
 
@@ -339,21 +262,6 @@
339 262
   #define BABYSTEP_XY  //not only z, but also XY in the menu. more clutter, more functions
340 263
   #define BABYSTEP_INVERT_Z false  //true for inverse movements in Z
341 264
   #define BABYSTEP_Z_MULTIPLICATOR 2 //faster z movements
342
-
343
-  #ifdef COREXY
344
-    #error BABYSTEPPING not implemented for COREXY yet.
345
-  #endif
346
-
347
-  #ifdef DELTA
348
-    #ifdef BABYSTEP_XY
349
-      #error BABYSTEPPING only implemented for Z axis on deltabots.
350
-    #endif
351
-  #endif
352
-  
353
-  #ifdef SCARA
354
-    #error BABYSTEPPING not implemented for SCARA yet.
355
-  #endif
356
-  
357 265
 #endif
358 266
 
359 267
 // extruder advance constant (s2/mm3)
@@ -387,26 +295,6 @@ const unsigned int dropsegments=5; //everything with less than this number of st
387 295
 // be commented out otherwise
388 296
 #define SDCARDDETECTINVERTED
389 297
 
390
-#ifdef ULTIPANEL
391
- #undef SDCARDDETECTINVERTED
392
-#endif
393
-
394
-// Power Signal Control Definitions
395
-// By default use ATX definition
396
-#ifndef POWER_SUPPLY
397
-  #define POWER_SUPPLY 1
398
-#endif
399
-// 1 = ATX
400
-#if (POWER_SUPPLY == 1)
401
-  #define PS_ON_AWAKE  LOW
402
-  #define PS_ON_ASLEEP HIGH
403
-#endif
404
-// 2 = X-Box 360 203W
405
-#if (POWER_SUPPLY == 2)
406
-  #define PS_ON_AWAKE  HIGH
407
-  #define PS_ON_ASLEEP LOW
408
-#endif
409
-
410 298
 // Control heater 0 and heater 1 in parallel.
411 299
 //#define HEATERS_PARALLEL
412 300
 
@@ -444,9 +332,9 @@ const unsigned int dropsegments=5; //everything with less than this number of st
444 332
   #define RETRACT_RECOVER_FEEDRATE 8     //default feedrate for recovering from retraction (mm/s)
445 333
 #endif
446 334
 
447
-//adds support for experimental filament exchange support M600; requires display
335
+// Add support for experimental filament exchange support M600; requires display
448 336
 #ifdef ULTIPANEL
449
-  #define FILAMENTCHANGEENABLE
337
+  //#define FILAMENTCHANGEENABLE
450 338
   #ifdef FILAMENTCHANGEENABLE
451 339
     #define FILAMENTCHANGE_XPOS 3
452 340
     #define FILAMENTCHANGE_YPOS 3
@@ -456,81 +344,7 @@ const unsigned int dropsegments=5; //everything with less than this number of st
456 344
   #endif
457 345
 #endif
458 346
 
459
-#ifdef FILAMENTCHANGEENABLE
460
-  #ifdef EXTRUDER_RUNOUT_PREVENT
461
-    #error EXTRUDER_RUNOUT_PREVENT currently incompatible with FILAMENTCHANGE
462
-  #endif
463
-#endif
464
-
465
-//===========================================================================
466
-//=============================  Define Defines  ============================
467
-//===========================================================================
468
-#if EXTRUDERS > 1 && defined TEMP_SENSOR_1_AS_REDUNDANT
469
-  #error "You cannot use TEMP_SENSOR_1_AS_REDUNDANT if EXTRUDERS > 1"
470
-#endif
471
-
472
-#if EXTRUDERS > 1 && defined HEATERS_PARALLEL
473
-  #error "You cannot use HEATERS_PARALLEL if EXTRUDERS > 1"
474
-#endif
475
-
476
-#if TEMP_SENSOR_0 > 0
477
-  #define THERMISTORHEATER_0 TEMP_SENSOR_0
478
-  #define HEATER_0_USES_THERMISTOR
479
-#endif
480
-#if TEMP_SENSOR_1 > 0
481
-  #define THERMISTORHEATER_1 TEMP_SENSOR_1
482
-  #define HEATER_1_USES_THERMISTOR
483
-#endif
484
-#if TEMP_SENSOR_2 > 0
485
-  #define THERMISTORHEATER_2 TEMP_SENSOR_2
486
-  #define HEATER_2_USES_THERMISTOR
487
-#endif
488
-#if TEMP_SENSOR_3 > 0
489
-  #define THERMISTORHEATER_3 TEMP_SENSOR_3
490
-  #define HEATER_3_USES_THERMISTOR
491
-#endif
492
-#if TEMP_SENSOR_BED > 0
493
-  #define THERMISTORBED TEMP_SENSOR_BED
494
-  #define BED_USES_THERMISTOR
495
-#endif
496
-#if TEMP_SENSOR_0 == -1
497
-  #define HEATER_0_USES_AD595
498
-#endif
499
-#if TEMP_SENSOR_1 == -1
500
-  #define HEATER_1_USES_AD595
501
-#endif
502
-#if TEMP_SENSOR_2 == -1
503
-  #define HEATER_2_USES_AD595
504
-#endif
505
-#if TEMP_SENSOR_3 == -1
506
-  #define HEATER_3_USES_AD595
507
-#endif
508
-#if TEMP_SENSOR_BED == -1
509
-  #define BED_USES_AD595
510
-#endif
511
-#if TEMP_SENSOR_0 == -2
512
-  #define HEATER_0_USES_MAX6675
513
-#endif
514
-#if TEMP_SENSOR_0 == 0
515
-  #undef HEATER_0_MINTEMP
516
-  #undef HEATER_0_MAXTEMP
517
-#endif
518
-#if TEMP_SENSOR_1 == 0
519
-  #undef HEATER_1_MINTEMP
520
-  #undef HEATER_1_MAXTEMP
521
-#endif
522
-#if TEMP_SENSOR_2 == 0
523
-  #undef HEATER_2_MINTEMP
524
-  #undef HEATER_2_MAXTEMP
525
-#endif
526
-#if TEMP_SENSOR_3 == 0
527
-  #undef HEATER_3_MINTEMP
528
-  #undef HEATER_3_MAXTEMP
529
-#endif
530
-#if TEMP_SENSOR_BED == 0
531
-  #undef BED_MINTEMP
532
-  #undef BED_MAXTEMP
533
-#endif
534
-
347
+#include "Conditionals.h"
348
+#include "SanityCheck.h"
535 349
 
536
-#endif //__CONFIGURATION_ADV_H
350
+#endif //CONFIGURATION_ADV_H

+ 34
- 158
Marlin/example_configurations/WITBOX/Configuration.h View File

@@ -321,15 +321,6 @@ your extruder heater takes 2 minutes to hit the target on heating.
321 321
   // #define ENDSTOPPULLUP_ZMIN
322 322
 #endif
323 323
 
324
-#ifdef ENDSTOPPULLUPS
325
-  #define ENDSTOPPULLUP_XMAX
326
-  #define ENDSTOPPULLUP_YMAX
327
-  #define ENDSTOPPULLUP_ZMAX
328
-  #define ENDSTOPPULLUP_XMIN
329
-  #define ENDSTOPPULLUP_YMIN
330
-  #define ENDSTOPPULLUP_ZMIN
331
-#endif
332
-
333 324
 // The pullups are needed if you directly connect a mechanical endswitch between the signal and ground pins.
334 325
 const bool X_MIN_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop.
335 326
 const bool Y_MIN_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop.
@@ -378,10 +369,32 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
378 369
 #define Z_MAX_POS 200
379 370
 #define Z_MIN_POS 0
380 371
 
381
-#define X_MAX_LENGTH (X_MAX_POS - X_MIN_POS)
382
-#define Y_MAX_LENGTH (Y_MAX_POS - Y_MIN_POS)
383
-#define Z_MAX_LENGTH (Z_MAX_POS - Z_MIN_POS)
372
+//===========================================================================
373
+//============================= Filament Runout Sensor ======================
374
+//===========================================================================
375
+//#define FILAMENT_RUNOUT_SENSOR // Uncomment for defining a filament runout sensor such as a mechanical or opto endstop to check the existence of filament
376
+                                 // In RAMPS uses servo pin 2. Can be changed in pins file. For other boards pin definition should be made.
377
+                                 // It is assumed that when logic high = filament available
378
+                                 //                    when logic  low = filament ran out
379
+//const bool FIL_RUNOUT_INVERTING = true;  // Should be uncommented and true or false should assigned
380
+//#define ENDSTOPPULLUP_FIL_RUNOUT // Uncomment to use internal pullup for filament runout pins if the sensor is defined.
381
+
382
+//===========================================================================
383
+//============================ Manual Bed Leveling ==========================
384
+//===========================================================================
384 385
 
386
+// #define MANUAL_BED_LEVELING  // Add display menu option for bed leveling
387
+// #define MESH_BED_LEVELING    // Enable mesh bed leveling
388
+
389
+#if defined(MESH_BED_LEVELING)
390
+  #define MESH_MIN_X 10
391
+  #define MESH_MAX_X (X_MAX_POS - MESH_MIN_X)
392
+  #define MESH_MIN_Y 10
393
+  #define MESH_MAX_Y (Y_MAX_POS - MESH_MIN_Y)
394
+  #define MESH_NUM_X_POINTS 3  // Don't use more than 7 points per axis, implementation limited
395
+  #define MESH_NUM_Y_POINTS 3
396
+  #define MESH_HOME_SEARCH_Z 4  // Z after Home, bed somewhere below but above 0.0
397
+#endif  // MESH_BED_LEVELING
385 398
 
386 399
 //===========================================================================
387 400
 //============================= Bed Auto Leveling ===========================
@@ -409,12 +422,6 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
409 422
 
410 423
   #ifdef AUTO_BED_LEVELING_GRID
411 424
 
412
-    // Use one of these defines to specify the origin
413
-    // for a topographical map to be printed for your bed.
414
-    enum { OriginBackLeft, OriginFrontLeft, OriginBackRight, OriginFrontRight };
415
-    #define TOPO_ORIGIN OriginFrontLeft
416
-
417
-    // The edges of the rectangle in which to probe
418 425
     #define LEFT_PROBE_BED_POSITION 15
419 426
     #define RIGHT_PROBE_BED_POSITION 170
420 427
     #define FRONT_PROBE_BED_POSITION 20
@@ -617,112 +624,17 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
617 624
 // REMEMBER TO INSTALL LiquidCrystal_I2C.h in your ARDUINO library folder: https://github.com/kiyoshigawa/LiquidCrystal_I2C
618 625
 //#define RA_CONTROL_PANEL
619 626
 
620
-//automatic expansion
621
-#if defined (MAKRPANEL)
622
- #define DOGLCD
623
- #define SDSUPPORT
624
- #define ULTIPANEL
625
- #define NEWPANEL
626
- #define DEFAULT_LCD_CONTRAST 17
627
-#endif
628
-
629
-#if defined(miniVIKI) || defined(VIKI2)
630
- #define ULTRA_LCD  //general LCD support, also 16x2
631
- #define DOGLCD  // Support for SPI LCD 128x64 (Controller ST7565R graphic Display Family)
632
- #define ULTIMAKERCONTROLLER //as available from the Ultimaker online store.
633
- 
634
-  #ifdef miniVIKI
635
-   #define DEFAULT_LCD_CONTRAST 95
636
-  #else
637
-   #define DEFAULT_LCD_CONTRAST 40
638
-  #endif
639
-  
640
- #define ENCODER_PULSES_PER_STEP 4
641
- #define ENCODER_STEPS_PER_MENU_ITEM 1
642
-#endif
643
-
644
-#if defined (PANEL_ONE)
645
- #define SDSUPPORT
646
- #define ULTIMAKERCONTROLLER
647
-#endif
648
-
649
-#if defined (REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER)
650
- #define DOGLCD
651
- #define U8GLIB_ST7920
652
- #define REPRAP_DISCOUNT_SMART_CONTROLLER
653
-#endif
654
-
655
-#if defined(ULTIMAKERCONTROLLER) || defined(REPRAP_DISCOUNT_SMART_CONTROLLER) || defined(G3D_PANEL)
656
- #define ULTIPANEL
657
- #define NEWPANEL
658
-#endif
659
-
660
-#if defined(REPRAPWORLD_KEYPAD)
661
-  #define NEWPANEL
662
-  #define ULTIPANEL
663
-#endif
664
-#if defined(RA_CONTROL_PANEL)
665
- #define ULTIPANEL
666
- #define NEWPANEL
667
- #define LCD_I2C_TYPE_PCA8574
668
- #define LCD_I2C_ADDRESS 0x27   // I2C Address of the port expander
669
-#endif
670
-
671
-//I2C PANELS
627
+/**
628
+ * I2C Panels
629
+ */
672 630
 
673 631
 //#define LCD_I2C_SAINSMART_YWROBOT
674
-#ifdef LCD_I2C_SAINSMART_YWROBOT
675
-  // This uses the LiquidCrystal_I2C library ( https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home )
676
-  // Make sure it is placed in the Arduino libraries directory.
677
-  #define LCD_I2C_TYPE_PCF8575
678
-  #define LCD_I2C_ADDRESS 0x27   // I2C Address of the port expander
679
-  #define NEWPANEL
680
-  #define ULTIPANEL
681
-#endif
682 632
 
683 633
 // PANELOLU2 LCD with status LEDs, separate encoder and click inputs
684 634
 //#define LCD_I2C_PANELOLU2
685
-#ifdef LCD_I2C_PANELOLU2
686
-  // This uses the LiquidTWI2 library v1.2.3 or later ( https://github.com/lincomatic/LiquidTWI2 )
687
-  // Make sure the LiquidTWI2 directory is placed in the Arduino or Sketchbook libraries subdirectory.
688
-  // (v1.2.3 no longer requires you to define PANELOLU in the LiquidTWI2.h library header file)
689
-  // Note: The PANELOLU2 encoder click input can either be directly connected to a pin
690
-  //       (if BTN_ENC defined to != -1) or read through I2C (when BTN_ENC == -1).
691
-  #define LCD_I2C_TYPE_MCP23017
692
-  #define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander
693
-  #define LCD_USE_I2C_BUZZER //comment out to disable buzzer on LCD
694
-  #define NEWPANEL
695
-  #define ULTIPANEL
696
-
697
-  #ifndef ENCODER_PULSES_PER_STEP
698
-	#define ENCODER_PULSES_PER_STEP 4
699
-  #endif
700
-
701
-  #ifndef ENCODER_STEPS_PER_MENU_ITEM
702
-	#define ENCODER_STEPS_PER_MENU_ITEM 1
703
-  #endif
704
-
705
-
706
-  #ifdef LCD_USE_I2C_BUZZER
707
-	#define LCD_FEEDBACK_FREQUENCY_HZ 1000
708
-	#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100
709
-  #endif
710
-
711
-#endif
712 635
 
713 636
 // Panucatt VIKI LCD with status LEDs, integrated click & L/R/U/P buttons, separate encoder inputs
714 637
 //#define LCD_I2C_VIKI
715
-#ifdef LCD_I2C_VIKI
716
-  // This uses the LiquidTWI2 library v1.2.3 or later ( https://github.com/lincomatic/LiquidTWI2 )
717
-  // Make sure the LiquidTWI2 directory is placed in the Arduino or Sketchbook libraries subdirectory.
718
-  // Note: The pause/stop/resume LCD button pin should be connected to the Arduino
719
-  //       BTN_ENC pin (or set BTN_ENC to -1 if not used)
720
-  #define LCD_I2C_TYPE_MCP23017
721
-  #define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander
722
-  #define LCD_USE_I2C_BUZZER //comment out to disable buzzer on LCD (requires LiquidTWI2 v1.2.3 or later)
723
-  #define NEWPANEL
724
-  #define ULTIPANEL
725
-#endif
726 638
 
727 639
 // Shift register panels
728 640
 // ---------------------
@@ -730,51 +642,10 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
730 642
 // https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection 
731 643
 
732 644
 //#define SAV_3DLCD
733
-#ifdef SAV_3DLCD
734
-   #define SR_LCD_2W_NL    // Non latching 2 wire shiftregister
735
-   #define NEWPANEL
736
-   #define ULTIPANEL
737
-#endif
738
-
739
-
740
-#ifdef ULTIPANEL
741
-//  #define NEWPANEL  //enable this if you have a click-encoder panel
742
-  #define SDSUPPORT
743
-  #define ULTRA_LCD
744
-  #ifdef DOGLCD // Change number of lines to match the DOG graphic display
745
-    #define LCD_WIDTH 22
746
-    #define LCD_HEIGHT 5
747
-  #else
748
-    #define LCD_WIDTH 20
749
-    #define LCD_HEIGHT 4
750
-  #endif
751
-#else //no panel but just LCD
752
-  #ifdef ULTRA_LCD
753
-  #ifdef DOGLCD // Change number of lines to match the 128x64 graphics display
754
-    #define LCD_WIDTH 22
755
-    #define LCD_HEIGHT 5
756
-  #else
757
-    #define LCD_WIDTH 16
758
-    #define LCD_HEIGHT 2
759
-  #endif
760
-  #endif
761
-#endif
762
-
763
-// default LCD contrast for dogm-like LCD displays
764
-#ifdef DOGLCD
765
-# ifndef DEFAULT_LCD_CONTRAST
766
-#  define DEFAULT_LCD_CONTRAST 32
767
-# endif
768
-#endif
769 645
 
770 646
 // Increase the FAN pwm frequency. Removes the PWM noise but increases heating in the FET/Arduino
771 647
 //#define FAST_PWM_FAN
772 648
 
773
-// Temperature status LEDs that display the hotend and bet temperature.
774
-// If all hotends and bed temperature and temperature setpoint are < 54C then the BLUE led is on.
775
-// Otherwise the RED led is on. There is 1C hysteresis.
776
-//#define TEMP_STAT_LEDS
777
-
778 649
 // Use software PWM to drive the fan, as for the heaters. This uses a very low frequency
779 650
 // which is not ass annoying as with the hardware PWM. On the other hand, if this frequency
780 651
 // is too low, you should also increment SOFT_PWM_SCALE.
@@ -786,6 +657,11 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
786 657
 // at zero value, there are 128 effective control positions.
787 658
 #define SOFT_PWM_SCALE 0
788 659
 
660
+// Temperature status LEDs that display the hotend and bet temperature.
661
+// If all hotends and bed temperature and temperature setpoint are < 54C then the BLUE led is on.
662
+// Otherwise the RED led is on. There is 1C hysteresis.
663
+//#define TEMP_STAT_LEDS
664
+
789 665
 // M240  Triggers a camera by emulating a Canon RC-1 Remote
790 666
 // Data from: http://www.doc-diy.net/photo/rc-1_hacked/
791 667
 // #define PHOTOGRAPH_PIN     23
@@ -857,4 +733,4 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
857 733
 #include "Configuration_adv.h"
858 734
 #include "thermistortables.h"
859 735
 
860
-#endif //__CONFIGURATION_H
736
+#endif //CONFIGURATION_H

+ 10
- 201
Marlin/example_configurations/WITBOX/Configuration_adv.h View File

@@ -1,6 +1,8 @@
1 1
 #ifndef CONFIGURATION_ADV_H
2 2
 #define CONFIGURATION_ADV_H
3 3
 
4
+#include "Conditionals.h"
5
+
4 6
 //===========================================================================
5 7
 //=============================Thermal Settings  ============================
6 8
 //===========================================================================
@@ -89,54 +91,6 @@
89 91
 
90 92
 //#define ENDSTOPS_ONLY_FOR_HOMING // If defined the endstops will only be used for homing
91 93
 
92
-
93
-//// AUTOSET LOCATIONS OF LIMIT SWITCHES
94
-//// Added by ZetaPhoenix 09-15-2012
95
-#ifdef MANUAL_HOME_POSITIONS  // Use manual limit switch locations
96
-  #define X_HOME_POS MANUAL_X_HOME_POS
97
-  #define Y_HOME_POS MANUAL_Y_HOME_POS
98
-  #define Z_HOME_POS MANUAL_Z_HOME_POS
99
-#else //Set min/max homing switch positions based upon homing direction and min/max travel limits
100
-  //X axis
101
-  #if X_HOME_DIR == -1
102
-    #ifdef BED_CENTER_AT_0_0
103
-      #define X_HOME_POS X_MAX_LENGTH * -0.5
104
-    #else
105
-      #define X_HOME_POS X_MIN_POS
106
-    #endif //BED_CENTER_AT_0_0
107
-  #else
108
-    #ifdef BED_CENTER_AT_0_0
109
-      #define X_HOME_POS X_MAX_LENGTH * 0.5
110
-    #else
111
-      #define X_HOME_POS X_MAX_POS
112
-    #endif //BED_CENTER_AT_0_0
113
-  #endif //X_HOME_DIR == -1
114
-
115
-  //Y axis
116
-  #if Y_HOME_DIR == -1
117
-    #ifdef BED_CENTER_AT_0_0
118
-      #define Y_HOME_POS Y_MAX_LENGTH * -0.5
119
-    #else
120
-      #define Y_HOME_POS Y_MIN_POS
121
-    #endif //BED_CENTER_AT_0_0
122
-  #else
123
-    #ifdef BED_CENTER_AT_0_0
124
-      #define Y_HOME_POS Y_MAX_LENGTH * 0.5
125
-    #else
126
-      #define Y_HOME_POS Y_MAX_POS
127
-    #endif //BED_CENTER_AT_0_0
128
-  #endif //Y_HOME_DIR == -1
129
-
130
-  // Z axis
131
-  #if Z_HOME_DIR == -1 //BED_CENTER_AT_0_0 not used
132
-    #define Z_HOME_POS Z_MIN_POS
133
-  #else
134
-    #define Z_HOME_POS Z_MAX_POS
135
-  #endif //Z_HOME_DIR == -1
136
-#endif //End auto min/max positions
137
-//END AUTOSET LOCATIONS OF LIMIT SWITCHES -ZP
138
-
139
-
140 94
 //#define Z_LATE_ENABLE // Enable Z the last moment. Needed if your Z driver overheats.
141 95
 
142 96
 // A single Z stepper driver is usually used to drive 2 stepper motors.
@@ -146,26 +100,12 @@
146 100
 // On a RAMPS (or other 5 driver) motherboard, using this feature will limit you to using 1 extruder.
147 101
 //#define Z_DUAL_STEPPER_DRIVERS
148 102
 
149
-#ifdef Z_DUAL_STEPPER_DRIVERS
150
-  #undef EXTRUDERS
151
-  #define EXTRUDERS 1
152
-#endif
153
-
154 103
 // Same again but for Y Axis.
155 104
 //#define Y_DUAL_STEPPER_DRIVERS
156 105
 
157 106
 // Define if the two Y drives need to rotate in opposite directions
158 107
 #define INVERT_Y2_VS_Y_DIR true
159 108
 
160
-#ifdef Y_DUAL_STEPPER_DRIVERS
161
-  #undef EXTRUDERS
162
-  #define EXTRUDERS 1
163
-#endif
164
-
165
-#if defined (Z_DUAL_STEPPER_DRIVERS) && defined (Y_DUAL_STEPPER_DRIVERS)
166
-  #error "You cannot have dual drivers for both Y and Z"
167
-#endif
168
-
169 109
 // Enable this for dual x-carriage printers.
170 110
 // A dual x-carriage design has the advantage that the inactive extruder can be parked which
171 111
 // prevents hot-end ooze contaminating the print. It also reduces the weight of each x-carriage
@@ -229,20 +169,15 @@
229 169
 #define INVERT_Z_STEP_PIN false
230 170
 #define INVERT_E_STEP_PIN false
231 171
 
232
-//default stepper release if idle. Set to 0 to deactivate.
172
+// Default stepper release if idle. Set to 0 to deactivate.
233 173
 #define DEFAULT_STEPPER_DEACTIVE_TIME 60
234 174
 
235 175
 #define DEFAULT_MINIMUMFEEDRATE       0.0     // minimum feedrate
236 176
 #define DEFAULT_MINTRAVELFEEDRATE     0.0
237 177
 
238
-// Feedrates for manual moves along X, Y, Z, E from panel
239 178
 #ifdef ULTIPANEL
240
-#define MANUAL_FEEDRATE {120*60, 120*60, 18*60, 60}  // set the speeds for manual moves (mm/min)
241
-#endif
242
-
243
-//Comment to disable setting feedrate multiplier via encoder
244
-#ifdef ULTIPANEL
245
-    #define ULTIPANEL_FEEDMULTIPLY
179
+  #define MANUAL_FEEDRATE {120*60, 120*60, 18*60, 60}  // Feedrates for manual moves along X, Y, Z, E from panel
180
+  #define ULTIPANEL_FEEDMULTIPLY  // Comment to disable setting feedrate multiplier via encoder
246 181
 #endif
247 182
 
248 183
 // minimum time in microseconds that a movement needs to take if the buffer is emptied.
@@ -261,13 +196,6 @@
261 196
 // if unwanted behavior is observed on a user's machine when running at very slow speeds.
262 197
 #define MINIMUM_PLANNER_SPEED 0.05// (mm/sec)
263 198
 
264
-// MS1 MS2 Stepper Driver Microstepping mode table
265
-#define MICROSTEP1 LOW,LOW
266
-#define MICROSTEP2 HIGH,LOW
267
-#define MICROSTEP4 LOW,HIGH
268
-#define MICROSTEP8 HIGH,HIGH
269
-#define MICROSTEP16 HIGH,HIGH
270
-
271 199
 // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU.
272 200
 #define MICROSTEP_MODES {16,16,16,16,16} // [1,2,4,8,16]
273 201
 
@@ -313,12 +241,6 @@
313 241
   #define PROGRESS_MSG_EXPIRE   0
314 242
   // Enable this to show messages for MSG_TIME then hide them
315 243
   //#define PROGRESS_MSG_ONCE
316
-  #ifdef DOGLCD
317
-    #warning LCD_PROGRESS_BAR does not apply to graphical displays at this time.
318
-  #endif
319
-  #ifdef FILAMENT_LCD_DISPLAY
320
-    #error LCD_PROGRESS_BAR and FILAMENT_LCD_DISPLAY are not fully compatible. Comment out this line to use both.
321
-  #endif
322 244
 #endif
323 245
 
324 246
 // The hardware watchdog should reset the microcontroller disabling all outputs, in case the firmware gets stuck and doesn't do temperature regulation.
@@ -342,16 +264,6 @@
342 264
   #define BABYSTEP_XY  //not only z, but also XY in the menu. more clutter, more functions
343 265
   #define BABYSTEP_INVERT_Z false  //true for inverse movements in Z
344 266
   #define BABYSTEP_Z_MULTIPLICATOR 2 //faster z movements
345
-
346
-  #ifdef COREXY
347
-    #error BABYSTEPPING not implemented for COREXY yet.
348
-  #endif
349
-
350
-  #ifdef DELTA
351
-    #ifdef BABYSTEP_XY
352
-      #error BABYSTEPPING only implemented for Z axis on deltabots.
353
-    #endif
354
-  #endif
355 267
 #endif
356 268
 
357 269
 // extruder advance constant (s2/mm3)
@@ -365,12 +277,8 @@
365 277
 
366 278
 #ifdef ADVANCE
367 279
   #define EXTRUDER_ADVANCE_K .0
368
-
369 280
   #define D_FILAMENT 1.75
370 281
   #define STEPS_MM_E 100.47095761381482
371
-  #define EXTRUSION_AREA (0.25 * D_FILAMENT * D_FILAMENT * 3.14159)
372
-  #define STEPS_PER_CUBIC_MM_E (axis_steps_per_unit[E_AXIS]/ EXTRUSION_AREA)
373
-
374 282
 #endif // ADVANCE
375 283
 
376 284
 // Arc interpretation settings:
@@ -385,26 +293,6 @@ const unsigned int dropsegments=5; //everything with less than this number of st
385 293
 // be commented out otherwise
386 294
 #define SDCARDDETECTINVERTED
387 295
 
388
-#ifdef ULTIPANEL
389
- #undef SDCARDDETECTINVERTED
390
-#endif
391
-
392
-// Power Signal Control Definitions
393
-// By default use ATX definition
394
-#ifndef POWER_SUPPLY
395
-  #define POWER_SUPPLY 1
396
-#endif
397
-// 1 = ATX
398
-#if (POWER_SUPPLY == 1)
399
-  #define PS_ON_AWAKE  LOW
400
-  #define PS_ON_ASLEEP HIGH
401
-#endif
402
-// 2 = X-Box 360 203W
403
-#if (POWER_SUPPLY == 2)
404
-  #define PS_ON_AWAKE  HIGH
405
-  #define PS_ON_ASLEEP LOW
406
-#endif
407
-
408 296
 // Control heater 0 and heater 1 in parallel.
409 297
 //#define HEATERS_PARALLEL
410 298
 
@@ -444,9 +332,9 @@ const unsigned int dropsegments=5; //everything with less than this number of st
444 332
   #define RETRACT_RECOVER_FEEDRATE 8*60     //default feedrate for recovering from retraction (mm/s)
445 333
 #endif
446 334
 
447
-//adds support for experimental filament exchange support M600; requires display
335
+// Add support for experimental filament exchange support M600; requires display
448 336
 #ifdef ULTIPANEL
449
-  #define FILAMENTCHANGEENABLE
337
+  //#define FILAMENTCHANGEENABLE
450 338
   #ifdef FILAMENTCHANGEENABLE
451 339
     #define FILAMENTCHANGE_XPOS 3
452 340
     #define FILAMENTCHANGE_YPOS 3
@@ -456,86 +344,7 @@ const unsigned int dropsegments=5; //everything with less than this number of st
456 344
   #endif
457 345
 #endif
458 346
 
459
-#ifdef FILAMENTCHANGEENABLE
460
-  #ifdef EXTRUDER_RUNOUT_PREVENT
461
-    #error EXTRUDER_RUNOUT_PREVENT currently incompatible with FILAMENTCHANGE
462
-  #endif
463
-#endif
464
-
465
-//===========================================================================
466
-//=============================  Define Defines  ============================
467
-//===========================================================================
468
-
469
-#if defined (ENABLE_AUTO_BED_LEVELING) && defined (DELTA)
470
-  #error "Bed Auto Leveling is still not compatible with Delta Kinematics."
471
-#endif
472
-
473
-#if EXTRUDERS > 1 && defined TEMP_SENSOR_1_AS_REDUNDANT
474
-  #error "You cannot use TEMP_SENSOR_1_AS_REDUNDANT if EXTRUDERS > 1"
475
-#endif
476
-
477
-#if EXTRUDERS > 1 && defined HEATERS_PARALLEL
478
-  #error "You cannot use HEATERS_PARALLEL if EXTRUDERS > 1"
479
-#endif
480
-
481
-#if TEMP_SENSOR_0 > 0
482
-  #define THERMISTORHEATER_0 TEMP_SENSOR_0
483
-  #define HEATER_0_USES_THERMISTOR
484
-#endif
485
-#if TEMP_SENSOR_1 > 0
486
-  #define THERMISTORHEATER_1 TEMP_SENSOR_1
487
-  #define HEATER_1_USES_THERMISTOR
488
-#endif
489
-#if TEMP_SENSOR_2 > 0
490
-  #define THERMISTORHEATER_2 TEMP_SENSOR_2
491
-  #define HEATER_2_USES_THERMISTOR
492
-#endif
493
-#if TEMP_SENSOR_3 > 0
494
-  #define THERMISTORHEATER_3 TEMP_SENSOR_3
495
-  #define HEATER_3_USES_THERMISTOR
496
-#endif
497
-#if TEMP_SENSOR_BED > 0
498
-  #define THERMISTORBED TEMP_SENSOR_BED
499
-  #define BED_USES_THERMISTOR
500
-#endif
501
-#if TEMP_SENSOR_0 == -1
502
-  #define HEATER_0_USES_AD595
503
-#endif
504
-#if TEMP_SENSOR_1 == -1
505
-  #define HEATER_1_USES_AD595
506
-#endif
507
-#if TEMP_SENSOR_2 == -1
508
-  #define HEATER_2_USES_AD595
509
-#endif
510
-#if TEMP_SENSOR_3 == -1
511
-  #define HEATER_3_USES_AD595
512
-#endif
513
-#if TEMP_SENSOR_BED == -1
514
-  #define BED_USES_AD595
515
-#endif
516
-#if TEMP_SENSOR_0 == -2
517
-  #define HEATER_0_USES_MAX6675
518
-#endif
519
-#if TEMP_SENSOR_0 == 0
520
-  #undef HEATER_0_MINTEMP
521
-  #undef HEATER_0_MAXTEMP
522
-#endif
523
-#if TEMP_SENSOR_1 == 0
524
-  #undef HEATER_1_MINTEMP
525
-  #undef HEATER_1_MAXTEMP
526
-#endif
527
-#if TEMP_SENSOR_2 == 0
528
-  #undef HEATER_2_MINTEMP
529
-  #undef HEATER_2_MAXTEMP
530
-#endif
531
-#if TEMP_SENSOR_3 == 0
532
-  #undef HEATER_3_MINTEMP
533
-  #undef HEATER_3_MAXTEMP
534
-#endif
535
-#if TEMP_SENSOR_BED == 0
536
-  #undef BED_MINTEMP
537
-  #undef BED_MAXTEMP
538
-#endif
539
-
347
+#include "Conditionals.h"
348
+#include "SanityCheck.h"
540 349
 
541
-#endif //__CONFIGURATION_ADV_H
350
+#endif //CONFIGURATION_ADV_H

+ 45
- 163
Marlin/example_configurations/delta/generic/Configuration.h View File

@@ -137,7 +137,7 @@ Here are some standard links for getting your machine calibrated:
137 137
 // 10 is 100k RS thermistor 198-961 (4.7k pullup)
138 138
 // 11 is 100k beta 3950 1% thermistor (4.7k pullup)
139 139
 // 12 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) (calibrated for Makibox hot bed)
140
-// 13 is 100k Hisens 3950  1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE"
140
+// 13 is 100k Hisens 3950  1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE" 
141 141
 // 20 is the PT100 circuit found in the Ultimainboard V2.x
142 142
 // 60 is 100k Maker's Tool Works Kapton Bed Thermistor beta=3950
143 143
 //
@@ -151,7 +151,7 @@ Here are some standard links for getting your machine calibrated:
151 151
 // 1010 is Pt1000 with 1k pullup (non standard)
152 152
 // 147 is Pt100 with 4k7 pullup
153 153
 // 110 is Pt100 with 1k pullup (non standard)
154
-// 998 and 999 are Dummy Tables. They will ALWAYS read 25°C or the temperature defined below.
154
+// 998 and 999 are Dummy Tables. They will ALWAYS read 25°C or the temperature defined below. 
155 155
 //     Use it for Testing or Development purposes. NEVER for production machine.
156 156
 //     #define DUMMY_THERMISTOR_998_VALUE 25
157 157
 //     #define DUMMY_THERMISTOR_999_VALUE 100
@@ -298,15 +298,15 @@ The issue: If a thermistor come off, it will read a lower temperature than actua
298 298
 The system will turn the heater on forever, burning up the filament and anything
299 299
 else around.
300 300
 
301
-After the temperature reaches the target for the first time, this feature will
302
-start measuring for how long the current temperature stays below the target
301
+After the temperature reaches the target for the first time, this feature will 
302
+start measuring for how long the current temperature stays below the target 
303 303
 minus _HYSTERESIS (set_temperature - THERMAL_RUNAWAY_PROTECTION_HYSTERESIS).
304 304
 
305 305
 If it stays longer than _PERIOD, it means the thermistor temperature
306 306
 cannot catch up with the target, so something *may be* wrong. Then, to be on the
307 307
 safe side, the system will he halt.
308 308
 
309
-Bear in mind the count down will just start AFTER the first time the
309
+Bear in mind the count down will just start AFTER the first time the 
310 310
 thermistor temperature is over the target, so you will have no problem if
311 311
 your extruder heater takes 2 minutes to hit the target on heating.
312 312
 
@@ -349,15 +349,6 @@ your extruder heater takes 2 minutes to hit the target on heating.
349 349
   // #define ENDSTOPPULLUP_ZMIN
350 350
 #endif
351 351
 
352
-#ifdef ENDSTOPPULLUPS
353
-  #define ENDSTOPPULLUP_XMAX
354
-  #define ENDSTOPPULLUP_YMAX
355
-  #define ENDSTOPPULLUP_ZMAX
356
-  #define ENDSTOPPULLUP_XMIN
357
-  #define ENDSTOPPULLUP_YMIN
358
-  #define ENDSTOPPULLUP_ZMIN
359
-#endif
360
-
361 352
 // The pullups are needed if you directly connect a mechanical endswitch between the signal and ground pins.
362 353
 const bool X_MIN_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop.
363 354
 const bool Y_MIN_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop.
@@ -408,10 +399,32 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
408 399
 #define Z_MAX_POS MANUAL_Z_HOME_POS
409 400
 #define Z_MIN_POS 0
410 401
 
411
-#define X_MAX_LENGTH (X_MAX_POS - X_MIN_POS)
412
-#define Y_MAX_LENGTH (Y_MAX_POS - Y_MIN_POS)
413
-#define Z_MAX_LENGTH (Z_MAX_POS - Z_MIN_POS)
402
+//===========================================================================
403
+//============================= Filament Runout Sensor ======================
404
+//===========================================================================
405
+//#define FILAMENT_RUNOUT_SENSOR // Uncomment for defining a filament runout sensor such as a mechanical or opto endstop to check the existence of filament
406
+                                 // In RAMPS uses servo pin 2. Can be changed in pins file. For other boards pin definition should be made.
407
+                                 // It is assumed that when logic high = filament available
408
+                                 //                    when logic  low = filament ran out
409
+//const bool FIL_RUNOUT_INVERTING = true;  // Should be uncommented and true or false should assigned
410
+//#define ENDSTOPPULLUP_FIL_RUNOUT // Uncomment to use internal pullup for filament runout pins if the sensor is defined.
411
+
412
+//===========================================================================
413
+//============================ Manual Bed Leveling ==========================
414
+//===========================================================================
415
+
416
+// #define MANUAL_BED_LEVELING  // Add display menu option for bed leveling
417
+// #define MESH_BED_LEVELING    // Enable mesh bed leveling
414 418
 
419
+#if defined(MESH_BED_LEVELING)
420
+  #define MESH_MIN_X 10
421
+  #define MESH_MAX_X (X_MAX_POS - MESH_MIN_X)
422
+  #define MESH_MIN_Y 10
423
+  #define MESH_MAX_Y (Y_MAX_POS - MESH_MIN_Y)
424
+  #define MESH_NUM_X_POINTS 3  // Don't use more than 7 points per axis, implementation limited
425
+  #define MESH_NUM_Y_POINTS 3
426
+  #define MESH_HOME_SEARCH_Z 4  // Z after Home, bed somewhere below but above 0.0
427
+#endif  // MESH_BED_LEVELING
415 428
 
416 429
 //===========================================================================
417 430
 //============================= Bed Auto Leveling ===========================
@@ -429,7 +442,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
429 442
   #define LEFT_PROBE_BED_POSITION -DELTA_PROBABLE_RADIUS
430 443
   #define RIGHT_PROBE_BED_POSITION DELTA_PROBABLE_RADIUS
431 444
   #define BACK_PROBE_BED_POSITION DELTA_PROBABLE_RADIUS
432
-  #define FRONT_PROBE_BED_POSITION -DELTA_PROBABLE_RADIUS
445
+  #define FRONT_PROBE_BED_POSITION -DELTA_PROBABLE_RADIUS   
433 446
 
434 447
   // Non-linear bed leveling will be used.
435 448
   // Compensate by interpolating between the nearest four Z probe values for each point.
@@ -459,13 +472,13 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
459 472
     #define Z_PROBE_ALLEN_KEY_DEPLOY_X 30
460 473
     #define Z_PROBE_ALLEN_KEY_DEPLOY_Y DELTA_PRINTABLE_RADIUS
461 474
     #define Z_PROBE_ALLEN_KEY_DEPLOY_Z 100
462
-
475
+    
463 476
     #define Z_PROBE_ALLEN_KEY_RETRACT_X     -64
464 477
     #define Z_PROBE_ALLEN_KEY_RETRACT_Y     56
465 478
     #define Z_PROBE_ALLEN_KEY_RETRACT_Z     23
466 479
     #define Z_PROBE_ALLEN_KEY_RETRACT_DEPTH 20
467 480
   #endif
468
-
481
+  
469 482
   //If defined, the Probe servo will be turned on only during movement and then turned off to avoid jerk
470 483
   //The value is the delay to turn the servo off after powered on - depends on the servo speed; 300ms is good value, but you can try lower it.
471 484
   // You MUST HAVE the SERVO_ENDSTOPS defined to use here a value higher than zero otherwise your code will not compile.
@@ -637,164 +650,28 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
637 650
 // in ultralcd.cpp@lcd_delta_calibrate_menu()
638 651
 // #define DELTA_CALIBRATION_MENU
639 652
 
640
-//automatic expansion
641
-#if defined (MAKRPANEL)
642
- #define DOGLCD
643
- #define SDSUPPORT
644
- #define ULTIPANEL
645
- #define NEWPANEL
646
- #define DEFAULT_LCD_CONTRAST 17
647
-#endif
648
-
649
-#if defined(miniVIKI) || defined(VIKI2)
650
- #define ULTRA_LCD  //general LCD support, also 16x2
651
- #define DOGLCD  // Support for SPI LCD 128x64 (Controller ST7565R graphic Display Family)
652
- #define ULTIMAKERCONTROLLER //as available from the Ultimaker online store.
653
-
654
-  #ifdef miniVIKI
655
-   #define DEFAULT_LCD_CONTRAST 95
656
-  #else
657
-   #define DEFAULT_LCD_CONTRAST 40
658
-  #endif
659
-
660
- #define ENCODER_PULSES_PER_STEP 4
661
- #define ENCODER_STEPS_PER_MENU_ITEM 1
662
-#endif
663
-
664
-#if defined (PANEL_ONE)
665
- #define SDSUPPORT
666
- #define ULTIMAKERCONTROLLER
667
-#endif
668
-
669
-#if defined (REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER)
670
- #define DOGLCD
671
- #define U8GLIB_ST7920
672
- #define REPRAP_DISCOUNT_SMART_CONTROLLER
673
-#endif
674
-
675
-#if defined(ULTIMAKERCONTROLLER) || defined(REPRAP_DISCOUNT_SMART_CONTROLLER) || defined(G3D_PANEL)
676
- #define ULTIPANEL
677
- #define NEWPANEL
678
-#endif
679
-
680
-#if defined(REPRAPWORLD_KEYPAD)
681
-  #define NEWPANEL
682
-  #define ULTIPANEL
683
-#endif
684
-#if defined(RA_CONTROL_PANEL)
685
- #define ULTIPANEL
686
- #define NEWPANEL
687
- #define LCD_I2C_TYPE_PCA8574
688
- #define LCD_I2C_ADDRESS 0x27   // I2C Address of the port expander
689
-#endif
690
-
691
-//I2C PANELS
653
+/**
654
+ * I2C PANELS
655
+ */
692 656
 
693 657
 //#define LCD_I2C_SAINSMART_YWROBOT
694
-#ifdef LCD_I2C_SAINSMART_YWROBOT
695
-  // This uses the LiquidCrystal_I2C library ( https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home )
696
-  // Make sure it is placed in the Arduino libraries directory.
697
-  #define LCD_I2C_TYPE_PCF8575
698
-  #define LCD_I2C_ADDRESS 0x27   // I2C Address of the port expander
699
-  #define NEWPANEL
700
-  #define ULTIPANEL
701
-#endif
702 658
 
703 659
 // PANELOLU2 LCD with status LEDs, separate encoder and click inputs
704 660
 //#define LCD_I2C_PANELOLU2
705
-#ifdef LCD_I2C_PANELOLU2
706
-  // This uses the LiquidTWI2 library v1.2.3 or later ( https://github.com/lincomatic/LiquidTWI2 )
707
-  // Make sure the LiquidTWI2 directory is placed in the Arduino or Sketchbook libraries subdirectory.
708
-  // (v1.2.3 no longer requires you to define PANELOLU in the LiquidTWI2.h library header file)
709
-  // Note: The PANELOLU2 encoder click input can either be directly connected to a pin
710
-  //       (if BTN_ENC defined to != -1) or read through I2C (when BTN_ENC == -1).
711
-  #define LCD_I2C_TYPE_MCP23017
712
-  #define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander
713
-  #define LCD_USE_I2C_BUZZER //comment out to disable buzzer on LCD
714
-  #define NEWPANEL
715
-  #define ULTIPANEL
716
-
717
-  #ifndef ENCODER_PULSES_PER_STEP
718
-	#define ENCODER_PULSES_PER_STEP 4
719
-  #endif
720
-
721
-  #ifndef ENCODER_STEPS_PER_MENU_ITEM
722
-	#define ENCODER_STEPS_PER_MENU_ITEM 1
723
-  #endif
724
-
725
-
726
-  #ifdef LCD_USE_I2C_BUZZER
727
-	#define LCD_FEEDBACK_FREQUENCY_HZ 1000
728
-	#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100
729
-  #endif
730
-
731
-#endif
732 661
 
733 662
 // Panucatt VIKI LCD with status LEDs, integrated click & L/R/U/P buttons, separate encoder inputs
734 663
 //#define LCD_I2C_VIKI
735
-#ifdef LCD_I2C_VIKI
736
-  // This uses the LiquidTWI2 library v1.2.3 or later ( https://github.com/lincomatic/LiquidTWI2 )
737
-  // Make sure the LiquidTWI2 directory is placed in the Arduino or Sketchbook libraries subdirectory.
738
-  // Note: The pause/stop/resume LCD button pin should be connected to the Arduino
739
-  //       BTN_ENC pin (or set BTN_ENC to -1 if not used)
740
-  #define LCD_I2C_TYPE_MCP23017
741
-  #define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander
742
-  #define LCD_USE_I2C_BUZZER //comment out to disable buzzer on LCD (requires LiquidTWI2 v1.2.3 or later)
743
-  #define NEWPANEL
744
-  #define ULTIPANEL
745
-#endif
746 664
 
747 665
 // Shift register panels
748 666
 // ---------------------
749 667
 // 2 wire Non-latching LCD SR from:
750
-// https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection
668
+// https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection 
751 669
 
752 670
 //#define SAV_3DLCD
753
-#ifdef SAV_3DLCD
754
-   #define SR_LCD_2W_NL    // Non latching 2 wire shiftregister
755
-   #define NEWPANEL
756
-   #define ULTIPANEL
757
-#endif
758
-
759
-
760
-#ifdef ULTIPANEL
761
-//  #define NEWPANEL  //enable this if you have a click-encoder panel
762
-  #define SDSUPPORT
763
-  #define ULTRA_LCD
764
-  #ifdef DOGLCD // Change number of lines to match the DOG graphic display
765
-    #define LCD_WIDTH 22
766
-    #define LCD_HEIGHT 5
767
-  #else
768
-    #define LCD_WIDTH 20
769
-    #define LCD_HEIGHT 4
770
-  #endif
771
-#else //no panel but just LCD
772
-  #ifdef ULTRA_LCD
773
-  #ifdef DOGLCD // Change number of lines to match the 128x64 graphics display
774
-    #define LCD_WIDTH 22
775
-    #define LCD_HEIGHT 5
776
-  #else
777
-    #define LCD_WIDTH 16
778
-    #define LCD_HEIGHT 2
779
-  #endif
780
-  #endif
781
-#endif
782
-
783
-// default LCD contrast for dogm-like LCD displays
784
-#ifdef DOGLCD
785
-# ifndef DEFAULT_LCD_CONTRAST
786
-#  define DEFAULT_LCD_CONTRAST 32
787
-# endif
788
-#endif
789 671
 
790 672
 // Increase the FAN pwm frequency. Removes the PWM noise but increases heating in the FET/Arduino
791 673
 //#define FAST_PWM_FAN
792 674
 
793
-// Temperature status LEDs that display the hotend and bet temperature.
794
-// If all hotends and bed temperature and temperature setpoint are < 54C then the BLUE led is on.
795
-// Otherwise the RED led is on. There is 1C hysteresis.
796
-//#define TEMP_STAT_LEDS
797
-
798 675
 // Use software PWM to drive the fan, as for the heaters. This uses a very low frequency
799 676
 // which is not ass annoying as with the hardware PWM. On the other hand, if this frequency
800 677
 // is too low, you should also increment SOFT_PWM_SCALE.
@@ -806,6 +683,11 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
806 683
 // at zero value, there are 128 effective control positions.
807 684
 #define SOFT_PWM_SCALE 0
808 685
 
686
+// Temperature status LEDs that display the hotend and bet temperature.
687
+// If all hotends and bed temperature and temperature setpoint are < 54C then the BLUE led is on.
688
+// Otherwise the RED led is on. There is 1C hysteresis.
689
+//#define TEMP_STAT_LEDS
690
+
809 691
 // M240  Triggers a camera by emulating a Canon RC-1 Remote
810 692
 // Data from: http://www.doc-diy.net/photo/rc-1_hacked/
811 693
 // #define PHOTOGRAPH_PIN     23
@@ -845,9 +727,9 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
845 727
  * Support for a filament diameter sensor
846 728
  * Also allows adjustment of diameter at print time (vs  at slicing)
847 729
  * Single extruder only at this point (extruder 0)
848
- *
730
+ * 
849 731
  * Motherboards
850
- * 34 - RAMPS1.4 - uses Analog input 5 on the AUX2 connector
732
+ * 34 - RAMPS1.4 - uses Analog input 5 on the AUX2 connector 
851 733
  * 81 - Printrboard - Uses Analog input 2 on the Exp1 connector (version B,C,D,E)
852 734
  * 301 - Rambo  - uses Analog input 3
853 735
  * Note may require analog pins to be defined for different motherboards
@@ -877,4 +759,4 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
877 759
 #include "Configuration_adv.h"
878 760
 #include "thermistortables.h"
879 761
 
880
-#endif //__CONFIGURATION_H
762
+#endif //CONFIGURATION_H

+ 9
- 207
Marlin/example_configurations/delta/generic/Configuration_adv.h View File

@@ -1,6 +1,8 @@
1 1
 #ifndef CONFIGURATION_ADV_H
2 2
 #define CONFIGURATION_ADV_H
3 3
 
4
+#include "Conditionals.h"
5
+
4 6
 //===========================================================================
5 7
 //=============================Thermal Settings  ============================
6 8
 //===========================================================================
@@ -89,54 +91,6 @@
89 91
 
90 92
 #define ENDSTOPS_ONLY_FOR_HOMING // If defined the endstops will only be used for homing
91 93
 
92
-
93
-//// AUTOSET LOCATIONS OF LIMIT SWITCHES
94
-//// Added by ZetaPhoenix 09-15-2012
95
-#ifdef MANUAL_HOME_POSITIONS  // Use manual limit switch locations
96
-  #define X_HOME_POS MANUAL_X_HOME_POS
97
-  #define Y_HOME_POS MANUAL_Y_HOME_POS
98
-  #define Z_HOME_POS MANUAL_Z_HOME_POS
99
-#else //Set min/max homing switch positions based upon homing direction and min/max travel limits
100
-  //X axis
101
-  #if X_HOME_DIR == -1
102
-    #ifdef BED_CENTER_AT_0_0
103
-      #define X_HOME_POS X_MAX_LENGTH * -0.5
104
-    #else
105
-      #define X_HOME_POS X_MIN_POS
106
-    #endif //BED_CENTER_AT_0_0
107
-  #else    
108
-    #ifdef BED_CENTER_AT_0_0
109
-      #define X_HOME_POS X_MAX_LENGTH * 0.5
110
-    #else
111
-      #define X_HOME_POS X_MAX_POS
112
-    #endif //BED_CENTER_AT_0_0
113
-  #endif //X_HOME_DIR == -1
114
-  
115
-  //Y axis
116
-  #if Y_HOME_DIR == -1
117
-    #ifdef BED_CENTER_AT_0_0
118
-      #define Y_HOME_POS Y_MAX_LENGTH * -0.5
119
-    #else
120
-      #define Y_HOME_POS Y_MIN_POS
121
-    #endif //BED_CENTER_AT_0_0
122
-  #else    
123
-    #ifdef BED_CENTER_AT_0_0
124
-      #define Y_HOME_POS Y_MAX_LENGTH * 0.5
125
-    #else
126
-      #define Y_HOME_POS Y_MAX_POS
127
-    #endif //BED_CENTER_AT_0_0
128
-  #endif //Y_HOME_DIR == -1
129
-  
130
-  // Z axis
131
-  #if Z_HOME_DIR == -1 //BED_CENTER_AT_0_0 not used
132
-    #define Z_HOME_POS Z_MIN_POS
133
-  #else    
134
-    #define Z_HOME_POS Z_MAX_POS
135
-  #endif //Z_HOME_DIR == -1
136
-#endif //End auto min/max positions
137
-//END AUTOSET LOCATIONS OF LIMIT SWITCHES -ZP
138
-
139
-
140 94
 //#define Z_LATE_ENABLE // Enable Z the last moment. Needed if your Z driver overheats.
141 95
 
142 96
 // A single Z stepper driver is usually used to drive 2 stepper motors.
@@ -146,26 +100,12 @@
146 100
 // On a RAMPS (or other 5 driver) motherboard, using this feature will limit you to using 1 extruder.
147 101
 //#define Z_DUAL_STEPPER_DRIVERS
148 102
 
149
-#ifdef Z_DUAL_STEPPER_DRIVERS
150
-  #undef EXTRUDERS
151
-  #define EXTRUDERS 1
152
-#endif
153
-
154 103
 // Same again but for Y Axis.
155 104
 //#define Y_DUAL_STEPPER_DRIVERS
156 105
 
157 106
 // Define if the two Y drives need to rotate in opposite directions
158 107
 #define INVERT_Y2_VS_Y_DIR true
159 108
 
160
-#ifdef Y_DUAL_STEPPER_DRIVERS
161
-  #undef EXTRUDERS
162
-  #define EXTRUDERS 1
163
-#endif
164
-
165
-#if defined (Z_DUAL_STEPPER_DRIVERS) && defined (Y_DUAL_STEPPER_DRIVERS)
166
-  #error "You cannot have dual drivers for both Y and Z"
167
-#endif
168
-
169 109
 // Enable this for dual x-carriage printers. 
170 110
 // A dual x-carriage design has the advantage that the inactive extruder can be parked which
171 111
 // prevents hot-end ooze contaminating the print. It also reduces the weight of each x-carriage
@@ -228,7 +168,7 @@
228 168
 #define INVERT_Z_STEP_PIN false
229 169
 #define INVERT_E_STEP_PIN false
230 170
 
231
-//default stepper release if idle. Set to 0 to deactivate.
171
+// Default stepper release if idle. Set to 0 to deactivate.
232 172
 #define DEFAULT_STEPPER_DEACTIVE_TIME 60
233 173
 
234 174
 #define DEFAULT_MINIMUMFEEDRATE       0.0     // minimum feedrate
@@ -236,7 +176,7 @@
236 176
 
237 177
 // Feedrates for manual moves along X, Y, Z, E from panel
238 178
 #ifdef ULTIPANEL
239
-#define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60}  // set the speeds for manual moves (mm/min)
179
+  #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel
240 180
 #endif
241 181
 
242 182
 // minimum time in microseconds that a movement needs to take if the buffer is emptied.
@@ -256,13 +196,6 @@
256 196
 // if unwanted behavior is observed on a user's machine when running at very slow speeds.
257 197
 #define MINIMUM_PLANNER_SPEED 0.05// (mm/sec)
258 198
 
259
-// MS1 MS2 Stepper Driver Microstepping mode table
260
-#define MICROSTEP1 LOW,LOW
261
-#define MICROSTEP2 HIGH,LOW
262
-#define MICROSTEP4 LOW,HIGH
263
-#define MICROSTEP8 HIGH,HIGH
264
-#define MICROSTEP16 HIGH,HIGH
265
-
266 199
 // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU.
267 200
 #define MICROSTEP_MODES {16,16,16,16,16} // [1,2,4,8,16]
268 201
 
@@ -331,16 +264,6 @@
331 264
   #define BABYSTEP_XY  //not only z, but also XY in the menu. more clutter, more functions
332 265
   #define BABYSTEP_INVERT_Z false  //true for inverse movements in Z
333 266
   #define BABYSTEP_Z_MULTIPLICATOR 2 //faster z movements
334
-  
335
-  #ifdef COREXY
336
-    #error BABYSTEPPING not implemented for COREXY yet.
337
-  #endif
338
-
339
-  #ifdef DELTA
340
-    #ifdef BABYSTEP_XY
341
-      #error BABYSTEPPING only implemented for Z axis on deltabots.
342
-    #endif
343
-  #endif
344 267
 #endif
345 268
 
346 269
 // extruder advance constant (s2/mm3)
@@ -354,12 +277,8 @@
354 277
 
355 278
 #ifdef ADVANCE
356 279
   #define EXTRUDER_ADVANCE_K .0
357
-
358 280
   #define D_FILAMENT 2.85
359 281
   #define STEPS_MM_E 836
360
-  #define EXTRUSION_AREA (0.25 * D_FILAMENT * D_FILAMENT * 3.14159)
361
-  #define STEPS_PER_CUBIC_MM_E (axis_steps_per_unit[E_AXIS]/ EXTRUSION_AREA)
362
-
363 282
 #endif // ADVANCE
364 283
 
365 284
 // Arc interpretation settings:
@@ -374,26 +293,6 @@ const unsigned int dropsegments=5; //everything with less than this number of st
374 293
 // be commented out otherwise
375 294
 #define SDCARDDETECTINVERTED 
376 295
 
377
-#ifdef ULTIPANEL
378
- #undef SDCARDDETECTINVERTED
379
-#endif
380
-
381
-// Power Signal Control Definitions
382
-// By default use ATX definition
383
-#ifndef POWER_SUPPLY
384
-  #define POWER_SUPPLY 1
385
-#endif
386
-// 1 = ATX
387
-#if (POWER_SUPPLY == 1) 
388
-  #define PS_ON_AWAKE  LOW
389
-  #define PS_ON_ASLEEP HIGH
390
-#endif
391
-// 2 = X-Box 360 203W
392
-#if (POWER_SUPPLY == 2) 
393
-  #define PS_ON_AWAKE  HIGH
394
-  #define PS_ON_ASLEEP LOW
395
-#endif
396
-
397 296
 // Control heater 0 and heater 1 in parallel.
398 297
 //#define HEATERS_PARALLEL
399 298
 
@@ -433,9 +332,9 @@ const unsigned int dropsegments=5; //everything with less than this number of st
433 332
   #define RETRACT_RECOVER_FEEDRATE 8     //default feedrate for recovering from retraction (mm/s)
434 333
 #endif
435 334
 
436
-//adds support for experimental filament exchange support M600; requires display
335
+// Add support for experimental filament exchange support M600; requires display
437 336
 #ifdef ULTIPANEL
438
-  #define FILAMENTCHANGEENABLE
337
+  //#define FILAMENTCHANGEENABLE
439 338
   #ifdef FILAMENTCHANGEENABLE
440 339
     #define FILAMENTCHANGE_XPOS 3
441 340
     #define FILAMENTCHANGE_YPOS 3
@@ -445,104 +344,7 @@ const unsigned int dropsegments=5; //everything with less than this number of st
445 344
   #endif
446 345
 #endif
447 346
 
448
-#ifdef FILAMENTCHANGEENABLE
449
-  #ifdef EXTRUDER_RUNOUT_PREVENT
450
-    #error EXTRUDER_RUNOUT_PREVENT currently incompatible with FILAMENTCHANGE
451
-  #endif 
452
-#endif
453
- 
454
-//===========================================================================
455
-//=============================  Define Defines  ============================
456
-//===========================================================================
457
-
458
-#if defined (ENABLE_AUTO_BED_LEVELING) && defined (DELTA)
459
-
460
-  #if not defined(AUTO_BED_LEVELING_GRID)
461
-    #error "Only Grid Bed Auto Leveling is supported on Deltas."
462
-  #endif
463
-  
464
-  #if defined(Z_PROBE_SLED)
465
-    #error "You cannot use Z_PROBE_SLED together with DELTA."
466
-  #endif
467
-
468
-  #if defined(Z_PROBE_REPEATABILITY_TEST)
469
-    #error "Z-probe repeatability test is not supported on Deltas yet."
470
-  #endif
471
-
472
-#endif  
473
-
474
-#if defined(Z_PROBE_ALLEN_KEY)
475
-  #if !defined(AUTO_BED_LEVELING_GRID) || !defined(DELTA)
476
-    #error "Invalid use of Z_PROBE_ALLEN_KEY."
477
-  #endif
478
-#endif
479
-
480
-#if EXTRUDERS > 1 && defined TEMP_SENSOR_1_AS_REDUNDANT
481
-  #error "You cannot use TEMP_SENSOR_1_AS_REDUNDANT if EXTRUDERS > 1"
482
-#endif
483
-
484
-#if EXTRUDERS > 1 && defined HEATERS_PARALLEL
485
-  #error "You cannot use HEATERS_PARALLEL if EXTRUDERS > 1"
486
-#endif
487
-
488
-#if TEMP_SENSOR_0 > 0
489
-  #define THERMISTORHEATER_0 TEMP_SENSOR_0
490
-  #define HEATER_0_USES_THERMISTOR
491
-#endif
492
-#if TEMP_SENSOR_1 > 0
493
-  #define THERMISTORHEATER_1 TEMP_SENSOR_1
494
-  #define HEATER_1_USES_THERMISTOR
495
-#endif
496
-#if TEMP_SENSOR_2 > 0
497
-  #define THERMISTORHEATER_2 TEMP_SENSOR_2
498
-  #define HEATER_2_USES_THERMISTOR
499
-#endif
500
-#if TEMP_SENSOR_3 > 0
501
-  #define THERMISTORHEATER_3 TEMP_SENSOR_3
502
-  #define HEATER_3_USES_THERMISTOR
503
-#endif
504
-#if TEMP_SENSOR_BED > 0
505
-  #define THERMISTORBED TEMP_SENSOR_BED
506
-  #define BED_USES_THERMISTOR
507
-#endif
508
-#if TEMP_SENSOR_0 == -1
509
-  #define HEATER_0_USES_AD595
510
-#endif
511
-#if TEMP_SENSOR_1 == -1
512
-  #define HEATER_1_USES_AD595
513
-#endif
514
-#if TEMP_SENSOR_2 == -1
515
-  #define HEATER_2_USES_AD595
516
-#endif
517
-#if TEMP_SENSOR_3 == -1
518
-  #define HEATER_3_USES_AD595
519
-#endif
520
-#if TEMP_SENSOR_BED == -1
521
-  #define BED_USES_AD595
522
-#endif
523
-#if TEMP_SENSOR_0 == -2
524
-  #define HEATER_0_USES_MAX6675
525
-#endif
526
-#if TEMP_SENSOR_0 == 0
527
-  #undef HEATER_0_MINTEMP
528
-  #undef HEATER_0_MAXTEMP
529
-#endif
530
-#if TEMP_SENSOR_1 == 0
531
-  #undef HEATER_1_MINTEMP
532
-  #undef HEATER_1_MAXTEMP
533
-#endif
534
-#if TEMP_SENSOR_2 == 0
535
-  #undef HEATER_2_MINTEMP
536
-  #undef HEATER_2_MAXTEMP
537
-#endif
538
-#if TEMP_SENSOR_3 == 0
539
-  #undef HEATER_3_MINTEMP
540
-  #undef HEATER_3_MAXTEMP
541
-#endif
542
-#if TEMP_SENSOR_BED == 0
543
-  #undef BED_MINTEMP
544
-  #undef BED_MAXTEMP
545
-#endif
546
-
347
+#include "Conditionals.h"
348
+#include "SanityCheck.h"
547 349
 
548
-#endif //__CONFIGURATION_ADV_H
350
+#endif //CONFIGURATION_ADV_H

+ 47
- 165
Marlin/example_configurations/delta/kossel_mini/Configuration.h View File

@@ -138,7 +138,7 @@ Here are some standard links for getting your machine calibrated:
138 138
 // 10 is 100k RS thermistor 198-961 (4.7k pullup)
139 139
 // 11 is 100k beta 3950 1% thermistor (4.7k pullup)
140 140
 // 12 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) (calibrated for Makibox hot bed)
141
-// 13 is 100k Hisens 3950  1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE"
141
+// 13 is 100k Hisens 3950  1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE" 
142 142
 // 20 is the PT100 circuit found in the Ultimainboard V2.x
143 143
 // 60 is 100k Maker's Tool Works Kapton Bed Thermistor beta=3950
144 144
 //
@@ -152,7 +152,7 @@ Here are some standard links for getting your machine calibrated:
152 152
 // 1010 is Pt1000 with 1k pullup (non standard)
153 153
 // 147 is Pt100 with 4k7 pullup
154 154
 // 110 is Pt100 with 1k pullup (non standard)
155
-// 998 and 999 are Dummy Tables. They will ALWAYS read 25°C or the temperature defined below.
155
+// 998 and 999 are Dummy Tables. They will ALWAYS read 25°C or the temperature defined below. 
156 156
 //     Use it for Testing or Development purposes. NEVER for production machine.
157 157
 //     #define DUMMY_THERMISTOR_998_VALUE 25
158 158
 //     #define DUMMY_THERMISTOR_999_VALUE 100
@@ -299,15 +299,15 @@ The issue: If a thermistor come off, it will read a lower temperature than actua
299 299
 The system will turn the heater on forever, burning up the filament and anything
300 300
 else around.
301 301
 
302
-After the temperature reaches the target for the first time, this feature will
303
-start measuring for how long the current temperature stays below the target
302
+After the temperature reaches the target for the first time, this feature will 
303
+start measuring for how long the current temperature stays below the target 
304 304
 minus _HYSTERESIS (set_temperature - THERMAL_RUNAWAY_PROTECTION_HYSTERESIS).
305 305
 
306 306
 If it stays longer than _PERIOD, it means the thermistor temperature
307 307
 cannot catch up with the target, so something *may be* wrong. Then, to be on the
308 308
 safe side, the system will he halt.
309 309
 
310
-Bear in mind the count down will just start AFTER the first time the
310
+Bear in mind the count down will just start AFTER the first time the 
311 311
 thermistor temperature is over the target, so you will have no problem if
312 312
 your extruder heater takes 2 minutes to hit the target on heating.
313 313
 
@@ -350,15 +350,6 @@ your extruder heater takes 2 minutes to hit the target on heating.
350 350
   // #define ENDSTOPPULLUP_ZMIN
351 351
 #endif
352 352
 
353
-#ifdef ENDSTOPPULLUPS
354
-  #define ENDSTOPPULLUP_XMAX
355
-  #define ENDSTOPPULLUP_YMAX
356
-  #define ENDSTOPPULLUP_ZMAX
357
-  #define ENDSTOPPULLUP_XMIN
358
-  #define ENDSTOPPULLUP_YMIN
359
-  #define ENDSTOPPULLUP_ZMIN
360
-#endif
361
-
362 353
 // The pullups are needed if you directly connect a mechanical endswitch between the signal and ground pins.
363 354
 const bool X_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
364 355
 const bool Y_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
@@ -409,10 +400,32 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o
409 400
 #define Z_MAX_POS MANUAL_Z_HOME_POS
410 401
 #define Z_MIN_POS 0
411 402
 
412
-#define X_MAX_LENGTH (X_MAX_POS - X_MIN_POS)
413
-#define Y_MAX_LENGTH (Y_MAX_POS - Y_MIN_POS)
414
-#define Z_MAX_LENGTH (Z_MAX_POS - Z_MIN_POS)
403
+//===========================================================================
404
+//============================= Filament Runout Sensor ======================
405
+//===========================================================================
406
+//#define FILAMENT_RUNOUT_SENSOR // Uncomment for defining a filament runout sensor such as a mechanical or opto endstop to check the existence of filament
407
+                                 // In RAMPS uses servo pin 2. Can be changed in pins file. For other boards pin definition should be made.
408
+                                 // It is assumed that when logic high = filament available
409
+                                 //                    when logic  low = filament ran out
410
+//const bool FIL_RUNOUT_INVERTING = true;  // Should be uncommented and true or false should assigned
411
+//#define ENDSTOPPULLUP_FIL_RUNOUT // Uncomment to use internal pullup for filament runout pins if the sensor is defined.
412
+
413
+//===========================================================================
414
+//============================ Manual Bed Leveling ==========================
415
+//===========================================================================
416
+
417
+// #define MANUAL_BED_LEVELING  // Add display menu option for bed leveling
418
+// #define MESH_BED_LEVELING    // Enable mesh bed leveling
415 419
 
420
+#if defined(MESH_BED_LEVELING)
421
+  #define MESH_MIN_X 10
422
+  #define MESH_MAX_X (X_MAX_POS - MESH_MIN_X)
423
+  #define MESH_MIN_Y 10
424
+  #define MESH_MAX_Y (Y_MAX_POS - MESH_MIN_Y)
425
+  #define MESH_NUM_X_POINTS 3  // Don't use more than 7 points per axis, implementation limited
426
+  #define MESH_NUM_Y_POINTS 3
427
+  #define MESH_HOME_SEARCH_Z 4  // Z after Home, bed somewhere below but above 0.0
428
+#endif  // MESH_BED_LEVELING
416 429
 
417 430
 //===========================================================================
418 431
 //============================= Bed Auto Leveling ===========================
@@ -430,9 +443,9 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o
430 443
   #define LEFT_PROBE_BED_POSITION -DELTA_PROBABLE_RADIUS
431 444
   #define RIGHT_PROBE_BED_POSITION DELTA_PROBABLE_RADIUS
432 445
   #define BACK_PROBE_BED_POSITION DELTA_PROBABLE_RADIUS
433
-  #define FRONT_PROBE_BED_POSITION -DELTA_PROBABLE_RADIUS
446
+  #define FRONT_PROBE_BED_POSITION -DELTA_PROBABLE_RADIUS  
434 447
 
435
-  #define MIN_PROBE_EDGE 10 // The probe square sides can be no smaller than this
448
+  #define MIN_PROBE_EDGE 10 // The probe square sides can be no smaller than this      
436 449
 
437 450
   // Non-linear bed leveling will be used.
438 451
   // Compensate by interpolating between the nearest four Z probe values for each point.
@@ -454,7 +467,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o
454 467
   #define Z_RAISE_BEFORE_PROBING 15   //How much the extruder will be raised before traveling to the first probing point.
455 468
   #define Z_RAISE_BETWEEN_PROBINGS 5  //How much the extruder will be raised when traveling from between next probing points
456 469
   #define Z_RAISE_AFTER_PROBING 50    //How much the extruder will be raised after the last probing point.
457
-
470
+  
458 471
   // Allen key retractable z-probe as seen on many Kossel delta printers - http://reprap.org/wiki/Kossel#Automatic_bed_leveling_probe
459 472
   // Deploys by touching z-axis belt. Retracts by pushing the probe down. Uses Z_MIN_PIN.
460 473
   #define Z_PROBE_ALLEN_KEY
@@ -462,13 +475,13 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o
462 475
     #define Z_PROBE_ALLEN_KEY_DEPLOY_X 30
463 476
     #define Z_PROBE_ALLEN_KEY_DEPLOY_Y DELTA_PRINTABLE_RADIUS
464 477
     #define Z_PROBE_ALLEN_KEY_DEPLOY_Z 100
465
-
478
+    
466 479
     #define Z_PROBE_ALLEN_KEY_RETRACT_X     -64
467 480
     #define Z_PROBE_ALLEN_KEY_RETRACT_Y     56
468 481
     #define Z_PROBE_ALLEN_KEY_RETRACT_Z     23
469 482
     #define Z_PROBE_ALLEN_KEY_RETRACT_DEPTH 20
470 483
   #endif
471
-
484
+  
472 485
   //If defined, the Probe servo will be turned on only during movement and then turned off to avoid jerk
473 486
   //The value is the delay to turn the servo off after powered on - depends on the servo speed; 300ms is good value, but you can try lower it.
474 487
   // You MUST HAVE the SERVO_ENDSTOPS defined to use here a value higher than zero otherwise your code will not compile.
@@ -639,164 +652,28 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o
639 652
 // in ultralcd.cpp@lcd_delta_calibrate_menu()
640 653
 // #define DELTA_CALIBRATION_MENU
641 654
 
642
-//automatic expansion
643
-#if defined (MAKRPANEL)
644
- #define DOGLCD
645
- #define SDSUPPORT
646
- #define ULTIPANEL
647
- #define NEWPANEL
648
- #define DEFAULT_LCD_CONTRAST 17
649
-#endif
650
-
651
-#if defined(miniVIKI) || defined(VIKI2)
652
- #define ULTRA_LCD  //general LCD support, also 16x2
653
- #define DOGLCD  // Support for SPI LCD 128x64 (Controller ST7565R graphic Display Family)
654
- #define ULTIMAKERCONTROLLER //as available from the Ultimaker online store.
655
-
656
-  #ifdef miniVIKI
657
-   #define DEFAULT_LCD_CONTRAST 95
658
-  #else
659
-   #define DEFAULT_LCD_CONTRAST 40
660
-  #endif
661
-
662
- #define ENCODER_PULSES_PER_STEP 4
663
- #define ENCODER_STEPS_PER_MENU_ITEM 1
664
-#endif
665
-
666
-#if defined (PANEL_ONE)
667
- #define SDSUPPORT
668
- #define ULTIMAKERCONTROLLER
669
-#endif
670
-
671
-#if defined (REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER)
672
- #define DOGLCD
673
- #define U8GLIB_ST7920
674
- #define REPRAP_DISCOUNT_SMART_CONTROLLER
675
-#endif
676
-
677
-#if defined(ULTIMAKERCONTROLLER) || defined(REPRAP_DISCOUNT_SMART_CONTROLLER) || defined(G3D_PANEL)
678
- #define ULTIPANEL
679
- #define NEWPANEL
680
-#endif
681
-
682
-#if defined(REPRAPWORLD_KEYPAD)
683
-  #define NEWPANEL
684
-  #define ULTIPANEL
685
-#endif
686
-#if defined(RA_CONTROL_PANEL)
687
- #define ULTIPANEL
688
- #define NEWPANEL
689
- #define LCD_I2C_TYPE_PCA8574
690
- #define LCD_I2C_ADDRESS 0x27   // I2C Address of the port expander
691
-#endif
692
-
693
-//I2C PANELS
655
+/**
656
+ * I2C Panels
657
+ */
694 658
 
695 659
 //#define LCD_I2C_SAINSMART_YWROBOT
696
-#ifdef LCD_I2C_SAINSMART_YWROBOT
697
-  // This uses the LiquidCrystal_I2C library ( https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home )
698
-  // Make sure it is placed in the Arduino libraries directory.
699
-  #define LCD_I2C_TYPE_PCF8575
700
-  #define LCD_I2C_ADDRESS 0x27   // I2C Address of the port expander
701
-  #define NEWPANEL
702
-  #define ULTIPANEL
703
-#endif
704 660
 
705 661
 // PANELOLU2 LCD with status LEDs, separate encoder and click inputs
706 662
 //#define LCD_I2C_PANELOLU2
707
-#ifdef LCD_I2C_PANELOLU2
708
-  // This uses the LiquidTWI2 library v1.2.3 or later ( https://github.com/lincomatic/LiquidTWI2 )
709
-  // Make sure the LiquidTWI2 directory is placed in the Arduino or Sketchbook libraries subdirectory.
710
-  // (v1.2.3 no longer requires you to define PANELOLU in the LiquidTWI2.h library header file)
711
-  // Note: The PANELOLU2 encoder click input can either be directly connected to a pin
712
-  //       (if BTN_ENC defined to != -1) or read through I2C (when BTN_ENC == -1).
713
-  #define LCD_I2C_TYPE_MCP23017
714
-  #define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander
715
-  #define LCD_USE_I2C_BUZZER //comment out to disable buzzer on LCD
716
-  #define NEWPANEL
717
-  #define ULTIPANEL
718
-
719
-  #ifndef ENCODER_PULSES_PER_STEP
720
-	#define ENCODER_PULSES_PER_STEP 4
721
-  #endif
722
-
723
-  #ifndef ENCODER_STEPS_PER_MENU_ITEM
724
-	#define ENCODER_STEPS_PER_MENU_ITEM 1
725
-  #endif
726
-
727
-
728
-  #ifdef LCD_USE_I2C_BUZZER
729
-	#define LCD_FEEDBACK_FREQUENCY_HZ 1000
730
-	#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100
731
-  #endif
732
-
733
-#endif
734 663
 
735 664
 // Panucatt VIKI LCD with status LEDs, integrated click & L/R/U/P buttons, separate encoder inputs
736 665
 //#define LCD_I2C_VIKI
737
-#ifdef LCD_I2C_VIKI
738
-  // This uses the LiquidTWI2 library v1.2.3 or later ( https://github.com/lincomatic/LiquidTWI2 )
739
-  // Make sure the LiquidTWI2 directory is placed in the Arduino or Sketchbook libraries subdirectory.
740
-  // Note: The pause/stop/resume LCD button pin should be connected to the Arduino
741
-  //       BTN_ENC pin (or set BTN_ENC to -1 if not used)
742
-  #define LCD_I2C_TYPE_MCP23017
743
-  #define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander
744
-  #define LCD_USE_I2C_BUZZER //comment out to disable buzzer on LCD (requires LiquidTWI2 v1.2.3 or later)
745
-  #define NEWPANEL
746
-  #define ULTIPANEL
747
-#endif
748 666
 
749 667
 // Shift register panels
750 668
 // ---------------------
751 669
 // 2 wire Non-latching LCD SR from:
752
-// https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection
670
+// https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection 
753 671
 
754 672
 //#define SAV_3DLCD
755
-#ifdef SAV_3DLCD
756
-   #define SR_LCD_2W_NL    // Non latching 2 wire shiftregister
757
-   #define NEWPANEL
758
-   #define ULTIPANEL
759
-#endif
760
-
761
-
762
-#ifdef ULTIPANEL
763
-//  #define NEWPANEL  //enable this if you have a click-encoder panel
764
-  #define SDSUPPORT
765
-  #define ULTRA_LCD
766
-  #ifdef DOGLCD // Change number of lines to match the DOG graphic display
767
-    #define LCD_WIDTH 22
768
-    #define LCD_HEIGHT 5
769
-  #else
770
-    #define LCD_WIDTH 20
771
-    #define LCD_HEIGHT 4
772
-  #endif
773
-#else //no panel but just LCD
774
-  #ifdef ULTRA_LCD
775
-  #ifdef DOGLCD // Change number of lines to match the 128x64 graphics display
776
-    #define LCD_WIDTH 22
777
-    #define LCD_HEIGHT 5
778
-  #else
779
-    #define LCD_WIDTH 16
780
-    #define LCD_HEIGHT 2
781
-  #endif
782
-  #endif
783
-#endif
784
-
785
-// default LCD contrast for dogm-like LCD displays
786
-#ifdef DOGLCD
787
-# ifndef DEFAULT_LCD_CONTRAST
788
-#  define DEFAULT_LCD_CONTRAST 32
789
-# endif
790
-#endif
791 673
 
792 674
 // Increase the FAN pwm frequency. Removes the PWM noise but increases heating in the FET/Arduino
793 675
 //#define FAST_PWM_FAN
794 676
 
795
-// Temperature status LEDs that display the hotend and bet temperature.
796
-// If all hotends and bed temperature and temperature setpoint are < 54C then the BLUE led is on.
797
-// Otherwise the RED led is on. There is 1C hysteresis.
798
-//#define TEMP_STAT_LEDS
799
-
800 677
 // Use software PWM to drive the fan, as for the heaters. This uses a very low frequency
801 678
 // which is not ass annoying as with the hardware PWM. On the other hand, if this frequency
802 679
 // is too low, you should also increment SOFT_PWM_SCALE.
@@ -808,6 +685,11 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o
808 685
 // at zero value, there are 128 effective control positions.
809 686
 #define SOFT_PWM_SCALE 0
810 687
 
688
+// Temperature status LEDs that display the hotend and bet temperature.
689
+// If all hotends and bed temperature and temperature setpoint are < 54C then the BLUE led is on.
690
+// Otherwise the RED led is on. There is 1C hysteresis.
691
+//#define TEMP_STAT_LEDS
692
+
811 693
 // M240  Triggers a camera by emulating a Canon RC-1 Remote
812 694
 // Data from: http://www.doc-diy.net/photo/rc-1_hacked/
813 695
 // #define PHOTOGRAPH_PIN     23
@@ -847,9 +729,9 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o
847 729
  * Support for a filament diameter sensor
848 730
  * Also allows adjustment of diameter at print time (vs  at slicing)
849 731
  * Single extruder only at this point (extruder 0)
850
- *
732
+ * 
851 733
  * Motherboards
852
- * 34 - RAMPS1.4 - uses Analog input 5 on the AUX2 connector
734
+ * 34 - RAMPS1.4 - uses Analog input 5 on the AUX2 connector 
853 735
  * 81 - Printrboard - Uses Analog input 2 on the Exp1 connector (version B,C,D,E)
854 736
  * 301 - Rambo  - uses Analog input 3
855 737
  * Note may require analog pins to be defined for different motherboards
@@ -879,4 +761,4 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o
879 761
 #include "Configuration_adv.h"
880 762
 #include "thermistortables.h"
881 763
 
882
-#endif //__CONFIGURATION_H
764
+#endif //CONFIGURATION_H

+ 9
- 207
Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h View File

@@ -1,6 +1,8 @@
1 1
 #ifndef CONFIGURATION_ADV_H
2 2
 #define CONFIGURATION_ADV_H
3 3
 
4
+#include "Conditionals.h"
5
+
4 6
 //===========================================================================
5 7
 //=============================Thermal Settings  ============================
6 8
 //===========================================================================
@@ -89,54 +91,6 @@
89 91
 
90 92
 #define ENDSTOPS_ONLY_FOR_HOMING // If defined the endstops will only be used for homing
91 93
 
92
-
93
-//// AUTOSET LOCATIONS OF LIMIT SWITCHES
94
-//// Added by ZetaPhoenix 09-15-2012
95
-#ifdef MANUAL_HOME_POSITIONS  // Use manual limit switch locations
96
-  #define X_HOME_POS MANUAL_X_HOME_POS
97
-  #define Y_HOME_POS MANUAL_Y_HOME_POS
98
-  #define Z_HOME_POS MANUAL_Z_HOME_POS
99
-#else //Set min/max homing switch positions based upon homing direction and min/max travel limits
100
-  //X axis
101
-  #if X_HOME_DIR == -1
102
-    #ifdef BED_CENTER_AT_0_0
103
-      #define X_HOME_POS X_MAX_LENGTH * -0.5
104
-    #else
105
-      #define X_HOME_POS X_MIN_POS
106
-    #endif //BED_CENTER_AT_0_0
107
-  #else    
108
-    #ifdef BED_CENTER_AT_0_0
109
-      #define X_HOME_POS X_MAX_LENGTH * 0.5
110
-    #else
111
-      #define X_HOME_POS X_MAX_POS
112
-    #endif //BED_CENTER_AT_0_0
113
-  #endif //X_HOME_DIR == -1
114
-  
115
-  //Y axis
116
-  #if Y_HOME_DIR == -1
117
-    #ifdef BED_CENTER_AT_0_0
118
-      #define Y_HOME_POS Y_MAX_LENGTH * -0.5
119
-    #else
120
-      #define Y_HOME_POS Y_MIN_POS
121
-    #endif //BED_CENTER_AT_0_0
122
-  #else    
123
-    #ifdef BED_CENTER_AT_0_0
124
-      #define Y_HOME_POS Y_MAX_LENGTH * 0.5
125
-    #else
126
-      #define Y_HOME_POS Y_MAX_POS
127
-    #endif //BED_CENTER_AT_0_0
128
-  #endif //Y_HOME_DIR == -1
129
-  
130
-  // Z axis
131
-  #if Z_HOME_DIR == -1 //BED_CENTER_AT_0_0 not used
132
-    #define Z_HOME_POS Z_MIN_POS
133
-  #else    
134
-    #define Z_HOME_POS Z_MAX_POS
135
-  #endif //Z_HOME_DIR == -1
136
-#endif //End auto min/max positions
137
-//END AUTOSET LOCATIONS OF LIMIT SWITCHES -ZP
138
-
139
-
140 94
 //#define Z_LATE_ENABLE // Enable Z the last moment. Needed if your Z driver overheats.
141 95
 
142 96
 // A single Z stepper driver is usually used to drive 2 stepper motors.
@@ -146,26 +100,12 @@
146 100
 // On a RAMPS (or other 5 driver) motherboard, using this feature will limit you to using 1 extruder.
147 101
 //#define Z_DUAL_STEPPER_DRIVERS
148 102
 
149
-#ifdef Z_DUAL_STEPPER_DRIVERS
150
-  #undef EXTRUDERS
151
-  #define EXTRUDERS 1
152
-#endif
153
-
154 103
 // Same again but for Y Axis.
155 104
 //#define Y_DUAL_STEPPER_DRIVERS
156 105
 
157 106
 // Define if the two Y drives need to rotate in opposite directions
158 107
 #define INVERT_Y2_VS_Y_DIR true
159 108
 
160
-#ifdef Y_DUAL_STEPPER_DRIVERS
161
-  #undef EXTRUDERS
162
-  #define EXTRUDERS 1
163
-#endif
164
-
165
-#if defined (Z_DUAL_STEPPER_DRIVERS) && defined (Y_DUAL_STEPPER_DRIVERS)
166
-  #error "You cannot have dual drivers for both Y and Z"
167
-#endif
168
-
169 109
 // Enable this for dual x-carriage printers. 
170 110
 // A dual x-carriage design has the advantage that the inactive extruder can be parked which
171 111
 // prevents hot-end ooze contaminating the print. It also reduces the weight of each x-carriage
@@ -228,7 +168,7 @@
228 168
 #define INVERT_Z_STEP_PIN false
229 169
 #define INVERT_E_STEP_PIN false
230 170
 
231
-//default stepper release if idle. Set to 0 to deactivate.
171
+// Default stepper release if idle. Set to 0 to deactivate.
232 172
 #define DEFAULT_STEPPER_DEACTIVE_TIME 60
233 173
 
234 174
 #define DEFAULT_MINIMUMFEEDRATE       0.0     // minimum feedrate
@@ -236,7 +176,7 @@
236 176
 
237 177
 // Feedrates for manual moves along X, Y, Z, E from panel
238 178
 #ifdef ULTIPANEL
239
-#define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60}  // set the speeds for manual moves (mm/min)
179
+  #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel
240 180
 #endif
241 181
 
242 182
 // minimum time in microseconds that a movement needs to take if the buffer is emptied.
@@ -255,13 +195,6 @@
255 195
 // if unwanted behavior is observed on a user's machine when running at very slow speeds.
256 196
 #define MINIMUM_PLANNER_SPEED 0.05// (mm/sec)
257 197
 
258
-// MS1 MS2 Stepper Driver Microstepping mode table
259
-#define MICROSTEP1 LOW,LOW
260
-#define MICROSTEP2 HIGH,LOW
261
-#define MICROSTEP4 LOW,HIGH
262
-#define MICROSTEP8 HIGH,HIGH
263
-#define MICROSTEP16 HIGH,HIGH
264
-
265 198
 // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU.
266 199
 #define MICROSTEP_MODES {16,16,16,16,16} // [1,2,4,8,16]
267 200
 
@@ -330,16 +263,6 @@
330 263
   #define BABYSTEP_XY  //not only z, but also XY in the menu. more clutter, more functions
331 264
   #define BABYSTEP_INVERT_Z false  //true for inverse movements in Z
332 265
   #define BABYSTEP_Z_MULTIPLICATOR 2 //faster z movements
333
-  
334
-  #ifdef COREXY
335
-    #error BABYSTEPPING not implemented for COREXY yet.
336
-  #endif
337
-
338
-  #ifdef DELTA
339
-    #ifdef BABYSTEP_XY
340
-      #error BABYSTEPPING only implemented for Z axis on deltabots.
341
-    #endif
342
-  #endif
343 266
 #endif
344 267
 
345 268
 // extruder advance constant (s2/mm3)
@@ -353,12 +276,8 @@
353 276
 
354 277
 #ifdef ADVANCE
355 278
   #define EXTRUDER_ADVANCE_K .0
356
-
357 279
   #define D_FILAMENT 2.85
358 280
   #define STEPS_MM_E 836
359
-  #define EXTRUSION_AREA (0.25 * D_FILAMENT * D_FILAMENT * 3.14159)
360
-  #define STEPS_PER_CUBIC_MM_E (axis_steps_per_unit[E_AXIS]/ EXTRUSION_AREA)
361
-
362 281
 #endif // ADVANCE
363 282
 
364 283
 // Arc interpretation settings:
@@ -373,26 +292,6 @@ const unsigned int dropsegments=5; //everything with less than this number of st
373 292
 // be commented out otherwise
374 293
 #define SDCARDDETECTINVERTED 
375 294
 
376
-#ifdef ULTIPANEL
377
- #undef SDCARDDETECTINVERTED
378
-#endif
379
-
380
-// Power Signal Control Definitions
381
-// By default use ATX definition
382
-#ifndef POWER_SUPPLY
383
-  #define POWER_SUPPLY 1
384
-#endif
385
-// 1 = ATX
386
-#if (POWER_SUPPLY == 1) 
387
-  #define PS_ON_AWAKE  LOW
388
-  #define PS_ON_ASLEEP HIGH
389
-#endif
390
-// 2 = X-Box 360 203W
391
-#if (POWER_SUPPLY == 2) 
392
-  #define PS_ON_AWAKE  HIGH
393
-  #define PS_ON_ASLEEP LOW
394
-#endif
395
-
396 295
 // Control heater 0 and heater 1 in parallel.
397 296
 //#define HEATERS_PARALLEL
398 297
 
@@ -432,9 +331,9 @@ const unsigned int dropsegments=5; //everything with less than this number of st
432 331
   #define RETRACT_RECOVER_FEEDRATE 8     //default feedrate for recovering from retraction (mm/s)
433 332
 #endif
434 333
 
435
-//adds support for experimental filament exchange support M600; requires display
334
+// Add support for experimental filament exchange support M600; requires display
436 335
 #ifdef ULTIPANEL
437
-  #define FILAMENTCHANGEENABLE
336
+  //#define FILAMENTCHANGEENABLE
438 337
   #ifdef FILAMENTCHANGEENABLE
439 338
     #define FILAMENTCHANGE_XPOS 3
440 339
     #define FILAMENTCHANGE_YPOS 3
@@ -444,104 +343,7 @@ const unsigned int dropsegments=5; //everything with less than this number of st
444 343
   #endif
445 344
 #endif
446 345
 
447
-#ifdef FILAMENTCHANGEENABLE
448
-  #ifdef EXTRUDER_RUNOUT_PREVENT
449
-    #error EXTRUDER_RUNOUT_PREVENT currently incompatible with FILAMENTCHANGE
450
-  #endif 
451
-#endif
452
- 
453
-//===========================================================================
454
-//=============================  Define Defines  ============================
455
-//===========================================================================
456
-
457
-#if defined (ENABLE_AUTO_BED_LEVELING) && defined (DELTA)
458
-
459
-  #if not defined(AUTO_BED_LEVELING_GRID)
460
-    #error "Only Grid Bed Auto Leveling is supported on Deltas."
461
-  #endif
462
-  
463
-  #if defined(Z_PROBE_SLED)
464
-    #error "You cannot use Z_PROBE_SLED together with DELTA."
465
-  #endif
466
-
467
-  #if defined(Z_PROBE_REPEATABILITY_TEST)
468
-    #error "Z-probe repeatability test is not supported on Deltas yet."
469
-  #endif
470
-
471
-#endif  
472
-
473
-#if defined(Z_PROBE_ALLEN_KEY)
474
-  #if !defined(AUTO_BED_LEVELING_GRID) || !defined(DELTA)
475
-    #error "Invalid use of Z_PROBE_ALLEN_KEY."
476
-  #endif
477
-#endif
478
-
479
-#if EXTRUDERS > 1 && defined TEMP_SENSOR_1_AS_REDUNDANT
480
-  #error "You cannot use TEMP_SENSOR_1_AS_REDUNDANT if EXTRUDERS > 1"
481
-#endif
482
-
483
-#if EXTRUDERS > 1 && defined HEATERS_PARALLEL
484
-  #error "You cannot use HEATERS_PARALLEL if EXTRUDERS > 1"
485
-#endif
486
-
487
-#if TEMP_SENSOR_0 > 0
488
-  #define THERMISTORHEATER_0 TEMP_SENSOR_0
489
-  #define HEATER_0_USES_THERMISTOR
490
-#endif
491
-#if TEMP_SENSOR_1 > 0
492
-  #define THERMISTORHEATER_1 TEMP_SENSOR_1
493
-  #define HEATER_1_USES_THERMISTOR
494
-#endif
495
-#if TEMP_SENSOR_2 > 0
496
-  #define THERMISTORHEATER_2 TEMP_SENSOR_2
497
-  #define HEATER_2_USES_THERMISTOR
498
-#endif
499
-#if TEMP_SENSOR_3 > 0
500
-  #define THERMISTORHEATER_3 TEMP_SENSOR_3
501
-  #define HEATER_3_USES_THERMISTOR
502
-#endif
503
-#if TEMP_SENSOR_BED > 0
504
-  #define THERMISTORBED TEMP_SENSOR_BED
505
-  #define BED_USES_THERMISTOR
506
-#endif
507
-#if TEMP_SENSOR_0 == -1
508
-  #define HEATER_0_USES_AD595
509
-#endif
510
-#if TEMP_SENSOR_1 == -1
511
-  #define HEATER_1_USES_AD595
512
-#endif
513
-#if TEMP_SENSOR_2 == -1
514
-  #define HEATER_2_USES_AD595
515
-#endif
516
-#if TEMP_SENSOR_3 == -1
517
-  #define HEATER_3_USES_AD595
518
-#endif
519
-#if TEMP_SENSOR_BED == -1
520
-  #define BED_USES_AD595
521
-#endif
522
-#if TEMP_SENSOR_0 == -2
523
-  #define HEATER_0_USES_MAX6675
524
-#endif
525
-#if TEMP_SENSOR_0 == 0
526
-  #undef HEATER_0_MINTEMP
527
-  #undef HEATER_0_MAXTEMP
528
-#endif
529
-#if TEMP_SENSOR_1 == 0
530
-  #undef HEATER_1_MINTEMP
531
-  #undef HEATER_1_MAXTEMP
532
-#endif
533
-#if TEMP_SENSOR_2 == 0
534
-  #undef HEATER_2_MINTEMP
535
-  #undef HEATER_2_MAXTEMP
536
-#endif
537
-#if TEMP_SENSOR_3 == 0
538
-  #undef HEATER_3_MINTEMP
539
-  #undef HEATER_3_MAXTEMP
540
-#endif
541
-#if TEMP_SENSOR_BED == 0
542
-  #undef BED_MINTEMP
543
-  #undef BED_MAXTEMP
544
-#endif
545
-
346
+#include "Conditionals.h"
347
+#include "SanityCheck.h"
546 348
 
547
-#endif //__CONFIGURATION_ADV_H
349
+#endif //CONFIGURATION_ADV_H

+ 34
- 158
Marlin/example_configurations/makibox/Configuration.h View File

@@ -319,15 +319,6 @@ your extruder heater takes 2 minutes to hit the target on heating.
319 319
   // #define ENDSTOPPULLUP_ZMIN
320 320
 #endif
321 321
 
322
-#ifdef ENDSTOPPULLUPS
323
-  #define ENDSTOPPULLUP_XMAX
324
-  #define ENDSTOPPULLUP_YMAX
325
-  #define ENDSTOPPULLUP_ZMAX
326
-  #define ENDSTOPPULLUP_XMIN
327
-  #define ENDSTOPPULLUP_YMIN
328
-  #define ENDSTOPPULLUP_ZMIN
329
-#endif
330
-
331 322
 // The pullups are needed if you directly connect a mechanical endswitch between the signal and ground pins.
332 323
 const bool X_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
333 324
 const bool Y_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
@@ -376,10 +367,32 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
376 367
 #define Z_MAX_POS 86
377 368
 #define Z_MIN_POS 0
378 369
 
379
-#define X_MAX_LENGTH (X_MAX_POS - X_MIN_POS)
380
-#define Y_MAX_LENGTH (Y_MAX_POS - Y_MIN_POS)
381
-#define Z_MAX_LENGTH (Z_MAX_POS - Z_MIN_POS)
370
+//===========================================================================
371
+//============================= Filament Runout Sensor ======================
372
+//===========================================================================
373
+//#define FILAMENT_RUNOUT_SENSOR // Uncomment for defining a filament runout sensor such as a mechanical or opto endstop to check the existence of filament
374
+                                 // In RAMPS uses servo pin 2. Can be changed in pins file. For other boards pin definition should be made.
375
+                                 // It is assumed that when logic high = filament available
376
+                                 //                    when logic  low = filament ran out
377
+//const bool FIL_RUNOUT_INVERTING = true;  // Should be uncommented and true or false should assigned
378
+//#define ENDSTOPPULLUP_FIL_RUNOUT // Uncomment to use internal pullup for filament runout pins if the sensor is defined.
379
+
380
+//===========================================================================
381
+//============================ Manual Bed Leveling ==========================
382
+//===========================================================================
382 383
 
384
+// #define MANUAL_BED_LEVELING  // Add display menu option for bed leveling
385
+// #define MESH_BED_LEVELING    // Enable mesh bed leveling
386
+
387
+#if defined(MESH_BED_LEVELING)
388
+  #define MESH_MIN_X 10
389
+  #define MESH_MAX_X (X_MAX_POS - MESH_MIN_X)
390
+  #define MESH_MIN_Y 10
391
+  #define MESH_MAX_Y (Y_MAX_POS - MESH_MIN_Y)
392
+  #define MESH_NUM_X_POINTS 3  // Don't use more than 7 points per axis, implementation limited
393
+  #define MESH_NUM_Y_POINTS 3
394
+  #define MESH_HOME_SEARCH_Z 4  // Z after Home, bed somewhere below but above 0.0
395
+#endif  // MESH_BED_LEVELING
383 396
 
384 397
 //===========================================================================
385 398
 //============================= Bed Auto Leveling ===========================
@@ -407,12 +420,6 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
407 420
 
408 421
   #ifdef AUTO_BED_LEVELING_GRID
409 422
 
410
-    // Use one of these defines to specify the origin
411
-    // for a topographical map to be printed for your bed.
412
-    enum { OriginBackLeft, OriginFrontLeft, OriginBackRight, OriginFrontRight };
413
-    #define TOPO_ORIGIN OriginFrontLeft
414
-
415
-    // The edges of the rectangle in which to probe
416 423
     #define LEFT_PROBE_BED_POSITION 15
417 424
     #define RIGHT_PROBE_BED_POSITION 170
418 425
     #define FRONT_PROBE_BED_POSITION 20
@@ -615,112 +622,17 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
615 622
 // REMEMBER TO INSTALL LiquidCrystal_I2C.h in your ARDUINO library folder: https://github.com/kiyoshigawa/LiquidCrystal_I2C
616 623
 //#define RA_CONTROL_PANEL
617 624
 
618
-//automatic expansion
619
-#if defined (MAKRPANEL)
620
- #define DOGLCD
621
- #define SDSUPPORT
622
- #define ULTIPANEL
623
- #define NEWPANEL
624
- #define DEFAULT_LCD_CONTRAST 17
625
-#endif
626
-
627
-#if defined(miniVIKI) || defined(VIKI2)
628
- #define ULTRA_LCD  //general LCD support, also 16x2
629
- #define DOGLCD  // Support for SPI LCD 128x64 (Controller ST7565R graphic Display Family)
630
- #define ULTIMAKERCONTROLLER //as available from the Ultimaker online store.
631
- 
632
-  #ifdef miniVIKI
633
-   #define DEFAULT_LCD_CONTRAST 95
634
-  #else
635
-   #define DEFAULT_LCD_CONTRAST 40
636
-  #endif
637
-  
638
- #define ENCODER_PULSES_PER_STEP 4
639
- #define ENCODER_STEPS_PER_MENU_ITEM 1
640
-#endif
641
-
642
-#if defined (PANEL_ONE)
643
- #define SDSUPPORT
644
- #define ULTIMAKERCONTROLLER
645
-#endif
646
-
647
-#if defined (REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER)
648
- #define DOGLCD
649
- #define U8GLIB_ST7920
650
- #define REPRAP_DISCOUNT_SMART_CONTROLLER
651
-#endif
652
-
653
-#if defined(ULTIMAKERCONTROLLER) || defined(REPRAP_DISCOUNT_SMART_CONTROLLER) || defined(G3D_PANEL)
654
- #define ULTIPANEL
655
- #define NEWPANEL
656
-#endif
657
-
658
-#if defined(REPRAPWORLD_KEYPAD)
659
-  #define NEWPANEL
660
-  #define ULTIPANEL
661
-#endif
662
-#if defined(RA_CONTROL_PANEL)
663
- #define ULTIPANEL
664
- #define NEWPANEL
665
- #define LCD_I2C_TYPE_PCA8574
666
- #define LCD_I2C_ADDRESS 0x27   // I2C Address of the port expander
667
-#endif
668
-
669
-//I2C PANELS
625
+/**
626
+ * I2C Panels
627
+ */
670 628
 
671 629
 //#define LCD_I2C_SAINSMART_YWROBOT
672
-#ifdef LCD_I2C_SAINSMART_YWROBOT
673
-  // This uses the LiquidCrystal_I2C library ( https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home )
674
-  // Make sure it is placed in the Arduino libraries directory.
675
-  #define LCD_I2C_TYPE_PCF8575
676
-  #define LCD_I2C_ADDRESS 0x27   // I2C Address of the port expander
677
-  #define NEWPANEL
678
-  #define ULTIPANEL
679
-#endif
680 630
 
681 631
 // PANELOLU2 LCD with status LEDs, separate encoder and click inputs
682 632
 //#define LCD_I2C_PANELOLU2
683
-#ifdef LCD_I2C_PANELOLU2
684
-  // This uses the LiquidTWI2 library v1.2.3 or later ( https://github.com/lincomatic/LiquidTWI2 )
685
-  // Make sure the LiquidTWI2 directory is placed in the Arduino or Sketchbook libraries subdirectory.
686
-  // (v1.2.3 no longer requires you to define PANELOLU in the LiquidTWI2.h library header file)
687
-  // Note: The PANELOLU2 encoder click input can either be directly connected to a pin
688
-  //       (if BTN_ENC defined to != -1) or read through I2C (when BTN_ENC == -1).
689
-  #define LCD_I2C_TYPE_MCP23017
690
-  #define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander
691
-  #define LCD_USE_I2C_BUZZER //comment out to disable buzzer on LCD
692
-  #define NEWPANEL
693
-  #define ULTIPANEL
694
-
695
-  #ifndef ENCODER_PULSES_PER_STEP
696
-	#define ENCODER_PULSES_PER_STEP 4
697
-  #endif
698
-
699
-  #ifndef ENCODER_STEPS_PER_MENU_ITEM
700
-	#define ENCODER_STEPS_PER_MENU_ITEM 1
701
-  #endif
702
-
703
-
704
-  #ifdef LCD_USE_I2C_BUZZER
705
-	#define LCD_FEEDBACK_FREQUENCY_HZ 1000
706
-	#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100
707
-  #endif
708
-
709
-#endif
710 633
 
711 634
 // Panucatt VIKI LCD with status LEDs, integrated click & L/R/U/P buttons, separate encoder inputs
712 635
 //#define LCD_I2C_VIKI
713
-#ifdef LCD_I2C_VIKI
714
-  // This uses the LiquidTWI2 library v1.2.3 or later ( https://github.com/lincomatic/LiquidTWI2 )
715
-  // Make sure the LiquidTWI2 directory is placed in the Arduino or Sketchbook libraries subdirectory.
716
-  // Note: The pause/stop/resume LCD button pin should be connected to the Arduino
717
-  //       BTN_ENC pin (or set BTN_ENC to -1 if not used)
718
-  #define LCD_I2C_TYPE_MCP23017
719
-  #define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander
720
-  #define LCD_USE_I2C_BUZZER //comment out to disable buzzer on LCD (requires LiquidTWI2 v1.2.3 or later)
721
-  #define NEWPANEL
722
-  #define ULTIPANEL
723
-#endif
724 636
 
725 637
 // Shift register panels
726 638
 // ---------------------
@@ -728,51 +640,10 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
728 640
 // https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection 
729 641
 
730 642
 //#define SAV_3DLCD
731
-#ifdef SAV_3DLCD
732
-   #define SR_LCD_2W_NL    // Non latching 2 wire shiftregister
733
-   #define NEWPANEL
734
-   #define ULTIPANEL
735
-#endif
736
-
737
-
738
-#ifdef ULTIPANEL
739
-//  #define NEWPANEL  //enable this if you have a click-encoder panel
740
-  #define SDSUPPORT
741
-  #define ULTRA_LCD
742
-  #ifdef DOGLCD // Change number of lines to match the DOG graphic display
743
-    #define LCD_WIDTH 22
744
-    #define LCD_HEIGHT 5
745
-  #else
746
-    #define LCD_WIDTH 20
747
-    #define LCD_HEIGHT 4
748
-  #endif
749
-#else //no panel but just LCD
750
-  #ifdef ULTRA_LCD
751
-  #ifdef DOGLCD // Change number of lines to match the 128x64 graphics display
752
-    #define LCD_WIDTH 22
753
-    #define LCD_HEIGHT 5
754
-  #else
755
-    #define LCD_WIDTH 16
756
-    #define LCD_HEIGHT 2
757
-  #endif
758
-  #endif
759
-#endif
760
-
761
-// default LCD contrast for dogm-like LCD displays
762
-#ifdef DOGLCD
763
-# ifndef DEFAULT_LCD_CONTRAST
764
-#  define DEFAULT_LCD_CONTRAST 32
765
-# endif
766
-#endif
767 643
 
768 644
 // Increase the FAN pwm frequency. Removes the PWM noise but increases heating in the FET/Arduino
769 645
 //#define FAST_PWM_FAN
770 646
 
771
-// Temperature status LEDs that display the hotend and bet temperature.
772
-// If all hotends and bed temperature and temperature setpoint are < 54C then the BLUE led is on.
773
-// Otherwise the RED led is on. There is 1C hysteresis.
774
-//#define TEMP_STAT_LEDS
775
-
776 647
 // Use software PWM to drive the fan, as for the heaters. This uses a very low frequency
777 648
 // which is not ass annoying as with the hardware PWM. On the other hand, if this frequency
778 649
 // is too low, you should also increment SOFT_PWM_SCALE.
@@ -784,6 +655,11 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
784 655
 // at zero value, there are 128 effective control positions.
785 656
 #define SOFT_PWM_SCALE 0
786 657
 
658
+// Temperature status LEDs that display the hotend and bet temperature.
659
+// If all hotends and bed temperature and temperature setpoint are < 54C then the BLUE led is on.
660
+// Otherwise the RED led is on. There is 1C hysteresis.
661
+//#define TEMP_STAT_LEDS
662
+
787 663
 // M240  Triggers a camera by emulating a Canon RC-1 Remote
788 664
 // Data from: http://www.doc-diy.net/photo/rc-1_hacked/
789 665
 // #define PHOTOGRAPH_PIN     23
@@ -855,4 +731,4 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
855 731
 #include "Configuration_adv.h"
856 732
 #include "thermistortables.h"
857 733
 
858
-#endif //__CONFIGURATION_H
734
+#endif //CONFIGURATION_H

+ 10
- 190
Marlin/example_configurations/makibox/Configuration_adv.h View File

@@ -1,6 +1,8 @@
1 1
 #ifndef CONFIGURATION_ADV_H
2 2
 #define CONFIGURATION_ADV_H
3 3
 
4
+#include "Conditionals.h"
5
+
4 6
 //===========================================================================
5 7
 //=============================Thermal Settings  ============================
6 8
 //===========================================================================
@@ -89,54 +91,6 @@
89 91
 
90 92
 #define ENDSTOPS_ONLY_FOR_HOMING // If defined the endstops will only be used for homing
91 93
 
92
-
93
-//// AUTOSET LOCATIONS OF LIMIT SWITCHES
94
-//// Added by ZetaPhoenix 09-15-2012
95
-#ifdef MANUAL_HOME_POSITIONS  // Use manual limit switch locations
96
-  #define X_HOME_POS MANUAL_X_HOME_POS
97
-  #define Y_HOME_POS MANUAL_Y_HOME_POS
98
-  #define Z_HOME_POS MANUAL_Z_HOME_POS
99
-#else //Set min/max homing switch positions based upon homing direction and min/max travel limits
100
-  //X axis
101
-  #if X_HOME_DIR == -1
102
-    #ifdef BED_CENTER_AT_0_0
103
-      #define X_HOME_POS X_MAX_LENGTH * -0.5
104
-    #else
105
-      #define X_HOME_POS X_MIN_POS
106
-    #endif //BED_CENTER_AT_0_0
107
-  #else
108
-    #ifdef BED_CENTER_AT_0_0
109
-      #define X_HOME_POS X_MAX_LENGTH * 0.5
110
-    #else
111
-      #define X_HOME_POS X_MAX_POS
112
-    #endif //BED_CENTER_AT_0_0
113
-  #endif //X_HOME_DIR == -1
114
-
115
-  //Y axis
116
-  #if Y_HOME_DIR == -1
117
-    #ifdef BED_CENTER_AT_0_0
118
-      #define Y_HOME_POS Y_MAX_LENGTH * -0.5
119
-    #else
120
-      #define Y_HOME_POS Y_MIN_POS
121
-    #endif //BED_CENTER_AT_0_0
122
-  #else
123
-    #ifdef BED_CENTER_AT_0_0
124
-      #define Y_HOME_POS Y_MAX_LENGTH * 0.5
125
-    #else
126
-      #define Y_HOME_POS Y_MAX_POS
127
-    #endif //BED_CENTER_AT_0_0
128
-  #endif //Y_HOME_DIR == -1
129
-
130
-  // Z axis
131
-  #if Z_HOME_DIR == -1 //BED_CENTER_AT_0_0 not used
132
-    #define Z_HOME_POS Z_MIN_POS
133
-  #else
134
-    #define Z_HOME_POS Z_MAX_POS
135
-  #endif //Z_HOME_DIR == -1
136
-#endif //End auto min/max positions
137
-//END AUTOSET LOCATIONS OF LIMIT SWITCHES -ZP
138
-
139
-
140 94
 //#define Z_LATE_ENABLE // Enable Z the last moment. Needed if your Z driver overheats.
141 95
 
142 96
 // A single Z stepper driver is usually used to drive 2 stepper motors.
@@ -146,26 +100,12 @@
146 100
 // On a RAMPS (or other 5 driver) motherboard, using this feature will limit you to using 1 extruder.
147 101
 //#define Z_DUAL_STEPPER_DRIVERS
148 102
 
149
-#ifdef Z_DUAL_STEPPER_DRIVERS
150
-  #undef EXTRUDERS
151
-  #define EXTRUDERS 1
152
-#endif
153
-
154 103
 // Same again but for Y Axis.
155 104
 //#define Y_DUAL_STEPPER_DRIVERS
156 105
 
157 106
 // Define if the two Y drives need to rotate in opposite directions
158 107
 #define INVERT_Y2_VS_Y_DIR true
159 108
 
160
-#ifdef Y_DUAL_STEPPER_DRIVERS
161
-  #undef EXTRUDERS
162
-  #define EXTRUDERS 1
163
-#endif
164
-
165
-#if defined (Z_DUAL_STEPPER_DRIVERS) && defined (Y_DUAL_STEPPER_DRIVERS)
166
-  #error "You cannot have dual drivers for both Y and Z"
167
-#endif
168
-
169 109
 // Enable this for dual x-carriage printers.
170 110
 // A dual x-carriage design has the advantage that the inactive extruder can be parked which
171 111
 // prevents hot-end ooze contaminating the print. It also reduces the weight of each x-carriage
@@ -227,20 +167,15 @@
227 167
 #define INVERT_Z_STEP_PIN false
228 168
 #define INVERT_E_STEP_PIN false
229 169
 
230
-//default stepper release if idle. Set to 0 to deactivate.
170
+// Default stepper release if idle. Set to 0 to deactivate.
231 171
 #define DEFAULT_STEPPER_DEACTIVE_TIME 60
232 172
 
233 173
 #define DEFAULT_MINIMUMFEEDRATE       0.0     // minimum feedrate
234 174
 #define DEFAULT_MINTRAVELFEEDRATE     0.0
235 175
 
236
-// Feedrates for manual moves along X, Y, Z, E from panel
237 176
 #ifdef ULTIPANEL
238
-#define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60}  // set the speeds for manual moves (mm/min)
239
-#endif
240
-
241
-//Comment to disable setting feedrate multiplier via encoder
242
-#ifdef ULTIPANEL
243
-    #define ULTIPANEL_FEEDMULTIPLY
177
+  #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel
178
+  #define ULTIPANEL_FEEDMULTIPLY  // Comment to disable setting feedrate multiplier via encoder
244 179
 #endif
245 180
 
246 181
 // minimum time in microseconds that a movement needs to take if the buffer is emptied.
@@ -259,13 +194,6 @@
259 194
 // if unwanted behavior is observed on a user's machine when running at very slow speeds.
260 195
 #define MINIMUM_PLANNER_SPEED 0.05// (mm/sec)
261 196
 
262
-// MS1 MS2 Stepper Driver Microstepping mode table
263
-#define MICROSTEP1 LOW,LOW
264
-#define MICROSTEP2 HIGH,LOW
265
-#define MICROSTEP4 LOW,HIGH
266
-#define MICROSTEP8 HIGH,HIGH
267
-#define MICROSTEP16 HIGH,HIGH
268
-
269 197
 // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU.
270 198
 #define MICROSTEP_MODES {16,16,16,16,16} // [1,2,4,8,16]
271 199
 
@@ -335,16 +263,6 @@
335 263
   #define BABYSTEP_XY  //not only z, but also XY in the menu. more clutter, more functions
336 264
   #define BABYSTEP_INVERT_Z false  //true for inverse movements in Z
337 265
   #define BABYSTEP_Z_MULTIPLICATOR 2 //faster z movements
338
-
339
-  #ifdef COREXY
340
-    #error BABYSTEPPING not implemented for COREXY yet.
341
-  #endif
342
-
343
-  #ifdef DELTA
344
-    #ifdef BABYSTEP_XY
345
-      #error BABYSTEPPING only implemented for Z axis on deltabots.
346
-    #endif
347
-  #endif
348 266
 #endif
349 267
 
350 268
 // extruder advance constant (s2/mm3)
@@ -358,12 +276,8 @@
358 276
 
359 277
 #ifdef ADVANCE
360 278
   #define EXTRUDER_ADVANCE_K .0
361
-
362 279
   #define D_FILAMENT 2.85
363 280
   #define STEPS_MM_E 836
364
-  #define EXTRUSION_AREA (0.25 * D_FILAMENT * D_FILAMENT * 3.14159)
365
-  #define STEPS_PER_CUBIC_MM_E (axis_steps_per_unit[E_AXIS]/ EXTRUSION_AREA)
366
-
367 281
 #endif // ADVANCE
368 282
 
369 283
 // Arc interpretation settings:
@@ -378,26 +292,6 @@ const unsigned int dropsegments=5; //everything with less than this number of st
378 292
 // be commented out otherwise
379 293
 //#define SDCARDDETECTINVERTED
380 294
 
381
-#ifdef ULTIPANEL
382
- #undef SDCARDDETECTINVERTED
383
-#endif
384
-
385
-// Power Signal Control Definitions
386
-// By default use ATX definition
387
-#ifndef POWER_SUPPLY
388
-  #define POWER_SUPPLY 1
389
-#endif
390
-// 1 = ATX
391
-#if (POWER_SUPPLY == 1)
392
-  #define PS_ON_AWAKE  LOW
393
-  #define PS_ON_ASLEEP HIGH
394
-#endif
395
-// 2 = X-Box 360 203W
396
-#if (POWER_SUPPLY == 2)
397
-  #define PS_ON_AWAKE  HIGH
398
-  #define PS_ON_ASLEEP LOW
399
-#endif
400
-
401 295
 // Control heater 0 and heater 1 in parallel.
402 296
 //#define HEATERS_PARALLEL
403 297
 
@@ -435,9 +329,9 @@ const unsigned int dropsegments=5; //everything with less than this number of st
435 329
   #define RETRACT_RECOVER_FEEDRATE 8     //default feedrate for recovering from retraction (mm/s)
436 330
 #endif
437 331
 
438
-//adds support for experimental filament exchange support M600; requires display
332
+// Add support for experimental filament exchange support M600; requires display
439 333
 #ifdef ULTIPANEL
440
-  #define FILAMENTCHANGEENABLE
334
+  //#define FILAMENTCHANGEENABLE
441 335
   #ifdef FILAMENTCHANGEENABLE
442 336
     #define FILAMENTCHANGE_XPOS 3
443 337
     #define FILAMENTCHANGE_YPOS 3
@@ -447,81 +341,7 @@ const unsigned int dropsegments=5; //everything with less than this number of st
447 341
   #endif
448 342
 #endif
449 343
 
450
-#ifdef FILAMENTCHANGEENABLE
451
-  #ifdef EXTRUDER_RUNOUT_PREVENT
452
-    #error EXTRUDER_RUNOUT_PREVENT currently incompatible with FILAMENTCHANGE
453
-  #endif
454
-#endif
455
-
456
-//===========================================================================
457
-//=============================  Define Defines  ============================
458
-//===========================================================================
459
-#if EXTRUDERS > 1 && defined TEMP_SENSOR_1_AS_REDUNDANT
460
-  #error "You cannot use TEMP_SENSOR_1_AS_REDUNDANT if EXTRUDERS > 1"
461
-#endif
462
-
463
-#if EXTRUDERS > 1 && defined HEATERS_PARALLEL
464
-  #error "You cannot use HEATERS_PARALLEL if EXTRUDERS > 1"
465
-#endif
466
-
467
-#if TEMP_SENSOR_0 > 0
468
-  #define THERMISTORHEATER_0 TEMP_SENSOR_0
469
-  #define HEATER_0_USES_THERMISTOR
470
-#endif
471
-#if TEMP_SENSOR_1 > 0
472
-  #define THERMISTORHEATER_1 TEMP_SENSOR_1
473
-  #define HEATER_1_USES_THERMISTOR
474
-#endif
475
-#if TEMP_SENSOR_2 > 0
476
-  #define THERMISTORHEATER_2 TEMP_SENSOR_2
477
-  #define HEATER_2_USES_THERMISTOR
478
-#endif
479
-#if TEMP_SENSOR_3 > 0
480
-  #define THERMISTORHEATER_3 TEMP_SENSOR_3
481
-  #define HEATER_3_USES_THERMISTOR
482
-#endif
483
-#if TEMP_SENSOR_BED > 0
484
-  #define THERMISTORBED TEMP_SENSOR_BED
485
-  #define BED_USES_THERMISTOR
486
-#endif
487
-#if TEMP_SENSOR_0 == -1
488
-  #define HEATER_0_USES_AD595
489
-#endif
490
-#if TEMP_SENSOR_1 == -1
491
-  #define HEATER_1_USES_AD595
492
-#endif
493
-#if TEMP_SENSOR_2 == -1
494
-  #define HEATER_2_USES_AD595
495
-#endif
496
-#if TEMP_SENSOR_3 == -1
497
-  #define HEATER_3_USES_AD595
498
-#endif
499
-#if TEMP_SENSOR_BED == -1
500
-  #define BED_USES_AD595
501
-#endif
502
-#if TEMP_SENSOR_0 == -2
503
-  #define HEATER_0_USES_MAX6675
504
-#endif
505
-#if TEMP_SENSOR_0 == 0
506
-  #undef HEATER_0_MINTEMP
507
-  #undef HEATER_0_MAXTEMP
508
-#endif
509
-#if TEMP_SENSOR_1 == 0
510
-  #undef HEATER_1_MINTEMP
511
-  #undef HEATER_1_MAXTEMP
512
-#endif
513
-#if TEMP_SENSOR_2 == 0
514
-  #undef HEATER_2_MINTEMP
515
-  #undef HEATER_2_MAXTEMP
516
-#endif
517
-#if TEMP_SENSOR_3 == 0
518
-  #undef HEATER_3_MINTEMP
519
-  #undef HEATER_3_MAXTEMP
520
-#endif
521
-#if TEMP_SENSOR_BED == 0
522
-  #undef BED_MINTEMP
523
-  #undef BED_MAXTEMP
524
-#endif
525
-
344
+#include "Conditionals.h"
345
+#include "SanityCheck.h"
526 346
 
527
-#endif //__CONFIGURATION_ADV_H
347
+#endif //CONFIGURATION_ADV_H

+ 34
- 158
Marlin/example_configurations/tvrrug/Round2/Configuration.h View File

@@ -321,15 +321,6 @@ your extruder heater takes 2 minutes to hit the target on heating.
321 321
   // #define ENDSTOPPULLUP_ZMIN
322 322
 #endif
323 323
 
324
-#ifdef ENDSTOPPULLUPS
325
-  #define ENDSTOPPULLUP_XMAX
326
-  #define ENDSTOPPULLUP_YMAX
327
-  #define ENDSTOPPULLUP_ZMAX
328
-  #define ENDSTOPPULLUP_XMIN
329
-  #define ENDSTOPPULLUP_YMIN
330
-  #define ENDSTOPPULLUP_ZMIN
331
-#endif
332
-
333 324
 // The pullups are needed if you directly connect a mechanical endswitch between the signal and ground pins.
334 325
 const bool X_MIN_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop.
335 326
 const bool Y_MIN_ENDSTOP_INVERTING = true; // set to true to invert the logic of the endstop.
@@ -378,10 +369,32 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
378 369
 #define Z_MAX_POS 120
379 370
 #define Z_MIN_POS 0
380 371
 
381
-#define X_MAX_LENGTH (X_MAX_POS - X_MIN_POS)
382
-#define Y_MAX_LENGTH (Y_MAX_POS - Y_MIN_POS)
383
-#define Z_MAX_LENGTH (Z_MAX_POS - Z_MIN_POS)
372
+//===========================================================================
373
+//============================= Filament Runout Sensor ======================
374
+//===========================================================================
375
+//#define FILAMENT_RUNOUT_SENSOR // Uncomment for defining a filament runout sensor such as a mechanical or opto endstop to check the existence of filament
376
+                                 // In RAMPS uses servo pin 2. Can be changed in pins file. For other boards pin definition should be made.
377
+                                 // It is assumed that when logic high = filament available
378
+                                 //                    when logic  low = filament ran out
379
+//const bool FIL_RUNOUT_INVERTING = true;  // Should be uncommented and true or false should assigned
380
+//#define ENDSTOPPULLUP_FIL_RUNOUT // Uncomment to use internal pullup for filament runout pins if the sensor is defined.
381
+
382
+//===========================================================================
383
+//============================ Manual Bed Leveling ==========================
384
+//===========================================================================
384 385
 
386
+// #define MANUAL_BED_LEVELING  // Add display menu option for bed leveling
387
+// #define MESH_BED_LEVELING    // Enable mesh bed leveling
388
+
389
+#if defined(MESH_BED_LEVELING)
390
+  #define MESH_MIN_X 10
391
+  #define MESH_MAX_X (X_MAX_POS - MESH_MIN_X)
392
+  #define MESH_MIN_Y 10
393
+  #define MESH_MAX_Y (Y_MAX_POS - MESH_MIN_Y)
394
+  #define MESH_NUM_X_POINTS 3  // Don't use more than 7 points per axis, implementation limited
395
+  #define MESH_NUM_Y_POINTS 3
396
+  #define MESH_HOME_SEARCH_Z 4  // Z after Home, bed somewhere below but above 0.0
397
+#endif  // MESH_BED_LEVELING
385 398
 
386 399
 //===========================================================================
387 400
 //============================= Bed Auto Leveling ===========================
@@ -409,12 +422,6 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
409 422
 
410 423
   #ifdef AUTO_BED_LEVELING_GRID
411 424
 
412
-    // Use one of these defines to specify the origin
413
-    // for a topographical map to be printed for your bed.
414
-    enum { OriginBackLeft, OriginFrontLeft, OriginBackRight, OriginFrontRight };
415
-    #define TOPO_ORIGIN OriginFrontLeft
416
-
417
-    // The edges of the rectangle in which to probe
418 425
     #define LEFT_PROBE_BED_POSITION 15
419 426
     #define RIGHT_PROBE_BED_POSITION 170
420 427
     #define FRONT_PROBE_BED_POSITION 20
@@ -622,112 +629,17 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
622 629
 // REMEMBER TO INSTALL LiquidCrystal_I2C.h in your ARDUINO library folder: https://github.com/kiyoshigawa/LiquidCrystal_I2C
623 630
 //#define RA_CONTROL_PANEL
624 631
 
625
-//automatic expansion
626
-#if defined (MAKRPANEL)
627
- #define DOGLCD
628
- #define SDSUPPORT
629
- #define ULTIPANEL
630
- #define NEWPANEL
631
- #define DEFAULT_LCD_CONTRAST 17
632
-#endif
633
-
634
-#if defined(miniVIKI) || defined(VIKI2)
635
- #define ULTRA_LCD  //general LCD support, also 16x2
636
- #define DOGLCD  // Support for SPI LCD 128x64 (Controller ST7565R graphic Display Family)
637
- #define ULTIMAKERCONTROLLER //as available from the Ultimaker online store.
638
- 
639
-  #ifdef miniVIKI
640
-   #define DEFAULT_LCD_CONTRAST 95
641
-  #else
642
-   #define DEFAULT_LCD_CONTRAST 40
643
-  #endif
644
-  
645
- #define ENCODER_PULSES_PER_STEP 4
646
- #define ENCODER_STEPS_PER_MENU_ITEM 1
647
-#endif
648
-
649
-#if defined (PANEL_ONE)
650
- #define SDSUPPORT
651
- #define ULTIMAKERCONTROLLER
652
-#endif
653
-
654
-#if defined (REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER)
655
- #define DOGLCD
656
- #define U8GLIB_ST7920
657
- #define REPRAP_DISCOUNT_SMART_CONTROLLER
658
-#endif
659
-
660
-#if defined(ULTIMAKERCONTROLLER) || defined(REPRAP_DISCOUNT_SMART_CONTROLLER) || defined(G3D_PANEL)
661
- #define ULTIPANEL
662
- #define NEWPANEL
663
-#endif
664
-
665
-#if defined(REPRAPWORLD_KEYPAD)
666
-  #define NEWPANEL
667
-  #define ULTIPANEL
668
-#endif
669
-#if defined(RA_CONTROL_PANEL)
670
- #define ULTIPANEL
671
- #define NEWPANEL
672
- #define LCD_I2C_TYPE_PCA8574
673
- #define LCD_I2C_ADDRESS 0x27   // I2C Address of the port expander
674
-#endif
675
-
676
-//I2C PANELS
632
+/**
633
+ * I2C Panels
634
+ */
677 635
 
678 636
 //#define LCD_I2C_SAINSMART_YWROBOT
679
-#ifdef LCD_I2C_SAINSMART_YWROBOT
680
-  // This uses the LiquidCrystal_I2C library ( https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home )
681
-  // Make sure it is placed in the Arduino libraries directory.
682
-  #define LCD_I2C_TYPE_PCF8575
683
-  #define LCD_I2C_ADDRESS 0x27   // I2C Address of the port expander
684
-  #define NEWPANEL
685
-  #define ULTIPANEL
686
-#endif
687 637
 
688 638
 // PANELOLU2 LCD with status LEDs, separate encoder and click inputs
689 639
 //#define LCD_I2C_PANELOLU2
690
-#ifdef LCD_I2C_PANELOLU2
691
-  // This uses the LiquidTWI2 library v1.2.3 or later ( https://github.com/lincomatic/LiquidTWI2 )
692
-  // Make sure the LiquidTWI2 directory is placed in the Arduino or Sketchbook libraries subdirectory.
693
-  // (v1.2.3 no longer requires you to define PANELOLU in the LiquidTWI2.h library header file)
694
-  // Note: The PANELOLU2 encoder click input can either be directly connected to a pin
695
-  //       (if BTN_ENC defined to != -1) or read through I2C (when BTN_ENC == -1).
696
-  #define LCD_I2C_TYPE_MCP23017
697
-  #define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander
698
-  #define LCD_USE_I2C_BUZZER //comment out to disable buzzer on LCD
699
-  #define NEWPANEL
700
-  #define ULTIPANEL
701
-
702
-  #ifndef ENCODER_PULSES_PER_STEP
703
-	#define ENCODER_PULSES_PER_STEP 4
704
-  #endif
705
-
706
-  #ifndef ENCODER_STEPS_PER_MENU_ITEM
707
-	#define ENCODER_STEPS_PER_MENU_ITEM 1
708
-  #endif
709
-
710
-
711
-  #ifdef LCD_USE_I2C_BUZZER
712
-	#define LCD_FEEDBACK_FREQUENCY_HZ 1000
713
-	#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100
714
-  #endif
715
-
716
-#endif
717 640
 
718 641
 // Panucatt VIKI LCD with status LEDs, integrated click & L/R/U/P buttons, separate encoder inputs
719 642
 //#define LCD_I2C_VIKI
720
-#ifdef LCD_I2C_VIKI
721
-  // This uses the LiquidTWI2 library v1.2.3 or later ( https://github.com/lincomatic/LiquidTWI2 )
722
-  // Make sure the LiquidTWI2 directory is placed in the Arduino or Sketchbook libraries subdirectory.
723
-  // Note: The pause/stop/resume LCD button pin should be connected to the Arduino
724
-  //       BTN_ENC pin (or set BTN_ENC to -1 if not used)
725
-  #define LCD_I2C_TYPE_MCP23017
726
-  #define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander
727
-  #define LCD_USE_I2C_BUZZER //comment out to disable buzzer on LCD (requires LiquidTWI2 v1.2.3 or later)
728
-  #define NEWPANEL
729
-  #define ULTIPANEL
730
-#endif
731 643
 
732 644
 // Shift register panels
733 645
 // ---------------------
@@ -735,51 +647,10 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
735 647
 // https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection 
736 648
 
737 649
 //#define SAV_3DLCD
738
-#ifdef SAV_3DLCD
739
-   #define SR_LCD_2W_NL    // Non latching 2 wire shiftregister
740
-   #define NEWPANEL
741
-   #define ULTIPANEL
742
-#endif
743
-
744
-
745
-#ifdef ULTIPANEL
746
-//  #define NEWPANEL  //enable this if you have a click-encoder panel
747
-  #define SDSUPPORT
748
-  #define ULTRA_LCD
749
-  #ifdef DOGLCD // Change number of lines to match the DOG graphic display
750
-    #define LCD_WIDTH 22
751
-    #define LCD_HEIGHT 5
752
-  #else
753
-    #define LCD_WIDTH 20
754
-    #define LCD_HEIGHT 4
755
-  #endif
756
-#else //no panel but just LCD
757
-  #ifdef ULTRA_LCD
758
-  #ifdef DOGLCD // Change number of lines to match the 128x64 graphics display
759
-    #define LCD_WIDTH 22
760
-    #define LCD_HEIGHT 5
761
-  #else
762
-    #define LCD_WIDTH 16
763
-    #define LCD_HEIGHT 2
764
-  #endif
765
-  #endif
766
-#endif
767
-
768
-// default LCD contrast for dogm-like LCD displays
769
-#ifdef DOGLCD
770
-# ifndef DEFAULT_LCD_CONTRAST
771
-#  define DEFAULT_LCD_CONTRAST 32
772
-# endif
773
-#endif
774 650
 
775 651
 // Increase the FAN pwm frequency. Removes the PWM noise but increases heating in the FET/Arduino
776 652
 //#define FAST_PWM_FAN
777 653
 
778
-// Temperature status LEDs that display the hotend and bet temperature.
779
-// If all hotends and bed temperature and temperature setpoint are < 54C then the BLUE led is on.
780
-// Otherwise the RED led is on. There is 1C hysteresis.
781
-//#define TEMP_STAT_LEDS
782
-
783 654
 // Use software PWM to drive the fan, as for the heaters. This uses a very low frequency
784 655
 // which is not ass annoying as with the hardware PWM. On the other hand, if this frequency
785 656
 // is too low, you should also increment SOFT_PWM_SCALE.
@@ -791,6 +662,11 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
791 662
 // at zero value, there are 128 effective control positions.
792 663
 #define SOFT_PWM_SCALE 0
793 664
 
665
+// Temperature status LEDs that display the hotend and bet temperature.
666
+// If all hotends and bed temperature and temperature setpoint are < 54C then the BLUE led is on.
667
+// Otherwise the RED led is on. There is 1C hysteresis.
668
+//#define TEMP_STAT_LEDS
669
+
794 670
 // M240  Triggers a camera by emulating a Canon RC-1 Remote
795 671
 // Data from: http://www.doc-diy.net/photo/rc-1_hacked/
796 672
 // #define PHOTOGRAPH_PIN     23
@@ -862,4 +738,4 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
862 738
 #include "Configuration_adv.h"
863 739
 #include "thermistortables.h"
864 740
 
865
-#endif //__CONFIGURATION_H
741
+#endif //CONFIGURATION_H

+ 10
- 186
Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h View File

@@ -1,6 +1,8 @@
1 1
 #ifndef CONFIGURATION_ADV_H
2 2
 #define CONFIGURATION_ADV_H
3 3
 
4
+#include "Conditionals.h"
5
+
4 6
 //===========================================================================
5 7
 //=============================Thermal Settings  ============================
6 8
 //===========================================================================
@@ -89,54 +91,6 @@
89 91
 
90 92
 #define ENDSTOPS_ONLY_FOR_HOMING // If defined the endstops will only be used for homing
91 93
 
92
-
93
-//// AUTOSET LOCATIONS OF LIMIT SWITCHES
94
-//// Added by ZetaPhoenix 09-15-2012
95
-#ifdef MANUAL_HOME_POSITIONS  // Use manual limit switch locations
96
-  #define X_HOME_POS MANUAL_X_HOME_POS
97
-  #define Y_HOME_POS MANUAL_Y_HOME_POS
98
-  #define Z_HOME_POS MANUAL_Z_HOME_POS
99
-#else //Set min/max homing switch positions based upon homing direction and min/max travel limits
100
-  //X axis
101
-  #if X_HOME_DIR == -1
102
-    #ifdef BED_CENTER_AT_0_0
103
-      #define X_HOME_POS X_MAX_LENGTH * -0.5
104
-    #else
105
-      #define X_HOME_POS X_MIN_POS
106
-    #endif //BED_CENTER_AT_0_0
107
-  #else
108
-    #ifdef BED_CENTER_AT_0_0
109
-      #define X_HOME_POS X_MAX_LENGTH * 0.5
110
-    #else
111
-      #define X_HOME_POS X_MAX_POS
112
-    #endif //BED_CENTER_AT_0_0
113
-  #endif //X_HOME_DIR == -1
114
-
115
-  //Y axis
116
-  #if Y_HOME_DIR == -1
117
-    #ifdef BED_CENTER_AT_0_0
118
-      #define Y_HOME_POS Y_MAX_LENGTH * -0.5
119
-    #else
120
-      #define Y_HOME_POS Y_MIN_POS
121
-    #endif //BED_CENTER_AT_0_0
122
-  #else
123
-    #ifdef BED_CENTER_AT_0_0
124
-      #define Y_HOME_POS Y_MAX_LENGTH * 0.5
125
-    #else
126
-      #define Y_HOME_POS Y_MAX_POS
127
-    #endif //BED_CENTER_AT_0_0
128
-  #endif //Y_HOME_DIR == -1
129
-
130
-  // Z axis
131
-  #if Z_HOME_DIR == -1 //BED_CENTER_AT_0_0 not used
132
-    #define Z_HOME_POS Z_MIN_POS
133
-  #else
134
-    #define Z_HOME_POS Z_MAX_POS
135
-  #endif //Z_HOME_DIR == -1
136
-#endif //End auto min/max positions
137
-//END AUTOSET LOCATIONS OF LIMIT SWITCHES -ZP
138
-
139
-
140 94
 //#define Z_LATE_ENABLE // Enable Z the last moment. Needed if your Z driver overheats.
141 95
 
142 96
 // A single Z stepper driver is usually used to drive 2 stepper motors.
@@ -146,26 +100,12 @@
146 100
 // On a RAMPS (or other 5 driver) motherboard, using this feature will limit you to using 1 extruder.
147 101
 //#define Z_DUAL_STEPPER_DRIVERS
148 102
 
149
-#ifdef Z_DUAL_STEPPER_DRIVERS
150
-  #undef EXTRUDERS
151
-  #define EXTRUDERS 1
152
-#endif
153
-
154 103
 // Same again but for Y Axis.
155 104
 //#define Y_DUAL_STEPPER_DRIVERS
156 105
 
157 106
 // Define if the two Y drives need to rotate in opposite directions
158 107
 #define INVERT_Y2_VS_Y_DIR true
159 108
 
160
-#ifdef Y_DUAL_STEPPER_DRIVERS
161
-  #undef EXTRUDERS
162
-  #define EXTRUDERS 1
163
-#endif
164
-
165
-#if defined (Z_DUAL_STEPPER_DRIVERS) && defined (Y_DUAL_STEPPER_DRIVERS)
166
-  #error "You cannot have dual drivers for both Y and Z"
167
-#endif
168
-
169 109
 // Enable this for dual x-carriage printers.
170 110
 // A dual x-carriage design has the advantage that the inactive extruder can be parked which
171 111
 // prevents hot-end ooze contaminating the print. It also reduces the weight of each x-carriage
@@ -229,20 +169,15 @@
229 169
 #define INVERT_Z_STEP_PIN false
230 170
 #define INVERT_E_STEP_PIN false
231 171
 
232
-//default stepper release if idle. Set to 0 to deactivate.
172
+// Default stepper release if idle. Set to 0 to deactivate.
233 173
 #define DEFAULT_STEPPER_DEACTIVE_TIME 60
234 174
 
235 175
 #define DEFAULT_MINIMUMFEEDRATE       0.0     // minimum feedrate
236 176
 #define DEFAULT_MINTRAVELFEEDRATE     0.0
237 177
 
238
-// Feedrates for manual moves along X, Y, Z, E from panel
239
-#ifdef ULTIPANEL
240
-#define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60}  // set the speeds for manual moves (mm/min)
241
-#endif
242
-
243
-//Comment to disable setting feedrate multiplier via encoder
244 178
 #ifdef ULTIPANEL
245
-    #define ULTIPANEL_FEEDMULTIPLY
179
+  #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel
180
+  #define ULTIPANEL_FEEDMULTIPLY  // Comment to disable setting feedrate multiplier via encoder
246 181
 #endif
247 182
 
248 183
 // minimum time in microseconds that a movement needs to take if the buffer is emptied.
@@ -261,13 +196,6 @@
261 196
 // if unwanted behavior is observed on a user's machine when running at very slow speeds.
262 197
 #define MINIMUM_PLANNER_SPEED 0.05// (mm/sec)
263 198
 
264
-// MS1 MS2 Stepper Driver Microstepping mode table
265
-#define MICROSTEP1 LOW,LOW
266
-#define MICROSTEP2 HIGH,LOW
267
-#define MICROSTEP4 LOW,HIGH
268
-#define MICROSTEP8 HIGH,HIGH
269
-#define MICROSTEP16 HIGH,HIGH
270
-
271 199
 // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU.
272 200
 #define MICROSTEP_MODES {16,16,16,16,16} // [1,2,4,8,16]
273 201
 
@@ -336,16 +264,6 @@
336 264
   #define BABYSTEP_XY  //not only z, but also XY in the menu. more clutter, more functions
337 265
   #define BABYSTEP_INVERT_Z false  //true for inverse movements in Z
338 266
   #define BABYSTEP_Z_MULTIPLICATOR 2 //faster z movements
339
-
340
-  #ifdef COREXY
341
-    #error BABYSTEPPING not implemented for COREXY yet.
342
-  #endif
343
-
344
-  #ifdef DELTA
345
-    #ifdef BABYSTEP_XY
346
-      #error BABYSTEPPING only implemented for Z axis on deltabots.
347
-    #endif
348
-  #endif
349 267
 #endif
350 268
 
351 269
 // extruder advance constant (s2/mm3)
@@ -379,26 +297,6 @@ const unsigned int dropsegments=5; //everything with less than this number of st
379 297
 // be commented out otherwise
380 298
 #define SDCARDDETECTINVERTED
381 299
 
382
-#ifdef ULTIPANEL
383
- #undef SDCARDDETECTINVERTED
384
-#endif
385
-
386
-// Power Signal Control Definitions
387
-// By default use ATX definition
388
-#ifndef POWER_SUPPLY
389
-  #define POWER_SUPPLY 1
390
-#endif
391
-// 1 = ATX
392
-#if (POWER_SUPPLY == 1)
393
-  #define PS_ON_AWAKE  LOW
394
-  #define PS_ON_ASLEEP HIGH
395
-#endif
396
-// 2 = X-Box 360 203W
397
-#if (POWER_SUPPLY == 2)
398
-  #define PS_ON_AWAKE  HIGH
399
-  #define PS_ON_ASLEEP LOW
400
-#endif
401
-
402 300
 // Control heater 0 and heater 1 in parallel.
403 301
 //#define HEATERS_PARALLEL
404 302
 
@@ -438,9 +336,9 @@ const unsigned int dropsegments=5; //everything with less than this number of st
438 336
   #define RETRACT_RECOVER_FEEDRATE 8     //default feedrate for recovering from retraction (mm/s)
439 337
 #endif
440 338
 
441
-//adds support for experimental filament exchange support M600; requires display
339
+// Add support for experimental filament exchange support M600; requires display
442 340
 #ifdef ULTIPANEL
443
-  #define FILAMENTCHANGEENABLE
341
+  //#define FILAMENTCHANGEENABLE
444 342
   #ifdef FILAMENTCHANGEENABLE
445 343
     #define FILAMENTCHANGE_XPOS 3
446 344
     #define FILAMENTCHANGE_YPOS 3
@@ -450,81 +348,7 @@ const unsigned int dropsegments=5; //everything with less than this number of st
450 348
   #endif
451 349
 #endif
452 350
 
453
-#ifdef FILAMENTCHANGEENABLE
454
-  #ifdef EXTRUDER_RUNOUT_PREVENT
455
-    #error EXTRUDER_RUNOUT_PREVENT currently incompatible with FILAMENTCHANGE
456
-  #endif
457
-#endif
458
-
459
-//===========================================================================
460
-//=============================  Define Defines  ============================
461
-//===========================================================================
462
-#if EXTRUDERS > 1 && defined TEMP_SENSOR_1_AS_REDUNDANT
463
-  #error "You cannot use TEMP_SENSOR_1_AS_REDUNDANT if EXTRUDERS > 1"
464
-#endif
465
-
466
-#if EXTRUDERS > 1 && defined HEATERS_PARALLEL
467
-  #error "You cannot use HEATERS_PARALLEL if EXTRUDERS > 1"
468
-#endif
469
-
470
-#if TEMP_SENSOR_0 > 0
471
-  #define THERMISTORHEATER_0 TEMP_SENSOR_0
472
-  #define HEATER_0_USES_THERMISTOR
473
-#endif
474
-#if TEMP_SENSOR_1 > 0
475
-  #define THERMISTORHEATER_1 TEMP_SENSOR_1
476
-  #define HEATER_1_USES_THERMISTOR
477
-#endif
478
-#if TEMP_SENSOR_2 > 0
479
-  #define THERMISTORHEATER_2 TEMP_SENSOR_2
480
-  #define HEATER_2_USES_THERMISTOR
481
-#endif
482
-#if TEMP_SENSOR_3 > 0
483
-  #define THERMISTORHEATER_3 TEMP_SENSOR_3
484
-  #define HEATER_3_USES_THERMISTOR
485
-#endif
486
-#if TEMP_SENSOR_BED > 0
487
-  #define THERMISTORBED TEMP_SENSOR_BED
488
-  #define BED_USES_THERMISTOR
489
-#endif
490
-#if TEMP_SENSOR_0 == -1
491
-  #define HEATER_0_USES_AD595
492
-#endif
493
-#if TEMP_SENSOR_1 == -1
494
-  #define HEATER_1_USES_AD595
495
-#endif
496
-#if TEMP_SENSOR_2 == -1
497
-  #define HEATER_2_USES_AD595
498
-#endif
499
-#if TEMP_SENSOR_3 == -1
500
-  #define HEATER_3_USES_AD595
501
-#endif
502
-#if TEMP_SENSOR_BED == -1
503
-  #define BED_USES_AD595
504
-#endif
505
-#if TEMP_SENSOR_0 == -2
506
-  #define HEATER_0_USES_MAX6675
507
-#endif
508
-#if TEMP_SENSOR_0 == 0
509
-  #undef HEATER_0_MINTEMP
510
-  #undef HEATER_0_MAXTEMP
511
-#endif
512
-#if TEMP_SENSOR_1 == 0
513
-  #undef HEATER_1_MINTEMP
514
-  #undef HEATER_1_MAXTEMP
515
-#endif
516
-#if TEMP_SENSOR_2 == 0
517
-  #undef HEATER_2_MINTEMP
518
-  #undef HEATER_2_MAXTEMP
519
-#endif
520
-#if TEMP_SENSOR_3 == 0
521
-  #undef HEATER_3_MINTEMP
522
-  #undef HEATER_3_MAXTEMP
523
-#endif
524
-#if TEMP_SENSOR_BED == 0
525
-  #undef BED_MINTEMP
526
-  #undef BED_MAXTEMP
527
-#endif
528
-
351
+#include "Conditionals.h"
352
+#include "SanityCheck.h"
529 353
 
530
-#endif //__CONFIGURATION_ADV_H
354
+#endif //CONFIGURATION_ADV_H

+ 0
- 1
Marlin/language.h View File

@@ -202,7 +202,6 @@
202 202
 
203 203
 // LCD Menu Messages
204 204
 
205
-
206 205
 #if !(defined( DISPLAY_CHARSET_HD44780_JAPAN ) || defined( DISPLAY_CHARSET_HD44780_WESTERN ) || defined( DISPLAY_CHARSET_HD44780_CYRILLIC ))
207 206
   #define DISPLAY_CHARSET_HD44780_JAPAN
208 207
 #endif

+ 3
- 0
Marlin/language_en.h View File

@@ -105,6 +105,9 @@
105 105
 #ifndef MSG_MOVE_AXIS
106 106
 #define MSG_MOVE_AXIS                       "Move axis"
107 107
 #endif
108
+#ifndef MSG_LEVEL_BED
109
+#define MSG_LEVEL_BED                       "Level bed"
110
+#endif
108 111
 #ifndef MSG_MOVE_X
109 112
 #define MSG_MOVE_X                          "Move X"
110 113
 #endif

+ 20
- 0
Marlin/mesh_bed_leveling.cpp View File

@@ -0,0 +1,20 @@
1
+#include "mesh_bed_leveling.h"
2
+
3
+#if defined(MESH_BED_LEVELING)
4
+
5
+mesh_bed_leveling mbl;
6
+
7
+mesh_bed_leveling::mesh_bed_leveling() {
8
+    reset();
9
+}
10
+    
11
+void mesh_bed_leveling::reset() {
12
+    for (int y=0; y<MESH_NUM_Y_POINTS; y++) {
13
+        for (int x=0; x<MESH_NUM_X_POINTS; x++) {
14
+            z_values[y][x] = 0;
15
+        }
16
+    }
17
+    active = 0;
18
+}
19
+
20
+#endif  // MESH_BED_LEVELING

+ 61
- 0
Marlin/mesh_bed_leveling.h View File

@@ -0,0 +1,61 @@
1
+#include "Marlin.h"
2
+
3
+#if defined(MESH_BED_LEVELING)
4
+
5
+#define MESH_X_DIST ((MESH_MAX_X - MESH_MIN_X)/(MESH_NUM_X_POINTS - 1))
6
+#define MESH_Y_DIST ((MESH_MAX_Y - MESH_MIN_Y)/(MESH_NUM_Y_POINTS - 1))
7
+
8
+class mesh_bed_leveling {
9
+public:
10
+    uint8_t active;
11
+    float z_values[MESH_NUM_Y_POINTS][MESH_NUM_X_POINTS];
12
+    
13
+    mesh_bed_leveling();
14
+    
15
+    void reset();
16
+    
17
+    float get_x(int i) { return MESH_MIN_X + MESH_X_DIST*i; }
18
+    float get_y(int i) { return MESH_MIN_Y + MESH_Y_DIST*i; }
19
+    void set_z(int ix, int iy, float z) { z_values[iy][ix] = z; }
20
+    
21
+    int select_x_index(float x) {
22
+        int i = 1;
23
+        while (x > get_x(i) && i < MESH_NUM_X_POINTS-1) {
24
+            i++;
25
+        }
26
+        return i-1;
27
+    }
28
+    
29
+    int select_y_index(float y) {
30
+        int i = 1;
31
+        while (y > get_y(i) && i < MESH_NUM_Y_POINTS-1) {
32
+            i++;
33
+        }
34
+        return i-1;
35
+    }
36
+    
37
+    float calc_z0(float a0, float a1, float z1, float a2, float z2) {
38
+        float delta_z = (z2 - z1)/(a2 - a1);
39
+        float delta_a = a0 - a1;
40
+        return z1 + delta_a * delta_z;
41
+    }
42
+    
43
+    float get_z(float x0, float y0) {
44
+        int x_index = select_x_index(x0);
45
+        int y_index = select_y_index(y0);
46
+        float z1 = calc_z0(x0,
47
+                           get_x(x_index), z_values[y_index][x_index],
48
+                           get_x(x_index+1), z_values[y_index][x_index+1]);
49
+        float z2 = calc_z0(x0,
50
+                           get_x(x_index), z_values[y_index+1][x_index],
51
+                           get_x(x_index+1), z_values[y_index+1][x_index+1]);
52
+        float z0 = calc_z0(y0,
53
+                           get_y(y_index), z1,
54
+                           get_y(y_index+1), z2);
55
+        return z0;
56
+    }
57
+};
58
+
59
+extern mesh_bed_leveling mbl;
60
+
61
+#endif  // MESH_BED_LEVELING

+ 0
- 2
Marlin/pins.h View File

@@ -5,8 +5,6 @@
5 5
 #ifndef PINS_H
6 6
 #define PINS_H
7 7
 
8
-#include "boards.h"
9
-
10 8
 // Preset optional pins
11 9
 #define X_MS1_PIN -1
12 10
 #define X_MS2_PIN -1

+ 523
- 641
Marlin/planner.cpp
File diff suppressed because it is too large
View File


+ 53
- 64
Marlin/planner.h View File

@@ -21,20 +21,16 @@
21 21
 // This module is to be considered a sub-module of stepper.c. Please don't include 
22 22
 // this file from any other module.
23 23
 
24
-#ifndef planner_h
25
-#define planner_h
24
+#ifndef PLANNER_H
25
+#define PLANNER_H
26 26
 
27 27
 #include "Marlin.h"
28 28
 
29
-#ifdef ENABLE_AUTO_BED_LEVELING
30
-#include "vector_3.h"
31
-#endif // ENABLE_AUTO_BED_LEVELING
32
-
33 29
 // This struct is used when buffering the setup for each linear movement "nominal" values are as specified in 
34 30
 // the source g-code and may never actually be reached if acceleration management is active.
35 31
 typedef struct {
36 32
   // Fields used by the bresenham algorithm for tracing the line
37
-  long steps_x, steps_y, steps_z, steps_e;  // Step count along each axis
33
+  long steps[NUM_AXIS];                     // Step count along each axis
38 34
   unsigned long step_event_count;           // The number of step events required to complete this block
39 35
   long accelerate_until;                    // The index of the step event on which to stop acceleration
40 36
   long decelerate_after;                    // The index of the step event on which to start decelerating
@@ -49,7 +45,7 @@ typedef struct {
49 45
   #endif
50 46
 
51 47
   // Fields used by the motion planner to manage acceleration
52
-//  float speed_x, speed_y, speed_z, speed_e;        // Nominal mm/sec for each axis
48
+  // float speed_x, speed_y, speed_z, speed_e;          // Nominal mm/sec for each axis
53 49
   float nominal_speed;                               // The nominal speed for this block in mm/sec 
54 50
   float entry_speed;                                 // Entry speed at previous-current junction in mm/sec
55 51
   float max_entry_speed;                             // Maximum allowable junction entry speed in mm/sec
@@ -65,48 +61,44 @@ typedef struct {
65 61
   unsigned long acceleration_st;                     // acceleration steps/sec^2
66 62
   unsigned long fan_speed;
67 63
   #ifdef BARICUDA
68
-  unsigned long valve_pressure;
69
-  unsigned long e_to_p_pressure;
64
+    unsigned long valve_pressure;
65
+    unsigned long e_to_p_pressure;
70 66
   #endif
71 67
   volatile char busy;
72 68
 } block_t;
73 69
 
74
-#ifdef ENABLE_AUTO_BED_LEVELING
75
-// this holds the required transform to compensate for bed level
76
-extern matrix_3x3 plan_bed_level_matrix;
77
-#endif // #ifdef ENABLE_AUTO_BED_LEVELING
70
+#define BLOCK_MOD(n) ((n)&(BLOCK_BUFFER_SIZE-1))
78 71
 
79 72
 // Initialize the motion plan subsystem      
80 73
 void plan_init();
81 74
 
82
-// Add a new linear movement to the buffer. x, y and z is the signed, absolute target position in 
83
-// millimaters. Feed rate specifies the speed of the motion.
84
-
85
-#ifdef ENABLE_AUTO_BED_LEVELING
86
-void plan_buffer_line(float x, float y, float z, const float &e, float feed_rate, const uint8_t &extruder);
87
-
88
-  #ifndef DELTA
89
-  // Get the position applying the bed level matrix if enabled
90
-  vector_3 plan_get_position();
91
-  #endif
92
-#else
93
-void plan_buffer_line(const float &x, const float &y, const float &z, const float &e, float feed_rate, const uint8_t &extruder);
94
-#endif // ENABLE_AUTO_BED_LEVELING
75
+void check_axes_activity();
95 76
 
96
-// Set position. Used for G92 instructions.
97
-#ifdef ENABLE_AUTO_BED_LEVELING
98
-void plan_set_position(float x, float y, float z, const float &e);
77
+// Get the number of buffered moves
78
+extern volatile unsigned char block_buffer_head;
79
+extern volatile unsigned char block_buffer_tail;
80
+FORCE_INLINE uint8_t movesplanned() { return BLOCK_MOD(block_buffer_head - block_buffer_tail + BLOCK_BUFFER_SIZE); }
81
+
82
+#if defined(ENABLE_AUTO_BED_LEVELING) || defined(MESH_BED_LEVELING)
83
+  #if defined(ENABLE_AUTO_BED_LEVELING)
84
+    #include "vector_3.h"
85
+    // this holds the required transform to compensate for bed level
86
+    extern matrix_3x3 plan_bed_level_matrix;
87
+    // Get the position applying the bed level matrix if enabled
88
+    vector_3 plan_get_position();
89
+  #endif  // ENABLE_AUTO_BED_LEVELING
90
+  // Add a new linear movement to the buffer. x, y and z is the signed, absolute target position in 
91
+  // millimeters. Feed rate specifies the speed of the motion.
92
+  void plan_buffer_line(float x, float y, float z, const float &e, float feed_rate, const uint8_t &extruder);
93
+  // Set position. Used for G92 instructions.
94
+  void plan_set_position(float x, float y, float z, const float &e);
99 95
 #else
100
-void plan_set_position(const float &x, const float &y, const float &z, const float &e);
101
-#endif // ENABLE_AUTO_BED_LEVELING
96
+  void plan_buffer_line(const float &x, const float &y, const float &z, const float &e, float feed_rate, const uint8_t &extruder);
97
+  void plan_set_position(const float &x, const float &y, const float &z, const float &e);
98
+#endif // ENABLE_AUTO_BED_LEVELING || MESH_BED_LEVELING
102 99
 
103 100
 void plan_set_e_position(const float &e);
104 101
 
105
-
106
-
107
-void check_axes_activity();
108
-uint8_t movesplanned(); //return the nr of buffered moves
109
-
110 102
 extern unsigned long minsegmenttime;
111 103
 extern float max_feedrate[NUM_AXIS]; // set the max speeds
112 104
 extern float axis_steps_per_unit[NUM_AXIS];
@@ -122,44 +114,41 @@ extern float mintravelfeedrate;
122 114
 extern unsigned long axis_steps_per_sqr_second[NUM_AXIS];
123 115
 
124 116
 #ifdef AUTOTEMP
125
-    extern bool autotemp_enabled;
126
-    extern float autotemp_max;
127
-    extern float autotemp_min;
128
-    extern float autotemp_factor;
117
+  extern bool autotemp_enabled;
118
+  extern float autotemp_max;
119
+  extern float autotemp_min;
120
+  extern float autotemp_factor;
129 121
 #endif
130 122
 
131
-    
132
-
133
-
134
-extern block_t block_buffer[BLOCK_BUFFER_SIZE];            // A ring buffer for motion instfructions
123
+extern block_t block_buffer[BLOCK_BUFFER_SIZE];            // A ring buffer for motion instructions
135 124
 extern volatile unsigned char block_buffer_head;           // Index of the next block to be pushed
136 125
 extern volatile unsigned char block_buffer_tail; 
137
-// Called when the current block is no longer needed. Discards the block and makes the memory
138
-// availible for new blocks.    
139
-FORCE_INLINE void plan_discard_current_block()  
140
-{
141
-  if (block_buffer_head != block_buffer_tail) {
142
-    block_buffer_tail = (block_buffer_tail + 1) & (BLOCK_BUFFER_SIZE - 1);  
143
-  }
126
+
127
+// Returns true if the buffer has a queued block, false otherwise
128
+FORCE_INLINE bool blocks_queued() { return (block_buffer_head != block_buffer_tail); }
129
+
130
+// Called when the current block is no longer needed. Discards
131
+// the block and makes the memory available for new blocks.
132
+FORCE_INLINE void plan_discard_current_block() {
133
+  if (blocks_queued())
134
+    block_buffer_tail = BLOCK_MOD(block_buffer_tail + 1);
144 135
 }
145 136
 
146 137
 // Gets the current block. Returns NULL if buffer empty
147
-FORCE_INLINE block_t *plan_get_current_block() 
148
-{
149
-  if (block_buffer_head == block_buffer_tail) { 
150
-    return(NULL); 
138
+FORCE_INLINE block_t *plan_get_current_block() {
139
+  if (blocks_queued()) {
140
+    block_t *block = &block_buffer[block_buffer_tail];
141
+    block->busy = true;
142
+    return block;
151 143
   }
152
-  block_t *block = &block_buffer[block_buffer_tail];
153
-  block->busy = true;
154
-  return(block);
144
+  else
145
+    return NULL;
155 146
 }
156 147
 
157
-// Returns true if the buffer has a queued block, false otherwise
158
-FORCE_INLINE bool blocks_queued() { return (block_buffer_head != block_buffer_tail); }
159
-
160 148
 #ifdef PREVENT_DANGEROUS_EXTRUDE
161
-void set_extrude_min_temp(float temp);
149
+  void set_extrude_min_temp(float temp);
162 150
 #endif
163 151
 
164 152
 void reset_acceleration_rates();
165
-#endif
153
+
154
+#endif //PLANNER_H

+ 61
- 68
Marlin/stepper.cpp View File

@@ -89,7 +89,7 @@ static bool old_x_min_endstop = false,
89 89
 static bool check_endstops = true;
90 90
 
91 91
 volatile long count_position[NUM_AXIS] = { 0 };
92
-volatile signed char count_direction[NUM_AXIS] = { 1 };
92
+volatile signed char count_direction[NUM_AXIS] = { 1, 1, 1, 1 };
93 93
 
94 94
 
95 95
 //===========================================================================
@@ -102,11 +102,8 @@ volatile signed char count_direction[NUM_AXIS] = { 1 };
102 102
       X_DIR_WRITE(v); \
103 103
       X2_DIR_WRITE(v); \
104 104
     } \
105
-    else{ \
106
-      if (current_block->active_extruder) \
107
-        X2_DIR_WRITE(v); \
108
-      else \
109
-        X_DIR_WRITE(v); \
105
+    else { \
106
+      if (current_block->active_extruder) X2_DIR_WRITE(v); else X_DIR_WRITE(v); \
110 107
     }
111 108
   #define X_APPLY_STEP(v,ALWAYS) \
112 109
     if (extruder_duplication_enabled || ALWAYS) { \
@@ -114,10 +111,7 @@ volatile signed char count_direction[NUM_AXIS] = { 1 };
114 111
       X2_STEP_WRITE(v); \
115 112
     } \
116 113
     else { \
117
-      if (current_block->active_extruder != 0) \
118
-        X2_STEP_WRITE(v); \
119
-      else \
120
-        X_STEP_WRITE(v); \
114
+      if (current_block->active_extruder != 0) X2_STEP_WRITE(v); else X_STEP_WRITE(v); \
121 115
     }
122 116
 #else
123 117
   #define X_APPLY_DIR(v,Q) X_DIR_WRITE(v)
@@ -125,16 +119,16 @@ volatile signed char count_direction[NUM_AXIS] = { 1 };
125 119
 #endif
126 120
 
127 121
 #ifdef Y_DUAL_STEPPER_DRIVERS
128
-  #define Y_APPLY_DIR(v,Q) Y_DIR_WRITE(v), Y2_DIR_WRITE((v) != INVERT_Y2_VS_Y_DIR)
129
-  #define Y_APPLY_STEP(v,Q) Y_STEP_WRITE(v), Y2_STEP_WRITE(v)
122
+  #define Y_APPLY_DIR(v,Q) { Y_DIR_WRITE(v); Y2_DIR_WRITE((v) != INVERT_Y2_VS_Y_DIR); }
123
+  #define Y_APPLY_STEP(v,Q) { Y_STEP_WRITE(v); Y2_STEP_WRITE(v); }
130 124
 #else
131 125
   #define Y_APPLY_DIR(v,Q) Y_DIR_WRITE(v)
132 126
   #define Y_APPLY_STEP(v,Q) Y_STEP_WRITE(v)
133 127
 #endif
134 128
 
135 129
 #ifdef Z_DUAL_STEPPER_DRIVERS
136
-  #define Z_APPLY_DIR(v,Q) Z_DIR_WRITE(v), Z2_DIR_WRITE(v)
137
-  #define Z_APPLY_STEP(v,Q) Z_STEP_WRITE(v), Z2_STEP_WRITE(v)
130
+  #define Z_APPLY_DIR(v,Q) { Z_DIR_WRITE(v); Z2_DIR_WRITE(v); }
131
+  #define Z_APPLY_STEP(v,Q) { Z_STEP_WRITE(v); Z2_STEP_WRITE(v); }
138 132
 #else
139 133
   #define Z_APPLY_DIR(v,Q) Z_DIR_WRITE(v)
140 134
   #define Z_APPLY_STEP(v,Q) Z_STEP_WRITE(v)
@@ -370,7 +364,7 @@ ISR(TIMER1_COMPA_vect) {
370 364
       step_events_completed = 0;
371 365
 
372 366
       #ifdef Z_LATE_ENABLE
373
-        if (current_block->steps_z > 0) {
367
+        if (current_block->steps[Z_AXIS] > 0) {
374 368
           enable_z();
375 369
           OCR1A = 2000; //1ms wait
376 370
           return;
@@ -411,7 +405,7 @@ ISR(TIMER1_COMPA_vect) {
411 405
 
412 406
     #define UPDATE_ENDSTOP(axis,AXIS,minmax,MINMAX) \
413 407
       bool axis ##_## minmax ##_endstop = (READ(AXIS ##_## MINMAX ##_PIN) != AXIS ##_## MINMAX ##_ENDSTOP_INVERTING); \
414
-      if (axis ##_## minmax ##_endstop && old_## axis ##_## minmax ##_endstop && (current_block->steps_## axis > 0)) { \
408
+      if (axis ##_## minmax ##_endstop && old_## axis ##_## minmax ##_endstop && (current_block->steps[AXIS ##_AXIS] > 0)) { \
415 409
         endstops_trigsteps[AXIS ##_AXIS] = count_position[AXIS ##_AXIS]; \
416 410
         endstop_## axis ##_hit = true; \
417 411
         step_events_completed = current_block->step_event_count; \
@@ -420,54 +414,54 @@ ISR(TIMER1_COMPA_vect) {
420 414
 
421 415
     // Check X and Y endstops
422 416
     if (check_endstops) {
423
-      #ifndef COREXY
424
-        if (TEST(out_bits, X_AXIS))   // stepping along -X axis (regular cartesians bot)
425
-      #else
417
+      #ifdef COREXY
426 418
         // Head direction in -X axis for CoreXY bots.
427 419
         // If DeltaX == -DeltaY, the movement is only in Y axis
428
-        if (current_block->steps_x != current_block->steps_y || (TEST(out_bits, X_AXIS) == TEST(out_bits, Y_AXIS)))      
429
-            if (TEST(out_bits, X_HEAD))
430
-      #endif
431
-            { // -direction
432
-              #ifdef DUAL_X_CARRIAGE
433
-                // with 2 x-carriages, endstops are only checked in the homing direction for the active extruder
434
-                if ((current_block->active_extruder == 0 && X_HOME_DIR == -1) || (current_block->active_extruder != 0 && X2_HOME_DIR == -1))
435
-              #endif          
436
-                {
437
-                  #if defined(X_MIN_PIN) && X_MIN_PIN >= 0
438
-                    UPDATE_ENDSTOP(x, X, min, MIN);
439
-                  #endif
440
-                }
441
-            }
442
-            else { // +direction
443
-              #ifdef DUAL_X_CARRIAGE
444
-                // with 2 x-carriages, endstops are only checked in the homing direction for the active extruder
445
-                if ((current_block->active_extruder == 0 && X_HOME_DIR == 1) || (current_block->active_extruder != 0 && X2_HOME_DIR == 1))
446
-              #endif
447
-                {
448
-                  #if defined(X_MAX_PIN) && X_MAX_PIN >= 0
449
-                    UPDATE_ENDSTOP(x, X, max, MAX);
450
-                  #endif
451
-                }
452
-            }
453
-      #ifndef COREXY
454
-        if (TEST(out_bits, Y_AXIS))   // -direction
420
+        if (current_block->steps[A_AXIS] != current_block->steps[B_AXIS] || (TEST(out_bits, A_AXIS) == TEST(out_bits, B_AXIS)))
421
+          if (TEST(out_bits, X_HEAD))
455 422
       #else
423
+          if (TEST(out_bits, X_AXIS))   // stepping along -X axis (regular cartesians bot)
424
+      #endif
425
+          { // -direction
426
+            #ifdef DUAL_X_CARRIAGE
427
+              // with 2 x-carriages, endstops are only checked in the homing direction for the active extruder
428
+              if ((current_block->active_extruder == 0 && X_HOME_DIR == -1) || (current_block->active_extruder != 0 && X2_HOME_DIR == -1))
429
+            #endif          
430
+              {
431
+                #if defined(X_MIN_PIN) && X_MIN_PIN >= 0
432
+                  UPDATE_ENDSTOP(x, X, min, MIN);
433
+                #endif
434
+              }
435
+          }
436
+          else { // +direction
437
+            #ifdef DUAL_X_CARRIAGE
438
+              // with 2 x-carriages, endstops are only checked in the homing direction for the active extruder
439
+              if ((current_block->active_extruder == 0 && X_HOME_DIR == 1) || (current_block->active_extruder != 0 && X2_HOME_DIR == 1))
440
+            #endif
441
+              {
442
+                #if defined(X_MAX_PIN) && X_MAX_PIN >= 0
443
+                  UPDATE_ENDSTOP(x, X, max, MAX);
444
+                #endif
445
+              }
446
+          }
447
+      #ifdef COREXY
456 448
         // Head direction in -Y axis for CoreXY bots.
457 449
         // If DeltaX == DeltaY, the movement is only in X axis
458
-        if (current_block->steps_x != current_block->steps_y || (TEST(out_bits, X_AXIS) != TEST(out_bits, Y_AXIS)))
459
-            if (TEST(out_bits, Y_HEAD))             
450
+        if (current_block->steps[A_AXIS] != current_block->steps[B_AXIS] || (TEST(out_bits, A_AXIS) != TEST(out_bits, B_AXIS)))
451
+          if (TEST(out_bits, Y_HEAD))
452
+      #else
453
+          if (TEST(out_bits, Y_AXIS))   // -direction
460 454
       #endif
461
-            { // -direction
462
-              #if defined(Y_MIN_PIN) && Y_MIN_PIN >= 0
463
-                UPDATE_ENDSTOP(y, Y, min, MIN);
464
-              #endif
465
-            }
466
-            else { // +direction
467
-              #if defined(Y_MAX_PIN) && Y_MAX_PIN >= 0
468
-                UPDATE_ENDSTOP(y, Y, max, MAX);
469
-              #endif
470
-            }
455
+          { // -direction
456
+            #if defined(Y_MIN_PIN) && Y_MIN_PIN >= 0
457
+              UPDATE_ENDSTOP(y, Y, min, MIN);
458
+            #endif
459
+          }
460
+          else { // +direction
461
+            #if defined(Y_MAX_PIN) && Y_MAX_PIN >= 0
462
+              UPDATE_ENDSTOP(y, Y, max, MAX);
463
+            #endif
464
+          }
471 465
     }
472 466
 
473 467
     if (TEST(out_bits, Z_AXIS)) {   // -direction
@@ -515,7 +509,7 @@ ISR(TIMER1_COMPA_vect) {
515 509
       #endif
516 510
 
517 511
       #ifdef ADVANCE
518
-        counter_e += current_block->steps_e;
512
+        counter_e += current_block->steps[E_AXIS];
519 513
         if (counter_e > 0) {
520 514
           counter_e -= current_block->step_event_count;
521 515
           e_steps[current_block->active_extruder] += TEST(out_bits, E_AXIS) ? -1 : 1;
@@ -529,15 +523,14 @@ ISR(TIMER1_COMPA_vect) {
529 523
          * instead of doing each in turn. The extra tests add enough
530 524
          * lag to allow it work with without needing NOPs
531 525
          */
532
-        counter_x += current_block->steps_x;
533
-        if (counter_x > 0) X_STEP_WRITE(HIGH);
534
-        counter_y += current_block->steps_y;
535
-        if (counter_y > 0) Y_STEP_WRITE(HIGH);
536
-        counter_z += current_block->steps_z;
537
-        if (counter_z > 0) Z_STEP_WRITE(HIGH);
526
+        #define STEP_ADD(axis, AXIS) \
527
+         counter_## axis += current_block->steps[AXIS ##_AXIS]; \
528
+         if (counter_## axis > 0) { AXIS ##_STEP_WRITE(HIGH); }
529
+        STEP_ADD(x,X);
530
+        STEP_ADD(y,Y);
531
+        STEP_ADD(z,Z);
538 532
         #ifndef ADVANCE
539
-          counter_e += current_block->steps_e;
540
-          if (counter_e > 0) E_STEP_WRITE(HIGH);
533
+          STEP_ADD(e,E);
541 534
         #endif
542 535
 
543 536
         #define STEP_IF_COUNTER(axis, AXIS) \
@@ -557,7 +550,7 @@ ISR(TIMER1_COMPA_vect) {
557 550
       #else // !CONFIG_STEPPERS_TOSHIBA
558 551
 
559 552
         #define APPLY_MOVEMENT(axis, AXIS) \
560
-          counter_## axis += current_block->steps_## axis; \
553
+          counter_## axis += current_block->steps[AXIS ##_AXIS]; \
561 554
           if (counter_## axis > 0) { \
562 555
             AXIS ##_APPLY_STEP(!INVERT_## AXIS ##_STEP_PIN,0); \
563 556
             counter_## axis -= current_block->step_event_count; \

+ 97
- 144
Marlin/temperature.cpp View File

@@ -41,50 +41,14 @@
41 41
 //================================== macros =================================
42 42
 //===========================================================================
43 43
 
44
-#if EXTRUDERS > 4
45
-  #error Unsupported number of extruders
46
-#elif EXTRUDERS > 3
47
-  #define ARRAY_BY_EXTRUDERS(v1, v2, v3, v4) { v1, v2, v3, v4 }
48
-#elif EXTRUDERS > 2
49
-  #define ARRAY_BY_EXTRUDERS(v1, v2, v3, v4) { v1, v2, v3 }
50
-#elif EXTRUDERS > 1
51
-  #define ARRAY_BY_EXTRUDERS(v1, v2, v3, v4) { v1, v2 }
52
-#else
53
-  #define ARRAY_BY_EXTRUDERS(v1, v2, v3, v4) { v1 }
44
+#ifdef K1 // Defined in Configuration.h in the PID settings
45
+  #define K2 (1.0-K1)
54 46
 #endif
55 47
 
56
-#define HAS_TEMP_0 (defined(TEMP_0_PIN) && TEMP_0_PIN >= 0)
57
-#define HAS_TEMP_1 (defined(TEMP_1_PIN) && TEMP_1_PIN >= 0)
58
-#define HAS_TEMP_2 (defined(TEMP_2_PIN) && TEMP_2_PIN >= 0)
59
-#define HAS_TEMP_3 (defined(TEMP_3_PIN) && TEMP_3_PIN >= 0)
60
-#define HAS_TEMP_BED (defined(TEMP_BED_PIN) && TEMP_BED_PIN >= 0)
61
-#define HAS_FILAMENT_SENSOR (defined(FILAMENT_SENSOR) && defined(FILWIDTH_PIN) && FILWIDTH_PIN >= 0)
62
-#define HAS_HEATER_0 (defined(HEATER_0_PIN) && HEATER_0_PIN >= 0)
63
-#define HAS_HEATER_1 (defined(HEATER_1_PIN) && HEATER_1_PIN >= 0)
64
-#define HAS_HEATER_2 (defined(HEATER_2_PIN) && HEATER_2_PIN >= 0)
65
-#define HAS_HEATER_3 (defined(HEATER_3_PIN) && HEATER_3_PIN >= 0)
66
-#define HAS_HEATER_BED (defined(HEATER_BED_PIN) && HEATER_BED_PIN >= 0)
67
-#define HAS_AUTO_FAN_0 (defined(EXTRUDER_0_AUTO_FAN_PIN) && EXTRUDER_0_AUTO_FAN_PIN >= 0)
68
-#define HAS_AUTO_FAN_1 (defined(EXTRUDER_1_AUTO_FAN_PIN) && EXTRUDER_1_AUTO_FAN_PIN >= 0)
69
-#define HAS_AUTO_FAN_2 (defined(EXTRUDER_2_AUTO_FAN_PIN) && EXTRUDER_2_AUTO_FAN_PIN >= 0)
70
-#define HAS_AUTO_FAN_3 (defined(EXTRUDER_3_AUTO_FAN_PIN) && EXTRUDER_3_AUTO_FAN_PIN >= 0)
71
-#define HAS_AUTO_FAN HAS_AUTO_FAN_0 || HAS_AUTO_FAN_1 || HAS_AUTO_FAN_2 || HAS_AUTO_FAN_3
72
-#define HAS_FAN (defined(FAN_PIN) && FAN_PIN >= 0)
73
-
74 48
 //===========================================================================
75 49
 //============================= public variables ============================
76 50
 //===========================================================================
77 51
 
78
-#ifdef K1 // Defined in Configuration.h in the PID settings
79
-  #define K2 (1.0-K1)
80
-#endif
81
-
82
-// Sampling period of the temperature routine
83
-#ifdef PID_dT
84
-  #undef PID_dT
85
-#endif
86
-#define PID_dT ((OVERSAMPLENR * 12.0)/(F_CPU / 64.0 / 256.0))
87
-
88 52
 int target_temperature[EXTRUDERS] = { 0 };
89 53
 int target_temperature_bed = 0;
90 54
 int current_temperature_raw[EXTRUDERS] = { 0 };
@@ -145,7 +109,7 @@ static volatile bool temp_meas_ready = false;
145 109
   static float temp_iState_min_bed;
146 110
   static float temp_iState_max_bed;
147 111
 #else //PIDTEMPBED
148
-	static unsigned long  previous_millis_bed_heater;
112
+  static unsigned long  previous_millis_bed_heater;
149 113
 #endif //PIDTEMPBED
150 114
   static unsigned char soft_pwm[EXTRUDERS];
151 115
 
@@ -177,7 +141,7 @@ static volatile bool temp_meas_ready = false;
177 141
 // Init min and max temp with extreme values to prevent false errors during startup
178 142
 static int minttemp_raw[EXTRUDERS] = ARRAY_BY_EXTRUDERS( HEATER_0_RAW_LO_TEMP , HEATER_1_RAW_LO_TEMP , HEATER_2_RAW_LO_TEMP, HEATER_3_RAW_LO_TEMP);
179 143
 static int maxttemp_raw[EXTRUDERS] = ARRAY_BY_EXTRUDERS( HEATER_0_RAW_HI_TEMP , HEATER_1_RAW_HI_TEMP , HEATER_2_RAW_HI_TEMP, HEATER_3_RAW_HI_TEMP);
180
-static int minttemp[EXTRUDERS] = ARRAY_BY_EXTRUDERS( 0, 0, 0, 0 );
144
+static int minttemp[EXTRUDERS] = { 0 };
181 145
 static int maxttemp[EXTRUDERS] = ARRAY_BY_EXTRUDERS( 16383, 16383, 16383, 16383 );
182 146
 //static int bed_minttemp_raw = HEATER_BED_RAW_LO_TEMP; /* No bed mintemp error implemented?!? */
183 147
 #ifdef BED_MAXTEMP
@@ -197,8 +161,8 @@ static float analog2tempBed(int raw);
197 161
 static void updateTemperaturesFromRawValues();
198 162
 
199 163
 #ifdef WATCH_TEMP_PERIOD
200
-  int watch_start_temp[EXTRUDERS] = ARRAY_BY_EXTRUDERS(0,0,0,0);
201
-  unsigned long watchmillis[EXTRUDERS] = ARRAY_BY_EXTRUDERS(0,0,0,0);
164
+  int watch_start_temp[EXTRUDERS] = { 0 };
165
+  unsigned long watchmillis[EXTRUDERS] = { 0 };
202 166
 #endif //WATCH_TEMP_PERIOD
203 167
 
204 168
 #ifndef SOFT_PWM_SCALE
@@ -243,7 +207,7 @@ void PID_autotune(float temp, int extruder, int ncycles)
243 207
     SERIAL_ECHOLN(MSG_PID_BAD_EXTRUDER_NUM);
244 208
     return;
245 209
   }
246
-	
210
+  
247 211
   SERIAL_ECHOLN(MSG_PID_AUTOTUNE_START);
248 212
 
249 213
   disable_heater(); // switch off all heaters.
@@ -391,21 +355,6 @@ int getHeaterPower(int heater) {
391 355
 
392 356
 #if HAS_AUTO_FAN
393 357
 
394
-  #if HAS_FAN
395
-    #if EXTRUDER_0_AUTO_FAN_PIN == FAN_PIN
396
-       #error "You cannot set EXTRUDER_0_AUTO_FAN_PIN equal to FAN_PIN"
397
-    #endif
398
-    #if EXTRUDER_1_AUTO_FAN_PIN == FAN_PIN
399
-       #error "You cannot set EXTRUDER_1_AUTO_FAN_PIN equal to FAN_PIN"
400
-    #endif
401
-    #if EXTRUDER_2_AUTO_FAN_PIN == FAN_PIN
402
-       #error "You cannot set EXTRUDER_2_AUTO_FAN_PIN equal to FAN_PIN"
403
-    #endif
404
-    #if EXTRUDER_3_AUTO_FAN_PIN == FAN_PIN
405
-       #error "You cannot set EXTRUDER_3_AUTO_FAN_PIN equal to FAN_PIN"
406
-    #endif
407
-  #endif 
408
-
409 358
 void setExtruderAutoFanState(int pin, bool state)
410 359
 {
411 360
   unsigned char newFanSpeed = (state != 0) ? EXTRUDER_AUTO_FAN_SPEED : 0;
@@ -482,42 +431,8 @@ void checkExtruderAutoFans()
482 431
 #endif // any extruder auto fan pins set
483 432
 
484 433
 //
485
-// Error checking and Write Routines
434
+// Temperature Error Handlers
486 435
 //
487
-#if !HAS_HEATER_0
488
-  #error HEATER_0_PIN not defined for this board
489
-#endif
490
-#define WRITE_HEATER_0P(v) WRITE(HEATER_0_PIN, v)
491
-#if EXTRUDERS > 1 || defined(HEATERS_PARALLEL)
492
-  #if !HAS_HEATER_1
493
-    #error HEATER_1_PIN not defined for this board
494
-  #endif
495
-  #define WRITE_HEATER_1(v) WRITE(HEATER_1_PIN, v)
496
-  #if EXTRUDERS > 2
497
-    #if !HAS_HEATER_2
498
-      #error HEATER_2_PIN not defined for this board
499
-    #endif
500
-    #define WRITE_HEATER_2(v) WRITE(HEATER_2_PIN, v)
501
-    #if EXTRUDERS > 3
502
-      #if !HAS_HEATER_3
503
-        #error HEATER_3_PIN not defined for this board
504
-      #endif
505
-      #define WRITE_HEATER_3(v) WRITE(HEATER_3_PIN, v)
506
-    #endif
507
-  #endif
508
-#endif
509
-#ifdef HEATERS_PARALLEL
510
-  #define WRITE_HEATER_0(v) { WRITE_HEATER_0P(v); WRITE_HEATER_1(v); }
511
-#else
512
-  #define WRITE_HEATER_0(v) WRITE_HEATER_0P(v)
513
-#endif
514
-#if HAS_HEATER_BED
515
-  #define WRITE_HEATER_BED(v) WRITE(HEATER_BED_PIN, v)
516
-#endif
517
-#if HAS_FAN
518
-  #define WRITE_FAN(v) WRITE(FAN_PIN, v)
519
-#endif
520
-
521 436
 inline void _temp_error(int e, const char *msg1, const char *msg2) {
522 437
   if (!IsStopped()) {
523 438
     SERIAL_ERROR_START;
@@ -661,12 +576,6 @@ void manage_heater() {
661 576
 
662 577
   updateTemperaturesFromRawValues();
663 578
 
664
-  #ifdef HEATER_0_USES_MAX6675
665
-    float ct = current_temperature[0];
666
-    if (ct > min(HEATER_0_MAXTEMP, 1023)) max_temp_error(0);
667
-    if (ct < max(HEATER_0_MINTEMP, 0.01)) min_temp_error(0);
668
-  #endif //HEATER_0_USES_MAX6675
669
-
670 579
   unsigned long ms = millis();
671 580
 
672 581
   // Loop through all extruders
@@ -755,8 +664,8 @@ void manage_heater() {
755 664
   #ifdef FILAMENT_SENSOR
756 665
     if (filament_sensor) {
757 666
       meas_shift_index = delay_index1 - meas_delay_cm;
758
-		  if (meas_shift_index < 0) meas_shift_index += MAX_MEASUREMENT_DELAY + 1;  //loop around buffer if needed
759
-		  
667
+      if (meas_shift_index < 0) meas_shift_index += MAX_MEASUREMENT_DELAY + 1;  //loop around buffer if needed
668
+      
760 669
       // Get the delayed info and add 100 to reconstitute to a percent of
761 670
       // the nominal filament diameter then square it to get an area
762 671
       meas_shift_index = constrain(meas_shift_index, 0, MAX_MEASUREMENT_DELAY);
@@ -1145,28 +1054,28 @@ void disable_heater() {
1145 1054
   for (int i=0; i<EXTRUDERS; i++) setTargetHotend(0, i);
1146 1055
   setTargetBed(0);
1147 1056
 
1057
+  #define DISABLE_HEATER(NR) { \
1058
+    target_temperature[NR] = 0; \
1059
+    soft_pwm[NR] = 0; \
1060
+    WRITE_HEATER_ ## NR (LOW); \
1061
+  }
1062
+
1148 1063
   #if HAS_TEMP_0
1149 1064
     target_temperature[0] = 0;
1150 1065
     soft_pwm[0] = 0;
1151
-    WRITE_HEATER_0P(LOW); // If HEATERS_PARALLEL should apply, change to WRITE_HEATER_0
1066
+    WRITE_HEATER_0P(LOW); // Should HEATERS_PARALLEL apply here? Then change to DISABLE_HEATER(0)
1152 1067
   #endif
1153 1068
 
1154 1069
   #if EXTRUDERS > 1 && HAS_TEMP_1
1155
-    target_temperature[1] = 0;
1156
-    soft_pwm[1] = 0;
1157
-    WRITE_HEATER_1(LOW);
1070
+    DISABLE_HEATER(1);
1158 1071
   #endif
1159 1072
 
1160 1073
   #if EXTRUDERS > 2 && HAS_TEMP_2
1161
-    target_temperature[2] = 0;
1162
-    soft_pwm[2] = 0;
1163
-    WRITE_HEATER_2(LOW);
1074
+    DISABLE_HEATER(2);
1164 1075
   #endif
1165 1076
 
1166 1077
   #if EXTRUDERS > 3 && HAS_TEMP_3
1167
-    target_temperature[3] = 0;
1168
-    soft_pwm[3] = 0;
1169
-    WRITE_HEATER_3(LOW);
1078
+    DISABLE_HEATER(3);
1170 1079
   #endif
1171 1080
 
1172 1081
   #if HAS_TEMP_BED
@@ -1257,12 +1166,15 @@ enum TempState {
1257 1166
 // Timer 0 is shared with millies
1258 1167
 //
1259 1168
 ISR(TIMER0_COMPB_vect) {
1169
+  #ifdef TEMP_SENSOR_1_AS_REDUNDANT
1170
+    #define TEMP_SENSOR_COUNT 2
1171
+  #else 
1172
+    #define TEMP_SENSOR_COUNT EXTRUDERS
1173
+  #endif
1174
+
1260 1175
   //these variables are only accesible from the ISR, but static, so they don't lose their value
1261 1176
   static unsigned char temp_count = 0;
1262
-  static unsigned long raw_temp_0_value = 0;
1263
-  static unsigned long raw_temp_1_value = 0;
1264
-  static unsigned long raw_temp_2_value = 0;
1265
-  static unsigned long raw_temp_3_value = 0;
1177
+  static unsigned long raw_temp_value[TEMP_SENSOR_COUNT] = { 0 };
1266 1178
   static unsigned long raw_temp_bed_value = 0;
1267 1179
   static TempState temp_state = StartupDelay;
1268 1180
   static unsigned char pwm_count = BIT(SOFT_PWM_SCALE);
@@ -1474,10 +1386,11 @@ ISR(TIMER0_COMPB_vect) {
1474 1386
       break;
1475 1387
     case MeasureTemp_0:
1476 1388
       #if HAS_TEMP_0
1477
-        raw_temp_0_value += ADC;
1389
+        raw_temp_value[0] += ADC;
1478 1390
       #endif
1479 1391
       temp_state = PrepareTemp_BED;
1480 1392
       break;
1393
+
1481 1394
     case PrepareTemp_BED:
1482 1395
       #if HAS_TEMP_BED
1483 1396
         START_ADC(TEMP_BED_PIN);
@@ -1491,6 +1404,7 @@ ISR(TIMER0_COMPB_vect) {
1491 1404
       #endif
1492 1405
       temp_state = PrepareTemp_1;
1493 1406
       break;
1407
+
1494 1408
     case PrepareTemp_1:
1495 1409
       #if HAS_TEMP_1
1496 1410
         START_ADC(TEMP_1_PIN);
@@ -1500,10 +1414,11 @@ ISR(TIMER0_COMPB_vect) {
1500 1414
       break;
1501 1415
     case MeasureTemp_1:
1502 1416
       #if HAS_TEMP_1
1503
-        raw_temp_1_value += ADC;
1417
+        raw_temp_value[1] += ADC;
1504 1418
       #endif
1505 1419
       temp_state = PrepareTemp_2;
1506 1420
       break;
1421
+
1507 1422
     case PrepareTemp_2:
1508 1423
       #if HAS_TEMP_2
1509 1424
         START_ADC(TEMP_2_PIN);
@@ -1513,10 +1428,11 @@ ISR(TIMER0_COMPB_vect) {
1513 1428
       break;
1514 1429
     case MeasureTemp_2:
1515 1430
       #if HAS_TEMP_2
1516
-        raw_temp_2_value += ADC;
1431
+        raw_temp_value[2] += ADC;
1517 1432
       #endif
1518 1433
       temp_state = PrepareTemp_3;
1519 1434
       break;
1435
+
1520 1436
     case PrepareTemp_3:
1521 1437
       #if HAS_TEMP_3
1522 1438
         START_ADC(TEMP_3_PIN);
@@ -1526,10 +1442,11 @@ ISR(TIMER0_COMPB_vect) {
1526 1442
       break;
1527 1443
     case MeasureTemp_3:
1528 1444
       #if HAS_TEMP_3
1529
-        raw_temp_3_value += ADC;
1445
+        raw_temp_value[3] += ADC;
1530 1446
       #endif
1531 1447
       temp_state = Prepare_FILWIDTH;
1532 1448
       break;
1449
+
1533 1450
     case Prepare_FILWIDTH:
1534 1451
       #if HAS_FILAMENT_SENSOR
1535 1452
         START_ADC(FILWIDTH_PIN);
@@ -1548,6 +1465,7 @@ ISR(TIMER0_COMPB_vect) {
1548 1465
       temp_state = PrepareTemp_0;
1549 1466
       temp_count++;
1550 1467
       break;
1468
+
1551 1469
     case StartupDelay:
1552 1470
       temp_state = PrepareTemp_0;
1553 1471
       break;
@@ -1557,23 +1475,23 @@ ISR(TIMER0_COMPB_vect) {
1557 1475
     //   SERIAL_ERRORLNPGM("Temp measurement error!");
1558 1476
     //   break;
1559 1477
   } // switch(temp_state)
1560
-    
1478
+
1561 1479
   if (temp_count >= OVERSAMPLENR) { // 10 * 16 * 1/(16000000/64/256)  = 164ms.
1562 1480
     if (!temp_meas_ready) { //Only update the raw values if they have been read. Else we could be updating them during reading.
1563 1481
       #ifndef HEATER_0_USES_MAX6675
1564
-        current_temperature_raw[0] = raw_temp_0_value;
1482
+        current_temperature_raw[0] = raw_temp_value[0];
1565 1483
       #endif
1566 1484
       #if EXTRUDERS > 1
1567
-        current_temperature_raw[1] = raw_temp_1_value;
1485
+        current_temperature_raw[1] = raw_temp_value[1];
1568 1486
         #if EXTRUDERS > 2
1569
-          current_temperature_raw[2] = raw_temp_2_value;
1487
+          current_temperature_raw[2] = raw_temp_value[2];
1570 1488
           #if EXTRUDERS > 3
1571
-            current_temperature_raw[3] = raw_temp_3_value;
1489
+            current_temperature_raw[3] = raw_temp_value[3];
1572 1490
           #endif
1573 1491
         #endif
1574 1492
       #endif
1575 1493
       #ifdef TEMP_SENSOR_1_AS_REDUNDANT
1576
-        redundant_temperature_raw = raw_temp_1_value;
1494
+        redundant_temperature_raw = raw_temp_value[1];
1577 1495
       #endif
1578 1496
       current_temperature_bed_raw = raw_temp_bed_value;
1579 1497
     } //!temp_meas_ready
@@ -1582,34 +1500,69 @@ ISR(TIMER0_COMPB_vect) {
1582 1500
     #if HAS_FILAMENT_SENSOR
1583 1501
       current_raw_filwidth = raw_filwidth_value >> 10;  // Divide to get to 0-16384 range since we used 1/128 IIR filter approach
1584 1502
     #endif
1585
-    
1503
+
1586 1504
     temp_meas_ready = true;
1587 1505
     temp_count = 0;
1588
-    raw_temp_0_value = 0;
1589
-    raw_temp_1_value = 0;
1590
-    raw_temp_2_value = 0;
1591
-    raw_temp_3_value = 0;
1506
+    for (int i = 0; i < TEMP_SENSOR_COUNT; i++) raw_temp_value[i] = 0;
1592 1507
     raw_temp_bed_value = 0;
1593 1508
 
1594
-    #if HEATER_0_RAW_LO_TEMP > HEATER_0_RAW_HI_TEMP
1595
-      #define MAXTEST <=
1596
-      #define MINTEST >=
1509
+    #ifdef HEATER_0_USES_MAX6675
1510
+      float ct = current_temperature[0];
1511
+      if (ct > min(HEATER_0_MAXTEMP, 1023)) max_temp_error(0);
1512
+      if (ct < max(HEATER_0_MINTEMP, 0.01)) min_temp_error(0);
1597 1513
     #else
1598
-      #define MAXTEST >=
1599
-      #define MINTEST <=
1514
+      #if HEATER_0_RAW_LO_TEMP > HEATER_0_RAW_HI_TEMP
1515
+        #define GE0 <=
1516
+      #else
1517
+        #define GE0 >=
1518
+      #endif
1519
+      if (current_temperature_raw[0] GE0 maxttemp_raw[0]) max_temp_error(0);
1520
+      if (minttemp_raw[0] GE0 current_temperature_raw[0]) min_temp_error(0);
1600 1521
     #endif
1601 1522
 
1602
-    for (int i=0; i<EXTRUDERS; i++) {
1603
-      if (current_temperature_raw[i] MAXTEST maxttemp_raw[i]) max_temp_error(i);
1604
-      else if (current_temperature_raw[i] MINTEST minttemp_raw[i]) min_temp_error(i);
1605
-    }
1606
-    /* No bed MINTEMP error? */
1523
+    #if EXTRUDERS > 1
1524
+      #if HEATER_1_RAW_LO_TEMP > HEATER_1_RAW_HI_TEMP
1525
+        #define GE1 <=
1526
+      #else
1527
+        #define GE1 >=
1528
+      #endif
1529
+      if (current_temperature_raw[1] GE1 maxttemp_raw[1]) max_temp_error(1);
1530
+      if (minttemp_raw[1] GE0 current_temperature_raw[1]) min_temp_error(1);
1531
+
1532
+      #if EXTRUDERS > 2
1533
+        #if HEATER_2_RAW_LO_TEMP > HEATER_2_RAW_HI_TEMP
1534
+          #define GE2 <=
1535
+        #else
1536
+          #define GE2 >=
1537
+        #endif
1538
+        if (current_temperature_raw[2] GE2 maxttemp_raw[2]) max_temp_error(2);
1539
+        if (minttemp_raw[2] GE0 current_temperature_raw[2]) min_temp_error(2);
1540
+
1541
+        #if EXTRUDERS > 3
1542
+          #if HEATER_3_RAW_LO_TEMP > HEATER_3_RAW_HI_TEMP
1543
+            #define GE3 <=
1544
+          #else
1545
+            #define GE3 >=
1546
+          #endif
1547
+          if (current_temperature_raw[3] GE3 maxttemp_raw[3]) max_temp_error(3);
1548
+          if (minttemp_raw[3] GE0 current_temperature_raw[3]) min_temp_error(3);
1549
+
1550
+        #endif // EXTRUDERS > 3
1551
+      #endif // EXTRUDERS > 2
1552
+    #endif // EXTRUDERS > 1
1553
+
1607 1554
     #if defined(BED_MAXTEMP) && (TEMP_SENSOR_BED != 0)
1608
-      if (current_temperature_bed_raw MAXTEST bed_maxttemp_raw) {
1609
-          target_temperature_bed = 0;
1610
-          bed_max_temp_error();
1611
-        }
1555
+      #if HEATER_BED_RAW_LO_TEMP > HEATER_BED_RAW_HI_TEMP
1556
+        #define GEBED <=
1557
+      #else
1558
+        #define GEBED >=
1559
+      #endif
1560
+      if (current_temperature_bed_raw GEBED bed_maxttemp_raw) {
1561
+        target_temperature_bed = 0;
1562
+        bed_max_temp_error();
1563
+      }
1612 1564
     #endif
1565
+
1613 1566
   } // temp_count >= OVERSAMPLENR
1614 1567
 
1615 1568
   #ifdef BABYSTEPPING

+ 94
- 12
Marlin/ultralcd.cpp View File

@@ -1,4 +1,3 @@
1
-#include "temperature.h"
2 1
 #include "ultralcd.h"
3 2
 #ifdef ULTRA_LCD
4 3
 #include "Marlin.h"
@@ -70,6 +69,13 @@ static void lcd_sdcard_menu();
70 69
 static void lcd_delta_calibrate_menu();
71 70
 #endif // DELTA_CALIBRATION_MENU
72 71
 
72
+#if defined(MANUAL_BED_LEVELING)
73
+#include "mesh_bed_leveling.h"
74
+static void _lcd_level_bed();
75
+static void _lcd_level_bed_homing();
76
+static void lcd_level_bed();
77
+#endif  // MANUAL_BED_LEVELING
78
+
73 79
 static void lcd_quick_feedback();//Cause an LCD refresh, and give the user visual or audible feedback that something has happened
74 80
 
75 81
 /* Different types of actions that can be used in menu items. */
@@ -198,8 +204,8 @@ static void menu_action_setting_edit_callback_long5(const char* pstr, unsigned l
198 204
   #define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(type, label, args...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## args)
199 205
 #endif //!ENCODER_RATE_MULTIPLIER
200 206
 #define END_MENU() \
201
-    if (encoderPosition / ENCODER_STEPS_PER_MENU_ITEM >= _menuItemNr) encoderPosition = _menuItemNr * ENCODER_STEPS_PER_MENU_ITEM - 1; \
202
-    if ((uint8_t)(encoderPosition / ENCODER_STEPS_PER_MENU_ITEM) >= currentMenuViewOffset + LCD_HEIGHT) { currentMenuViewOffset = (encoderPosition / ENCODER_STEPS_PER_MENU_ITEM) - LCD_HEIGHT + 1; lcdDrawUpdate = 1; _lineNr = currentMenuViewOffset - 1; _drawLineNr = -1; } \
207
+    if (encoderLine >= _menuItemNr) encoderPosition = _menuItemNr * ENCODER_STEPS_PER_MENU_ITEM - 1; encoderLine = encoderPosition / ENCODER_STEPS_PER_MENU_ITEM;\
208
+    if (encoderLine >= currentMenuViewOffset + LCD_HEIGHT) { currentMenuViewOffset = encoderLine - LCD_HEIGHT + 1; lcdDrawUpdate = 1; _lineNr = currentMenuViewOffset - 1; _drawLineNr = -1; } \
203 209
     } } while(0)
204 210
 
205 211
 /** Used variables to keep track of the menu */
@@ -430,7 +436,7 @@ static void lcd_main_menu() {
430 436
 void lcd_set_home_offsets() {
431 437
   for(int8_t i=0; i < NUM_AXIS; i++) {
432 438
     if (i != E_AXIS) {
433
-      add_homing[i] -= current_position[i];
439
+      home_offset[i] -= current_position[i];
434 440
       current_position[i] = 0.0;
435 441
     }
436 442
   }
@@ -630,6 +636,10 @@ static void lcd_prepare_menu() {
630 636
     }
631 637
   #endif
632 638
   MENU_ITEM(submenu, MSG_MOVE_AXIS, lcd_move_menu);
639
+
640
+  #if defined(MANUAL_BED_LEVELING)
641
+    MENU_ITEM(submenu, MSG_LEVEL_BED, lcd_level_bed);
642
+  #endif
633 643
 	
634 644
   END_MENU();
635 645
 }
@@ -901,9 +911,9 @@ static void lcd_control_motion_menu() {
901 911
   START_MENU();
902 912
   MENU_ITEM(back, MSG_CONTROL, lcd_control_menu);
903 913
   #ifdef ENABLE_AUTO_BED_LEVELING
904
-    MENU_ITEM_EDIT(float32, MSG_ZPROBE_ZOFFSET, &zprobe_zoffset, 0.5, 50);
914
+    MENU_ITEM_EDIT(float32, MSG_ZPROBE_ZOFFSET, &zprobe_zoffset, 0.0, 50);
905 915
   #endif
906
-  MENU_ITEM_EDIT(float5, MSG_ACC, &acceleration, 500, 99000);
916
+  MENU_ITEM_EDIT(float5, MSG_ACC, &acceleration, 10, 99000);
907 917
   MENU_ITEM_EDIT(float3, MSG_VXY_JERK, &max_xy_jerk, 1, 990);
908 918
   MENU_ITEM_EDIT(float52, MSG_VZ_JERK, &max_z_jerk, 0.1, 990);
909 919
   MENU_ITEM_EDIT(float3, MSG_VE_JERK, &max_e_jerk, 1, 990);
@@ -915,7 +925,7 @@ static void lcd_control_motion_menu() {
915 925
   MENU_ITEM_EDIT(float3, MSG_VTRAV_MIN, &mintravelfeedrate, 0, 999);
916 926
   MENU_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_X, &max_acceleration_units_per_sq_second[X_AXIS], 100, 99000, reset_acceleration_rates);
917 927
   MENU_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_Y, &max_acceleration_units_per_sq_second[Y_AXIS], 100, 99000, reset_acceleration_rates);
918
-  MENU_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_Z, &max_acceleration_units_per_sq_second[Z_AXIS], 100, 99000, reset_acceleration_rates);
928
+  MENU_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_Z, &max_acceleration_units_per_sq_second[Z_AXIS], 10, 99000, reset_acceleration_rates);
919 929
   MENU_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_E, &max_acceleration_units_per_sq_second[E_AXIS], 100, 99000, reset_acceleration_rates);
920 930
   MENU_ITEM_EDIT(float5, MSG_A_RETRACT, &retract_acceleration, 100, 99000);
921 931
   MENU_ITEM_EDIT(float5, MSG_A_TRAVEL, &travel_acceleration, 100, 99000);
@@ -1189,10 +1199,6 @@ void lcd_init() {
1189 1199
      WRITE(SHIFT_OUT,HIGH);
1190 1200
      WRITE(SHIFT_LD,HIGH);
1191 1201
      WRITE(SHIFT_EN,LOW);
1192
-  #else
1193
-     #ifdef ULTIPANEL
1194
-     #error ULTIPANEL requires an encoder
1195
-     #endif
1196 1202
   #endif // SR_LCD_2W_NL
1197 1203
 #endif//!NEWPANEL
1198 1204
 
@@ -1341,7 +1347,12 @@ void lcd_update() {
1341 1347
     #endif
1342 1348
 
1343 1349
     #ifdef ULTIPANEL
1344
-      if (currentMenu != lcd_status_screen && millis() > timeoutToStatus) {
1350
+      if (currentMenu != lcd_status_screen &&
1351
+        #if defined(MANUAL_BED_LEVELING)
1352
+          currentMenu != _lcd_level_bed && 
1353
+          currentMenu != _lcd_level_bed_homing && 
1354
+        #endif  // MANUAL_BED_LEVELING
1355
+          millis() > timeoutToStatus) {
1345 1356
         lcd_return_to_status();
1346 1357
         lcdDrawUpdate = 2;
1347 1358
       }
@@ -1760,4 +1771,75 @@ char *ftostr52(const float &x)
1760 1771
   return conv;
1761 1772
 }
1762 1773
 
1774
+#if defined(MANUAL_BED_LEVELING)
1775
+static int _lcd_level_bed_position;
1776
+static void _lcd_level_bed()
1777
+{
1778
+  if (encoderPosition != 0) {
1779
+    refresh_cmd_timeout();
1780
+    current_position[Z_AXIS] += float((int)encoderPosition) * 0.05;
1781
+    if (min_software_endstops && current_position[Z_AXIS] < Z_MIN_POS) current_position[Z_AXIS] = Z_MIN_POS;
1782
+    if (max_software_endstops && current_position[Z_AXIS] > Z_MAX_POS) current_position[Z_AXIS] = Z_MAX_POS;
1783
+    encoderPosition = 0;
1784
+    plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], manual_feedrate[Z_AXIS]/60, active_extruder);
1785
+    lcdDrawUpdate = 1;
1786
+  }
1787
+  if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR("Z"), ftostr32(current_position[Z_AXIS]));
1788
+  static bool debounce_click = false;
1789
+  if (LCD_CLICKED) {
1790
+    if (!debounce_click) {
1791
+      debounce_click = true;
1792
+      int ix = _lcd_level_bed_position % MESH_NUM_X_POINTS;
1793
+      int iy = _lcd_level_bed_position / MESH_NUM_X_POINTS;
1794
+      mbl.set_z(ix, iy, current_position[Z_AXIS]);
1795
+      _lcd_level_bed_position++;
1796
+      if (_lcd_level_bed_position == MESH_NUM_X_POINTS*MESH_NUM_Y_POINTS) {
1797
+        current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
1798
+        plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], manual_feedrate[X_AXIS]/60, active_extruder);
1799
+        mbl.active = 1;
1800
+        enquecommands_P(PSTR("G28"));
1801
+        lcd_return_to_status();
1802
+      } else {
1803
+        current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
1804
+        plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], manual_feedrate[X_AXIS]/60, active_extruder);
1805
+        ix = _lcd_level_bed_position % MESH_NUM_X_POINTS;
1806
+        iy = _lcd_level_bed_position / MESH_NUM_X_POINTS;
1807
+        if (iy&1) { // Zig zag
1808
+          ix = (MESH_NUM_X_POINTS - 1) - ix;
1809
+        }
1810
+        current_position[X_AXIS] = mbl.get_x(ix);
1811
+        current_position[Y_AXIS] = mbl.get_y(iy);
1812
+        plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], manual_feedrate[X_AXIS]/60, active_extruder);
1813
+        lcdDrawUpdate = 1;
1814
+      }
1815
+    }
1816
+  } else {
1817
+    debounce_click = false;
1818
+  }
1819
+}
1820
+static void _lcd_level_bed_homing()
1821
+{
1822
+  if (axis_known_position[X_AXIS] &&
1823
+      axis_known_position[Y_AXIS] &&
1824
+      axis_known_position[Z_AXIS]) {
1825
+    current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
1826
+    plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
1827
+    current_position[X_AXIS] = MESH_MIN_X;
1828
+    current_position[Y_AXIS] = MESH_MIN_Y;
1829
+    plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], manual_feedrate[X_AXIS]/60, active_extruder);
1830
+    _lcd_level_bed_position = 0;
1831
+    lcd_goto_menu(_lcd_level_bed);
1832
+  }
1833
+}
1834
+static void lcd_level_bed()
1835
+{
1836
+  axis_known_position[X_AXIS] = false;
1837
+  axis_known_position[Y_AXIS] = false;
1838
+  axis_known_position[Z_AXIS] = false;
1839
+  mbl.reset();
1840
+  enquecommands_P(PSTR("G28"));
1841
+  lcd_goto_menu(_lcd_level_bed_homing);
1842
+}
1843
+#endif  // MANUAL_BED_LEVELING
1844
+
1763 1845
 #endif //ULTRA_LCD

+ 12
- 13
Marlin/ultralcd.h View File

@@ -14,10 +14,10 @@
14 14
   void lcd_reset_alert_level();
15 15
   bool lcd_detected(void);
16 16
 
17
-#ifdef DOGLCD
18
-  extern int lcd_contrast;
19
-  void lcd_setcontrast(uint8_t value);
20
-#endif
17
+  #ifdef DOGLCD
18
+    extern int lcd_contrast;
19
+    void lcd_setcontrast(uint8_t value);
20
+  #endif
21 21
 
22 22
   static unsigned char blink = 0;	// Variable for visualization of fan rotation in GLCD
23 23
 
@@ -28,27 +28,26 @@
28 28
   #define LCD_TIMEOUT_TO_STATUS 15000
29 29
 
30 30
   #ifdef ULTIPANEL
31
-  void lcd_buttons_update();
32
-  extern volatile uint8_t buttons;  //the last checked buttons in a bit array.
33
-  #ifdef REPRAPWORLD_KEYPAD
34
-    extern volatile uint8_t buttons_reprapworld_keypad; // to store the keypad shift register values
35
-  #endif
31
+    void lcd_buttons_update();
32
+    extern volatile uint8_t buttons;  //the last checked buttons in a bit array.
33
+    #ifdef REPRAPWORLD_KEYPAD
34
+      extern volatile uint8_t buttons_reprapworld_keypad; // to store the keypad shift register values
35
+    #endif
36 36
   #else
37
-  FORCE_INLINE void lcd_buttons_update() {}
37
+    FORCE_INLINE void lcd_buttons_update() {}
38 38
   #endif
39 39
 
40 40
   extern int plaPreheatHotendTemp;
41 41
   extern int plaPreheatHPBTemp;
42 42
   extern int plaPreheatFanSpeed;
43
-
44 43
   extern int absPreheatHotendTemp;
45 44
   extern int absPreheatHPBTemp;
46 45
   extern int absPreheatFanSpeed;
47
-  
46
+
48 47
   extern bool cancel_heatup;
49 48
   
50 49
   #ifdef FILAMENT_LCD_DISPLAY
51
-        extern unsigned long message_millis;
50
+    extern unsigned long message_millis;
52 51
   #endif
53 52
 
54 53
   void lcd_buzz(long duration,uint16_t freq);

Loading…
Cancel
Save