My Marlin configs for Fabrikator Mini and CTC i3 Pro B
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Conditionals.h 12KB

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