Browse Source

Fix call to uninitialized PWM pin, heater 2 overlap (#13674)

InsanityAutomation 5 years ago
parent
commit
aa0f7afbe6
2 changed files with 4 additions and 2 deletions
  1. 3
    1
      Marlin/src/gcode/control/M3-M5.cpp
  2. 1
    1
      Marlin/src/pins/pins_FORMBOT_TREX3.h

+ 3
- 1
Marlin/src/gcode/control/M3-M5.cpp View File

@@ -74,7 +74,9 @@ inline void delay_for_power_down() { safe_delay(SPINDLE_LASER_POWERDOWN_DELAY);
74 74
 
75 75
 inline void set_spindle_laser_ocr(const uint8_t ocr) {
76 76
   WRITE(SPINDLE_LASER_ENA_PIN, SPINDLE_LASER_ENABLE_INVERT); // turn spindle on (active low)
77
-  analogWrite(SPINDLE_LASER_PWM_PIN, (SPINDLE_LASER_PWM_INVERT) ? 255 - ocr : ocr);
77
+  #if ENABLED(SPINDLE_LASER_PWM)
78
+    analogWrite(SPINDLE_LASER_PWM_PIN, (SPINDLE_LASER_PWM_INVERT) ? 255 - ocr : ocr);
79
+  #endif
78 80
 }
79 81
 
80 82
 #if ENABLED(SPINDLE_LASER_PWM)

+ 1
- 1
Marlin/src/pins/pins_FORMBOT_TREX3.h View File

@@ -143,7 +143,7 @@
143 143
   #define LED_PIN          13
144 144
 #endif
145 145
 
146
-#define SPINDLE_LASER_PWM_PIN     7   // MUST BE HARDWARE PWM
146
+#define SPINDLE_LASER_PWM_PIN    -1   // MUST BE HARDWARE PWM
147 147
 #define SPINDLE_LASER_ENA_PIN     4   // Pin should have a pullup!
148 148
 
149 149
 // Use the RAMPS 1.4 Analog input 5 on the AUX2 connector

Loading…
Cancel
Save