From 99fec765c6f23a8855e39179ce3dd326ca366ec8 Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Sat, 28 Aug 2021 22:27:52 +0200 Subject: [PATCH 01/31] Lerdge K: Fix LERDGE_ST7796 TFT_DRIVER Allow also CLASSIC_UI builds (FSMC_CS_PIN & FSMC_RS_PIN) Note: All lerdge boards use the same 3.5" TFT display, so the HAS_FSMC_TFT section could be set to the X & S boards. --- Marlin/src/inc/Conditionals_LCD.h | 4 ++++ Marlin/src/lcd/tft_io/tft_io.cpp | 2 +- Marlin/src/pins/stm32f4/pins_LERDGE_K.h | 6 +++++- ini/stm32f4.ini | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index bfbe5ba6cf1a..d3324734c102 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -1222,6 +1222,10 @@ #define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY) #define TFT_RES_480x320 #define TFT_INTERFACE_SPI +#elif ENABLED(LERDGE_TFT35) // ST7796 + #define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY) + #define TFT_RES_480x320 + #define TFT_INTERFACE_FSMC #elif ENABLED(ANET_ET5_TFT35) // ST7796 #define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY) #define TFT_RES_480x320 diff --git a/Marlin/src/lcd/tft_io/tft_io.cpp b/Marlin/src/lcd/tft_io/tft_io.cpp index ded711b57768..a1bf03ae739a 100644 --- a/Marlin/src/lcd/tft_io/tft_io.cpp +++ b/Marlin/src/lcd/tft_io/tft_io.cpp @@ -33,7 +33,7 @@ #if TFT_DRIVER == ST7789 || TFT_DRIVER == AUTO #include "st7789v.h" #endif -#if TFT_DRIVER == ST7796 || TFT_DRIVER == AUTO +#if TFT_DRIVER == ST7796 || TFT_DRIVER == LERDGE_ST7796 || TFT_DRIVER == AUTO #include "st7796s.h" #endif #if TFT_DRIVER == R61505 || TFT_DRIVER == AUTO diff --git a/Marlin/src/pins/stm32f4/pins_LERDGE_K.h b/Marlin/src/pins/stm32f4/pins_LERDGE_K.h index 4adc2f65a2f2..b2c3bdc0f802 100644 --- a/Marlin/src/pins/stm32f4/pins_LERDGE_K.h +++ b/Marlin/src/pins/stm32f4/pins_LERDGE_K.h @@ -233,7 +233,11 @@ // TFT with FSMC interface // #if HAS_FSMC_TFT - //#define TFT_DRIVER LERDGE_ST7796 + #undef TFT_DRIVER + #define TFT_DRIVER LERDGE_ST7796 + + #define FSMC_CS_PIN PD7 + #define FSMC_RS_PIN PD11 #define TFT_RESET_PIN PD6 #define TFT_BACKLIGHT_PIN PD3 diff --git a/ini/stm32f4.ini b/ini/stm32f4.ini index 29dd93307826..6518d92c01ef 100644 --- a/ini/stm32f4.ini +++ b/ini/stm32f4.ini @@ -255,7 +255,7 @@ board_build.encrypt = firmware.bin board_build.offset = 0x10000 build_flags = ${stm32_variant.build_flags} -DSTM32F4 -DSTM32F4xx -DTARGET_STM32F4 - -DDISABLE_GENERIC_SERIALUSB -DARDUINO_ARCH_STM32 -DARDUINO_LERDGE + -DDISABLE_GENERIC_SERIALUSB -DARDUINO_ARCH_STM32 -DARDUINO_LERDGE -DLERDGE_TFT35 -DHAL_SRAM_MODULE_ENABLED build_unflags = ${stm32_variant.build_unflags} -DUSBCON -DUSBD_USE_CDC -DUSBD_VID=0x0483 extra_scripts = ${stm32_variant.extra_scripts} From 2a660432653af29f4639706414f85ef63c0393eb Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 28 Aug 2021 18:10:33 -0500 Subject: [PATCH 02/31] Tweak TFT_*_PINs --- Marlin/src/pins/stm32f4/pins_LERDGE_K.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Marlin/src/pins/stm32f4/pins_LERDGE_K.h b/Marlin/src/pins/stm32f4/pins_LERDGE_K.h index b2c3bdc0f802..9c073b568602 100644 --- a/Marlin/src/pins/stm32f4/pins_LERDGE_K.h +++ b/Marlin/src/pins/stm32f4/pins_LERDGE_K.h @@ -236,14 +236,14 @@ #undef TFT_DRIVER #define TFT_DRIVER LERDGE_ST7796 - #define FSMC_CS_PIN PD7 - #define FSMC_RS_PIN PD11 - #define TFT_RESET_PIN PD6 #define TFT_BACKLIGHT_PIN PD3 - #define TFT_CS_PIN PD7 - #define TFT_RS_PIN PD11 + #define FSMC_CS_PIN PD7 + #define FSMC_RS_PIN PD11 + + #define TFT_CS_PIN FSMC_CS_PIN + #define TFT_RS_PIN FSMC_RS_PIN #define TOUCH_CS_PIN PG15 #define TOUCH_SCK_PIN PB3 From 50a4507a326f2f3c81c4c5b01b0907458f6ce9e6 Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Sun, 29 Aug 2021 09:01:17 +0200 Subject: [PATCH 03/31] Reorg SD pins and adjust Lerdge X ones too Invert encoder direction for marlin, both menus & values were reversed. Easier than reversing the multiple encoder config defines --- Marlin/src/pins/stm32f4/pins_LERDGE_K.h | 27 ++++++----- Marlin/src/pins/stm32f4/pins_LERDGE_X.h | 63 +++++++++++++++---------- ini/stm32f4.ini | 2 +- 3 files changed, 53 insertions(+), 39 deletions(-) diff --git a/Marlin/src/pins/stm32f4/pins_LERDGE_K.h b/Marlin/src/pins/stm32f4/pins_LERDGE_K.h index 9c073b568602..c0820e6b0024 100644 --- a/Marlin/src/pins/stm32f4/pins_LERDGE_K.h +++ b/Marlin/src/pins/stm32f4/pins_LERDGE_K.h @@ -212,23 +212,21 @@ #define SDIO_SUPPORT #define SDIO_CLOCK 4800000 +#define SD_SCK_PIN PC12 +#define SD_MISO_PIN PC8 +#define SD_MOSI_PIN PD2 +#define SD_SS_PIN PC11 +#define SDSS PC11 +#define SD_DETECT_PIN PA8 + // // Misc. Functions // -#define SDSS PC11 #define LED_PIN PA15 // Alive #define PS_ON_PIN PA4 -#define KILL_PIN -1 +#define KILL_PIN -1 #define POWER_LOSS_PIN PA4 // Power-loss / nAC_FAULT -#define SD_SCK_PIN PC12 -#define SD_MISO_PIN PC8 -#define SD_MOSI_PIN PD2 -#define SD_SS_PIN PC11 - -#define SD_DETECT_PIN PA8 -#define BEEPER_PIN PC7 - // // TFT with FSMC interface // @@ -252,7 +250,12 @@ #endif #if IS_NEWPANEL - #define BTN_EN1 PG10 - #define BTN_EN2 PG11 + #define BTN_EN1 PG11 + #define BTN_EN2 PG10 #define BTN_ENC PG9 + #ifndef ENCODER_STEPS_PER_MENU_ITEM + #define ENCODER_STEPS_PER_MENU_ITEM 2 + #endif + + #define BEEPER_PIN PC7 #endif diff --git a/Marlin/src/pins/stm32f4/pins_LERDGE_X.h b/Marlin/src/pins/stm32f4/pins_LERDGE_X.h index 3a9c286e001e..965deab75b98 100644 --- a/Marlin/src/pins/stm32f4/pins_LERDGE_X.h +++ b/Marlin/src/pins/stm32f4/pins_LERDGE_X.h @@ -114,46 +114,57 @@ //#define NEOPIXEL_PIN -1 // -// Misc. Functions +// SD support (On board) // -#define SDSS PC11 -#define LED_PIN PC7 // Alive -#define PS_ON_PIN -1 -#define KILL_PIN -1 - -// Lerdge supports auto-power off and power loss sense through a single pin. -#define POWER_LOSS_PIN PC14 // Power-loss / nAC_FAULT +#define SDIO_SUPPORT +#define SD_DETECT_PIN PA8 +#define SDIO_CLOCK 4800000 #define SD_SCK_PIN PC12 #define SD_MISO_PIN PC8 #define SD_MOSI_PIN PD2 #define SD_SS_PIN PC11 +#define SDSS PC11 // -// SD support +// Misc. Functions // -#define SDIO_SUPPORT -#define SD_DETECT_PIN PA8 -#define SDIO_CLOCK 4800000 +#define LED_PIN PC7 // Alive +#define PS_ON_PIN -1 +#define KILL_PIN -1 + +// Lerdge supports auto-power off and power loss sense through a single pin. +#define POWER_LOSS_PIN PC14 // Power-loss / nAC_FAULT // -// LCD / Controller +// TFT with FSMC interface // +#if HAS_FSMC_TFT + #undef TFT_DRIVER + #define TFT_DRIVER LERDGE_ST7796 -// The LCD is initialized in FSMC mode -#define BEEPER_PIN PD12 + #define FSMC_CS_PIN PD7 + #define FSMC_RS_PIN PD11 -#define BTN_EN1 PE3 -#define BTN_EN2 PE4 -#define BTN_ENC PE2 + #define TFT_RESET_PIN PD6 + #define TFT_BACKLIGHT_PIN PD3 -#define TFT_RESET_PIN PD6 -#define TFT_BACKLIGHT_PIN PD3 + #define TFT_CS_PIN FSMC_CS_PIN + #define TFT_RS_PIN FSMC_RS_PIN -#define TFT_CS_PIN PD7 -#define TFT_RS_PIN PD11 + #define TOUCH_CS_PIN PB6 + #define TOUCH_SCK_PIN PB3 + #define TOUCH_MOSI_PIN PB5 + #define TOUCH_MISO_PIN PB4 +#endif -#define TOUCH_CS_PIN PB6 -#define TOUCH_SCK_PIN PB3 -#define TOUCH_MOSI_PIN PB5 -#define TOUCH_MISO_PIN PB4 +#if IS_NEWPANEL + #define BTN_EN1 PE4 + #define BTN_EN2 PE3 + #define BTN_ENC PE2 + #ifndef ENCODER_STEPS_PER_MENU_ITEM + #define ENCODER_STEPS_PER_MENU_ITEM 2 + #endif + + #define BEEPER_PIN PD12 +#endif diff --git a/ini/stm32f4.ini b/ini/stm32f4.ini index 6518d92c01ef..c9bda77503ad 100644 --- a/ini/stm32f4.ini +++ b/ini/stm32f4.ini @@ -262,7 +262,7 @@ extra_scripts = ${stm32_variant.extra_scripts} buildroot/share/PlatformIO/scripts/lerdge.py # -# Lerdge X +# Lerdge X (STM32F407VET6) # [env:LERDGEX] platform = ${lerdge_common.platform} From 0e6dcb388f6842d8af3ae641a6695dfada6027d5 Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Sun, 29 Aug 2021 10:14:53 +0200 Subject: [PATCH 04/31] Update Lerdge S, closer to the K (F407ZG too) --- Marlin/src/pins/stm32f4/pins_LERDGE_S.h | 41 ++++++++++++++++--------- ini/stm32f4.ini | 6 ++-- 2 files changed, 29 insertions(+), 18 deletions(-) diff --git a/Marlin/src/pins/stm32f4/pins_LERDGE_S.h b/Marlin/src/pins/stm32f4/pins_LERDGE_S.h index 4707a16e1432..17fa2e26f836 100644 --- a/Marlin/src/pins/stm32f4/pins_LERDGE_S.h +++ b/Marlin/src/pins/stm32f4/pins_LERDGE_S.h @@ -190,24 +190,35 @@ #endif // -// LCD / Controller +// TFT with FSMC interface // +#if HAS_FSMC_TFT + #undef TFT_DRIVER + #define TFT_DRIVER LERDGE_ST7796 -// The LCD is initialized in FSMC mode -#define BEEPER_PIN PD13 + #define TFT_RESET_PIN PD6 + #define TFT_BACKLIGHT_PIN PD3 -#define BTN_EN1 PC14 -#define BTN_EN2 PC15 -#define BTN_ENC PC13 + #define FSMC_CS_PIN PD7 + #define FSMC_RS_PIN PD11 -#define TFT_RESET_PIN PD6 -#define TFT_BACKLIGHT_PIN PD3 + #define TFT_CS_PIN FSMC_CS_PIN + #define TFT_RS_PIN FSMC_RS_PIN -#define TFT_CS_PIN PD7 // TFT works -#define TFT_RS_PIN PD11 // TFT works + #define TOUCH_CS_PIN PB6 + #define TOUCH_SCK_PIN PB3 + #define TOUCH_MOSI_PIN PB5 + #define TOUCH_MISO_PIN PB4 +#endif + +#if IS_NEWPANEL + #define BTN_EN1 PC15 + #define BTN_EN2 PC14 + #define BTN_ENC PC13 + #ifndef ENCODER_STEPS_PER_MENU_ITEM + #define ENCODER_STEPS_PER_MENU_ITEM 2 + #endif + + #define BEEPER_PIN PD13 +#endif -// There is touch, but calibration is off -#define TOUCH_CS_PIN PB6 -#define TOUCH_SCK_PIN PB3 -#define TOUCH_MOSI_PIN PB5 -#define TOUCH_MISO_PIN PB4 diff --git a/ini/stm32f4.ini b/ini/stm32f4.ini index c9bda77503ad..13e7e6a5a523 100644 --- a/ini/stm32f4.ini +++ b/ini/stm32f4.ini @@ -262,7 +262,7 @@ extra_scripts = ${stm32_variant.extra_scripts} buildroot/share/PlatformIO/scripts/lerdge.py # -# Lerdge X (STM32F407VET6) +# Lerdge X (STM32F407VE) # [env:LERDGEX] platform = ${lerdge_common.platform} @@ -279,7 +279,7 @@ platform_packages = ${stm_flash_drive.platform_packages} build_flags = ${stm_flash_drive.build_flags} ${lerdge_common.build_flags} # -# Lerdge S +# Lerdge S (STM32F407ZG) # [env:LERDGES] platform = ${lerdge_common.platform} @@ -296,7 +296,7 @@ platform_packages = ${stm_flash_drive.platform_packages} build_flags = ${stm_flash_drive.build_flags} ${lerdge_common.build_flags} # -# Lerdge K +# Lerdge K (STM32F407ZG) # [env:LERDGEK] platform = ${lerdge_common.platform} From 09edbaa316ffaa9f2f464da33bacc3a1154384c8 Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Sun, 29 Aug 2021 12:03:51 +0200 Subject: [PATCH 05/31] Variant: Comment wrong pin definitions All those could make conflicts with stepper drivers pins and are not required to build. --- .../variants/MARLIN_LERDGE/variant.h | 33 +++++++++---------- 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/buildroot/share/PlatformIO/variants/MARLIN_LERDGE/variant.h b/buildroot/share/PlatformIO/variants/MARLIN_LERDGE/variant.h index 87033a68e5f6..f8cccead29c3 100644 --- a/buildroot/share/PlatformIO/variants/MARLIN_LERDGE/variant.h +++ b/buildroot/share/PlatformIO/variants/MARLIN_LERDGE/variant.h @@ -163,25 +163,22 @@ extern "C" { // Below SPI and I2C definitions already done in the core // Could be redefined here if differs from the default one // SPI Definitions -#define PIN_SPI_SS PF11 -#define PIN_SPI_MOSI PB15 -#define PIN_SPI_MISO PB14 -#define PIN_SPI_SCK PB13 - - -//max6675 -//#define PIN_SPI_SS PA4 -//#define PIN_SPI_SCK PA5 -//#define PIN_SPI_MISO PA6 -//#define PIN_SPI_MOSI PA7 - - - - -// I2C Definitions -#define PIN_WIRE_SDA PB7 -#define PIN_WIRE_SCL PB6 +// SPI1 (Winbond on the Lerdge-K) +//#define PIN_SPI_SS PC4 +//#define PIN_SPI_SCK PA5 +//#define PIN_SPI_MISO PA6 +//#define PIN_SPI_MOSI PA7 + +// SPI2 (Winbond on the Lerdge-S) +//#define PIN_SPI_SS PB12 +//#define PIN_SPI_SCK PB13 +//#define PIN_SPI_MISO PB14 +//#define PIN_SPI_MOSI PB15 + +// I2C Definitions (Software I2C) +//#define PIN_WIRE_SDA PG13 +//#define PIN_WIRE_SCL PG14 // Timer Definitions //Do not use timer used by PWM pins when possible. See PinMap_PWM in PeripheralPins.c From ff576311a68a815d8eeb9799dcd849fc5a809af6 Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Sun, 29 Aug 2021 12:52:57 +0200 Subject: [PATCH 06/31] pio: Allow to unset/ignore board_build.encrypt from parent env and remove extra ";" (only to write 2 lines on one in python) --- buildroot/share/PlatformIO/scripts/lerdge.py | 5 +++-- buildroot/share/PlatformIO/scripts/offset_and_rename.py | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/buildroot/share/PlatformIO/scripts/lerdge.py b/buildroot/share/PlatformIO/scripts/lerdge.py index 5c35c19e7df2..654f0ad4df92 100644 --- a/buildroot/share/PlatformIO/scripts/lerdge.py +++ b/buildroot/share/PlatformIO/scripts/lerdge.py @@ -41,7 +41,8 @@ def encrypt(source, target, env): renamed.close() if 'encrypt' in board.get("build").keys(): - marlin.add_post_action(encrypt); + if board.get("build.encrypt") != "": + marlin.add_post_action(encrypt) else: print("LERDGE builds require output file via board_build.encrypt = 'filename' parameter") - exit(1); + exit(1) diff --git a/buildroot/share/PlatformIO/scripts/offset_and_rename.py b/buildroot/share/PlatformIO/scripts/offset_and_rename.py index b42b2f35317c..9caed298e434 100644 --- a/buildroot/share/PlatformIO/scripts/offset_and_rename.py +++ b/buildroot/share/PlatformIO/scripts/offset_and_rename.py @@ -45,7 +45,8 @@ def encrypt(source, target, env): marlin.encrypt_mks(source, target, env, board.get("build.encrypt")) - marlin.add_post_action(encrypt); + if board.get("build.encrypt") != "": + marlin.add_post_action(encrypt) # # For build.rename simply rename the firmware file. From c2ac5c33c360017794315d29b953fdc70eede4e6 Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Sun, 29 Aug 2021 13:31:12 +0200 Subject: [PATCH 07/31] Undef SPI SD pins with SDIO enabled, not required These pins may be required for the SPI EEPROM with HAL_SPI.cpp --- Marlin/src/pins/stm32f4/pins_LERDGE_K.h | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Marlin/src/pins/stm32f4/pins_LERDGE_K.h b/Marlin/src/pins/stm32f4/pins_LERDGE_K.h index c0820e6b0024..ab77f863d729 100644 --- a/Marlin/src/pins/stm32f4/pins_LERDGE_K.h +++ b/Marlin/src/pins/stm32f4/pins_LERDGE_K.h @@ -211,13 +211,16 @@ // #define SDIO_SUPPORT #define SDIO_CLOCK 4800000 - -#define SD_SCK_PIN PC12 -#define SD_MISO_PIN PC8 -#define SD_MOSI_PIN PD2 -#define SD_SS_PIN PC11 -#define SDSS PC11 #define SD_DETECT_PIN PA8 +#if DISABLED(SDIO_SUPPORT) + #define SD_SCK_PIN PC12 + #define SD_MISO_PIN PC8 + #define SD_MOSI_PIN PD2 + #define SD_SS_PIN PC11 + #define SDSS PC11 +#else + #define SDSS -1 +#endif // // Misc. Functions From d0a330e89a6d5d507c05f97eae59e36a06a5fd50 Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Sun, 29 Aug 2021 13:50:18 +0200 Subject: [PATCH 08/31] Add missing SDIO pinmap in variant --- .../variants/MARLIN_LERDGE/PeripheralPins.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/buildroot/share/PlatformIO/variants/MARLIN_LERDGE/PeripheralPins.c b/buildroot/share/PlatformIO/variants/MARLIN_LERDGE/PeripheralPins.c index 044f555a4105..7f6b32c22800 100644 --- a/buildroot/share/PlatformIO/variants/MARLIN_LERDGE/PeripheralPins.c +++ b/buildroot/share/PlatformIO/variants/MARLIN_LERDGE/PeripheralPins.c @@ -398,3 +398,21 @@ const PinMap PinMap_USB_OTG_HS[] = { {NC, NP, 0} }; #endif + +//*** SD *** + +#ifdef HAL_SD_MODULE_ENABLED +WEAK const PinMap PinMap_SD[] = { +//{PB_8, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D4 +//{PB_9, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D5 +//{PC_6, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D6 +//{PC_7, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D7 + {PC_8, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D0 + {PC_9, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D1 + {PC_10, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D2 + {PC_11, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D3 + {PC_12, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF12_SDIO)}, // SDIO_CK + {PD_2, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF12_SDIO)}, // SDIO_CMD + {NC, NP, 0} +}; +#endif From a6e9dab8284ed46112cbf813cc36cabe3db2287f Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Sun, 29 Aug 2021 14:05:22 +0200 Subject: [PATCH 09/31] Same SDIO pins logic for X & S --- Marlin/src/pins/stm32f4/pins_LERDGE_S.h | 21 ++++++++++++--------- Marlin/src/pins/stm32f4/pins_LERDGE_X.h | 15 +++++++++------ 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/Marlin/src/pins/stm32f4/pins_LERDGE_S.h b/Marlin/src/pins/stm32f4/pins_LERDGE_S.h index 17fa2e26f836..d9b67c0aea60 100644 --- a/Marlin/src/pins/stm32f4/pins_LERDGE_S.h +++ b/Marlin/src/pins/stm32f4/pins_LERDGE_S.h @@ -150,24 +150,27 @@ // // Misc. Functions // -#define SDSS PC11 // SD is working using SDIO, not sure if this definition is needed? #define LED_PIN PC6 // Mainboard soldered green LED #define PS_ON_PIN PB2 // Board has a power module connector -#define KILL_PIN -1 // There is no reset button on the LCD -#define POWER_LOSS_PIN -1 // PB2 could be used for this as well +#define KILL_PIN -1 // There is no reset button on the LCD +#define POWER_LOSS_PIN -1 // PB2 could be used for this as well // // SD support // #define SDIO_SUPPORT #define SDIO_CLOCK 4800000 - -#define SD_SCK_PIN PC12 -#define SD_MISO_PIN PC8 -#define SD_MOSI_PIN PD2 -#define SD_SS_PIN PC11 - #define SD_DETECT_PIN PG15 +#if DISABLED(SDIO_SUPPORT) + // SD SPI Mode unused/untested + #define SD_SCK_PIN PC12 + #define SD_MISO_PIN PC8 + #define SD_MOSI_PIN PD2 + #define SD_SS_PIN PC11 + #define SDSS PC11 +#else + #define SDSS -1 +#endif // // Persistent Storage diff --git a/Marlin/src/pins/stm32f4/pins_LERDGE_X.h b/Marlin/src/pins/stm32f4/pins_LERDGE_X.h index 965deab75b98..4acbad26fcb3 100644 --- a/Marlin/src/pins/stm32f4/pins_LERDGE_X.h +++ b/Marlin/src/pins/stm32f4/pins_LERDGE_X.h @@ -119,12 +119,15 @@ #define SDIO_SUPPORT #define SD_DETECT_PIN PA8 #define SDIO_CLOCK 4800000 - -#define SD_SCK_PIN PC12 -#define SD_MISO_PIN PC8 -#define SD_MOSI_PIN PD2 -#define SD_SS_PIN PC11 -#define SDSS PC11 +#if DISABLED(SDIO_SUPPORT) + #define SD_SCK_PIN PC12 + #define SD_MISO_PIN PC8 + #define SD_MOSI_PIN PD2 + #define SD_SS_PIN PC11 + #define SDSS PC11 +#else + #define SDSS -1 +#endif // // Misc. Functions From 7ad6e78d5ed4bde8a37cd8b5d5673483475f8624 Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Sun, 29 Aug 2021 14:11:42 +0200 Subject: [PATCH 10/31] Remove SDSS -1, was only req. for F1 HAL --- Marlin/src/pins/stm32f4/pins_LERDGE_K.h | 2 -- Marlin/src/pins/stm32f4/pins_LERDGE_S.h | 2 -- Marlin/src/pins/stm32f4/pins_LERDGE_X.h | 2 -- 3 files changed, 6 deletions(-) diff --git a/Marlin/src/pins/stm32f4/pins_LERDGE_K.h b/Marlin/src/pins/stm32f4/pins_LERDGE_K.h index ab77f863d729..7d7aeaae35db 100644 --- a/Marlin/src/pins/stm32f4/pins_LERDGE_K.h +++ b/Marlin/src/pins/stm32f4/pins_LERDGE_K.h @@ -218,8 +218,6 @@ #define SD_MOSI_PIN PD2 #define SD_SS_PIN PC11 #define SDSS PC11 -#else - #define SDSS -1 #endif // diff --git a/Marlin/src/pins/stm32f4/pins_LERDGE_S.h b/Marlin/src/pins/stm32f4/pins_LERDGE_S.h index d9b67c0aea60..7c44b5e07557 100644 --- a/Marlin/src/pins/stm32f4/pins_LERDGE_S.h +++ b/Marlin/src/pins/stm32f4/pins_LERDGE_S.h @@ -168,8 +168,6 @@ #define SD_MOSI_PIN PD2 #define SD_SS_PIN PC11 #define SDSS PC11 -#else - #define SDSS -1 #endif // diff --git a/Marlin/src/pins/stm32f4/pins_LERDGE_X.h b/Marlin/src/pins/stm32f4/pins_LERDGE_X.h index 4acbad26fcb3..bead292f3e15 100644 --- a/Marlin/src/pins/stm32f4/pins_LERDGE_X.h +++ b/Marlin/src/pins/stm32f4/pins_LERDGE_X.h @@ -125,8 +125,6 @@ #define SD_MOSI_PIN PD2 #define SD_SS_PIN PC11 #define SDSS PC11 -#else - #define SDSS -1 #endif // From a40481f4aa81cfa6b0302f0f65e4db6144cf233c Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Sun, 29 Aug 2021 17:05:11 +0200 Subject: [PATCH 11/31] Prepare the I2C EEPROM/F-RAM for the Lerdge S works well on the Lerdge K... I2C pins to double check --- Marlin/src/pins/stm32f4/pins_LERDGE_S.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Marlin/src/pins/stm32f4/pins_LERDGE_S.h b/Marlin/src/pins/stm32f4/pins_LERDGE_S.h index 7c44b5e07557..fabf4909e480 100644 --- a/Marlin/src/pins/stm32f4/pins_LERDGE_S.h +++ b/Marlin/src/pins/stm32f4/pins_LERDGE_S.h @@ -175,10 +175,13 @@ // If no option is selected below the SD Card will be used // (this section modelled after pins_LONGER3D_LK.h) // Warning: Not tested yet! Pins traced with multimeter, mistakes are possible + //#define SPI_EEPROM +//#define I2C_EEPROM #if ENABLED(SPI_EEPROM) - // Lerdge has an SPI EEPROM Winbond W25Q128 (128Mbits) https://www.pjrc.com/teensy/W25Q128FV.pdf + // SPI EEPROM Winbond W25Q128 (128Mbits) https://www.pjrc.com/teensy/W25Q128FV.pdf + // Prefer the I2C one (F-RAM) to store marlin settings #define SPI_CHAN_EEPROM1 1 #define SPI_EEPROM1_CS_PIN PB12 // datasheet: /CS pin, found with multimeter, not tested #define EEPROM_SCK_PIN PB13 // datasheet: CLK pin, found with multimeter, not tested @@ -186,6 +189,11 @@ #define EEPROM_MOSI_PIN PB15 // datasheet: DI pin, found with multimeter, not tested #define EEPROM_PAGE_SIZE 0x1000U // 4KB (from datasheet) #define MARLIN_EEPROM_SIZE 16UL * (EEPROM_PAGE_SIZE) // Limit to 64KB for now... +#elif ENABLED(I2C_EEPROM) + #define SOFT_I2C_EEPROM // Force the use of Software I2C + #define I2C_SCL_PIN PG14 // To be confirmed on the Lerdge S, but probably same as the K + #define I2C_SDA_PIN PG13 + #define MARLIN_EEPROM_SIZE 0x10000 #else #define MARLIN_EEPROM_SIZE 0x800U // On SD, Limit to 2KB, require this amount of RAM #endif From 1754b5374bf4384a7b77a4495148244e6bb924aa Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Sun, 29 Aug 2021 17:22:18 +0200 Subject: [PATCH 12/31] Lerdge S comments & cleanup --- Marlin/src/pins/stm32f4/pins_LERDGE_S.h | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Marlin/src/pins/stm32f4/pins_LERDGE_S.h b/Marlin/src/pins/stm32f4/pins_LERDGE_S.h index fabf4909e480..7a1b464d9cac 100644 --- a/Marlin/src/pins/stm32f4/pins_LERDGE_S.h +++ b/Marlin/src/pins/stm32f4/pins_LERDGE_S.h @@ -31,8 +31,6 @@ #define STEP_TIMER 4 #define TEMP_TIMER 2 -//#define I2C_EEPROM - // USB Flash Drive support #define HAS_OTG_USB_HOST_SUPPORT @@ -173,15 +171,13 @@ // // Persistent Storage // If no option is selected below the SD Card will be used -// (this section modelled after pins_LONGER3D_LK.h) -// Warning: Not tested yet! Pins traced with multimeter, mistakes are possible +// Prefer the I2C one (F-RAM) to store marlin settings, SPI one is not working yet //#define SPI_EEPROM //#define I2C_EEPROM #if ENABLED(SPI_EEPROM) // SPI EEPROM Winbond W25Q128 (128Mbits) https://www.pjrc.com/teensy/W25Q128FV.pdf - // Prefer the I2C one (F-RAM) to store marlin settings #define SPI_CHAN_EEPROM1 1 #define SPI_EEPROM1_CS_PIN PB12 // datasheet: /CS pin, found with multimeter, not tested #define EEPROM_SCK_PIN PB13 // datasheet: CLK pin, found with multimeter, not tested @@ -190,9 +186,10 @@ #define EEPROM_PAGE_SIZE 0x1000U // 4KB (from datasheet) #define MARLIN_EEPROM_SIZE 16UL * (EEPROM_PAGE_SIZE) // Limit to 64KB for now... #elif ENABLED(I2C_EEPROM) + // FM24CL64BG (CYP1813) 64Kbit F-RAM #define SOFT_I2C_EEPROM // Force the use of Software I2C - #define I2C_SCL_PIN PG14 // To be confirmed on the Lerdge S, but probably same as the K #define I2C_SDA_PIN PG13 + #define I2C_SCL_PIN PG14 // To be confirmed on the Lerdge S, but probably same as the K #define MARLIN_EEPROM_SIZE 0x10000 #else #define MARLIN_EEPROM_SIZE 0x800U // On SD, Limit to 2KB, require this amount of RAM From 97c2fe4389e1b1a44b311d2418ff3be606d1b453 Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Sun, 29 Aug 2021 17:46:58 +0200 Subject: [PATCH 13/31] LerdgeK: Fix commented CS pins, same ones as UART on v1.0.1, but i think v2 just use .1" connectors instead of SH1.0 (1mm) --- Marlin/src/pins/stm32f4/pins_LERDGE_K.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Marlin/src/pins/stm32f4/pins_LERDGE_K.h b/Marlin/src/pins/stm32f4/pins_LERDGE_K.h index 7d7aeaae35db..8827a6fd1929 100644 --- a/Marlin/src/pins/stm32f4/pins_LERDGE_K.h +++ b/Marlin/src/pins/stm32f4/pins_LERDGE_K.h @@ -72,42 +72,42 @@ #define X_DIR_PIN PB10 #define X_ENABLE_PIN PG0 //#ifndef X_CS_PIN -// #define X_CS_PIN PE0 +// #define X_CS_PIN PB2 //#endif #define Y_STEP_PIN PF14 #define Y_DIR_PIN PF15 #define Y_ENABLE_PIN PF13 //#ifndef Y_CS_PIN -// #define Y_CS_PIN PE1 +// #define Y_CS_PIN PE2 //#endif #define Z_STEP_PIN PF11 #define Z_DIR_PIN PF12 #define Z_ENABLE_PIN PC5 //#ifndef Z_CS_PIN -// #define Z_CS_PIN PE2 +// #define Z_CS_PIN PE3 //#endif #define E0_STEP_PIN PC14 #define E0_DIR_PIN PC13 #define E0_ENABLE_PIN PC15 //#ifndef E0_CS_PIN -// #define E0_CS_PIN PE3 +// #define E0_CS_PIN PE4 //#endif #define E1_STEP_PIN PF1 #define E1_DIR_PIN PF0 #define E1_ENABLE_PIN PF2 //#ifndef E1_CS_PIN -// #define E1_CS_PIN PE4 +// #define E1_CS_PIN PE1 //#endif //#define E2_STEP_PIN PF4 // best guess //#define E2_DIR_PIN PF3 // best guess //#define E2_ENABLE_PIN PF5 // best guess //#ifndef E2_CS_PIN -// #define E2_CS_PIN PB2 // best guess +// #define E2_CS_PIN PE0 //#endif #if HAS_TMC_UART From 14f5d709a0ecb0840f7d1eb03f66abc6c1be5c17 Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Sun, 29 Aug 2021 18:41:15 +0200 Subject: [PATCH 14/31] Add LED Connector pin, to remember the pin --- Marlin/src/pins/stm32f4/pins_LERDGE_K.h | 1 + 1 file changed, 1 insertion(+) diff --git a/Marlin/src/pins/stm32f4/pins_LERDGE_K.h b/Marlin/src/pins/stm32f4/pins_LERDGE_K.h index 8827a6fd1929..1fd41546430c 100644 --- a/Marlin/src/pins/stm32f4/pins_LERDGE_K.h +++ b/Marlin/src/pins/stm32f4/pins_LERDGE_K.h @@ -224,6 +224,7 @@ // Misc. Functions // #define LED_PIN PA15 // Alive +//#define LED_PIN PB6 // External LED #define PS_ON_PIN PA4 #define KILL_PIN -1 #define POWER_LOSS_PIN PA4 // Power-loss / nAC_FAULT From 34c73e27e4a58875f1fea2d8fea14899a64d7d96 Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Sun, 29 Aug 2021 19:35:18 +0200 Subject: [PATCH 15/31] Tune LEDs comments, 2 connectors :p --- Marlin/src/pins/stm32f4/pins_LERDGE_K.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/src/pins/stm32f4/pins_LERDGE_K.h b/Marlin/src/pins/stm32f4/pins_LERDGE_K.h index 1fd41546430c..e6a89d5e9ce9 100644 --- a/Marlin/src/pins/stm32f4/pins_LERDGE_K.h +++ b/Marlin/src/pins/stm32f4/pins_LERDGE_K.h @@ -223,8 +223,8 @@ // // Misc. Functions // -#define LED_PIN PA15 // Alive -//#define LED_PIN PB6 // External LED +#define LED_PIN PA15 // Status LED +//#define LED_PIN PB6 // LED Connector #define PS_ON_PIN PA4 #define KILL_PIN -1 #define POWER_LOSS_PIN PA4 // Power-loss / nAC_FAULT From ddfcaebe7ee381502d576d966ca3d5c32a14e7ab Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Mon, 30 Aug 2021 10:55:38 +0200 Subject: [PATCH 16/31] SD without SDIO need SOFTWARE_SPI --- Marlin/src/pins/stm32f4/pins_LERDGE_K.h | 1 + Marlin/src/pins/stm32f4/pins_LERDGE_S.h | 2 +- Marlin/src/pins/stm32f4/pins_LERDGE_X.h | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Marlin/src/pins/stm32f4/pins_LERDGE_K.h b/Marlin/src/pins/stm32f4/pins_LERDGE_K.h index e6a89d5e9ce9..7ad2e12bd05e 100644 --- a/Marlin/src/pins/stm32f4/pins_LERDGE_K.h +++ b/Marlin/src/pins/stm32f4/pins_LERDGE_K.h @@ -213,6 +213,7 @@ #define SDIO_CLOCK 4800000 #define SD_DETECT_PIN PA8 #if DISABLED(SDIO_SUPPORT) + #define SOFTWARE_SPI #define SD_SCK_PIN PC12 #define SD_MISO_PIN PC8 #define SD_MOSI_PIN PD2 diff --git a/Marlin/src/pins/stm32f4/pins_LERDGE_S.h b/Marlin/src/pins/stm32f4/pins_LERDGE_S.h index 7a1b464d9cac..9f9b2ad3d77f 100644 --- a/Marlin/src/pins/stm32f4/pins_LERDGE_S.h +++ b/Marlin/src/pins/stm32f4/pins_LERDGE_S.h @@ -160,7 +160,7 @@ #define SDIO_CLOCK 4800000 #define SD_DETECT_PIN PG15 #if DISABLED(SDIO_SUPPORT) - // SD SPI Mode unused/untested + #define SOFTWARE_SPI #define SD_SCK_PIN PC12 #define SD_MISO_PIN PC8 #define SD_MOSI_PIN PD2 diff --git a/Marlin/src/pins/stm32f4/pins_LERDGE_X.h b/Marlin/src/pins/stm32f4/pins_LERDGE_X.h index bead292f3e15..c598683eb16d 100644 --- a/Marlin/src/pins/stm32f4/pins_LERDGE_X.h +++ b/Marlin/src/pins/stm32f4/pins_LERDGE_X.h @@ -120,6 +120,7 @@ #define SD_DETECT_PIN PA8 #define SDIO_CLOCK 4800000 #if DISABLED(SDIO_SUPPORT) + #define SOFTWARE_SPI #define SD_SCK_PIN PC12 #define SD_MISO_PIN PC8 #define SD_MOSI_PIN PD2 From bed668fcdd9f9bc1379befa62e0318b7af9a4dd1 Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Mon, 30 Aug 2021 21:30:11 +0200 Subject: [PATCH 17/31] Conflicting TIM6 used by Marlin, add notes in variant --- Marlin/src/pins/stm32f4/pins_LERDGE_K.h | 14 +++++++------- .../PlatformIO/variants/MARLIN_LERDGE/variant.h | 10 ++++++---- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/Marlin/src/pins/stm32f4/pins_LERDGE_K.h b/Marlin/src/pins/stm32f4/pins_LERDGE_K.h index 7ad2e12bd05e..b84a320f77b7 100644 --- a/Marlin/src/pins/stm32f4/pins_LERDGE_K.h +++ b/Marlin/src/pins/stm32f4/pins_LERDGE_K.h @@ -103,9 +103,9 @@ // #define E1_CS_PIN PE1 //#endif -//#define E2_STEP_PIN PF4 // best guess -//#define E2_DIR_PIN PF3 // best guess -//#define E2_ENABLE_PIN PF5 // best guess +//#define E2_STEP_PIN PF4 +//#define E2_DIR_PIN PF3 +//#define E2_ENABLE_PIN PF5 //#ifndef E2_CS_PIN // #define E2_CS_PIN PE0 //#endif @@ -193,8 +193,10 @@ // // LED / Lighting // -//#define CASE_LIGHT_PIN_CI -1 -//#define CASE_LIGHT_PIN_DO -1 +#define LED_PIN PA15 // Status LED +//#define CASE_LIGHT_PIN PB6 // LED Ribbon Connector (PWM TIM4_CH1) +//#define CASE_LIGHT_PIN_CI -1 // ??? +//#define CASE_LIGHT_PIN_DO -1 // ??? //#define NEOPIXEL_PIN -1 #ifndef RGB_LED_R_PIN #define RGB_LED_R_PIN PB8 // swap R and G pin for compatibility with real wires @@ -224,8 +226,6 @@ // // Misc. Functions // -#define LED_PIN PA15 // Status LED -//#define LED_PIN PB6 // LED Connector #define PS_ON_PIN PA4 #define KILL_PIN -1 #define POWER_LOSS_PIN PA4 // Power-loss / nAC_FAULT diff --git a/buildroot/share/PlatformIO/variants/MARLIN_LERDGE/variant.h b/buildroot/share/PlatformIO/variants/MARLIN_LERDGE/variant.h index f8cccead29c3..8ff4d23f3c1c 100644 --- a/buildroot/share/PlatformIO/variants/MARLIN_LERDGE/variant.h +++ b/buildroot/share/PlatformIO/variants/MARLIN_LERDGE/variant.h @@ -181,11 +181,13 @@ extern "C" { //#define PIN_WIRE_SCL PG14 // Timer Definitions -//Do not use timer used by PWM pins when possible. See PinMap_PWM in PeripheralPins.c -#define TIMER_TONE TIM6 +// Do not use timer used by PWM pins when possible. See PinMap_PWM in PeripheralPins.c +// FANs may require PWM timers 3 10 11 13 +// The LED/RGB connectors timer 4 +// Beware: STEP_TIMER default is 6 and TEMP_TIMER 14 for the F407 -// Do not use basic timer: OC is required -#define TIMER_SERVO TIM1 //TODO: advanced-control timers don't work +#define TIMER_TONE TIM8 // TIM3 or TIM8 for SPEAKER compat on the lerdge K (PC6) +#define TIMER_SERVO TIM1 // Ideally TIM2 for Hardware PWM (PB11) // UART Definitions // Define here Serial instance number to map on Serial generic name From 866c27820d410295252a8329216f1cf1df999ece Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Mon, 30 Aug 2021 22:44:53 +0200 Subject: [PATCH 18/31] XPT2046 Touch INT pin is wired --- Marlin/src/pins/stm32f4/pins_LERDGE_K.h | 1 + 1 file changed, 1 insertion(+) diff --git a/Marlin/src/pins/stm32f4/pins_LERDGE_K.h b/Marlin/src/pins/stm32f4/pins_LERDGE_K.h index b84a320f77b7..4a9192935eb0 100644 --- a/Marlin/src/pins/stm32f4/pins_LERDGE_K.h +++ b/Marlin/src/pins/stm32f4/pins_LERDGE_K.h @@ -250,6 +250,7 @@ #define TOUCH_SCK_PIN PB3 #define TOUCH_MOSI_PIN PB5 #define TOUCH_MISO_PIN PB4 + #define TOUCH_INT_PIN PG12 #endif #if IS_NEWPANEL From a24a64bb87b1bb88db3c002213c54defd996e42e Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Tue, 31 Aug 2021 09:18:01 +0200 Subject: [PATCH 19/31] Variant: Allow to override timers, X S & K are different --- .../PlatformIO/variants/MARLIN_LERDGE/variant.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/buildroot/share/PlatformIO/variants/MARLIN_LERDGE/variant.h b/buildroot/share/PlatformIO/variants/MARLIN_LERDGE/variant.h index 8ff4d23f3c1c..dae7c74c664d 100644 --- a/buildroot/share/PlatformIO/variants/MARLIN_LERDGE/variant.h +++ b/buildroot/share/PlatformIO/variants/MARLIN_LERDGE/variant.h @@ -185,9 +185,15 @@ extern "C" { // FANs may require PWM timers 3 10 11 13 // The LED/RGB connectors timer 4 // Beware: STEP_TIMER default is 6 and TEMP_TIMER 14 for the F407 - -#define TIMER_TONE TIM8 // TIM3 or TIM8 for SPEAKER compat on the lerdge K (PC6) -#define TIMER_SERVO TIM1 // Ideally TIM2 for Hardware PWM (PB11) +#ifndef TIMER_TONE + #define TIMER_TONE TIM8 // TIM3 or TIM8 for SPEAKER compat on the lerdge K (PC6) +#endif // TIM4 for that on the Lerdge S (PD11) +#ifndef TIMER_SERVO + #define TIMER_SERVO TIM1 // Ideally TIM2 for Hardware PWM (PB11) +#endif // TIM4 on the S (PD12) +#ifndef TIMER_SERIAL + #define TIMER_SERIAL TIM7 // Default used in SoftwareSerial lib +#endif // UART Definitions // Define here Serial instance number to map on Serial generic name From d3a827f410e814d6cf68ac2e3ba03861f49ad365 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 31 Aug 2021 02:54:23 -0500 Subject: [PATCH 20/31] Run formatter --- Marlin/src/pins/stm32f4/pins_LERDGE_K.h | 2 +- Marlin/src/pins/stm32f4/pins_LERDGE_S.h | 5 ++--- Marlin/src/pins/stm32f4/pins_LERDGE_X.h | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Marlin/src/pins/stm32f4/pins_LERDGE_K.h b/Marlin/src/pins/stm32f4/pins_LERDGE_K.h index 4a9192935eb0..877c58fb0314 100644 --- a/Marlin/src/pins/stm32f4/pins_LERDGE_K.h +++ b/Marlin/src/pins/stm32f4/pins_LERDGE_K.h @@ -227,7 +227,7 @@ // Misc. Functions // #define PS_ON_PIN PA4 -#define KILL_PIN -1 +#define KILL_PIN -1 #define POWER_LOSS_PIN PA4 // Power-loss / nAC_FAULT // diff --git a/Marlin/src/pins/stm32f4/pins_LERDGE_S.h b/Marlin/src/pins/stm32f4/pins_LERDGE_S.h index 9f9b2ad3d77f..be8b95e2254c 100644 --- a/Marlin/src/pins/stm32f4/pins_LERDGE_S.h +++ b/Marlin/src/pins/stm32f4/pins_LERDGE_S.h @@ -150,8 +150,8 @@ // #define LED_PIN PC6 // Mainboard soldered green LED #define PS_ON_PIN PB2 // Board has a power module connector -#define KILL_PIN -1 // There is no reset button on the LCD -#define POWER_LOSS_PIN -1 // PB2 could be used for this as well +#define KILL_PIN -1 // There is no reset button on the LCD +#define POWER_LOSS_PIN -1 // PB2 could be used for this as well // // SD support @@ -227,4 +227,3 @@ #define BEEPER_PIN PD13 #endif - diff --git a/Marlin/src/pins/stm32f4/pins_LERDGE_X.h b/Marlin/src/pins/stm32f4/pins_LERDGE_X.h index c598683eb16d..33d8bf6db08c 100644 --- a/Marlin/src/pins/stm32f4/pins_LERDGE_X.h +++ b/Marlin/src/pins/stm32f4/pins_LERDGE_X.h @@ -132,8 +132,8 @@ // Misc. Functions // #define LED_PIN PC7 // Alive -#define PS_ON_PIN -1 -#define KILL_PIN -1 +#define PS_ON_PIN -1 +#define KILL_PIN -1 // Lerdge supports auto-power off and power loss sense through a single pin. #define POWER_LOSS_PIN PC14 // Power-loss / nAC_FAULT From adff448786aab4481b606af5b88aa59525b0b90d Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 31 Aug 2021 02:55:51 -0500 Subject: [PATCH 21/31] One less TFT driver name --- Marlin/src/lcd/tft_io/st7796s.h | 38 ++++--------------------- Marlin/src/lcd/tft_io/tft_ids.h | 1 - Marlin/src/lcd/tft_io/tft_io.cpp | 6 +--- Marlin/src/pins/stm32f4/pins_LERDGE_K.h | 3 +- Marlin/src/pins/stm32f4/pins_LERDGE_S.h | 3 +- Marlin/src/pins/stm32f4/pins_LERDGE_X.h | 3 +- 6 files changed, 9 insertions(+), 45 deletions(-) diff --git a/Marlin/src/lcd/tft_io/st7796s.h b/Marlin/src/lcd/tft_io/st7796s.h index e1931ed55148..6d79dd882ac2 100644 --- a/Marlin/src/lcd/tft_io/st7796s.h +++ b/Marlin/src/lcd/tft_io/st7796s.h @@ -144,39 +144,11 @@ static const uint16_t st7796s_init[] = { ESC_REG(ST7796S_PGC), 0x00F0, 0x0004, 0x0008, 0x0009, 0x0008, 0x0015, 0x002F, 0x0042, 0x0046, 0x0028, 0x0015, 0x0016, 0x0029, 0x002D, ESC_REG(ST7796S_NGC), 0x00F0, 0x0004, 0x0009, 0x0009, 0x0008, 0x0015, 0x002E, 0x0046, 0x0046, 0x0028, 0x0015, 0x0015, 0x0029, 0x002D, - ESC_REG(ST7796S_NORON), - ESC_REG(ST7796S_WRCTRLD), 0x0024, - ESC_REG(ST7796S_CSCON), 0x003C, // disable command 2 part I - ESC_REG(ST7796S_CSCON), 0x0069, // disable command 2 part II - ESC_REG(ST7796S_DISPON), - ESC_END -}; - -static const uint16_t lerdge_st7796s_init[] = { - DATASIZE_8BIT, - ESC_REG(ST7796S_SWRESET), ESC_DELAY(100), - ESC_REG(ST7796S_SLPOUT), ESC_DELAY(20), - - ESC_REG(ST7796S_CSCON), 0x00C3, // enable command 2 part I - ESC_REG(ST7796S_CSCON), 0x0096, // enable command 2 part II - - ESC_REG(ST7796S_MADCTL), ST7796S_MADCTL_DATA, - ESC_REG(ST7796S_COLMOD), 0x0055, - - ESC_REG(ST7796S_DIC), 0x0001, // 1-dot inversion - ESC_REG(ST7796S_EM), 0x00C6, - - ESC_REG(ST7796S_PWR2), 0x0015, - ESC_REG(ST7796S_PWR3), 0x00AF, - ESC_REG(ST7796S_VCMPCTL), 0x0022, - ESC_REG(ST7796S_VCMOST), 0x0000, - ESC_REG(ST7796S_DOCA), 0x0040, 0x008A, 0x0000, 0x0000, 0x0029, 0x0019, 0x00A5, 0x0033, - - /* Gamma Correction. */ - ESC_REG(ST7796S_PGC), 0x00F0, 0x0004, 0x0008, 0x0009, 0x0008, 0x0015, 0x002F, 0x0042, 0x0046, 0x0028, 0x0015, 0x0016, 0x0029, 0x002D, - ESC_REG(ST7796S_NGC), 0x00F0, 0x0004, 0x0009, 0x0009, 0x0008, 0x0015, 0x002E, 0x0046, 0x0046, 0x0028, 0x0015, 0x0015, 0x0029, 0x002D, - - ESC_REG(ST7796S_INVON), // Display inversion ON + #if ENABLED(ST7796S_INVERTED) + ESC_REG(ST7796S_INVON), // Display inversion ON + #else + ESC_REG(ST7796S_NORON), + #endif ESC_REG(ST7796S_WRCTRLD), 0x0024, ESC_REG(ST7796S_CSCON), 0x003C, // disable command 2 part I ESC_REG(ST7796S_CSCON), 0x0069, // disable command 2 part II diff --git a/Marlin/src/lcd/tft_io/tft_ids.h b/Marlin/src/lcd/tft_io/tft_ids.h index c4f6127c685a..2de111366c45 100644 --- a/Marlin/src/lcd/tft_io/tft_ids.h +++ b/Marlin/src/lcd/tft_io/tft_ids.h @@ -31,5 +31,4 @@ #define ILI9341 0x9341 #define ILI9488 0x9488 #define ILI9488_ID1 0x8066 // Some ILI9488 have 0x8066 in the 0x04 -#define LERDGE_ST7796 0xFFFE #define AUTO 0xFFFF diff --git a/Marlin/src/lcd/tft_io/tft_io.cpp b/Marlin/src/lcd/tft_io/tft_io.cpp index a1bf03ae739a..707232b4bb48 100644 --- a/Marlin/src/lcd/tft_io/tft_io.cpp +++ b/Marlin/src/lcd/tft_io/tft_io.cpp @@ -33,7 +33,7 @@ #if TFT_DRIVER == ST7789 || TFT_DRIVER == AUTO #include "st7789v.h" #endif -#if TFT_DRIVER == ST7796 || TFT_DRIVER == LERDGE_ST7796 || TFT_DRIVER == AUTO +#if TFT_DRIVER == ST7796 || TFT_DRIVER == AUTO #include "st7796s.h" #endif #if TFT_DRIVER == R61505 || TFT_DRIVER == AUTO @@ -97,10 +97,6 @@ if (lcd_id != 0xFFFFFFFF) return; write_esc_sequence(ili9341_init); #elif TFT_DRIVER == ILI9488 write_esc_sequence(ili9488_init); - #elif TFT_DRIVER == LERDGE_ST7796 - lcd_id = ST7796; - write_esc_sequence(lerdge_st7796s_init); - #elif TFT_DRIVER == AUTO // autodetect lcd_id = io.GetID() & 0xFFFF; diff --git a/Marlin/src/pins/stm32f4/pins_LERDGE_K.h b/Marlin/src/pins/stm32f4/pins_LERDGE_K.h index 877c58fb0314..9b9bf87aadbf 100644 --- a/Marlin/src/pins/stm32f4/pins_LERDGE_K.h +++ b/Marlin/src/pins/stm32f4/pins_LERDGE_K.h @@ -234,8 +234,7 @@ // TFT with FSMC interface // #if HAS_FSMC_TFT - #undef TFT_DRIVER - #define TFT_DRIVER LERDGE_ST7796 + #define ST7796S_INVERTED #define TFT_RESET_PIN PD6 #define TFT_BACKLIGHT_PIN PD3 diff --git a/Marlin/src/pins/stm32f4/pins_LERDGE_S.h b/Marlin/src/pins/stm32f4/pins_LERDGE_S.h index be8b95e2254c..e224dbde46a2 100644 --- a/Marlin/src/pins/stm32f4/pins_LERDGE_S.h +++ b/Marlin/src/pins/stm32f4/pins_LERDGE_S.h @@ -199,8 +199,7 @@ // TFT with FSMC interface // #if HAS_FSMC_TFT - #undef TFT_DRIVER - #define TFT_DRIVER LERDGE_ST7796 + #define ST7796S_INVERTED #define TFT_RESET_PIN PD6 #define TFT_BACKLIGHT_PIN PD3 diff --git a/Marlin/src/pins/stm32f4/pins_LERDGE_X.h b/Marlin/src/pins/stm32f4/pins_LERDGE_X.h index 33d8bf6db08c..e988c2388cfc 100644 --- a/Marlin/src/pins/stm32f4/pins_LERDGE_X.h +++ b/Marlin/src/pins/stm32f4/pins_LERDGE_X.h @@ -142,8 +142,7 @@ // TFT with FSMC interface // #if HAS_FSMC_TFT - #undef TFT_DRIVER - #define TFT_DRIVER LERDGE_ST7796 + #define ST7796S_INVERTED #define FSMC_CS_PIN PD7 #define FSMC_RS_PIN PD11 From afc0cd834c670ecc5b31d4027827b5714c4d405b Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Tue, 31 Aug 2021 11:07:38 +0200 Subject: [PATCH 22/31] variant: add missing EXTI module, and move SRAM one --- buildroot/share/PlatformIO/variants/MARLIN_LERDGE/variant.h | 2 ++ ini/stm32f4.ini | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/buildroot/share/PlatformIO/variants/MARLIN_LERDGE/variant.h b/buildroot/share/PlatformIO/variants/MARLIN_LERDGE/variant.h index dae7c74c664d..692cce69c94a 100644 --- a/buildroot/share/PlatformIO/variants/MARLIN_LERDGE/variant.h +++ b/buildroot/share/PlatformIO/variants/MARLIN_LERDGE/variant.h @@ -213,6 +213,8 @@ extern "C" { /* Extra HAL modules */ //#define HAL_DAC_MODULE_ENABLED #define HAL_SD_MODULE_ENABLED +#define HAL_SRAM_MODULE_ENABLED +#define HAL_EXTI_MODULE_ENABLED #ifdef __cplusplus } // extern "C" diff --git a/ini/stm32f4.ini b/ini/stm32f4.ini index 13e7e6a5a523..da0faa6b77a1 100644 --- a/ini/stm32f4.ini +++ b/ini/stm32f4.ini @@ -256,7 +256,6 @@ board_build.offset = 0x10000 build_flags = ${stm32_variant.build_flags} -DSTM32F4 -DSTM32F4xx -DTARGET_STM32F4 -DDISABLE_GENERIC_SERIALUSB -DARDUINO_ARCH_STM32 -DARDUINO_LERDGE -DLERDGE_TFT35 - -DHAL_SRAM_MODULE_ENABLED build_unflags = ${stm32_variant.build_unflags} -DUSBCON -DUSBD_USE_CDC -DUSBD_VID=0x0483 extra_scripts = ${stm32_variant.extra_scripts} buildroot/share/PlatformIO/scripts/lerdge.py From 240298e10e52fcc2a3cd00e74b4fefe07d9ec7e3 Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Tue, 31 Aug 2021 11:54:02 +0200 Subject: [PATCH 23/31] Ex-Motor is not E2, can be Z2 or even X2/Y2 Its why E1 and Ex have endstop connectors in addition to the 2 RUNOUT ones --- Marlin/src/pins/stm32f4/pins_LERDGE_K.h | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/Marlin/src/pins/stm32f4/pins_LERDGE_K.h b/Marlin/src/pins/stm32f4/pins_LERDGE_K.h index 9b9bf87aadbf..ee9caec5e812 100644 --- a/Marlin/src/pins/stm32f4/pins_LERDGE_K.h +++ b/Marlin/src/pins/stm32f4/pins_LERDGE_K.h @@ -103,11 +103,12 @@ // #define E1_CS_PIN PE1 //#endif -//#define E2_STEP_PIN PF4 -//#define E2_DIR_PIN PF3 -//#define E2_ENABLE_PIN PF5 -//#ifndef E2_CS_PIN -// #define E2_CS_PIN PE0 +//#define Z2_STEP_PIN PF4 +//#define Z2_DIR_PIN PF3 +//#define Z2_ENABLE_PIN PF5 +//#define Z2_STOP_PIN PG2 +//#ifndef Z2_CS_PIN +// #define 22_CS_PIN PE0 //#endif #if HAS_TMC_UART @@ -144,12 +145,17 @@ #ifndef E1_SERIAL_RX_PIN #define E1_SERIAL_RX_PIN E1_SERIAL_TX_PIN #endif + // Ex-motor can be any... X2/Y2/Z2 or E2 #ifndef EX_SERIAL_TX_PIN - #define E2_SERIAL_TX_PIN PE0 + #define EX_SERIAL_TX_PIN PE0 #endif #ifndef EX_SERIAL_RX_PIN - #define E2_SERIAL_RX_PIN E2_SERIAL_TX_PIN + #define EX_SERIAL_RX_PIN EX_SERIAL_TX_PIN #endif + //#define Z2_SERIAL_RX_PIN EX_SERIAL_RX_PIN + //#define Z2_SERIAL_TX_PIN EX_SERIAL_TX_PIN + //#define E2_SERIAL_RX_PIN EX_SERIAL_RX_PIN + //#define E2_SERIAL_TX_PIN EX_SERIAL_TX_PIN // Reduce baud rate to improve software serial reliability #define TMC_BAUD_RATE 19200 #endif From e4f02784674ef1de3ecef623367e1091b2aea6d0 Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Tue, 31 Aug 2021 12:07:29 +0200 Subject: [PATCH 24/31] oups, typo --- Marlin/src/pins/stm32f4/pins_LERDGE_K.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/pins/stm32f4/pins_LERDGE_K.h b/Marlin/src/pins/stm32f4/pins_LERDGE_K.h index ee9caec5e812..19d38f948ac8 100644 --- a/Marlin/src/pins/stm32f4/pins_LERDGE_K.h +++ b/Marlin/src/pins/stm32f4/pins_LERDGE_K.h @@ -108,7 +108,7 @@ //#define Z2_ENABLE_PIN PF5 //#define Z2_STOP_PIN PG2 //#ifndef Z2_CS_PIN -// #define 22_CS_PIN PE0 +// #define Z2_CS_PIN PE0 //#endif #if HAS_TMC_UART From f340f5186173e456f727752ea57ed3fa063e9e7d Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Tue, 31 Aug 2021 22:18:50 +0200 Subject: [PATCH 25/31] view PR CI :p --- Marlin/src/pins/stm32f4/pins_LERDGE_K.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/Marlin/src/pins/stm32f4/pins_LERDGE_K.h b/Marlin/src/pins/stm32f4/pins_LERDGE_K.h index 19d38f948ac8..ec4072e9b6be 100644 --- a/Marlin/src/pins/stm32f4/pins_LERDGE_K.h +++ b/Marlin/src/pins/stm32f4/pins_LERDGE_K.h @@ -201,8 +201,6 @@ // #define LED_PIN PA15 // Status LED //#define CASE_LIGHT_PIN PB6 // LED Ribbon Connector (PWM TIM4_CH1) -//#define CASE_LIGHT_PIN_CI -1 // ??? -//#define CASE_LIGHT_PIN_DO -1 // ??? //#define NEOPIXEL_PIN -1 #ifndef RGB_LED_R_PIN #define RGB_LED_R_PIN PB8 // swap R and G pin for compatibility with real wires From d3158f223aa4326ae31be40e79f1ffc45a4087c5 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 31 Aug 2021 15:40:50 -0500 Subject: [PATCH 26/31] tweak newpanel items --- Marlin/src/pins/stm32f4/pins_LERDGE_K.h | 5 ++--- Marlin/src/pins/stm32f4/pins_LERDGE_S.h | 5 ++--- Marlin/src/pins/stm32f4/pins_LERDGE_X.h | 5 ++--- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/Marlin/src/pins/stm32f4/pins_LERDGE_K.h b/Marlin/src/pins/stm32f4/pins_LERDGE_K.h index ec4072e9b6be..d4b4ed52b40b 100644 --- a/Marlin/src/pins/stm32f4/pins_LERDGE_K.h +++ b/Marlin/src/pins/stm32f4/pins_LERDGE_K.h @@ -257,12 +257,11 @@ #endif #if IS_NEWPANEL + #define BEEPER_PIN PC7 #define BTN_EN1 PG11 #define BTN_EN2 PG10 #define BTN_ENC PG9 #ifndef ENCODER_STEPS_PER_MENU_ITEM - #define ENCODER_STEPS_PER_MENU_ITEM 2 + #define ENCODER_STEPS_PER_MENU_ITEM 2 #endif - - #define BEEPER_PIN PC7 #endif diff --git a/Marlin/src/pins/stm32f4/pins_LERDGE_S.h b/Marlin/src/pins/stm32f4/pins_LERDGE_S.h index e224dbde46a2..f4eb31056eed 100644 --- a/Marlin/src/pins/stm32f4/pins_LERDGE_S.h +++ b/Marlin/src/pins/stm32f4/pins_LERDGE_S.h @@ -217,12 +217,11 @@ #endif #if IS_NEWPANEL + #define BEEPER_PIN PD13 #define BTN_EN1 PC15 #define BTN_EN2 PC14 #define BTN_ENC PC13 #ifndef ENCODER_STEPS_PER_MENU_ITEM - #define ENCODER_STEPS_PER_MENU_ITEM 2 + #define ENCODER_STEPS_PER_MENU_ITEM 2 #endif - - #define BEEPER_PIN PD13 #endif diff --git a/Marlin/src/pins/stm32f4/pins_LERDGE_X.h b/Marlin/src/pins/stm32f4/pins_LERDGE_X.h index e988c2388cfc..1abafde2db27 100644 --- a/Marlin/src/pins/stm32f4/pins_LERDGE_X.h +++ b/Marlin/src/pins/stm32f4/pins_LERDGE_X.h @@ -160,12 +160,11 @@ #endif #if IS_NEWPANEL + #define BEEPER_PIN PD12 #define BTN_EN1 PE4 #define BTN_EN2 PE3 #define BTN_ENC PE2 #ifndef ENCODER_STEPS_PER_MENU_ITEM - #define ENCODER_STEPS_PER_MENU_ITEM 2 + #define ENCODER_STEPS_PER_MENU_ITEM 2 #endif - - #define BEEPER_PIN PD12 #endif From 3fad9320136855a382b9f28b692a69d9646f1adb Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 31 Aug 2021 16:47:12 -0500 Subject: [PATCH 27/31] Ensure EXTI in all variants --- .../MARLIN_BIGTREE_BTT002/hal_conf_extra.h | 2 +- .../MARLIN_BIGTREE_E3_RRF/hal_conf_extra.h | 2 +- .../MARLIN_BIGTREE_GTR_V1/hal_conf_extra.h | 2 +- .../PeripheralPins.c | 2 - .../hal_conf_extra.h | 2 +- .../hal_conf_extra.h | 2 +- .../MARLIN_BTT_SKR_SE_BX/hal_conf_extra.h | 2 +- .../MARLIN_F103VE_LONGER/hal_conf_custom.h | 37 +++++-------------- .../variants/MARLIN_F103Zx/hal_conf_custom.h | 2 +- .../variants/MARLIN_F407VE/hal_conf_custom.h | 2 +- .../variants/MARLIN_F4x7Vx/hal_conf_extra.h | 2 +- .../hal_conf_custom.h | 2 +- .../variants/MARLIN_LERDGE/variant.h | 2 +- .../MARLIN_STEVAL_F401VE/hal_conf_custom.h | 2 +- .../hal_conf_extra.h | 25 +++++++------ 15 files changed, 34 insertions(+), 54 deletions(-) diff --git a/buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_BTT002/hal_conf_extra.h b/buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_BTT002/hal_conf_extra.h index 40b340c20560..ef621d57bf29 100644 --- a/buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_BTT002/hal_conf_extra.h +++ b/buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_BTT002/hal_conf_extra.h @@ -4,6 +4,7 @@ #define HAL_ADC_MODULE_ENABLED #define HAL_CRC_MODULE_ENABLED #define HAL_DMA_MODULE_ENABLED +#define HAL_EXTI_MODULE_ENABLED // Needed for Endstop (and other external) Interrupts #define HAL_GPIO_MODULE_ENABLED #define HAL_I2C_MODULE_ENABLED #define HAL_PWR_MODULE_ENABLED @@ -32,7 +33,6 @@ //#define HAL_SRAM_MODULE_ENABLED //#define HAL_SDRAM_MODULE_ENABLED //#define HAL_HASH_MODULE_ENABLED -//#define HAL_EXTI_MODULE_ENABLED //#define HAL_SMBUS_MODULE_ENABLED //#define HAL_I2S_MODULE_ENABLED //#define HAL_IWDG_MODULE_ENABLED diff --git a/buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_E3_RRF/hal_conf_extra.h b/buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_E3_RRF/hal_conf_extra.h index 6c4a991f33b8..449f73f43fa0 100644 --- a/buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_E3_RRF/hal_conf_extra.h +++ b/buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_E3_RRF/hal_conf_extra.h @@ -4,6 +4,7 @@ #define HAL_ADC_MODULE_ENABLED #define HAL_CRC_MODULE_ENABLED #define HAL_DMA_MODULE_ENABLED +#define HAL_EXTI_MODULE_ENABLED // Needed for Endstop (and other external) Interrupts #define HAL_GPIO_MODULE_ENABLED #define HAL_I2C_MODULE_ENABLED #define HAL_PWR_MODULE_ENABLED @@ -32,7 +33,6 @@ #undef HAL_SRAM_MODULE_ENABLED #undef HAL_SDRAM_MODULE_ENABLED #undef HAL_HASH_MODULE_ENABLED -#undef HAL_EXTI_MODULE_ENABLED #undef HAL_SMBUS_MODULE_ENABLED #undef HAL_I2S_MODULE_ENABLED #undef HAL_IWDG_MODULE_ENABLED diff --git a/buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_GTR_V1/hal_conf_extra.h b/buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_GTR_V1/hal_conf_extra.h index e6d558b3e174..2874a3c3262c 100644 --- a/buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_GTR_V1/hal_conf_extra.h +++ b/buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_GTR_V1/hal_conf_extra.h @@ -4,6 +4,7 @@ #define HAL_ADC_MODULE_ENABLED #define HAL_CRC_MODULE_ENABLED #define HAL_DMA_MODULE_ENABLED +#define HAL_EXTI_MODULE_ENABLED // Needed for Endstop (and other external) Interrupts #define HAL_GPIO_MODULE_ENABLED #define HAL_I2C_MODULE_ENABLED #define HAL_PWR_MODULE_ENABLED @@ -32,7 +33,6 @@ //#define HAL_SRAM_MODULE_ENABLED //#define HAL_SDRAM_MODULE_ENABLED //#define HAL_HASH_MODULE_ENABLED -//#define HAL_EXTI_MODULE_ENABLED //#define HAL_SMBUS_MODULE_ENABLED //#define HAL_I2S_MODULE_ENABLED //#define HAL_IWDG_MODULE_ENABLED diff --git a/buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_OCTOPUS_V1/PeripheralPins.c b/buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_OCTOPUS_V1/PeripheralPins.c index a4f8f696ee82..9df61baf9b1d 100644 --- a/buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_OCTOPUS_V1/PeripheralPins.c +++ b/buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_OCTOPUS_V1/PeripheralPins.c @@ -392,9 +392,7 @@ const PinMap PinMap_USB_OTG_FS[] = { {PA_12, USB_OTG_FS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_FS)}, // USB_OTG_FS_DP {NC, NP, 0} }; -#endif -#ifdef HAL_PCD_MODULE_ENABLED const PinMap PinMap_USB_OTG_HS[] = { //{PB_12, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_PULLUP, GPIO_AF12_OTG_HS_FS)}, // USB_OTG_HS_ID //{PB_13, USB_OTG_HS, STM_PIN_DATA(STM_MODE_INPUT, GPIO_NOPULL, GPIO_AF_NONE)}, // USB_OTG_HS_VBUS diff --git a/buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_OCTOPUS_V1/hal_conf_extra.h b/buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_OCTOPUS_V1/hal_conf_extra.h index da974b1ba761..e63e63c632c0 100644 --- a/buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_OCTOPUS_V1/hal_conf_extra.h +++ b/buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_OCTOPUS_V1/hal_conf_extra.h @@ -4,6 +4,7 @@ #define HAL_ADC_MODULE_ENABLED #define HAL_CRC_MODULE_ENABLED #define HAL_DMA_MODULE_ENABLED +#define HAL_EXTI_MODULE_ENABLED // Needed for Endstop (and other external) Interrupts #define HAL_GPIO_MODULE_ENABLED #define HAL_I2C_MODULE_ENABLED #define HAL_PWR_MODULE_ENABLED @@ -33,7 +34,6 @@ #undef HAL_SRAM_MODULE_ENABLED #undef HAL_SDRAM_MODULE_ENABLED #undef HAL_HASH_MODULE_ENABLED -#undef HAL_EXTI_MODULE_ENABLED #undef HAL_SMBUS_MODULE_ENABLED #undef HAL_I2S_MODULE_ENABLED #undef HAL_IWDG_MODULE_ENABLED diff --git a/buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_SKR_PRO_11/hal_conf_extra.h b/buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_SKR_PRO_11/hal_conf_extra.h index e6d558b3e174..2874a3c3262c 100644 --- a/buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_SKR_PRO_11/hal_conf_extra.h +++ b/buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_SKR_PRO_11/hal_conf_extra.h @@ -4,6 +4,7 @@ #define HAL_ADC_MODULE_ENABLED #define HAL_CRC_MODULE_ENABLED #define HAL_DMA_MODULE_ENABLED +#define HAL_EXTI_MODULE_ENABLED // Needed for Endstop (and other external) Interrupts #define HAL_GPIO_MODULE_ENABLED #define HAL_I2C_MODULE_ENABLED #define HAL_PWR_MODULE_ENABLED @@ -32,7 +33,6 @@ //#define HAL_SRAM_MODULE_ENABLED //#define HAL_SDRAM_MODULE_ENABLED //#define HAL_HASH_MODULE_ENABLED -//#define HAL_EXTI_MODULE_ENABLED //#define HAL_SMBUS_MODULE_ENABLED //#define HAL_I2S_MODULE_ENABLED //#define HAL_IWDG_MODULE_ENABLED diff --git a/buildroot/share/PlatformIO/variants/MARLIN_BTT_SKR_SE_BX/hal_conf_extra.h b/buildroot/share/PlatformIO/variants/MARLIN_BTT_SKR_SE_BX/hal_conf_extra.h index 4050fe810f9d..99f3a30443b6 100644 --- a/buildroot/share/PlatformIO/variants/MARLIN_BTT_SKR_SE_BX/hal_conf_extra.h +++ b/buildroot/share/PlatformIO/variants/MARLIN_BTT_SKR_SE_BX/hal_conf_extra.h @@ -51,7 +51,7 @@ extern "C" { #define HAL_DMA2D_MODULE_ENABLED #define HAL_DSI_MODULE_ENABLED #define HAL_ETH_MODULE_ENABLED -#define HAL_EXTI_MODULE_ENABLED +#define HAL_EXTI_MODULE_ENABLED // Needed for Endstop (and other external) Interrupts #define HAL_FDCAN_MODULE_ENABLED #define HAL_FLASH_MODULE_ENABLED #define HAL_GPIO_MODULE_ENABLED diff --git a/buildroot/share/PlatformIO/variants/MARLIN_F103VE_LONGER/hal_conf_custom.h b/buildroot/share/PlatformIO/variants/MARLIN_F103VE_LONGER/hal_conf_custom.h index e2247addb964..7eb92c4d1023 100644 --- a/buildroot/share/PlatformIO/variants/MARLIN_F103VE_LONGER/hal_conf_custom.h +++ b/buildroot/share/PlatformIO/variants/MARLIN_F103VE_LONGER/hal_conf_custom.h @@ -20,9 +20,7 @@ extern "C" { */ #include "stm32yyxx_hal_conf.h" -#ifdef HAL_PWR_MODULE_ENABLED - #undef HAL_PWR_MODULE_ENABLED // only way to disable it -#endif +#undef HAL_PWR_MODULE_ENABLED // only way to disable it #if defined(HAL_PWR_MODULE_ENABLED) && !defined(HAL_PWR_MODULE_ONLY) #define HAL_PWR_MODULE_ONLY // disable low power & PA0 wakeup pin (its T°c pin) @@ -33,38 +31,22 @@ extern "C" { #endif #ifdef HAL_PCD_MODULE_ENABLED - #warning No direct STM32 USB pins on Longer3D board + #warning "No direct STM32 USB pins on Longer3D board" #undef HAL_PCD_MODULE_ENABLED // USB Device #endif #ifdef HAL_HCD_MODULE_ENABLED - #warning No direct STM32 USB pins on Longer3D board + #warning "No direct STM32 USB pins on Longer3D board" #undef HAL_HCD_MODULE_ENABLED // USB Host #endif -#ifndef HAL_USART_MODULE_ENABLED - //#define HAL_USART_MODULE_ENABLED // Useless.... UART_MODULE do it -#endif - -#ifdef HAL_CAN_LEGACY_MODULE_ENABLED - #undef HAL_CAN_LEGACY_MODULE_ENABLED -#endif - -#ifdef HAL_CAN_MODULE_ENABLED - #undef HAL_CAN_MODULE_ENABLED -#endif - -#ifdef HAL_DAC_MODULE_ENABLED - #undef HAL_DAC_MODULE_ENABLED -#endif - -#ifdef HAL_RTC_MODULE_ENABLED - #undef HAL_RTC_MODULE_ENABLED -#endif +//#define HAL_USART_MODULE_ENABLED // Useless.... UART_MODULE does it -#ifndef HAL_EXTI_MODULE_ENABLED - #define HAL_EXTI_MODULE_ENABLED // for ENDSTOP_INTERRUPTS_FEATURE -#endif +#undef HAL_CAN_LEGACY_MODULE_ENABLED +#undef HAL_CAN_MODULE_ENABLED +#undef HAL_DAC_MODULE_ENABLED +#undef HAL_RTC_MODULE_ENABLED +#define HAL_EXTI_MODULE_ENABLED // for ENDSTOP_INTERRUPTS_FEATURE /** * @brief List of modules in the framework (first ones enabled by default) @@ -92,7 +74,6 @@ extern "C" { //#define HAL_CEC_MODULE_ENABLED //#define HAL_CRC_MODULE_ENABLED //#define HAL_ETH_MODULE_ENABLED -//#define HAL_EXTI_MODULE_ENABLED //#define HAL_HCD_MODULE_ENABLED //#define HAL_I2S_MODULE_ENABLED //#define HAL_IRDA_MODULE_ENABLED diff --git a/buildroot/share/PlatformIO/variants/MARLIN_F103Zx/hal_conf_custom.h b/buildroot/share/PlatformIO/variants/MARLIN_F103Zx/hal_conf_custom.h index 4e55fe1240f3..fc2ec72587a2 100644 --- a/buildroot/share/PlatformIO/variants/MARLIN_F103Zx/hal_conf_custom.h +++ b/buildroot/share/PlatformIO/variants/MARLIN_F103Zx/hal_conf_custom.h @@ -47,7 +47,7 @@ extern "C" { //#define HAL_DAC_MODULE_ENABLED //#define HAL_DMA_MODULE_ENABLED //#define HAL_ETH_MODULE_ENABLED -//#define HAL_EXTI_MODULE_ENABLED +#define HAL_EXTI_MODULE_ENABLED // Needed for Endstop (and other external) Interrupts //#define HAL_FLASH_MODULE_ENABLED //#define HAL_GPIO_MODULE_ENABLED //#define HAL_HCD_MODULE_ENABLED diff --git a/buildroot/share/PlatformIO/variants/MARLIN_F407VE/hal_conf_custom.h b/buildroot/share/PlatformIO/variants/MARLIN_F407VE/hal_conf_custom.h index 1252bc705952..58e9646b57f5 100644 --- a/buildroot/share/PlatformIO/variants/MARLIN_F407VE/hal_conf_custom.h +++ b/buildroot/share/PlatformIO/variants/MARLIN_F407VE/hal_conf_custom.h @@ -36,6 +36,7 @@ extern "C" { #define HAL_CRC_MODULE_ENABLED #define HAL_DAC_MODULE_ENABLED #define HAL_DMA_MODULE_ENABLED +#define HAL_EXTI_MODULE_ENABLED // Needed for Endstop (and other external) Interrupts #define HAL_FLASH_MODULE_ENABLED #define HAL_GPIO_MODULE_ENABLED #define HAL_I2C_MODULE_ENABLED @@ -61,7 +62,6 @@ extern "C" { //#define HAL_SRAM_MODULE_ENABLED //#define HAL_SDRAM_MODULE_ENABLED //#define HAL_HASH_MODULE_ENABLED -//#define HAL_EXTI_MODULE_ENABLED //#define HAL_SMBUS_MODULE_ENABLED //#define HAL_I2S_MODULE_ENABLED //#define HAL_IWDG_MODULE_ENABLED diff --git a/buildroot/share/PlatformIO/variants/MARLIN_F4x7Vx/hal_conf_extra.h b/buildroot/share/PlatformIO/variants/MARLIN_F4x7Vx/hal_conf_extra.h index 0c44f0874224..952fe3c5b881 100644 --- a/buildroot/share/PlatformIO/variants/MARLIN_F4x7Vx/hal_conf_extra.h +++ b/buildroot/share/PlatformIO/variants/MARLIN_F4x7Vx/hal_conf_extra.h @@ -40,6 +40,7 @@ #define HAL_CRC_MODULE_ENABLED #define HAL_DAC_MODULE_ENABLED #define HAL_DMA_MODULE_ENABLED +#define HAL_EXTI_MODULE_ENABLED // Needed for Endstop (and other external) Interrupts #define HAL_GPIO_MODULE_ENABLED #define HAL_I2C_MODULE_ENABLED #define HAL_PWR_MODULE_ENABLED @@ -64,7 +65,6 @@ //#define HAL_SRAM_MODULE_ENABLED //#define HAL_SDRAM_MODULE_ENABLED //#define HAL_HASH_MODULE_ENABLED -//#define HAL_EXTI_MODULE_ENABLED //#define HAL_SMBUS_MODULE_ENABLED //#define HAL_I2S_MODULE_ENABLED //#define HAL_IWDG_MODULE_ENABLED diff --git a/buildroot/share/PlatformIO/variants/MARLIN_FYSETC_CHEETAH_V20/hal_conf_custom.h b/buildroot/share/PlatformIO/variants/MARLIN_FYSETC_CHEETAH_V20/hal_conf_custom.h index 395bfcd4b764..2ff2fd686ea4 100644 --- a/buildroot/share/PlatformIO/variants/MARLIN_FYSETC_CHEETAH_V20/hal_conf_custom.h +++ b/buildroot/share/PlatformIO/variants/MARLIN_FYSETC_CHEETAH_V20/hal_conf_custom.h @@ -35,6 +35,7 @@ extern "C" { #define HAL_ADC_MODULE_ENABLED #define HAL_CRC_MODULE_ENABLED #define HAL_DMA_MODULE_ENABLED +#define HAL_EXTI_MODULE_ENABLED // Needed for Endstop (and other external) Interrupts #define HAL_FLASH_MODULE_ENABLED #define HAL_GPIO_MODULE_ENABLED #define HAL_I2C_MODULE_ENABLED @@ -61,7 +62,6 @@ extern "C" { //#define HAL_SRAM_MODULE_ENABLED //#define HAL_SDRAM_MODULE_ENABLED //#define HAL_HASH_MODULE_ENABLED -//#define HAL_EXTI_MODULE_ENABLED //#define HAL_SMBUS_MODULE_ENABLED //#define HAL_I2S_MODULE_ENABLED //#define HAL_LTDC_MODULE_ENABLED diff --git a/buildroot/share/PlatformIO/variants/MARLIN_LERDGE/variant.h b/buildroot/share/PlatformIO/variants/MARLIN_LERDGE/variant.h index 692cce69c94a..f4488356b7d0 100644 --- a/buildroot/share/PlatformIO/variants/MARLIN_LERDGE/variant.h +++ b/buildroot/share/PlatformIO/variants/MARLIN_LERDGE/variant.h @@ -214,7 +214,7 @@ extern "C" { //#define HAL_DAC_MODULE_ENABLED #define HAL_SD_MODULE_ENABLED #define HAL_SRAM_MODULE_ENABLED -#define HAL_EXTI_MODULE_ENABLED +#define HAL_EXTI_MODULE_ENABLED // Needed for Endstop (and other external) Interrupts #ifdef __cplusplus } // extern "C" diff --git a/buildroot/share/PlatformIO/variants/MARLIN_STEVAL_F401VE/hal_conf_custom.h b/buildroot/share/PlatformIO/variants/MARLIN_STEVAL_F401VE/hal_conf_custom.h index aeaaf890f24b..7d013d2b27f4 100644 --- a/buildroot/share/PlatformIO/variants/MARLIN_STEVAL_F401VE/hal_conf_custom.h +++ b/buildroot/share/PlatformIO/variants/MARLIN_STEVAL_F401VE/hal_conf_custom.h @@ -35,6 +35,7 @@ extern "C" { #define HAL_ADC_MODULE_ENABLED #define HAL_CRC_MODULE_ENABLED #define HAL_DMA_MODULE_ENABLED +#define HAL_EXTI_MODULE_ENABLED // Needed for Endstop (and other external) Interrupts #define HAL_FLASH_MODULE_ENABLED #define HAL_GPIO_MODULE_ENABLED #define HAL_I2C_MODULE_ENABLED @@ -62,7 +63,6 @@ extern "C" { //#define HAL_SRAM_MODULE_ENABLED //#define HAL_SDRAM_MODULE_ENABLED //#define HAL_HASH_MODULE_ENABLED -//#define HAL_EXTI_MODULE_ENABLED //#define HAL_SMBUS_MODULE_ENABLED //#define HAL_I2S_MODULE_ENABLED //#define HAL_LTDC_MODULE_ENABLED diff --git a/buildroot/share/PlatformIO/variants/MARLIN_TH3D_EZBOARD_LITE_V2/hal_conf_extra.h b/buildroot/share/PlatformIO/variants/MARLIN_TH3D_EZBOARD_LITE_V2/hal_conf_extra.h index 8c46edb50e6e..2ad290502338 100755 --- a/buildroot/share/PlatformIO/variants/MARLIN_TH3D_EZBOARD_LITE_V2/hal_conf_extra.h +++ b/buildroot/share/PlatformIO/variants/MARLIN_TH3D_EZBOARD_LITE_V2/hal_conf_extra.h @@ -36,6 +36,19 @@ */ #define HAL_MODULE_ENABLED #define HAL_ADC_MODULE_ENABLED +#define HAL_DMA_MODULE_ENABLED +#define HAL_FLASH_MODULE_ENABLED +#define HAL_GPIO_MODULE_ENABLED +#define HAL_EXTI_MODULE_ENABLED // Needed for Endstop (and other external) Interrupts +#define HAL_PWR_MODULE_ENABLED +#define HAL_RCC_MODULE_ENABLED +#define HAL_SPI_MODULE_ENABLED +#define HAL_TIM_MODULE_ENABLED +#define HAL_USART_MODULE_ENABLED +#define HAL_CORTEX_MODULE_ENABLED +#define HAL_PCD_MODULE_ENABLED +//#define HAL_UART_MODULE_ENABLED // by default + //#define HAL_CAN_MODULE_ENABLED //#define HAL_CAN_LEGACY_MODULE_ENABLED //#define HAL_CRC_MODULE_ENABLED @@ -43,40 +56,28 @@ //#define HAL_CRYP_MODULE_ENABLED //#define HAL_DAC_MODULE_ENABLED //#define HAL_DCMI_MODULE_ENABLED -#define HAL_DMA_MODULE_ENABLED //#define HAL_DMA2D_MODULE_ENABLED //#define HAL_ETH_MODULE_ENABLED -#define HAL_FLASH_MODULE_ENABLED //#define HAL_NAND_MODULE_ENABLED //#define HAL_NOR_MODULE_ENABLED //#define HAL_PCCARD_MODULE_ENABLED //#define HAL_SRAM_MODULE_ENABLED //#define HAL_SDRAM_MODULE_ENABLED //#define HAL_HASH_MODULE_ENABLED -#define HAL_GPIO_MODULE_ENABLED -//#define HAL_EXTI_MODULE_ENABLED //#define HAL_I2C_MODULE_ENABLED //#define HAL_SMBUS_MODULE_ENABLED //#define HAL_I2S_MODULE_ENABLED //#define HAL_IWDG_MODULE_ENABLED //#define HAL_LTDC_MODULE_ENABLED //#define HAL_DSI_MODULE_ENABLED -#define HAL_PWR_MODULE_ENABLED //#define HAL_QSPI_MODULE_ENABLED -#define HAL_RCC_MODULE_ENABLED //#define HAL_RNG_MODULE_ENABLED //#define HAL_RTC_MODULE_ENABLED //#define HAL_SAI_MODULE_ENABLED //#define HAL_SD_MODULE_ENABLED -#define HAL_SPI_MODULE_ENABLED -#define HAL_TIM_MODULE_ENABLED -//#define HAL_UART_MODULE_ENABLED // by default -#define HAL_USART_MODULE_ENABLED //#define HAL_IRDA_MODULE_ENABLED //#define HAL_SMARTCARD_MODULE_ENABLED //#define HAL_WWDG_MODULE_ENABLED -#define HAL_CORTEX_MODULE_ENABLED -#define HAL_PCD_MODULE_ENABLED //#define HAL_HCD_MODULE_ENABLED //#define HAL_FMPI2C_MODULE_ENABLED //#define HAL_SPDIFRX_MODULE_ENABLED From afea7a242f6f4df0809ad1262db75e660b8970ba Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 31 Aug 2021 17:23:31 -0500 Subject: [PATCH 28/31] Combine some TFTs, add a resolution --- Marlin/Configuration.h | 1 + Marlin/src/inc/Conditionals_LCD.h | 40 +++++++------------------------ 2 files changed, 9 insertions(+), 32 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index ac98b1b322b7..c4613d71d436 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -2707,6 +2707,7 @@ //#define TFT_RES_320x240 //#define TFT_RES_480x272 //#define TFT_RES_480x320 + //#define TFT_RES_1024x600 #endif /** diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index d3324734c102..13af3c25f5ff 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -1219,34 +1219,19 @@ */ #if ENABLED(MKS_TS35_V2_0) // ST7796 #define TFT_DEFAULT_DRIVER ST7796 - #define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY) + #define TFT_DEFAULT_ORIENTATION TFT_EXCHANGE_XY #define TFT_RES_480x320 #define TFT_INTERFACE_SPI -#elif ENABLED(LERDGE_TFT35) // ST7796 - #define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY) +#elif EITHER(LERDGE_TFT35, ANET_ET5_TFT35) // ST7796 + #define TFT_DEFAULT_ORIENTATION TFT_EXCHANGE_XY #define TFT_RES_480x320 #define TFT_INTERFACE_FSMC -#elif ENABLED(ANET_ET5_TFT35) // ST7796 - #define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY) - #define TFT_RES_480x320 - #define TFT_INTERFACE_FSMC -#elif ENABLED(ANET_ET4_TFT28) // ST7789 - #define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY | TFT_INVERT_Y) - #define TFT_RES_320x240 - #define TFT_INTERFACE_FSMC -#elif ENABLED(MKS_ROBIN_TFT24) // ST7789 +#elif ANY(ANET_ET4_TFT28, MKS_ROBIN_TFT24, MKS_ROBIN_TFT28, MKS_ROBIN_TFT32) // ST7789 #define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY | TFT_INVERT_Y) #define TFT_RES_320x240 #define TFT_INTERFACE_FSMC -#elif ENABLED(MKS_ROBIN_TFT28) // ST7789 - #define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY | TFT_INVERT_Y) - #define TFT_RES_320x240 - #define TFT_INTERFACE_FSMC -#elif ENABLED(MKS_ROBIN_TFT32) // ST7789 - #define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY | TFT_INVERT_Y) - #define TFT_RES_320x240 - #define TFT_INTERFACE_FSMC -#elif ENABLED(MKS_ROBIN_TFT35) // ILI9488 +#elif ANY(MKS_ROBIN_TFT35, TFT_TRONXY_X5SA, ANYCUBIC_TFT35) // ILI9488 + #define TFT_DRIVER ILI9488 #define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY | TFT_INVERT_X | TFT_INVERT_Y) #define TFT_RES_480x320 #define TFT_INTERFACE_FSMC @@ -1255,21 +1240,12 @@ #define TFT_DEFAULT_ORIENTATION 0 #define TFT_RES_480x272 #define TFT_INTERFACE_FSMC -#elif ENABLED(MKS_ROBIN_TFT_V1_1R) // ILI9328 or R61505 - #define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY | TFT_INVERT_X | TFT_INVERT_Y) - #define TFT_RES_320x240 - #define TFT_INTERFACE_FSMC -#elif EITHER(TFT_TRONXY_X5SA, ANYCUBIC_TFT35) // ILI9488 - #define TFT_DRIVER ILI9488 - #define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY | TFT_INVERT_X | TFT_INVERT_Y) - #define TFT_RES_480x320 - #define TFT_INTERFACE_FSMC -#elif ENABLED(LONGER_LK_TFT28) +#elif ANY(MKS_ROBIN_TFT_V1_1R, LONGER_LK_TFT28) // ILI9328 or R61505 #define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY | TFT_INVERT_X | TFT_INVERT_Y) #define TFT_RES_320x240 #define TFT_INTERFACE_FSMC #elif ENABLED(BIQU_BX_TFT70) // RGB - #define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY) + #define TFT_DEFAULT_ORIENTATION TFT_EXCHANGE_XY #define TFT_RES_1024x600 #define TFT_INTERFACE_LTDC #if ENABLED(TOUCH_SCREEN) From c820a56f9980cabe33775fefea316800d23393e4 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 31 Aug 2021 23:56:15 -0500 Subject: [PATCH 29/31] Final tweaks --- Marlin/src/pins/stm32f4/pins_LERDGE_S.h | 8 +++----- .../MARLIN_F103VE_LONGER/hal_conf_custom.h | 19 ++++++++----------- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/Marlin/src/pins/stm32f4/pins_LERDGE_S.h b/Marlin/src/pins/stm32f4/pins_LERDGE_S.h index f4eb31056eed..a4070b3583ff 100644 --- a/Marlin/src/pins/stm32f4/pins_LERDGE_S.h +++ b/Marlin/src/pins/stm32f4/pins_LERDGE_S.h @@ -171,13 +171,12 @@ // // Persistent Storage // If no option is selected below the SD Card will be used -// Prefer the I2C one (F-RAM) to store marlin settings, SPI one is not working yet +// Prefer the I2C option (F-RAM) to store Marlin settings, SPI option is not working yet //#define SPI_EEPROM //#define I2C_EEPROM -#if ENABLED(SPI_EEPROM) - // SPI EEPROM Winbond W25Q128 (128Mbits) https://www.pjrc.com/teensy/W25Q128FV.pdf +#if ENABLED(SPI_EEPROM) // SPI EEPROM Winbond W25Q128 (128Mbits) https://www.pjrc.com/teensy/W25Q128FV.pdf #define SPI_CHAN_EEPROM1 1 #define SPI_EEPROM1_CS_PIN PB12 // datasheet: /CS pin, found with multimeter, not tested #define EEPROM_SCK_PIN PB13 // datasheet: CLK pin, found with multimeter, not tested @@ -185,8 +184,7 @@ #define EEPROM_MOSI_PIN PB15 // datasheet: DI pin, found with multimeter, not tested #define EEPROM_PAGE_SIZE 0x1000U // 4KB (from datasheet) #define MARLIN_EEPROM_SIZE 16UL * (EEPROM_PAGE_SIZE) // Limit to 64KB for now... -#elif ENABLED(I2C_EEPROM) - // FM24CL64BG (CYP1813) 64Kbit F-RAM +#elif ENABLED(I2C_EEPROM) // FM24CL64BG (CYP1813) 64Kbit F-RAM #define SOFT_I2C_EEPROM // Force the use of Software I2C #define I2C_SDA_PIN PG13 #define I2C_SCL_PIN PG14 // To be confirmed on the Lerdge S, but probably same as the K diff --git a/buildroot/share/PlatformIO/variants/MARLIN_F103VE_LONGER/hal_conf_custom.h b/buildroot/share/PlatformIO/variants/MARLIN_F103VE_LONGER/hal_conf_custom.h index d737357eb22d..3a6b7037adf0 100644 --- a/buildroot/share/PlatformIO/variants/MARLIN_F103VE_LONGER/hal_conf_custom.h +++ b/buildroot/share/PlatformIO/variants/MARLIN_F103VE_LONGER/hal_conf_custom.h @@ -20,11 +20,6 @@ extern "C" { */ #include "stm32yyxx_hal_conf.h" -#undef HAL_PWR_MODULE_ENABLED -#define HAL_PWR_MODULE_ONLY // disable low power & PA0 wakeup pin (its T°c pin) - -#define HAL_IWDG_MODULE_ENABLED // USE_WATCHDOG - #ifdef HAL_PCD_MODULE_ENABLED #warning "No direct STM32 USB pins on Longer3D board" #undef HAL_PCD_MODULE_ENABLED // USB Device @@ -35,18 +30,20 @@ extern "C" { #undef HAL_HCD_MODULE_ENABLED // USB Host #endif -//#define HAL_USART_MODULE_ENABLED // Useless.... UART_MODULE does it +#define HAL_EXTI_MODULE_ENABLED // Needed for Endstop (and other external) Interrupts +#define HAL_IWDG_MODULE_ENABLED // USE_WATCHDOG + +#undef HAL_PWR_MODULE_ENABLED +#define HAL_PWR_MODULE_ONLY // disable low power & PA0 wakeup pin (its T°c pin) #undef HAL_CAN_LEGACY_MODULE_ENABLED #undef HAL_CAN_MODULE_ENABLED #undef HAL_DAC_MODULE_ENABLED #undef HAL_RTC_MODULE_ENABLED -#define HAL_EXTI_MODULE_ENABLED // for ENDSTOP_INTERRUPTS_FEATURE - /** - * @brief List of modules in the framework (first ones enabled by default) - */ + * @brief List of modules in the framework (first ones enabled by default) + */ //#define HAL_MODULE_ENABLED //#define HAL_ADC_MODULE_ENABLED //#define HAL_CORTEX_MODULE_ENABLED @@ -77,7 +74,7 @@ extern "C" { //#define HAL_NOR_MODULE_ENABLED //#define HAL_PCCARD_MODULE_ENABLED //#define HAL_SMARTCARD_MODULE_ENABLED -//#define HAL_USART_MODULE_ENABLED +//#define HAL_USART_MODULE_ENABLED // Useless.... UART_MODULE does it //#define HAL_WWDG_MODULE_ENABLED //#define HAL_MMC_MODULE_ENABLED From a9f4e81a04e815161c3345b5300c48256e47842d Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 1 Sep 2021 18:49:05 -0500 Subject: [PATCH 30/31] Update stm32f4.ini --- ini/stm32f4.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ini/stm32f4.ini b/ini/stm32f4.ini index da0faa6b77a1..6870345121d8 100644 --- a/ini/stm32f4.ini +++ b/ini/stm32f4.ini @@ -255,7 +255,7 @@ board_build.encrypt = firmware.bin board_build.offset = 0x10000 build_flags = ${stm32_variant.build_flags} -DSTM32F4 -DSTM32F4xx -DTARGET_STM32F4 - -DDISABLE_GENERIC_SERIALUSB -DARDUINO_ARCH_STM32 -DARDUINO_LERDGE -DLERDGE_TFT35 + -DDISABLE_GENERIC_SERIALUSB -DARDUINO_ARCH_STM32 -DLERDGE_TFT35 build_unflags = ${stm32_variant.build_unflags} -DUSBCON -DUSBD_USE_CDC -DUSBD_VID=0x0483 extra_scripts = ${stm32_variant.extra_scripts} buildroot/share/PlatformIO/scripts/lerdge.py From f7ff1372f3762a8dc0f29c392c87b858a4f0fe35 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 1 Sep 2021 18:53:09 -0500 Subject: [PATCH 31/31] Avoid AUTO where possible --- Marlin/src/pins/linux/pins_RAMPS_LINUX.h | 4 ++-- Marlin/src/pins/stm32f4/pins_LERDGE_K.h | 3 +++ Marlin/src/pins/stm32f4/pins_LERDGE_S.h | 3 +++ Marlin/src/pins/stm32f4/pins_LERDGE_X.h | 3 +++ 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Marlin/src/pins/linux/pins_RAMPS_LINUX.h b/Marlin/src/pins/linux/pins_RAMPS_LINUX.h index 1b3cf15e5afe..04f9afaad212 100644 --- a/Marlin/src/pins/linux/pins_RAMPS_LINUX.h +++ b/Marlin/src/pins/linux/pins_RAMPS_LINUX.h @@ -427,10 +427,10 @@ #define TFT_DRIVER ST7796 #endif #ifndef XPT2046_X_CALIBRATION - #define XPT2046_X_CALIBRATION 63934 + #define XPT2046_X_CALIBRATION 63934 #endif #ifndef XPT2046_Y_CALIBRATION - #define XPT2046_Y_CALIBRATION 63598 + #define XPT2046_Y_CALIBRATION 63598 #endif #ifndef XPT2046_X_OFFSET #define XPT2046_X_OFFSET -1 diff --git a/Marlin/src/pins/stm32f4/pins_LERDGE_K.h b/Marlin/src/pins/stm32f4/pins_LERDGE_K.h index d4b4ed52b40b..3cfa3cd3e5c2 100644 --- a/Marlin/src/pins/stm32f4/pins_LERDGE_K.h +++ b/Marlin/src/pins/stm32f4/pins_LERDGE_K.h @@ -238,6 +238,9 @@ // TFT with FSMC interface // #if HAS_FSMC_TFT + #ifndef TFT_DRIVER + #define TFT_DRIVER ST7796 + #endif #define ST7796S_INVERTED #define TFT_RESET_PIN PD6 diff --git a/Marlin/src/pins/stm32f4/pins_LERDGE_S.h b/Marlin/src/pins/stm32f4/pins_LERDGE_S.h index a4070b3583ff..2d5a45eee0af 100644 --- a/Marlin/src/pins/stm32f4/pins_LERDGE_S.h +++ b/Marlin/src/pins/stm32f4/pins_LERDGE_S.h @@ -197,6 +197,9 @@ // TFT with FSMC interface // #if HAS_FSMC_TFT + #ifndef TFT_DRIVER + #define TFT_DRIVER ST7796 + #endif #define ST7796S_INVERTED #define TFT_RESET_PIN PD6 diff --git a/Marlin/src/pins/stm32f4/pins_LERDGE_X.h b/Marlin/src/pins/stm32f4/pins_LERDGE_X.h index 1abafde2db27..f65476c0b705 100644 --- a/Marlin/src/pins/stm32f4/pins_LERDGE_X.h +++ b/Marlin/src/pins/stm32f4/pins_LERDGE_X.h @@ -142,6 +142,9 @@ // TFT with FSMC interface // #if HAS_FSMC_TFT + #ifndef TFT_DRIVER + #define TFT_DRIVER ST7796 + #endif #define ST7796S_INVERTED #define FSMC_CS_PIN PD7