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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. /**
  2. * Conditionals.h
  3. * Defines that depend on configuration but are not editable.
  4. */
  5. #ifndef CONDITIONALS_H
  6. #define CONDITIONALS_H
  7. #ifndef AT90USB
  8. #define HardwareSerial_h // trick to disable the standard HWserial
  9. #endif
  10. #if (ARDUINO >= 100)
  11. #include "Arduino.h"
  12. #else
  13. #include "WProgram.h"
  14. #endif
  15. #include "pins.h"
  16. /**
  17. * ENDSTOPPULLUPS
  18. */
  19. #ifdef ENDSTOPPULLUPS
  20. #ifndef DISABLE_MAX_ENDSTOPS
  21. #define ENDSTOPPULLUP_XMAX
  22. #define ENDSTOPPULLUP_YMAX
  23. #define ENDSTOPPULLUP_ZMAX
  24. #endif
  25. #ifndef DISABLE_MIN_ENDSTOPS
  26. #define ENDSTOPPULLUP_XMIN
  27. #define ENDSTOPPULLUP_YMIN
  28. #define ENDSTOPPULLUP_ZMIN
  29. #endif
  30. #endif
  31. /**
  32. * Axis lengths
  33. */
  34. #define X_MAX_LENGTH (X_MAX_POS - X_MIN_POS)
  35. #define Y_MAX_LENGTH (Y_MAX_POS - Y_MIN_POS)
  36. #define Z_MAX_LENGTH (Z_MAX_POS - Z_MIN_POS)
  37. /**
  38. * SCARA
  39. */
  40. #ifdef SCARA
  41. #undef SLOWDOWN
  42. #define QUICK_HOME //SCARA needs Quickhome
  43. #endif
  44. /**
  45. * AUTOSET LOCATIONS OF LIMIT SWITCHES
  46. * Added by ZetaPhoenix 09-15-2012
  47. */
  48. #ifdef MANUAL_HOME_POSITIONS // Use manual limit switch locations
  49. #define X_HOME_POS MANUAL_X_HOME_POS
  50. #define Y_HOME_POS MANUAL_Y_HOME_POS
  51. #define Z_HOME_POS MANUAL_Z_HOME_POS
  52. #else //!MANUAL_HOME_POSITIONS – Use home switch positions based on homing direction and travel limits
  53. #ifdef BED_CENTER_AT_0_0
  54. #define X_HOME_POS X_MAX_LENGTH * X_HOME_DIR * 0.5
  55. #define Y_HOME_POS Y_MAX_LENGTH * Y_HOME_DIR * 0.5
  56. #else
  57. #define X_HOME_POS (X_HOME_DIR < 0 ? X_MIN_POS : X_MAX_POS)
  58. #define Y_HOME_POS (Y_HOME_DIR < 0 ? Y_MIN_POS : Y_MAX_POS)
  59. #endif
  60. #define Z_HOME_POS (Z_HOME_DIR < 0 ? Z_MIN_POS : Z_MAX_POS)
  61. #endif //!MANUAL_HOME_POSITIONS
  62. /**
  63. * Auto Bed Leveling
  64. */
  65. #ifdef ENABLE_AUTO_BED_LEVELING
  66. // Boundaries for probing based on set limits
  67. #define MIN_PROBE_X (max(X_MIN_POS, X_MIN_POS + X_PROBE_OFFSET_FROM_EXTRUDER))
  68. #define MAX_PROBE_X (min(X_MAX_POS, X_MAX_POS + X_PROBE_OFFSET_FROM_EXTRUDER))
  69. #define MIN_PROBE_Y (max(Y_MIN_POS, Y_MIN_POS + Y_PROBE_OFFSET_FROM_EXTRUDER))
  70. #define MAX_PROBE_Y (min(Y_MAX_POS, Y_MAX_POS + Y_PROBE_OFFSET_FROM_EXTRUDER))
  71. #endif
  72. /**
  73. * MAX_STEP_FREQUENCY differs for TOSHIBA
  74. */
  75. #ifdef CONFIG_STEPPERS_TOSHIBA
  76. #define MAX_STEP_FREQUENCY 10000 // Max step frequency for Toshiba Stepper Controllers
  77. #else
  78. #define MAX_STEP_FREQUENCY 40000 // Max step frequency for Ultimaker (5000 pps / half step)
  79. #endif
  80. // MS1 MS2 Stepper Driver Microstepping mode table
  81. #define MICROSTEP1 LOW,LOW
  82. #define MICROSTEP2 HIGH,LOW
  83. #define MICROSTEP4 LOW,HIGH
  84. #define MICROSTEP8 HIGH,HIGH
  85. #define MICROSTEP16 HIGH,HIGH
  86. /**
  87. * Advance calculated values
  88. */
  89. #ifdef ADVANCE
  90. #define EXTRUSION_AREA (0.25 * D_FILAMENT * D_FILAMENT * 3.14159)
  91. #define STEPS_PER_CUBIC_MM_E (axis_steps_per_unit[E_AXIS] / EXTRUSION_AREA)
  92. #endif
  93. #ifdef ULTIPANEL
  94. #undef SDCARDDETECTINVERTED
  95. #endif
  96. // Power Signal Control Definitions
  97. // By default use ATX definition
  98. #ifndef POWER_SUPPLY
  99. #define POWER_SUPPLY 1
  100. #endif
  101. // 1 = ATX
  102. #if (POWER_SUPPLY == 1)
  103. #define PS_ON_AWAKE LOW
  104. #define PS_ON_ASLEEP HIGH
  105. #endif
  106. // 2 = X-Box 360 203W
  107. #if (POWER_SUPPLY == 2)
  108. #define PS_ON_AWAKE HIGH
  109. #define PS_ON_ASLEEP LOW
  110. #endif
  111. /**
  112. * Temp Sensor defines
  113. */
  114. #if TEMP_SENSOR_0 == -2
  115. #define HEATER_0_USES_MAX6675
  116. #elif TEMP_SENSOR_0 == -1
  117. #define HEATER_0_USES_AD595
  118. #elif TEMP_SENSOR_0 == 0
  119. #undef HEATER_0_MINTEMP
  120. #undef HEATER_0_MAXTEMP
  121. #elif TEMP_SENSOR_0 > 0
  122. #define THERMISTORHEATER_0 TEMP_SENSOR_0
  123. #define HEATER_0_USES_THERMISTOR
  124. #endif
  125. #if TEMP_SENSOR_1 == -1
  126. #define HEATER_1_USES_AD595
  127. #elif TEMP_SENSOR_1 == 0
  128. #undef HEATER_1_MINTEMP
  129. #undef HEATER_1_MAXTEMP
  130. #elif TEMP_SENSOR_1 > 0
  131. #define THERMISTORHEATER_1 TEMP_SENSOR_1
  132. #define HEATER_1_USES_THERMISTOR
  133. #endif
  134. #if TEMP_SENSOR_2 == -1
  135. #define HEATER_2_USES_AD595
  136. #elif TEMP_SENSOR_2 == 0
  137. #undef HEATER_2_MINTEMP
  138. #undef HEATER_2_MAXTEMP
  139. #elif TEMP_SENSOR_2 > 0
  140. #define THERMISTORHEATER_2 TEMP_SENSOR_2
  141. #define HEATER_2_USES_THERMISTOR
  142. #endif
  143. #if TEMP_SENSOR_3 == -1
  144. #define HEATER_3_USES_AD595
  145. #elif TEMP_SENSOR_3 == 0
  146. #undef HEATER_3_MINTEMP
  147. #undef HEATER_3_MAXTEMP
  148. #elif TEMP_SENSOR_3 > 0
  149. #define THERMISTORHEATER_3 TEMP_SENSOR_3
  150. #define HEATER_3_USES_THERMISTOR
  151. #endif
  152. #if TEMP_SENSOR_BED == -1
  153. #define BED_USES_AD595
  154. #elif TEMP_SENSOR_BED == 0
  155. #undef BED_MINTEMP
  156. #undef BED_MAXTEMP
  157. #elif TEMP_SENSOR_BED > 0
  158. #define THERMISTORBED TEMP_SENSOR_BED
  159. #define BED_USES_THERMISTOR
  160. #endif
  161. /**
  162. * ARRAY_BY_EXTRUDERS based on EXTRUDERS
  163. */
  164. #if EXTRUDERS > 3
  165. #define ARRAY_BY_EXTRUDERS(v1, v2, v3, v4) { v1, v2, v3, v4 }
  166. #elif EXTRUDERS > 2
  167. #define ARRAY_BY_EXTRUDERS(v1, v2, v3, v4) { v1, v2, v3 }
  168. #elif EXTRUDERS > 1
  169. #define ARRAY_BY_EXTRUDERS(v1, v2, v3, v4) { v1, v2 }
  170. #else
  171. #define ARRAY_BY_EXTRUDERS(v1, v2, v3, v4) { v1 }
  172. #endif
  173. /**
  174. * Shorthand for pin tests, for temperature.cpp
  175. */
  176. #define HAS_TEMP_0 (defined(TEMP_0_PIN) && TEMP_0_PIN >= 0)
  177. #define HAS_TEMP_1 (defined(TEMP_1_PIN) && TEMP_1_PIN >= 0)
  178. #define HAS_TEMP_2 (defined(TEMP_2_PIN) && TEMP_2_PIN >= 0)
  179. #define HAS_TEMP_3 (defined(TEMP_3_PIN) && TEMP_3_PIN >= 0)
  180. #define HAS_TEMP_BED (defined(TEMP_BED_PIN) && TEMP_BED_PIN >= 0)
  181. #define HAS_FILAMENT_SENSOR (defined(FILAMENT_SENSOR) && defined(FILWIDTH_PIN) && FILWIDTH_PIN >= 0)
  182. #define HAS_HEATER_0 (defined(HEATER_0_PIN) && HEATER_0_PIN >= 0)
  183. #define HAS_HEATER_1 (defined(HEATER_1_PIN) && HEATER_1_PIN >= 0)
  184. #define HAS_HEATER_2 (defined(HEATER_2_PIN) && HEATER_2_PIN >= 0)
  185. #define HAS_HEATER_3 (defined(HEATER_3_PIN) && HEATER_3_PIN >= 0)
  186. #define HAS_HEATER_BED (defined(HEATER_BED_PIN) && HEATER_BED_PIN >= 0)
  187. #define HAS_AUTO_FAN_0 (defined(EXTRUDER_0_AUTO_FAN_PIN) && EXTRUDER_0_AUTO_FAN_PIN >= 0)
  188. #define HAS_AUTO_FAN_1 (defined(EXTRUDER_1_AUTO_FAN_PIN) && EXTRUDER_1_AUTO_FAN_PIN >= 0)
  189. #define HAS_AUTO_FAN_2 (defined(EXTRUDER_2_AUTO_FAN_PIN) && EXTRUDER_2_AUTO_FAN_PIN >= 0)
  190. #define HAS_AUTO_FAN_3 (defined(EXTRUDER_3_AUTO_FAN_PIN) && EXTRUDER_3_AUTO_FAN_PIN >= 0)
  191. #define HAS_AUTO_FAN HAS_AUTO_FAN_0 || HAS_AUTO_FAN_1 || HAS_AUTO_FAN_2 || HAS_AUTO_FAN_3
  192. #define HAS_FAN (defined(FAN_PIN) && FAN_PIN >= 0)
  193. /**
  194. * Helper Macros for heaters and extruder fan
  195. */
  196. #define WRITE_HEATER_0P(v) WRITE(HEATER_0_PIN, v)
  197. #if EXTRUDERS > 1 || defined(HEATERS_PARALLEL)
  198. #define WRITE_HEATER_1(v) WRITE(HEATER_1_PIN, v)
  199. #if EXTRUDERS > 2
  200. #define WRITE_HEATER_2(v) WRITE(HEATER_2_PIN, v)
  201. #if EXTRUDERS > 3
  202. #define WRITE_HEATER_3(v) WRITE(HEATER_3_PIN, v)
  203. #endif
  204. #endif
  205. #endif
  206. #ifdef HEATERS_PARALLEL
  207. #define WRITE_HEATER_0(v) { WRITE_HEATER_0P(v); WRITE_HEATER_1(v); }
  208. #else
  209. #define WRITE_HEATER_0(v) WRITE_HEATER_0P(v)
  210. #endif
  211. #if HAS_HEATER_BED
  212. #define WRITE_HEATER_BED(v) WRITE(HEATER_BED_PIN, v)
  213. #endif
  214. #if HAS_FAN
  215. #define WRITE_FAN(v) WRITE(FAN_PIN, v)
  216. #endif
  217. /**
  218. * Sampling period of the temperature routine
  219. * This override comes originally from temperature.cpp
  220. * The Configuration.h option is basically ignored.
  221. */
  222. #ifdef PID_dT
  223. #undef PID_dT
  224. #endif
  225. #define PID_dT ((OVERSAMPLENR * 12.0)/(F_CPU / 64.0 / 256.0))
  226. #endif //CONDITIONALS_H