My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

Conditionals.h 12KB

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