Add print at position shortcuts
This commit is contained in:
parent
5c0e5c599f
commit
7924e0d819
|
@ -401,9 +401,7 @@ void MarlinUI::clear_lcd() { lcd.clear(); }
|
|||
void lcd_scroll(const lcd_uint_t col, const lcd_uint_t line, PGM_P const text, const uint8_t len, const int16_t time) {
|
||||
uint8_t slen = utf8_strlen_P(text);
|
||||
if (slen < len) {
|
||||
// Fits into,
|
||||
lcd_moveto(col, line);
|
||||
lcd_put_u8str_max_P(text, len);
|
||||
lcd_put_u8str_max_P(col, line, text, len);
|
||||
for (; slen < len; ++slen) lcd_put_wchar(' ');
|
||||
safe_delay(time);
|
||||
}
|
||||
|
@ -412,11 +410,8 @@ void MarlinUI::clear_lcd() { lcd.clear(); }
|
|||
int dly = time / _MAX(slen, 1);
|
||||
for (uint8_t i = 0; i <= slen; i++) {
|
||||
|
||||
// Go to the correct place
|
||||
lcd_moveto(col, line);
|
||||
|
||||
// Print the text
|
||||
lcd_put_u8str_max_P(p, len);
|
||||
// Print the text at the correct place
|
||||
lcd_put_u8str_max_P(col, line, p, len);
|
||||
|
||||
// Fill with spaces
|
||||
for (uint8_t ix = slen - i; ix < len; ++ix) lcd_put_wchar(' ');
|
||||
|
@ -433,9 +428,9 @@ void MarlinUI::clear_lcd() { lcd.clear(); }
|
|||
|
||||
static void logo_lines(PGM_P const extra) {
|
||||
int16_t indent = (LCD_WIDTH - 8 - utf8_strlen_P(extra)) / 2;
|
||||
lcd_moveto(indent, 0); lcd_put_wchar('\x00'); lcd_put_u8str_P(PSTR( "------" )); lcd_put_wchar('\x01');
|
||||
lcd_moveto(indent, 1); lcd_put_u8str_P(PSTR("|Marlin|")); lcd_put_u8str_P(extra);
|
||||
lcd_moveto(indent, 2); lcd_put_wchar('\x02'); lcd_put_u8str_P(PSTR( "------" )); lcd_put_wchar('\x03');
|
||||
lcd_put_wchar(indent, 0, '\x00'); lcd_put_u8str_P(PSTR( "------" )); lcd_put_wchar('\x01');
|
||||
lcd_put_u8str_P(indent, 1, PSTR("|Marlin|")); lcd_put_u8str_P(extra);
|
||||
lcd_put_wchar(indent, 2, '\x02'); lcd_put_u8str_P(PSTR( "------" )); lcd_put_wchar('\x03');
|
||||
}
|
||||
|
||||
void MarlinUI::show_bootscreen() {
|
||||
|
@ -447,8 +442,7 @@ void MarlinUI::clear_lcd() { lcd.clear(); }
|
|||
#define CENTER_OR_SCROLL(STRING,DELAY) \
|
||||
lcd_erase_line(3); \
|
||||
if (utf8_strlen(STRING) <= LCD_WIDTH) { \
|
||||
lcd_moveto((LCD_WIDTH - utf8_strlen_P(PSTR(STRING))) / 2, 3); \
|
||||
lcd_put_u8str_P(PSTR(STRING)); \
|
||||
lcd_put_u8str_P((LCD_WIDTH - utf8_strlen_P(PSTR(STRING))) / 2, 3, PSTR(STRING)); \
|
||||
safe_delay(DELAY); \
|
||||
} \
|
||||
else { \
|
||||
|
@ -518,16 +512,12 @@ void MarlinUI::clear_lcd() { lcd.clear(); }
|
|||
#endif // SHOW_BOOTSCREEN
|
||||
|
||||
void MarlinUI::draw_kill_screen() {
|
||||
lcd_moveto(0, 0);
|
||||
lcd_put_u8str(status_message);
|
||||
#if LCD_HEIGHT < 4
|
||||
lcd_moveto(0, 2);
|
||||
#else
|
||||
lcd_moveto(0, 2);
|
||||
lcd_put_u8str_P(PSTR(MSG_HALTED));
|
||||
lcd_moveto(0, 3);
|
||||
lcd_put_u8str(0, 0, status_message);
|
||||
lcd_uint_t y = 2;
|
||||
#if LCD_HEIGHT >= 4
|
||||
lcd_put_u8str_P(0, y++, PSTR(MSG_HALTED));
|
||||
#endif
|
||||
lcd_put_u8str_P(PSTR(MSG_PLEASE_RESET));
|
||||
lcd_put_u8str_P(0, y, PSTR(MSG_PLEASE_RESET));
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -886,8 +876,7 @@ void MarlinUI::draw_status_screen() {
|
|||
|
||||
#if LCD_HEIGHT > 3
|
||||
|
||||
lcd_moveto(0, 2);
|
||||
lcd_put_wchar(LCD_STR_FEEDRATE[0]);
|
||||
lcd_put_wchar(0, 2, LCD_STR_FEEDRATE[0]);
|
||||
lcd_put_u8str(i16tostr3(feedrate_percentage));
|
||||
lcd_put_wchar('%');
|
||||
|
||||
|
@ -895,8 +884,7 @@ void MarlinUI::draw_status_screen() {
|
|||
duration_t elapsed = print_job_timer.duration();
|
||||
const uint8_t len = elapsed.toDigital(buffer),
|
||||
timepos = LCD_WIDTH - len - 1;
|
||||
lcd_moveto(timepos, 2);
|
||||
lcd_put_wchar(LCD_STR_CLOCK[0]);
|
||||
lcd_put_wchar(timepos, 2, LCD_STR_CLOCK[0]);
|
||||
lcd_put_u8str(buffer);
|
||||
|
||||
#if LCD_WIDTH >= 20
|
||||
|
@ -945,8 +933,7 @@ void MarlinUI::draw_status_screen() {
|
|||
_draw_axis_value(Z_AXIS, ftostr52sp(LOGICAL_Z_POSITION(current_position[Z_AXIS])), blink);
|
||||
|
||||
#if HAS_LEVELING && (HOTENDS > 1 || !HAS_HEATED_BED)
|
||||
lcd_moveto(LCD_WIDTH - 1, 0);
|
||||
lcd_put_wchar(planner.leveling_active || blink ? '_' : ' ');
|
||||
lcd_put_wchar(LCD_WIDTH - 1, 0, planner.leveling_active || blink ? '_' : ' ');
|
||||
#endif
|
||||
|
||||
// ========== Line 2 ==========
|
||||
|
@ -961,8 +948,7 @@ void MarlinUI::draw_status_screen() {
|
|||
_draw_bed_status(blink);
|
||||
#endif
|
||||
|
||||
lcd_moveto(LCD_WIDTH - 9, 1);
|
||||
lcd_put_wchar(LCD_STR_FEEDRATE[0]);
|
||||
lcd_put_wchar(LCD_WIDTH - 9, 1, LCD_STR_FEEDRATE[0]);
|
||||
lcd_put_u8str(i16tostr3(feedrate_percentage));
|
||||
lcd_put_wchar('%');
|
||||
|
||||
|
@ -1033,8 +1019,7 @@ void MarlinUI::draw_status_screen() {
|
|||
|
||||
void draw_menu_item(const bool sel, const uint8_t row, PGM_P pstr, const char pre_char, const char post_char) {
|
||||
uint8_t n = LCD_WIDTH - 2;
|
||||
lcd_moveto(0, row);
|
||||
lcd_put_wchar(sel ? pre_char : ' ');
|
||||
lcd_put_wchar(0, row, sel ? pre_char : ' ');
|
||||
n -= lcd_put_u8str_max_P(pstr, n);
|
||||
for (; n; --n) lcd_put_wchar(' ');
|
||||
lcd_put_wchar(post_char);
|
||||
|
@ -1042,8 +1027,7 @@ void MarlinUI::draw_status_screen() {
|
|||
|
||||
void _draw_menu_item_edit(const bool sel, const uint8_t row, PGM_P pstr, const char* const data, const bool pgm) {
|
||||
uint8_t n = LCD_WIDTH - 2 - (pgm ? utf8_strlen_P(data) : utf8_strlen(data));
|
||||
lcd_moveto(0, row);
|
||||
lcd_put_wchar(sel ? LCD_STR_ARROW_RIGHT[0] : ' ');
|
||||
lcd_put_wchar(0, row, sel ? LCD_STR_ARROW_RIGHT[0] : ' ');
|
||||
n -= lcd_put_u8str_max_P(pstr, n);
|
||||
lcd_put_wchar(':');
|
||||
for (; n; --n) lcd_put_wchar(' ');
|
||||
|
@ -1053,14 +1037,12 @@ void MarlinUI::draw_status_screen() {
|
|||
void draw_edit_screen(PGM_P const pstr, const char* const value/*=nullptr*/) {
|
||||
ui.encoder_direction_normal();
|
||||
|
||||
lcd_moveto(0, 1);
|
||||
lcd_put_u8str_P(pstr);
|
||||
lcd_put_u8str_P(0, 1, pstr);
|
||||
if (value != nullptr) {
|
||||
lcd_put_wchar(':');
|
||||
int len = utf8_strlen(value);
|
||||
const lcd_uint_t valrow = (utf8_strlen_P(pstr) + 1 + len + 1) > (LCD_WIDTH - 2) ? 2 : 1; // Value on the next row if it won't fit
|
||||
lcd_moveto((LCD_WIDTH - 1) - (len + 1), valrow); // Right-justified, padded by spaces
|
||||
lcd_put_wchar(' '); // Overwrite char if value gets shorter
|
||||
lcd_put_wchar((LCD_WIDTH - 1) - (len + 1), valrow, ' '); // Right-justified, padded, add a leading space
|
||||
lcd_put_u8str(value);
|
||||
}
|
||||
}
|
||||
|
@ -1078,8 +1060,7 @@ void MarlinUI::draw_status_screen() {
|
|||
void draw_sd_menu_item(const bool sel, const uint8_t row, PGM_P const pstr, CardReader &theCard, const bool isDir) {
|
||||
UNUSED(pstr);
|
||||
|
||||
lcd_moveto(0, row);
|
||||
lcd_put_wchar(sel ? LCD_STR_ARROW_RIGHT[0] : ' ');
|
||||
lcd_put_wchar(0, row, sel ? LCD_STR_ARROW_RIGHT[0] : ' ');
|
||||
constexpr uint8_t maxlen = LCD_WIDTH - 2;
|
||||
uint8_t n = maxlen - lcd_put_u8str_max(ui.scrolled_filename(theCard, maxlen, row, sel), maxlen);
|
||||
for (; n; --n) lcd_put_wchar(' ');
|
||||
|
@ -1206,8 +1187,7 @@ void MarlinUI::draw_status_screen() {
|
|||
void prep_and_put_map_char(custom_char &chrdata, const coordinate &ul, const coordinate &lr, const coordinate &brc, const uint8_t cl, const char c, const lcd_uint_t x, const lcd_uint_t y) {
|
||||
add_edges_to_custom_char(chrdata, ul, lr, brc, cl);
|
||||
lcd.createChar(c, (uint8_t*)&chrdata);
|
||||
lcd_moveto(x, y);
|
||||
lcd_put_wchar(c);
|
||||
lcd_put_wchar(x, y, c);
|
||||
}
|
||||
|
||||
void MarlinUI::ubl_plot(const uint8_t x_plot, const uint8_t y_plot) {
|
||||
|
@ -1216,7 +1196,7 @@ void MarlinUI::draw_status_screen() {
|
|||
#define _LCD_W_POS 12
|
||||
#define _PLOT_X 1
|
||||
#define _MAP_X 3
|
||||
#define _LABEL(C,X,Y) lcd_moveto(X, Y); lcd_put_u8str(C)
|
||||
#define _LABEL(C,X,Y) lcd_put_u8str(X, Y, C)
|
||||
#define _XLABEL(X,Y) _LABEL("X:",X,Y)
|
||||
#define _YLABEL(X,Y) _LABEL("Y:",X,Y)
|
||||
#define _ZLABEL(X,Y) _LABEL("Z:",X,Y)
|
||||
|
@ -1224,7 +1204,7 @@ void MarlinUI::draw_status_screen() {
|
|||
#define _LCD_W_POS 8
|
||||
#define _PLOT_X 0
|
||||
#define _MAP_X 1
|
||||
#define _LABEL(X,Y,C) lcd_moveto(X, Y); lcd_put_wchar(C)
|
||||
#define _LABEL(X,Y,C) lcd_put_wchar(X, Y, C)
|
||||
#define _XLABEL(X,Y) _LABEL('X',X,Y)
|
||||
#define _YLABEL(X,Y) _LABEL('Y',X,Y)
|
||||
#define _ZLABEL(X,Y) _LABEL('Z',X,Y)
|
||||
|
@ -1288,17 +1268,13 @@ void MarlinUI::draw_status_screen() {
|
|||
n_cols = right_edge / (HD44780_CHAR_WIDTH) + 1;
|
||||
|
||||
for (i = 0; i < n_cols; i++) {
|
||||
lcd_moveto(i, 0);
|
||||
lcd_put_wchar(CHAR_LINE_TOP); // Box Top line
|
||||
lcd_moveto(i, n_rows - 1);
|
||||
lcd_put_wchar(CHAR_LINE_BOT); // Box Bottom line
|
||||
lcd_put_wchar(i, 0, CHAR_LINE_TOP); // Box Top line
|
||||
lcd_put_wchar(i, n_rows - 1, CHAR_LINE_BOT); // Box Bottom line
|
||||
}
|
||||
|
||||
for (j = 0; j < n_rows; j++) {
|
||||
lcd_moveto(0, j);
|
||||
lcd_put_wchar(CHAR_EDGE_L); // Box Left edge
|
||||
lcd_moveto(n_cols - 1, j);
|
||||
lcd_put_wchar(CHAR_EDGE_R); // Box Right edge
|
||||
lcd_put_wchar(0, j, CHAR_EDGE_L); // Box Left edge
|
||||
lcd_put_wchar(n_cols - 1, j, CHAR_EDGE_R); // Box Right edge
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1308,10 +1284,8 @@ void MarlinUI::draw_status_screen() {
|
|||
k = pixels_per_y_mesh_pnt * (GRID_MAX_POINTS_Y) + 2;
|
||||
l = (HD44780_CHAR_HEIGHT) * n_rows;
|
||||
if (l > k && l - k >= (HD44780_CHAR_HEIGHT) / 2) {
|
||||
lcd_moveto(0, n_rows - 1); // Box Left edge
|
||||
lcd_put_wchar(' ');
|
||||
lcd_moveto(n_cols - 1, n_rows - 1); // Box Right edge
|
||||
lcd_put_wchar(' ');
|
||||
lcd_put_wchar(0, n_rows - 1, ' '); // Box Left edge
|
||||
lcd_put_wchar(n_cols - 1, n_rows - 1, ' '); // Box Right edge
|
||||
}
|
||||
|
||||
clear_custom_char(&new_char);
|
||||
|
@ -1425,8 +1399,7 @@ void MarlinUI::draw_status_screen() {
|
|||
/**
|
||||
* Print plot position
|
||||
*/
|
||||
lcd_moveto(_LCD_W_POS, 0);
|
||||
lcd_put_wchar('(');
|
||||
lcd_put_wchar(_LCD_W_POS, 0, '(');
|
||||
lcd_put_u8str(ui8tostr3(x_plot));
|
||||
lcd_put_wchar(',');
|
||||
lcd_put_u8str(ui8tostr3(y_plot));
|
||||
|
|
|
@ -100,8 +100,7 @@
|
|||
FORCE_INLINE void _draw_centered_temp(const int16_t temp, const uint8_t tx, const uint8_t ty) {
|
||||
const char *str = i16tostr3(temp);
|
||||
const uint8_t len = str[0] != ' ' ? 3 : str[1] != ' ' ? 2 : 1;
|
||||
lcd_moveto(tx - len * (INFO_FONT_WIDTH) / 2 + 1, ty);
|
||||
lcd_put_u8str(&str[3-len]);
|
||||
lcd_put_u8str(tx - len * (INFO_FONT_WIDTH) / 2 + 1, ty, &str[3-len]);
|
||||
lcd_put_wchar(LCD_STR_DEGREE[0]);
|
||||
}
|
||||
|
||||
|
@ -264,8 +263,7 @@ FORCE_INLINE void _draw_heater_status(const heater_ind_t heater, const bool blin
|
|||
//
|
||||
FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const bool blink) {
|
||||
const uint8_t offs = (XYZ_SPACING) * axis;
|
||||
lcd_moveto(X_LABEL_POS + offs, XYZ_BASELINE);
|
||||
lcd_put_wchar('X' + axis);
|
||||
lcd_put_wchar(X_LABEL_POS + offs, XYZ_BASELINE, 'X' + axis);
|
||||
lcd_moveto(X_VALUE_POS + offs, XYZ_BASELINE);
|
||||
if (blink)
|
||||
lcd_put_u8str(value);
|
||||
|
@ -429,8 +427,7 @@ void MarlinUI::draw_status_screen() {
|
|||
c = '*';
|
||||
}
|
||||
#endif
|
||||
lcd_moveto(STATUS_FAN_TEXT_X, STATUS_FAN_TEXT_Y);
|
||||
lcd_put_u8str(i16tostr3(thermalManager.fanPercent(spd)));
|
||||
lcd_put_u8str(STATUS_FAN_TEXT_X, STATUS_FAN_TEXT_Y, i16tostr3(thermalManager.fanPercent(spd)));
|
||||
lcd_put_wchar(c);
|
||||
}
|
||||
}
|
||||
|
@ -488,8 +485,7 @@ void MarlinUI::draw_status_screen() {
|
|||
#if ENABLED(DOGM_SD_PERCENT)
|
||||
if (PAGE_CONTAINS(41, 48)) {
|
||||
// Percent complete
|
||||
lcd_moveto(55, 48);
|
||||
lcd_put_u8str(ui8tostr3(progress));
|
||||
lcd_put_u8str(55, 48, ui8tostr3(progress));
|
||||
lcd_put_wchar('%');
|
||||
}
|
||||
#endif
|
||||
|
@ -510,8 +506,7 @@ void MarlinUI::draw_status_screen() {
|
|||
duration_t elapsed = print_job_timer.duration();
|
||||
bool has_days = (elapsed.value >= 60*60*24L);
|
||||
uint8_t len = elapsed.toDigital(buffer, has_days);
|
||||
lcd_moveto(SD_DURATION_X, EXTRAS_BASELINE);
|
||||
lcd_put_u8str(buffer);
|
||||
lcd_put_u8str(SD_DURATION_X, EXTRAS_BASELINE, buffer);
|
||||
}
|
||||
|
||||
#endif // HAS_PRINT_PROGRESS
|
||||
|
@ -546,8 +541,6 @@ void MarlinUI::draw_status_screen() {
|
|||
|
||||
// Two-component mix / gradient instead of XY
|
||||
|
||||
lcd_moveto(X_LABEL_POS, XYZ_BASELINE);
|
||||
|
||||
char mixer_messages[12];
|
||||
const char *mix_label;
|
||||
#if ENABLED(GRADIENT_MIX)
|
||||
|
@ -562,7 +555,7 @@ void MarlinUI::draw_status_screen() {
|
|||
mix_label = "Mx";
|
||||
}
|
||||
sprintf_P(mixer_messages, PSTR("%s %d;%d%% "), mix_label, int(mixer.mix[0]), int(mixer.mix[1]));
|
||||
lcd_put_u8str(mixer_messages);
|
||||
lcd_put_u8str(X_LABEL_POS, XYZ_BASELINE, mixer_messages);
|
||||
|
||||
#else
|
||||
|
||||
|
@ -587,28 +580,22 @@ void MarlinUI::draw_status_screen() {
|
|||
|
||||
if (PAGE_CONTAINS(EXTRAS_2_BASELINE - INFO_FONT_ASCENT, EXTRAS_2_BASELINE - 1)) {
|
||||
set_font(FONT_MENU);
|
||||
lcd_moveto(3, EXTRAS_2_BASELINE);
|
||||
lcd_put_wchar(LCD_STR_FEEDRATE[0]);
|
||||
lcd_put_wchar(3, EXTRAS_2_BASELINE, LCD_STR_FEEDRATE[0]);
|
||||
|
||||
set_font(FONT_STATUSMENU);
|
||||
lcd_moveto(12, EXTRAS_2_BASELINE);
|
||||
lcd_put_u8str(i16tostr3(feedrate_percentage));
|
||||
lcd_put_u8str(12, EXTRAS_2_BASELINE, i16tostr3(feedrate_percentage));
|
||||
lcd_put_wchar('%');
|
||||
|
||||
//
|
||||
// Filament sensor display if SD is disabled
|
||||
//
|
||||
#if ENABLED(FILAMENT_LCD_DISPLAY) && DISABLED(SDSUPPORT)
|
||||
lcd_moveto(56, EXTRAS_2_BASELINE);
|
||||
lcd_put_u8str(wstring);
|
||||
lcd_moveto(102, EXTRAS_2_BASELINE);
|
||||
lcd_put_u8str(mstring);
|
||||
lcd_put_u8str(56, EXTRAS_2_BASELINE, wstring);
|
||||
lcd_put_u8str(102, EXTRAS_2_BASELINE, mstring);
|
||||
lcd_put_wchar('%');
|
||||
set_font(FONT_MENU);
|
||||
lcd_moveto(47, EXTRAS_2_BASELINE);
|
||||
lcd_put_wchar(LCD_STR_FILAM_DIA[0]); // lcd_put_u8str_P(PSTR(LCD_STR_FILAM_DIA));
|
||||
lcd_moveto(93, EXTRAS_2_BASELINE);
|
||||
lcd_put_wchar(LCD_STR_FILAM_MUL[0]);
|
||||
lcd_put_wchar(47, EXTRAS_2_BASELINE, LCD_STR_FILAM_DIA[0]); // lcd_put_u8str_P(PSTR(LCD_STR_FILAM_DIA));
|
||||
lcd_put_wchar(93, EXTRAS_2_BASELINE, LCD_STR_FILAM_MUL[0]);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -201,13 +201,11 @@ bool MarlinUI::detected() { return true; }
|
|||
auto draw_bootscreen_bmp = [&](const uint8_t *bitmap) {
|
||||
u8g.drawBitmapP(offx, offy, START_BMP_BYTEWIDTH, START_BMPHEIGHT, bitmap);
|
||||
set_font(FONT_MENU);
|
||||
const u8g_pgm_uint8_t splash1[] U8G_PROGMEM = STRING_SPLASH_LINE1;
|
||||
#ifndef STRING_SPLASH_LINE2
|
||||
u8g.drawStrP(txt_offx_1, txt_base, splash1);
|
||||
lcd_put_u8str_P(txt_offx_1, txt_base, PSTR(STRING_SPLASH_LINE1));
|
||||
#else
|
||||
const u8g_pgm_uint8_t splash2[] U8G_PROGMEM = STRING_SPLASH_LINE2;
|
||||
u8g.drawStrP(txt_offx_1, txt_base - (MENU_FONT_HEIGHT), splash1);
|
||||
u8g.drawStrP(txt_offx_2, txt_base, splash2);
|
||||
lcd_put_u8str_P(txt_offx_1, txt_base - (MENU_FONT_HEIGHT), PSTR(STRING_SPLASH_LINE1));
|
||||
lcd_put_u8str_P(txt_offx_2, txt_base, PSTR(STRING_SPLASH_LINE2));
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -306,12 +304,9 @@ void MarlinUI::draw_kill_screen() {
|
|||
u8g.firstPage();
|
||||
do {
|
||||
set_font(FONT_MENU);
|
||||
lcd_moveto(0, h4 * 1);
|
||||
lcd_put_u8str(status_message);
|
||||
lcd_moveto(0, h4 * 2);
|
||||
lcd_put_u8str_P(PSTR(MSG_HALTED));
|
||||
lcd_moveto(0, h4 * 3);
|
||||
lcd_put_u8str_P(PSTR(MSG_PLEASE_RESET));
|
||||
lcd_put_u8str(0, h4 * 1, status_message);
|
||||
lcd_put_u8str_P(0, h4 * 2, PSTR(MSG_HALTED));
|
||||
lcd_put_u8str_P(0, h4 * 3, PSTR(MSG_PLEASE_RESET));
|
||||
} while (u8g.nextPage());
|
||||
}
|
||||
|
||||
|
@ -329,8 +324,7 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
|
|||
|
||||
if (!PAGE_CONTAINS(row_y1 + 1, row_y2 + 2)) return;
|
||||
|
||||
lcd_moveto(LCD_PIXEL_WIDTH - 11 * (MENU_FONT_WIDTH), row_y2);
|
||||
lcd_put_wchar('E');
|
||||
lcd_put_wchar(LCD_PIXEL_WIDTH - 11 * (MENU_FONT_WIDTH), row_y2, 'E');
|
||||
lcd_put_wchar((char)('1' + extruder));
|
||||
lcd_put_wchar(' ');
|
||||
lcd_put_u8str(i16tostr3(thermalManager.degHotend(extruder)));
|
||||
|
@ -396,8 +390,7 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
|
|||
u8g_uint_t n = (LCD_WIDTH - 2) * (MENU_FONT_WIDTH);
|
||||
n -= lcd_put_u8str_max_P(pstr, n);
|
||||
while (n > MENU_FONT_WIDTH) n -= lcd_put_wchar(' ');
|
||||
lcd_moveto(LCD_PIXEL_WIDTH - (MENU_FONT_WIDTH), row_y2);
|
||||
lcd_put_wchar(post_char);
|
||||
lcd_put_wchar(LCD_PIXEL_WIDTH - (MENU_FONT_WIDTH), row_y2, post_char);
|
||||
lcd_put_wchar(' ');
|
||||
}
|
||||
}
|
||||
|
@ -447,10 +440,7 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
|
|||
|
||||
// Assume the label is alpha-numeric (with a descender)
|
||||
bool onpage = PAGE_CONTAINS(baseline - (EDIT_FONT_ASCENT - 1), baseline + EDIT_FONT_DESCENT);
|
||||
if (onpage) {
|
||||
lcd_moveto(0, baseline);
|
||||
lcd_put_u8str_P(pstr);
|
||||
}
|
||||
if (onpage) lcd_put_u8str_P(0, baseline, pstr);
|
||||
|
||||
// If a value is included, print a colon, then print the value right-justified
|
||||
if (value != nullptr) {
|
||||
|
@ -461,8 +451,7 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
|
|||
onpage = PAGE_CONTAINS(baseline - (EDIT_FONT_ASCENT - 1), baseline);
|
||||
}
|
||||
if (onpage) {
|
||||
lcd_moveto(((lcd_chr_fit - 1) - (vallen + 1)) * one_chr_width, baseline); // Right-justified, leaving padded by spaces
|
||||
lcd_put_wchar(' '); // overwrite char if value gets shorter
|
||||
lcd_put_wchar(((lcd_chr_fit - 1) - (vallen + 1)) * one_chr_width, baseline, ' '); // Right-justified, padded, add a leading space
|
||||
lcd_put_u8str(value);
|
||||
}
|
||||
}
|
||||
|
@ -476,8 +465,7 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
|
|||
u8g.drawBox(bx - 1, by - (MENU_FONT_ASCENT) + 1, bw + 2, MENU_FONT_HEIGHT - 1);
|
||||
u8g.setColorIndex(0);
|
||||
}
|
||||
lcd_moveto(bx, by);
|
||||
lcd_put_u8str_P(pstr);
|
||||
lcd_put_u8str_P(bx, by, pstr);
|
||||
if (inv) u8g.setColorIndex(1);
|
||||
}
|
||||
|
||||
|
@ -562,26 +550,22 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
|
|||
// Show X and Y positions at top of screen
|
||||
u8g.setColorIndex(1);
|
||||
if (PAGE_UNDER(7)) {
|
||||
lcd_moveto(5, 7);
|
||||
lcd_put_u8str("X:");
|
||||
lcd_put_u8str(5, 7, "X:");
|
||||
lcd_put_u8str(ftostr52(LOGICAL_X_POSITION(pgm_read_float(&ubl._mesh_index_to_xpos[x_plot]))));
|
||||
lcd_moveto(74, 7);
|
||||
lcd_put_u8str("Y:");
|
||||
lcd_put_u8str(74, 7, "Y:");
|
||||
lcd_put_u8str(ftostr52(LOGICAL_Y_POSITION(pgm_read_float(&ubl._mesh_index_to_ypos[y_plot]))));
|
||||
}
|
||||
|
||||
// Print plot position
|
||||
if (PAGE_CONTAINS(LCD_PIXEL_HEIGHT - (INFO_FONT_HEIGHT - 1), LCD_PIXEL_HEIGHT)) {
|
||||
lcd_moveto(5, LCD_PIXEL_HEIGHT);
|
||||
lcd_put_wchar('(');
|
||||
lcd_put_wchar(5, LCD_PIXEL_HEIGHT, '(');
|
||||
u8g.print(x_plot);
|
||||
lcd_put_wchar(',');
|
||||
u8g.print(y_plot);
|
||||
lcd_put_wchar(')');
|
||||
|
||||
// Show the location value
|
||||
lcd_moveto(74, LCD_PIXEL_HEIGHT);
|
||||
lcd_put_u8str("Z:");
|
||||
lcd_put_u8str(74, LCD_PIXEL_HEIGHT, "Z:");
|
||||
if (!isnan(ubl.z_values[x_plot][y_plot]))
|
||||
lcd_put_u8str(ftostr43sign(ubl.z_values[x_plot][y_plot]));
|
||||
else
|
||||
|
|
|
@ -38,6 +38,11 @@ int lcd_put_wchar_max(wchar_t c, pixel_len_t max_length);
|
|||
*/
|
||||
int lcd_put_u8str_max(const char * utf8_str, pixel_len_t max_length);
|
||||
|
||||
/**
|
||||
* Set the print baseline position
|
||||
*/
|
||||
void lcd_moveto(const lcd_uint_t col, const lcd_uint_t row);
|
||||
|
||||
/**
|
||||
* @brief Draw a ROM UTF-8 string
|
||||
*
|
||||
|
@ -49,13 +54,19 @@ int lcd_put_u8str_max(const char * utf8_str, pixel_len_t max_length);
|
|||
* Draw a ROM UTF-8 string
|
||||
*/
|
||||
int lcd_put_u8str_max_P(PGM_P utf8_str_P, pixel_len_t max_length);
|
||||
|
||||
void lcd_moveto(const lcd_uint_t col, const lcd_uint_t row);
|
||||
inline int lcd_put_u8str_max_P(const lcd_uint_t col, const lcd_uint_t row, PGM_P utf8_str_P, pixel_len_t max_length) {
|
||||
lcd_moveto(col, row);
|
||||
return lcd_put_u8str_max_P(utf8_str_P, max_length);
|
||||
}
|
||||
|
||||
void lcd_put_int(const int i);
|
||||
inline void lcd_put_int(const lcd_uint_t col, const lcd_uint_t row, const int i) { lcd_moveto(col, row); lcd_put_int(i); }
|
||||
|
||||
inline int lcd_put_u8str_P(PGM_P str) { return lcd_put_u8str_max_P(str, PIXEL_LEN_NOLIMIT); }
|
||||
inline int lcd_put_u8str_P(const lcd_uint_t col, const lcd_uint_t row, PGM_P str) { lcd_moveto(col, row); return lcd_put_u8str_P(str); }
|
||||
|
||||
inline int lcd_put_u8str(const char* str) { return lcd_put_u8str_max(str, PIXEL_LEN_NOLIMIT); }
|
||||
inline int lcd_put_u8str(const lcd_uint_t col, const lcd_uint_t row, PGM_P str) { lcd_moveto(col, row); return lcd_put_u8str(str); }
|
||||
|
||||
inline int lcd_put_wchar(const wchar_t c) { return lcd_put_wchar_max(c, PIXEL_LEN_NOLIMIT); }
|
||||
inline int lcd_put_wchar(const lcd_uint_t col, const lcd_uint_t row, const wchar_t c) { lcd_moveto(col, row); return lcd_put_wchar(c); }
|
||||
|
|
|
@ -180,8 +180,7 @@ void BrickoutGame::game_screen() {
|
|||
// Score Digits
|
||||
//const uint8_t sx = (LCD_PIXEL_WIDTH - (score >= 10 ? score >= 100 ? score >= 1000 ? 4 : 3 : 2 : 1) * MENU_FONT_WIDTH) / 2;
|
||||
constexpr uint8_t sx = 0;
|
||||
lcd_moveto(sx, MENU_FONT_ASCENT - 1);
|
||||
lcd_put_int(score);
|
||||
lcd_put_int(sx, MENU_FONT_ASCENT - 1, score);
|
||||
|
||||
// Balls Left
|
||||
lcd_moveto(LCD_PIXEL_WIDTH - MENU_FONT_WIDTH * 3, MENU_FONT_ASCENT - 1);
|
||||
|
|
|
@ -48,10 +48,7 @@ void MarlinGame::draw_game_over() {
|
|||
u8g.setColorIndex(0);
|
||||
u8g.drawBox(lx - 1, ly - gohigh - 1, gowide + 2, gohigh + 2);
|
||||
u8g.setColorIndex(1);
|
||||
if (ui.get_blink()) {
|
||||
lcd_moveto(lx, ly);
|
||||
lcd_put_u8str_P(PSTR("GAME OVER"));
|
||||
}
|
||||
if (ui.get_blink()) lcd_put_u8str_P(lx, ly, PSTR("GAME OVER"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -416,8 +416,7 @@ void InvadersGame::game_screen() {
|
|||
// Draw Score
|
||||
//const uint8_t sx = (LCD_PIXEL_WIDTH - (score >= 10 ? score >= 100 ? score >= 1000 ? 4 : 3 : 2 : 1) * MENU_FONT_WIDTH) / 2;
|
||||
constexpr uint8_t sx = 0;
|
||||
lcd_moveto(sx, MENU_FONT_ASCENT - 1);
|
||||
lcd_put_int(score);
|
||||
lcd_put_int(sx, MENU_FONT_ASCENT - 1, score);
|
||||
|
||||
// Draw lives
|
||||
if (idat.cannons_left)
|
||||
|
|
|
@ -80,10 +80,7 @@ void MazeGame::game_screen() {
|
|||
u8g.setColorIndex(1);
|
||||
|
||||
// Draw Score
|
||||
if (PAGE_UNDER(HEADER_H)) {
|
||||
lcd_moveto(0, HEADER_H - 1);
|
||||
lcd_put_int(score);
|
||||
}
|
||||
if (PAGE_UNDER(HEADER_H)) lcd_put_int(0, HEADER_H - 1, score);
|
||||
|
||||
// Draw the maze
|
||||
// for (uint8_t n = 0; n < head_ind; ++n) {
|
||||
|
|
|
@ -231,10 +231,7 @@ void SnakeGame::game_screen() {
|
|||
u8g.setColorIndex(1);
|
||||
|
||||
// Draw Score
|
||||
if (PAGE_UNDER(HEADER_H)) {
|
||||
lcd_moveto(0, HEADER_H - 1);
|
||||
lcd_put_int(score);
|
||||
}
|
||||
if (PAGE_UNDER(HEADER_H)) lcd_put_int(0, HEADER_H - 1, score);
|
||||
|
||||
// DRAW THE PLAYFIELD BORDER
|
||||
u8g.drawFrame(BOARD_L - 2, BOARD_T - 2, BOARD_R - BOARD_L + 4, BOARD_B - BOARD_T + 4);
|
||||
|
|
|
@ -76,8 +76,7 @@ static void lcd_factory_settings() {
|
|||
LIMIT(bar_percent, 0, 100);
|
||||
ui.encoderPosition = 0;
|
||||
draw_menu_item_static(0, PSTR(MSG_PROGRESS_BAR_TEST), true, true);
|
||||
lcd_moveto((LCD_WIDTH) / 2 - 2, LCD_HEIGHT - 2);
|
||||
lcd_put_int(bar_percent); lcd_put_wchar('%');
|
||||
lcd_put_int((LCD_WIDTH) / 2 - 2, LCD_HEIGHT - 2, bar_percent); lcd_put_wchar('%');
|
||||
lcd_moveto(0, LCD_HEIGHT - 1); ui.draw_progress_bar(bar_percent);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue