ADAPTIVE_FAN_SLOWING extension to hotend thermal protection (#12853)

This commit is contained in:
InsanityAutomation 2019-01-12 01:41:48 -05:00 committed by Scott Lahteine
parent 459f4fef60
commit 082f6a27de
88 changed files with 405 additions and 161 deletions

View file

@ -77,6 +77,8 @@
#define THERMAL_PROTECTION_PERIOD 40 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
/**
* Whenever an M104, M109, or M303 increases the target temperature, the
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature

View file

@ -164,17 +164,6 @@ bool Running = true;
TempUnit input_temp_units = TEMPUNIT_C;
#endif
#if FAN_COUNT > 0
uint8_t fan_speed[FAN_COUNT] = { 0 };
#if ENABLED(EXTRA_FAN_SPEED)
uint8_t old_fan_speed[FAN_COUNT], new_fan_speed[FAN_COUNT];
#endif
#if ENABLED(PROBING_FANS_OFF)
bool fans_paused; // = false;
uint8_t paused_fan_speed[FAN_COUNT] = { 0 };
#endif
#endif
// For M109 and M190, this flag may be cleared (by M108) to exit the wait loop
volatile bool wait_for_heatup = true;
@ -655,7 +644,7 @@ void stop() {
print_job_timer.stop();
#if ENABLED(PROBING_FANS_OFF)
if (fans_paused) fans_pause(false); // put things back the way they were
if (thermalManager.fans_paused) thermalManager.set_fans_paused(false); // put things back the way they were
#endif
if (IsRunning()) {
@ -976,7 +965,7 @@ void loop() {
quickstop_stepper();
print_job_timer.stop();
thermalManager.disable_all_heaters();
zero_fan_speeds();
thermalManager.zero_fan_speeds();
wait_for_heatup = false;
#if ENABLED(POWER_LOSS_RECOVERY)
card.removeJobRecoveryFile();

View file

@ -81,24 +81,6 @@ extern volatile bool wait_for_heatup;
// Inactivity shutdown timer
extern millis_t max_inactive_time, stepper_inactive_time;
#if FAN_COUNT > 0
extern uint8_t fan_speed[FAN_COUNT];
#if ENABLED(EXTRA_FAN_SPEED)
extern uint8_t old_fan_speed[FAN_COUNT], new_fan_speed[FAN_COUNT];
#endif
#if ENABLED(PROBING_FANS_OFF)
extern bool fans_paused;
extern uint8_t paused_fan_speed[FAN_COUNT];
#endif
#define FANS_LOOP(I) LOOP_L_N(I, FAN_COUNT)
#endif
inline void zero_fan_speeds() {
#if FAN_COUNT > 0
FANS_LOOP(i) fan_speed[i] = 0;
#endif
}
#if ENABLED(USE_CONTROLLER_FAN)
extern uint8_t controllerfan_speed;
#endif

View file

@ -77,6 +77,8 @@
#define THERMAL_PROTECTION_PERIOD 40 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
/**
* Whenever an M104, M109, or M303 increases the target temperature, the
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature

View file

@ -77,6 +77,8 @@
#define THERMAL_PROTECTION_PERIOD 40 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
/**
* Whenever an M104, M109, or M303 increases the target temperature, the
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature

View file

@ -77,6 +77,8 @@
#define THERMAL_PROTECTION_PERIOD 40 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
/**
* Whenever an M104, M109, or M303 increases the target temperature, the
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature

View file

@ -77,6 +77,8 @@
#define THERMAL_PROTECTION_PERIOD 40 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
/**
* Whenever an M104, M109, or M303 increases the target temperature, the
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature

View file

@ -77,6 +77,8 @@
#define THERMAL_PROTECTION_PERIOD 60 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 10 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
/**
* Whenever an M104, M109, or M303 increases the target temperature, the
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature

View file

@ -77,6 +77,8 @@
#define THERMAL_PROTECTION_PERIOD 60 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 10 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
/**
* Whenever an M104, M109, or M303 increases the target temperature, the
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature

View file

@ -81,6 +81,8 @@
#define THERMAL_PROTECTION_PERIOD 40 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
/**
* Whenever an M104, M109, or M303 increases the target temperature, the
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature

View file

@ -77,6 +77,8 @@
#define THERMAL_PROTECTION_PERIOD 45 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 2 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
/**
* Whenever an M104, M109, or M303 increases the target temperature, the
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature

View file

@ -77,6 +77,8 @@
#define THERMAL_PROTECTION_PERIOD 60 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 2 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
/**
* Whenever an M104, M109, or M303 increases the target temperature, the
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature

View file

@ -77,6 +77,8 @@
#define THERMAL_PROTECTION_PERIOD 40 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
/**
* Whenever an M104, M109, or M303 increases the target temperature, the
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature

View file

@ -77,6 +77,8 @@
#define THERMAL_PROTECTION_PERIOD 40 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
/**
* Whenever an M104, M109, or M303 increases the target temperature, the
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature

View file

@ -77,6 +77,8 @@
#define THERMAL_PROTECTION_PERIOD 40 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
/**
* Whenever an M104, M109, or M303 increases the target temperature, the
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature

View file

@ -77,6 +77,8 @@
#define THERMAL_PROTECTION_PERIOD 40 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
/**
* Whenever an M104, M109, or M303 increases the target temperature, the
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature

View file

@ -77,6 +77,8 @@
#define THERMAL_PROTECTION_PERIOD 40 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
/**
* Whenever an M104, M109, or M303 increases the target temperature, the
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature

View file

@ -77,6 +77,8 @@
#define THERMAL_PROTECTION_PERIOD 40 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
/**
* Whenever an M104, M109, or M303 increases the target temperature, the
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature

View file

@ -77,6 +77,8 @@
#define THERMAL_PROTECTION_PERIOD 40 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
/**
* Whenever an M104, M109, or M303 increases the target temperature, the
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature

View file

@ -77,6 +77,8 @@
#define THERMAL_PROTECTION_PERIOD 40 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
/**
* Whenever an M104, M109, or M303 increases the target temperature, the
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature

View file

@ -77,6 +77,8 @@
#define THERMAL_PROTECTION_PERIOD 40 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
/**
* Whenever an M104, M109, or M303 increases the target temperature, the
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature

View file

@ -77,6 +77,8 @@
#define THERMAL_PROTECTION_PERIOD 40 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
/**
* Whenever an M104, M109, or M303 increases the target temperature, the
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature

View file

@ -77,6 +77,8 @@
#define THERMAL_PROTECTION_PERIOD 40 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
/**
* Whenever an M104, M109, or M303 increases the target temperature, the
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature

View file

@ -77,6 +77,8 @@
#define THERMAL_PROTECTION_PERIOD 40 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
/**
* Whenever an M104, M109, or M303 increases the target temperature, the
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature

View file

@ -77,6 +77,8 @@
#define THERMAL_PROTECTION_PERIOD 40 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
/**
* Whenever an M104, M109, or M303 increases the target temperature, the
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature

View file

@ -77,6 +77,8 @@
#define THERMAL_PROTECTION_PERIOD 40 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 2 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
/**
* Whenever an M104, M109, or M303 increases the target temperature, the
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature

View file

@ -77,6 +77,8 @@
#define THERMAL_PROTECTION_PERIOD 210 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 2 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
/**
* Whenever an M104, M109, or M303 increases the target temperature, the
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature

View file

@ -77,6 +77,8 @@
#define THERMAL_PROTECTION_PERIOD 60 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 10 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
/**
* Whenever an M104, M109, or M303 increases the target temperature, the
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature

View file

@ -77,6 +77,8 @@
#define THERMAL_PROTECTION_PERIOD 60 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 10 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
/**
* Whenever an M104, M109, or M303 increases the target temperature, the
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature

View file

@ -77,6 +77,8 @@
#define THERMAL_PROTECTION_PERIOD 40 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
/**
* Whenever an M104, M109, or M303 increases the target temperature, the
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature

View file

@ -77,6 +77,8 @@
#define THERMAL_PROTECTION_PERIOD 40 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
/**
* Whenever an M104, M109, or M303 increases the target temperature, the
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature

View file

@ -77,6 +77,8 @@
#define THERMAL_PROTECTION_PERIOD 40 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
/**
* Whenever an M104, M109, or M303 increases the target temperature, the
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature

View file

@ -77,6 +77,8 @@
#define THERMAL_PROTECTION_PERIOD 40 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
/**
* Whenever an M104, M109, or M303 increases the target temperature, the
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature

View file

@ -77,6 +77,8 @@
#define THERMAL_PROTECTION_PERIOD 40 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
/**
* Whenever an M104, M109, or M303 increases the target temperature, the
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature

View file

@ -77,6 +77,8 @@
#define THERMAL_PROTECTION_PERIOD 40 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
/**
* Whenever an M104, M109, or M303 increases the target temperature, the
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature

View file

@ -77,6 +77,8 @@
#define THERMAL_PROTECTION_PERIOD 40 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
/**
* Whenever an M104, M109, or M303 increases the target temperature, the
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature

View file

@ -77,6 +77,8 @@
#define THERMAL_PROTECTION_PERIOD 40 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
/**
* Whenever an M104, M109, or M303 increases the target temperature, the
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature

View file

@ -77,6 +77,8 @@
#define THERMAL_PROTECTION_PERIOD 40 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
/**
* Whenever an M104, M109, or M303 increases the target temperature, the
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature

View file

@ -77,6 +77,8 @@
#define THERMAL_PROTECTION_PERIOD 40 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
/**
* Whenever an M104, M109, or M303 increases the target temperature, the
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature

View file

@ -77,6 +77,8 @@
#define THERMAL_PROTECTION_PERIOD 50 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 6 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
/**
* Whenever an M104, M109, or M303 increases the target temperature, the
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature

View file

@ -77,6 +77,8 @@
#define THERMAL_PROTECTION_PERIOD 40 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
/**
* Whenever an M104, M109, or M303 increases the target temperature, the
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature

View file

@ -77,6 +77,8 @@
#define THERMAL_PROTECTION_PERIOD 40 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
/**
* Whenever an M104, M109, or M303 increases the target temperature, the
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature

View file

@ -77,6 +77,8 @@
#define THERMAL_PROTECTION_PERIOD 40 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
/**
* Whenever an M104, M109, or M303 increases the target temperature, the
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature

View file

@ -77,6 +77,8 @@
#define THERMAL_PROTECTION_PERIOD 50 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 6 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
/**
* Whenever an M104, M109, or M303 increases the target temperature, the
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature

View file

@ -77,6 +77,8 @@
#define THERMAL_PROTECTION_PERIOD 40 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
/**
* Whenever an M104, M109, or M303 increases the target temperature, the
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature

View file

@ -77,6 +77,8 @@
#define THERMAL_PROTECTION_PERIOD 40 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
/**
* Whenever an M104, M109, or M303 increases the target temperature, the
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature

View file

@ -77,6 +77,8 @@
#define THERMAL_PROTECTION_PERIOD 40 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
/**
* Whenever an M104, M109, or M303 increases the target temperature, the
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature

View file

@ -77,6 +77,8 @@
#define THERMAL_PROTECTION_PERIOD 40 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
/**
* Whenever an M104, M109, or M303 increases the target temperature, the
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature

View file

@ -77,6 +77,8 @@
#define THERMAL_PROTECTION_PERIOD 40 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
/**
* Whenever an M104, M109, or M303 increases the target temperature, the
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature

View file

@ -77,5 +77,5 @@ const unsigned char custom_start_bmp[] PROGMEM = {
B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000
B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000
};

View file

@ -87,6 +87,8 @@
#define THERMAL_PROTECTION_PERIOD 60 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 8 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
/**
* Whenever an M104, M109, or M303 increases the target temperature, the
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature

View file

@ -77,6 +77,8 @@
#define THERMAL_PROTECTION_PERIOD 40 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
/**
* Whenever an M104, M109, or M303 increases the target temperature, the
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature

View file

@ -77,6 +77,8 @@
#define THERMAL_PROTECTION_PERIOD 60 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
/**
* Whenever an M104, M109, or M303 increases the target temperature, the
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature

View file

@ -77,6 +77,8 @@
#define THERMAL_PROTECTION_PERIOD 40 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
/**
* Whenever an M104, M109, or M303 increases the target temperature, the
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature

View file

@ -77,6 +77,8 @@
#define THERMAL_PROTECTION_PERIOD 40 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
/**
* Whenever an M104, M109, or M303 increases the target temperature, the
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature

View file

@ -77,6 +77,8 @@
#define THERMAL_PROTECTION_PERIOD 40 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
/**
* Whenever an M104, M109, or M303 increases the target temperature, the
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature

View file

@ -77,6 +77,8 @@
#define THERMAL_PROTECTION_PERIOD 40 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
/**
* Whenever an M104, M109, or M303 increases the target temperature, the
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature

View file

@ -77,6 +77,8 @@
#define THERMAL_PROTECTION_PERIOD 40 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
/**
* Whenever an M104, M109, or M303 increases the target temperature, the
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature

View file

@ -77,6 +77,8 @@
#define THERMAL_PROTECTION_PERIOD 50 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 6 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
/**
* Whenever an M104, M109, or M303 increases the target temperature, the
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature

View file

@ -77,6 +77,8 @@
#define THERMAL_PROTECTION_PERIOD 60 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 10 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
/**
* Whenever an M104, M109, or M303 increases the target temperature, the
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature

View file

@ -77,6 +77,8 @@
#define THERMAL_PROTECTION_PERIOD 40 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
/**
* Whenever an M104, M109, or M303 increases the target temperature, the
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature

View file

@ -77,6 +77,8 @@
#define THERMAL_PROTECTION_PERIOD 40 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
/**
* Whenever an M104, M109, or M303 increases the target temperature, the
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature

View file

@ -77,6 +77,8 @@
#define THERMAL_PROTECTION_PERIOD 40 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
/**
* Whenever an M104, M109, or M303 increases the target temperature, the
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature

View file

@ -77,6 +77,8 @@
#define THERMAL_PROTECTION_PERIOD 50 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 3 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
/**
* Whenever an M104, M109, or M303 increases the target temperature, the
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature

View file

@ -77,6 +77,8 @@
#define THERMAL_PROTECTION_PERIOD 40 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
/**
* Whenever an M104, M109, or M303 increases the target temperature, the
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature

View file

@ -77,6 +77,8 @@
#define THERMAL_PROTECTION_PERIOD 40 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
/**
* Whenever an M104, M109, or M303 increases the target temperature, the
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature

View file

@ -77,6 +77,8 @@
#define THERMAL_PROTECTION_PERIOD 40 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
/**
* Whenever an M104, M109, or M303 increases the target temperature, the
* firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature

View file

@ -39,7 +39,7 @@ millis_t Power::lastPowerOn;
bool Power::is_power_needed() {
#if ENABLED(AUTO_POWER_FANS)
FANS_LOOP(i) if (fan_speed[i]) return true;
FANS_LOOP(i) if (thermalManager.fan_speed[i]) return true;
#endif
#if ENABLED(AUTO_POWER_E_FANS)

View file

@ -162,7 +162,7 @@ void PrintJobRecovery::save(const bool force/*=false*/, const bool save_queue/*=
#endif
#if FAN_COUNT
COPY(info.fan_speed, fan_speed);
COPY(info.fan_speed, thermalManager.fan_speed);
#endif
#if HAS_LEVELING

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -866,11 +866,15 @@ void MarlinUI::draw_status_screen() {
_draw_print_progress();
#else
char c;
int per;
uint16_t per;
#if HAS_FAN0
if (blink) {
c = 'F';
per = ((int(fan_speed[0]) + 1) * 100) / 256;
if (blink || thermalManager.fan_speed_scaler[0] < 128) {
uint16_t spd = thermalManager.fan_speed[0];
if (blink) c = 'F';
#if ENABLED(ADAPTIVE_FAN_SLOWING)
else { c = '*'; spd = (spd * thermalManager.fan_speed_scaler[0]) >> 7; }
#endif
per = thermalManager.fanPercent(spd);
}
else
#endif
@ -1049,13 +1053,13 @@ void MarlinUI::draw_status_screen() {
#if FAN_COUNT > 0
if (0
#if HAS_FAN0
|| fan_speed[0]
|| thermalManager.fan_speed[0]
#endif
#if HAS_FAN1
|| fan_speed[1]
|| thermalManager.fan_speed[1]
#endif
#if HAS_FAN2
|| fan_speed[2]
|| thermalManager.fan_speed[2]
#endif
) leds |= LED_C;
#endif // FAN_COUNT > 0

View file

@ -291,7 +291,7 @@ void MarlinUI::draw_status_screen() {
static uint8_t fan_frame;
if (old_blink != blink) {
old_blink = blink;
if (!fan_speed[0] || ++fan_frame >= STATUS_FAN_FRAMES) fan_frame = 0;
if (!thermalManager.fan_speed[0] || ++fan_frame >= STATUS_FAN_FRAMES) fan_frame = 0;
}
#endif
if (PAGE_CONTAINS(STATUS_FAN_Y, STATUS_FAN_Y + STATUS_FAN_HEIGHT - 1))
@ -305,7 +305,7 @@ void MarlinUI::draw_status_screen() {
fan_frame == 3 ? status_fan3_bmp :
#endif
#elif STATUS_FAN_FRAMES > 1
blink && fan_speed[0] ? status_fan1_bmp :
blink && thermalManager.fan_speed[0] ? status_fan1_bmp :
#endif
status_fan0_bmp
);
@ -328,11 +328,18 @@ void MarlinUI::draw_status_screen() {
// Fan, if a bitmap was provided
#if DO_DRAW_FAN
if (PAGE_CONTAINS(STATUS_FAN_TEXT_Y - INFO_FONT_ASCENT, STATUS_FAN_TEXT_Y - 1)) {
const int per = ((int(fan_speed[0]) + 1) * 100) / 256;
if (per) {
char c = '%';
uint16_t spd = thermalManager.fan_speed[0];
if (spd) {
#if ENABLED(ADAPTIVE_FAN_SLOWING)
if (!blink && thermalManager.fan_speed_scaler[0] < 128) {
spd = (spd * thermalManager.fan_speed_scaler[0]) >> 7;
c = '*';
}
#endif
lcd_moveto(STATUS_FAN_TEXT_X, STATUS_FAN_TEXT_Y);
lcd_put_u8str(itostr3(per));
lcd_put_wchar('%');
lcd_put_u8str(itostr3(thermalManager.fanPercent(spd)));
lcd_put_wchar(c);
}
}
#endif

View file

@ -707,7 +707,7 @@ bool ST7920_Lite_Status_Screen::indicators_changed() {
// them only during blinks we gain a bit of stability.
const bool blink = ui.get_blink();
const uint16_t feedrate_perc = feedrate_percentage;
const uint8_t fs = (((uint16_t)fan_speed[0] + 1) * 100) / 256;
const uint16_t fs = (thermalManager.fan_speed[0] * uint16_t(thermalManager.fan_speed_scaler[0])) >> 7;
const int16_t extruder_1_target = thermalManager.degTargetHotend(0);
#if HOTENDS > 1
const int16_t extruder_2_target = thermalManager.degTargetHotend(1);
@ -734,7 +734,6 @@ void ST7920_Lite_Status_Screen::update_indicators(const bool forceUpdate) {
const bool blink = ui.get_blink();
const duration_t elapsed = print_job_timer.duration();
const uint16_t feedrate_perc = feedrate_percentage;
const uint8_t fs = (((uint16_t)fan_speed[0] + 1) * 100) / 256;
const int16_t extruder_1_temp = thermalManager.degHotend(0),
extruder_1_target = thermalManager.degTargetHotend(0);
#if HOTENDS > 1
@ -753,12 +752,20 @@ void ST7920_Lite_Status_Screen::update_indicators(const bool forceUpdate) {
#if HAS_HEATED_BED
draw_bed_temp(bed_temp, bed_target, forceUpdate);
#endif
draw_fan_speed(fs);
uint16_t spd = thermalManager.fan_speed[0];
#if ENABLED(ADAPTIVE_FAN_SLOWING)
if (!blink && thermalManager.fan_speed_scaler[0] < 128)
spd = (spd * thermalManager.fan_speed_scaler[0]) >> 7;
#endif
draw_fan_speed(thermalManager.fanPercent(spd));
draw_print_time(elapsed);
draw_feedrate_percentage(feedrate_perc);
// Update the fan and bed animations
if (fs) draw_fan_icon(blink);
if (spd) draw_fan_icon(blink);
#if HAS_HEATED_BED
draw_heat_icon(bed_target > 0 && blink, bed_target > 0);
#endif

View file

@ -180,7 +180,13 @@ namespace ExtUI {
return thermalManager.degTargetHotend(extruder - E0);
}
float getFan_percent(const fan_t fan) { return ((float(fan_speed[fan - FAN0]) + 1) * 100) / 256; }
float getTargetFan_percent(const fan_t fan) {
return thermalManager.fanPercent(thermalManager.fan_speed[fan - FAN0]);
}
float getActualFan_percent(const fan_t fan) {
return thermalManager.fanPercent((thermalManager.fan_speed[fan - FAN0] * uint16_t(thermalManager.fan_speed_scaler[fan - FAN0])) >> 7);
}
float getAxisPosition_mm(const axis_t axis) {
return flags.manual_motion ? destination[axis] : current_position[axis];
@ -560,9 +566,9 @@ namespace ExtUI {
thermalManager.setTargetHotend(clamp(value, 0, heater_maxtemp[e] - 15), e);
}
void setFan_percent(float value, const fan_t fan) {
void setTargetFan_percent(const float value, const fan_t fan) {
if (fan < FAN_COUNT)
fan_speed[fan - FAN0] = clamp(round(value * 255 / 100), 0, 255);
thermalManager.set_fan_speed(fan - FAN0, map(value, 0, 100, 0, 255));
}
void setFeedrate_percent(const float value) {

View file

@ -72,7 +72,8 @@ namespace ExtUI {
float getActualTemp_celsius(const extruder_t);
float getTargetTemp_celsius(const heater_t);
float getTargetTemp_celsius(const extruder_t);
float getFan_percent(const fan_t);
float getTargetFan_percent(const fan_t);
float getActualFan_percent(const fan_t);
float getAxisPosition_mm(const axis_t);
float getAxisPosition_mm(const extruder_t);
float getAxisSteps_per_mm(const axis_t);
@ -100,7 +101,7 @@ namespace ExtUI {
void setTargetTemp_celsius(const float, const heater_t);
void setTargetTemp_celsius(const float, const extruder_t);
void setFan_percent(const float, const fan_t);
void setTargetFan_percent(const float, const fan_t);
void setAxisPosition_mm(const float, const axis_t);
void setAxisPosition_mm(const float, const extruder_t);
void setAxisSteps_per_mm(const float, const axis_t);

View file

@ -255,7 +255,7 @@ void process_lcd_p_command(const char* command) {
quickstop_stepper();
print_job_timer.stop();
thermalManager.disable_all_heaters();
zero_fan_speeds();
thermalManager.zero_fan_speeds();
wait_for_heatup = false;
write_to_lcd_P(PSTR("{SYS:STARTED}"));
#endif

View file

@ -54,7 +54,7 @@ void lcd_pause() {
void lcd_resume() {
#if ENABLED(SDSUPPORT)
if (card.isPaused()) enqueue_and_echo_commands_P(PSTR("M24"));
#elif ENABLED(ACTION_ON_RESUME)
#elif defined(ACTION_ON_RESUME)
SERIAL_ECHOLNPGM("//action:" ACTION_ON_RESUME);
#endif
}

View file

@ -52,9 +52,9 @@ void _lcd_preheat(const int16_t endnum, const int16_t temph, const int16_t tempb
#endif
#if FAN_COUNT > 0
#if FAN_COUNT > 1
fan_speed[active_extruder < FAN_COUNT ? active_extruder : 0] = fan;
thermalManager.set_fan_speed(active_extruder < FAN_COUNT ? active_extruder : 0, fan);
#else
fan_speed[0] = fan;
thermalManager.set_fan_speed(0, fan);
#endif
#else
UNUSED(fan);
@ -292,7 +292,7 @@ void _lcd_preheat(const int16_t endnum, const int16_t temph, const int16_t tempb
}
void lcd_cooldown() {
zero_fan_speeds();
thermalManager.zero_fan_speeds();
thermalManager.disable_all_heaters();
ui.return_to_status();
}
@ -339,21 +339,21 @@ void menu_temperature() {
//
#if FAN_COUNT > 0
#if HAS_FAN0
MENU_MULTIPLIER_ITEM_EDIT(int8, MSG_FAN_SPEED FAN_SPEED_1_SUFFIX, &fan_speed[0], 0, 255);
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int8, MSG_FAN_SPEED FAN_SPEED_1_SUFFIX, &thermalManager.lcd_tmpfan_speed[0], 0, 255, thermalManager.lcd_setFanSpeed0);
#if ENABLED(EXTRA_FAN_SPEED)
MENU_MULTIPLIER_ITEM_EDIT(int8, MSG_EXTRA_FAN_SPEED FAN_SPEED_1_SUFFIX, &new_fan_speed[0], 3, 255);
MENU_MULTIPLIER_ITEM_EDIT(int8, MSG_EXTRA_FAN_SPEED FAN_SPEED_1_SUFFIX, &thermalManager.new_fan_speed[0], 3, 255);
#endif
#endif
#if HAS_FAN1
MENU_MULTIPLIER_ITEM_EDIT(int8, MSG_FAN_SPEED " 2", &fan_speed[1], 0, 255);
#if HAS_FAN1 || (ENABLED(SINGLENOZZLE) && EXTRUDERS > 1)
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int8, MSG_FAN_SPEED " 2", &thermalManager.lcd_tmpfan_speed[1], 0, 255, thermalManager.lcd_setFanSpeed1);
#if ENABLED(EXTRA_FAN_SPEED)
MENU_MULTIPLIER_ITEM_EDIT(int8, MSG_EXTRA_FAN_SPEED " 2", &new_fan_speed[1], 3, 255);
MENU_MULTIPLIER_ITEM_EDIT(int8, MSG_EXTRA_FAN_SPEED " 2", &thermalManager.new_fan_speed[1], 3, 255);
#endif
#endif
#if HAS_FAN2
MENU_MULTIPLIER_ITEM_EDIT(int8, MSG_FAN_SPEED " 3", &fan_speed[2], 0, 255);
#if HAS_FAN2 || (ENABLED(SINGLENOZZLE) && EXTRUDERS > 2)
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int8, MSG_FAN_SPEED " 3", &thermalManager.lcd_tmpfan_speed[2], 0, 255, thermalManager.lcd_setFanSpeed2);
#if ENABLED(EXTRA_FAN_SPEED)
MENU_MULTIPLIER_ITEM_EDIT(int8, MSG_EXTRA_FAN_SPEED " 3", &new_fan_speed[2], 3, 255);
MENU_MULTIPLIER_ITEM_EDIT(int8, MSG_EXTRA_FAN_SPEED " 3", &thermalManager.new_fan_speed[2], 3, 255);
#endif
#endif
#endif // FAN_COUNT > 0

View file

@ -141,21 +141,21 @@ void menu_tune() {
//
#if FAN_COUNT > 0
#if HAS_FAN0
MENU_MULTIPLIER_ITEM_EDIT(int8, MSG_FAN_SPEED FAN_SPEED_1_SUFFIX, &fan_speed[0], 0, 255);
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int8, MSG_FAN_SPEED FAN_SPEED_1_SUFFIX, &thermalManager.lcd_tmpfan_speed[0], 0, 255, thermalManager.lcd_setFanSpeed0);
#if ENABLED(EXTRA_FAN_SPEED)
MENU_MULTIPLIER_ITEM_EDIT(int8, MSG_EXTRA_FAN_SPEED FAN_SPEED_1_SUFFIX, &new_fan_speed[0], 3, 255);
MENU_MULTIPLIER_ITEM_EDIT(int8, MSG_EXTRA_FAN_SPEED FAN_SPEED_1_SUFFIX, &thermalManager.new_fan_speed[0], 3, 255);
#endif
#endif
#if HAS_FAN1
MENU_MULTIPLIER_ITEM_EDIT(int8, MSG_FAN_SPEED " 2", &fan_speed[1], 0, 255);
#if HAS_FAN1 || (ENABLED(SINGLENOZZLE) && EXTRUDERS > 1)
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int8, MSG_FAN_SPEED " 2", &thermalManager.lcd_tmpfan_speed[1], 0, 255, thermalManager.lcd_setFanSpeed1);
#if ENABLED(EXTRA_FAN_SPEED)
MENU_MULTIPLIER_ITEM_EDIT(int8, MSG_EXTRA_FAN_SPEED " 2", &new_fan_speed[1], 3, 255);
MENU_MULTIPLIER_ITEM_EDIT(int8, MSG_EXTRA_FAN_SPEED " 2", &thermalManager.new_fan_speed[1], 3, 255);
#endif
#endif
#if HAS_FAN2
MENU_MULTIPLIER_ITEM_EDIT(int8, MSG_FAN_SPEED " 3", &fan_speed[2], 0, 255);
#if HAS_FAN2 || (ENABLED(SINGLENOZZLE) && EXTRUDERS > 2)
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int8, MSG_FAN_SPEED " 3", &thermalManager.lcd_tmpfan_speed[2], 0, 255, thermalManager.lcd_setFanSpeed2);
#if ENABLED(EXTRA_FAN_SPEED)
MENU_MULTIPLIER_ITEM_EDIT(int8, MSG_EXTRA_FAN_SPEED " 3", &new_fan_speed[2], 3, 255);
MENU_MULTIPLIER_ITEM_EDIT(int8, MSG_EXTRA_FAN_SPEED " 3", &thermalManager.new_fan_speed[2], 3, 255);
#endif
#endif
#endif // FAN_COUNT > 0

View file

@ -1178,10 +1178,9 @@ void Planner::check_axes_activity() {
#endif
if (has_blocks_queued()) {
#if FAN_COUNT > 0
FANS_LOOP(i)
tail_fan_speed[i] = block_buffer[block_buffer_tail].fan_speed[i];
tail_fan_speed[i] = (block_buffer[block_buffer_tail].fan_speed[i] * uint16_t(thermalManager.fan_speed_scaler[i])) >> 7;
#endif
block_t* block;
@ -1203,7 +1202,8 @@ void Planner::check_axes_activity() {
}
else {
#if FAN_COUNT > 0
FANS_LOOP(i) tail_fan_speed[i] = fan_speed[i];
FANS_LOOP(i)
tail_fan_speed[i] = (thermalManager.fan_speed[i] * uint16_t(thermalManager.fan_speed_scaler[i])) >> 7;
#endif
#if ENABLED(BARICUDA)
@ -1903,7 +1903,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
#endif
#if FAN_COUNT > 0
FANS_LOOP(i) block->fan_speed[i] = fan_speed[i];
FANS_LOOP(i) block->fan_speed[i] = thermalManager.fan_speed[i];
#endif
#if ENABLED(BARICUDA)

View file

@ -268,31 +268,13 @@ float zprobe_zoffset; // Initialized by settings.load()
#endif // Z_PROBE_ALLEN_KEY
#if ENABLED(PROBING_FANS_OFF)
void fans_pause(const bool p) {
if (p != fans_paused) {
fans_paused = p;
if (p)
for (uint8_t x = 0; x < FAN_COUNT; x++) {
paused_fan_speed[x] = fan_speed[x];
fan_speed[x] = 0;
}
else
for (uint8_t x = 0; x < FAN_COUNT; x++)
fan_speed[x] = paused_fan_speed[x];
}
}
#endif // PROBING_FANS_OFF
#if QUIET_PROBING
void probing_pause(const bool p) {
#if ENABLED(PROBING_HEATERS_OFF)
thermalManager.pause(p);
#endif
#if ENABLED(PROBING_FANS_OFF)
fans_pause(p);
thermalManager.set_fans_paused(p);
#endif
#if ENABLED(PROBING_STEPPERS_OFF)
disable_e_steppers();

View file

@ -58,10 +58,6 @@
void probing_pause(const bool p);
#endif
#if ENABLED(PROBING_FANS_OFF)
void fans_pause(const bool p);
#endif
#if ENABLED(BLTOUCH)
void bltouch_command(int angle);
bool set_bltouch_deployed(const bool deploy);

View file

@ -55,6 +55,10 @@
#include "../feature/leds/printer_event_leds.h"
#endif
#if ENABLED(SINGLENOZZLE)
#include "tool_change.h"
#endif
#if HOTEND_USES_THERMISTOR
#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
static void* heater_ttbl_map[2] = { (void*)HEATER_0_TEMPTABLE, (void*)HEATER_1_TEMPTABLE };
@ -92,14 +96,99 @@ Temperature thermalManager;
// public:
float Temperature::current_temperature[HOTENDS] = { 0.0 };
int16_t Temperature::current_temperature_raw[HOTENDS] = { 0 },
Temperature::target_temperature[HOTENDS] = { 0 };
float Temperature::current_temperature[HOTENDS]; // = { 0.0 };
int16_t Temperature::current_temperature_raw[HOTENDS], // = { 0 }
Temperature::target_temperature[HOTENDS]; // = { 0 }
#if ENABLED(AUTO_POWER_E_FANS)
uint8_t Temperature::autofan_speed[HOTENDS] = { 0 };
uint8_t Temperature::autofan_speed[HOTENDS]; // = { 0 }
#endif
#if FAN_COUNT > 0
uint8_t Temperature::fan_speed[FAN_COUNT]; // = { 0 }
#if ENABLED(EXTRA_FAN_SPEED)
uint8_t Temperature::old_fan_speed[FAN_COUNT], Temperature::new_fan_speed[FAN_COUNT];
void Temperature::set_temp_fan_speed(const uint8_t fan, const int16_t tmp_temp) {
switch (tmp_temp) {
case 1:
set_fan_speed(fan, old_fan_speed[fan]);
break;
case 2:
old_fan_speed[fan] = fan_speed[fan];
set_fan_speed(fan, new_fan_speed[fan]);
break;
default:
new_fan_speed[fan] = MIN(tmp_temp, 255U);
break;
}
}
#endif
#if ENABLED(PROBING_FANS_OFF)
bool Temperature::fans_paused; // = false;
uint8_t Temperature::paused_fan_speed[FAN_COUNT]; // = { 0 }
#endif
#if ENABLED(ADAPTIVE_FAN_SLOWING)
uint8_t Temperature::fan_speed_scaler[FAN_COUNT] = ARRAY_N(FAN_COUNT, 128, 128, 128, 128, 128, 128);
#endif
#if HAS_LCD_MENU
uint8_t Temperature::lcd_tmpfan_speed[
#if ENABLED(SINGLENOZZLE)
MAX(EXTRUDERS, FAN_COUNT)
#else
FAN_COUNT
#endif
]; // = { 0 }
#endif
void Temperature::set_fan_speed(uint8_t target, uint16_t speed) {
NOMORE(speed, 255U);
#if ENABLED(SINGLENOZZLE)
if (target != active_extruder) {
if (target < EXTRUDERS) singlenozzle_fan_speed[target] = speed;
return;
}
target = 0; // Always use fan index 0 with SINGLENOZZLE
#endif
if (target >= FAN_COUNT) return;
fan_speed[target] = speed;
#if ENABLED(ULTRA_LCD)
lcd_tmpfan_speed[target] = speed;
#endif
}
#if ENABLED(PROBING_FANS_OFF)
void Temperature::set_fans_paused(const bool p) {
if (p != fans_paused) {
fans_paused = p;
if (p)
for (uint8_t x = 0; x < FAN_COUNT; x++) {
paused_fan_speed[x] = fan_speed[x];
fan_speed[x] = 0;
}
else
for (uint8_t x = 0; x < FAN_COUNT; x++)
fan_speed[x] = paused_fan_speed[x];
}
}
#endif // PROBING_FANS_OFF
#endif // FAN_COUNT > 0
#if HAS_HEATED_BED
float Temperature::current_temperature_bed = 0.0;
int16_t Temperature::current_temperature_bed_raw = 0,
@ -1529,18 +1618,38 @@ void Temperature::init() {
switch (*state) {
// Inactive state waits for a target temperature to be set
case TRInactive: break;
// When first heating, wait for the temperature to be reached then go to Stable state
case TRFirstHeating:
if (current < tr_target_temperature[heater_index]) break;
*state = TRStable;
// While the temperature is stable watch for a bad temperature
case TRStable:
#if ENABLED(ADAPTIVE_FAN_SLOWING) && FAN_COUNT > 0
if (heater_id >= 0) {
const int fan_index = MIN(heater_id, FAN_COUNT - 1);
if (fan_speed[fan_index] == 0 || current >= tr_target_temperature[heater_id] - (hysteresis_degc * 0.25f))
fan_speed_scaler[fan_index] = 128;
else if (current >= tr_target_temperature[heater_id] - (hysteresis_degc * 0.3335f))
fan_speed_scaler[fan_index] = 96;
else if (current >= tr_target_temperature[heater_id] - (hysteresis_degc * 0.5f))
fan_speed_scaler[fan_index] = 64;
else if (current >= tr_target_temperature[heater_id] - (hysteresis_degc * 0.8f))
fan_speed_scaler[fan_index] = 32;
else
fan_speed_scaler[fan_index] = 0;
}
#endif
if (current >= tr_target_temperature[heater_index] - hysteresis_degc) {
*timer = millis() + period_seconds * 1000UL;
break;
}
else if (PENDING(millis(), *timer)) break;
*state = TRRunaway;
case TRRunaway:
_temp_error(heater_id, PSTR(MSG_T_THERMAL_RUNAWAY), TEMP_ERR_PSTR(MSG_THERMAL_RUNAWAY, heater_id));
}

View file

@ -320,6 +320,71 @@ class Temperature {
static float analog_to_celsiusChamber(const int raw);
#endif
#if FAN_COUNT > 0
static uint8_t fan_speed[FAN_COUNT];
#define FANS_LOOP(I) LOOP_L_N(I, FAN_COUNT)
static void set_fan_speed(const uint8_t target, const uint16_t speed);
#if ENABLED(PROBING_FANS_OFF)
static bool fans_paused;
static uint8_t paused_fan_speed[FAN_COUNT];
#endif
static constexpr inline uint8_t fanPercent(const uint8_t speed) { return (int(speed) * 100 + 127) / 255; }
#if ENABLED(ADAPTIVE_FAN_SLOWING)
static uint8_t fan_speed_scaler[FAN_COUNT];
#else
static constexpr uint8_t fan_speed_scaler[FAN_COUNT] = ARRAY_N(FAN_COUNT, 128, 128, 128, 128, 128, 128);
#endif
static inline uint8_t lcd_fanSpeedActual(const uint8_t target) {
return (fan_speed[target] * uint16_t(fan_speed_scaler[target])) >> 7;
}
#if ENABLED(EXTRA_FAN_SPEED)
static uint8_t old_fan_speed[FAN_COUNT], new_fan_speed[FAN_COUNT];
static void set_temp_fan_speed(const uint8_t fan, const int16_t tmp_temp);
#endif
#if HAS_LCD_MENU
static uint8_t lcd_tmpfan_speed[
#if ENABLED(SINGLENOZZLE)
MAX(EXTRUDERS, FAN_COUNT)
#else
FAN_COUNT
#endif
];
static inline void lcd_setFanSpeed(const uint8_t target) { set_fan_speed(target, lcd_tmpfan_speed[target]); }
#if HAS_FAN0
FORCE_INLINE static void lcd_setFanSpeed0() { lcd_setFanSpeed(0); }
#endif
#if HAS_FAN1 || (ENABLED(SINGLENOZZLE) && EXTRUDERS > 1)
FORCE_INLINE static void lcd_setFanSpeed1() { lcd_setFanSpeed(1); }
#endif
#if HAS_FAN2 || (ENABLED(SINGLENOZZLE) && EXTRUDERS > 2)
FORCE_INLINE static void lcd_setFanSpeed2() { lcd_setFanSpeed(2); }
#endif
#endif // HAS_LCD_MENU
#if ENABLED(PROBING_FANS_OFF)
void set_fans_paused(const bool p);
#endif
#endif // FAN_COUNT > 0
static inline void zero_fan_speeds() {
#if FAN_COUNT > 0
FANS_LOOP(i) fan_speed[i] = 0;
#endif
}
/**
* Called from the Temperature ISR
*/

View file

@ -674,8 +674,8 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n
#if ENABLED(SINGLENOZZLE)
#if FAN_COUNT > 0
singlenozzle_fan_speed[active_extruder] = fan_speed[0];
fan_speed[0] = singlenozzle_fan_speed[tmp_extruder];
singlenozzle_fan_speed[active_extruder] = thermalManager.fan_speed[0];
thermalManager.fan_speed[0] = singlenozzle_fan_speed[tmp_extruder];
#endif
singlenozzle_temp[active_extruder] = thermalManager.target_temperature[0];

View file

@ -36,7 +36,7 @@ opt_set EXTRUDERS 2
opt_set TEMP_SENSOR_0 1
opt_set TEMP_SENSOR_1 5
opt_set TEMP_SENSOR_BED 1
opt_enable REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER SDSUPPORT \
opt_enable REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER SDSUPPORT ADAPTIVE_FAN_SLOWING \
FILAMENT_WIDTH_SENSOR FILAMENT_LCD_DISPLAY \
FIX_MOUNTED_PROBE Z_SAFE_HOMING AUTO_BED_LEVELING_BILINEAR Z_MIN_PROBE_REPEATABILITY_TEST DEBUG_LEVELING_FEATURE \
BABYSTEPPING BABYSTEP_XY BABYSTEP_ZPROBE_OFFSET BABYSTEP_ZPROBE_GFX_OVERLAY \