Browse Source

Implement CONTROLLER_FAN_USE_Z_ONLY

Followup to #17149
vanilla_fb_2.0.x
Scott Lahteine 4 years ago
parent
commit
de45ac41ad
  1. 51
      Marlin/src/feature/controllerfan.cpp
  2. 4
      Marlin/src/gcode/feature/controllerfan/M710.cpp
  3. 8
      Marlin/src/lcd/menu/menu_configuration.cpp

51
Marlin/src/feature/controllerfan.cpp

@ -55,35 +55,36 @@ void ControllerFan::update() {
#define MOTOR_IS_ON(A,B) (A##_ENABLE_READ() == bool(B##_ENABLE_ON)) #define MOTOR_IS_ON(A,B) (A##_ENABLE_READ() == bool(B##_ENABLE_ON))
#define _OR_ENABLED_E(N) || MOTOR_IS_ON(E##N,E) #define _OR_ENABLED_E(N) || MOTOR_IS_ON(E##N,E)
const bool const bool motor_on = MOTOR_IS_ON(Z,Z)
xy_motor_on = MOTOR_IS_ON(X,X) || MOTOR_IS_ON(Y,Y) #if HAS_Z2_ENABLE
#if HAS_X2_ENABLE || MOTOR_IS_ON(Z2,Z)
|| MOTOR_IS_ON(X2,X) #endif
#endif #if HAS_Z3_ENABLE
#if HAS_Y2_ENABLE || MOTOR_IS_ON(Z3,Z)
|| MOTOR_IS_ON(Y2,Y) #endif
#endif #if HAS_Z4_ENABLE
, || MOTOR_IS_ON(Z4,Z)
z_motor_on = MOTOR_IS_ON(Z,Z) #endif
#if HAS_Z2_ENABLE || (DISABLED(CONTROLLER_FAN_USE_Z_ONLY) && (
|| MOTOR_IS_ON(Z2,Z) MOTOR_IS_ON(X,X) || MOTOR_IS_ON(Y,Y)
#endif #if HAS_X2_ENABLE
#if HAS_Z3_ENABLE || MOTOR_IS_ON(X2,X)
|| MOTOR_IS_ON(Z3,Z) #endif
#endif #if HAS_Y2_ENABLE
#if HAS_Z4_ENABLE || MOTOR_IS_ON(Y2,Y)
|| MOTOR_IS_ON(Z4,Z) #endif
#endif #if E_STEPPERS
; REPEAT(E_STEPPERS, _OR_ENABLED_E)
#endif
)
)
;
// If any of the drivers or the bed are enabled... // If any of the drivers or the heated bed are enabled...
if (xy_motor_on || z_motor_on if (motor_on
#if HAS_HEATED_BED #if HAS_HEATED_BED
|| thermalManager.temp_bed.soft_pwm_amount > 0 || thermalManager.temp_bed.soft_pwm_amount > 0
#endif #endif
#if E_STEPPERS
REPEAT(E_STEPPERS, _OR_ENABLED_E)
#endif
) lastMotorOn = ms; //... set time to NOW so the fan will turn on ) lastMotorOn = ms; //... set time to NOW so the fan will turn on
// Fan Settings. Set fan > 0: // Fan Settings. Set fan > 0:

4
Marlin/src/gcode/feature/controllerfan/M710.cpp

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

8
Marlin/src/lcd/menu/menu_configuration.cpp

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

Loading…
Cancel
Save