Browse Source

Clean up LCD print, align (#15498)

pull/1/head
ANMay-ru 5 years ago
committed by Scott Lahteine
parent
commit
b119c14017
  1. 14
      Marlin/src/lcd/menu/menu_mixer.cpp
  2. 4
      Marlin/src/lcd/menu/menu_motion.cpp
  3. 4
      Marlin/src/lcd/ultralcd.h

14
Marlin/src/lcd/menu/menu_mixer.cpp

@ -53,7 +53,7 @@
strcpy_P(tmp, GET_TEXT(MSG_START_Z));
sprintf_P(tmp + strlen(tmp), PSTR(": %4d.%d mm"), int(mixer.gradient.start_z), int(mixer.gradient.start_z * 10) % 10);
SETCURSOR(2, (LCD_HEIGHT - 1) / 2);
LCDPRINT(tmp);
lcd_put_u8str(tmp);
}
if (ui.lcd_clicked) {
@ -79,7 +79,7 @@
strcpy_P(tmp, GET_TEXT(MSG_END_Z));
sprintf_P(tmp + strlen(tmp), PSTR(": %4d.%d mm"), int(mixer.gradient.end_z), int(mixer.gradient.end_z * 10) % 10);
SETCURSOR(2, (LCD_HEIGHT - 1) / 2);
LCDPRINT(tmp);
lcd_put_u8str(tmp);
}
if (ui.lcd_clicked) {
@ -106,13 +106,13 @@
SUBMENU(MSG_START_Z, lcd_mixer_gradient_z_start_edit);
MENU_ITEM_ADDON_START(9);
sprintf_P(tmp, PSTR("%4d.%d mm"), int(mixer.gradient.start_z), int(mixer.gradient.start_z * 10) % 10);
LCDPRINT(tmp);
lcd_put_u8str(tmp);
MENU_ITEM_ADDON_END();
SUBMENU(MSG_END_Z, lcd_mixer_gradient_z_end_edit);
MENU_ITEM_ADDON_START(9);
sprintf_P(tmp, PSTR("%4d.%d mm"), int(mixer.gradient.end_z), int(mixer.gradient.end_z * 10) % 10);
LCDPRINT(tmp);
lcd_put_u8str(tmp);
MENU_ITEM_ADDON_END();
END_MENU();
@ -129,7 +129,7 @@ static uint8_t v_index;
lcd_put_u8str_P(GET_TEXT(MSG_MIX));
SETCURSOR(LCD_WIDTH - 9, y);
sprintf_P(tmp, PSTR("%3d%% %3d%%"), int(mixer.mix[0]), int(mixer.mix[1]));
LCDPRINT(tmp);
lcd_put_u8str(tmp);
}
#endif
@ -283,7 +283,7 @@ void menu_mixer() {
MENU_ITEM_ADDON_START(10);
mixer.update_mix_from_vtool();
sprintf_P(tmp, PSTR("%3d;%3d%%"), int(mixer.mix[0]), int(mixer.mix[1]));
LCDPRINT(tmp);
lcd_put_u8str(tmp);
MENU_ITEM_ADDON_END();
ACTION_ITEM(MSG_TOGGLE_MIX, _lcd_mixer_toggle_mix);
}
@ -299,7 +299,7 @@ void menu_mixer() {
SUBMENU(MSG_GRADIENT, lcd_mixer_edit_gradient_menu);
MENU_ITEM_ADDON_START(10);
sprintf_P(tmp, PSTR("T%i->T%i"), mixer.gradient.start_vtool, mixer.gradient.end_vtool);
LCDPRINT(tmp);
lcd_put_u8str(tmp);
MENU_ITEM_ADDON_END();
ACTION_ITEM(MSG_REVERSE_GRADIENT, _lcd_mixer_reverse_gradient);
}

4
Marlin/src/lcd/menu/menu_motion.cpp

@ -262,13 +262,13 @@ void _menu_move_distance(const AxisEnum axis, const screenFunc_t func, const int
SUBMENU(MSG_MOVE_01MM, [](){ _goto_manual_move( 0.1f); });
if (axis == Z_AXIS && (SHORT_MANUAL_Z_MOVE) > 0.0f && (SHORT_MANUAL_Z_MOVE) < 0.1f) {
SUBMENU_P(PSTR(""), []{ _goto_manual_move(float(SHORT_MANUAL_Z_MOVE)); });
MENU_ITEM_ADDON_START(1);
MENU_ITEM_ADDON_START(0);
char tmp[20], numstr[10];
// Determine digits needed right of decimal
const uint8_t digs = !UNEAR_ZERO((SHORT_MANUAL_Z_MOVE) * 1000 - int((SHORT_MANUAL_Z_MOVE) * 1000)) ? 4 :
!UNEAR_ZERO((SHORT_MANUAL_Z_MOVE) * 100 - int((SHORT_MANUAL_Z_MOVE) * 100)) ? 3 : 2;
sprintf_P(tmp, GET_TEXT(MSG_MOVE_Z_DIST), dtostrf(SHORT_MANUAL_Z_MOVE, 1, digs, numstr));
LCDPRINT(tmp);
lcd_put_u8str(tmp);
MENU_ITEM_ADDON_END();
}
}

4
Marlin/src/lcd/ultralcd.h

@ -67,13 +67,9 @@
#if HAS_GRAPHICAL_LCD
#define SETCURSOR(col, row) lcd_moveto(col * (MENU_FONT_WIDTH), (row + 1) * (MENU_FONT_HEIGHT))
#define SETCURSOR_RJ(len, row) lcd_moveto(LCD_PIXEL_WIDTH - (len) * (MENU_FONT_WIDTH), (row + 1) * (MENU_FONT_HEIGHT))
#define LCDPRINT(p) u8g.print(p)
#define LCDWRITE(c) u8g.print(c)
#else
#define SETCURSOR(col, row) lcd_moveto(col, row)
#define SETCURSOR_RJ(len, row) lcd_moveto(LCD_WIDTH - (len), row)
#define LCDPRINT(p) lcd_put_u8str(p)
#define LCDWRITE(c) lcd_put_wchar(c)
#endif
#include "lcdprint.h"

Loading…
Cancel
Save