From 154decfc66c30808cfe7320e542fcf90427d7176 Mon Sep 17 00:00:00 2001 From: Roxy-3D Date: Mon, 19 Jul 2021 18:59:06 -0600 Subject: [PATCH 01/15] Update vector_3.cpp Fix the regression for G29 J in UBL --- Marlin/src/libs/vector_3.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Marlin/src/libs/vector_3.cpp b/Marlin/src/libs/vector_3.cpp index b8202217dd..4db8fb5f2e 100644 --- a/Marlin/src/libs/vector_3.cpp +++ b/Marlin/src/libs/vector_3.cpp @@ -104,9 +104,9 @@ matrix_3x3 matrix_3x3::create_from_rows(const vector_3 &row_0, const vector_3 &r //row_1.debug(PSTR("row_1")); //row_2.debug(PSTR("row_2")); matrix_3x3 new_matrix; - new_matrix.vectors[0].x = row_0.x; new_matrix.vectors[1].y = row_0.y; new_matrix.vectors[2].z = row_0.z; - new_matrix.vectors[3].x = row_1.x; new_matrix.vectors[4].y = row_1.y; new_matrix.vectors[5].z = row_1.z; - new_matrix.vectors[6].x = row_2.x; new_matrix.vectors[7].y = row_2.y; new_matrix.vectors[8].z = row_2.z; + new_matrix.vectors[0] = row_0; + new_matrix.vectors[1] = row_1; + new_matrix.vectors[2] = row_2; //new_matrix.debug(PSTR("new_matrix")); return new_matrix; } From 3fdf40fd29099025bd6aa81413222aaef0058439 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Tue, 20 Jul 2021 01:04:54 +0000 Subject: [PATCH 02/15] [cron] Bump distribution date (2021-07-20) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index ea80f51d28..d559910437 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2021-07-19" +//#define STRING_DISTRIBUTION_DATE "2021-07-20" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 29249b0b9b..ea126d2855 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2021-07-19" + #define STRING_DISTRIBUTION_DATE "2021-07-20" #endif /** From da0450605a31626f423808c4842256671152c489 Mon Sep 17 00:00:00 2001 From: Katelyn Schiesser Date: Tue, 20 Jul 2021 12:20:28 -0700 Subject: [PATCH 03/15] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Refactor=20STM32=20i?= =?UTF-8?q?ni=20files=20(#22377)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Scott Lahteine --- .../boards/marlin_STEVAL_STM32F401VE.json | 2 +- .../boards/marlin_blackSTM32F407VET6.json | 2 +- ini/stm32-common.ini | 41 ++ ini/stm32f0.ini | 10 +- ini/stm32f1.ini | 392 ++++++++---------- ini/stm32f4.ini | 318 +++++++------- ini/stm32f7.ini | 26 -- ini/stm32h7.ini | 41 ++ platformio.ini | 2 + 9 files changed, 411 insertions(+), 423 deletions(-) create mode 100644 ini/stm32-common.ini create mode 100644 ini/stm32h7.ini diff --git a/buildroot/share/PlatformIO/boards/marlin_STEVAL_STM32F401VE.json b/buildroot/share/PlatformIO/boards/marlin_STEVAL_STM32F401VE.json index e89ca0af73..e260950f25 100644 --- a/buildroot/share/PlatformIO/boards/marlin_STEVAL_STM32F401VE.json +++ b/buildroot/share/PlatformIO/boards/marlin_STEVAL_STM32F401VE.json @@ -2,7 +2,7 @@ "build": { "core": "stm32", "cpu": "cortex-m4", - "extra_flags": "-DSTM32F401xx", + "extra_flags": "-DSTM32F401xx -DARDUINO_STEVAL", "f_cpu": "84000000L", "hwids": [ [ diff --git a/buildroot/share/PlatformIO/boards/marlin_blackSTM32F407VET6.json b/buildroot/share/PlatformIO/boards/marlin_blackSTM32F407VET6.json index a3f130c6b1..b0fd9db939 100644 --- a/buildroot/share/PlatformIO/boards/marlin_blackSTM32F407VET6.json +++ b/buildroot/share/PlatformIO/boards/marlin_blackSTM32F407VET6.json @@ -2,7 +2,7 @@ "build": { "core": "stm32", "cpu": "cortex-m4", - "extra_flags": "-DSTM32F407xx", + "extra_flags": "-DSTM32F407xx -DARDUINO_BLACK_F407VE", "f_cpu": "168000000L", "hwids": [ [ diff --git a/ini/stm32-common.ini b/ini/stm32-common.ini new file mode 100644 index 0000000000..4ae068939e --- /dev/null +++ b/ini/stm32-common.ini @@ -0,0 +1,41 @@ +# +# Marlin Firmware +# PlatformIO Configuration File +# + +#################################### +# +# HAL/STM32 Common Environments +# +#################################### + +[common_stm32] +platform = ststm32@~12.1 +board_build.core = stm32 +build_flags = ${common.build_flags} + -std=gnu++14 + -DUSBCON -DUSBD_USE_CDC + -DTIM_IRQ_PRIO=13 + -DADC_RESOLUTION=12 +build_unflags = -std=gnu++11 +src_filter = ${common.default_src_filter} + + +extra_scripts = ${common.extra_scripts} + pre:buildroot/share/PlatformIO/scripts/stm32_serialbuffer.py + +# +# STM32 board based on a variant. +# +[stm32_variant] +extends = common_stm32 +extra_scripts = ${common_stm32.extra_scripts} + pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py + buildroot/share/PlatformIO/scripts/offset_and_rename.py + +# +# USB Flash Drive mix-ins for STM32 +# +[stm_flash_drive] +platform_packages = framework-arduinoststm32@https://github.com/rhapsodyv/Arduino_Core_STM32/archive/usb-host-msc-cdc-msc-3.zip +build_flags = ${common_stm32.build_flags} + -DHAL_PCD_MODULE_ENABLED -DHAL_HCD_MODULE_ENABLED + -DUSBHOST -DUSBH_IRQ_PRIO=3 -DUSBH_IRQ_SUBPRIO=4 diff --git a/ini/stm32f0.ini b/ini/stm32f0.ini index 64568e4b4c..6aebd88298 100644 --- a/ini/stm32f0.ini +++ b/ini/stm32f0.ini @@ -27,8 +27,8 @@ platform = ${common_stm32.platform} extends = common_stm32 board = marlin_malyanM200v2 build_flags = ${common_stm32.build_flags} -DHAL_PCD_MODULE_ENABLED - -O2 -ffreestanding -fsigned-char -fno-move-loop-invariants -fno-strict-aliasing - -DCUSTOM_STARTUP_FILE + -O2 -ffreestanding -fsigned-char -fno-move-loop-invariants + -fno-strict-aliasing -DCUSTOM_STARTUP_FILE # # Malyan M200 v2 (STM32F070CB) @@ -38,7 +38,8 @@ platform = ${common_stm32.platform} extends = common_stm32 board = malyanm200_f070cb build_flags = ${common_stm32.build_flags} - -DHAL_PCD_MODULE_ENABLED -DDISABLE_GENERIC_SERIALUSB -DHAL_UART_MODULE_ENABLED -DCUSTOM_STARTUP_FILE + -DHAL_PCD_MODULE_ENABLED -DDISABLE_GENERIC_SERIALUSB + -DHAL_UART_MODULE_ENABLED -DCUSTOM_STARTUP_FILE # # Malyan M300 (STM32F070CB) @@ -48,5 +49,6 @@ platform = ${common_stm32.platform} extends = common_stm32 board = malyanm300_f070cb build_flags = ${common_stm32.build_flags} - -DHAL_PCD_MODULE_ENABLED -DDISABLE_GENERIC_SERIALUSB -DHAL_UART_MODULE_ENABLED + -DHAL_PCD_MODULE_ENABLED -DDISABLE_GENERIC_SERIALUSB + -DHAL_UART_MODULE_ENABLED src_filter = ${common.default_src_filter} + diff --git a/ini/stm32f1.ini b/ini/stm32f1.ini index f487dc62fc..0f1d308660 100644 --- a/ini/stm32f1.ini +++ b/ini/stm32f1.ini @@ -10,70 +10,48 @@ # Naming Example: STM32F103RCT6 # # F : Foundation (sometimes High Performance F2/F4) -# 1 : Cortex M1 core +# 1 : Cortex M3 core # 03 : Line/Features -# R : 64 or 66 pins (V:100, Z:144, I:176) -# C : 256KB Flash-memory (D:384KB, E:512KB, G:1024KB) +# R : 64 or 66 pins (T:36, C:48, V:100, Z:144, I:176) +# C : 256KB Flash-memory (B: 128KB, D:384KB, E:512KB, G:1024KB) # T : LQFP package # 6 : -40...85°C (7: ...105°C) # ################################# -# -# HAL/STM32 Base Environment values -# -[common_stm32] -platform = ststm32@~12.1 -build_flags = ${common.build_flags} - -std=gnu++14 - -DUSBCON -DUSBD_USE_CDC - -DTIM_IRQ_PRIO=13 - -DADC_RESOLUTION=12 -build_unflags = -std=gnu++11 -src_filter = ${common.default_src_filter} + + -extra_scripts = ${common.extra_scripts} - pre:buildroot/share/PlatformIO/scripts/stm32_serialbuffer.py - -[stm32f1_variant] -extra_scripts = ${common_stm32.extra_scripts} - pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py - buildroot/share/PlatformIO/scripts/offset_and_rename.py - -[common_STM32F103RC] -platform = ${common_stm32.platform} -extends = common_stm32 +[common_STM32F103RC_variant] +extends = stm32_variant board = genericSTM32F103RC -monitor_speed = 115200 -board_build.core = stm32 board_build.variant = MARLIN_F103Rx -extra_scripts = ${stm32f1_variant.extra_scripts} +build_flags = ${stm32_variant.build_flags} -DDEBUG_LEVEL=0 +monitor_speed = 115200 # # STM32F103RE # [env:STM32F103RE] -platform = ${common_stm32.platform} -extends = common_stm32 -board = genericSTM32F103RE -monitor_speed = 115200 +platform = ${common_stm32.platform} +extends = common_stm32 +board = genericSTM32F103RE +monitor_speed = 115200 # # STM32F103VE # [env:STM32F103VE] -platform = ${common_stm32.platform} -extends = common_stm32 -board = genericSTM32F103VE -monitor_speed = 115200 +platform = ${common_stm32.platform} +extends = common_stm32 +board = genericSTM32F103VE +monitor_speed = 115200 # # STM32F103ZE # [env:STM32F103ZE] -platform = ${common_stm32.platform} -extends = common_stm32 -board = genericSTM32F103ZE -monitor_speed = 115200 +platform = ${common_stm32.platform} +extends = common_stm32 +board = genericSTM32F103ZE +monitor_speed = 115200 # # BigTree SKR Mini V1.1 / SKR Mini E3 & MZ (STM32F103RCT6 ARM Cortex-M3) @@ -82,23 +60,23 @@ monitor_speed = 115200 # STM32F103RC_btt_USB ......... RCT6 with 256K (USB mass storage) # [env:STM32F103RC_btt] -platform = ${common_stm32.platform} -extends = common_STM32F103RC -build_flags = ${common_stm32.build_flags} -DDEBUG_LEVEL=0 -DTIMER_SERVO=TIM5 -board_build.offset = 0x7000 +platform = ${common_stm32.platform} +extends = common_STM32F103RC_variant +build_flags = ${common_STM32F103RC_variant.build_flags} + -DTIMER_SERVO=TIM5 +board_build.offset = 0x7000 board_upload.offset_address = 0x08007000 [env:STM32F103RC_btt_USB] -extends = env:STM32F103RC_btt platform = ${common_stm32.platform} -platform_packages = framework-arduinoststm32@https://github.com/rhapsodyv/Arduino_Core_STM32/archive/usb-host-msc-cdc-msc-3.zip +extends = env:STM32F103RC_btt +platform_packages = ${stm_flash_drive.platform_packages} +build_flags = ${env:STM32F103RC_btt.build_flags} + -DUSE_USB_FS + -DUSBD_IRQ_PRIO=5 + -DUSBD_IRQ_SUBPRIO=6 + -DUSBD_USE_CDC_MSC build_unflags = ${common_stm32.build_unflags} -DUSBD_USE_CDC -build_flags = ${env:STM32F103RC_btt.build_flags} ${env:stm32_flash_drive.build_flags} - -DUSBCON - -DUSE_USB_FS - -DUSBD_IRQ_PRIO=5 - -DUSBD_IRQ_SUBPRIO=6 - -DUSBD_USE_CDC_MSC # # MKS Robin (STM32F103ZET6) @@ -106,52 +84,53 @@ build_flags = ${env:STM32F103RC_btt.build_flags} ${env:stm32_flash_drive.b # [env:mks_robin] platform = ${common_stm32.platform} -extends = common_stm32 +extends = stm32_variant board = genericSTM32F103ZE -board_build.core = stm32 board_build.variant = MARLIN_F103Zx -board_build.offset = 0x7000 board_build.encrypt = Robin.bin -build_flags = ${common_stm32.build_flags} - -DENABLE_HWSERIAL3 -DTIMER_SERIAL=TIM5 -build_unflags = ${common_stm32.build_unflags} - -DUSBCON -DUSBD_USE_CDC -extra_scripts = ${stm32f1_variant.extra_scripts} -lib_deps = +board_build.offset = 0x7000 +build_flags = ${stm32_variant.build_flags} + -DENABLE_HWSERIAL3 -DTIMER_SERIAL=TIM5 +build_unflags = ${stm32_variant.build_unflags} + -DUSBCON -DUSBD_USE_CDC # # MKS Robin E3/E3D (STM32F103RCT6) with TMC2209 # [env:mks_robin_e3] platform = ${common_stm32.platform} -extends = common_STM32F103RC -build_flags = ${common_stm32.build_flags} -DDEBUG_LEVEL=0 -DTIMER_SERVO=TIM5 -DDEFAULT_SPI=3 -build_unflags = ${common_stm32.build_unflags} -DUSBCON -DUSBD_USE_CDC -monitor_speed = 115200 -board_build.offset = 0x5000 +extends = common_STM32F103RC_variant board_build.encrypt = Robin_e3.bin +board_build.offset = 0x5000 board_upload.offset_address = 0x08005000 +build_flags = ${common_STM32F103RC_variant.build_flags} + -DTIMER_SERVO=TIM5 -DDEFAULT_SPI=3 +build_unflags = ${common_STM32F103RC_variant.build_unflags} + -DUSBCON -DUSBD_USE_CDC +monitor_speed = 115200 debug_tool = stlink -extra_scripts = ${common_STM32F103RC.extra_scripts} # # Creality (STM32F103RET6) # [env:STM32F103RET6_creality] -platform = ${common_stm32.platform} -extends = common_stm32 -build_flags = ${common_stm32.build_flags} -DMCU_STM32F103RE -DHAL_SD_MODULE_ENABLED -DSS_TIMER=4 -DTIMER_SERVO=TIM5 -DENABLE_HWSERIAL3 -DTRANSFER_CLOCK_DIV=8 -board = genericSTM32F103RE -monitor_speed = 115200 -board_build.core = stm32 -board_build.variant = MARLIN_F103Rx -board_build.offset = 0x7000 +platform = ${common_stm32.platform} +extends = stm32_variant +board = genericSTM32F103RE +board_build.variant = MARLIN_F103Rx +board_build.offset = 0x7000 board_upload.offset_address = 0x08007000 -build_unflags = ${common_stm32.build_unflags} -DUSBCON -DUSBD_USE_CDC -extra_scripts = ${stm32f1_variant.extra_scripts} - pre:buildroot/share/PlatformIO/scripts/random-bin.py -debug_tool = jlink -upload_protocol = jlink +build_flags = ${stm32_variant.build_flags} + -DMCU_STM32F103RE -DHAL_SD_MODULE_ENABLED + -DSS_TIMER=4 -DTIMER_SERVO=TIM5 + -DENABLE_HWSERIAL3 -DTRANSFER_CLOCK_DIV=8 +build_unflags = ${stm32_variant.build_unflags} + -DUSBCON -DUSBD_USE_CDC +extra_scripts = ${stm32_variant.extra_scripts} + pre:buildroot/share/PlatformIO/scripts/random-bin.py +monitor_speed = 115200 +debug_tool = jlink +upload_protocol = jlink # # BigTree SKR Mini E3 V2.0 & DIP / SKR CR6 (STM32F103RET6 ARM Cortex-M3) @@ -160,80 +139,79 @@ upload_protocol = jlink # STM32F103RE_btt_USB ......... RET6 (USB mass storage) # [env:STM32F103RE_btt] -platform = ${common_stm32.platform} -extends = common_stm32 -build_flags = ${common_stm32.build_flags} -DMCU_STM32F103RE -DHAL_SD_MODULE_ENABLED -DSS_TIMER=4 -DTIMER_SERVO=TIM5 -DENABLE_HWSERIAL3 -DTRANSFER_CLOCK_DIV=8 -board = genericSTM32F103RE -monitor_speed = 115200 -board_build.core = stm32 -board_build.variant = MARLIN_F103Rx -board_build.offset = 0x7000 +platform = ${common_stm32.platform} +extends = stm32_variant +board = genericSTM32F103RE +board_build.variant = MARLIN_F103Rx +board_build.offset = 0x7000 board_upload.offset_address = 0x08007000 -build_unflags = ${common_stm32.build_unflags} -extra_scripts = ${stm32f1_variant.extra_scripts} -debug_tool = jlink -upload_protocol = jlink +build_flags = ${stm32_variant.build_flags} + -DMCU_STM32F103RE -DHAL_SD_MODULE_ENABLED + -DSS_TIMER=4 -DTIMER_SERVO=TIM5 + -DENABLE_HWSERIAL3 -DTRANSFER_CLOCK_DIV=8 +monitor_speed = 115200 +debug_tool = jlink +upload_protocol = jlink [env:STM32F103RE_btt_USB] -extends = env:STM32F103RE_btt platform = ${common_stm32.platform} -platform_packages = framework-arduinoststm32@https://github.com/rhapsodyv/Arduino_Core_STM32/archive/usb-host-msc-cdc-msc-3.zip -build_unflags = ${common_stm32.build_unflags} -DUSBD_USE_CDC -build_flags = ${env:STM32F103RE_btt.build_flags} ${env:stm32_flash_drive.build_flags} - -DUSBCON - -DUSE_USB_FS - -DUSBD_IRQ_PRIO=5 - -DUSBD_IRQ_SUBPRIO=6 - -DUSBD_USE_CDC_MSC +extends = env:STM32F103RE_btt +platform_packages = ${stm_flash_drive.platform_packages} +build_flags = ${env:STM32F103RE_btt.build_flags} + -DUSE_USB_FS -DUSBD_IRQ_PRIO=5 + -DUSBD_IRQ_SUBPRIO=6 -DUSBD_USE_CDC_MSC +build_unflags = ${stm32_variant.build_unflags} -DUSBD_USE_CDC # # FLSUN QQS Pro (STM32F103VET6) # board Hispeedv1 # [env:flsun_hispeedv1] -platform = ${common_stm32.platform} -extends = common_stm32 -build_flags = ${common_stm32.build_flags} -DMCU_STM32F103VE -DSS_TIMER=4 -DENABLE_HWSERIAL3 -DTIMER_TONE=TIM3 -DTIMER_SERVO=TIM2 -board = genericSTM32F103VE -board_build.core = stm32 -board_build.variant = MARLIN_F103Vx -board_build.offset = 0x7000 -board_build.encrypt = Robin_mini.bin +platform = ${common_stm32.platform} +extends = stm32_variant +board = genericSTM32F103VE +board_build.variant = MARLIN_F103Vx +board_build.encrypt = Robin_mini.bin +board_build.offset = 0x7000 board_upload.offset_address = 0x08007000 -build_unflags = ${common_stm32.build_unflags} -DUSBCON -DUSBD_USE_CDC -extra_scripts = ${stm32f1_variant.extra_scripts} +build_flags = ${stm32_variant.build_flags} + -DMCU_STM32F103VE -DSS_TIMER=4 -DENABLE_HWSERIAL3 + -DTIMER_TONE=TIM3 -DTIMER_SERVO=TIM2 +build_unflags = ${stm32_variant.build_unflags} + -DUSBCON -DUSBD_USE_CDC # # MKS Robin Nano V1.2 and V2 # [env:mks_robin_nano35] -platform = ${common_stm32.platform} -extends = common_stm32 -build_flags = ${common_stm32.build_flags} -DMCU_STM32F103VE -DSS_TIMER=4 -DENABLE_HWSERIAL3 -DTIMER_TONE=TIM3 -DTIMER_SERVO=TIM2 -board = genericSTM32F103VE -board_build.core = stm32 -board_build.variant = MARLIN_F103Vx -board_build.offset = 0x7000 -board_build.encrypt = Robin_nano35.bin +platform = ${common_stm32.platform} +extends = stm32_variant +board = genericSTM32F103VE +board_build.variant = MARLIN_F103Vx +board_build.encrypt = Robin_nano35.bin +board_build.offset = 0x7000 board_upload.offset_address = 0x08007000 -build_unflags = ${common_stm32.build_unflags} -DUSBCON -DUSBD_USE_CDC -debug_tool = jlink -upload_protocol = jlink -extra_scripts = ${stm32f1_variant.extra_scripts} +build_flags = ${stm32_variant.build_flags} + -DMCU_STM32F103VE -DSS_TIMER=4 -DENABLE_HWSERIAL3 + -DTIMER_TONE=TIM3 -DTIMER_SERVO=TIM2 +build_unflags = ${stm32_variant.build_unflags} + -DUSBCON -DUSBD_USE_CDC +debug_tool = jlink +upload_protocol = jlink # # Mingda MPX_ARM_MINI # [env:mingda_mpx_arm_mini] platform = ${common_stm32.platform} -extends = common_stm32 +extends = stm32_variant board = genericSTM32F103ZE -board_build.core = stm32 board_build.variant = MARLIN_F103Zx board_build.offset = 0x10000 -build_flags = ${common_stm32.build_flags} -DENABLE_HWSERIAL3 -DTIMER_SERIAL=TIM5 -build_unflags = ${common_stm32.build_unflags} -DUSBCON -DUSBD_USE_CDC -extra_scripts = ${stm32f1_variant.extra_scripts} +build_flags = ${stm32_variant.build_flags} + -DENABLE_HWSERIAL3 -DTIMER_SERIAL=TIM5 +build_unflags = ${stm32_variant.build_unflags} + -DUSBCON -DUSBD_USE_CDC # # Malyan M200 (STM32F103CB) @@ -243,67 +221,55 @@ platform = ${common_stm32.platform} extends = common_stm32 board = malyanm200_f103cb build_flags = ${common_stm32.build_flags} - -DHAL_PCD_MODULE_ENABLED -DDISABLE_GENERIC_SERIALUSB -DHAL_UART_MODULE_ENABLED + -DHAL_PCD_MODULE_ENABLED -DDISABLE_GENERIC_SERIALUSB + -DHAL_UART_MODULE_ENABLED src_filter = ${common.default_src_filter} + # # FLYmaker FLY Mini (STM32F103RCT6) # [env:FLY_MINI] -platform = ${common_stm32.platform} -extends = common_stm32 -build_flags = ${common_stm32.build_flags} -DSS_TIMER=4 -board = genericSTM32F103RC -board_build.core = stm32 -board_build.variant = MARLIN_F103Rx -board_build.offset = 0x5000 +platform = ${common_stm32.platform} +extends = stm32_variant +board = genericSTM32F103RC +board_build.variant = MARLIN_F103Rx +board_build.offset = 0x5000 board_upload.offset_address = 0x08005000 -extra_scripts = ${stm32f1_variant.extra_scripts} +build_flags = ${stm32_variant.build_flags} -DSS_TIMER=4 # # MKS Robin Mini (STM32F103VET6) # [env:mks_robin_mini] -platform = ${common_stm32.platform} -extends = common_stm32 -board = genericSTM32F103VE -board_build.core = stm32 -board_build.variant = MARLIN_F103Vx -board_build.offset = 0x7000 -board_build.encrypt = Robin_mini.bin -build_flags = ${common_stm32.build_flags} -DMCU_STM32F103VE -DTIMER_TONE=TIM3 -DTIMER_SERVO=TIM2 +platform = ${common_stm32.platform} +extends = stm32_variant +board = genericSTM32F103VE +board_build.variant = MARLIN_F103Vx +board_build.encrypt = Robin_mini.bin +board_build.offset = 0x7000 board_upload.offset_address = 0x08007000 -extra_scripts = ${stm32f1_variant.extra_scripts} +build_flags = ${stm32_variant.build_flags} + -DMCU_STM32F103VE -DTIMER_TONE=TIM3 -DTIMER_SERVO=TIM2 # # MKS Robin Lite/Lite2 (STM32F103RCT6) # [env:mks_robin_lite] -platform = ${common_stm32.platform} -extends = common_stm32 -board = genericSTM32F103RC -board_build.core = stm32 -board_build.variant = MARLIN_F103Rx -board_build.offset = 0x5000 -board_build.encrypt = mksLite.bin -build_flags = ${common_stm32.build_flags} +platform = ${common_stm32.platform} +extends = stm32_variant +board = genericSTM32F103RC +board_build.variant = MARLIN_F103Rx +board_build.encrypt = mksLite.bin +board_build.offset = 0x5000 board_upload.offset_address = 0x08005000 -extra_scripts = ${stm32f1_variant.extra_scripts} # # MKS ROBIN LITE3 (STM32F103RCT6) # [env:mks_robin_lite3] -platform = ${common_stm32.platform} -extends = common_stm32 -board = genericSTM32F103RC -board_build.core = stm32 -board_build.variant = MARLIN_F103Rx -board_build.offset = 0x5000 -board_build.encrypt = mksLite3.bin -build_flags = ${common_stm32.build_flags} -board_upload.offset_address = 0x08005000 -extra_scripts = ${stm32f1_variant.extra_scripts} +platform = ${common_stm32.platform} +extends = env:mks_robin_lite +board_build.encrypt = mksLite3.bin # # MKS Robin Pro (STM32F103ZET6) @@ -318,44 +284,43 @@ board_build.encrypt = Robin_pro.bin # - LVGL UI # [env:mks_robin_e3p] -platform = ${common_stm32.platform} -extends = common_stm32 -board = genericSTM32F103VE -board_build.core = stm32 -board_build.variant = MARLIN_F103Vx -board_build.offset = 0x7000 -board_build.encrypt = Robin_e3p.bin -build_flags = ${common_stm32.build_flags} -DMCU_STM32F103VE -DSS_TIMER=4 -DTIMER_TONE=TIM3 -DTIMER_SERVO=TIM2 +platform = ${common_stm32.platform} +extends = stm32_variant +board = genericSTM32F103VE +board_build.variant = MARLIN_F103Vx +board_build.encrypt = Robin_e3p.bin +board_build.offset = 0x7000 board_upload.offset_address = 0x08007000 -extra_scripts = ${stm32f1_variant.extra_scripts} -debug_tool = jlink -upload_protocol = jlink +build_flags = ${stm32_variant.build_flags} + -DMCU_STM32F103VE -DSS_TIMER=4 + -DTIMER_TONE=TIM3 -DTIMER_SERVO=TIM2 +debug_tool = jlink +upload_protocol = jlink # # JGAurora A5S A1 (STM32F103ZET6) # [env:jgaurora_a5s_a1] -platform = ${common_stm32.platform} -extends = common_stm32 -board = genericSTM32F103ZE -board_build.core = stm32 -board_build.variant = MARLIN_F103Zx -board_build.offset = 0xA000 -board_build.rename = firmware_for_sd_upload.bin -build_flags = ${common_stm32.build_flags} -DSTM32F1xx -DSTM32_XL_DENSITY -board_build.address = 0x0800A000 -extra_scripts = ${stm32f1_variant.extra_scripts} - buildroot/share/PlatformIO/scripts/jgaurora_a5s_a1_with_bootloader.py +platform = ${common_stm32.platform} +extends = stm32_variant +board = genericSTM32F103ZE +board_build.variant = MARLIN_F103Zx +board_build.offset = 0xA000 +board_build.rename = firmware_for_sd_upload.bin +board_upload.offset_address = 0x0800A000 +build_flags = ${stm32_variant.build_flags} + -DSTM32F1xx -DSTM32_XL_DENSITY +extra_scripts = ${stm32_variant.extra_scripts} + buildroot/share/PlatformIO/scripts/jgaurora_a5s_a1_with_bootloader.py # # FYSETC STM32F103RC # [env:STM32F103RC_fysetc] platform = ${common_stm32.platform} -extends = common_STM32F103RC -extra_scripts = ${stm32f1_variant.extra_scripts} - buildroot/share/PlatformIO/scripts/STM32F103RC_fysetc.py -build_flags = ${common_stm32.build_flags} -DDEBUG_LEVEL=0 +extends = common_STM32F103RC_variant +extra_scripts = ${common_STM32F103RC_variant.extra_scripts} + buildroot/share/PlatformIO/scripts/STM32F103RC_fysetc.py lib_ldf_mode = chain debug_tool = stlink upload_protocol = serial @@ -364,20 +329,20 @@ upload_protocol = serial # Longer 3D board in Alfawise U20 (STM32F103VET6) # [env:STM32F103VE_longer] -platform = ${common_stm32.platform} -extends = common_stm32 -board = genericSTM32F103VE -board_build.core = stm32 -board_build.variant = MARLIN_F103Vx -board_build.offset = 0x10000 -board_build.address = 0x08010000 -build_flags = ${common_stm32.build_flags} -DMCU_STM32F103VE -DU20 -DTS_V12 - -DLED_BUILTIN=PC2 -UPIN_WIRE_SDA -UPIN_WIRE_SCL -DPIN_WIRE_SDA=PB11 -DPIN_WIRE_SCL=PB10 - -DHAL_DAC_MODULE_DISABLED -DHAL_I2S_MODULE_DISABLED -build_unflags = ${common_stm32.build_unflags} - -DUSBCON -DUSBD_USE_CDC -DHAL_PCD_MODULE_ENABLED -extra_scripts = ${stm32f1_variant.extra_scripts} - buildroot/share/PlatformIO/scripts/STM32F103VE_longer.py +platform = ${common_stm32.platform} +extends = stm32_variant +board = genericSTM32F103VE +board_build.variant = MARLIN_F103Vx +board_build.offset = 0x10000 +board_upload.offset_address = 0x08010000 +build_flags = ${stm32_variant.build_flags} + -DMCU_STM32F103VE -DU20 -DTS_V12 -DLED_BUILTIN=PC2 -UPIN_WIRE_SDA + -UPIN_WIRE_SCL -DPIN_WIRE_SDA=PB11 -DPIN_WIRE_SCL=PB10 + -DHAL_DAC_MODULE_DISABLED -DHAL_I2S_MODULE_DISABLED +build_unflags = ${stm32_variant.build_unflags} + -DUSBCON -DUSBD_USE_CDC -DHAL_PCD_MODULE_ENABLED +extra_scripts = ${stm32_variant.extra_scripts} + buildroot/share/PlatformIO/scripts/STM32F103VE_longer.py # # TRIGORILLA PRO (STM32F103ZET6) @@ -392,15 +357,16 @@ extra_scripts = ${common_stm32.extra_scripts} # [env:chitu_f103] platform = ${common_stm32.platform} -extends = common_stm32 +extends = stm32_variant board = genericSTM32F103ZE -board_build.core = stm32 board_build.variant = MARLIN_F103Zx -extra_scripts = ${stm32f1_variant.extra_scripts} - buildroot/share/PlatformIO/scripts/chitu_crypt.py -build_flags = ${common_stm32.build_flags} -DSTM32_XL_DENSITY -build_unflags = ${common_stm32.build_unflags} - -DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG= -DERROR_LED_PORT=GPIOE -DERROR_LED_PIN=6 +build_flags = ${stm32_variant.build_flags} + -DSTM32F1xx -DSTM32_XL_DENSITY +build_unflags = ${stm32_variant.build_unflags} + -DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG= + -DERROR_LED_PORT=GPIOE -DERROR_LED_PIN=6 +extra_scripts = ${stm32_variant.extra_scripts} + buildroot/share/PlatformIO/scripts/chitu_crypt.py # # Some Chitu V5 boards have a problem with GPIO init. diff --git a/ini/stm32f4.ini b/ini/stm32f4.ini index ada6605e07..f9c16cf455 100644 --- a/ini/stm32f4.ini +++ b/ini/stm32f4.ini @@ -12,8 +12,8 @@ # F : Foundation (sometimes High Performance F2/F4) # 4 : Cortex M4 core # 01 : Line/Features -# R : 64 or 66 pins (V:100, Z:144, I:176) -# G : 1024KB Flash-memory (C:256KB, D:384KB, E:512KB) +# R : 64 or 66 pins (T:36, C:48 or 49, M:81, V:100, Z:144, I:176) +# G : 1024KB Flash-memory (B:128KB, C:256KB, D:384KB, E:512KB) # T : LQFP package # 6 : -40...85°C (7: ...105°C) # @@ -27,12 +27,7 @@ platform = ${common_stm32.platform} extends = common_stm32 board = armed_v1 build_flags = ${common_stm32.build_flags} - -O2 -ffreestanding -fsigned-char -fno-move-loop-invariants -fno-strict-aliasing - -[stm32f4_variant] -extra_scripts = ${common.extra_scripts} - pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py - buildroot/share/PlatformIO/scripts/offset_and_rename.py + -O2 -ffreestanding -fsigned-char -fno-move-loop-invariants -fno-strict-aliasing # # STM32F401VE @@ -40,49 +35,46 @@ extra_scripts = ${common.extra_scripts} # [env:STM32F401VE_STEVAL] platform = ${common_stm32.platform} -extends = common_stm32 +extends = stm32_variant board = marlin_STEVAL_STM32F401VE -build_flags = ${common_stm32.build_flags} - -DARDUINO_STEVAL -DSTM32F401xE - -DDISABLE_GENERIC_SERIALUSB -DUSBD_USE_CDC_COMPOSITE -DUSE_USB_FS -extra_scripts = ${stm32f4_variant.extra_scripts} +build_flags = ${stm32_variant.build_flags} + -DSTM32F401xE -DDISABLE_GENERIC_SERIALUSB + -DUSBD_USE_CDC_COMPOSITE -DUSE_USB_FS # # STM32F401RC # [env:FYSETC_CHEETAH_V20] -platform = ${common_stm32.platform} -extends = common_stm32 -board = marlin_FYSETC_CHEETAH_V20 -build_flags = ${common_stm32.build_flags} -DSTM32F401xC -DVECT_TAB_OFFSET=0xC000 -extra_scripts = ${stm32f4_variant.extra_scripts} +platform = ${common_stm32.platform} +extends = stm32_variant +board = marlin_FYSETC_CHEETAH_V20 +board_build.offset = 0xC000 +build_flags = ${stm32_variant.build_flags} -DSTM32F401xC # # FLYF407ZG # [env:FLYF407ZG] platform = ${common_stm32.platform} -extends = common_stm32 +extends = stm32_variant board = marlin_STM32F407ZGT6 board_build.variant = MARLIN_FLY_F407ZG +board_build.offset = 0x8000 upload_protocol = dfu -build_flags = ${common_stm32.build_flags} - -DVECT_TAB_OFFSET=0x8000 -extra_scripts = ${stm32f4_variant.extra_scripts} # # FYSETC S6 (STM32F446RET6 ARM Cortex-M4) # [env:FYSETC_S6] -platform = ${common_stm32.platform} -extends = common_stm32 -platform_packages = tool-stm32duino -board = marlin_fysetc_s6 -build_flags = ${common_stm32.build_flags} -DVECT_TAB_OFFSET=0x10000 -DHAL_PCD_MODULE_ENABLED -extra_scripts = ${stm32f4_variant.extra_scripts} -debug_tool = stlink -upload_protocol = dfu -upload_command = dfu-util -a 0 -s 0x08010000:leave -D "$SOURCE" +platform = ${common_stm32.platform} +extends = stm32_variant +board = marlin_fysetc_s6 +board_build.offset = 0x10000 +board_upload.offset_address = 0x08010000 +build_flags = ${stm32_variant.build_flags} -DHAL_PCD_MODULE_ENABLED +debug_tool = stlink +upload_protocol = dfu +upload_command = dfu-util -a 0 -s 0x08010000:leave -D "$SOURCE" # # FYSETC S6 new bootloader @@ -93,8 +85,6 @@ extends = env:FYSETC_S6 board = marlin_fysetc_s6_8000 board_build.offset = 0x8000 board_upload.offset_address = 0x08008000 -build_flags = ${common_stm32.build_flags} -DHAL_PCD_MODULE_ENABLED -extra_scripts = ${stm32f4_variant.extra_scripts} upload_command = dfu-util -a 0 -s 0x08008000:leave -D "$SOURCE" # @@ -104,12 +94,10 @@ upload_command = dfu-util -a 0 -s 0x08008000:leave -D "$SOURCE" # [env:STM32F407VE_black] platform = ${common_stm32.platform} -extends = common_stm32 +extends = stm32_variant board = marlin_blackSTM32F407VET6 -build_flags = ${common_stm32.build_flags} - -DARDUINO_BLACK_F407VE - -DUSBD_USE_CDC_COMPOSITE -DUSE_USB_FS -extra_scripts = ${stm32f4_variant.extra_scripts} +build_flags = ${stm32_variant.build_flags} + -DUSBD_USE_CDC_COMPOSITE -DUSE_USB_FS # # Anet ET4-MB_V1.x/ET4P-MB_V1.x (STM32F407VGT6 ARM Cortex-M4) @@ -117,120 +105,108 @@ extra_scripts = ${stm32f4_variant.extra_scripts} # Comment out board_build.offset = 0x10000 if you don't plan to use OpenBLT/flashing directly to 0x08000000. # [env:Anet_ET4_OpenBLT] -platform = ${common_stm32.platform} -extends = common_stm32 -build_flags = ${common_stm32.build_flags} -DHAL_SD_MODULE_ENABLED -DHAL_SRAM_MODULE_ENABLED -board = marlin_STM32F407VGT6_CCM -board_build.core = stm32 -board_build.variant = MARLIN_F4x7Vx -board_build.encrypt = firmware.srec -board_build.offset = 0x10000 +platform = ${common_stm32.platform} +extends = stm32_variant +board = marlin_STM32F407VGT6_CCM +board_build.variant = MARLIN_F4x7Vx +board_build.encrypt = firmware.srec +board_build.offset = 0x10000 board_upload.offset_address = 0x08010000 -build_unflags = ${common_stm32.build_unflags} -DUSBCON -DUSBD_USE_CDC -DUSBD_VID=0x0483 -debug_tool = jlink -upload_protocol = jlink -extra_scripts = ${stm32f4_variant.extra_scripts} - buildroot/share/PlatformIO/scripts/openblt.py +build_flags = ${stm32_variant.build_flags} + -DHAL_SD_MODULE_ENABLED -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/openblt.py +debug_tool = jlink +upload_protocol = jlink # # BigTreeTech SKR Pro (STM32F407ZGT6 ARM Cortex-M4) # [env:BIGTREE_SKR_PRO] -platform = ${common_stm32.platform} -extends = common_stm32 -board = marlin_BigTree_SKR_Pro -build_flags = ${common_stm32.build_flags} - -DSTM32F407_5ZX -DVECT_TAB_OFFSET=0x8000 -extra_scripts = ${stm32f4_variant.extra_scripts} -#upload_protocol = stlink -#upload_command = "$PROJECT_PACKAGES_DIR/tool-stm32duino/stlink/ST-LINK_CLI.exe" -c SWD -P "$BUILD_DIR/firmware.bin" 0x8008000 -Rst -Run -debug_tool = stlink -debug_init_break = - -# -# USB Flash Drive mix-ins for STM32 -# -[stm_flash_drive] -platform_packages = framework-arduinoststm32@https://github.com/rhapsodyv/Arduino_Core_STM32/archive/usb-host-msc-cdc-msc-3.zip -build_flags = ${common_stm32.build_flags} - -DHAL_PCD_MODULE_ENABLED -DHAL_HCD_MODULE_ENABLED - -DUSBHOST -DUSBH_IRQ_PRIO=3 -DUSBH_IRQ_SUBPRIO=4 +platform = ${common_stm32.platform} +extends = stm32_variant +board = marlin_BigTree_SKR_Pro +board_build.offset = 0x8000 +build_flags = ${stm32_variant.build_flags} -DSTM32F407_5ZX +debug_tool = stlink +upload_protocol = stlink # # BigTreeTech SKR Pro (STM32F407ZGT6 ARM Cortex-M4) with USB Flash Drive Support # [env:BIGTREE_SKR_PRO_usb_flash_drive] +platform = ${common_stm32.platform} extends = env:BIGTREE_SKR_PRO platform_packages = ${stm_flash_drive.platform_packages} -build_unflags = -DUSBCON -DUSBD_USE_CDC -build_flags = ${stm_flash_drive.build_flags} - -DSTM32F407_5ZX -DVECT_TAB_OFFSET=0x8000 +build_flags = ${stm_flash_drive.build_flags} -DSTM32F407_5ZX +build_unflags = ${env:BIGTREE_SKR_PRO.build_unflags} -DUSBCON -DUSBD_USE_CDC # # BigTreeTech E3 RRF (STM32F407VGT6 ARM Cortex-M4) # [env:BIGTREE_E3_RRF] platform = ${common_stm32.platform} -extends = common_stm32 +extends = stm32_variant board = marlin_STM32F407VGT6_CCM board_build.variant = MARLIN_BIGTREE_E3_RRF -build_flags = ${common_stm32.build_flags} - -DSTM32F407_5VX -DVECT_TAB_OFFSET=0x8000 - -DSERIAL_RX_BUFFER_SIZE=255 -DSERIAL_TX_BUFFER_SIZE=255 -extra_scripts = ${stm32f4_variant.extra_scripts} +board_build.offset = 0x8000 +build_flags = ${stm32_variant.build_flags} + -DSTM32F407_5VX + -DSERIAL_RX_BUFFER_SIZE=255 + -DSERIAL_TX_BUFFER_SIZE=255 # # Bigtreetech GTR V1.0 (STM32F407IGT6 ARM Cortex-M4) # [env:BIGTREE_GTR_V1_0] -platform = ${common_stm32.platform} -extends = common_stm32 -board = marlin_BigTree_GTR_v1 -extra_scripts = ${stm32f4_variant.extra_scripts} -build_flags = ${common_stm32.build_flags} - -DSTM32F407IX -DVECT_TAB_OFFSET=0x8000 +platform = ${common_stm32.platform} +extends = stm32_variant +board = marlin_BigTree_GTR_v1 +board_build.offset = 0x8000 +build_flags = ${stm32_variant.build_flags} -DSTM32F407IX # # Bigtreetech GTR V1.0 (STM32F407IGT6 ARM Cortex-M4) with USB Flash Drive Support # [env:BIGTREE_GTR_V1_0_usb_flash_drive] +platform = ${common_stm32.platform} extends = env:BIGTREE_GTR_V1_0 platform_packages = ${stm_flash_drive.platform_packages} -build_unflags = -DUSBCON -DUSBD_USE_CDC -build_flags = ${stm_flash_drive.build_flags} - -DSTM32F407IX -DVECT_TAB_OFFSET=0x8000 +build_flags = ${stm_flash_drive.build_flags} -DSTM32F407IX +build_unflags = ${env:BIGTREE_GTR_V1_0.build_unflags} -DUSBCON -DUSBD_USE_CDC # # BigTreeTech BTT002 V1.0 (STM32F407VGT6 ARM Cortex-M4) # [env:BIGTREE_BTT002] -platform = ${common_stm32.platform} -extends = common_stm32 -board = marlin_BigTree_BTT002 -build_flags = ${common_stm32.build_flags} - -DSTM32F407_5VX -DVECT_TAB_OFFSET=0x8000 - -DHAVE_HWSERIAL2 - -DHAVE_HWSERIAL3 - -DPIN_SERIAL2_RX=PD_6 - -DPIN_SERIAL2_TX=PD_5 -extra_scripts = ${stm32f4_variant.extra_scripts} +platform = ${common_stm32.platform} +extends = stm32_variant +board = marlin_BigTree_BTT002 +board_build.offset = 0x8000 +build_flags = ${stm32_variant.build_flags} + -DSTM32F407_5VX + -DHAVE_HWSERIAL2 + -DHAVE_HWSERIAL3 + -DPIN_SERIAL2_RX=PD_6 + -DPIN_SERIAL2_TX=PD_5 # # BigTreeTech SKR V2.0 (STM32F407VGT6 ARM Cortex-M4) with USB Flash Drive Support # [env:BIGTREE_SKR_2] -platform = ${common_stm32.platform} -platform_packages = ${stm_flash_drive.platform_packages} -extends = common_stm32 -board = marlin_STM32F407VGT6_CCM -board_build.core = stm32 -board_build.variant = MARLIN_F4x7Vx -board_build.offset = 0x8000 +platform = ${common_stm32.platform} +extends = stm32_variant +platform_packages = ${stm_flash_drive.platform_packages} +board = marlin_STM32F407VGT6_CCM +board_build.variant = MARLIN_F4x7Vx +board_build.offset = 0x8000 board_upload.offset_address = 0x08008000 -extra_scripts = ${stm32f4_variant.extra_scripts} -build_flags = ${stm_flash_drive.build_flags} - -DUSE_USBHOST_HS -DUSE_USB_HS_IN_FS -DUSBD_IRQ_PRIO=5 -DUSBD_IRQ_SUBPRIO=6 - -DHSE_VALUE=8000000U -DHAL_SD_MODULE_ENABLED +build_flags = ${stm_flash_drive.build_flags} + -DUSE_USBHOST_HS -DUSE_USB_HS_IN_FS + -DUSBD_IRQ_PRIO=5 -DUSBD_IRQ_SUBPRIO=6 + -DHSE_VALUE=8000000U -DHAL_SD_MODULE_ENABLED # # BigTreeTech SKR V2.0 (STM32F407VGT6 ARM Cortex-M4) with USB Media Share Support @@ -238,49 +214,50 @@ build_flags = ${stm_flash_drive.build_flags} [env:BIGTREE_SKR_2_USB] platform = ${common_stm32.platform} extends = env:BIGTREE_SKR_2 -platform_packages = ${stm_flash_drive.platform_packages} -build_unflags = -DUSBD_USE_CDC build_flags = ${env:BIGTREE_SKR_2.build_flags} -DUSBD_USE_CDC_MSC +build_unflags = ${env:BIGTREE_SKR_2.build_unflags} -DUSBD_USE_CDC # # BigTreeTech Octopus V1.0/1.1 (STM32F446ZET6 ARM Cortex-M4) # [env:BIGTREE_OCTOPUS_V1] -platform = ${common_stm32.platform} -extends = common_stm32 -board = marlin_BigTree_Octopus_v1 -extra_scripts = ${stm32f4_variant.extra_scripts} -build_flags = ${common_stm32.build_flags} - -DSTM32F446_5VX -DVECT_TAB_OFFSET=0x8000 -DUSE_USB_HS_IN_FS +platform = ${common_stm32.platform} +extends = stm32_variant +board = marlin_BigTree_Octopus_v1 +board_build.offset = 0x8000 +build_flags = ${stm32_variant.build_flags} + -DSTM32F446_5VX -DUSE_USB_HS_IN_FS # # BigTreeTech Octopus V1.0/1.1 (STM32F446ZET6 ARM Cortex-M4) with USB Flash Drive Support # [env:BIGTREE_OCTOPUS_V1_USB] +platform = ${common_stm32.platform} extends = env:BIGTREE_OCTOPUS_V1 platform_packages = ${stm_flash_drive.platform_packages} -#build_unflags = -DUSBCON -DUSBD_USE_CDC build_flags = ${stm_flash_drive.build_flags} - -DSTM32F446_5VX -DVECT_TAB_OFFSET=0x8000 - -DUSBCON -DUSE_USBHOST_HS -DUSBD_IRQ_PRIO=5 -DUSBD_IRQ_SUBPRIO=6 -DUSE_USB_HS_IN_FS -DUSBD_USE_CDC_MSC + -DSTM32F446_5VX -DUSE_USB_HS_IN_FS + -DUSE_USBHOST_HS -DUSBD_IRQ_PRIO=5 + -DUSBD_IRQ_SUBPRIO=6 + -DUSBD_USE_CDC_MSC # # Lerdge base # [lerdge_common] platform = ${common_stm32.platform} -extends = common_stm32 +extends = stm32_variant board = marlin_STM32F407ZGT6 board_build.variant = MARLIN_LERDGE -board_build.offset = 0x10000 board_build.encrypt = firmware.bin -extra_scripts = ${stm32f4_variant.extra_scripts} +board_build.offset = 0x10000 +build_flags = ${stm32_variant.build_flags} + -DSTM32F4 -DSTM32F4xx -DTARGET_STM32F4 + -DDISABLE_GENERIC_SERIALUSB -DARDUINO_ARCH_STM32 -DARDUINO_LERDGE + -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 -build_flags = ${common_stm32.build_flags} - -DSTM32F4 -DSTM32F4xx -DTARGET_STM32F4 - -DDISABLE_GENERIC_SERIALUSB -DARDUINO_ARCH_STM32 -DARDUINO_LERDGE - -DHAL_SRAM_MODULE_ENABLED -build_unflags = ${common_stm32.build_unflags} -DUSBCON -DUSBD_USE_CDC -DUSBD_VID=0x0483 # # Lerdge X @@ -339,38 +316,33 @@ build_flags = ${stm_flash_drive.build_flags} ${lerdge_common.build_flags} # [env:rumba32] platform = ${common_stm32.platform} -extends = common_stm32 -build_flags = ${common_stm32.build_flags} - -Os - -DHAL_PCD_MODULE_ENABLED - -DDISABLE_GENERIC_SERIALUSB - -DHAL_UART_MODULE_ENABLED - -DTIMER_SERIAL=TIM9 +extends = stm32_variant board = rumba32_f446ve -upload_protocol = dfu -monitor_speed = 500000 -board_build.core = stm32 board_build.variant = MARLIN_F446VE board_build.offset = 0x0000 -extra_scripts = ${stm32f4_variant.extra_scripts} +build_flags = ${stm32_variant.build_flags} + -Os -DHAL_PCD_MODULE_ENABLED + -DDISABLE_GENERIC_SERIALUSB + -DHAL_UART_MODULE_ENABLED + -DTIMER_SERIAL=TIM9 +monitor_speed = 500000 +upload_protocol = dfu # # MKS Robin Pro V2 # [env:mks_robin_pro2] -platform = ${common_stm32.platform} -platform_packages = ${stm_flash_drive.platform_packages} -extends = common_stm32 -build_flags = ${stm_flash_drive.build_flags} -board = genericSTM32F407VET6 -board_build.core = stm32 -board_build.variant = MARLIN_F4x7Vx -board_build.offset = 0x0000 +platform = ${common_stm32.platform} +extends = stm32_variant +platform_packages = ${stm_flash_drive.platform_packages} +board = genericSTM32F407VET6 +board_build.variant = MARLIN_F4x7Vx +board_build.offset = 0x0000 board_upload.offset_address = 0x08000000 -build_unflags = ${common_stm32.build_unflags} -DUSBCON -DUSBD_USE_CDC -debug_tool = jlink -upload_protocol = jlink -extra_scripts = ${stm32f4_variant.extra_scripts} +build_flags = ${stm_flash_drive.build_flags} +build_unflags = ${stm32_variant.build_unflags} -DUSBCON -DUSBD_USE_CDC +debug_tool = jlink +upload_protocol = jlink # # This SPI is used by Robin Nano V3 @@ -382,34 +354,31 @@ build_flags = -DPIN_WIRE_SCL=PB6 -DPIN_WIRE_SDA=PB7 # MKS Robin Nano V3 # [env:mks_robin_nano_v3] -platform = ${common_stm32.platform} -extends = common_stm32 -build_flags = ${common_stm32.build_flags} ${stm32f4_I2C1.build_flags} -DHAL_PCD_MODULE_ENABLED -DUSBCON -DUSBD_USE_CDC -board = marlin_STM32F407VGT6_CCM -board_build.core = stm32 -board_build.variant = MARLIN_F4x7Vx -board_build.rename = Robin_nano_v3.bin -board_build.offset = 0xC000 +platform = ${common_stm32.platform} +extends = stm32_variant +board = marlin_STM32F407VGT6_CCM +board_build.variant = MARLIN_F4x7Vx +board_build.offset = 0xC000 +board_build.rename = Robin_nano_v3.bin board_upload.offset_address = 0x0800C000 -build_unflags = ${common_stm32.build_unflags} -debug_tool = jlink -upload_protocol = jlink -extra_scripts = ${stm32f4_variant.extra_scripts} +build_flags = ${stm32_variant.build_flags} ${stm32f4_I2C1.build_flags} + -DHAL_PCD_MODULE_ENABLED +debug_tool = jlink +upload_protocol = jlink # # MKS Robin Nano V3 with USB Flash Drive Support # Currently, using a STM32duino fork, until USB Host get merged # [env:mks_robin_nano_v3_usb_flash_drive] +platform = ${common_stm32.platform} extends = env:mks_robin_nano_v3 platform_packages = ${stm_flash_drive.platform_packages} build_flags = ${stm_flash_drive.build_flags} ${stm32f4_I2C1.build_flags} - -DUSBCON - -DUSE_USBHOST_HS - -DUSBD_IRQ_PRIO=5 - -DUSBD_IRQ_SUBPRIO=6 - -DUSE_USB_HS_IN_FS - -DUSBD_USE_CDC + -DUSE_USBHOST_HS + -DUSBD_IRQ_PRIO=5 + -DUSBD_IRQ_SUBPRIO=6 + -DUSE_USB_HS_IN_FS # # MKS Robin Nano V3 with USB Flash Drive Support and Shared Media @@ -417,13 +386,6 @@ build_flags = ${stm_flash_drive.build_flags} ${stm32f4_I2C1.build_flags} # [env:mks_robin_nano_v3_usb_flash_drive_msc] platform = ${common_stm32.platform} -extends = env:mks_robin_nano_v3 -platform_packages = framework-arduinoststm32@https://github.com/rhapsodyv/Arduino_Core_STM32/archive/usb-host-msc-cdc-msc-3.zip -build_unflags = ${common_stm32.build_unflags} -DUSBD_USE_CDC -build_flags = ${stm_flash_drive.build_flags} ${stm32f4_I2C1.build_flags} - -DUSBCON - -DUSE_USBHOST_HS - -DUSBD_IRQ_PRIO=5 - -DUSBD_IRQ_SUBPRIO=6 - -DUSE_USB_HS_IN_FS - -DUSBD_USE_CDC_MSC +extends = env:mks_robin_nano_v3_usb_flash_drive +build_flags = ${env:mks_robin_nano_v3_usb_flash_drive} + -DUSBD_USE_CDC_MSC diff --git a/ini/stm32f7.ini b/ini/stm32f7.ini index 76d039533c..984b25162e 100644 --- a/ini/stm32f7.ini +++ b/ini/stm32f7.ini @@ -37,29 +37,3 @@ build_flags = ${common_stm32.build_flags} -DTIMER_SERIAL=TIM9 platform = ${common_stm32.platform} extends = common_stm32 board = remram_v1 -build_flags = ${common_stm32.build_flags} - -# -# BigTreeTech SKR SE BX (STM32H743IIT6 ARM Cortex-M7) -# -[env:BTT_SKR_SE_BX] -platform = ${common_stm32.platform} -platform_packages = ${stm_flash_drive.platform_packages} -extends = common_stm32 -board = marlin_BTT_SKR_SE_BX -extra_scripts = ${common.extra_scripts} - pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py -build_flags = ${common_stm32.build_flags} - ${stm_flash_drive.build_flags} - -DUSE_USBHOST_HS - -DUSE_USB_HS_IN_FS - #-DUSBD_USE_CDC_MSC - -DVECT_TAB_OFFSET=0x20000 - -DHAL_DMA2D_MODULE_ENABLED - -DHAL_LTDC_MODULE_ENABLED - -DHAL_SDRAM_MODULE_ENABLED - -DHAL_QSPI_MODULE_ENABLED - -DHAL_MDMA_MODULE_ENABLED - -DHAL_SD_MODULE_ENABLED -upload_protocol = cmsis-dap -debug_tool = cmsis-dap diff --git a/ini/stm32h7.ini b/ini/stm32h7.ini new file mode 100644 index 0000000000..3d0753a235 --- /dev/null +++ b/ini/stm32h7.ini @@ -0,0 +1,41 @@ +# +# Marlin Firmware +# PlatformIO Configuration File +# + +################################# +# +# STM32H7 Architecture +# +# Naming Example: STM32H743IIT6 +# +# H : High Performance +# 7 : Cortex M7 core +# 43 : Line/Features +# I : 176 pins +# I : 2048KB Flash-memory +# T : LQFP package +# 6 : -40...85°C (7: ...105°C) +# +################################# + +# +# BigTreeTech SKR SE BX (STM32H743IIT6 ARM Cortex-M7) +# +[env:BTT_SKR_SE_BX] +platform = ${common_stm32.platform} +extends = stm32_variant +platform_packages = ${stm_flash_drive.platform_packages} +board = marlin_BTT_SKR_SE_BX +board_build.offset = 0x20000 +build_flags = ${stm32_variant.build_flags} ${stm_flash_drive.build_flags} + -DUSE_USBHOST_HS + -DUSE_USB_HS_IN_FS + -DHAL_DMA2D_MODULE_ENABLED + -DHAL_LTDC_MODULE_ENABLED + -DHAL_SDRAM_MODULE_ENABLED + -DHAL_QSPI_MODULE_ENABLED + -DHAL_MDMA_MODULE_ENABLED + -DHAL_SD_MODULE_ENABLED +upload_protocol = cmsis-dap +debug_tool = cmsis-dap diff --git a/platformio.ini b/platformio.ini index afdd823f9e..1fb9ba55e6 100644 --- a/platformio.ini +++ b/platformio.ini @@ -23,11 +23,13 @@ extra_configs = ini/lpc176x.ini ini/native.ini ini/samd51.ini + ini/stm32-common.ini ini/stm32f0.ini ini/stm32f1-maple.ini ini/stm32f1.ini ini/stm32f4.ini ini/stm32f7.ini + ini/stm32h7.ini ini/teensy.ini # From 178f9a77a88b333470725e0e19d033859721656b Mon Sep 17 00:00:00 2001 From: ellensp Date: Wed, 21 Jul 2021 07:44:15 +1200 Subject: [PATCH 04/15] =?UTF-8?q?=F0=9F=90=9B=20Fix=20STATUS=5FCOMBINE=5FH?= =?UTF-8?q?EATERS=20compile=20(#22405)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/dogm/status_screen_DOGM.cpp | 42 ++++++++++++---------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/Marlin/src/lcd/dogm/status_screen_DOGM.cpp b/Marlin/src/lcd/dogm/status_screen_DOGM.cpp index a66aca6d19..5fe8b61bf4 100644 --- a/Marlin/src/lcd/dogm/status_screen_DOGM.cpp +++ b/Marlin/src/lcd/dogm/status_screen_DOGM.cpp @@ -264,29 +264,33 @@ FORCE_INLINE void _draw_centered_temp(const celsius_t temp, const uint8_t tx, co #define HOTEND_BITMAP(N,S) status_hotend_a_bmp #endif - if (PAGE_CONTAINS(STATUS_HEATERS_Y, STATUS_HEATERS_BOT)) { + #if DISABLED(STATUS_COMBINE_HEATERS) - #define BAR_TALL (STATUS_HEATERS_HEIGHT - 2) + if (PAGE_CONTAINS(STATUS_HEATERS_Y, STATUS_HEATERS_BOT)) { - const float prop = target - 20, - perc = prop > 0 && temp >= 20 ? (temp - 20) / prop : 0; - uint8_t tall = uint8_t(perc * BAR_TALL + 0.5f); - NOMORE(tall, BAR_TALL); + #define BAR_TALL (STATUS_HEATERS_HEIGHT - 2) - // Draw hotend bitmap, either whole or split by the heating percent - const uint8_t hx = STATUS_HOTEND_X(heater_id), - bw = STATUS_HOTEND_BYTEWIDTH(heater_id); - #if ENABLED(STATUS_HEAT_PERCENT) - if (isHeat && tall <= BAR_TALL) { - const uint8_t ph = STATUS_HEATERS_HEIGHT - 1 - tall; - u8g.drawBitmapP(hx, STATUS_HEATERS_Y, bw, ph, HOTEND_BITMAP(TERN(HAS_MMU, active_extruder, heater_id), false)); - u8g.drawBitmapP(hx, STATUS_HEATERS_Y + ph, bw, tall + 1, HOTEND_BITMAP(TERN(HAS_MMU, active_extruder, heater_id), true) + ph * bw); - } - else - #endif - u8g.drawBitmapP(hx, STATUS_HEATERS_Y, bw, STATUS_HEATERS_HEIGHT, HOTEND_BITMAP(TERN(HAS_MMU, active_extruder, heater_id), isHeat)); + const float prop = target - 20, + perc = prop > 0 && temp >= 20 ? (temp - 20) / prop : 0; + uint8_t tall = uint8_t(perc * BAR_TALL + 0.5f); + NOMORE(tall, BAR_TALL); - } // PAGE_CONTAINS + // Draw hotend bitmap, either whole or split by the heating percent + const uint8_t hx = STATUS_HOTEND_X(heater_id), + bw = STATUS_HOTEND_BYTEWIDTH(heater_id); + #if ENABLED(STATUS_HEAT_PERCENT) + if (isHeat && tall <= BAR_TALL) { + const uint8_t ph = STATUS_HEATERS_HEIGHT - 1 - tall; + u8g.drawBitmapP(hx, STATUS_HEATERS_Y, bw, ph, HOTEND_BITMAP(TERN(HAS_MMU, active_extruder, heater_id), false)); + u8g.drawBitmapP(hx, STATUS_HEATERS_Y + ph, bw, tall + 1, HOTEND_BITMAP(TERN(HAS_MMU, active_extruder, heater_id), true) + ph * bw); + } + else + #endif + u8g.drawBitmapP(hx, STATUS_HEATERS_Y, bw, STATUS_HEATERS_HEIGHT, HOTEND_BITMAP(TERN(HAS_MMU, active_extruder, heater_id), isHeat)); + + } // PAGE_CONTAINS + + #endif // !STATUS_COMBINE_HEATERS if (PAGE_UNDER(7)) { #if HEATER_IDLE_HANDLER From 497541e1995db4e9890abc0951e0a77104bc62ef Mon Sep 17 00:00:00 2001 From: Yash <76577754+yash-fn@users.noreply.github.com> Date: Tue, 20 Jul 2021 14:51:41 -0500 Subject: [PATCH 05/15] =?UTF-8?q?=F0=9F=90=9B=20Fix=20G2/G3=20angular=20mo?= =?UTF-8?q?tion=20calculation=20(#22407)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/gcode/motion/G2_G3.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Marlin/src/gcode/motion/G2_G3.cpp b/Marlin/src/gcode/motion/G2_G3.cpp index 170789d827..094afdb70e 100644 --- a/Marlin/src/gcode/motion/G2_G3.cpp +++ b/Marlin/src/gcode/motion/G2_G3.cpp @@ -83,12 +83,13 @@ void plan_arc( #endif // Angle of rotation between position and target from the circle center. - float angular_travel; + float angular_travel, abs_angular_travel; // Do a full circle if starting and ending positions are "identical" if (NEAR(current_position[p_axis], cart[p_axis]) && NEAR(current_position[q_axis], cart[q_axis])) { // Preserve direction for circles angular_travel = clockwise ? -RADIANS(360) : RADIANS(360); + abs_angular_travel = RADIANS(360); } else { // Calculate the angle @@ -103,8 +104,10 @@ void plan_arc( case 2: angular_travel += RADIANS(360); break; // Negative but CCW? Reverse direction. } + abs_angular_travel = ABS(angular_travel); + #ifdef MIN_ARC_SEGMENTS - min_segments = CEIL(min_segments * ABS(angular_travel) / RADIANS(360)); + min_segments = CEIL(min_segments * abs_angular_travel / RADIANS(360)); NOLESS(min_segments, 1U); #endif } @@ -117,8 +120,8 @@ void plan_arc( #endif // If circling around... - if (ENABLED(ARC_P_CIRCLES) && circles) { - const float total_angular = angular_travel + circles * RADIANS(360), // Total rotation with all circles and remainder + if (TERN0(ARC_P_CIRCLES, circles)) { + const float total_angular = abs_angular_travel + circles * RADIANS(360), // Total rotation with all circles and remainder part_per_circle = RADIANS(360) / total_angular; // Each circle's part of the total #if HAS_Z_AXIS @@ -138,8 +141,8 @@ void plan_arc( TERN_(HAS_EXTRUDERS, extruder_travel = cart.e - current_position.e); } - const float flat_mm = radius * angular_travel, - mm_of_travel = TERN_(HAS_Z_AXIS, linear_travel ? HYPOT(flat_mm, linear_travel) :) ABS(flat_mm); + const float flat_mm = radius * abs_angular_travel, + mm_of_travel = TERN_(HAS_Z_AXIS, linear_travel ? HYPOT(flat_mm, linear_travel) :) flat_mm; if (mm_of_travel < 0.001f) return; const feedRate_t scaled_fr_mm_s = MMS_SCALED(feedrate_mm_s); From 2d4be74db98c8ab74b5c636cd1899bcaabd760e2 Mon Sep 17 00:00:00 2001 From: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com> Date: Tue, 20 Jul 2021 12:54:02 -0700 Subject: [PATCH 06/15] =?UTF-8?q?=F0=9F=8E=A8=20Fix=20unused=20lambda=20wa?= =?UTF-8?q?rning=20(#22399)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/module/probe.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Marlin/src/module/probe.cpp b/Marlin/src/module/probe.cpp index 6831d151f9..d585afb8b2 100644 --- a/Marlin/src/module/probe.cpp +++ b/Marlin/src/module/probe.cpp @@ -865,9 +865,11 @@ float Probe::probe_at_point(const_float_t rx, const_float_t ry, const ProbePtRai #if HAS_CURRENT_HOME(Z) static int16_t saved_current_Z; #endif - auto debug_current_on = [](PGM_P const s, const int16_t a, const int16_t b) { - if (DEBUGGING(LEVELING)) { DEBUG_ECHOPGM_P(s); DEBUG_ECHOLNPAIR(" current: ", a, " -> ", b); } - }; + #if ((ENABLED(DELTA) && (HAS_CURRENT_HOME(X) || HAS_CURRENT_HOME(Y))) || HAS_CURRENT_HOME(Z)) + auto debug_current_on = [](PGM_P const s, const int16_t a, const int16_t b) { + if (DEBUGGING(LEVELING)) { DEBUG_ECHOPGM_P(s); DEBUG_ECHOLNPAIR(" current: ", a, " -> ", b); } + }; + #endif if (onoff) { #if ENABLED(DELTA) #if HAS_CURRENT_HOME(X) From a90968b0cef30f166f2f96aea526caf532a84949 Mon Sep 17 00:00:00 2001 From: Malderin <52313714+Malderin@users.noreply.github.com> Date: Tue, 20 Jul 2021 23:07:32 +0300 Subject: [PATCH 07/15] =?UTF-8?q?=F0=9F=8E=A8=20MKS=20hardware=20test=20fo?= =?UTF-8?q?llowup=20(#22395)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Scott Lahteine --- Marlin/src/lcd/extui/mks_ui/mks_hardware.cpp | 134 +++++++++--------- Marlin/src/lcd/extui/mks_ui/mks_hardware.h | 9 +- .../extui/mks_ui/tft_lvgl_configuration.cpp | 2 +- 3 files changed, 73 insertions(+), 72 deletions(-) diff --git a/Marlin/src/lcd/extui/mks_ui/mks_hardware.cpp b/Marlin/src/lcd/extui/mks_ui/mks_hardware.cpp index cf9790ea9d..3c7eb55532 100644 --- a/Marlin/src/lcd/extui/mks_ui/mks_hardware.cpp +++ b/Marlin/src/lcd/extui/mks_ui/mks_hardware.cpp @@ -127,77 +127,81 @@ delay(100); } - void mks_gpio_test() { - init_test_gpio(); + #if ENABLED(SDSUPPORT) - test_gpio_readlevel_L(); - test_gpio_readlevel_H(); - test_gpio_readlevel_L(); - if (pw_det_sta && pw_off_sta && mt_det_sta - #if PIN_EXISTS(MT_DET_2) - && mt_det2_sta - #endif - #if ENABLED(MKS_HARDWARE_TEST_ONLY_E0) - && (READ(PA1) == LOW) - && (READ(PA3) == LOW) - && (READ(PC2) == LOW) - && (READ(PD8) == LOW) - && (READ(PE5) == LOW) - && (READ(PE6) == LOW) - && (READ(PE7) == LOW) - #endif - ) - disp_det_ok(); - else - disp_det_error(); + void mks_gpio_test() { + init_test_gpio(); - if (endstopx1_sta && endstopy1_sta && endstopz1_sta && endstopz2_sta) - disp_Limit_ok(); - else - disp_Limit_error(); - } + test_gpio_readlevel_L(); + test_gpio_readlevel_H(); + test_gpio_readlevel_L(); + if (pw_det_sta && pw_off_sta && mt_det_sta + #if PIN_EXISTS(MT_DET_2) + && mt_det2_sta + #endif + #if ENABLED(MKS_HARDWARE_TEST_ONLY_E0) + && (READ(PA1) == LOW) + && (READ(PA3) == LOW) + && (READ(PC2) == LOW) + && (READ(PD8) == LOW) + && (READ(PE5) == LOW) + && (READ(PE6) == LOW) + && (READ(PE7) == LOW) + #endif + ) + disp_det_ok(); + else + disp_det_error(); - void mks_hardware_test() { - if (millis() % 2000 < 1000) { - WRITE(X_DIR_PIN, LOW); - WRITE(Y_DIR_PIN, LOW); - WRITE(Z_DIR_PIN, LOW); - WRITE(E0_DIR_PIN, LOW); - #if DISABLED(MKS_HARDWARE_TEST_ONLY_E0) - WRITE(E1_DIR_PIN, LOW); - #endif - thermalManager.fan_speed[0] = 255; - #if DISABLED(MKS_HARDWARE_TEST_ONLY_E0) - WRITE(HEATER_1_PIN, HIGH); // HE1 - #endif - WRITE(HEATER_0_PIN, HIGH); // HE0 - WRITE(HEATER_BED_PIN, HIGH); // HOT-BED - } - else { - WRITE(X_DIR_PIN, HIGH); - WRITE(Y_DIR_PIN, HIGH); - WRITE(Z_DIR_PIN, HIGH); - WRITE(E0_DIR_PIN, HIGH); - #if DISABLED(MKS_HARDWARE_TEST_ONLY_E0) - WRITE(E1_DIR_PIN, HIGH); - #endif - thermalManager.fan_speed[0] = 0; - #if DISABLED(MKS_HARDWARE_TEST_ONLY_E0) - WRITE(HEATER_1_PIN, LOW); // HE1 - #endif - WRITE(HEATER_0_PIN, LOW); // HE0 - WRITE(HEATER_BED_PIN, LOW); // HOT-BED + if (endstopx1_sta && endstopy1_sta && endstopz1_sta && endstopz2_sta) + disp_Limit_ok(); + else + disp_Limit_error(); } - if (endstopx1_sta && endstopx2_sta && endstopy1_sta && endstopy2_sta && endstopz1_sta && endstopz2_sta) { - // nothing here - } - else { + void mks_hardware_test() { + if (millis() % 2000 < 1000) { + WRITE(X_DIR_PIN, LOW); + WRITE(Y_DIR_PIN, LOW); + WRITE(Z_DIR_PIN, LOW); + WRITE(E0_DIR_PIN, LOW); + #if DISABLED(MKS_HARDWARE_TEST_ONLY_E0) + WRITE(E1_DIR_PIN, LOW); + #endif + thermalManager.fan_speed[0] = 255; + #if DISABLED(MKS_HARDWARE_TEST_ONLY_E0) + WRITE(HEATER_1_PIN, HIGH); // HE1 + #endif + WRITE(HEATER_0_PIN, HIGH); // HE0 + WRITE(HEATER_BED_PIN, HIGH); // HOT-BED + } + else { + WRITE(X_DIR_PIN, HIGH); + WRITE(Y_DIR_PIN, HIGH); + WRITE(Z_DIR_PIN, HIGH); + WRITE(E0_DIR_PIN, HIGH); + #if DISABLED(MKS_HARDWARE_TEST_ONLY_E0) + WRITE(E1_DIR_PIN, HIGH); + #endif + thermalManager.fan_speed[0] = 0; + #if DISABLED(MKS_HARDWARE_TEST_ONLY_E0) + WRITE(HEATER_1_PIN, LOW); // HE1 + #endif + WRITE(HEATER_0_PIN, LOW); // HE0 + WRITE(HEATER_BED_PIN, LOW); // HOT-BED + } + + if (endstopx1_sta && endstopx2_sta && endstopy1_sta && endstopy2_sta && endstopz1_sta && endstopz2_sta) { + // nothing here + } + else { + } + + if (disp_state == PRINT_READY_UI) + mks_disp_test(); } - if (disp_state == PRINT_READY_UI) - mks_disp_test(); - } + #endif #endif // MKS_TEST @@ -613,7 +617,7 @@ void disp_assets_update_progress(const char *msg) { disp_string(100, 165, buf, 0xFFFF, 0x0000); } -#if ENABLED(SDSUPPORT) +#if BOTH(MKS_TEST, SDSUPPORT) uint8_t mks_test_flag = 0; const char *MKSTestPath = "MKS_TEST"; void mks_test_get() { diff --git a/Marlin/src/lcd/extui/mks_ui/mks_hardware.h b/Marlin/src/lcd/extui/mks_ui/mks_hardware.h index de0c3a738e..f41c4e18ac 100644 --- a/Marlin/src/lcd/extui/mks_ui/mks_hardware.h +++ b/Marlin/src/lcd/extui/mks_ui/mks_hardware.h @@ -26,17 +26,14 @@ #include // Functions for MKS_TEST -#if ENABLED(MKS_TEST) - void mks_gpio_test(); +#if BOTH(MKS_TEST, SDSUPPORT) void mks_hardware_test(); void mks_test_get(); + void mks_gpio_test(); + extern uint8_t mks_test_flag; #endif // String display and assets void disp_string(uint16_t x, uint16_t y, const char * string, uint16_t charColor, uint16_t bkColor); void disp_assets_update(); void disp_assets_update_progress(const char *msg); - -#if ENABLED(SDSUPPORT) - extern uint8_t mks_test_flag; -#endif diff --git a/Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.cpp b/Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.cpp index d8c5fbd6ec..2127b23a15 100644 --- a/Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.cpp +++ b/Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.cpp @@ -139,7 +139,7 @@ void tft_lvgl_init() { #if ENABLED(SDSUPPORT) UpdateAssets(); watchdog_refresh(); // LVGL init takes time - mks_test_get(); + TERN_(MKS_TEST, mks_test_get()); #endif touch.Init(); From e4ac55089e73577968cb693924bec673bf32c575 Mon Sep 17 00:00:00 2001 From: vyacheslav-shubin Date: Tue, 20 Jul 2021 23:12:08 +0300 Subject: [PATCH 08/15] =?UTF-8?q?=F0=9F=A9=B9=20Init=20var=20to=20suppress?= =?UTF-8?q?=20invalid=20warning=20(#22396)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/gcode/bedlevel/mbl/G29.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Marlin/src/gcode/bedlevel/mbl/G29.cpp b/Marlin/src/gcode/bedlevel/mbl/G29.cpp index 21336f0b9a..03f2c58e81 100644 --- a/Marlin/src/gcode/bedlevel/mbl/G29.cpp +++ b/Marlin/src/gcode/bedlevel/mbl/G29.cpp @@ -70,7 +70,8 @@ void GcodeSuite::G29() { return; } - int8_t ix, iy = 0; + int8_t ix, iy; + ix = iy = 0; switch (state) { case MeshReport: From 86feddb75fc01fb744c9453dc4d1f5d1bfad4c4f Mon Sep 17 00:00:00 2001 From: Katelyn Schiesser Date: Tue, 20 Jul 2021 13:13:25 -0700 Subject: [PATCH 09/15] =?UTF-8?q?=F0=9F=90=9B=20Fix=20BTC=5FSAMPLE=5FRES?= =?UTF-8?q?=20sanity=20check=20(#22394)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/inc/SanityCheck.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index ae4aba14db..9ced6e4e42 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -623,7 +623,7 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L static_assert(_test_btc_sample_start != 12.3f, "BTC_SAMPLE_START must be a whole number."); #endif #ifdef BTC_SAMPLE_RES - constexpr _btc_sample_res = BTC_SAMPLE_RES; + constexpr auto _btc_sample_res = BTC_SAMPLE_RES; constexpr decltype(_btc_sample_res) _test_btc_sample_res = 12.3f; static_assert(_test_btc_sample_res != 12.3f, "BTC_SAMPLE_RES must be a whole number."); #endif From 909834683a4db5ba4e16b18059dd4ae68f2129ef Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Wed, 21 Jul 2021 01:00:14 +0000 Subject: [PATCH 10/15] [cron] Bump distribution date (2021-07-21) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index d559910437..bd8473bee3 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2021-07-20" +//#define STRING_DISTRIBUTION_DATE "2021-07-21" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index ea126d2855..ef569263f7 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2021-07-20" + #define STRING_DISTRIBUTION_DATE "2021-07-21" #endif /** From 50ada44e7e7e42dd8b04668242a63071300aec27 Mon Sep 17 00:00:00 2001 From: VTXtruder <87478332+VTXtruder@users.noreply.github.com> Date: Tue, 20 Jul 2021 23:27:19 -0400 Subject: [PATCH 11/15] =?UTF-8?q?=E2=9C=A8=20Chitu3D=20V9=20board=20(#2240?= =?UTF-8?q?1)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Scott Lahteine --- Marlin/src/core/boards.h | 25 +-- Marlin/src/pins/pins.h | 2 + Marlin/src/pins/stm32f1/pins_CHITU3D.h | 7 +- Marlin/src/pins/stm32f1/pins_CHITU3D_V5.h | 146 +-------------- Marlin/src/pins/stm32f1/pins_CHITU3D_V6.h | 150 +-------------- Marlin/src/pins/stm32f1/pins_CHITU3D_V9.h | 36 ++++ Marlin/src/pins/stm32f1/pins_CHITU3D_common.h | 177 ++++++++++++++++++ 7 files changed, 234 insertions(+), 309 deletions(-) create mode 100755 Marlin/src/pins/stm32f1/pins_CHITU3D_V9.h create mode 100644 Marlin/src/pins/stm32f1/pins_CHITU3D_common.h diff --git a/Marlin/src/core/boards.h b/Marlin/src/core/boards.h index 661a213b4b..b5b33692a0 100644 --- a/Marlin/src/core/boards.h +++ b/Marlin/src/core/boards.h @@ -333,18 +333,19 @@ #define BOARD_CCROBOT_MEEB_3DP 4035 // ccrobot-online.com MEEB_3DP (STM32F103RC) #define BOARD_CHITU3D_V5 4036 // Chitu3D TronXY X5SA V5 Board #define BOARD_CHITU3D_V6 4037 // Chitu3D TronXY X5SA V6 Board -#define BOARD_CREALITY_V4 4038 // Creality v4.x (STM32F103RE) -#define BOARD_CREALITY_V427 4039 // Creality v4.2.7 (STM32F103RE) -#define BOARD_CREALITY_V4210 4040 // Creality v4.2.10 (STM32F103RE) as found in the CR-30 -#define BOARD_CREALITY_V431 4041 // Creality v4.3.1 (STM32F103RE) -#define BOARD_CREALITY_V452 4042 // Creality v4.5.2 (STM32F103RE) -#define BOARD_CREALITY_V453 4043 // Creality v4.5.3 (STM32F103RE) -#define BOARD_TRIGORILLA_PRO 4044 // Trigorilla Pro (STM32F103ZET6) -#define BOARD_FLY_MINI 4045 // FLYmaker FLY MINI (STM32F103RCT6) -#define BOARD_FLSUN_HISPEED 4046 // FLSUN HiSpeedV1 (STM32F103VET6) -#define BOARD_BEAST 4047 // STM32F103RET6 Libmaple-based controller -#define BOARD_MINGDA_MPX_ARM_MINI 4048 // STM32F103ZET6 Mingda MD-16 -#define BOARD_GTM32_PRO_VD 4049 // STM32F103VET6 controller +#define BOARD_CHITU3D_V9 4038 // Chitu3D TronXY X5SA V9 Board +#define BOARD_CREALITY_V4 4039 // Creality v4.x (STM32F103RE) +#define BOARD_CREALITY_V427 4040 // Creality v4.2.7 (STM32F103RE) +#define BOARD_CREALITY_V4210 4041 // Creality v4.2.10 (STM32F103RE) as found in the CR-30 +#define BOARD_CREALITY_V431 4042 // Creality v4.3.1 (STM32F103RE) +#define BOARD_CREALITY_V452 4043 // Creality v4.5.2 (STM32F103RE) +#define BOARD_CREALITY_V453 4044 // Creality v4.5.3 (STM32F103RE) +#define BOARD_TRIGORILLA_PRO 4045 // Trigorilla Pro (STM32F103ZET6) +#define BOARD_FLY_MINI 4046 // FLYmaker FLY MINI (STM32F103RCT6) +#define BOARD_FLSUN_HISPEED 4047 // FLSUN HiSpeedV1 (STM32F103VET6) +#define BOARD_BEAST 4048 // STM32F103RET6 Libmaple-based controller +#define BOARD_MINGDA_MPX_ARM_MINI 4049 // STM32F103ZET6 Mingda MD-16 +#define BOARD_GTM32_PRO_VD 4050 // STM32F103VET6 controller // // ARM Cortex-M4F diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index b5a81c6097..4c773d1e76 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -537,6 +537,8 @@ #include "stm32f1/pins_CHITU3D_V5.h" // STM32F1 env:chitu_f103 env:chitu_f103_maple env:chitu_v5_gpio_init env:chitu_v5_gpio_init_maple #elif MB(CHITU3D_V6) #include "stm32f1/pins_CHITU3D_V6.h" // STM32F1 env:chitu_f103 env:chitu_f103_maple +#elif MB(CHITU3D_V9) + #include "stm32f1/pins_CHITU3D_V9.h" // STM32F1 env:chitu_f103 env:chitu_f103_maple #elif MB(CREALITY_V4) #include "stm32f1/pins_CREALITY_V4.h" // STM32F1 env:STM32F103RET6_creality env:STM32F103RET6_creality_maple #elif MB(CREALITY_V4210) diff --git a/Marlin/src/pins/stm32f1/pins_CHITU3D.h b/Marlin/src/pins/stm32f1/pins_CHITU3D.h index c2025ba8c0..2d33fb9f2c 100644 --- a/Marlin/src/pins/stm32f1/pins_CHITU3D.h +++ b/Marlin/src/pins/stm32f1/pins_CHITU3D.h @@ -81,12 +81,7 @@ // Heaters / Fans // #define HEATER_0_PIN PD12 // HOT-END -#define HEATER_1_PIN -1 -#define HEATER_2_PIN -1 - #define HEATER_BED_PIN PG11 // HOT-BED -#define HEATER_BED2_PIN -1 // BED2 -#define HEATER_BED3_PIN -1 // BED3 #ifndef FAN_PIN #define FAN_PIN PG14 // MAIN BOARD FAN @@ -97,8 +92,8 @@ // // Temperature Sensors // -#define TEMP_BED_PIN PA0 // Analog Input #define TEMP_0_PIN PA1 // Analog Input +#define TEMP_BED_PIN PA0 // Analog Input // // LCD Pins diff --git a/Marlin/src/pins/stm32f1/pins_CHITU3D_V5.h b/Marlin/src/pins/stm32f1/pins_CHITU3D_V5.h index 88dd28a401..afe58df803 100644 --- a/Marlin/src/pins/stm32f1/pins_CHITU3D_V5.h +++ b/Marlin/src/pins/stm32f1/pins_CHITU3D_V5.h @@ -21,148 +21,8 @@ */ #pragma once -#include "env_validate.h" +#define BOARD_INFO_NAME "Chitu3D V5" -/** - * 2017 Victor Perez Marlin for stm32f1 test - */ +#define Z_STOP_PIN PG9 -#define BOARD_INFO_NAME "Chitu3D V5" -#define DEFAULT_MACHINE_NAME "STM32F103ZET6" - -#define BOARD_NO_NATIVE_USB - -#define DISABLE_JTAG - -// -// EEPROM -// -#define FLASH_EEPROM_EMULATION -#if ENABLED(FLASH_EEPROM_EMULATION) - // SoC Flash (framework-arduinoststm32-maple/STM32F1/libraries/EEPROM/EEPROM.h) - #define EEPROM_START_ADDRESS (0x8000000UL + (512 * 1024) - 2 * EEPROM_PAGE_SIZE) - #define EEPROM_PAGE_SIZE (0x800U) // 2KB, but will use 2x more (4KB) - #define MARLIN_EEPROM_SIZE EEPROM_PAGE_SIZE -#else - #define MARLIN_EEPROM_SIZE 0x800U // On SD, Limit to 2KB, require this amount of RAM -#endif - -// -// Limit Switches -// -#define X_STOP_PIN PG10 -#define Y_STOP_PIN PA12 -#define Z_STOP_PIN PA14 - -// -// Steppers -// -#define X_ENABLE_PIN PC13 -#define X_STEP_PIN PE5 -#define X_DIR_PIN PE6 - -#define Y_ENABLE_PIN PE4 -#define Y_STEP_PIN PE2 -#define Y_DIR_PIN PE3 - -#define Z_ENABLE_PIN PE1 -#define Z_STEP_PIN PB9 -#define Z_DIR_PIN PE0 - -#define E0_ENABLE_PIN PB8 -#define E0_STEP_PIN PB4 -#define E0_DIR_PIN PB5 - -#define E1_ENABLE_PIN PG8 -#define E1_STEP_PIN PC7 -#define E1_DIR_PIN PC6 - -// -// Temperature Sensors -// -#define TEMP_0_PIN PA1 // TH1 -#define TEMP_BED_PIN PA0 // TB1 - -// -// Heaters -// -#define HEATER_0_PIN PG12 // HEATER1 -#define HEATER_BED_PIN PG11 // HOT BED - -// -// Fans -// -#define CONTROLLER_FAN_PIN PD6 // BOARD FAN -#define FAN_PIN PG13 // FAN -#define FAN2_PIN PG14 - -// -// Misc -// -#define BEEPER_PIN PB0 -//#define LED_PIN -1 -//#define POWER_LOSS_PIN -1 -#define FIL_RUNOUT_PIN PA15 - -// SPI Flash -#define HAS_SPI_FLASH 1 -#if HAS_SPI_FLASH - #define SPI_FLASH_SIZE 0x200000 // 2MB -#endif - -// SPI 2 -#define W25QXX_CS_PIN PB12 -#define W25QXX_MOSI_PIN PB15 -#define W25QXX_MISO_PIN PB14 -#define W25QXX_SCK_PIN PB13 - -// -// TFT with FSMC interface -// -#if HAS_FSMC_TFT - #define TOUCH_CS_PIN PB7 // SPI1_NSS - #define TOUCH_SCK_PIN PA5 // SPI1_SCK - #define TOUCH_MISO_PIN PA6 // SPI1_MISO - #define TOUCH_MOSI_PIN PA7 // SPI1_MOSI - - #define TFT_RESET_PIN PF11 - #define TFT_BACKLIGHT_PIN PD13 - - #define LCD_USE_DMA_FSMC // Use DMA transfers to send data to the TFT - #define FSMC_CS_PIN PD7 - #define FSMC_RS_PIN PD11 - #define FSMC_DMA_DEV DMA2 - #define FSMC_DMA_CHANNEL DMA_CH5 - - #define TFT_CS_PIN FSMC_CS_PIN - #define TFT_RS_PIN FSMC_RS_PIN -#endif - -#if ENABLED(TFT_LVGL_UI) - // LVGL - #define HAS_SPI_FLASH_FONT 1 - #define HAS_GCODE_PREVIEW 1 - #define HAS_GCODE_DEFAULT_VIEW_IN_FLASH 0 - #define HAS_LANG_SELECT_SCREEN 1 - #define HAS_BAK_VIEW_IN_FLASH 0 - #define HAS_LOGO_IN_FLASH 0 -#elif ENABLED(TFT_COLOR_UI) - // Color UI - #define TFT_BUFFER_SIZE 14400 -#endif - -// SPI1(PA7)=LCD & SPI3(PB5)=STUFF, are not available -// Needs to use SPI2 -#define SPI_DEVICE 2 -#define SD_SCK_PIN PB13 -#define SD_MISO_PIN PB14 -#define SD_MOSI_PIN PB15 -#define SD_SS_PIN PB12 - -// -// SD Card -// -#define SDIO_SUPPORT -#define SD_DETECT_PIN -1 // PF0, but it isn't connected -#define SDIO_CLOCK 4500000 -#define SDIO_READ_RETRIES 16 +#include "pins_CHITU3D_common.h" diff --git a/Marlin/src/pins/stm32f1/pins_CHITU3D_V6.h b/Marlin/src/pins/stm32f1/pins_CHITU3D_V6.h index 51bd7294a9..b76ef52c42 100644 --- a/Marlin/src/pins/stm32f1/pins_CHITU3D_V6.h +++ b/Marlin/src/pins/stm32f1/pins_CHITU3D_V6.h @@ -21,160 +21,14 @@ */ #pragma once -#include "env_validate.h" - -/** - * 2017 Victor Perez Marlin for stm32f1 test - */ - -#define BOARD_INFO_NAME "Chitu3D" -#define DEFAULT_MACHINE_NAME "STM32F103ZET6" - -#define BOARD_NO_NATIVE_USB - -#define DISABLE_JTAG - -// -// EEPROM -// - -#if NO_EEPROM_SELECTED - #define FLASH_EEPROM_EMULATION -#endif - -#if ENABLED(FLASH_EEPROM_EMULATION) - // SoC Flash (framework-arduinoststm32-maple/STM32F1/libraries/EEPROM/EEPROM.h) - #define EEPROM_START_ADDRESS (0x8000000UL + (512 * 1024) - 2 * EEPROM_PAGE_SIZE) - #define EEPROM_PAGE_SIZE (0x800U) // 2KB, but will use 2x more (4KB) - #define MARLIN_EEPROM_SIZE EEPROM_PAGE_SIZE -#else - #define MARLIN_EEPROM_SIZE 0x800U // On SD, Limit to 2KB, require this amount of RAM -#endif - -// -// Limit Switches -// -#define X_STOP_PIN PG10 -#define Y_STOP_PIN PA12 -#define Z_STOP_PIN PG9 - -// -// Steppers -// -#define X_ENABLE_PIN PC13 -#define X_STEP_PIN PE5 -#define X_DIR_PIN PE6 - -#define Y_ENABLE_PIN PE4 -#define Y_STEP_PIN PE2 -#define Y_DIR_PIN PE3 - -#define Z_ENABLE_PIN PE1 -#define Z_STEP_PIN PB9 -#define Z_DIR_PIN PE0 +#define BOARD_INFO_NAME "Chitu3D V6" #define Z2_ENABLE_PIN PF3 #define Z2_STEP_PIN PF5 #define Z2_DIR_PIN PF1 -#define E0_ENABLE_PIN PB8 -#define E0_STEP_PIN PB4 -#define E0_DIR_PIN PB5 - -#define E1_ENABLE_PIN PG8 -#define E1_STEP_PIN PC7 -#define E1_DIR_PIN PC6 - -// -// Temperature Sensors -// -#define TEMP_0_PIN PA1 // TH1 -#define TEMP_BED_PIN PA0 // TB1 - -// -// Heaters -// -#define HEATER_0_PIN PG12 // HEATER1 -#define HEATER_BED_PIN PG11 // HOT BED -//#define HEATER_BED_INVERTING true - -// -// Fans -// -#define CONTROLLER_FAN_PIN PD6 // BOARD FAN -#define FAN_PIN PG13 // FAN -#define FAN2_PIN PG14 - -// -// Misc -// -#define BEEPER_PIN PB0 -//#define LED_PIN PD3 -//#define POWER_LOSS_PIN PG2 // PG4 PW_DET - -#ifndef FIL_RUNOUT_PIN - #define FIL_RUNOUT_PIN PA15 // MT_DET -#endif #ifndef FIL_RUNOUT2_PIN #define FIL_RUNOUT2_PIN PF13 #endif -// SPI Flash -#define HAS_SPI_FLASH 1 -#if HAS_SPI_FLASH - #define SPI_FLASH_SIZE 0x200000 // 2MB -#endif - -// SPI 2 -#define W25QXX_CS_PIN PB12 -#define W25QXX_MOSI_PIN PB15 -#define W25QXX_MISO_PIN PB14 -#define W25QXX_SCK_PIN PB13 - -// -// TFT with FSMC interface -// -#if HAS_FSMC_TFT - #define TOUCH_CS_PIN PB7 // SPI1_NSS - #define TOUCH_SCK_PIN PA5 // SPI1_SCK - #define TOUCH_MISO_PIN PA6 // SPI1_MISO - #define TOUCH_MOSI_PIN PA7 // SPI1_MOSI - - #define TFT_RESET_PIN PF11 - #define TFT_BACKLIGHT_PIN PD13 - - #define LCD_USE_DMA_FSMC // Use DMA transfers to send data to the TFT - #define FSMC_CS_PIN PD7 - #define FSMC_RS_PIN PD11 - #define FSMC_DMA_DEV DMA2 - #define FSMC_DMA_CHANNEL DMA_CH5 -#endif - -#if ENABLED(TFT_LVGL_UI) - // LVGL - #define HAS_SPI_FLASH_FONT 1 - #define HAS_GCODE_PREVIEW 1 - #define HAS_GCODE_DEFAULT_VIEW_IN_FLASH 0 - #define HAS_LANG_SELECT_SCREEN 1 - #define HAS_BAK_VIEW_IN_FLASH 0 - #define HAS_LOGO_IN_FLASH 0 -#elif ENABLED(TFT_COLOR_UI) - // Color UI - #define TFT_BUFFER_SIZE 14400 -#endif - -// SPI1(PA7)=LCD & SPI3(PB5)=STUFF, are not available -// so SPI2 is required. -#define SPI_DEVICE 2 -#define SD_SCK_PIN PB13 -#define SD_MISO_PIN PB14 -#define SD_MOSI_PIN PB15 -#define SD_SS_PIN PB12 - -// -// SD Card -// -#define SDIO_SUPPORT -#define SD_DETECT_PIN -1 // PF0, but it isn't connected -#define SDIO_CLOCK 4500000 -#define SDIO_READ_RETRIES 16 +#include "pins_CHITU3D_common.h" diff --git a/Marlin/src/pins/stm32f1/pins_CHITU3D_V9.h b/Marlin/src/pins/stm32f1/pins_CHITU3D_V9.h new file mode 100755 index 0000000000..eb7f91deab --- /dev/null +++ b/Marlin/src/pins/stm32f1/pins_CHITU3D_V9.h @@ -0,0 +1,36 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +#pragma once + +#define BOARD_INFO_NAME "Chitu3D V9" + +#define Z_STOP_PIN PA14 + +#define Z2_ENABLE_PIN PF3 +#define Z2_STEP_PIN PF5 +#define Z2_DIR_PIN PF1 + +#ifndef FIL_RUNOUT2_PIN + #define FIL_RUNOUT2_PIN PF13 +#endif + +#include "pins_CHITU3D_common.h" diff --git a/Marlin/src/pins/stm32f1/pins_CHITU3D_common.h b/Marlin/src/pins/stm32f1/pins_CHITU3D_common.h new file mode 100644 index 0000000000..b638589388 --- /dev/null +++ b/Marlin/src/pins/stm32f1/pins_CHITU3D_common.h @@ -0,0 +1,177 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +#pragma once + +#include "env_validate.h" + +#ifndef BOARD_INFO_NAME + #define BOARD_INFO_NAME "Chitu3D" +#endif +#ifndef DEFAULT_MACHINE_NAME + #define DEFAULT_MACHINE_NAME "STM32F103ZET6" +#endif + +#define BOARD_NO_NATIVE_USB +#define DISABLE_JTAG + +// +// EEPROM +// + +#if NO_EEPROM_SELECTED + #define FLASH_EEPROM_EMULATION +#endif + +#if ENABLED(FLASH_EEPROM_EMULATION) + // SoC Flash (framework-arduinoststm32-maple/STM32F1/libraries/EEPROM/EEPROM.h) + #define EEPROM_START_ADDRESS (0x8000000UL + (512 * 1024) - 2 * EEPROM_PAGE_SIZE) + #define EEPROM_PAGE_SIZE (0x800U) // 2KB, but will use 2x more (4KB) + #define MARLIN_EEPROM_SIZE EEPROM_PAGE_SIZE +#else + #define MARLIN_EEPROM_SIZE 0x800U // On SD, Limit to 2KB, require this amount of RAM +#endif + +// +// Limit Switches +// +#define X_STOP_PIN PG10 +#define Y_STOP_PIN PA12 +#ifndef Z_STOP_PIN + #define Z_STOP_PIN PG9 +#endif + +// +// Steppers +// +#define X_ENABLE_PIN PC13 +#define X_STEP_PIN PE5 +#define X_DIR_PIN PE6 + +#define Y_ENABLE_PIN PE4 +#define Y_STEP_PIN PE2 +#define Y_DIR_PIN PE3 + +#define Z_ENABLE_PIN PE1 +#define Z_STEP_PIN PB9 +#define Z_DIR_PIN PE0 + +#define E0_ENABLE_PIN PB8 +#define E0_STEP_PIN PB4 +#define E0_DIR_PIN PB5 + +#define E1_ENABLE_PIN PG8 +#define E1_STEP_PIN PC7 +#define E1_DIR_PIN PC6 + +// +// Temperature Sensors +// +#define TEMP_0_PIN PA1 // TH1 Analog Input +#define TEMP_BED_PIN PA0 // TB1 Analog Input + +// +// Heaters +// +#define HEATER_0_PIN PG12 // HEATER1 +#define HEATER_BED_PIN PG11 // HOT BED +//#define HEATER_BED_INVERTING true + +// +// Fans +// +#define CONTROLLER_FAN_PIN PD6 // BOARD FAN +#define FAN_PIN PG13 // FAN +#define FAN2_PIN PG14 + +// +// Misc +// +#define BEEPER_PIN PB0 +//#define LED_PIN PD3 +//#define POWER_LOSS_PIN PG2 // PG4 PW_DET + +#ifndef FIL_RUNOUT_PIN + #define FIL_RUNOUT_PIN PA15 // MT_DET +#endif + +// SPI Flash +#define HAS_SPI_FLASH 1 +#if HAS_SPI_FLASH + #define SPI_FLASH_SIZE 0x200000 // 2MB +#endif + +// SPI 2 +#define W25QXX_CS_PIN PB12 +#define W25QXX_MOSI_PIN PB15 +#define W25QXX_MISO_PIN PB14 +#define W25QXX_SCK_PIN PB13 + +// +// TFT with FSMC interface +// +#if HAS_FSMC_TFT + #define TOUCH_CS_PIN PB7 // SPI1_NSS + #define TOUCH_SCK_PIN PA5 // SPI1_SCK + #define TOUCH_MISO_PIN PA6 // SPI1_MISO + #define TOUCH_MOSI_PIN PA7 // SPI1_MOSI + + #define TFT_RESET_PIN PF11 + #define TFT_BACKLIGHT_PIN PD13 + + #define LCD_USE_DMA_FSMC // Use DMA transfers to send data to the TFT + #define FSMC_CS_PIN PD7 + #define FSMC_RS_PIN PD11 + #define FSMC_DMA_DEV DMA2 + #define FSMC_DMA_CHANNEL DMA_CH5 + + #define TFT_CS_PIN FSMC_CS_PIN + #define TFT_RS_PIN FSMC_RS_PIN +#endif + +#if ENABLED(TFT_LVGL_UI) + // LVGL + #define HAS_SPI_FLASH_FONT 1 + #define HAS_GCODE_PREVIEW 1 + #define HAS_GCODE_DEFAULT_VIEW_IN_FLASH 0 + #define HAS_LANG_SELECT_SCREEN 1 + #define HAS_BAK_VIEW_IN_FLASH 0 + #define HAS_LOGO_IN_FLASH 0 +#elif ENABLED(TFT_COLOR_UI) + // Color UI + #define TFT_BUFFER_SIZE 14400 +#endif + +// SPI1(PA7)=LCD & SPI3(PB5)=STUFF, are not available +// so SPI2 is required. +#define SPI_DEVICE 2 +#define SD_SCK_PIN PB13 +#define SD_MISO_PIN PB14 +#define SD_MOSI_PIN PB15 +#define SD_SS_PIN PB12 + +// +// SD Card +// +#define SDIO_SUPPORT +#define SD_DETECT_PIN -1 // PF0, but it isn't connected +#define SDIO_CLOCK 4500000 +#define SDIO_READ_RETRIES 16 From eb3ad3e4fe5a914921fb3878ccfaeb1905773d51 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 20 Jul 2021 23:35:56 -0500 Subject: [PATCH 12/15] =?UTF-8?q?=F0=9F=8E=A8=20BTT=20SKR=20Pro=20pins=20a?= =?UTF-8?q?uto-assign=20(#22411)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: MarkusThur <83773817+MarkusThur@users.noreply.github.com> --- .../pins/stm32f4/pins_BTT_SKR_PRO_common.h | 68 +++++++++++++++++-- 1 file changed, 61 insertions(+), 7 deletions(-) diff --git a/Marlin/src/pins/stm32f4/pins_BTT_SKR_PRO_common.h b/Marlin/src/pins/stm32f4/pins_BTT_SKR_PRO_common.h index fe6d8740bd..fdc6c6f6e5 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_SKR_PRO_common.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_SKR_PRO_common.h @@ -231,27 +231,81 @@ // // Temperature Sensors +// Use ADC pins without pullup for sensors that don't need a pullup. // -#define TEMP_0_PIN PF4 // T1 <-> E0 -#define TEMP_1_PIN PF5 // T2 <-> E1 -#define TEMP_2_PIN PF6 // T3 <-> E2 -#define TEMP_BED_PIN PF3 // T0 <-> Bed +#if TEMP_SENSOR_0_IS_AD8495 || TEMP_SENSOR_0 == 20 + #define TEMP_0_PIN PF8 +#else + #define TEMP_0_PIN PF4 // T1 <-> E0 +#endif +#if TEMP_SENSOR_1_IS_AD8495 || TEMP_SENSOR_1 == 20 + #define TEMP_1_PIN PF9 +#else + #define TEMP_1_PIN PF5 // T2 <-> E1 +#endif +#if TEMP_SENSOR_2_IS_AD8495 || TEMP_SENSOR_2 == 20 + #define TEMP_2_PIN PF10 +#else + #define TEMP_2_PIN PF6 // T3 <-> E2 +#endif +#if TEMP_SENSOR_BED_IS_AD8495 || TEMP_SENSOR_BED == 20 + #define TEMP_BED_PIN PF7 +#else + #define TEMP_BED_PIN PF3 // T0 <-> Bed +#endif + +#ifdef TEMP_SENSOR_PROBE && !defined(TEMP_PROBE_PIN) + #if TEMP_SENSOR_PROBE_IS_AD8495 || TEMP_SENSOR_PROBE == 20 + #if HOTENDS == 2 + #define TEMP_PROBE_PIN PF10 + #elif HOTENDS < 2 + #define TEMP_PROBE_PIN PF9 + #endif + #else + #if HOTENDS == 2 + #define TEMP_PROBE_PIN TEMP_2_PIN + #elif HOTENDS < 2 + #define TEMP_PROBE_PIN TEMP_1_PIN + #endif + #endif +#endif + +#if TEMP_SENSOR_CHAMBER && !defined(TEMP_CHAMBER_PIN) + #if TEMP_SENSOR_CHAMBER_IS_AD8495 || TEMP_SENSOR_CHAMBER == 20 + #define TEMP_CHAMBER_PIN PF10 + #else + #define TEMP_CHAMBER_PIN TEMP_2_PIN + #endif +#endif // -// Heaters / Fans +// Heaters // #define HEATER_0_PIN PB1 // Heater0 #define HEATER_1_PIN PD14 // Heater1 -#define HEATER_2_PIN PB0 // Heater1 +#if TEMP_SENSOR_CHAMBER && HOTENDS < 3 + #define HEATER_CHAMBER_PIN PB0 // Heater2 +#else + #define HEATER_2_PIN PB0 // Heater2 +#endif #define HEATER_BED_PIN PD12 // Hotbed + +// +// Fans +// #define FAN_PIN PC8 // Fan0 #define FAN1_PIN PE5 // Fan1 -#define FAN2_PIN PE6 // Fan2 #ifndef E0_AUTO_FAN_PIN #define E0_AUTO_FAN_PIN FAN1_PIN #endif +#if ENABLED(USE_CONTROLLER_FAN) && HOTENDS < 2 + #define CONTROLLER_FAN_PIN PE6 // Fan2 +#else + #define FAN2_PIN PE6 // Fan2 +#endif + // // Misc. Functions // From af4c281af582699bd535a1da4eb2abb2c7775cba Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 21 Jul 2021 00:12:26 -0500 Subject: [PATCH 13/15] =?UTF-8?q?=F0=9F=94=A7=20Clean=20up=20PTC=5FPROBE?= =?UTF-8?q?=5FHEATING=5FOFFSET?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/Configuration_adv.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index e99e1f7c09..d404d0d19c 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -2021,9 +2021,9 @@ // calibration. //#define BTC_PROBE_TEMP 30 // (°C) - // Height above Z=0.0f to raise the nozzle. Lowering this can help the probe to heat faster. - // Note: the Z=0.0f offset is determined by the probe offset which can be set using M851. - //#define PTC_PROBE_HEATING_OFFSET 0.5f + // Height above Z=0.0 to raise the nozzle. Lowering this can help the probe to heat faster. + // Note: the Z=0.0 offset is determined by the probe offset which can be set using M851. + //#define PTC_PROBE_HEATING_OFFSET 0.5 // Height to raise the Z-probe between heating and taking the next measurement. Some probes // may fail to untrigger if they have been triggered for a long time, which can be solved by From eb2f086522c0befd3628693250ba56fe56a1a7a1 Mon Sep 17 00:00:00 2001 From: Luke Harrison Date: Wed, 21 Jul 2021 07:43:33 +0200 Subject: [PATCH 14/15] =?UTF-8?q?=F0=9F=94=A7=20Octopus=20SPI=20display=20?= =?UTF-8?q?pins,=20fix=20USB=20build=20env=20(#22412)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pins/stm32f4/pins_BTT_OCTOPUS_V1_common.h | 18 ++++++++++++++++++ ini/stm32f1.ini | 2 +- ini/stm32f4.ini | 3 ++- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_V1_common.h b/Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_V1_common.h index 2cf1ee1447..25622bc62d 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_V1_common.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_V1_common.h @@ -500,6 +500,24 @@ #endif #endif +#if HAS_SPI_TFT + #define TFT_CS_PIN EXP2_07_PIN + #define TFT_A0_PIN EXP2_04_PIN + #define TFT_SCK_PIN EXP2_09_PIN + #define TFT_MISO_PIN EXP2_10_PIN + #define TFT_MOSI_PIN EXP2_05_PIN + + #define TOUCH_INT_PIN EXP1_04_PIN + #define TOUCH_MISO_PIN EXP1_05_PIN + #define TOUCH_MOSI_PIN EXP1_08_PIN + #define TOUCH_SCK_PIN EXP1_06_PIN + #define TOUCH_CS_PIN EXP1_07_PIN + + #define BTN_EN1 EXP2_08_PIN + #define BTN_EN2 EXP2_06_PIN + #define BTN_ENC EXP1_09_PIN +#endif + // // WIFI // diff --git a/ini/stm32f1.ini b/ini/stm32f1.ini index 0f1d308660..175d0e45b0 100644 --- a/ini/stm32f1.ini +++ b/ini/stm32f1.ini @@ -336,7 +336,7 @@ board_build.variant = MARLIN_F103Vx board_build.offset = 0x10000 board_upload.offset_address = 0x08010000 build_flags = ${stm32_variant.build_flags} - -DMCU_STM32F103VE -DU20 -DTS_V12 -DLED_BUILTIN=PC2 -UPIN_WIRE_SDA + -DMCU_STM32F103VE -DU20 -DTS_V12 -DLED_BUILTIN=PC2 -UPIN_WIRE_SDA -UPIN_WIRE_SCL -DPIN_WIRE_SDA=PB11 -DPIN_WIRE_SCL=PB10 -DHAL_DAC_MODULE_DISABLED -DHAL_I2S_MODULE_DISABLED build_unflags = ${stm32_variant.build_unflags} diff --git a/ini/stm32f4.ini b/ini/stm32f4.ini index f9c16cf455..901f145113 100644 --- a/ini/stm32f4.ini +++ b/ini/stm32f4.ini @@ -129,7 +129,7 @@ platform = ${common_stm32.platform} extends = stm32_variant board = marlin_BigTree_SKR_Pro board_build.offset = 0x8000 -build_flags = ${stm32_variant.build_flags} -DSTM32F407_5ZX +build_flags = ${stm32_variant.build_flags} -DSTM32F407_5ZX debug_tool = stlink upload_protocol = stlink @@ -235,6 +235,7 @@ build_flags = ${stm32_variant.build_flags} platform = ${common_stm32.platform} extends = env:BIGTREE_OCTOPUS_V1 platform_packages = ${stm_flash_drive.platform_packages} +build_unflags = -DUSBD_USE_CDC build_flags = ${stm_flash_drive.build_flags} -DSTM32F446_5VX -DUSE_USB_HS_IN_FS -DUSE_USBHOST_HS -DUSBD_IRQ_PRIO=5 From d819de46d32d7d6f87664e4b7ecf3afb7a3ed8ce Mon Sep 17 00:00:00 2001 From: ellensp Date: Thu, 22 Jul 2021 09:31:11 +1200 Subject: [PATCH 15/15] =?UTF-8?q?=F0=9F=8E=A8=20MKS=20Hardware=20Test=20fo?= =?UTF-8?q?llowup=20(#22414)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Scott Lahteine --- .../lcd/extui/mks_ui/draw_media_select.cpp | 4 +- .../src/lcd/extui/mks_ui/draw_ready_print.cpp | 12 +- Marlin/src/lcd/extui/mks_ui/draw_tool.cpp | 4 +- .../extui/mks_ui/draw_touch_calibration.cpp | 6 +- Marlin/src/lcd/extui/mks_ui/mks_hardware.cpp | 188 ++++++++++++++---- Marlin/src/lcd/extui/mks_ui/mks_hardware.h | 2 + .../src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3.h | 6 + buildroot/tests/mks_robin_nano35 | 1 + buildroot/tests/mks_robin_nano35_maple | 1 + 9 files changed, 170 insertions(+), 54 deletions(-) diff --git a/Marlin/src/lcd/extui/mks_ui/draw_media_select.cpp b/Marlin/src/lcd/extui/mks_ui/draw_media_select.cpp index 0394ed6009..81c82dc02d 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_media_select.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_media_select.cpp @@ -39,7 +39,7 @@ enum { }; #if ENABLED(MKS_TEST) - extern uint8_t curent_disp_ui; + extern uint8_t current_disp_ui; #endif static void event_handler(lv_obj_t *obj, lv_event_t event) { @@ -49,7 +49,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { case ID_T_USB_DISK: card.changeMedia(&card.media_driver_usbFlash); break; case ID_T_SD_DISK: card.changeMedia(&card.media_driver_sdcard); break; case ID_T_RETURN: - TERN_(MKS_TEST, curent_disp_ui = 1); + TERN_(MKS_TEST, current_disp_ui = 1); lv_draw_ready_print(); return; } diff --git a/Marlin/src/lcd/extui/mks_ui/draw_ready_print.cpp b/Marlin/src/lcd/extui/mks_ui/draw_ready_print.cpp index 6f24d81b49..d324d8d7be 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_ready_print.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_ready_print.cpp @@ -61,7 +61,7 @@ static lv_obj_t *buttonExt1, *labelExt1, *buttonFanstate, *labelFan; #endif #if ENABLED(MKS_TEST) - uint8_t curent_disp_ui = 0; + uint8_t current_disp_ui = 0; #endif enum { ID_TOOL = 1, ID_SET, ID_PRINT, ID_INFO_EXT, ID_INFO_BED, ID_INFO_FAN }; @@ -106,8 +106,10 @@ void disp_det_error() { lv_obj_t *e1, *e2, *e3, *bed; void mks_disp_test() { char buf[30] = {0}; - sprintf_P(buf, PSTR("e1:%d"), thermalManager.wholeDegHotend(0)); - lv_label_set_text(e1, buf); + #if HAS_HOTEND + sprintf_P(buf, PSTR("e1:%d"), thermalManager.wholeDegHotend(0)); + lv_label_set_text(e1, buf); + #endif #if HAS_MULTI_HOTEND sprintf_P(buf, PSTR("e2:%d"), thermalManager.wholeDegHotend(1)); lv_label_set_text(e2, buf); @@ -126,7 +128,7 @@ void lv_draw_ready_print() { ZERO(disp_state_stack._disp_state); scr = lv_screen_create(PRINT_READY_UI, ""); - if (TERN0(SDSUPPORT, mks_test_flag == 0x1E)) { + if (mks_test_flag == 0x1E) { // Create image buttons buttonTool = lv_imgbtn_create(scr, "F:/bmp_tool.bin", event_handler, ID_TOOL); @@ -147,7 +149,7 @@ void lv_draw_ready_print() { #if HAS_MULTI_HOTEND e2 = lv_label_create_empty(scr); lv_obj_set_pos(e2, 20, 45); - sprintf_P(buf, PSTR("e1: %d"), thermalManager.wholeDegHotend(1)); + sprintf_P(buf, PSTR("e2: %d"), thermalManager.wholeDegHotend(1)); lv_label_set_text(e2, buf); #endif #if HAS_HEATED_BED diff --git a/Marlin/src/lcd/extui/mks_ui/draw_tool.cpp b/Marlin/src/lcd/extui/mks_ui/draw_tool.cpp index 16c1448b3c..8b9747972d 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_tool.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_tool.cpp @@ -45,7 +45,7 @@ enum { }; #if ENABLED(MKS_TEST) - extern uint8_t curent_disp_ui; + extern uint8_t current_disp_ui; #endif static void event_handler(lv_obj_t *obj, lv_event_t event) { @@ -75,7 +75,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { lv_draw_more(); break; case ID_T_RETURN: - TERN_(MKS_TEST, curent_disp_ui = 1); + TERN_(MKS_TEST, current_disp_ui = 1); lv_draw_ready_print(); break; } diff --git a/Marlin/src/lcd/extui/mks_ui/draw_touch_calibration.cpp b/Marlin/src/lcd/extui/mks_ui/draw_touch_calibration.cpp index a4470a4c87..e10a07c6de 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_touch_calibration.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_touch_calibration.cpp @@ -34,6 +34,10 @@ static lv_obj_t *scr; static lv_obj_t *status_label; +#if ENABLED(MKS_TEST) + extern uint8_t current_disp_ui; +#endif + static void event_handler(lv_obj_t *obj, lv_event_t event); enum { @@ -93,7 +97,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { if (event != LV_EVENT_RELEASED) return; switch (obj->mks_obj_id) { case ID_TC_RETURN: - TERN_(MKS_TEST, curent_disp_ui = 1); + TERN_(MKS_TEST, current_disp_ui = 1); lv_clear_touch_calibration_screen(); draw_return_ui(); break; diff --git a/Marlin/src/lcd/extui/mks_ui/mks_hardware.cpp b/Marlin/src/lcd/extui/mks_ui/mks_hardware.cpp index 3c7eb55532..5cd1a4c525 100644 --- a/Marlin/src/lcd/extui/mks_ui/mks_hardware.cpp +++ b/Marlin/src/lcd/extui/mks_ui/mks_hardware.cpp @@ -38,12 +38,44 @@ #if ENABLED(MKS_TEST) #include "mks_hardware.h" + #include "../../../module/endstops.h" bool pw_det_sta, pw_off_sta, mt_det_sta; #if PIN_EXISTS(MT_DET_2) bool mt_det2_sta; #endif - bool endstopx1_sta, endstopx2_sta, endstopy1_sta, endstopy2_sta, endstopz1_sta, endstopz2_sta; + #if HAS_X_MIN || HAS_X_MAX + bool endstopx1_sta; + #else + constexpr static bool endstopx1_sta = true; + #endif + #if HAS_X2_MIN || HAS_X2_MAX + bool endstopx2_sta; + #else + constexpr static bool endstopx2_sta = true; + #endif + #if HAS_Y_MIN || HAS_Y_MAX + bool endstopy1_sta; + #else + constexpr static bool endstopy1_sta = true; + #endif + #if HAS_Y2_MIN || HAS_Y2_MAX + bool endstopy2_sta; + #else + constexpr static bool endstopy2_sta = true; + #endif + #if HAS_Z_MIN || HAS_Z_MAX + bool endstopz1_sta; + #else + constexpr static bool endstopz1_sta = true; + #endif + #if HAS_Z2_MIN || HAS_Z2_MAX + bool endstopz2_sta; + #else + constexpr static bool endstopz2_sta = true; + #endif + + #define ESTATE(S) (READ(S##_PIN) != S##_ENDSTOP_INVERTING) void test_gpio_readlevel_L() { WRITE(WIFI_IO0_PIN, HIGH); @@ -54,10 +86,36 @@ #if PIN_EXISTS(MT_DET_2) mt_det2_sta = (READ(MT_DET_2_PIN) == LOW); #endif - endstopx1_sta = (READ(X_MIN_PIN) == LOW); - endstopy1_sta = (READ(Y_MIN_PIN) == LOW); - endstopz1_sta = (READ(Z_MIN_PIN) == LOW); - endstopz2_sta = (READ(Z_MAX_PIN) == LOW); + #if HAS_X_MIN + endstopx1_sta = ESTATE(X_MIN); + #elif HAS_X_MAX + endstopx1_sta = ESTATE(X_MAX); + #endif + #if HAS_X2_MIN + endstopx2_sta = ESTATE(X2_MIN); + #elif HAS_X2_MAX + endstopx2_sta = ESTATE(X2_MAX); + #endif + #if HAS_Y_MIN + endstopy1_sta = ESTATE(Y_MIN); + #elif HAS_Y_MAX + endstopy1_sta = ESTATE(Y_MAX); + #endif + #if HAS_Y2_MIN + endstopy2_sta = ESTATE(Y2_MIN); + #elif HAS_Y2_MAX + endstopy2_sta = ESTATE(Y2_MAX); + #endif + #if HAS_Z_MIN + endstopz1_sta = ESTATE(Z_MIN); + #elif HAS_Z_MAX + endstopz1_sta = ESTATE(Z_MAX); + #endif + #if HAS_Z2_MIN + endstopz2_sta = ESTATE(Z2_MIN); + #elif HAS_Z2_MAX + endstopz2_sta = ESTATE(Z2_MAX); + #endif } void test_gpio_readlevel_H() { @@ -69,44 +127,66 @@ #if PIN_EXISTS(MT_DET_2) mt_det2_sta = (READ(MT_DET_2_PIN) == HIGH); #endif - endstopx1_sta = (READ(X_MIN_PIN) == HIGH); - endstopy1_sta = (READ(Y_MIN_PIN) == HIGH); - endstopz1_sta = (READ(Z_MIN_PIN) == HIGH); - endstopz2_sta = (READ(Z_MAX_PIN) == HIGH); + #if HAS_X_MIN + endstopx1_sta = !ESTATE(X_MIN); + #elif HAS_X_MAX + endstopx1_sta = !ESTATE(X_MAX); + #endif + #if HAS_X2_MIN + endstopx2_sta = !ESTATE(X2_MIN); + #elif HAS_X2_MAX + endstopx2_sta = !ESTATE(X2_MAX); + #endif + #if HAS_Y_MIN + endstopy1_sta = !ESTATE(Y_MIN); + #elif HAS_Y_MAX + endstopy1_sta = !ESTATE(Y_MAX); + #endif + #if HAS_Y2_MIN + endstopy2_sta = !ESTATE(Y2_MIN); + #elif HAS_Y2_MAX + endstopy2_sta = !ESTATE(Y2_MAX); + #endif + #if HAS_Z_MIN + endstopz1_sta = !ESTATE(Z_MIN); + #elif HAS_Z_MAX + endstopz1_sta = !ESTATE(Z_MAX); + #endif + #if HAS_Z2_MIN + endstopz2_sta = !ESTATE(Z2_MIN); + #elif HAS_Z2_MAX + endstopz2_sta = !ESTATE(Z2_MAX); + #endif } void init_test_gpio() { - SET_INPUT_PULLUP(X_MIN_PIN); - SET_INPUT_PULLUP(Y_MIN_PIN); - SET_INPUT_PULLUP(Z_MIN_PIN); - SET_INPUT_PULLUP(Z_MAX_PIN); + endstops.init(); SET_OUTPUT(WIFI_IO0_PIN); - SET_INPUT_PULLUP(MT_DET_1_PIN); + #if PIN_EXISTS(MT_DET_1) + SET_INPUT_PULLUP(MT_DET_1_PIN); + #endif #if PIN_EXISTS(MT_DET_2) SET_INPUT_PULLUP(MT_DET_2_PIN); #endif SET_INPUT_PULLUP(MKS_TEST_POWER_LOSS_PIN); SET_INPUT_PULLUP(MKS_TEST_PS_ON_PIN); - SET_INPUT_PULLUP(SERVO0_PIN); - SET_OUTPUT(X_ENABLE_PIN); - SET_OUTPUT(Y_ENABLE_PIN); - SET_OUTPUT(Z_ENABLE_PIN); - SET_OUTPUT(E0_ENABLE_PIN); - #if DISABLED(MKS_HARDWARE_TEST_ONLY_E0) - SET_OUTPUT(E1_ENABLE_PIN); + OUT_WRITE(X_ENABLE_PIN, LOW); + #if HAS_Y_AXIS + OUT_WRITE(Y_ENABLE_PIN, LOW); #endif - - WRITE(X_ENABLE_PIN, LOW); - WRITE(Y_ENABLE_PIN, LOW); - WRITE(Z_ENABLE_PIN, LOW); - WRITE(E0_ENABLE_PIN, LOW); - #if DISABLED(MKS_HARDWARE_TEST_ONLY_E0) - WRITE(E1_ENABLE_PIN, LOW); + #if HAS_Z_AXIS + OUT_WRITE(Z_ENABLE_PIN, LOW); + #endif + #if HAS_EXTRUDERS + OUT_WRITE(E0_ENABLE_PIN, LOW); + #endif + #if HAS_MULTI_EXTRUDER && DISABLED(MKS_HARDWARE_TEST_ONLY_E0) + OUT_WRITE(E1_ENABLE_PIN, LOW); #endif #if ENABLED(MKS_HARDWARE_TEST_ONLY_E0) @@ -161,34 +241,54 @@ void mks_hardware_test() { if (millis() % 2000 < 1000) { + thermalManager.fan_speed[0] = 255; WRITE(X_DIR_PIN, LOW); - WRITE(Y_DIR_PIN, LOW); - WRITE(Z_DIR_PIN, LOW); - WRITE(E0_DIR_PIN, LOW); - #if DISABLED(MKS_HARDWARE_TEST_ONLY_E0) + #if HAS_Y_AXIS + WRITE(Y_DIR_PIN, LOW); + #endif + #if HAS_Z_AXIS + WRITE(Z_DIR_PIN, LOW); + #endif + #if HAS_EXTRUDERS + WRITE(E0_DIR_PIN, LOW); + #endif + #if HAS_MULTI_EXTRUDER && DISABLED(MKS_HARDWARE_TEST_ONLY_E0) WRITE(E1_DIR_PIN, LOW); #endif - thermalManager.fan_speed[0] = 255; - #if DISABLED(MKS_HARDWARE_TEST_ONLY_E0) + #if HAS_MULTI_HOTEND && DISABLED(MKS_HARDWARE_TEST_ONLY_E0) WRITE(HEATER_1_PIN, HIGH); // HE1 #endif - WRITE(HEATER_0_PIN, HIGH); // HE0 - WRITE(HEATER_BED_PIN, HIGH); // HOT-BED + #if HAS_HOTEND + WRITE(HEATER_0_PIN, HIGH); // HE0 + #endif + #if HAS_HEATED_BED + WRITE(HEATER_BED_PIN, HIGH); // HOT-BED + #endif } else { + thermalManager.fan_speed[0] = 0; WRITE(X_DIR_PIN, HIGH); - WRITE(Y_DIR_PIN, HIGH); - WRITE(Z_DIR_PIN, HIGH); - WRITE(E0_DIR_PIN, HIGH); - #if DISABLED(MKS_HARDWARE_TEST_ONLY_E0) + #if HAS_Y_AXIS + WRITE(Y_DIR_PIN, HIGH); + #endif + #if HAS_Y_AXIS + WRITE(Z_DIR_PIN, HIGH); + #endif + #if HAS_EXTRUDERS + WRITE(E0_DIR_PIN, HIGH); + #endif + #if HAS_MULTI_EXTRUDER && DISABLED(MKS_HARDWARE_TEST_ONLY_E0) WRITE(E1_DIR_PIN, HIGH); #endif - thermalManager.fan_speed[0] = 0; - #if DISABLED(MKS_HARDWARE_TEST_ONLY_E0) + #if HAS_MULTI_HOTEND && DISABLED(MKS_HARDWARE_TEST_ONLY_E0) WRITE(HEATER_1_PIN, LOW); // HE1 #endif - WRITE(HEATER_0_PIN, LOW); // HE0 - WRITE(HEATER_BED_PIN, LOW); // HOT-BED + #if HAS_HOTEND + WRITE(HEATER_0_PIN, LOW); // HE0 + #endif + #if HAS_HEATED_BED + WRITE(HEATER_BED_PIN, LOW); // HOT-BED + #endif } if (endstopx1_sta && endstopx2_sta && endstopy1_sta && endstopy2_sta && endstopz1_sta && endstopz2_sta) { diff --git a/Marlin/src/lcd/extui/mks_ui/mks_hardware.h b/Marlin/src/lcd/extui/mks_ui/mks_hardware.h index f41c4e18ac..5313265662 100644 --- a/Marlin/src/lcd/extui/mks_ui/mks_hardware.h +++ b/Marlin/src/lcd/extui/mks_ui/mks_hardware.h @@ -31,6 +31,8 @@ void mks_test_get(); void mks_gpio_test(); extern uint8_t mks_test_flag; +#else + #define mks_test_flag 0 #endif // String display and assets diff --git a/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3.h b/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3.h index 178e75ab7f..182506f11e 100644 --- a/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3.h +++ b/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3.h @@ -220,6 +220,12 @@ #define WIFI_RESET_PIN PE9 // MKS ESP WIFI RESET PIN #endif +// MKS TEST +#if ENABLED(MKS_TEST) + #define MKS_TEST_POWER_LOSS_PIN PA13 // PW_DET + #define MKS_TEST_PS_ON_PIN PB2 // PW_OFF +#endif + // // Onboard SD card // diff --git a/buildroot/tests/mks_robin_nano35 b/buildroot/tests/mks_robin_nano35 index 99ff2623bb..bd16fe48e9 100755 --- a/buildroot/tests/mks_robin_nano35 +++ b/buildroot/tests/mks_robin_nano35 @@ -22,6 +22,7 @@ use_example_configs Mks/Robin opt_set MOTHERBOARD BOARD_MKS_ROBIN_NANO_V2 opt_disable TFT_INTERFACE_FSMC opt_enable TFT_INTERFACE_SPI MKS_WIFI_MODULE +opt_add MKS_TEST exec_test $1 $2 "MKS Robin v2 nano Emulated DOGM SPI, MKS_WIFI_MODULE" "$3" # diff --git a/buildroot/tests/mks_robin_nano35_maple b/buildroot/tests/mks_robin_nano35_maple index f1549a8103..ebd5466ce6 100755 --- a/buildroot/tests/mks_robin_nano35_maple +++ b/buildroot/tests/mks_robin_nano35_maple @@ -32,6 +32,7 @@ use_example_configs Mks/Robin opt_set MOTHERBOARD BOARD_MKS_ROBIN_NANO_V2 opt_disable TFT_INTERFACE_FSMC TFT_COLOR_UI TOUCH_SCREEN TFT_RES_320x240 SERIAL_PORT_2 opt_enable TFT_INTERFACE_SPI TFT_LVGL_UI TFT_RES_480x320 MKS_WIFI_MODULE +opt_add MKS_TEST exec_test $1 $2 "MKS Robin v2 nano LVGL SPI w/ WiFi" "$3" #