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.

SanityCheck.h 9.0KB

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