🚸 Optional Cutter/Laser status for HD44780 (#25003)
This commit is contained in:
committed by
Scott Lahteine
parent
b9bed1ca69
commit
b6051fe847
@ -34,7 +34,7 @@ int lcd_put_lchar_max(const lchar_t &c, const pixel_len_t max_length) {
|
||||
return u8g_GetFontBBXWidth(u8g.getU8g());
|
||||
}
|
||||
u8g_uint_t x = u8g.getPrintCol(), y = u8g.getPrintRow(),
|
||||
ret = uxg_DrawWchar(u8g.getU8g(), x, y, c, max_length);
|
||||
ret = uxg_DrawLchar(u8g.getU8g(), x, y, c, max_length);
|
||||
u8g.setPrintPos(x + ret, y);
|
||||
return ret;
|
||||
}
|
||||
|
@ -372,9 +372,9 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
|
||||
|
||||
lcd_put_lchar(LCD_PIXEL_WIDTH - 11 * (MENU_FONT_WIDTH), y2, 'E');
|
||||
lcd_put_lchar((char)('1' + extruder));
|
||||
lcd_put_lchar(' ');
|
||||
lcd_put_u8str(F(" "));
|
||||
lcd_put_u8str(i16tostr3rj(thermalManager.wholeDegHotend(extruder)));
|
||||
lcd_put_lchar('/');
|
||||
lcd_put_u8str(F("/"));
|
||||
|
||||
if (get_blink() || !thermalManager.heater_idle[extruder].timed_out)
|
||||
lcd_put_u8str(i16tostr3rj(thermalManager.degTargetHotend(extruder)));
|
||||
@ -420,12 +420,12 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
|
||||
vlen = vstr ? utf8_strlen(vstr) : 0;
|
||||
if (style & SS_CENTER) {
|
||||
int pad = (LCD_PIXEL_WIDTH - plen - vlen * MENU_FONT_WIDTH) / MENU_FONT_WIDTH / 2;
|
||||
while (--pad >= 0) n -= lcd_put_lchar(' ');
|
||||
while (--pad >= 0) n -= lcd_put_u8str(F(" "));
|
||||
}
|
||||
|
||||
if (plen) n = lcd_put_u8str(ftpl, itemIndex, itemStringC, itemStringF, n / (MENU_FONT_WIDTH)) * (MENU_FONT_WIDTH);
|
||||
if (vlen) n -= lcd_put_u8str_max(vstr, n);
|
||||
while (n > MENU_FONT_WIDTH) n -= lcd_put_lchar(' ');
|
||||
while (n > MENU_FONT_WIDTH) n -= lcd_put_u8str(F(" "));
|
||||
}
|
||||
}
|
||||
|
||||
@ -433,9 +433,9 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
|
||||
void MenuItemBase::_draw(const bool sel, const uint8_t row, FSTR_P const ftpl, const char, const char post_char) {
|
||||
if (mark_as_selected(row, sel)) {
|
||||
pixel_len_t n = lcd_put_u8str(ftpl, itemIndex, itemStringC, itemStringF, LCD_WIDTH - 1) * (MENU_FONT_WIDTH);
|
||||
while (n > MENU_FONT_WIDTH) n -= lcd_put_lchar(' ');
|
||||
while (n > MENU_FONT_WIDTH) n -= lcd_put_u8str(F(" "));
|
||||
lcd_put_lchar(LCD_PIXEL_WIDTH - (MENU_FONT_WIDTH), row_y2, post_char);
|
||||
lcd_put_lchar(' ');
|
||||
lcd_put_u8str(F(" "));
|
||||
}
|
||||
}
|
||||
|
||||
@ -448,8 +448,8 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
|
||||
|
||||
pixel_len_t n = lcd_put_u8str(ftpl, itemIndex, itemStringC, itemStringF, LCD_WIDTH - 2 - vallen * prop) * (MENU_FONT_WIDTH);
|
||||
if (vallen) {
|
||||
lcd_put_lchar(':');
|
||||
while (n > MENU_FONT_WIDTH) n -= lcd_put_lchar(' ');
|
||||
lcd_put_u8str(F(":"));
|
||||
while (n > MENU_FONT_WIDTH) n -= lcd_put_u8str(F(" "));
|
||||
lcd_moveto(LCD_PIXEL_WIDTH - _MAX((MENU_FONT_WIDTH) * vallen, pixelwidth + 2), row_y2);
|
||||
if (pgm) lcd_put_u8str_P(inStr); else lcd_put_u8str(inStr);
|
||||
}
|
||||
@ -493,7 +493,7 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
|
||||
|
||||
// If a value is included, print a colon, then print the value right-justified
|
||||
if (value) {
|
||||
lcd_put_lchar(':');
|
||||
lcd_put_u8str(F(":"));
|
||||
if (extra_row) {
|
||||
// Assume that value is numeric (with no descender)
|
||||
baseline += EDIT_FONT_ASCENT + 2;
|
||||
@ -535,7 +535,7 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
|
||||
if (isDir) lcd_put_lchar(LCD_STR_FOLDER[0]);
|
||||
const pixel_len_t pixw = maxlen * (MENU_FONT_WIDTH);
|
||||
pixel_len_t n = pixw - lcd_put_u8str_max(ui.scrolled_filename(theCard, maxlen, row, sel), pixw);
|
||||
while (n > MENU_FONT_WIDTH) n -= lcd_put_lchar(' ');
|
||||
while (n > MENU_FONT_WIDTH) n -= lcd_put_u8str(F(" "));
|
||||
}
|
||||
}
|
||||
|
||||
@ -612,9 +612,9 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
|
||||
if (PAGE_CONTAINS(LCD_PIXEL_HEIGHT - (INFO_FONT_HEIGHT - 1), LCD_PIXEL_HEIGHT)) {
|
||||
lcd_put_lchar(5, LCD_PIXEL_HEIGHT, '(');
|
||||
u8g.print(x_plot);
|
||||
lcd_put_lchar(',');
|
||||
lcd_put_u8str(F(","));
|
||||
u8g.print(y_plot);
|
||||
lcd_put_lchar(')');
|
||||
lcd_put_u8str(F(")"));
|
||||
|
||||
// Show the location value
|
||||
lcd_put_u8str_P(74, LCD_PIXEL_HEIGHT, Z_LBL);
|
||||
|
@ -455,7 +455,7 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const
|
||||
void MarlinUI::drawPercent() {
|
||||
if (progress_string[0]) {
|
||||
lcd_put_u8str(progress_x_pos, EXTRAS_BASELINE, progress_string);
|
||||
lcd_put_lchar('%');
|
||||
lcd_put_u8str(F("%"));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -705,7 +705,7 @@ void MarlinUI::draw_status_screen() {
|
||||
lcd_put_u8str(STATUS_CUTTER_TEXT_X, STATUS_CUTTER_TEXT_Y, cutter_power2str(cutter.unitPower));
|
||||
#elif CUTTER_UNIT_IS(RPM)
|
||||
lcd_put_u8str(STATUS_CUTTER_TEXT_X - 2, STATUS_CUTTER_TEXT_Y, ftostr61rj(float(cutter.unitPower) / 1000));
|
||||
lcd_put_lchar('K');
|
||||
lcd_put_u8str(F("K"));
|
||||
#else
|
||||
lcd_put_u8str(STATUS_CUTTER_TEXT_X, STATUS_CUTTER_TEXT_Y, cutter_power2str(cutter.unitPower));
|
||||
#endif
|
||||
@ -892,7 +892,7 @@ void MarlinUI::draw_status_screen() {
|
||||
|
||||
set_font(FONT_STATUSMENU);
|
||||
lcd_put_u8str(12, EXTRAS_2_BASELINE, i16tostr3rj(feedrate_percentage));
|
||||
lcd_put_lchar('%');
|
||||
lcd_put_u8str(F("%"));
|
||||
|
||||
//
|
||||
// Filament sensor display if SD is disabled
|
||||
@ -900,7 +900,7 @@ void MarlinUI::draw_status_screen() {
|
||||
#if ENABLED(FILAMENT_LCD_DISPLAY) && DISABLED(SDSUPPORT)
|
||||
lcd_put_u8str(56, EXTRAS_2_BASELINE, wstring);
|
||||
lcd_put_u8str(102, EXTRAS_2_BASELINE, mstring);
|
||||
lcd_put_lchar('%');
|
||||
lcd_put_u8str(F("%"));
|
||||
set_font(FONT_MENU);
|
||||
lcd_put_lchar(47, EXTRAS_2_BASELINE, LCD_STR_FILAM_DIA[0]); // lcd_put_u8str(F(LCD_STR_FILAM_DIA));
|
||||
lcd_put_lchar(93, EXTRAS_2_BASELINE, LCD_STR_FILAM_MUL[0]);
|
||||
@ -917,12 +917,12 @@ void MarlinUI::draw_status_screen() {
|
||||
// Alternate Status message and Filament display
|
||||
if (ELAPSED(millis(), next_filament_display)) {
|
||||
lcd_put_u8str(F(LCD_STR_FILAM_DIA));
|
||||
lcd_put_lchar(':');
|
||||
lcd_put_u8str(F(":"));
|
||||
lcd_put_u8str(wstring);
|
||||
lcd_put_u8str(F(" " LCD_STR_FILAM_MUL));
|
||||
lcd_put_lchar(':');
|
||||
lcd_put_u8str(F(":"));
|
||||
lcd_put_u8str(mstring);
|
||||
lcd_put_lchar('%');
|
||||
lcd_put_u8str(F("%"));
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@ -955,7 +955,7 @@ void MarlinUI::draw_status_message(const bool blink) {
|
||||
if (slen <= lcd_width) {
|
||||
// The string fits within the line. Print with no scrolling
|
||||
lcd_put_u8str(status_message);
|
||||
while (slen < lcd_width) { lcd_put_lchar(' '); ++slen; }
|
||||
while (slen < lcd_width) { lcd_put_u8str(F(" ")); ++slen; }
|
||||
}
|
||||
else {
|
||||
// String is longer than the available space
|
||||
@ -973,14 +973,14 @@ void MarlinUI::draw_status_message(const bool blink) {
|
||||
// If the remaining string doesn't completely fill the screen
|
||||
if (rlen < lcd_width) {
|
||||
uint8_t chars = lcd_width - rlen; // Amount of space left in characters
|
||||
lcd_put_lchar(' '); // Always at 1+ spaces left, draw a space
|
||||
lcd_put_u8str(F(" ")); // Always at 1+ spaces left, draw a space
|
||||
if (--chars) { // Draw a second space if there's room
|
||||
lcd_put_lchar(' ');
|
||||
lcd_put_u8str(F(" "));
|
||||
if (--chars) { // Draw a third space if there's room
|
||||
lcd_put_lchar(' ');
|
||||
lcd_put_u8str(F(" "));
|
||||
if (--chars) { // Print a second copy of the message
|
||||
lcd_put_u8str_max(status_message, pixel_width - (rlen + 2) * (MENU_FONT_WIDTH));
|
||||
lcd_put_lchar(' ');
|
||||
lcd_put_u8str(F(" "));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -995,7 +995,7 @@ void MarlinUI::draw_status_message(const bool blink) {
|
||||
lcd_put_u8str_max(status_message, pixel_width);
|
||||
|
||||
// Fill the rest with spaces
|
||||
for (; slen < lcd_width; ++slen) lcd_put_lchar(' ');
|
||||
for (; slen < lcd_width; ++slen) lcd_put_u8str(F(" "));
|
||||
|
||||
#endif // !STATUS_MESSAGE_SCROLLING
|
||||
|
||||
|
@ -161,7 +161,7 @@ static int fontgroup_cb_draw_u8g(void *userdata, const font_t *fnt_current, cons
|
||||
*
|
||||
* Draw a UTF-8 string at the specified position
|
||||
*/
|
||||
unsigned int uxg_DrawWchar(u8g_t *pu8g, unsigned int x, unsigned int y, const lchar_t &wc, pixel_len_t max_width) {
|
||||
unsigned int uxg_DrawLchar(u8g_t *pu8g, unsigned int x, unsigned int y, const lchar_t &wc, pixel_len_t max_width) {
|
||||
struct _uxg_drawu8_data_t data;
|
||||
font_group_t *group = &g_fontgroup_root;
|
||||
const font_t *fnt_default = uxg_GetFont(pu8g);
|
||||
|
@ -26,7 +26,7 @@ typedef struct _uxg_fontinfo_t {
|
||||
|
||||
int uxg_SetUtf8Fonts(const uxg_fontinfo_t * fntinfo, int number); // fntinfo is type of PROGMEM
|
||||
|
||||
unsigned int uxg_DrawWchar(u8g_t *pu8g, unsigned int x, unsigned int y, const lchar_t &ch, const pixel_len_t max_length);
|
||||
unsigned int uxg_DrawLchar(u8g_t *pu8g, unsigned int x, unsigned int y, const lchar_t &ch, const pixel_len_t max_length);
|
||||
|
||||
unsigned int uxg_DrawUtf8Str(u8g_t *pu8g, unsigned int x, unsigned int y, const char *utf8_msg, const pixel_len_t max_length);
|
||||
unsigned int uxg_DrawUtf8StrP(u8g_t *pu8g, unsigned int x, unsigned int y, PGM_P utf8_msg, const pixel_len_t max_length);
|
||||
|
Reference in New Issue
Block a user