Fix single nozzle fan (#13038)

This commit is contained in:
InsanityAutomation 2019-01-30 21:54:04 -05:00 committed by Scott Lahteine
parent 159d7eefda
commit a1d03fe7ba

View file

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