Fixes for TFTGLCD (#20734)

This commit is contained in:
Serhiy-K 2021-01-11 07:59:42 +02:00 committed by Scott Lahteine
parent be3caa4686
commit 92f847c8f7

View File

@ -313,7 +313,7 @@ void MarlinUI::init_lcd() {
t = 0; t = 0;
#if ENABLED(TFTGLCD_PANEL_SPI) #if ENABLED(TFTGLCD_PANEL_SPI)
// SPI speed must be less 10MHz // SPI speed must be less 10MHz
_SET_OUTPUT(TFTGLCD_CS); SET_OUTPUT(TFTGLCD_CS);
WRITE(TFTGLCD_CS, HIGH); WRITE(TFTGLCD_CS, HIGH);
spiInit(TERN(__STM32F1__, SPI_QUARTER_SPEED, SPI_FULL_SPEED)); spiInit(TERN(__STM32F1__, SPI_QUARTER_SPEED, SPI_FULL_SPEED));
WRITE(TFTGLCD_CS, LOW); WRITE(TFTGLCD_CS, LOW);
@ -855,13 +855,14 @@ void MarlinUI::draw_status_screen() {
void MenuEditItemBase::draw_edit_screen(PGM_P const pstr, const char* const value/*=nullptr*/) { void MenuEditItemBase::draw_edit_screen(PGM_P const pstr, const char* const value/*=nullptr*/) {
if (!PanelDetected) return; if (!PanelDetected) return;
ui.encoder_direction_normal(); ui.encoder_direction_normal();
lcd.setCursor(0, MIDDLE_Y); const uint8_t y = TERN0(AUTO_BED_LEVELING_UBL, ui.external_control) ? LCD_HEIGHT - 1 : MIDDLE_Y;
lcd.setCursor(0, y);
lcd.write(COLOR_EDIT); lcd.write(COLOR_EDIT);
lcd_put_u8str_P(pstr); lcd_put_u8str_P(pstr);
if (value) { if (value) {
lcd.write(':'); lcd.write(':');
lcd.setCursor((LCD_WIDTH - 1) - (utf8_strlen(value) + 1), MIDDLE_Y); // Right-justified, padded by spaces lcd.setCursor((LCD_WIDTH - 1) - (utf8_strlen(value) + 1), y); // Right-justified, padded by spaces
lcd.write(' '); // Overwrite char if value gets shorter lcd.write(' '); // Overwrite char if value gets shorter
lcd.print(value); lcd.print(value);
lcd.write(' '); lcd.write(' ');
lcd.print_line(); lcd.print_line();