Followup to menu refactor. TMC warnings, sanity. (#12288)

- Followup fixes for menu refactor
- Fix TMC sanity checks, unused var warnings
This commit is contained in:
Ludy
2018-11-01 22:13:33 +01:00
committed by Scott Lahteine
parent cafabf2055
commit 9f77df2590
8 changed files with 201 additions and 121 deletions

View File

@ -857,15 +857,13 @@
#define AXIS_HAS_STEALTHCHOP(ST) (AXIS_DRIVER_TYPE(ST, TMC2130) || AXIS_DRIVER_TYPE(ST, TMC2208))
#define USE_SENSORLESS (ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING))
#if USE_SENSORLESS
// Disable Z axis sensorless homing if a probe is used to home the Z axis
#if HOMING_Z_WITH_PROBE
#undef Z_STALL_SENSITIVITY
#endif
#define X_SENSORLESS (AXIS_HAS_STALLGUARD(X) && defined(X_STALL_SENSITIVITY))
#define Y_SENSORLESS (AXIS_HAS_STALLGUARD(Y) && defined(Y_STALL_SENSITIVITY))
#define Z_SENSORLESS (AXIS_HAS_STALLGUARD(Z) && defined(Z_STALL_SENSITIVITY))
// Disable Z axis sensorless homing if a probe is used to home the Z axis
#if HOMING_Z_WITH_PROBE
#undef Z_STALL_SENSITIVITY
#endif
#define X_SENSORLESS (AXIS_HAS_STALLGUARD(X) && defined(X_STALL_SENSITIVITY))
#define Y_SENSORLESS (AXIS_HAS_STALLGUARD(Y) && defined(Y_STALL_SENSITIVITY))
#define Z_SENSORLESS (AXIS_HAS_STALLGUARD(Z) && defined(Z_STALL_SENSITIVITY))
#endif
// Endstops and bed probe

View File

@ -19,6 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#pragma once
/**
* SanityCheck.h
@ -26,9 +27,6 @@
* Test configuration values for errors at compile-time.
*/
#ifndef _SANITYCHECK_H_
#define _SANITYCHECK_H_
/**
* Require gcc 4.7 or newer (first included with Arduino 1.6.8) for C++11 features.
*/
@ -1707,31 +1705,62 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE,
* Check existing CS pins against enabled TMC SPI drivers.
*/
#if AXIS_DRIVER_TYPE(X, TMC2130) && !PIN_EXISTS(X_CS)
#error "X_CS_PIN is required for TMC2130. Define X_CS_PIN in Configuration_adv.h."
#error "TMC2130 on X requires X_CS_PIN."
#elif AXIS_DRIVER_TYPE(X2, TMC2130) && !PIN_EXISTS(X2_CS)
#error "X2_CS_PIN is required for X2. Define X2_CS_PIN in Configuration_adv.h."
#error "TMC2130 on X2 requires X2_CS_PIN."
#elif AXIS_DRIVER_TYPE(Y, TMC2130) && !PIN_EXISTS(Y_CS)
#error "Y_CS_PIN is required for TMC2130. Define Y_CS_PIN in Configuration_adv.h."
#error "TMC2130 on Y requires Y_CS_PIN."
#elif AXIS_DRIVER_TYPE(Y2, TMC2130) && !PIN_EXISTS(Y2_CS)
#error "Y2_CS_PIN is required for TMC2130. Define Y2_CS_PIN in Configuration_adv.h."
#error "TMC2130 on Y2 requires Y2_CS_PIN."
#elif AXIS_DRIVER_TYPE(Z, TMC2130) && !PIN_EXISTS(Z_CS)
#error "Z_CS_PIN is required for TMC2130. Define Z_CS_PIN in Configuration_adv.h."
#error "TMC2130 on Z requires Z_CS_PIN."
#elif AXIS_DRIVER_TYPE(Z2, TMC2130) && !PIN_EXISTS(Z2_CS)
#error "Z2_CS_PIN is required for TMC2130. Define Z2_CS_PIN in Configuration_adv.h."
#error "TMC2130 on Z2 requires Z2_CS_PIN."
#elif AXIS_DRIVER_TYPE(Z3, TMC2130) && !PIN_EXISTS(Z3_CS)
#error "Z3_CS_PIN is required for TMC2130. Define Z3_CS_PIN in Configuration_adv.h."
#error "TMC2130 on Z3 requires Z3_CS_PIN."
#elif AXIS_DRIVER_TYPE(E0, TMC2130) && !PIN_EXISTS(E0_CS)
#error "E0_CS_PIN is required for TMC2130. Define E0_CS_PIN in Configuration_adv.h."
#error "TMC2130 on E0 requires E0_CS_PIN."
#elif AXIS_DRIVER_TYPE(E1, TMC2130) && !PIN_EXISTS(E1_CS)
#error "E1_CS_PIN is required for TMC2130. Define E1_CS_PIN in Configuration_adv.h."
#error "TMC2130 on E1 requires E1_CS_PIN."
#elif AXIS_DRIVER_TYPE(E2, TMC2130) && !PIN_EXISTS(E2_CS)
#error "E2_CS_PIN is required for TMC2130. Define E2_CS_PIN in Configuration_adv.h."
#error "TMC2130 on E2 requires E2_CS_PIN."
#elif AXIS_DRIVER_TYPE(E3, TMC2130) && !PIN_EXISTS(E3_CS)
#error "E3_CS_PIN is required for TMC2130. Define E3_CS_PIN in Configuration_adv.h."
#error "TMC2130 on E3 requires E3_CS_PIN."
#elif AXIS_DRIVER_TYPE(E4, TMC2130) && !PIN_EXISTS(E4_CS)
#error "E4_CS_PIN is required for TMC2130. Define E4_CS_PIN in Configuration_adv.h."
#error "TMC2130 on E4 requires E4_CS_PIN."
#elif AXIS_DRIVER_TYPE(E5, TMC2130) && !PIN_EXISTS(E5_CS)
#error "E5_CS_PIN is required for TMC2130. Define E5_CS_PIN in Configuration_adv.h."
#error "TMC2130 on E5 requires E5_CS_PIN."
#endif
/**
* Check existing RX/TX pins against enable TMC UART drivers.
*/
#if AXIS_DRIVER_TYPE(X, TMC2208) && !(defined(X_HARDWARE_SERIAL) || (PIN_EXISTS(X_SERIAL_RX) && PIN_EXISTS(X_SERIAL_TX)))
#error "TMC2208 on X requires X_HARDWARE_SERIAL or both X_SERIAL_RX_PIN and X_SERIAL_TX_PIN."
#elif AXIS_DRIVER_TYPE(X2, TMC2208) && !(defined(X2_HARDWARE_SERIAL) || (PIN_EXISTS(X2_SERIAL_RX) && PIN_EXISTS(X2_SERIAL_TX)))
#error "TMC2208 on X2 requires X2_HARDWARE_SERIAL or both X2_SERIAL_RX_PIN and X2_SERIAL_TX_PIN."
#elif AXIS_DRIVER_TYPE(Y, TMC2208) && !(defined(Y_HARDWARE_SERIAL) || (PIN_EXISTS(Y_SERIAL_RX) && PIN_EXISTS(Y_SERIAL_TX)))
#error "TMC2208 on Y requires Y_HARDWARE_SERIAL or both Y_SERIAL_RX_PIN and Y_SERIAL_TX_PIN."
#elif AXIS_DRIVER_TYPE(Y2, TMC2208) && !(defined(Y2_HARDWARE_SERIAL) || (PIN_EXISTS(Y2_SERIAL_RX) && PIN_EXISTS(Y2_SERIAL_TX)))
#error "TMC2208 on Y2 requires Y2_HARDWARE_SERIAL or both Y2_SERIAL_RX_PIN and Y2_SERIAL_TX_PIN."
#elif AXIS_DRIVER_TYPE(Z, TMC2208) && !(defined(Z_HARDWARE_SERIAL) || (PIN_EXISTS(Z_SERIAL_RX) && PIN_EXISTS(Z_SERIAL_TX)))
#error "TMC2208 on Z requires Z_HARDWARE_SERIAL or both Z_SERIAL_RX_PIN and Z_SERIAL_TX_PIN."
#elif AXIS_DRIVER_TYPE(Z2, TMC2208) && !(defined(Z2_HARDWARE_SERIAL) || (PIN_EXISTS(Z2_SERIAL_RX) && PIN_EXISTS(Z2_SERIAL_TX)))
#error "TMC2208 on Z2 requires Z2_HARDWARE_SERIAL or both Z2_SERIAL_RX_PIN and Z2_SERIAL_TX_PIN."
#elif AXIS_DRIVER_TYPE(Z3, TMC2208) && !(defined(Z3_HARDWARE_SERIAL) || (PIN_EXISTS(Z3_SERIAL_RX) && PIN_EXISTS(Z3_SERIAL_TX)))
#error "TMC2208 on Z3 requires Z3_HARDWARE_SERIAL or both Z3_SERIAL_RX_PIN and Z3_SERIAL_TX_PIN."
#elif AXIS_DRIVER_TYPE(E0, TMC2208) && !(defined(E0_HARDWARE_SERIAL) || (PIN_EXISTS(E0_SERIAL_RX) && PIN_EXISTS(E0_SERIAL_TX)))
#error "TMC2208 on E0 requires E0_HARDWARE_SERIAL or both E0_SERIAL_RX_PIN and E0_SERIAL_TX_PIN."
#elif AXIS_DRIVER_TYPE(E1, TMC2208) && !(defined(E1_HARDWARE_SERIAL) || (PIN_EXISTS(E1_SERIAL_RX) && PIN_EXISTS(E1_SERIAL_TX)))
#error "TMC2208 on E1 requires E1_HARDWARE_SERIAL or both E1_SERIAL_RX_PIN and E1_SERIAL_TX_PIN."
#elif AXIS_DRIVER_TYPE(E2, TMC2208) && !(defined(E2_HARDWARE_SERIAL) || (PIN_EXISTS(E2_SERIAL_RX) && PIN_EXISTS(E2_SERIAL_TX)))
#error "TMC2208 on E2 requires E2_HARDWARE_SERIAL or both E2_SERIAL_RX_PIN and E2_SERIAL_TX_PIN."
#elif AXIS_DRIVER_TYPE(E3, TMC2208) && !(defined(E3_HARDWARE_SERIAL) || (PIN_EXISTS(E3_SERIAL_RX) && PIN_EXISTS(E3_SERIAL_TX)))
#error "TMC2208 on E3 requires E3_HARDWARE_SERIAL or both E3_SERIAL_RX_PIN and E3_SERIAL_TX_PIN."
#elif AXIS_DRIVER_TYPE(E4, TMC2208) && !(defined(E4_HARDWARE_SERIAL) || (PIN_EXISTS(E4_SERIAL_RX) && PIN_EXISTS(E4_SERIAL_TX)))
#error "TMC2208 on E4 requires E4_HARDWARE_SERIAL or both E4_SERIAL_RX_PIN and E4_SERIAL_TX_PIN."
#elif AXIS_DRIVER_TYPE(E5, TMC2208) && !(defined(E5_HARDWARE_SERIAL) || (PIN_EXISTS(E5_SERIAL_RX) && PIN_EXISTS(E5_SERIAL_TX)))
#error "TMC2208 on E5 requires E5_HARDWARE_SERIAL or both E5_SERIAL_RX_PIN and E5_SERIAL_TX_PIN."
#endif
/**
@ -1797,6 +1826,15 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE,
#endif
#endif
// Sensorless homing/probing requirements
#if ENABLED(SENSORLESS_HOMING) && !(X_SENSORLESS || Y_SENSORLESS || Z_SENSORLESS)
#error "SENSORLESS_HOMING requires a TMC stepper driver with StallGuard on X, Y, or Z axes."
#elif ENABLED(SENSORLESS_PROBING) && ENABLED(DELTA) && !(X_SENSORLESS && Y_SENSORLESS && Z_SENSORLESS)
#error "SENSORLESS_PROBING for DELTA requires TMC stepper drivers with StallGuard on X, Y, and Z axes."
#elif ENABLED(SENSORLESS_PROBING) && !Z_SENSORLESS
#error "SENSORLESS_PROBING requires a TMC stepper driver with StallGuard on Z."
#endif
// Sensorless homing is required for both combined steppers in an H-bot
#if CORE_IS_XY && X_SENSORLESS != Y_SENSORLESS
#error "CoreXY requires both X and Y to use sensorless homing if either does."
@ -1904,5 +1942,3 @@ static_assert(COUNT(sanity_arr_3) <= XYZE_N, "DEFAULT_MAX_ACCELERATION has too m
#if ENABLED(SD_FIRMWARE_UPDATE) && !defined(__AVR_ATmega2560__)
#error "SD_FIRMWARE_UPDATE requires an ATmega2560-based (Arduino Mega) board."
#endif
#endif // _SANITYCHECK_H_