Browse Source

Fix / complete USE_CONTROLLER_FAN (#9666)

Bob-the-Kuhn 6 years ago
parent
commit
2d749d490b
3 changed files with 8 additions and 1 deletions
  1. 4
    0
      Marlin/src/Marlin.h
  2. 3
    0
      Marlin/src/feature/controllerfan.cpp
  3. 1
    1
      Marlin/src/feature/power.cpp

+ 4
- 0
Marlin/src/Marlin.h View File

208
   #endif
208
   #endif
209
 #endif
209
 #endif
210
 
210
 
211
+#if ENABLED(USE_CONTROLLER_FAN)
212
+  extern uint8_t controllerFanSpeed;
213
+#endif
214
+
211
 #if ENABLED(PID_EXTRUSION_SCALING)
215
 #if ENABLED(PID_EXTRUSION_SCALING)
212
   extern int lpq_len;
216
   extern int lpq_len;
213
 #endif
217
 #endif

+ 3
- 0
Marlin/src/feature/controllerfan.cpp View File

27
 #include "../module/stepper_indirection.h"
27
 #include "../module/stepper_indirection.h"
28
 #include "../module/temperature.h"
28
 #include "../module/temperature.h"
29
 
29
 
30
+uint8_t controllerFanSpeed;
31
+
30
 void controllerfan_update() {
32
 void controllerfan_update() {
31
   static millis_t lastMotorOn = 0, // Last time a motor was turned on
33
   static millis_t lastMotorOn = 0, // Last time a motor was turned on
32
                   nextMotorCheck = 0; // Last time the state was checked
34
                   nextMotorCheck = 0; // Last time the state was checked
56
 
58
 
57
     // Fan off if no steppers have been enabled for CONTROLLERFAN_SECS seconds
59
     // Fan off if no steppers have been enabled for CONTROLLERFAN_SECS seconds
58
     uint8_t speed = (!lastMotorOn || ELAPSED(ms, lastMotorOn + (CONTROLLERFAN_SECS) * 1000UL)) ? 0 : CONTROLLERFAN_SPEED;
60
     uint8_t speed = (!lastMotorOn || ELAPSED(ms, lastMotorOn + (CONTROLLERFAN_SECS) * 1000UL)) ? 0 : CONTROLLERFAN_SPEED;
61
+    controllerFanSpeed = speed;
59
 
62
 
60
     // allows digital or PWM fan output to be used (see M42 handling)
63
     // allows digital or PWM fan output to be used (see M42 handling)
61
     WRITE(CONTROLLER_FAN_PIN, speed);
64
     WRITE(CONTROLLER_FAN_PIN, speed);

+ 1
- 1
Marlin/src/feature/power.cpp View File

46
     HOTEND_LOOP() if (thermalManager.autofan_speed[e] > 0) return true;
46
     HOTEND_LOOP() if (thermalManager.autofan_speed[e] > 0) return true;
47
   #endif
47
   #endif
48
 
48
 
49
-  #if ENABLED(AUTO_POWER_CONTROLLERFAN) && HAS_CONTROLLER_FAN
49
+  #if ENABLED(AUTO_POWER_CONTROLLERFAN) && HAS_CONTROLLER_FAN && ENABLED(USE_CONTROLLER_FAN)
50
     if (controllerFanSpeed > 0) return true;
50
     if (controllerFanSpeed > 0) return true;
51
   #endif
51
   #endif
52
 
52
 

Loading…
Cancel
Save