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 4.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
  4. *
  5. * Based on Sprinter and grbl.
  6. * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  20. *
  21. */
  22. #pragma once
  23. /**
  24. * Test AVR-specific configuration values for errors at compile-time.
  25. */
  26. /**
  27. * Check for common serial pin conflicts
  28. */
  29. #define CHECK_SERIAL_PIN(N) ( \
  30. X_STOP_PIN == N || Y_STOP_PIN == N || Z_STOP_PIN == N \
  31. || X_MIN_PIN == N || Y_MIN_PIN == N || Z_MIN_PIN == N \
  32. || X_MAX_PIN == N || Y_MAX_PIN == N || Z_MAX_PIN == N \
  33. || X_STEP_PIN == N || Y_STEP_PIN == N || Z_STEP_PIN == N \
  34. || X_DIR_PIN == N || Y_DIR_PIN == N || Z_DIR_PIN == N \
  35. || X_ENA_PIN == N || Y_ENA_PIN == N || Z_ENA_PIN == N \
  36. || BTN_EN1 == N || BTN_EN2 == N \
  37. )
  38. #if SERIAL_IN_USE(0)
  39. // D0-D1. No known conflicts.
  40. #endif
  41. #if SERIAL_IN_USE(1)
  42. #if NOT_TARGET(__AVR_ATmega644P__, __AVR_ATmega1284P__)
  43. #if CHECK_SERIAL_PIN(18) || CHECK_SERIAL_PIN(19)
  44. #error "Serial Port 1 pin D18 and/or D19 conflicts with another pin on the board."
  45. #endif
  46. #else
  47. #if CHECK_SERIAL_PIN(10) || CHECK_SERIAL_PIN(11)
  48. #error "Serial Port 1 pin D10 and/or D11 conflicts with another pin on the board."
  49. #endif
  50. #endif
  51. #endif
  52. #if SERIAL_IN_USE(2) && (CHECK_SERIAL_PIN(16) || CHECK_SERIAL_PIN(17))
  53. #error "Serial Port 2 pin D16 and/or D17 conflicts with another pin on the board."
  54. #endif
  55. #if SERIAL_IN_USE(3) && (CHECK_SERIAL_PIN(14) || CHECK_SERIAL_PIN(15))
  56. #error "Serial Port 3 pin D14 and/or D15 conflicts with another pin on the board."
  57. #endif
  58. #undef CHECK_SERIAL_PIN
  59. /**
  60. * Checks for FAST PWM
  61. */
  62. #if ALL(FAST_PWM_FAN, USE_OCR2A_AS_TOP, HAS_TCCR2)
  63. #error "USE_OCR2A_AS_TOP does not apply to devices with a single output TIMER2."
  64. #endif
  65. /**
  66. * Checks for SOFT PWM
  67. */
  68. #if HAS_FAN0 && FAN_PIN == 9 && DISABLED(FAN_SOFT_PWM) && ENABLED(SPEAKER)
  69. #error "FAN_PIN 9 Hardware PWM uses Timer 2 which conflicts with Arduino AVR Tone Timer (for SPEAKER)."
  70. #error "Disable SPEAKER or enable FAN_SOFT_PWM."
  71. #endif
  72. /**
  73. * Sanity checks for Spindle / Laser PWM
  74. */
  75. #if ENABLED(SPINDLE_LASER_USE_PWM)
  76. #include "../ServoTimers.h" // Needed to check timer availability (_useTimer3)
  77. #if SPINDLE_LASER_PWM_PIN == 4 || WITHIN(SPINDLE_LASER_PWM_PIN, 11, 13)
  78. #error "Counter/Timer for SPINDLE_LASER_PWM_PIN is used by a system interrupt."
  79. #elif NUM_SERVOS > 0 && defined(_useTimer3) && (WITHIN(SPINDLE_LASER_PWM_PIN, 2, 3) || SPINDLE_LASER_PWM_PIN == 5)
  80. #error "Counter/Timer for SPINDLE_LASER_PWM_PIN is used by the servo system."
  81. #endif
  82. #elif SPINDLE_LASER_FREQUENCY
  83. #error "SPINDLE_LASER_FREQUENCY requires SPINDLE_LASER_USE_PWM."
  84. #endif
  85. /**
  86. * The Trinamic library includes SoftwareSerial.h, leading to a compile error.
  87. */
  88. #if BOTH(HAS_TRINAMIC_CONFIG, ENDSTOP_INTERRUPTS_FEATURE)
  89. #error "TMCStepper includes SoftwareSerial.h which is incompatible with ENDSTOP_INTERRUPTS_FEATURE. Disable ENDSTOP_INTERRUPTS_FEATURE to continue."
  90. #endif
  91. #if BOTH(HAS_TMC_SW_SERIAL, MONITOR_DRIVER_STATUS)
  92. #error "MONITOR_DRIVER_STATUS causes performance issues when used with SoftwareSerial-connected drivers. Disable MONITOR_DRIVER_STATUS or use hardware serial to continue."
  93. #endif
  94. /**
  95. * Postmortem debugging
  96. */
  97. #if ENABLED(POSTMORTEM_DEBUGGING)
  98. #error "POSTMORTEM_DEBUGGING is not supported on AVR boards."
  99. #endif
  100. #if USING_PULLDOWNS
  101. #error "PULLDOWN pin mode is not available on AVR boards."
  102. #endif