Common method for scaled fan speed
This commit is contained in:
parent
1a09c4dea5
commit
a8d68b7c8a
7 changed files with 16 additions and 9 deletions
|
@ -886,7 +886,7 @@ void MarlinUI::draw_status_screen() {
|
||||||
uint16_t spd = thermalManager.fan_speed[0];
|
uint16_t spd = thermalManager.fan_speed[0];
|
||||||
if (blink) c = 'F';
|
if (blink) c = 'F';
|
||||||
#if ENABLED(ADAPTIVE_FAN_SLOWING)
|
#if ENABLED(ADAPTIVE_FAN_SLOWING)
|
||||||
else { c = '*'; spd = (spd * thermalManager.fan_speed_scaler[0]) >> 7; }
|
else { c = '*'; spd = thermalManager.scaledFanSpeed(0, spd); }
|
||||||
#endif
|
#endif
|
||||||
per = thermalManager.fanPercent(spd);
|
per = thermalManager.fanPercent(spd);
|
||||||
}
|
}
|
||||||
|
|
|
@ -423,7 +423,7 @@ void MarlinUI::draw_status_screen() {
|
||||||
if (spd) {
|
if (spd) {
|
||||||
#if ENABLED(ADAPTIVE_FAN_SLOWING)
|
#if ENABLED(ADAPTIVE_FAN_SLOWING)
|
||||||
if (!blink && thermalManager.fan_speed_scaler[0] < 128) {
|
if (!blink && thermalManager.fan_speed_scaler[0] < 128) {
|
||||||
spd = (spd * thermalManager.fan_speed_scaler[0]) >> 7;
|
spd = thermalManager.scaledFanSpeed(0, spd);
|
||||||
c = '*';
|
c = '*';
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -684,7 +684,7 @@ bool ST7920_Lite_Status_Screen::indicators_changed() {
|
||||||
// them only during blinks we gain a bit of stability.
|
// them only during blinks we gain a bit of stability.
|
||||||
const bool blink = ui.get_blink();
|
const bool blink = ui.get_blink();
|
||||||
const uint16_t feedrate_perc = feedrate_percentage;
|
const uint16_t feedrate_perc = feedrate_percentage;
|
||||||
const uint16_t fs = (thermalManager.fan_speed[0] * uint16_t(thermalManager.fan_speed_scaler[0])) >> 7;
|
const uint16_t fs = thermalManager.scaledFanSpeed(0);
|
||||||
const int16_t extruder_1_target = thermalManager.degTargetHotend(0);
|
const int16_t extruder_1_target = thermalManager.degTargetHotend(0);
|
||||||
#if HOTENDS > 1
|
#if HOTENDS > 1
|
||||||
const int16_t extruder_2_target = thermalManager.degTargetHotend(1);
|
const int16_t extruder_2_target = thermalManager.degTargetHotend(1);
|
||||||
|
@ -734,7 +734,7 @@ void ST7920_Lite_Status_Screen::update_indicators(const bool forceUpdate) {
|
||||||
|
|
||||||
#if ENABLED(ADAPTIVE_FAN_SLOWING)
|
#if ENABLED(ADAPTIVE_FAN_SLOWING)
|
||||||
if (!blink && thermalManager.fan_speed_scaler[0] < 128)
|
if (!blink && thermalManager.fan_speed_scaler[0] < 128)
|
||||||
spd = (spd * thermalManager.fan_speed_scaler[0]) >> 7;
|
spd = thermalManager.scaledFanSpeed(0, spd);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
draw_fan_speed(thermalManager.fanPercent(spd));
|
draw_fan_speed(thermalManager.fanPercent(spd));
|
||||||
|
|
|
@ -246,7 +246,7 @@ namespace ExtUI {
|
||||||
}
|
}
|
||||||
|
|
||||||
float getActualFan_percent(const fan_t fan) {
|
float getActualFan_percent(const fan_t fan) {
|
||||||
return thermalManager.fanPercent((thermalManager.fan_speed[fan - FAN0] * uint16_t(thermalManager.fan_speed_scaler[fan - FAN0])) >> 7);
|
return thermalManager.fanPercent(thermalManager.scaledFanSpeed(fan - FAN0));
|
||||||
}
|
}
|
||||||
|
|
||||||
float getAxisPosition_mm(const axis_t axis) {
|
float getAxisPosition_mm(const axis_t axis) {
|
||||||
|
|
|
@ -1184,7 +1184,7 @@ void Planner::check_axes_activity() {
|
||||||
if (has_blocks_queued()) {
|
if (has_blocks_queued()) {
|
||||||
#if FAN_COUNT > 0
|
#if FAN_COUNT > 0
|
||||||
FANS_LOOP(i)
|
FANS_LOOP(i)
|
||||||
tail_fan_speed[i] = (block_buffer[block_buffer_tail].fan_speed[i] * uint16_t(thermalManager.fan_speed_scaler[i])) >> 7;
|
tail_fan_speed[i] = thermalManager.scaledFanSpeed(i, block_buffer[block_buffer_tail].fan_speed[i]);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
block_t* block;
|
block_t* block;
|
||||||
|
@ -1207,7 +1207,7 @@ void Planner::check_axes_activity() {
|
||||||
else {
|
else {
|
||||||
#if FAN_COUNT > 0
|
#if FAN_COUNT > 0
|
||||||
FANS_LOOP(i)
|
FANS_LOOP(i)
|
||||||
tail_fan_speed[i] = (thermalManager.fan_speed[i] * uint16_t(thermalManager.fan_speed_scaler[i])) >> 7;
|
tail_fan_speed[i] = thermalManager.scaledFanSpeed(i);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(BARICUDA)
|
#if ENABLED(BARICUDA)
|
||||||
|
|
|
@ -171,6 +171,9 @@ hotend_info_t Temperature::temp_hotend[HOTENDS
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the print fan speed for a target extruder
|
||||||
|
*/
|
||||||
void Temperature::set_fan_speed(uint8_t target, uint16_t speed) {
|
void Temperature::set_fan_speed(uint8_t target, uint16_t speed) {
|
||||||
|
|
||||||
NOMORE(speed, 255U);
|
NOMORE(speed, 255U);
|
||||||
|
|
|
@ -472,8 +472,12 @@ class Temperature {
|
||||||
static constexpr uint8_t fan_speed_scaler[FAN_COUNT] = ARRAY_N(FAN_COUNT, 128, 128, 128, 128, 128, 128);
|
static constexpr uint8_t fan_speed_scaler[FAN_COUNT] = ARRAY_N(FAN_COUNT, 128, 128, 128, 128, 128, 128);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static inline uint8_t lcd_fanSpeedActual(const uint8_t target) {
|
static inline uint8_t scaledFanSpeed(const uint8_t target) {
|
||||||
return (fan_speed[target] * uint16_t(fan_speed_scaler[target])) >> 7;
|
return (fs * uint16_t(fan_speed_scaler[target])) >> 7;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline uint8_t scaledFanSpeed(const uint8_t target, const uint8_t fs) {
|
||||||
|
return scaledFanSpeed(target, fan_speed[target]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLED(EXTRA_FAN_SPEED)
|
#if ENABLED(EXTRA_FAN_SPEED)
|
||||||
|
|
Reference in a new issue