From f11c6d5d02a3992e95c6450a8b7a062aab28f180 Mon Sep 17 00:00:00 2001 From: Marcio Teixeira Date: Tue, 15 Jan 2019 17:45:18 -0700 Subject: [PATCH] Fix M107 when dual-nozzles share fan (#12819) (#12909) --- Marlin/src/gcode/temperature/M106_M107.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Marlin/src/gcode/temperature/M106_M107.cpp b/Marlin/src/gcode/temperature/M106_M107.cpp index 8b9daa779..7150f7db3 100644 --- a/Marlin/src/gcode/temperature/M106_M107.cpp +++ b/Marlin/src/gcode/temperature/M106_M107.cpp @@ -63,7 +63,8 @@ void GcodeSuite::M106() { * M107: Fan Off */ void GcodeSuite::M107() { - thermalManager.set_fan_speed(parser.byteval('P', active_extruder), 0); + const uint8_t p = parser.byteval('P', MIN(active_extruder, FAN_COUNT - 1)); + thermalManager.set_fan_speed(p, 0); } #endif // FAN_COUNT > 0