Fix M106 with SINGLENOZZLE
This commit is contained in:
parent
7557f8d68c
commit
4f2473053c
@ -25,10 +25,11 @@
|
|||||||
#if FAN_COUNT > 0
|
#if FAN_COUNT > 0
|
||||||
|
|
||||||
#include "../gcode.h"
|
#include "../gcode.h"
|
||||||
#include "../../Marlin.h" // for fan_speed — should move those to Planner
|
#include "../../Marlin.h" // for fan_speed
|
||||||
|
|
||||||
|
#include "../../module/motion.h"
|
||||||
|
|
||||||
#if ENABLED(SINGLENOZZLE)
|
#if ENABLED(SINGLENOZZLE)
|
||||||
#include "../../module/motion.h"
|
|
||||||
#include "../../module/tool_change.h"
|
#include "../../module/tool_change.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -46,36 +47,42 @@
|
|||||||
* 3-255 = Set the speed for use with T2
|
* 3-255 = Set the speed for use with T2
|
||||||
*/
|
*/
|
||||||
void GcodeSuite::M106() {
|
void GcodeSuite::M106() {
|
||||||
const uint8_t p = parser.byteval('P');
|
const uint8_t p = parser.byteval('P', active_extruder);
|
||||||
const uint16_t s = parser.ushortval('S', 255);
|
|
||||||
|
if (p < MIN(EXTRUDERS, FAN_COUNT)) {
|
||||||
|
uint16_t s = parser.ushortval('S', 255);
|
||||||
|
NOMORE(s, 255);
|
||||||
|
|
||||||
|
uint8_t np = p;
|
||||||
|
|
||||||
#if ENABLED(SINGLENOZZLE)
|
#if ENABLED(SINGLENOZZLE)
|
||||||
if (p != active_extruder) {
|
if (p != active_extruder) {
|
||||||
if (p < EXTRUDERS) singlenozzle_fan_speed[p] = MIN(s, 255U);
|
if (p < EXTRUDERS) singlenozzle_fan_speed[p] = s;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
np = 0; // Always use fan index 0 with SINGLENOZZLE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (p < FAN_COUNT) {
|
|
||||||
#if ENABLED(EXTRA_FAN_SPEED)
|
#if ENABLED(EXTRA_FAN_SPEED)
|
||||||
const int16_t t = parser.intval('T');
|
const int16_t t = parser.intval('T');
|
||||||
if (t > 0) {
|
if (t > 0) {
|
||||||
switch (t) {
|
switch (t) {
|
||||||
case 1:
|
case 1:
|
||||||
fan_speed[p] = old_fan_speed[p];
|
fan_speed[np] = old_fan_speed[np];
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
old_fan_speed[p] = fan_speed[p];
|
old_fan_speed[np] = fan_speed[np];
|
||||||
fan_speed[p] = new_fan_speed[p];
|
fan_speed[np] = new_fan_speed[np];
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
new_fan_speed[p] = MIN(t, 255U);
|
new_fan_speed[np] = MIN(t, 255U);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif // EXTRA_FAN_SPEED
|
#endif // EXTRA_FAN_SPEED
|
||||||
fan_speed[p] = MIN(s, 255U);
|
|
||||||
|
fan_speed[np] = s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,7 +90,8 @@ void GcodeSuite::M106() {
|
|||||||
* M107: Fan Off
|
* M107: Fan Off
|
||||||
*/
|
*/
|
||||||
void GcodeSuite::M107() {
|
void GcodeSuite::M107() {
|
||||||
const uint16_t p = parser.ushortval('P');
|
const uint16_t p = parser.byteval('P', active_extruder);
|
||||||
|
|
||||||
#if ENABLED(SINGLENOZZLE)
|
#if ENABLED(SINGLENOZZLE)
|
||||||
if (p != active_extruder) {
|
if (p != active_extruder) {
|
||||||
if (p < EXTRUDERS) singlenozzle_fan_speed[p] = 0;
|
if (p < EXTRUDERS) singlenozzle_fan_speed[p] = 0;
|
||||||
@ -91,7 +99,7 @@ void GcodeSuite::M107() {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (p < FAN_COUNT) fan_speed[p] = 0;
|
if (p < MIN(EXTRUDERS, FAN_COUNT)) fan_speed[p] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // FAN_COUNT > 0
|
#endif // FAN_COUNT > 0
|
||||||
|
Loading…
Reference in New Issue
Block a user