From bcf347403b13546e591e4f80cc06e61812049703 Mon Sep 17 00:00:00 2001 From: Luu Lac <45380455+shitcreek@users.noreply.github.com> Date: Sat, 5 Jan 2019 14:01:35 -0600 Subject: [PATCH] Fix M106 extruder & fan count (#12820) --- Marlin/src/gcode/temperature/M106_M107.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/gcode/temperature/M106_M107.cpp b/Marlin/src/gcode/temperature/M106_M107.cpp index 268a57d95..5fcf465e7 100644 --- a/Marlin/src/gcode/temperature/M106_M107.cpp +++ b/Marlin/src/gcode/temperature/M106_M107.cpp @@ -47,7 +47,7 @@ * 3-255 = Set the speed for use with T2 */ void GcodeSuite::M106() { - const uint8_t p = parser.byteval('P', active_extruder); + const uint8_t p = parser.byteval('P', MIN(active_extruder, FAN_COUNT - 1)); if (p < MIN(EXTRUDERS, FAN_COUNT)) { uint16_t s = parser.ushortval('S', 255);