Add fan percent accessors

This commit is contained in:
Scott Lahteine
2021-04-13 04:00:39 -05:00
parent 4e314ef6d4
commit fd99ea09ec
9 changed files with 32 additions and 33 deletions

View File

@ -944,7 +944,7 @@ void MarlinUI::draw_status_screen() {
#if ENABLED(ADAPTIVE_FAN_SLOWING)
else { c = '*'; spd = thermalManager.scaledFanSpeed(0, spd); }
#endif
per = thermalManager.fanPercent(spd);
per = thermalManager.pwmToPercent(spd);
}
else
#endif

View File

@ -750,7 +750,7 @@ void MarlinUI::draw_status_screen() {
#if HOTENDS > 2
_draw_heater_status(H_E2, "HE3", blink); // Hotend 3 Temperature
#endif
#endif // HOTENDS <= 1
#endif
#if HAS_HEATED_BED
#if HAS_LEVELING
@ -758,16 +758,15 @@ void MarlinUI::draw_status_screen() {
#else
_draw_heater_status(H_BED, "BED", blink);
#endif
#endif // HAS_HEATED_BED
#endif
#if HAS_FAN
uint16_t spd = thermalManager.fan_speed[0];
#if ENABLED(ADAPTIVE_FAN_SLOWING)
if (!blink) spd = thermalManager.scaledFanSpeed(0, spd);
#endif
uint16_t per = thermalManager.pwmToPercent(spd);
uint16_t per = thermalManager.fanPercent(spd);
#if HOTENDS < 2
#define FANX 11
#else

View File

@ -696,7 +696,7 @@ void MarlinUI::draw_status_screen() {
c = '*';
}
#endif
lcd_put_u8str(STATUS_FAN_TEXT_X, STATUS_FAN_TEXT_Y, i16tostr3rj(thermalManager.fanPercent(spd)));
lcd_put_u8str(STATUS_FAN_TEXT_X, STATUS_FAN_TEXT_Y, i16tostr3rj(thermalManager.pwmToPercent(spd)));
lcd_put_wchar(c);
}
}

View File

@ -733,14 +733,12 @@ void ST7920_Lite_Status_Screen::update_indicators(const bool forceUpdate) {
TERN_(HAS_MULTI_HOTEND, draw_extruder_2_temp(extruder_2_temp, extruder_2_target, forceUpdate));
TERN_(HAS_HEATED_BED, draw_bed_temp(bed_temp, bed_target, forceUpdate));
uint16_t spd = thermalManager.fan_speed[0];
uint8_t spd = thermalManager.fan_speed[0];
#if ENABLED(ADAPTIVE_FAN_SLOWING)
if (!blink && thermalManager.fan_speed_scaler[0] < 128)
spd = thermalManager.scaledFanSpeed(0, spd);
#endif
draw_fan_speed(thermalManager.fanPercent(spd));
draw_fan_speed(thermalManager.pwmToPercent(spd));
// Draw elapsed/remaining time
const bool show_remaining = ENABLED(SHOW_REMAINING_TIME) && (DISABLED(ROTATE_PROGRESS_DISPLAY) || blink);

View File

@ -236,7 +236,7 @@ void disp_bed_temp() {
}
void disp_fan_speed() {
sprintf_P(public_buf_l, PSTR("%d%%"), thermalManager.fanPercent(thermalManager.fan_speed[0]));
sprintf_P(public_buf_l, PSTR("%d%%"), thermalManager.fanSpeedPercent(0));
lv_label_set_text(labelFan, public_buf_l);
}

View File

@ -241,7 +241,7 @@ void lv_draw_ready_print() {
lv_obj_align(labelBedTarget, buttonBedstate, LV_ALIGN_CENTER, 0, TARGET_LABEL_MOD_Y);
#endif
sprintf_P(buf, PSTR("%d%%"), thermalManager.fanPercent(thermalManager.fan_speed[0]));
sprintf_P(buf, PSTR("%d%%"), (int)thermalManager.fanSpeedPercent(0));
lv_label_set_text(labelFan, buf);
lv_obj_align(labelFan, buttonFanstate, LV_ALIGN_CENTER, 0, LABEL_MOD_Y);
}

View File

@ -297,7 +297,7 @@ namespace ExtUI {
float getTargetFan_percent(const fan_t fan) {
#if HAS_FAN
return thermalManager.fanPercent(thermalManager.fan_speed[fan - FAN0]);
return thermalManager.fanSpeedPercent(fan - FAN0);
#else
UNUSED(fan);
return 0;
@ -306,7 +306,7 @@ namespace ExtUI {
float getActualFan_percent(const fan_t fan) {
#if HAS_FAN
return thermalManager.fanPercent(thermalManager.scaledFanSpeed(fan - FAN0));
return thermalManager.scaledFanSpeedPercent(fan - FAN0);
#else
UNUSED(fan);
return 0;