Browse Source

Implement CONTROLLER_FAN_USE_Z_ONLY

Followup to #17149
Scott Lahteine 5 years ago
parent
commit
de45ac41ad

+ 26
- 25
Marlin/src/feature/controllerfan.cpp View File

@@ -55,35 +55,36 @@ void ControllerFan::update() {
55 55
     #define MOTOR_IS_ON(A,B) (A##_ENABLE_READ() == bool(B##_ENABLE_ON))
56 56
     #define _OR_ENABLED_E(N) || MOTOR_IS_ON(E##N,E)
57 57
 
58
-    const bool
59
-    xy_motor_on = MOTOR_IS_ON(X,X) || MOTOR_IS_ON(Y,Y)
60
-                  #if HAS_X2_ENABLE
61
-                    || MOTOR_IS_ON(X2,X)
62
-                  #endif
63
-                  #if HAS_Y2_ENABLE
64
-                    || MOTOR_IS_ON(Y2,Y)
65
-                  #endif
66
-                  ,
67
-    z_motor_on  = MOTOR_IS_ON(Z,Z)
68
-                  #if HAS_Z2_ENABLE
69
-                    || MOTOR_IS_ON(Z2,Z)
70
-                  #endif
71
-                  #if HAS_Z3_ENABLE
72
-                    || MOTOR_IS_ON(Z3,Z)
73
-                  #endif
74
-                  #if HAS_Z4_ENABLE
75
-                    || MOTOR_IS_ON(Z4,Z)
76
-                  #endif
77
-                  ;
58
+    const bool motor_on = MOTOR_IS_ON(Z,Z)
59
+      #if HAS_Z2_ENABLE
60
+        || MOTOR_IS_ON(Z2,Z)
61
+      #endif
62
+      #if HAS_Z3_ENABLE
63
+        || MOTOR_IS_ON(Z3,Z)
64
+      #endif
65
+      #if HAS_Z4_ENABLE
66
+        || MOTOR_IS_ON(Z4,Z)
67
+      #endif
68
+      || (DISABLED(CONTROLLER_FAN_USE_Z_ONLY) && (
69
+          MOTOR_IS_ON(X,X) || MOTOR_IS_ON(Y,Y)
70
+          #if HAS_X2_ENABLE
71
+            || MOTOR_IS_ON(X2,X)
72
+          #endif
73
+          #if HAS_Y2_ENABLE
74
+            || MOTOR_IS_ON(Y2,Y)
75
+          #endif
76
+          #if E_STEPPERS
77
+            REPEAT(E_STEPPERS, _OR_ENABLED_E)
78
+          #endif
79
+        )
80
+      )
81
+    ;
78 82
 
79
-    // If any of the drivers or the bed are enabled...
80
-    if (xy_motor_on || z_motor_on
83
+    // If any of the drivers or the heated bed are enabled...
84
+    if (motor_on
81 85
       #if HAS_HEATED_BED
82 86
         || thermalManager.temp_bed.soft_pwm_amount > 0
83 87
       #endif
84
-      #if E_STEPPERS
85
-        REPEAT(E_STEPPERS, _OR_ENABLED_E)
86
-      #endif
87 88
     ) lastMotorOn = ms; //... set time to NOW so the fan will turn on
88 89
 
89 90
     // Fan Settings. Set fan > 0:

+ 1
- 3
Marlin/src/gcode/feature/controllerfan/M710.cpp View File

@@ -74,9 +74,7 @@ void GcodeSuite::M710() {
74 74
   const bool seenD = parser.seenval('D');
75 75
   if (seenD) controllerFan.settings.duration = parser.value_ushort();
76 76
 
77
-  if (seenR || seenS || seenI || seenA || seenD)
78
-    controllerFan.update();
79
-  else
77
+  if (!(seenR || seenS || seenI || seenA || seenD))
80 78
     M710_report(false);
81 79
 }
82 80
 

+ 4
- 4
Marlin/src/lcd/menu/menu_configuration.cpp View File

@@ -234,11 +234,11 @@ void menu_advanced_settings();
234 234
   void menu_controller_fan() {
235 235
     START_MENU();
236 236
     BACK_ITEM(MSG_CONFIGURATION);
237
-    EDIT_ITEM_FAST(percent, MSG_CONTROLLER_FAN_IDLE_SPEED, &controllerFan.settings.idle_speed, _MAX(1, CONTROLLERFAN_SPEED_MIN) - 1, 255, controllerFan.update);
238
-    EDIT_ITEM(bool, MSG_CONTROLLER_FAN_AUTO_ON, &controllerFan.settings.auto_mode, controllerFan.update);
237
+    EDIT_ITEM_FAST(percent, MSG_CONTROLLER_FAN_IDLE_SPEED, &controllerFan.settings.idle_speed, _MAX(1, CONTROLLERFAN_SPEED_MIN) - 1, 255);
238
+    EDIT_ITEM(bool, MSG_CONTROLLER_FAN_AUTO_ON, &controllerFan.settings.auto_mode);
239 239
     if (controllerFan.settings.auto_mode) {
240
-      EDIT_ITEM_FAST(percent, MSG_CONTROLLER_FAN_SPEED, &controllerFan.settings.active_speed, _MAX(1, CONTROLLERFAN_SPEED_MIN) - 1, 255, controllerFan.update);
241
-      EDIT_ITEM(uint16_4, MSG_CONTROLLER_FAN_DURATION, &controllerFan.settings.duration, 0, 4800, controllerFan.update);
240
+      EDIT_ITEM_FAST(percent, MSG_CONTROLLER_FAN_SPEED, &controllerFan.settings.active_speed, _MAX(1, CONTROLLERFAN_SPEED_MIN) - 1, 255);
241
+      EDIT_ITEM(uint16_4, MSG_CONTROLLER_FAN_DURATION, &controllerFan.settings.duration, 0, 4800);
242 242
     }
243 243
     END_MENU();
244 244
   }

Loading…
Cancel
Save