ADAPTIVE_FAN_SLOWING extension to hotend thermal protection (#12853)
This commit is contained in:
committed by
Scott Lahteine
parent
459f4fef60
commit
082f6a27de
@ -24,6 +24,10 @@
|
||||
#include "../../Marlin.h" // for pin_is_protected
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
#if FAN_COUNT > 0
|
||||
#include "../../module/temperature.h"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* M42: Change pin status via GCode
|
||||
*
|
||||
@ -52,13 +56,13 @@ void GcodeSuite::M42() {
|
||||
#if FAN_COUNT > 0
|
||||
switch (pin) {
|
||||
#if HAS_FAN0
|
||||
case FAN_PIN: fan_speed[0] = pin_status; break;
|
||||
case FAN_PIN: thermalManager.fan_speed[0] = pin_status; break;
|
||||
#endif
|
||||
#if HAS_FAN1
|
||||
case FAN1_PIN: fan_speed[1] = pin_status; break;
|
||||
case FAN1_PIN: thermalManager.fan_speed[1] = pin_status; break;
|
||||
#endif
|
||||
#if HAS_FAN2
|
||||
case FAN2_PIN: fan_speed[2] = pin_status; break;
|
||||
case FAN2_PIN: thermalManager.fan_speed[2] = pin_status; break;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
@ -100,10 +100,10 @@ void GcodeSuite::M81() {
|
||||
planner.finish_and_disable();
|
||||
|
||||
#if FAN_COUNT > 0
|
||||
zero_fan_speeds();
|
||||
thermalManager.zero_fan_speeds();
|
||||
#if ENABLED(PROBING_FANS_OFF)
|
||||
fans_paused = false;
|
||||
ZERO(paused_fan_speed);
|
||||
thermalManager.fans_paused = false;
|
||||
ZERO(thermalManager.paused_fan_speed);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -25,13 +25,9 @@
|
||||
#if FAN_COUNT > 0
|
||||
|
||||
#include "../gcode.h"
|
||||
#include "../../Marlin.h" // for fan_speed
|
||||
|
||||
#include "../../module/motion.h"
|
||||
#include "../../module/temperature.h"
|
||||
|
||||
#if ENABLED(SINGLENOZZLE)
|
||||
#include "../../module/tool_change.h"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* M106: Set Fan Speed
|
||||
@ -50,39 +46,16 @@ void GcodeSuite::M106() {
|
||||
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);
|
||||
NOMORE(s, 255U);
|
||||
|
||||
uint8_t np = p;
|
||||
|
||||
#if ENABLED(SINGLENOZZLE)
|
||||
if (p != active_extruder) {
|
||||
if (p < EXTRUDERS) singlenozzle_fan_speed[p] = s;
|
||||
return;
|
||||
}
|
||||
np = 0; // Always use fan index 0 with SINGLENOZZLE
|
||||
#endif
|
||||
|
||||
#if ENABLED(EXTRA_FAN_SPEED)
|
||||
const int16_t t = parser.intval('T');
|
||||
if (t > 0) {
|
||||
switch (t) {
|
||||
case 1:
|
||||
fan_speed[np] = old_fan_speed[np];
|
||||
break;
|
||||
case 2:
|
||||
old_fan_speed[np] = fan_speed[np];
|
||||
fan_speed[np] = new_fan_speed[np];
|
||||
break;
|
||||
default:
|
||||
new_fan_speed[np] = MIN(t, 255U);
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
#endif // EXTRA_FAN_SPEED
|
||||
if (t > 0) return thermalManager.set_temp_fan_speed(p, t);
|
||||
#endif
|
||||
|
||||
fan_speed[np] = s;
|
||||
uint16_t s = parser.ushortval('S', 255);
|
||||
NOMORE(s, 255U);
|
||||
|
||||
thermalManager.set_fan_speed(p, s);
|
||||
}
|
||||
}
|
||||
|
||||
@ -90,16 +63,7 @@ void GcodeSuite::M106() {
|
||||
* M107: Fan Off
|
||||
*/
|
||||
void GcodeSuite::M107() {
|
||||
const uint16_t p = parser.byteval('P', active_extruder);
|
||||
|
||||
#if ENABLED(SINGLENOZZLE)
|
||||
if (p != active_extruder) {
|
||||
if (p < EXTRUDERS) singlenozzle_fan_speed[p] = 0;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (p < MIN(EXTRUDERS, FAN_COUNT)) fan_speed[p] = 0;
|
||||
thermalManager.set_fan_speed(parser.byteval('P', active_extruder), 0);
|
||||
}
|
||||
|
||||
#endif // FAN_COUNT > 0
|
||||
|
Reference in New Issue
Block a user