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,6 +208,10 @@ extern millis_t max_inactive_time, stepper_inactive_time;
208 208
   #endif
209 209
 #endif
210 210
 
211
+#if ENABLED(USE_CONTROLLER_FAN)
212
+  extern uint8_t controllerFanSpeed;
213
+#endif
214
+
211 215
 #if ENABLED(PID_EXTRUSION_SCALING)
212 216
   extern int lpq_len;
213 217
 #endif

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

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

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

@@ -46,7 +46,7 @@ bool Power::is_power_needed() {
46 46
     HOTEND_LOOP() if (thermalManager.autofan_speed[e] > 0) return true;
47 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 50
     if (controllerFanSpeed > 0) return true;
51 51
   #endif
52 52
 

Loading…
Cancel
Save