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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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 NOT_TARGET(__AVR_ATmega644P__, __AVR_ATmega1284P__)
  42. #if SERIAL_IN_USE(1) && (CHECK_SERIAL_PIN(18) || CHECK_SERIAL_PIN(19))
  43. #error "Serial Port 1 pin D18 and/or D19 conflicts with another pin on the board."
  44. #endif
  45. #else
  46. #if SERIAL_IN_USE(1) && (CHECK_SERIAL_PIN(10) || CHECK_SERIAL_PIN(11))
  47. #error "Serial Port 1 pin D10 and/or D11 conflicts with another pin on the board."
  48. #endif
  49. #endif
  50. #if SERIAL_IN_USE(2) && (CHECK_SERIAL_PIN(16) || CHECK_SERIAL_PIN(17))
  51. #error "Serial Port 2 pin D16 and/or D17 conflicts with another pin on the board."
  52. #endif
  53. #if SERIAL_IN_USE(3) && (CHECK_SERIAL_PIN(14) || CHECK_SERIAL_PIN(15))
  54. #error "Serial Port 3 pin D14 and/or D15 conflicts with another pin on the board."
  55. #endif
  56. #undef CHECK_SERIAL_PIN
  57. /**
  58. * Checks for FAST PWM
  59. */
  60. #if ALL(FAST_PWM_FAN, USE_OCR2A_AS_TOP, HAS_TCCR2)
  61. #error "USE_OCR2A_AS_TOP does not apply to devices with a single output TIMER2."
  62. #endif
  63. /**
  64. * Checks for SOFT PWM
  65. */
  66. #if HAS_FAN0 && FAN_PIN == 9 && DISABLED(FAN_SOFT_PWM) && ENABLED(SPEAKER)
  67. #error "FAN_PIN 9 Hardware PWM uses Timer 2 which conflicts with Arduino AVR Tone Timer (for SPEAKER)."
  68. #error "Disable SPEAKER or enable FAN_SOFT_PWM."
  69. #endif
  70. /**
  71. * Sanity checks for Spindle / Laser PWM
  72. */
  73. #if ENABLED(SPINDLE_LASER_USE_PWM)
  74. #include "../ServoTimers.h" // Needed to check timer availability (_useTimer3)
  75. #if SPINDLE_LASER_PWM_PIN == 4 || WITHIN(SPINDLE_LASER_PWM_PIN, 11, 13)
  76. #error "Counter/Timer for SPINDLE_LASER_PWM_PIN is used by a system interrupt."
  77. #elif NUM_SERVOS > 0 && defined(_useTimer3) && (WITHIN(SPINDLE_LASER_PWM_PIN, 2, 3) || SPINDLE_LASER_PWM_PIN == 5)
  78. #error "Counter/Timer for SPINDLE_LASER_PWM_PIN is used by the servo system."
  79. #endif
  80. #elif SPINDLE_LASER_FREQUENCY
  81. #error "SPINDLE_LASER_FREQUENCY requires SPINDLE_LASER_USE_PWM."
  82. #endif
  83. /**
  84. * The Trinamic library includes SoftwareSerial.h, leading to a compile error.
  85. */
  86. #if BOTH(HAS_TRINAMIC_CONFIG, ENDSTOP_INTERRUPTS_FEATURE)
  87. #error "TMCStepper includes SoftwareSerial.h which is incompatible with ENDSTOP_INTERRUPTS_FEATURE. Disable ENDSTOP_INTERRUPTS_FEATURE to continue."
  88. #endif
  89. #if BOTH(HAS_TMC_SW_SERIAL, MONITOR_DRIVER_STATUS)
  90. #error "MONITOR_DRIVER_STATUS causes performance issues when used with SoftwareSerial-connected drivers. Disable MONITOR_DRIVER_STATUS or use hardware serial to continue."
  91. #endif
  92. /**
  93. * Postmortem debugging
  94. */
  95. #if ENABLED(POSTMORTEM_DEBUGGING)
  96. #error "POSTMORTEM_DEBUGGING is not supported on AVR boards."
  97. #endif
  98. #if USING_PULLDOWNS
  99. #error "PULLDOWN pin mode is not available on AVR boards."
  100. #endif