From fd9c6983d30f70171d9d9a9c55962689fa4cdd85 Mon Sep 17 00:00:00 2001 From: ellensp Date: Sat, 8 Aug 2020 10:59:09 +1200 Subject: [PATCH] HW PWM sanity checks for SPINDLE_LASER_FREQUENCY (#18947) --- Marlin/src/HAL/DUE/inc/SanityCheck.h | 4 ++-- Marlin/src/HAL/ESP32/inc/SanityCheck.h | 4 ++-- Marlin/src/HAL/LINUX/inc/SanityCheck.h | 4 ++-- Marlin/src/HAL/LPC1768/fast_pwm.cpp | 2 +- Marlin/src/HAL/LPC1768/inc/SanityCheck.h | 4 ++++ Marlin/src/HAL/SAMD51/inc/SanityCheck.h | 4 ++-- Marlin/src/HAL/STM32/inc/SanityCheck.h | 4 ++-- Marlin/src/HAL/STM32F1/inc/SanityCheck.h | 4 ++-- Marlin/src/HAL/STM32_F4_F7/inc/SanityCheck.h | 4 ++-- Marlin/src/HAL/TEENSY31_32/inc/SanityCheck.h | 4 ++-- Marlin/src/HAL/TEENSY35_36/inc/SanityCheck.h | 4 ++-- 11 files changed, 23 insertions(+), 19 deletions(-) diff --git a/Marlin/src/HAL/DUE/inc/SanityCheck.h b/Marlin/src/HAL/DUE/inc/SanityCheck.h index cdea34436e87..688069650630 100644 --- a/Marlin/src/HAL/DUE/inc/SanityCheck.h +++ b/Marlin/src/HAL/DUE/inc/SanityCheck.h @@ -52,8 +52,8 @@ #endif #endif -#if ENABLED(FAST_PWM_FAN) - #error "FAST_PWM_FAN is not yet implemented for this platform." +#if ENABLED(FAST_PWM_FAN) || SPINDLE_LASER_FREQUENCY + #error "Features requiring Hardware PWM (FAST_PWM_FAN, SPINDLE_LASER_FREQUENCY) are not yet supported on DUE." #endif #if HAS_TMC_SW_SERIAL diff --git a/Marlin/src/HAL/ESP32/inc/SanityCheck.h b/Marlin/src/HAL/ESP32/inc/SanityCheck.h index 7653f6fe7ff1..f57a6c591028 100644 --- a/Marlin/src/HAL/ESP32/inc/SanityCheck.h +++ b/Marlin/src/HAL/ESP32/inc/SanityCheck.h @@ -25,8 +25,8 @@ #error "EMERGENCY_PARSER is not yet implemented for ESP32. Disable EMERGENCY_PARSER to continue." #endif -#if ENABLED(FAST_PWM_FAN) - #error "FAST_PWM_FAN is not yet implemented for this platform." +#if ENABLED(FAST_PWM_FAN) || SPINDLE_LASER_FREQUENCY + #error "Features requiring Hardware PWM (FAST_PWM_FAN, SPINDLE_LASER_FREQUENCY) are not yet supported on ESP32." #endif #if HAS_TMC_SW_SERIAL diff --git a/Marlin/src/HAL/LINUX/inc/SanityCheck.h b/Marlin/src/HAL/LINUX/inc/SanityCheck.h index 8d23cdabbf8f..84167c97a144 100644 --- a/Marlin/src/HAL/LINUX/inc/SanityCheck.h +++ b/Marlin/src/HAL/LINUX/inc/SanityCheck.h @@ -30,8 +30,8 @@ #error "SPINDLE_LASER_PWM_PIN must use SERVO0, SERVO1 or SERVO3 connector" #endif -#if ENABLED(FAST_PWM_FAN) - #error "FAST_PWM_FAN is not yet implemented for this platform." +#if ENABLED(FAST_PWM_FAN) || SPINDLE_LASER_FREQUENCY + #error "Features requiring Hardware PWM (FAST_PWM_FAN, SPINDLE_LASER_FREQUENCY) are not yet supported on LINUX." #endif #if HAS_TMC_SW_SERIAL diff --git a/Marlin/src/HAL/LPC1768/fast_pwm.cpp b/Marlin/src/HAL/LPC1768/fast_pwm.cpp index 46507ac0dabc..dd440b5e7730 100644 --- a/Marlin/src/HAL/LPC1768/fast_pwm.cpp +++ b/Marlin/src/HAL/LPC1768/fast_pwm.cpp @@ -35,5 +35,5 @@ void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size/*=255 LPC176x::pwm_write_ratio(pin, invert ? 1.0f - (float)v / v_size : (float)v / v_size); } -#endif // FAST_PWM_FAN || SPINDLE_LASER_PWM +#endif // NEEDS_HARDWARE_PWM #endif // TARGET_LPC1768 diff --git a/Marlin/src/HAL/LPC1768/inc/SanityCheck.h b/Marlin/src/HAL/LPC1768/inc/SanityCheck.h index 964538962ce5..0a4e59c6c459 100644 --- a/Marlin/src/HAL/LPC1768/inc/SanityCheck.h +++ b/Marlin/src/HAL/LPC1768/inc/SanityCheck.h @@ -59,6 +59,10 @@ */ static_assert(!(NUM_SERVOS && ENABLED(FAST_PWM_FAN)), "BLTOUCH and Servos are incompatible with FAST_PWM_FAN on LPC176x boards."); +#if SPINDLE_LASER_FREQUENCY + static_assert(!NUM_SERVOS, "BLTOUCH and Servos are incompatible with SPINDLE_LASER_FREQUENCY on LPC176x boards."); +#endif + /** * Test LPC176x-specific configuration values for errors at compile-time. */ diff --git a/Marlin/src/HAL/SAMD51/inc/SanityCheck.h b/Marlin/src/HAL/SAMD51/inc/SanityCheck.h index ee04e2e2e0c7..5d610acac85c 100644 --- a/Marlin/src/HAL/SAMD51/inc/SanityCheck.h +++ b/Marlin/src/HAL/SAMD51/inc/SanityCheck.h @@ -47,6 +47,6 @@ #error "SDIO_SUPPORT is not supported on SAMD51." #endif -#if ENABLED(FAST_PWM_FAN) - #error "FAST_PWM_FAN is not yet implemented for this platform." +#if ENABLED(FAST_PWM_FAN) || SPINDLE_LASER_FREQUENCY + #error "Features requiring Hardware PWM (FAST_PWM_FAN, SPINDLE_LASER_FREQUENCY) are not yet supported on SAMD51." #endif diff --git a/Marlin/src/HAL/STM32/inc/SanityCheck.h b/Marlin/src/HAL/STM32/inc/SanityCheck.h index 37ca3d5a30ab..30d0750d90e0 100644 --- a/Marlin/src/HAL/STM32/inc/SanityCheck.h +++ b/Marlin/src/HAL/STM32/inc/SanityCheck.h @@ -28,8 +28,8 @@ // #error "SPINDLE_LASER_PWM_PIN must use SERVO0, SERVO1 or SERVO3 connector" //#endif -#if ENABLED(FAST_PWM_FAN) - #error "FAST_PWM_FAN is not yet implemented for this platform." +#if ENABLED(FAST_PWM_FAN) || SPINDLE_LASER_FREQUENCY + #error "Features requiring Hardware PWM (FAST_PWM_FAN, SPINDLE_LASER_FREQUENCY) are not yet supported on STM32." #endif #if ENABLED(SDCARD_EEPROM_EMULATION) && DISABLED(SDSUPPORT) diff --git a/Marlin/src/HAL/STM32F1/inc/SanityCheck.h b/Marlin/src/HAL/STM32F1/inc/SanityCheck.h index 5559b3d4a480..5e5b9097d87f 100644 --- a/Marlin/src/HAL/STM32F1/inc/SanityCheck.h +++ b/Marlin/src/HAL/STM32F1/inc/SanityCheck.h @@ -29,8 +29,8 @@ #error "EMERGENCY_PARSER is not yet implemented for STM32F1. Disable EMERGENCY_PARSER to continue." #endif -#if ENABLED(FAST_PWM_FAN) - #error "FAST_PWM_FAN is not yet implemented for this platform." +#if ENABLED(FAST_PWM_FAN) || SPINDLE_LASER_FREQUENCY + #error "Features requiring Hardware PWM (FAST_PWM_FAN, SPINDLE_LASER_FREQUENCY) are not yet supported on STM32F1." #endif #if !defined(HAVE_SW_SERIAL) && HAS_TMC_SW_SERIAL diff --git a/Marlin/src/HAL/STM32_F4_F7/inc/SanityCheck.h b/Marlin/src/HAL/STM32_F4_F7/inc/SanityCheck.h index 53b15ba1909a..9bb36f3bbbca 100644 --- a/Marlin/src/HAL/STM32_F4_F7/inc/SanityCheck.h +++ b/Marlin/src/HAL/STM32_F4_F7/inc/SanityCheck.h @@ -32,8 +32,8 @@ #error "EMERGENCY_PARSER is not yet implemented for STM32F4/7. Disable EMERGENCY_PARSER to continue." #endif -#if ENABLED(FAST_PWM_FAN) - #error "FAST_PWM_FAN is not yet implemented for this platform." +#if ENABLED(FAST_PWM_FAN) || SPINDLE_LASER_FREQUENCY + #error "Features requiring Hardware PWM (FAST_PWM_FAN, SPINDLE_LASER_FREQUENCY) are not yet supported on STM32F4/F7." #endif #if HAS_TMC_SW_SERIAL diff --git a/Marlin/src/HAL/TEENSY31_32/inc/SanityCheck.h b/Marlin/src/HAL/TEENSY31_32/inc/SanityCheck.h index 0b731a61d3b6..3932ee6a76c1 100644 --- a/Marlin/src/HAL/TEENSY31_32/inc/SanityCheck.h +++ b/Marlin/src/HAL/TEENSY31_32/inc/SanityCheck.h @@ -29,8 +29,8 @@ #error "EMERGENCY_PARSER is not yet implemented for Teensy 3.1/3.2. Disable EMERGENCY_PARSER to continue." #endif -#if ENABLED(FAST_PWM_FAN) - #error "FAST_PWM_FAN is not yet implemented for this platform." +#if ENABLED(FAST_PWM_FAN) || SPINDLE_LASER_FREQUENCY + #error "Features requiring Hardware PWM (FAST_PWM_FAN, SPINDLE_LASER_FREQUENCY) are not yet supported on Teensy 3.1/3.2." #endif #if HAS_TMC_SW_SERIAL diff --git a/Marlin/src/HAL/TEENSY35_36/inc/SanityCheck.h b/Marlin/src/HAL/TEENSY35_36/inc/SanityCheck.h index 36b8018085c4..ee80e42696fa 100644 --- a/Marlin/src/HAL/TEENSY35_36/inc/SanityCheck.h +++ b/Marlin/src/HAL/TEENSY35_36/inc/SanityCheck.h @@ -29,8 +29,8 @@ #error "EMERGENCY_PARSER is not yet implemented for Teensy 3.5/3.6. Disable EMERGENCY_PARSER to continue." #endif -#if ENABLED(FAST_PWM_FAN) - #error "FAST_PWM_FAN is not yet implemented for this platform." +#if ENABLED(FAST_PWM_FAN) || SPINDLE_LASER_FREQUENCY + #error "Features requiring Hardware PWM (FAST_PWM_FAN, SPINDLE_LASER_FREQUENCY) are not yet supported on Teensy 3.5/3.6." #endif #if HAS_TMC_SW_SERIAL