Browse Source

Fix single nozzle fan (#13038)

pull/1/head
InsanityAutomation 6 years ago
committed by Scott Lahteine
parent
commit
a1d03fe7ba
  1. 13
      Marlin/src/gcode/temperature/M106_M107.cpp

13
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);
}

Loading…
Cancel
Save