Browse Source

Apply TERN to status screen

vanilla_fb_2.0.x
Scott Lahteine 4 years ago
parent
commit
4cdd51cd3a
  1. 39
      Marlin/src/lcd/dogm/status_screen_DOGM.cpp

39
Marlin/src/lcd/dogm/status_screen_DOGM.cpp

@ -305,12 +305,7 @@ FORCE_INLINE void _draw_centered_temp(const int16_t temp, const uint8_t tx, cons
// Homed and known, display constantly. // Homed and known, display constantly.
// //
FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const bool blink) { FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const bool blink) {
const AxisEnum a = ( const AxisEnum a = TERN(LCD_SHOW_E_TOTAL, axis == E_AXIS ? X_AXIS : axis, axis);
#if ENABLED(LCD_SHOW_E_TOTAL)
axis == E_AXIS ? X_AXIS :
#endif
axis
);
const uint8_t offs = (XYZ_SPACING) * a; const uint8_t offs = (XYZ_SPACING) * a;
lcd_put_wchar(X_LABEL_POS + offs, XYZ_BASELINE, axis_codes[axis]); lcd_put_wchar(X_LABEL_POS + offs, XYZ_BASELINE, axis_codes[axis]);
lcd_moveto(X_VALUE_POS + offs, XYZ_BASELINE); lcd_moveto(X_VALUE_POS + offs, XYZ_BASELINE);
@ -332,11 +327,7 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const
void MarlinUI::draw_status_screen() { void MarlinUI::draw_status_screen() {
static char xstring[5 static char xstring[TERN(LCD_SHOW_E_TOTAL, 12, 5)], ystring[5], zstring[8];
#if ENABLED(LCD_SHOW_E_TOTAL)
+ 7
#endif
], ystring[5], zstring[8];
#if ENABLED(FILAMENT_LCD_DISPLAY) #if ENABLED(FILAMENT_LCD_DISPLAY)
static char wstring[5], mstring[4]; static char wstring[5], mstring[4];
#endif #endif
@ -365,11 +356,7 @@ void MarlinUI::draw_status_screen() {
#endif #endif
#endif #endif
const bool showxy = (true const bool showxy = TERN1(LCD_SHOW_E_TOTAL, !printingIsActive());
#if ENABLED(LCD_SHOW_E_TOTAL)
&& !printingIsActive()
#endif
);
// At the first page, generate new display values // At the first page, generate new display values
if (first_page) { if (first_page) {
@ -411,13 +398,7 @@ void MarlinUI::draw_status_screen() {
// Progress / elapsed / estimation updates and string formatting to avoid float math on each LCD draw // Progress / elapsed / estimation updates and string formatting to avoid float math on each LCD draw
#if HAS_PRINT_PROGRESS #if HAS_PRINT_PROGRESS
const progress_t progress = const progress_t progress = TERN(HAS_PRINT_PROGRESS_PERMYRIAD, get_progress_permyriad, get_progress_percent)();
#if HAS_PRINT_PROGRESS_PERMYRIAD
get_progress_permyriad()
#else
get_progress_percent()
#endif
;
duration_t elapsed = print_job_timer.duration(); duration_t elapsed = print_job_timer.duration();
const uint8_t p = progress & 0xFF, ev = elapsed.value & 0xFF; const uint8_t p = progress & 0xFF, ev = elapsed.value & 0xFF;
if (p != lastProgress) { if (p != lastProgress) {
@ -433,15 +414,9 @@ void MarlinUI::draw_status_screen() {
estimation_x_pos = _SD_INFO_X(0); estimation_x_pos = _SD_INFO_X(0);
#endif #endif
} }
else { else
strcpy(progress_string, ( strcpy(progress_string, TERN(PRINT_PROGRESS_SHOW_DECIMALS, permyriadtostr4(progress), ui8tostr3rj(progress / (PROGRESS_SCALE))));
#if ENABLED(PRINT_PROGRESS_SHOW_DECIMALS)
permyriadtostr4(progress)
#else
ui8tostr3rj(progress / (PROGRESS_SCALE))
#endif
));
}
#if BOTH(SHOW_REMAINING_TIME, ROTATE_PROGRESS_DISPLAY) // Tri-state progress display mode #if BOTH(SHOW_REMAINING_TIME, ROTATE_PROGRESS_DISPLAY) // Tri-state progress display mode
progress_x_pos = _SD_INFO_X(strlen(progress_string) + 1); progress_x_pos = _SD_INFO_X(strlen(progress_string) + 1);
#endif #endif

Loading…
Cancel
Save