From d20375c185feddcb5635c86b3ec8a8fb683af9e3 Mon Sep 17 00:00:00 2001 From: Kachidoki Date: Sat, 27 Feb 2021 20:45:12 +0100 Subject: [PATCH] Duplicate fan speed in M106/7 IDEX Duplication Mode (#21208) --- Marlin/src/gcode/temp/M106_M107.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Marlin/src/gcode/temp/M106_M107.cpp b/Marlin/src/gcode/temp/M106_M107.cpp index 9c70f1ebc7..b7d64c99ea 100644 --- a/Marlin/src/gcode/temp/M106_M107.cpp +++ b/Marlin/src/gcode/temp/M106_M107.cpp @@ -81,6 +81,9 @@ void GcodeSuite::M106() { // Set speed, with constraint thermalManager.set_fan_speed(pfan, speed); + + if (TERN0(DUAL_X_CARRIAGE, idex_is_duplicating())) // pfan == 0 when duplicating + thermalManager.set_fan_speed(1 - pfan, speed); } } @@ -88,8 +91,13 @@ void GcodeSuite::M106() { * M107: Fan Off */ void GcodeSuite::M107() { - const uint8_t p = parser.byteval('P', _ALT_P); - thermalManager.set_fan_speed(p, 0); + const uint8_t pfan = parser.byteval('P', _ALT_P); + if (pfan < _CNT_P) { + thermalManager.set_fan_speed(pfan, 0); + + if (TERN0(DUAL_X_CARRIAGE, idex_is_duplicating())) // pfan == 0 when duplicating + thermalManager.set_fan_speed(1 - pfan, 0); + } } #endif // HAS_FAN