Merge upstream changes from Marlin 2.1.1
This commit is contained in:
@@ -57,6 +57,11 @@
|
||||
#define U8G_COM_HAL_SW_SPI_FN u8g_com_std_sw_spi_fn
|
||||
#define U8G_COM_HAL_HW_SPI_FN u8g_com_stm32duino_hw_spi_fn
|
||||
|
||||
#elif defined(ESP32)
|
||||
|
||||
uint8_t u8g_eps_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
||||
#define U8G_COM_HAL_HW_SPI_FN u8g_eps_hw_spi_fn
|
||||
|
||||
#elif defined(__AVR__)
|
||||
|
||||
uint8_t u8g_com_HAL_AVR_sw_sp_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
||||
@@ -119,7 +124,7 @@
|
||||
#ifndef U8G_COM_SSD_I2C_HAL
|
||||
#define U8G_COM_SSD_I2C_HAL u8g_com_null_fn
|
||||
#endif
|
||||
#if HAS_FSMC_GRAPHICAL_TFT || HAS_SPI_GRAPHICAL_TFT
|
||||
#if HAS_FSMC_GRAPHICAL_TFT || HAS_SPI_GRAPHICAL_TFT || HAS_LTDC_GRAPHICAL_TFT
|
||||
uint8_t u8g_com_hal_tft_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
||||
#define U8G_COM_HAL_TFT_FN u8g_com_hal_tft_fn
|
||||
#else
|
||||
|
@@ -37,6 +37,7 @@
|
||||
|
||||
#undef STATUS_HEATERS_X
|
||||
#undef STATUS_BED_X
|
||||
|
||||
/**
|
||||
* Custom _Statusscreen.h files can define:
|
||||
* - A custom logo image
|
||||
|
@@ -28,7 +28,7 @@ void lcd_put_int(const int i) { u8g.print(i); }
|
||||
|
||||
// return < 0 on error
|
||||
// return the advanced pixels
|
||||
int lcd_put_wchar_max(wchar_t c, pixel_len_t max_length) {
|
||||
int lcd_put_lchar_max(const lchar_t &c, const pixel_len_t max_length) {
|
||||
if (c < 256) {
|
||||
u8g.print((char)c);
|
||||
return u8g_GetFontBBXWidth(u8g.getU8g());
|
||||
@@ -39,16 +39,16 @@ int lcd_put_wchar_max(wchar_t c, pixel_len_t max_length) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
int lcd_put_u8str_max(const char * utf8_str, pixel_len_t max_length) {
|
||||
int lcd_put_u8str_max(const char * utf8_str, const pixel_len_t max_length) {
|
||||
u8g_uint_t x = u8g.getPrintCol(), y = u8g.getPrintRow(),
|
||||
ret = uxg_DrawUtf8Str(u8g.getU8g(), x, y, utf8_str, max_length);
|
||||
u8g.setPrintPos(x + ret, y);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int lcd_put_u8str_max_P(PGM_P utf8_str_P, pixel_len_t max_length) {
|
||||
int lcd_put_u8str_max_P(PGM_P utf8_pstr, const pixel_len_t max_length) {
|
||||
u8g_uint_t x = u8g.getPrintCol(), y = u8g.getPrintRow(),
|
||||
ret = uxg_DrawUtf8StrP(u8g.getU8g(), x, y, utf8_str_P, max_length);
|
||||
ret = uxg_DrawUtf8StrP(u8g.getU8g(), x, y, utf8_pstr, max_length);
|
||||
u8g.setPrintPos(x + ret, y);
|
||||
return ret;
|
||||
}
|
||||
|
@@ -217,8 +217,8 @@ 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);
|
||||
if (!two_part || !line2) lcd_put_u8str_P(txt_offx_1, txt_base - (MENU_FONT_HEIGHT), PSTR(SHORT_BUILD_VERSION));
|
||||
if (!two_part || line2) lcd_put_u8str_P(txt_offx_2, txt_base, PSTR(MARLIN_WEBSITE_URL));
|
||||
if (!two_part || !line2) lcd_put_u8str(txt_offx_1, txt_base - (MENU_FONT_HEIGHT), F(SHORT_BUILD_VERSION));
|
||||
if (!two_part || line2) lcd_put_u8str(txt_offx_2, txt_base, F(MARLIN_WEBSITE_URL));
|
||||
};
|
||||
|
||||
auto draw_bootscreen_bmp = [&](const uint8_t *bitmap) {
|
||||
@@ -282,9 +282,9 @@ void MarlinUI::init_lcd() {
|
||||
#if PIN_EXISTS(LCD_RESET)
|
||||
// Perform a clean hardware reset with needed delays
|
||||
OUT_WRITE(LCD_RESET_PIN, LOW);
|
||||
_delay_ms(5);
|
||||
hal.delay_ms(5);
|
||||
WRITE(LCD_RESET_PIN, HIGH);
|
||||
_delay_ms(5);
|
||||
hal.delay_ms(5);
|
||||
u8g.begin();
|
||||
#endif
|
||||
|
||||
@@ -294,9 +294,13 @@ void MarlinUI::init_lcd() {
|
||||
|
||||
TERN_(HAS_LCD_CONTRAST, refresh_contrast());
|
||||
|
||||
TERN_(LCD_SCREEN_ROT_90, u8g.setRot90());
|
||||
TERN_(LCD_SCREEN_ROT_180, u8g.setRot180());
|
||||
TERN_(LCD_SCREEN_ROT_270, u8g.setRot270());
|
||||
#if LCD_SCREEN_ROTATE == 90
|
||||
u8g.setRot90();
|
||||
#elif LCD_SCREEN_ROTATE == 180
|
||||
u8g.setRot180();
|
||||
#elif LCD_SCREEN_ROTATE == 270
|
||||
u8g.setRot270();
|
||||
#endif
|
||||
|
||||
update_language_font();
|
||||
}
|
||||
@@ -326,28 +330,35 @@ void MarlinUI::update_language_font() {
|
||||
// The kill screen is displayed for unrecoverable conditions
|
||||
void MarlinUI::draw_kill_screen() {
|
||||
TERN_(LIGHTWEIGHT_UI, ST7920_Lite_Status_Screen::clear_text_buffer());
|
||||
const u8g_uint_t h4 = u8g.getHeight() / 4;
|
||||
const u8g_uint_t x = 0, h4 = u8g.getHeight() / 4;
|
||||
u8g.firstPage();
|
||||
do {
|
||||
set_font(FONT_MENU);
|
||||
lcd_put_u8str(0, h4 * 1, status_message);
|
||||
lcd_put_u8str_P(0, h4 * 2, GET_TEXT(MSG_HALTED));
|
||||
lcd_put_u8str_P(0, h4 * 3, GET_TEXT(MSG_PLEASE_RESET));
|
||||
lcd_put_u8str(x, h4 * 1, status_message);
|
||||
lcd_put_u8str(x, h4 * 2, GET_TEXT_F(MSG_HALTED));
|
||||
lcd_put_u8str(x, h4 * 3, GET_TEXT_F(MSG_PLEASE_RESET));
|
||||
} while (u8g.nextPage());
|
||||
}
|
||||
|
||||
void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
|
||||
|
||||
#if HAS_DISPLAY_SLEEP
|
||||
void MarlinUI::sleep_on() { u8g.sleepOn(); }
|
||||
void MarlinUI::sleep_off() { u8g.sleepOff(); }
|
||||
#endif
|
||||
|
||||
#if HAS_LCD_BRIGHTNESS
|
||||
|
||||
void MarlinUI::_set_brightness() {
|
||||
#if PIN_EXISTS(TFT_BACKLIGHT)
|
||||
if (PWM_PIN(TFT_BACKLIGHT_PIN))
|
||||
analogWrite(pin_t(TFT_BACKLIGHT_PIN), brightness);
|
||||
analogWrite(pin_t(TFT_BACKLIGHT_PIN), backlight ? brightness : 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if HAS_LCD_MENU
|
||||
#if HAS_MARLINUI_MENU
|
||||
|
||||
#include "../menu/menu.h"
|
||||
|
||||
@@ -360,11 +371,11 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
|
||||
|
||||
if (!PAGE_CONTAINS(y1 + 1, y2 + 2)) return;
|
||||
|
||||
lcd_put_wchar(LCD_PIXEL_WIDTH - 11 * (MENU_FONT_WIDTH), y2, 'E');
|
||||
lcd_put_wchar((char)('1' + extruder));
|
||||
lcd_put_wchar(' ');
|
||||
lcd_put_lchar(LCD_PIXEL_WIDTH - 11 * (MENU_FONT_WIDTH), y2, 'E');
|
||||
lcd_put_lchar((char)('1' + extruder));
|
||||
lcd_put_lchar(' ');
|
||||
lcd_put_u8str(i16tostr3rj(thermalManager.wholeDegHotend(extruder)));
|
||||
lcd_put_wchar('/');
|
||||
lcd_put_lchar('/');
|
||||
|
||||
if (get_blink() || !thermalManager.heater_idle[extruder].timed_out)
|
||||
lcd_put_u8str(i16tostr3rj(thermalManager.degTargetHotend(extruder)));
|
||||
@@ -401,56 +412,56 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
|
||||
}
|
||||
|
||||
// Draw a static line of text in the same idiom as a menu item
|
||||
void MenuItem_static::draw(const uint8_t row, PGM_P const pstr, const uint8_t style/*=SS_DEFAULT*/, const char * const vstr/*=nullptr*/) {
|
||||
void MenuItem_static::draw(const uint8_t row, FSTR_P const ftpl, const uint8_t style/*=SS_DEFAULT*/, const char * const vstr/*=nullptr*/) {
|
||||
|
||||
if (mark_as_selected(row, style & SS_INVERT)) {
|
||||
pixel_len_t n = LCD_PIXEL_WIDTH; // pixel width of string allowed
|
||||
|
||||
const int plen = pstr ? calculateWidth(pstr) : 0,
|
||||
const int plen = ftpl ? calculateWidth(ftpl) : 0,
|
||||
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_wchar(' ');
|
||||
while (--pad >= 0) n -= lcd_put_lchar(' ');
|
||||
}
|
||||
|
||||
if (plen) n = lcd_put_u8str_ind_P(pstr, itemIndex, itemString, n / (MENU_FONT_WIDTH)) * (MENU_FONT_WIDTH);
|
||||
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_wchar(' ');
|
||||
while (n > MENU_FONT_WIDTH) n -= lcd_put_lchar(' ');
|
||||
}
|
||||
}
|
||||
|
||||
// Draw a generic menu item
|
||||
void MenuItemBase::_draw(const bool sel, const uint8_t row, PGM_P const pstr, const char, const char post_char) {
|
||||
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_ind_P(pstr, itemIndex, itemString, LCD_WIDTH - 1) * (MENU_FONT_WIDTH);
|
||||
while (n > MENU_FONT_WIDTH) n -= lcd_put_wchar(' ');
|
||||
lcd_put_wchar(LCD_PIXEL_WIDTH - (MENU_FONT_WIDTH), row_y2, post_char);
|
||||
lcd_put_wchar(' ');
|
||||
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(' ');
|
||||
lcd_put_lchar(LCD_PIXEL_WIDTH - (MENU_FONT_WIDTH), row_y2, post_char);
|
||||
lcd_put_lchar(' ');
|
||||
}
|
||||
}
|
||||
|
||||
// Draw a menu item with an editable value
|
||||
void MenuEditItemBase::draw(const bool sel, const uint8_t row, PGM_P const pstr, const char * const inStr, const bool pgm) {
|
||||
void MenuEditItemBase::draw(const bool sel, const uint8_t row, FSTR_P const ftpl, const char * const inStr, const bool pgm) {
|
||||
if (mark_as_selected(row, sel)) {
|
||||
const uint8_t vallen = (pgm ? utf8_strlen_P(inStr) : utf8_strlen((char*)inStr)),
|
||||
pixelwidth = (pgm ? uxg_GetUtf8StrPixelWidthP(u8g.getU8g(), inStr) : uxg_GetUtf8StrPixelWidth(u8g.getU8g(), (char*)inStr));
|
||||
const uint8_t vallen = (pgm ? utf8_strlen_P(inStr) : utf8_strlen(inStr)),
|
||||
pixelwidth = (pgm ? uxg_GetUtf8StrPixelWidthP(u8g.getU8g(), inStr) : uxg_GetUtf8StrPixelWidth(u8g.getU8g(), inStr));
|
||||
const u8g_uint_t prop = USE_WIDE_GLYPH ? 2 : 1;
|
||||
|
||||
pixel_len_t n = lcd_put_u8str_ind_P(pstr, itemIndex, itemString, LCD_WIDTH - 2 - vallen * prop) * (MENU_FONT_WIDTH);
|
||||
pixel_len_t n = lcd_put_u8str(ftpl, itemIndex, itemStringC, itemStringF, LCD_WIDTH - 2 - vallen * prop) * (MENU_FONT_WIDTH);
|
||||
if (vallen) {
|
||||
lcd_put_wchar(':');
|
||||
while (n > MENU_FONT_WIDTH) n -= lcd_put_wchar(' ');
|
||||
lcd_put_lchar(':');
|
||||
while (n > MENU_FONT_WIDTH) n -= lcd_put_lchar(' ');
|
||||
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((char*)inStr);
|
||||
if (pgm) lcd_put_u8str_P(inStr); else lcd_put_u8str(inStr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MenuEditItemBase::draw_edit_screen(PGM_P const pstr, const char * const value/*=nullptr*/) {
|
||||
void MenuEditItemBase::draw_edit_screen(FSTR_P const ftpl, const char * const value/*=nullptr*/) {
|
||||
ui.encoder_direction_normal();
|
||||
|
||||
const u8g_uint_t prop = USE_WIDE_GLYPH ? 2 : 1;
|
||||
const u8g_uint_t labellen = utf8_strlen_P(pstr), vallen = utf8_strlen(value);
|
||||
const u8g_uint_t labellen = utf8_strlen(ftpl), vallen = utf8_strlen(value);
|
||||
bool extra_row = labellen * prop > LCD_WIDTH - 2 - vallen * prop;
|
||||
|
||||
#if ENABLED(USE_BIG_EDIT_FONT)
|
||||
@@ -479,26 +490,26 @@ 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_put_u8str_ind_P(0, baseline, pstr, itemIndex, itemString);
|
||||
if (onpage) lcd_put_u8str(0, baseline, ftpl, itemIndex, itemStringC, itemStringF);
|
||||
|
||||
// If a value is included, print a colon, then print the value right-justified
|
||||
if (value) {
|
||||
lcd_put_wchar(':');
|
||||
lcd_put_lchar(':');
|
||||
if (extra_row) {
|
||||
// Assume that value is numeric (with no descender)
|
||||
baseline += EDIT_FONT_ASCENT + 2;
|
||||
onpage = PAGE_CONTAINS(baseline - (EDIT_FONT_ASCENT - 1), baseline);
|
||||
}
|
||||
if (onpage) {
|
||||
lcd_put_wchar(((lcd_chr_fit - 1) - (vallen * prop + 1)) * one_chr_width, baseline, ' '); // Right-justified, padded, add a leading space
|
||||
lcd_put_lchar(((lcd_chr_fit - 1) - (vallen * prop + 1)) * one_chr_width, baseline, ' '); // Right-justified, padded, add a leading space
|
||||
lcd_put_u8str(value);
|
||||
}
|
||||
}
|
||||
TERN_(USE_BIG_EDIT_FONT, ui.set_font(FONT_MENU));
|
||||
}
|
||||
|
||||
inline void draw_boxed_string(const u8g_uint_t x, const u8g_uint_t y, PGM_P const pstr, const bool inv) {
|
||||
const u8g_uint_t len = utf8_strlen_P(pstr),
|
||||
inline void draw_boxed_string(const u8g_uint_t x, const u8g_uint_t y, FSTR_P const fstr, const bool inv) {
|
||||
const u8g_uint_t len = utf8_strlen(fstr),
|
||||
by = (y + 1) * (MENU_FONT_HEIGHT);
|
||||
const u8g_uint_t prop = USE_WIDE_GLYPH ? 2 : 1;
|
||||
const pixel_len_t bw = len * prop * (MENU_FONT_WIDTH), bx = x * prop * (MENU_FONT_WIDTH);
|
||||
@@ -507,25 +518,25 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
|
||||
u8g.drawBox(bx / prop - 1, by - (MENU_FONT_ASCENT), bw + 2, MENU_FONT_HEIGHT);
|
||||
u8g.setColorIndex(0);
|
||||
}
|
||||
lcd_put_u8str_P(bx / prop, by, pstr);
|
||||
lcd_put_u8str(bx / prop, by, fstr);
|
||||
if (inv) u8g.setColorIndex(1);
|
||||
}
|
||||
|
||||
void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const bool yesno, PGM_P const pref, const char * const string/*=nullptr*/, PGM_P const suff/*=nullptr*/) {
|
||||
ui.draw_select_screen_prompt(pref, string, suff);
|
||||
draw_boxed_string(1, LCD_HEIGHT - 1, no, !yesno);
|
||||
draw_boxed_string(LCD_WIDTH - (utf8_strlen_P(yes) * (USE_WIDE_GLYPH ? 2 : 1) + 1), LCD_HEIGHT - 1, yes, yesno);
|
||||
void MenuItem_confirm::draw_select_screen(FSTR_P const yes, FSTR_P const no, const bool yesno, FSTR_P const fpre, const char * const string/*=nullptr*/, FSTR_P const suff/*=nullptr*/) {
|
||||
ui.draw_select_screen_prompt(fpre, string, suff);
|
||||
if (no) draw_boxed_string(1, LCD_HEIGHT - 1, no, !yesno);
|
||||
if (yes) draw_boxed_string(LCD_WIDTH - (utf8_strlen(yes) * (USE_WIDE_GLYPH ? 2 : 1) + 1), LCD_HEIGHT - 1, yes, yesno);
|
||||
}
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
|
||||
void MenuItem_sdbase::draw(const bool sel, const uint8_t row, PGM_P const, CardReader &theCard, const bool isDir) {
|
||||
void MenuItem_sdbase::draw(const bool sel, const uint8_t row, FSTR_P const, CardReader &theCard, const bool isDir) {
|
||||
if (mark_as_selected(row, sel)) {
|
||||
const uint8_t maxlen = LCD_WIDTH - isDir;
|
||||
if (isDir) lcd_put_wchar(LCD_STR_FOLDER[0]);
|
||||
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_wchar(' ');
|
||||
while (n > MENU_FONT_WIDTH) n -= lcd_put_lchar(' ');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -568,9 +579,9 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
|
||||
u8g.setColorIndex(1);
|
||||
const u8g_uint_t sx = x_offset + pixels_per_x_mesh_pnt / 2;
|
||||
u8g_uint_t y = y_offset + pixels_per_y_mesh_pnt / 2;
|
||||
for (uint8_t j = 0; j < GRID_MAX_POINTS_Y; j++, y += pixels_per_y_mesh_pnt)
|
||||
for (uint8_t j = 0; j < (GRID_MAX_POINTS_Y); j++, y += pixels_per_y_mesh_pnt)
|
||||
if (PAGE_CONTAINS(y, y))
|
||||
for (uint8_t i = 0, x = sx; i < GRID_MAX_POINTS_X; i++, x += pixels_per_x_mesh_pnt)
|
||||
for (uint8_t i = 0, x = sx; i < (GRID_MAX_POINTS_X); i++, x += pixels_per_x_mesh_pnt)
|
||||
u8g.drawBox(x, y, 1, 1);
|
||||
|
||||
// Fill in the Specified Mesh Point
|
||||
@@ -590,7 +601,7 @@ 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)) {
|
||||
const xy_pos_t pos = { ubl.mesh_index_to_xpos(x_plot), ubl.mesh_index_to_ypos(y_plot) },
|
||||
const xy_pos_t pos = { bedlevel.get_mesh_x(x_plot), bedlevel.get_mesh_y(y_plot) },
|
||||
lpos = pos.asLogical();
|
||||
lcd_put_u8str_P(5, 7, X_LBL);
|
||||
lcd_put_u8str(ftostr52(lpos.x));
|
||||
@@ -600,18 +611,18 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
|
||||
|
||||
// Print plot position
|
||||
if (PAGE_CONTAINS(LCD_PIXEL_HEIGHT - (INFO_FONT_HEIGHT - 1), LCD_PIXEL_HEIGHT)) {
|
||||
lcd_put_wchar(5, LCD_PIXEL_HEIGHT, '(');
|
||||
lcd_put_lchar(5, LCD_PIXEL_HEIGHT, '(');
|
||||
u8g.print(x_plot);
|
||||
lcd_put_wchar(',');
|
||||
lcd_put_lchar(',');
|
||||
u8g.print(y_plot);
|
||||
lcd_put_wchar(')');
|
||||
lcd_put_lchar(')');
|
||||
|
||||
// Show the location value
|
||||
lcd_put_u8str_P(74, LCD_PIXEL_HEIGHT, Z_LBL);
|
||||
if (!isnan(ubl.z_values[x_plot][y_plot]))
|
||||
lcd_put_u8str(ftostr43sign(ubl.z_values[x_plot][y_plot]));
|
||||
if (!isnan(bedlevel.z_values[x_plot][y_plot]))
|
||||
lcd_put_u8str(ftostr43sign(bedlevel.z_values[x_plot][y_plot]));
|
||||
else
|
||||
lcd_put_u8str_P(PSTR(" -----"));
|
||||
lcd_put_u8str(F(" -----"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -715,15 +726,7 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
|
||||
B00001100,B00000000
|
||||
};
|
||||
|
||||
void _lcd_zoffset_overlay_gfx(const_float_t zvalue) {
|
||||
// Determine whether the user is raising or lowering the nozzle.
|
||||
static int8_t dir;
|
||||
static float old_zvalue;
|
||||
if (zvalue != old_zvalue) {
|
||||
dir = zvalue ? zvalue < old_zvalue ? -1 : 1 : 0;
|
||||
old_zvalue = zvalue;
|
||||
}
|
||||
|
||||
void MarlinUI::zoffset_overlay(const int8_t dir) {
|
||||
const unsigned char *rot_up = TERN(OVERLAY_GFX_REVERSE, ccw_bmp, cw_bmp),
|
||||
*rot_down = TERN(OVERLAY_GFX_REVERSE, cw_bmp, ccw_bmp);
|
||||
|
||||
@@ -746,6 +749,6 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
|
||||
|
||||
#endif // BABYSTEP_ZPROBE_GFX_OVERLAY || MESH_EDIT_GFX_OVERLAY
|
||||
|
||||
#endif // HAS_LCD_MENU
|
||||
#endif // HAS_MARLINUI_MENU
|
||||
|
||||
#endif // HAS_MARLINUI_U8GLIB
|
||||
|
@@ -43,7 +43,7 @@
|
||||
#define U8G_PARAM LCD_PINS_D4, LCD_PINS_ENABLE, LCD_PINS_RS
|
||||
#endif
|
||||
|
||||
#elif ENABLED(U8GLIB_ST7920)
|
||||
#elif IS_U8GLIB_ST7920
|
||||
|
||||
// RepRap Discount Full Graphics Smart Controller
|
||||
// and other variant LCDs using ST7920
|
||||
@@ -72,7 +72,7 @@
|
||||
#define U8G_CLASS U8GLIB_DOGM128_2X // 4 stripes (HW-SPI)
|
||||
#endif
|
||||
|
||||
#elif ENABLED(U8GLIB_LM6059_AF)
|
||||
#elif IS_U8GLIB_LM6059_AF
|
||||
|
||||
// Based on the Adafruit ST7565 (https://www.adafruit.com/products/250)
|
||||
|
||||
@@ -82,7 +82,7 @@
|
||||
#define U8G_CLASS U8GLIB_LM6059_2X // 4 stripes (HW-SPI)
|
||||
#endif
|
||||
|
||||
#elif ENABLED(U8GLIB_ST7565_64128N)
|
||||
#elif IS_U8GLIB_ST7565_64128N
|
||||
|
||||
// MaKrPanel, Mini Viki, Viki 2.0, AZSMZ 12864 ST7565 controller
|
||||
|
||||
|
@@ -42,6 +42,18 @@
|
||||
B00000011,B11111111,B11111111
|
||||
};
|
||||
|
||||
#if HAS_LEVELING
|
||||
const unsigned char status_bed_leveled_bmp[] PROGMEM = {
|
||||
B11111111,B11111111,B11001110,
|
||||
B01000000,B00100000,B00100100,
|
||||
B00100000,B00010000,B00010000,
|
||||
B00011111,B11111111,B11111000,
|
||||
B00001000,B00000100,B00000100,
|
||||
B00100100,B00000010,B00000010,
|
||||
B01110011,B11111111,B11111111
|
||||
};
|
||||
#endif
|
||||
|
||||
const unsigned char status_bed_on_bmp[] PROGMEM = {
|
||||
B00000010,B00100010,B00000000,
|
||||
B00000100,B01000100,B00000000,
|
||||
@@ -57,6 +69,23 @@
|
||||
B00000011,B11111111,B11111111
|
||||
};
|
||||
|
||||
#if HAS_LEVELING
|
||||
const unsigned char status_bed_leveled_on_bmp[] PROGMEM = {
|
||||
B00000010,B00100010,B00000000,
|
||||
B00000100,B01000100,B00000000,
|
||||
B00000100,B01000100,B00000000,
|
||||
B00000010,B00100010,B00000000,
|
||||
B00000001,B00010001,B00000000,
|
||||
B11111111,B11111111,B11001110,
|
||||
B01000000,B10101000,B10100100,
|
||||
B00100001,B00010001,B00010000,
|
||||
B00011111,B11111111,B11111000,
|
||||
B00001000,B00000100,B00000100,
|
||||
B00100100,B00000010,B00000010,
|
||||
B01110011,B11111111,B11111111
|
||||
};
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#define STATUS_BED_WIDTH 21
|
||||
|
@@ -37,6 +37,7 @@
|
||||
#if HOTENDS == 0
|
||||
|
||||
#define STATUS_HEATERS_WIDTH 96
|
||||
#define STATUS_BED_X 74
|
||||
|
||||
const unsigned char status_heaters_bmp[] PROGMEM = {
|
||||
B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000100,B00010000,B01000000,
|
||||
@@ -56,6 +57,7 @@
|
||||
#elif HOTENDS == 1
|
||||
|
||||
#define STATUS_HEATERS_WIDTH 96
|
||||
#define STATUS_BED_X 74
|
||||
|
||||
const unsigned char status_heaters_bmp[] PROGMEM = {
|
||||
B00011111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000100,B00010000,B01000000,
|
||||
@@ -75,6 +77,7 @@
|
||||
#elif HOTENDS == 2
|
||||
|
||||
#define STATUS_HEATERS_WIDTH 96
|
||||
#define STATUS_BED_X 74
|
||||
|
||||
const unsigned char status_heaters_bmp[] PROGMEM = {
|
||||
B00011111,B11100000,B00000000,B00011111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000100,B00010000,B01000000,
|
||||
@@ -104,6 +107,7 @@
|
||||
#elif HOTENDS == 3
|
||||
|
||||
#define STATUS_HEATERS_WIDTH 96
|
||||
#define STATUS_BED_X 74
|
||||
|
||||
const unsigned char status_heaters_bmp[] PROGMEM = {
|
||||
B00011111,B11100000,B00000000,B00011111,B11100000,B00000000,B00011111,B11100000,B00000000,B00000100,B00010000,B01000000,
|
||||
@@ -133,6 +137,7 @@
|
||||
#else // HOTENDS > 3
|
||||
|
||||
#define STATUS_HEATERS_WIDTH 120
|
||||
#define STATUS_BED_X 98
|
||||
|
||||
const unsigned char status_heaters_bmp[] PROGMEM = {
|
||||
B00011111,B11100000,B00000000,B00011111,B11100000,B00000000,B00011111,B11100000,B00000000,B00011111,B11100000,B00000000,B00000100,B00010000,B01000000,
|
||||
@@ -161,7 +166,8 @@
|
||||
|
||||
#endif // HOTENDS
|
||||
|
||||
#define STATUS_BED_TEXT_X (STATUS_HEATERS_WIDTH - 10)
|
||||
#define STATUS_BED_WIDTH 20
|
||||
#define STATUS_BED_TEXT_X (STATUS_BED_X + STATUS_BED_WIDTH / 2)
|
||||
|
||||
#else // !HAS_HEATED_BED || HOTENDS > 3
|
||||
|
||||
|
@@ -49,6 +49,10 @@
|
||||
#include "../../module/planner.h"
|
||||
#endif
|
||||
|
||||
#if HAS_LEVELING
|
||||
#include "../../module/planner.h"
|
||||
#endif
|
||||
|
||||
#if HAS_CUTTER
|
||||
#include "../../feature/spindle_laser.h"
|
||||
#endif
|
||||
@@ -57,7 +61,7 @@
|
||||
#include "../../feature/cooler.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(I2C_AMMETER)
|
||||
#if DO_DRAW_AMMETER
|
||||
#include "../../feature/ammeter.h"
|
||||
#endif
|
||||
|
||||
@@ -191,12 +195,12 @@
|
||||
|
||||
FORCE_INLINE void _draw_centered_temp(const celsius_t temp, const uint8_t tx, const uint8_t ty) {
|
||||
if (temp < 0)
|
||||
lcd_put_u8str(tx - 3 * (INFO_FONT_WIDTH) / 2 + 1, ty, "err");
|
||||
lcd_put_u8str(tx - 3 * (INFO_FONT_WIDTH) / 2 + 1, ty, F("err"));
|
||||
else {
|
||||
const char *str = i16tostr3rj(temp);
|
||||
const uint8_t len = str[0] != ' ' ? 3 : str[1] != ' ' ? 2 : 1;
|
||||
lcd_put_u8str(tx - len * (INFO_FONT_WIDTH) / 2 + 1, ty, &str[3-len]);
|
||||
lcd_put_wchar(LCD_STR_DEGREE[0]);
|
||||
lcd_put_lchar(LCD_STR_DEGREE[0]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -428,15 +432,15 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const
|
||||
const bool is_inch = parser.using_inch_units();
|
||||
const AxisEnum a = TERN(LCD_SHOW_E_TOTAL, axis == E_AXIS ? X_AXIS : axis, axis);
|
||||
const uint8_t offs = a * (is_inch ? XYZ_SPACING_IN : XYZ_SPACING);
|
||||
lcd_put_wchar((is_inch ? X_LABEL_POS_IN : X_LABEL_POS) + offs, XYZ_BASELINE, axis_codes[axis]);
|
||||
lcd_put_lchar((is_inch ? X_LABEL_POS_IN : X_LABEL_POS) + offs, XYZ_BASELINE, AXIS_CHAR(axis));
|
||||
lcd_moveto((is_inch ? X_VALUE_POS_IN : X_VALUE_POS) + offs, XYZ_BASELINE);
|
||||
|
||||
if (blink)
|
||||
lcd_put_u8str(value);
|
||||
else if (axis_should_home(axis))
|
||||
while (const char c = *value++) lcd_put_wchar(c <= '.' ? c : '?');
|
||||
while (const char c = *value++) lcd_put_lchar(c <= '.' ? c : '?');
|
||||
else if (NONE(HOME_AFTER_DEACTIVATE, DISABLE_REDUCED_ACCURACY_WARNING) && !axis_is_trusted(axis))
|
||||
lcd_put_u8str_P(axis == Z_AXIS ? PSTR(" ") : PSTR(" "));
|
||||
lcd_put_u8str(axis == Z_AXIS ? F(" ") : F(" "));
|
||||
else
|
||||
lcd_put_u8str(value);
|
||||
}
|
||||
@@ -602,7 +606,13 @@ void MarlinUI::draw_status_screen() {
|
||||
|
||||
#if DO_DRAW_BED && DISABLED(STATUS_COMBINE_HEATERS)
|
||||
#if ANIM_BED
|
||||
#define BED_BITMAP(S) ((S) ? status_bed_on_bmp : status_bed_bmp)
|
||||
#if BOTH(HAS_LEVELING, STATUS_ALT_BED_BITMAP)
|
||||
#define BED_BITMAP(S) ((S) \
|
||||
? (planner.leveling_active ? status_bed_leveled_on_bmp : status_bed_on_bmp) \
|
||||
: (planner.leveling_active ? status_bed_leveled_bmp : status_bed_bmp))
|
||||
#else
|
||||
#define BED_BITMAP(S) ((S) ? status_bed_on_bmp : status_bed_bmp)
|
||||
#endif
|
||||
#else
|
||||
#define BED_BITMAP(S) status_bed_bmp
|
||||
#endif
|
||||
@@ -660,12 +670,12 @@ void MarlinUI::draw_status_screen() {
|
||||
|
||||
// Laser / Spindle
|
||||
#if DO_DRAW_CUTTER
|
||||
if (cutter.isReady && PAGE_CONTAINS(STATUS_CUTTER_TEXT_Y - INFO_FONT_ASCENT, STATUS_CUTTER_TEXT_Y - 1)) {
|
||||
if (cutter.isReadyForUI && PAGE_CONTAINS(STATUS_CUTTER_TEXT_Y - INFO_FONT_ASCENT, STATUS_CUTTER_TEXT_Y - 1)) {
|
||||
#if CUTTER_UNIT_IS(PERCENT)
|
||||
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, ftostr51rj(float(cutter.unitPower) / 1000));
|
||||
lcd_put_wchar('K');
|
||||
lcd_put_u8str(STATUS_CUTTER_TEXT_X - 2, STATUS_CUTTER_TEXT_Y, ftostr61rj(float(cutter.unitPower) / 1000));
|
||||
lcd_put_lchar('K');
|
||||
#else
|
||||
lcd_put_u8str(STATUS_CUTTER_TEXT_X, STATUS_CUTTER_TEXT_Y, cutter_power2str(cutter.unitPower));
|
||||
#endif
|
||||
@@ -724,7 +734,7 @@ void MarlinUI::draw_status_screen() {
|
||||
}
|
||||
#endif
|
||||
lcd_put_u8str(STATUS_FAN_TEXT_X, STATUS_FAN_TEXT_Y, i16tostr3rj(thermalManager.pwmToPercent(spd)));
|
||||
lcd_put_wchar(c);
|
||||
lcd_put_lchar(c);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -773,15 +783,15 @@ void MarlinUI::draw_status_screen() {
|
||||
if (progress_state == 0) {
|
||||
if (progress_string[0]) {
|
||||
lcd_put_u8str(progress_x_pos, EXTRAS_BASELINE, progress_string);
|
||||
lcd_put_wchar('%');
|
||||
lcd_put_lchar('%');
|
||||
}
|
||||
}
|
||||
else if (progress_state == 2 && estimation_string[0]) {
|
||||
lcd_put_u8str_P(PROGRESS_BAR_X, EXTRAS_BASELINE, PSTR("R:"));
|
||||
lcd_put_u8str(PROGRESS_BAR_X, EXTRAS_BASELINE, F("R:"));
|
||||
lcd_put_u8str(estimation_x_pos, EXTRAS_BASELINE, estimation_string);
|
||||
}
|
||||
else if (elapsed_string[0]) {
|
||||
lcd_put_u8str_P(PROGRESS_BAR_X, EXTRAS_BASELINE, E_LBL);
|
||||
lcd_put_u8str(PROGRESS_BAR_X, EXTRAS_BASELINE, F("E:"));
|
||||
lcd_put_u8str(elapsed_x_pos, EXTRAS_BASELINE, elapsed_string);
|
||||
}
|
||||
|
||||
@@ -794,7 +804,7 @@ void MarlinUI::draw_status_screen() {
|
||||
#if ENABLED(SHOW_SD_PERCENT)
|
||||
if (progress_string[0]) {
|
||||
lcd_put_u8str(55, EXTRAS_BASELINE, progress_string); // Percent complete
|
||||
lcd_put_wchar('%');
|
||||
lcd_put_lchar('%');
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -804,7 +814,7 @@ void MarlinUI::draw_status_screen() {
|
||||
|
||||
#if ENABLED(SHOW_REMAINING_TIME)
|
||||
if (blink && estimation_string[0]) {
|
||||
lcd_put_wchar(estimation_x_pos, EXTRAS_BASELINE, 'R');
|
||||
lcd_put_lchar(estimation_x_pos, EXTRAS_BASELINE, 'R');
|
||||
lcd_put_u8str(estimation_string);
|
||||
}
|
||||
else
|
||||
@@ -862,24 +872,22 @@ void MarlinUI::draw_status_screen() {
|
||||
mix_label = PSTR("Mx");
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#if GCC_VERSION <= 50000
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wformat-overflow"
|
||||
#endif
|
||||
|
||||
sprintf_P(mixer_messages, PSTR(S_FMT " %d;%d%% "), mix_label, int(mixer.mix[0]), int(mixer.mix[1]));
|
||||
lcd_put_u8str(X_LABEL_POS, XYZ_BASELINE, mixer_messages);
|
||||
|
||||
#if GCC_VERSION <= 50000
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
#else
|
||||
|
||||
if (show_e_total) {
|
||||
#if ENABLED(LCD_SHOW_E_TOTAL)
|
||||
_draw_axis_value(E_AXIS, xstring, true);
|
||||
lcd_put_u8str_P(PSTR(" "));
|
||||
lcd_put_u8str(F(" "));
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
@@ -904,11 +912,11 @@ void MarlinUI::draw_status_screen() {
|
||||
|
||||
if (PAGE_CONTAINS(EXTRAS_2_BASELINE - INFO_FONT_ASCENT, EXTRAS_2_BASELINE - 1)) {
|
||||
set_font(FONT_MENU);
|
||||
lcd_put_wchar(3, EXTRAS_2_BASELINE, LCD_STR_FEEDRATE[0]);
|
||||
lcd_put_lchar(3, EXTRAS_2_BASELINE, LCD_STR_FEEDRATE[0]);
|
||||
|
||||
set_font(FONT_STATUSMENU);
|
||||
lcd_put_u8str(12, EXTRAS_2_BASELINE, i16tostr3rj(feedrate_percentage));
|
||||
lcd_put_wchar('%');
|
||||
lcd_put_lchar('%');
|
||||
|
||||
//
|
||||
// Filament sensor display if SD is disabled
|
||||
@@ -916,10 +924,10 @@ 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_wchar('%');
|
||||
lcd_put_lchar('%');
|
||||
set_font(FONT_MENU);
|
||||
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]);
|
||||
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]);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -932,13 +940,13 @@ void MarlinUI::draw_status_screen() {
|
||||
#if BOTH(FILAMENT_LCD_DISPLAY, SDSUPPORT)
|
||||
// Alternate Status message and Filament display
|
||||
if (ELAPSED(millis(), next_filament_display)) {
|
||||
lcd_put_u8str_P(PSTR(LCD_STR_FILAM_DIA));
|
||||
lcd_put_wchar(':');
|
||||
lcd_put_u8str(F(LCD_STR_FILAM_DIA));
|
||||
lcd_put_lchar(':');
|
||||
lcd_put_u8str(wstring);
|
||||
lcd_put_u8str_P(PSTR(" " LCD_STR_FILAM_MUL));
|
||||
lcd_put_wchar(':');
|
||||
lcd_put_u8str(F(" " LCD_STR_FILAM_MUL));
|
||||
lcd_put_lchar(':');
|
||||
lcd_put_u8str(mstring);
|
||||
lcd_put_wchar('%');
|
||||
lcd_put_lchar('%');
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@@ -971,7 +979,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_wchar(' '); ++slen; }
|
||||
while (slen < lcd_width) { lcd_put_lchar(' '); ++slen; }
|
||||
}
|
||||
else {
|
||||
// String is longer than the available space
|
||||
@@ -989,14 +997,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_wchar(' '); // Always at 1+ spaces left, draw a space
|
||||
lcd_put_lchar(' '); // Always at 1+ spaces left, draw a space
|
||||
if (--chars) { // Draw a second space if there's room
|
||||
lcd_put_wchar(' ');
|
||||
lcd_put_lchar(' ');
|
||||
if (--chars) { // Draw a third space if there's room
|
||||
lcd_put_wchar(' ');
|
||||
lcd_put_lchar(' ');
|
||||
if (--chars) { // Print a second copy of the message
|
||||
lcd_put_u8str_max(status_message, pixel_width - (rlen + 2) * (MENU_FONT_WIDTH));
|
||||
lcd_put_wchar(' ');
|
||||
lcd_put_lchar(' ');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1011,7 +1019,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_wchar(' ');
|
||||
for (; slen < lcd_width; ++slen) lcd_put_lchar(' ');
|
||||
|
||||
#endif // !STATUS_MESSAGE_SCROLLING
|
||||
|
||||
|
@@ -99,9 +99,9 @@ void ST7920_Lite_Status_Screen::write_str(const char *str, uint8_t len) {
|
||||
while (*str && len--) write_byte(*str++);
|
||||
}
|
||||
|
||||
void ST7920_Lite_Status_Screen::write_str_P(PGM_P const str) {
|
||||
PGM_P p_str = (PGM_P)str;
|
||||
while (char c = pgm_read_byte(p_str++)) write_byte(c);
|
||||
void ST7920_Lite_Status_Screen::write_str(FSTR_P const fstr) {
|
||||
PGM_P pstr = FTOP(fstr);
|
||||
while (char c = pgm_read_byte(pstr++)) write_byte(c);
|
||||
}
|
||||
|
||||
void ST7920_Lite_Status_Screen::write_number(const int16_t value, const uint8_t digits/*=3*/) {
|
||||
@@ -500,11 +500,11 @@ void ST7920_Lite_Status_Screen::draw_progress_bar(const uint8_t value) {
|
||||
// Draw centered
|
||||
if (value > 9) {
|
||||
write_number(value, 4);
|
||||
write_str_P(PSTR("% "));
|
||||
write_str(F("% "));
|
||||
}
|
||||
else {
|
||||
write_number(value, 3);
|
||||
write_str_P(PSTR("% "));
|
||||
write_str(F("% "));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -559,7 +559,7 @@ void ST7920_Lite_Status_Screen::draw_temps(uint8_t line, const int16_t temp, con
|
||||
};
|
||||
|
||||
if (targetStateChange) {
|
||||
if (!showTarget) write_str_P(PSTR(" "));
|
||||
if (!showTarget) write_str(F(" "));
|
||||
draw_degree_symbol(5, line, !showTarget);
|
||||
draw_degree_symbol(9, line, showTarget);
|
||||
}
|
||||
@@ -672,14 +672,7 @@ void ST7920_Lite_Status_Screen::draw_position(const xyze_pos_t &pos, const bool
|
||||
// If position is unknown, flash the labels.
|
||||
const unsigned char alt_label = position_trusted ? 0 : (ui.get_blink() ? ' ' : 0);
|
||||
|
||||
if (TERN1(LCD_SHOW_E_TOTAL, !printingIsActive())) {
|
||||
write_byte(alt_label ? alt_label : 'X');
|
||||
write_str(dtostrf(pos.x, -4, 0, str), 4);
|
||||
|
||||
write_byte(alt_label ? alt_label : 'Y');
|
||||
write_str(dtostrf(pos.y, -4, 0, str), 4);
|
||||
}
|
||||
else {
|
||||
if (TERN0(LCD_SHOW_E_TOTAL, printingIsActive())) {
|
||||
#if ENABLED(LCD_SHOW_E_TOTAL)
|
||||
char tmp[15];
|
||||
const uint8_t escale = e_move_accumulator >= 100000.0f ? 10 : 1; // After 100m switch to cm
|
||||
@@ -687,6 +680,13 @@ void ST7920_Lite_Status_Screen::draw_position(const xyze_pos_t &pos, const bool
|
||||
write_str(tmp);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
write_byte(alt_label ? alt_label : 'X');
|
||||
write_str(dtostrf(pos.x, -4, 0, str), 4);
|
||||
|
||||
write_byte(alt_label ? alt_label : 'Y');
|
||||
write_str(dtostrf(pos.y, -4, 0, str), 4);
|
||||
}
|
||||
|
||||
write_byte(alt_label ? alt_label : 'Z');
|
||||
write_str(dtostrf(pos.z, -5, 1, str), 5);
|
||||
|
@@ -46,7 +46,7 @@ class ST7920_Lite_Status_Screen {
|
||||
|
||||
static void write_str(const char *str);
|
||||
static void write_str(const char *str, const uint8_t len);
|
||||
static void write_str_P(PGM_P const str);
|
||||
static void write_str(FSTR_P const fstr);
|
||||
static void write_number(const int16_t value, const uint8_t digits=3);
|
||||
|
||||
static void _extended_function_set(const bool extended, const bool graphics);
|
||||
|
@@ -63,6 +63,9 @@
|
||||
#define WIDTH 128
|
||||
#define HEIGHT 64
|
||||
#define PAGE_HEIGHT 8
|
||||
#ifndef ST7565_XOFFSET
|
||||
#define ST7565_XOFFSET 0x00
|
||||
#endif
|
||||
|
||||
#define ST7565_ADC_REVERSE(N) ((N) ? 0xA1 : 0xA0)
|
||||
#define ST7565_BIAS_MODE(N) ((N) ? 0xA3 : 0xA2)
|
||||
@@ -71,7 +74,6 @@
|
||||
#define ST7565_ON(N) ((N) ? 0xAF : 0xAE)
|
||||
#define ST7565_OUT_MODE(N) ((N) ? 0xC8 : 0xC0)
|
||||
#define ST7565_POWER_CONTROL(N) (0x28 | (N))
|
||||
#define ST7565_V0_RATIO(N) (0x10 | ((N) & 0x7))
|
||||
#define ST7565_V5_RATIO(N) (0x20 | ((N) & 0x7))
|
||||
#define ST7565_CONTRAST(N) (0x81), (N)
|
||||
|
||||
@@ -103,11 +105,14 @@ static const uint8_t u8g_dev_st7565_64128n_HAL_init_seq[] PROGMEM = {
|
||||
ST7565_POWER_CONTROL(0x7), // power control: turn on voltage follower
|
||||
U8G_ESC_DLY(50), // delay 50 ms
|
||||
|
||||
ST7565_V0_RATIO(0), // Set V0 voltage resistor ratio. Setting for controlling brightness of Displaytech 64128N
|
||||
#ifdef ST7565_VOLTAGE_DIVIDER_VALUE
|
||||
// Set V5 voltage resistor ratio. Affects brightness of Displaytech 64128N
|
||||
ST7565_V5_RATIO(ST7565_VOLTAGE_DIVIDER_VALUE),
|
||||
#endif
|
||||
|
||||
ST7565_INVERTED(0), // display normal, bit val 0: LCD pixel off.
|
||||
|
||||
ST7565_CONTRAST(0x1E), // Contrast value. Setting for controlling brightness of Displaytech 64128N
|
||||
ST7565_CONTRAST(0x1E), // Contrast value for Displaytech 64128N
|
||||
|
||||
ST7565_ON(1), // display on
|
||||
|
||||
@@ -123,7 +128,7 @@ static const uint8_t u8g_dev_st7565_64128n_HAL_init_seq[] PROGMEM = {
|
||||
static const uint8_t u8g_dev_st7565_64128n_HAL_data_start[] PROGMEM = {
|
||||
U8G_ESC_ADR(0), // instruction mode
|
||||
U8G_ESC_CS(1), // enable chip
|
||||
ST7565_COLUMN_ADR(0x00), // high 4 bits to 0, low 4 bits to 0. Changed for DisplayTech 64128N
|
||||
ST7565_COLUMN_ADR(ST7565_XOFFSET), // high 4 bits to 0, low 4 bits to 0. Changed for DisplayTech 64128N
|
||||
U8G_ESC_END // end of sequence
|
||||
};
|
||||
|
||||
|
@@ -78,13 +78,13 @@ TFT_IO tftio;
|
||||
#include "../marlinui.h"
|
||||
#endif
|
||||
|
||||
#if HAS_TOUCH_BUTTONS
|
||||
#include "../touch/touch_buttons.h"
|
||||
#if HAS_TOUCH_SLEEP
|
||||
#define HAS_TOUCH_BUTTONS_SLEEP 1
|
||||
#endif
|
||||
#if HAS_TOUCH_BUTTONS && HAS_TOUCH_SLEEP
|
||||
#define HAS_TOUCH_BUTTONS_SLEEP 1
|
||||
#endif
|
||||
|
||||
#include "../touch/touch_buttons.h"
|
||||
#include "../scaled_tft.h"
|
||||
|
||||
#define X_HI (UPSCALE(TFT_PIXEL_OFFSET_X, WIDTH) - 1)
|
||||
#define Y_HI (UPSCALE(TFT_PIXEL_OFFSET_Y, HEIGHT) - 1)
|
||||
|
||||
@@ -325,6 +325,7 @@ static bool preinit = true;
|
||||
static uint8_t page;
|
||||
|
||||
#if HAS_TOUCH_BUTTONS
|
||||
|
||||
static bool redrawTouchButtons = true;
|
||||
static void drawTouchButtons(u8g_t *u8g, u8g_dev_t *dev) {
|
||||
if (!redrawTouchButtons) return;
|
||||
@@ -343,6 +344,7 @@ static uint8_t page;
|
||||
setWindow(u8g, dev, BUTTONC_X_LO, BUTTON_Y_LO, BUTTONC_X_HI, BUTTON_Y_HI);
|
||||
drawImage(buttonC, u8g, dev, BUTTON_DRAW_WIDTH, BUTTON_DRAW_HEIGHT, TFT_BTOKMENU_COLOR);
|
||||
}
|
||||
|
||||
#endif // HAS_TOUCH_BUTTONS
|
||||
|
||||
static void u8g_upscale_clear_lcd(u8g_t *u8g, u8g_dev_t *dev, uint16_t *buffer) {
|
||||
@@ -395,7 +397,7 @@ uint8_t u8g_dev_tft_320x240_upscale_from_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, u
|
||||
if (!sleepCleared) {
|
||||
sleepCleared = true;
|
||||
u8g_upscale_clear_lcd(u8g, dev, buffer);
|
||||
IF_ENABLED(HAS_TOUCH_BUTTONS, redrawTouchButtons = true);
|
||||
TERN_(HAS_TOUCH_BUTTONS, redrawTouchButtons = true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -515,14 +517,14 @@ U8G_PB_DEV(u8g_dev_tft_320x240_upscale_from_128x64, WIDTH, HEIGHT, PAGE_HEIGHT,
|
||||
drawCross(x, y, TFT_MARLINBG_COLOR);
|
||||
}
|
||||
|
||||
const char *str = nullptr;
|
||||
FSTR_P str = nullptr;
|
||||
if (calibration_stage < CALIBRATION_SUCCESS) {
|
||||
// handle current state
|
||||
switch (calibration_stage) {
|
||||
case CALIBRATION_TOP_LEFT: str = GET_TEXT(MSG_TOP_LEFT); break;
|
||||
case CALIBRATION_BOTTOM_LEFT: str = GET_TEXT(MSG_BOTTOM_LEFT); break;
|
||||
case CALIBRATION_TOP_RIGHT: str = GET_TEXT(MSG_TOP_RIGHT); break;
|
||||
case CALIBRATION_BOTTOM_RIGHT: str = GET_TEXT(MSG_BOTTOM_RIGHT); break;
|
||||
case CALIBRATION_TOP_LEFT: str = GET_TEXT_F(MSG_TOP_LEFT); break;
|
||||
case CALIBRATION_BOTTOM_LEFT: str = GET_TEXT_F(MSG_BOTTOM_LEFT); break;
|
||||
case CALIBRATION_TOP_RIGHT: str = GET_TEXT_F(MSG_TOP_RIGHT); break;
|
||||
case CALIBRATION_BOTTOM_RIGHT: str = GET_TEXT_F(MSG_BOTTOM_RIGHT); break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
@@ -532,7 +534,7 @@ U8G_PB_DEV(u8g_dev_tft_320x240_upscale_from_128x64, WIDTH, HEIGHT, PAGE_HEIGHT,
|
||||
}
|
||||
else {
|
||||
// end calibration
|
||||
str = calibration_stage == CALIBRATION_SUCCESS ? GET_TEXT(MSG_CALIBRATION_COMPLETED) : GET_TEXT(MSG_CALIBRATION_FAILED);
|
||||
str = calibration_stage == CALIBRATION_SUCCESS ? GET_TEXT_F(MSG_CALIBRATION_COMPLETED) : GET_TEXT_F(MSG_CALIBRATION_FAILED);
|
||||
defer_status_screen(false);
|
||||
touch_calibration.calibration_end();
|
||||
TERN_(HAS_TOUCH_BUTTONS, redrawTouchButtons = true);
|
||||
|
@@ -60,11 +60,11 @@ static int fontgroup_init(font_group_t * root, const uxg_fontinfo_t * fntinfo, i
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const font_t* fontgroup_find(font_group_t * root, wchar_t val) {
|
||||
uxg_fontinfo_t vcmp = {(uint16_t)(val / 128), (uint8_t)(val % 128 + 128), (uint8_t)(val % 128 + 128), 0, 0};
|
||||
size_t idx = 0;
|
||||
static const font_t* fontgroup_find(font_group_t * root, const lchar_t &val) {
|
||||
if (val <= 0xFF) return nullptr;
|
||||
|
||||
if (val < 256) return nullptr;
|
||||
uxg_fontinfo_t vcmp = { uint16_t(val >> 7), uint8_t((val & 0x7F) + 0x80), uint8_t((val & 0x7F) + 0x80), 0, 0 };
|
||||
size_t idx = 0;
|
||||
|
||||
if (pf_bsearch_r((void*)root->m_fntifo, root->m_fntinfo_num, pf_bsearch_cb_comp_fntifo_pgm, (void*)&vcmp, &idx) < 0)
|
||||
return nullptr;
|
||||
@@ -73,7 +73,7 @@ static const font_t* fontgroup_find(font_group_t * root, wchar_t val) {
|
||||
return vcmp.fntdata;
|
||||
}
|
||||
|
||||
static void fontgroup_drawwchar(font_group_t *group, const font_t *fnt_default, wchar_t val, void * userdata, fontgroup_cb_draw_t cb_draw_ram) {
|
||||
static void fontgroup_drawwchar(font_group_t *group, const font_t *fnt_default, const lchar_t &val, void * userdata, fontgroup_cb_draw_t cb_draw_ram) {
|
||||
uint8_t buf[2] = {0, 0};
|
||||
const font_t * fntpqm = (font_t*)fontgroup_find(group, val);
|
||||
if (!fntpqm) {
|
||||
@@ -104,12 +104,12 @@ static void fontgroup_drawwchar(font_group_t *group, const font_t *fnt_default,
|
||||
* Get the screen pixel width of a ROM UTF-8 string
|
||||
*/
|
||||
static void fontgroup_drawstring(font_group_t *group, const font_t *fnt_default, const char *utf8_msg, read_byte_cb_t cb_read_byte, void * userdata, fontgroup_cb_draw_t cb_draw_ram) {
|
||||
uint8_t *p = (uint8_t*)utf8_msg;
|
||||
const uint8_t *p = (uint8_t*)utf8_msg;
|
||||
for (;;) {
|
||||
wchar_t val = 0;
|
||||
p = get_utf8_value_cb(p, cb_read_byte, &val);
|
||||
if (!val) break;
|
||||
fontgroup_drawwchar(group, fnt_default, val, userdata, cb_draw_ram);
|
||||
lchar_t wc;
|
||||
p = get_utf8_value_cb(p, cb_read_byte, wc);
|
||||
if (!wc) break;
|
||||
fontgroup_drawwchar(group, fnt_default, wc, userdata, cb_draw_ram);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,19 +149,19 @@ static int fontgroup_cb_draw_u8g(void *userdata, const font_t *fnt_current, cons
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Draw a wchar_t at the specified position
|
||||
* @brief Draw a lchar_t at the specified position
|
||||
*
|
||||
* @param pu8g : U8G pointer
|
||||
* @param x : position x axis
|
||||
* @param y : position y axis
|
||||
* @param ch : the wchar_t
|
||||
* @param wc : the lchar_t
|
||||
* @param max_width : the pixel width of the string allowed
|
||||
*
|
||||
* @return number of pixels advanced
|
||||
*
|
||||
* Draw a UTF-8 string at the specified position
|
||||
*/
|
||||
unsigned int uxg_DrawWchar(u8g_t *pu8g, unsigned int x, unsigned int y, wchar_t ch, pixel_len_t max_width) {
|
||||
unsigned int uxg_DrawWchar(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);
|
||||
@@ -176,7 +176,7 @@ unsigned int uxg_DrawWchar(u8g_t *pu8g, unsigned int x, unsigned int y, wchar_t
|
||||
data.adv = 0;
|
||||
data.max_width = max_width;
|
||||
data.fnt_prev = nullptr;
|
||||
fontgroup_drawwchar(group, fnt_default, ch, (void*)&data, fontgroup_cb_draw_u8g);
|
||||
fontgroup_drawwchar(group, fnt_default, wc, (void*)&data, fontgroup_cb_draw_u8g);
|
||||
u8g_SetFont(pu8g, (const u8g_fntpgm_uint8_t*)fnt_default);
|
||||
|
||||
return data.adv;
|
||||
|
@@ -26,10 +26,10 @@ 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, wchar_t ch, pixel_len_t max_length);
|
||||
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_DrawUtf8Str(u8g_t *pu8g, unsigned int x, unsigned int y, const char *utf8_msg, pixel_len_t max_length);
|
||||
unsigned int uxg_DrawUtf8StrP(u8g_t *pu8g, unsigned int x, unsigned int y, PGM_P utf8_msg, 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);
|
||||
|
||||
int uxg_GetUtf8StrPixelWidth(u8g_t *pu8g, const char *utf8_msg);
|
||||
int uxg_GetUtf8StrPixelWidthP(u8g_t *pu8g, PGM_P utf8_msg);
|
||||
|
@@ -29,7 +29,7 @@
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(U8GLIB_ST7920)
|
||||
#if IS_U8GLIB_ST7920
|
||||
|
||||
#include "ultralcd_st7920_u8glib_rrd_AVR.h"
|
||||
|
||||
@@ -192,5 +192,5 @@ u8g_dev_t u8g_dev_st7920_128x64_rrd_sw_spi = { u8g_dev_rrd_st7920_128x64_fn, &u8
|
||||
void ST7920_write_byte(const uint8_t val) { ST7920_WRITE_BYTE(val); }
|
||||
#endif
|
||||
|
||||
#endif // U8GLIB_ST7920
|
||||
#endif // IS_U8GLIB_ST7920
|
||||
#endif // !U8G_HAL_LINKS && (__AVR__ || ARDUINO_ARCH_STM32 || ARDUINO_ARCH_ESP32)
|
||||
|
Reference in New Issue
Block a user