diff --git a/Marlin/src/gcode/temperature/M106_M107.cpp b/Marlin/src/gcode/temperature/M106_M107.cpp index 25160669e..4821ec6b7 100644 --- a/Marlin/src/gcode/temperature/M106_M107.cpp +++ b/Marlin/src/gcode/temperature/M106_M107.cpp @@ -28,6 +28,13 @@ #include "../../module/motion.h" #include "../../module/temperature.h" +#if ENABLED(SINGLENOZZLE) + #define _ALT_P active_extruder + #define _CNT_P EXTRUDERS +#else + #define _ALT_P MIN(active_extruder, FAN_COUNT - 1) + #define _CNT_P MIN(EXTRUDERS, FAN_COUNT) +#endif /** * M106: Set Fan Speed @@ -43,9 +50,9 @@ * 3-255 = Set the speed for use with T2 */ void GcodeSuite::M106() { - const uint8_t p = parser.byteval('P', MIN(active_extruder, FAN_COUNT - 1)); + const uint8_t p = parser.byteval('P', _ALT_P); - if (p < MIN(EXTRUDERS, FAN_COUNT)) { + if (p < _CNT_P) { #if ENABLED(EXTRA_FAN_SPEED) const uint16_t t = parser.intval('T'); @@ -63,7 +70,7 @@ void GcodeSuite::M106() { * M107: Fan Off */ void GcodeSuite::M107() { - const uint8_t p = parser.byteval('P', MIN(active_extruder, FAN_COUNT - 1)); + const uint8_t p = parser.byteval('P', _ALT_P); thermalManager.set_fan_speed(p, 0); }