Clean up LCD print, align (#15498)
This commit is contained in:
parent
46763efb75
commit
b119c14017
3 changed files with 9 additions and 13 deletions
|
@ -53,7 +53,7 @@
|
||||||
strcpy_P(tmp, GET_TEXT(MSG_START_Z));
|
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);
|
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);
|
SETCURSOR(2, (LCD_HEIGHT - 1) / 2);
|
||||||
LCDPRINT(tmp);
|
lcd_put_u8str(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ui.lcd_clicked) {
|
if (ui.lcd_clicked) {
|
||||||
|
@ -79,7 +79,7 @@
|
||||||
strcpy_P(tmp, GET_TEXT(MSG_END_Z));
|
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);
|
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);
|
SETCURSOR(2, (LCD_HEIGHT - 1) / 2);
|
||||||
LCDPRINT(tmp);
|
lcd_put_u8str(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ui.lcd_clicked) {
|
if (ui.lcd_clicked) {
|
||||||
|
@ -106,13 +106,13 @@
|
||||||
SUBMENU(MSG_START_Z, lcd_mixer_gradient_z_start_edit);
|
SUBMENU(MSG_START_Z, lcd_mixer_gradient_z_start_edit);
|
||||||
MENU_ITEM_ADDON_START(9);
|
MENU_ITEM_ADDON_START(9);
|
||||||
sprintf_P(tmp, PSTR("%4d.%d mm"), int(mixer.gradient.start_z), int(mixer.gradient.start_z * 10) % 10);
|
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();
|
MENU_ITEM_ADDON_END();
|
||||||
|
|
||||||
SUBMENU(MSG_END_Z, lcd_mixer_gradient_z_end_edit);
|
SUBMENU(MSG_END_Z, lcd_mixer_gradient_z_end_edit);
|
||||||
MENU_ITEM_ADDON_START(9);
|
MENU_ITEM_ADDON_START(9);
|
||||||
sprintf_P(tmp, PSTR("%4d.%d mm"), int(mixer.gradient.end_z), int(mixer.gradient.end_z * 10) % 10);
|
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();
|
MENU_ITEM_ADDON_END();
|
||||||
|
|
||||||
END_MENU();
|
END_MENU();
|
||||||
|
@ -129,7 +129,7 @@ static uint8_t v_index;
|
||||||
lcd_put_u8str_P(GET_TEXT(MSG_MIX));
|
lcd_put_u8str_P(GET_TEXT(MSG_MIX));
|
||||||
SETCURSOR(LCD_WIDTH - 9, y);
|
SETCURSOR(LCD_WIDTH - 9, y);
|
||||||
sprintf_P(tmp, PSTR("%3d%% %3d%%"), int(mixer.mix[0]), int(mixer.mix[1]));
|
sprintf_P(tmp, PSTR("%3d%% %3d%%"), int(mixer.mix[0]), int(mixer.mix[1]));
|
||||||
LCDPRINT(tmp);
|
lcd_put_u8str(tmp);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -283,7 +283,7 @@ void menu_mixer() {
|
||||||
MENU_ITEM_ADDON_START(10);
|
MENU_ITEM_ADDON_START(10);
|
||||||
mixer.update_mix_from_vtool();
|
mixer.update_mix_from_vtool();
|
||||||
sprintf_P(tmp, PSTR("%3d;%3d%%"), int(mixer.mix[0]), int(mixer.mix[1]));
|
sprintf_P(tmp, PSTR("%3d;%3d%%"), int(mixer.mix[0]), int(mixer.mix[1]));
|
||||||
LCDPRINT(tmp);
|
lcd_put_u8str(tmp);
|
||||||
MENU_ITEM_ADDON_END();
|
MENU_ITEM_ADDON_END();
|
||||||
ACTION_ITEM(MSG_TOGGLE_MIX, _lcd_mixer_toggle_mix);
|
ACTION_ITEM(MSG_TOGGLE_MIX, _lcd_mixer_toggle_mix);
|
||||||
}
|
}
|
||||||
|
@ -299,7 +299,7 @@ void menu_mixer() {
|
||||||
SUBMENU(MSG_GRADIENT, lcd_mixer_edit_gradient_menu);
|
SUBMENU(MSG_GRADIENT, lcd_mixer_edit_gradient_menu);
|
||||||
MENU_ITEM_ADDON_START(10);
|
MENU_ITEM_ADDON_START(10);
|
||||||
sprintf_P(tmp, PSTR("T%i->T%i"), mixer.gradient.start_vtool, mixer.gradient.end_vtool);
|
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();
|
MENU_ITEM_ADDON_END();
|
||||||
ACTION_ITEM(MSG_REVERSE_GRADIENT, _lcd_mixer_reverse_gradient);
|
ACTION_ITEM(MSG_REVERSE_GRADIENT, _lcd_mixer_reverse_gradient);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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); });
|
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) {
|
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)); });
|
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];
|
char tmp[20], numstr[10];
|
||||||
// Determine digits needed right of decimal
|
// Determine digits needed right of decimal
|
||||||
const uint8_t digs = !UNEAR_ZERO((SHORT_MANUAL_Z_MOVE) * 1000 - int((SHORT_MANUAL_Z_MOVE) * 1000)) ? 4 :
|
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;
|
!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));
|
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();
|
MENU_ITEM_ADDON_END();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,13 +67,9 @@
|
||||||
#if HAS_GRAPHICAL_LCD
|
#if HAS_GRAPHICAL_LCD
|
||||||
#define SETCURSOR(col, row) lcd_moveto(col * (MENU_FONT_WIDTH), (row + 1) * (MENU_FONT_HEIGHT))
|
#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 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
|
#else
|
||||||
#define SETCURSOR(col, row) lcd_moveto(col, row)
|
#define SETCURSOR(col, row) lcd_moveto(col, row)
|
||||||
#define SETCURSOR_RJ(len, row) lcd_moveto(LCD_WIDTH - (len), 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
|
#endif
|
||||||
|
|
||||||
#include "lcdprint.h"
|
#include "lcdprint.h"
|
||||||
|
|
Reference in a new issue