From 6a8ebdcd5093a8fb393356dc0c1ee2a894576fdb Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 29 Mar 2023 21:50:04 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20Ender-3=20V2=20with=20no?= =?UTF-8?q?=20fan?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/e3v2/jyersui/dwin.cpp | 4 +- .../lcd/e3v2/marlinui/ui_status_480x272.cpp | 39 ++++++++++--------- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp index 3f13fe8b3bdc..d90e4df5aff7 100644 --- a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp @@ -3862,7 +3862,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/ Draw_Menu_Item(row, ICON_Back, F("Cancel")); else { thermalManager.setTargetHotend(0, 0); - thermalManager.set_fan_speed(0, 0); + TERN_(HAS_FAN, thermalManager.set_fan_speed(0, 0)); Redraw_Menu(false, true, true); } break; @@ -4474,7 +4474,7 @@ void CrealityDWINClass::Popup_Control() { case ETemp: if (selection == 0) { thermalManager.setTargetHotend(EXTRUDE_MINTEMP, 0); - thermalManager.set_fan_speed(0, MAX_FAN_SPEED); + TERN_(HAS_FAN, thermalManager.set_fan_speed(0, MAX_FAN_SPEED)); Draw_Menu(PreheatHotend); } else diff --git a/Marlin/src/lcd/e3v2/marlinui/ui_status_480x272.cpp b/Marlin/src/lcd/e3v2/marlinui/ui_status_480x272.cpp index d0a04a3c4b15..680173bd12f7 100644 --- a/Marlin/src/lcd/e3v2/marlinui/ui_status_480x272.cpp +++ b/Marlin/src/lcd/e3v2/marlinui/ui_status_480x272.cpp @@ -143,25 +143,27 @@ void _draw_axis_value(const AxisEnum axis, const char *value, const bool blink, #endif // LCD_SHOW_E_TOTAL -// -// Fan Icon and Percentage -// -FORCE_INLINE void _draw_fan_status(const uint16_t x, const uint16_t y) { - const uint16_t fanx = (4 * STATUS_CHR_WIDTH - STATUS_FAN_WIDTH) / 2; - const bool fan_on = !!thermalManager.scaledFanSpeed(0); - if (fan_on) { - DWIN_ICON_Animation(0, fan_on, ICON, ICON_Fan0, ICON_Fan3, x + fanx, y, 25); - dwin_string.set(i8tostr3rj(thermalManager.scaledFanSpeedPercent(0))); - dwin_string.add('%'); - DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, x, y + STATUS_FAN_HEIGHT, S(dwin_string.string())); - } - else { - DWIN_ICON_AnimationControl(0x0000); // disable all icon animations (this is the only one) - DWIN_ICON_Show(ICON, ICON_Fan0, x + fanx, y); - dwin_string.set(F(" ")); - DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, x, y + STATUS_FAN_HEIGHT, S(dwin_string.string())); +#if HAS_FAN + // + // Fan Icon and Percentage + // + FORCE_INLINE void _draw_fan_status(const uint16_t x, const uint16_t y) { + const uint16_t fanx = (4 * STATUS_CHR_WIDTH - STATUS_FAN_WIDTH) / 2; + const bool fan_on = !!thermalManager.scaledFanSpeed(0); + if (fan_on) { + DWIN_ICON_Animation(0, fan_on, ICON, ICON_Fan0, ICON_Fan3, x + fanx, y, 25); + dwin_string.set(i8tostr3rj(thermalManager.scaledFanSpeedPercent(0))); + dwin_string.add('%'); + DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, x, y + STATUS_FAN_HEIGHT, S(dwin_string.string())); + } + else { + DWIN_ICON_AnimationControl(0x0000); // disable all icon animations (this is the only one) + DWIN_ICON_Show(ICON, ICON_Fan0, x + fanx, y); + dwin_string.set(F(" ")); + DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, x, y + STATUS_FAN_HEIGHT, S(dwin_string.string())); + } } -} +#endif /** * Draw a single heater icon with current and target temperature, at the given XY @@ -300,7 +302,6 @@ void MarlinUI::draw_status_screen() { #if HAS_HEATED_BED _draw_heater_status(H_BED, hx, STATUS_HEATERS_Y); #endif - #if HAS_FAN _draw_fan_status(LCD_PIXEL_WIDTH - STATUS_CHR_WIDTH * 5, STATUS_FAN_Y); #endif