From aa0f7afbe67e95541134878b9520aec329492cc0 Mon Sep 17 00:00:00 2001 From: InsanityAutomation <38436470+InsanityAutomation@users.noreply.github.com> Date: Mon, 15 Apr 2019 16:57:34 -0400 Subject: [PATCH] Fix call to uninitialized PWM pin, heater 2 overlap (#13674) --- Marlin/src/gcode/control/M3-M5.cpp | 4 +++- Marlin/src/pins/pins_FORMBOT_TREX3.h | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Marlin/src/gcode/control/M3-M5.cpp b/Marlin/src/gcode/control/M3-M5.cpp index 8612e0c03..132f7bb39 100644 --- a/Marlin/src/gcode/control/M3-M5.cpp +++ b/Marlin/src/gcode/control/M3-M5.cpp @@ -74,7 +74,9 @@ inline void delay_for_power_down() { safe_delay(SPINDLE_LASER_POWERDOWN_DELAY); inline void set_spindle_laser_ocr(const uint8_t ocr) { WRITE(SPINDLE_LASER_ENA_PIN, SPINDLE_LASER_ENABLE_INVERT); // turn spindle on (active low) - analogWrite(SPINDLE_LASER_PWM_PIN, (SPINDLE_LASER_PWM_INVERT) ? 255 - ocr : ocr); + #if ENABLED(SPINDLE_LASER_PWM) + analogWrite(SPINDLE_LASER_PWM_PIN, (SPINDLE_LASER_PWM_INVERT) ? 255 - ocr : ocr); + #endif } #if ENABLED(SPINDLE_LASER_PWM) diff --git a/Marlin/src/pins/pins_FORMBOT_TREX3.h b/Marlin/src/pins/pins_FORMBOT_TREX3.h index 3615ca742..5b4bd8b53 100644 --- a/Marlin/src/pins/pins_FORMBOT_TREX3.h +++ b/Marlin/src/pins/pins_FORMBOT_TREX3.h @@ -143,7 +143,7 @@ #define LED_PIN 13 #endif -#define SPINDLE_LASER_PWM_PIN 7 // MUST BE HARDWARE PWM +#define SPINDLE_LASER_PWM_PIN -1 // MUST BE HARDWARE PWM #define SPINDLE_LASER_ENA_PIN 4 // Pin should have a pullup! // Use the RAMPS 1.4 Analog input 5 on the AUX2 connector