Skip to content

Commit 59a2cb0

Browse files
committed
🩹 Fix Ender-3 V2 with no fan
1 parent 85e28f3 commit 59a2cb0

File tree

2 files changed

+22
-21
lines changed

2 files changed

+22
-21
lines changed

Marlin/src/lcd/e3v2/jyersui/dwin.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3862,7 +3862,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/
38623862
Draw_Menu_Item(row, ICON_Back, F("Cancel"));
38633863
else {
38643864
thermalManager.setTargetHotend(0, 0);
3865-
thermalManager.set_fan_speed(0, 0);
3865+
TERN_(HAS_FAN, thermalManager.set_fan_speed(0, 0));
38663866
Redraw_Menu(false, true, true);
38673867
}
38683868
break;
@@ -4474,7 +4474,7 @@ void CrealityDWINClass::Popup_Control() {
44744474
case ETemp:
44754475
if (selection == 0) {
44764476
thermalManager.setTargetHotend(EXTRUDE_MINTEMP, 0);
4477-
thermalManager.set_fan_speed(0, MAX_FAN_SPEED);
4477+
TERN_(HAS_FAN, thermalManager.set_fan_speed(0, MAX_FAN_SPEED));
44784478
Draw_Menu(PreheatHotend);
44794479
}
44804480
else

Marlin/src/lcd/e3v2/marlinui/ui_status_480x272.cpp

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -143,25 +143,27 @@ void _draw_axis_value(const AxisEnum axis, const char *value, const bool blink,
143143

144144
#endif // LCD_SHOW_E_TOTAL
145145

146-
//
147-
// Fan Icon and Percentage
148-
//
149-
FORCE_INLINE void _draw_fan_status(const uint16_t x, const uint16_t y) {
150-
const uint16_t fanx = (4 * STATUS_CHR_WIDTH - STATUS_FAN_WIDTH) / 2;
151-
const bool fan_on = !!thermalManager.scaledFanSpeed(0);
152-
if (fan_on) {
153-
DWIN_ICON_Animation(0, fan_on, ICON, ICON_Fan0, ICON_Fan3, x + fanx, y, 25);
154-
dwin_string.set(i8tostr3rj(thermalManager.scaledFanSpeedPercent(0)));
155-
dwin_string.add('%');
156-
DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, x, y + STATUS_FAN_HEIGHT, S(dwin_string.string()));
157-
}
158-
else {
159-
DWIN_ICON_AnimationControl(0x0000); // disable all icon animations (this is the only one)
160-
DWIN_ICON_Show(ICON, ICON_Fan0, x + fanx, y);
161-
dwin_string.set(F(" "));
162-
DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, x, y + STATUS_FAN_HEIGHT, S(dwin_string.string()));
146+
#if HAS_FAN
147+
//
148+
// Fan Icon and Percentage
149+
//
150+
FORCE_INLINE void _draw_fan_status(const uint16_t x, const uint16_t y) {
151+
const uint16_t fanx = (4 * STATUS_CHR_WIDTH - STATUS_FAN_WIDTH) / 2;
152+
const bool fan_on = !!thermalManager.scaledFanSpeed(0);
153+
if (fan_on) {
154+
DWIN_ICON_Animation(0, fan_on, ICON, ICON_Fan0, ICON_Fan3, x + fanx, y, 25);
155+
dwin_string.set(i8tostr3rj(thermalManager.scaledFanSpeedPercent(0)));
156+
dwin_string.add('%');
157+
DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, x, y + STATUS_FAN_HEIGHT, S(dwin_string.string()));
158+
}
159+
else {
160+
DWIN_ICON_AnimationControl(0x0000); // disable all icon animations (this is the only one)
161+
DWIN_ICON_Show(ICON, ICON_Fan0, x + fanx, y);
162+
dwin_string.set(F(" "));
163+
DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, x, y + STATUS_FAN_HEIGHT, S(dwin_string.string()));
164+
}
163165
}
164-
}
166+
#endif
165167

166168
/**
167169
* Draw a single heater icon with current and target temperature, at the given XY
@@ -300,7 +302,6 @@ void MarlinUI::draw_status_screen() {
300302
#if HAS_HEATED_BED
301303
_draw_heater_status(H_BED, hx, STATUS_HEATERS_Y);
302304
#endif
303-
304305
#if HAS_FAN
305306
_draw_fan_status(LCD_PIXEL_WIDTH - STATUS_CHR_WIDTH * 5, STATUS_FAN_Y);
306307
#endif

0 commit comments

Comments
 (0)