From 0b3b4da7d0ec2015ca7b8bd346e4f6af3c6f5886 Mon Sep 17 00:00:00 2001 From: Serhiy-K <52166448+Serhiy-K@users.noreply.github.com> Date: Tue, 22 Dec 2020 14:56:00 +0200 Subject: [PATCH] STM32F1xx support for TFTGLCD (#20515) --- Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp | 6 ++++++ Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp | 12 ++++++------ Marlin/src/pins/stm32f1/pins_MORPHEUS.h | 3 ++- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp index 11bea18c81..549fd7721f 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp +++ b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp @@ -972,6 +972,12 @@ MeshFlags done_flags{0}; const xy_int8_t &lpos = location.pos; + + #if IS_TFTGLCD_PANEL + lcd_mesh_edit_setup(0); // Change current screen before calling ui.ubl_plot + safe_delay(50); + #endif + do { location = find_closest_mesh_point_of_type(SET_IN_BITMAP, pos, false, &done_flags); diff --git a/Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp b/Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp index cadd693f6f..57146519a4 100644 --- a/Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp +++ b/Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp @@ -32,7 +32,7 @@ * and supports color output. */ -#if NONE(__AVR__, TARGET_LPC1768, __STM32F1__, STM32F4xx) +#if NONE(__AVR__, TARGET_LPC1768, STM32F1, STM32F4xx) #warning "Selected platform not yet tested. Please contribute your good pin mappings." #endif @@ -129,7 +129,7 @@ static uint8_t PanelDetected = 0; #if ANY(__AVR__, TARGET_LPC1768, __STM32F1__, ARDUINO_ARCH_SAM, __SAMD51__, __MK20DX256__, __MK64FX512__) #define SPI_SEND_ONE(V) SPI.transfer(V); #define SPI_SEND_TWO(V) SPI.transfer16(V); -#elif defined(STM32F4xx) +#elif EITHER(STM32F4xx, STM32F1xx) #define SPI_SEND_ONE(V) SPI.transfer(V, SPI_CONTINUE); #define SPI_SEND_TWO(V) SPI.transfer16(V, SPI_CONTINUE); #elif defined(ARDUINO_ARCH_ESP32) @@ -139,7 +139,7 @@ static uint8_t PanelDetected = 0; #if ANY(__AVR__, ARDUINO_ARCH_SAM, __SAMD51__, __MK20DX256__, __MK64FX512__) #define SPI_SEND_SOME(V,L,Z) SPI.transfer(&V[Z], L); -#elif defined(STM32F4xx) +#elif EITHER(STM32F4xx, STM32F1xx) #define SPI_SEND_SOME(V,L,Z) SPI.transfer(&V[Z], L, SPI_CONTINUE); #elif ANY(TARGET_LPC1768, __STM32F1__, ARDUINO_ARCH_ESP32) #define SPI_SEND_SOME(V,L,Z) do{ for (uint16_t i = 0; i < L; i++) SPI_SEND_ONE(V[(Z)+i]); }while(0) @@ -276,7 +276,7 @@ uint8_t MarlinUI::read_slow_buttons(void) { Wire.endTransmission(); #ifdef __AVR__ Wire.requestFrom((uint8_t)LCD_I2C_ADDRESS, 2, 0, 0, 1); - #elif defined(__STM32F1__) + #elif defined(STM32F1) Wire.requestFrom((uint8_t)LCD_I2C_ADDRESS, (uint8_t)2); #elif EITHER(STM32F4xx, TARGET_LPC1768) Wire.requestFrom(LCD_I2C_ADDRESS, 2); @@ -330,7 +330,7 @@ void MarlinUI::init_lcd() { Wire.endTransmission(); // send buffer #ifdef __AVR__ Wire.requestFrom((uint8_t)LCD_I2C_ADDRESS, 1, 0, 0, 1); - #elif ANY(__STM32F1__, STM32F4xx, TARGET_LPC1768) + #elif ANY(STM32F1, STM32F4xx, TARGET_LPC1768) Wire.requestFrom(LCD_I2C_ADDRESS, 1); #endif t = (uint8_t)Wire.read(); @@ -626,7 +626,7 @@ Equal to 20x10 text LCD | ttc ttc % | ttc - current temperature | tts tts %%% | tts - setted temperature, %%% - percent for FAN | ICO ICO ICO ICO | ICO - icon 48x48, placed in 2 text lines -| ICO ICO ICO ICO | ICO / +| ICO ICO ICO ICO | ICO or diff --git a/Marlin/src/pins/stm32f1/pins_MORPHEUS.h b/Marlin/src/pins/stm32f1/pins_MORPHEUS.h index ccc92b7527..05e02c9e4d 100644 --- a/Marlin/src/pins/stm32f1/pins_MORPHEUS.h +++ b/Marlin/src/pins/stm32f1/pins_MORPHEUS.h @@ -30,7 +30,7 @@ * MORPHEUS Board pin assignments */ -#if NOT_TARGET(__STM32F1__) +#if NOT_TARGET(__STM32F1__, STM32F1xx) #error "Oops! Select an STM32F1 board in 'Tools > Board.'" #endif @@ -90,3 +90,4 @@ #define LED_PIN PC13 #define SDSS PA3 #define TFTGLCD_CS PA4 +#define SD_DETECT_PIN PC14