Skip to content

Commit

Permalink
move a dwin flag
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Mar 15, 2023
1 parent f07161e commit b49a5f7
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions Marlin/src/lcd/e3v2/marlinui/marlinui_dwin.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ typedef struct {
bool solid;
} dwin_font_t;

extern bool old_is_printing;
extern dwin_font_t dwin_font;

// Only Western languages support big / small fonts
Expand Down
4 changes: 3 additions & 1 deletion Marlin/src/lcd/e3v2/marlinui/ui_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
#include "../../../feature/bedlevel/bedlevel.h"
#endif

bool old_is_printing;

// DWIN printing specifies the font on each string operation
// but we'll make the font modal for Marlin
dwin_font_t dwin_font = { font8x16, 8, 16, Color_White, Color_Bg_Black, true };
Expand Down Expand Up @@ -195,7 +197,7 @@ void MarlinUI::draw_status_message(const bool blink) {
}
const bool hash_changed = hash != old_hash;
old_hash = hash;
return hash_changed || !ui.did_first_redraw;
return hash_changed || !did_first_redraw;
};

#if ENABLED(STATUS_MESSAGE_SCROLLING)
Expand Down
10 changes: 5 additions & 5 deletions Marlin/src/lcd/e3v2/marlinui/ui_status_480x272.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@
// Homed but unknown... '123' <-> ' '.
// Homed and known, display constantly.
//
FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const bool blink, const uint16_t x, const uint16_t y) {
const bool x_redraw = !ui.did_first_redraw || ui.old_is_printing != print_job_timer.isRunning();
void _draw_axis_value(const AxisEnum axis, const char *value, const bool blink, const uint16_t x, const uint16_t y) {
const bool x_redraw = !ui.did_first_redraw || old_is_printing != print_job_timer.isRunning();
if (x_redraw) {
dwin_string.set('X' + axis);
DWIN_Draw_String(true, font16x32, Color_IconBlue, Color_Bg_Black,
Expand Down Expand Up @@ -108,7 +108,7 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const

FORCE_INLINE void _draw_e_value(const_float_t value, const uint16_t x, const uint16_t y) {
const uint8_t scale = value >= 100000.0f ? 10 : 1; // show cm after 99,999mm
const bool e_redraw = !ui.did_first_redraw || ui.old_is_printing != print_job_timer.isRunning();
const bool e_redraw = !ui.did_first_redraw || old_is_printing != print_job_timer.isRunning();

#if ENABLED(DWIN_MARLINUI_PORTRAIT)

Expand Down Expand Up @@ -378,7 +378,7 @@ void MarlinUI::draw_status_screen() {
}
DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, 378, 170, S(dwin_string.string()));
}
else if (!ui.did_first_redraw || ui.old_is_printing != print_job_timer.isRunning()) {
else if (!ui.did_first_redraw || old_is_printing != print_job_timer.isRunning()) {
dwin_string.set(F(" "));
DWIN_Draw_String(true, font14x28, Color_IconBlue, Color_Bg_Black, 336, 170, S(dwin_string.string()));
}
Expand Down Expand Up @@ -434,7 +434,7 @@ void MarlinUI::draw_status_screen() {
draw_status_message(blink);

ui.did_first_redraw = true;
ui.old_is_printing = print_job_timer.isRunning();
old_is_printing = print_job_timer.isRunning();
}

#endif // IS_DWIN_MARLINUI
1 change: 0 additions & 1 deletion Marlin/src/lcd/marlinui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,6 @@ void MarlinUI::init() {

#if IS_DWIN_MARLINUI
bool MarlinUI::did_first_redraw;
bool MarlinUI::old_is_printing;
#endif

#if ENABLED(SDSUPPORT)
Expand Down
1 change: 0 additions & 1 deletion Marlin/src/lcd/marlinui.h
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,6 @@ class MarlinUI {

#if IS_DWIN_MARLINUI
static bool did_first_redraw;
static bool old_is_printing;
#endif

#if EITHER(BABYSTEP_GFX_OVERLAY, MESH_EDIT_GFX_OVERLAY)
Expand Down

0 comments on commit b49a5f7

Please sign in to comment.