✏️ Fix E3V2 MarlinUI draw flags (#23979)
This commit is contained in:
@@ -193,7 +193,7 @@ FORCE_INLINE void _draw_heater_status(const heater_id_t heater, const uint16_t x
|
|||||||
#define HOTEND_STATS 3
|
#define HOTEND_STATS 3
|
||||||
#elif HOTENDS > 1
|
#elif HOTENDS > 1
|
||||||
#define HOTEND_STATS 2
|
#define HOTEND_STATS 2
|
||||||
#elif HAS_HOTEND
|
#else
|
||||||
#define HOTEND_STATS 1
|
#define HOTEND_STATS 1
|
||||||
#endif
|
#endif
|
||||||
static celsius_t old_temp[HOTEND_STATS] = ARRAY_N_1(HOTEND_STATS, 500),
|
static celsius_t old_temp[HOTEND_STATS] = ARRAY_N_1(HOTEND_STATS, 500),
|
||||||
@@ -211,24 +211,23 @@ FORCE_INLINE void _draw_heater_status(const heater_id_t heater, const uint16_t x
|
|||||||
|
|
||||||
#if HAS_HOTEND && HAS_HEATED_BED
|
#if HAS_HOTEND && HAS_HEATED_BED
|
||||||
const bool isBed = heater < 0;
|
const bool isBed = heater < 0;
|
||||||
const float tc = isBed ? thermalManager.degBed() : thermalManager.degHotend(heater),
|
bool c_draw, t_draw, i_draw;
|
||||||
tt = isBed ? thermalManager.degTargetBed() : thermalManager.degTargetHotend(heater);
|
|
||||||
const bool ta = isBed ? thermalManager.isHeatingBed() : thermalManager.isHeatingHotend(heater);
|
|
||||||
|
|
||||||
bool c_draw = tc != (isBed ? old_bed_temp : old_temp[heater]),
|
|
||||||
t_draw = tt != (isBed ? old_bed_target : old_target[heater]),
|
|
||||||
i_draw = ta != (isBed ? old_bed_on : old_on[heater]);
|
|
||||||
|
|
||||||
if (isBed) {
|
if (isBed) {
|
||||||
#if HAS_LEVELING
|
const float tc = thermalManager.degBed(), tt = thermalManager.degTargetBed();
|
||||||
if (!i_draw && planner.leveling_active != old_leveling_on) i_draw = true;
|
const bool ta = thermalManager.isHeatingBed();
|
||||||
old_leveling_on = planner.leveling_active;
|
c_draw = tc != old_bed_temp;
|
||||||
#endif
|
t_draw = tt != old_bed_target;
|
||||||
|
i_draw = ta != old_bed_on;
|
||||||
old_bed_temp = tc;
|
old_bed_temp = tc;
|
||||||
old_bed_target = tt;
|
old_bed_target = tt;
|
||||||
old_bed_on = ta;
|
old_bed_on = ta;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
const float tc = thermalManager.degHotend(heater), tt = thermalManager.degTargetHotend(heater);
|
||||||
|
const bool ta = thermalManager.isHeatingHotend(heater);
|
||||||
|
c_draw = tc != old_temp[heater];
|
||||||
|
t_draw = tt != old_target[heater];
|
||||||
|
i_draw = ta != old_on[heater];
|
||||||
old_temp[heater] = tc;
|
old_temp[heater] = tc;
|
||||||
old_target[heater] = tt;
|
old_target[heater] = tt;
|
||||||
old_on[heater] = ta;
|
old_on[heater] = ta;
|
||||||
@@ -237,31 +236,41 @@ FORCE_INLINE void _draw_heater_status(const heater_id_t heater, const uint16_t x
|
|||||||
constexpr bool isBed = false;
|
constexpr bool isBed = false;
|
||||||
const float tc = thermalManager.degHotend(heater), tt = thermalManager.degTargetHotend(heater);
|
const float tc = thermalManager.degHotend(heater), tt = thermalManager.degTargetHotend(heater);
|
||||||
const uint8_t ta = thermalManager.isHeatingHotend(heater);
|
const uint8_t ta = thermalManager.isHeatingHotend(heater);
|
||||||
const bool c_draw = tc != old_bed_temp, t_draw = tt != old_bed_target, i_draw = ta != old_bed_on;
|
bool c_draw = tc != old_temp[heater], t_draw = tt != old_target[heater], i_draw = ta != old_on[heater];
|
||||||
old_temp[heater] = tc; old_target[heater] = tt; old_on[heater] = ta;
|
old_temp[heater] = tc; old_target[heater] = tt; old_on[heater] = ta;
|
||||||
#elif HAS_HEATED_BED
|
#elif HAS_HEATED_BED
|
||||||
constexpr bool isBed = true;
|
constexpr bool isBed = true;
|
||||||
const float tc = thermalManager.degBed(), tt = thermalManager.degTargetBed();
|
const float tc = thermalManager.degBed(), tt = thermalManager.degTargetBed();
|
||||||
const uint8_t ta = thermalManager.isHeatingBed();
|
const uint8_t ta = thermalManager.isHeatingBed();
|
||||||
bool c_draw = tc != old_temp[heater], t_draw = tt != old_target[heater], i_draw = ta != old_on[heater];
|
bool c_draw = tc != old_bed_temp, t_draw = tt != old_bed_target, i_draw = ta != old_bed_on;
|
||||||
#if HAS_LEVELING
|
|
||||||
if (!idraw && planner.leveling_active != old_leveling_on) i_draw = true;
|
|
||||||
old_leveling_on = tl;
|
|
||||||
#endif
|
|
||||||
old_bed_temp = tc; old_bed_target = tt; old_bed_on = ta;
|
old_bed_temp = tc; old_bed_target = tt; old_bed_on = ta;
|
||||||
|
#else
|
||||||
|
bool c_draw = false, t_draw = false, i_draw = false;
|
||||||
|
constexpr float tc = 0, tt = 0;
|
||||||
|
constexpr uint8_t ta = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if HAS_HEATED_BED && HAS_LEVELING
|
||||||
|
if (isBed) {
|
||||||
|
i_draw |= (planner.leveling_active != old_leveling_on);
|
||||||
|
old_leveling_on = planner.leveling_active;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Draw target temperature, if needed
|
||||||
if (!ui.did_first_redraw || t_draw) {
|
if (!ui.did_first_redraw || t_draw) {
|
||||||
dwin_string.set(i16tostr3rj(tt + 0.5));
|
dwin_string.set(i16tostr3rj(tt + 0.5));
|
||||||
dwin_string.add(LCD_STR_DEGREE);
|
dwin_string.add(LCD_STR_DEGREE);
|
||||||
DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, x, y, S(dwin_string.string()));
|
DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, x, y, S(dwin_string.string()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Draw heater icon with on / off / leveled states
|
||||||
if (!ui.did_first_redraw || i_draw) {
|
if (!ui.did_first_redraw || i_draw) {
|
||||||
const uint8_t ico = isBed ? (TERN0(HAS_LEVELING, planner.leveling_active) ? ICON_BedLevelOff : ICON_BedOff) : ICON_HotendOff;
|
const uint8_t ico = isBed ? (TERN0(HAS_LEVELING, planner.leveling_active) ? ICON_BedLevelOff : ICON_BedOff) : ICON_HotendOff;
|
||||||
DWIN_ICON_Show(ICON, ico + ta, x, y + STATUS_CHR_HEIGHT + 2);
|
DWIN_ICON_Show(ICON, ico + ta, x, y + STATUS_CHR_HEIGHT + 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Draw current temperature, if needed
|
||||||
if (!ui.did_first_redraw || c_draw) {
|
if (!ui.did_first_redraw || c_draw) {
|
||||||
dwin_string.set(i16tostr3rj(tc + 0.5));
|
dwin_string.set(i16tostr3rj(tc + 0.5));
|
||||||
dwin_string.add(LCD_STR_DEGREE);
|
dwin_string.add(LCD_STR_DEGREE);
|
||||||
@@ -412,6 +421,7 @@ void MarlinUI::draw_status_screen() {
|
|||||||
//
|
//
|
||||||
// Progress Bar
|
// Progress Bar
|
||||||
//
|
//
|
||||||
|
#if HAS_PRINT_PROGRESS
|
||||||
constexpr int16_t pb_margin = 5,
|
constexpr int16_t pb_margin = 5,
|
||||||
pb_left = pb_margin + TERN(DWIN_MARLINUI_PORTRAIT, 0, 90),
|
pb_left = pb_margin + TERN(DWIN_MARLINUI_PORTRAIT, 0, 90),
|
||||||
pb_height = TERN(DWIN_MARLINUI_PORTRAIT, 60, 20),
|
pb_height = TERN(DWIN_MARLINUI_PORTRAIT, 60, 20),
|
||||||
@@ -449,6 +459,7 @@ void MarlinUI::draw_status_screen() {
|
|||||||
|
|
||||||
old_solid = pb_solid;
|
old_solid = pb_solid;
|
||||||
}
|
}
|
||||||
|
#endif // HAS_PRINT_PROGRESS
|
||||||
|
|
||||||
//
|
//
|
||||||
// Status Message
|
// Status Message
|
||||||
|
Reference in New Issue
Block a user