From 53abfdc2c35fa7076515cef2ba3ce2403bef8a0f Mon Sep 17 00:00:00 2001 From: Jason Smith Date: Tue, 15 Oct 2019 12:18:46 -0700 Subject: [PATCH] Fix BLTOUCH and FAN PWM conflicts on SKR E3 boards (#15547) --- Marlin/src/HAL/HAL_STM32F1/HAL.cpp | 2 +- Marlin/src/HAL/HAL_STM32F1/timers.cpp | 2 +- Marlin/src/HAL/HAL_STM32F1/timers.h | 9 ++++++++- Marlin/src/core/boards.h | 7 ++++++- Marlin/src/feature/digipot/digipot_mcp4451.cpp | 2 +- Marlin/src/inc/Conditionals_LCD.h | 2 +- Marlin/src/lcd/dogm/ultralcd_DOGM.h | 2 +- .../src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.h | 4 ++-- Marlin/src/pins/mega/pins_MEGATRONICS_3.h | 2 +- Marlin/src/pins/pins.h | 14 +++++++------- Marlin/src/pins/sanguino/pins_MELZI.h | 1 - Marlin/src/pins/sanguino/pins_SANGUINOLOLU_11.h | 10 +++++----- .../share/tests/STM32F103RC_bigtree_USB-tests | 6 +++--- 13 files changed, 37 insertions(+), 26 deletions(-) diff --git a/Marlin/src/HAL/HAL_STM32F1/HAL.cpp b/Marlin/src/HAL/HAL_STM32F1/HAL.cpp index 802a489101..cba41dd3c2 100644 --- a/Marlin/src/HAL/HAL_STM32F1/HAL.cpp +++ b/Marlin/src/HAL/HAL_STM32F1/HAL.cpp @@ -27,8 +27,8 @@ #ifdef __STM32F1__ -#include "HAL.h" #include "../../inc/MarlinConfig.h" +#include "HAL.h" #include diff --git a/Marlin/src/HAL/HAL_STM32F1/timers.cpp b/Marlin/src/HAL/HAL_STM32F1/timers.cpp index a21dc12c12..a1f5f1e453 100644 --- a/Marlin/src/HAL/HAL_STM32F1/timers.cpp +++ b/Marlin/src/HAL/HAL_STM32F1/timers.cpp @@ -26,8 +26,8 @@ #ifdef __STM32F1__ +#include "../../inc/MarlinConfig.h" #include "HAL.h" - #include "timers.h" // ------------------------ diff --git a/Marlin/src/HAL/HAL_STM32F1/timers.h b/Marlin/src/HAL/HAL_STM32F1/timers.h index 69793f4302..aba619fd10 100644 --- a/Marlin/src/HAL/HAL_STM32F1/timers.h +++ b/Marlin/src/HAL/HAL_STM32F1/timers.h @@ -27,6 +27,7 @@ #include #include +#include "../../core/boards.h" // ------------------------ // Defines @@ -54,7 +55,13 @@ typedef uint16_t hal_timer_t; #define TEMP_TIMER_NUM 2 // index of timer to use for temperature //#define TEMP_TIMER_NUM 4 // 2->4, Timer 2 for Stepper Current PWM #define PULSE_TIMER_NUM STEP_TIMER_NUM -#define SERVO0_TIMER_NUM 1 // SERVO0 or BLTOUCH + +#if MB(BIGTREE_SKR_MINI_E3, BIGTREE_SKR_E3_DIP, BTT_SKR_MINI_E3_V1_2, MKS_ROBIN_LITE) + // SKR Mini E3 boards use PA8 as FAN_PIN, so TIMER 1 is used for Fan PWM. + #define SERVO0_TIMER_NUM 8 +#else + #define SERVO0_TIMER_NUM 1 // SERVO0 or BLTOUCH +#endif #define STEP_TIMER_IRQ_PRIO 1 #define TEMP_TIMER_IRQ_PRIO 2 diff --git a/Marlin/src/core/boards.h b/Marlin/src/core/boards.h index d3d7b18925..5cea3a69b8 100644 --- a/Marlin/src/core/boards.h +++ b/Marlin/src/core/boards.h @@ -21,6 +21,8 @@ */ #pragma once +#include "macros.h" + #define BOARD_UNKNOWN -1 // @@ -316,4 +318,7 @@ #define BOARD_LINUX_RAMPS 9999 -#define MB(board) (defined(BOARD_##board) && MOTHERBOARD==BOARD_##board) +#define _MB_1(B) (defined(BOARD_##B) && MOTHERBOARD==BOARD_##B) +#define MB(V...) DO(MB,||,V) + +#define IS_MELZI MB(MELZI, MELZI_CREALITY, MELZI_MAKR3D, MELZI_MALYAN, MELZI_TRONXY) diff --git a/Marlin/src/feature/digipot/digipot_mcp4451.cpp b/Marlin/src/feature/digipot/digipot_mcp4451.cpp index 1b9672251f..b04406f4be 100644 --- a/Marlin/src/feature/digipot/digipot_mcp4451.cpp +++ b/Marlin/src/feature/digipot/digipot_mcp4451.cpp @@ -35,7 +35,7 @@ #if MB(5DPRINT) #define DIGIPOT_I2C_FACTOR 117.96 #define DIGIPOT_I2C_MAX_CURRENT 1.736 -#elif MB(AZTEEG_X5_MINI) || MB(AZTEEG_X5_MINI_WIFI) +#elif MB(AZTEEG_X5_MINI, AZTEEG_X5_MINI_WIFI) #define DIGIPOT_I2C_FACTOR 113.5 #define DIGIPOT_I2C_MAX_CURRENT 2.0 #else diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index ec74131592..42965a14f2 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -562,7 +562,7 @@ #define BOOT_MARLIN_LOGO_SMALL #endif -#define IS_RE_ARM_BOARD (MB(RAMPS_14_RE_ARM_EFB) || MB(RAMPS_14_RE_ARM_EEB) || MB(RAMPS_14_RE_ARM_EFF) || MB(RAMPS_14_RE_ARM_EEF) || MB(RAMPS_14_RE_ARM_SF)) +#define IS_RE_ARM_BOARD MB(RAMPS_14_RE_ARM_EFB, RAMPS_14_RE_ARM_EEB, RAMPS_14_RE_ARM_EFF, RAMPS_14_RE_ARM_EEF, RAMPS_14_RE_ARM_SF) #define HAS_SDCARD_CONNECTION EITHER(TARGET_LPC1768, ADAFRUIT_GRAND_CENTRAL_M4) diff --git a/Marlin/src/lcd/dogm/ultralcd_DOGM.h b/Marlin/src/lcd/dogm/ultralcd_DOGM.h index e8d1b8a1e3..8ff2dbc85b 100644 --- a/Marlin/src/lcd/dogm/ultralcd_DOGM.h +++ b/Marlin/src/lcd/dogm/ultralcd_DOGM.h @@ -82,7 +82,7 @@ // MaKrPanel, Mini Viki, Viki 2.0, AZSMZ 12864 ST7565 controller - #define SMART_RAMPS (MB(RAMPS_SMART_EFB) || MB(RAMPS_SMART_EEB) || MB(RAMPS_SMART_EFF) || MB(RAMPS_SMART_EEF) || MB(RAMPS_SMART_SF)) + #define SMART_RAMPS MB(RAMPS_SMART_EFB, RAMPS_SMART_EEB, RAMPS_SMART_EFF, RAMPS_SMART_EEF, RAMPS_SMART_SF) #define U8G_CLASS U8GLIB_64128N_2X_HAL // 4 stripes (HW-SPI) #if SMART_RAMPS || DOGLCD_SCK != SCK_PIN || DOGLCD_MOSI != MOSI_PIN #define FORCE_SOFT_SPI // SW-SPI diff --git a/Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.h b/Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.h index 960375ae43..858cbe8824 100644 --- a/Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.h +++ b/Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.h @@ -49,11 +49,11 @@ #define CPU_ST7920_DELAY_1 DELAY_NS(0) #define CPU_ST7920_DELAY_2 DELAY_NS(0) #define CPU_ST7920_DELAY_3 DELAY_NS(50) -#elif MB(3DRAG) || MB(K8200) || MB(K8400) || MB(SILVER_GATE) +#elif MB(3DRAG, K8200, K8400, SILVER_GATE) #define CPU_ST7920_DELAY_1 DELAY_NS(0) #define CPU_ST7920_DELAY_2 DELAY_NS(188) #define CPU_ST7920_DELAY_3 DELAY_NS(0) -#elif MB(MINIRAMBO) || MB(EINSY_RAMBO) || MB(EINSY_RETRO) +#elif MB(MINIRAMBO, EINSY_RAMBO, EINSY_RETRO) #define CPU_ST7920_DELAY_1 DELAY_NS(0) #define CPU_ST7920_DELAY_2 DELAY_NS(250) #define CPU_ST7920_DELAY_3 DELAY_NS(0) diff --git a/Marlin/src/pins/mega/pins_MEGATRONICS_3.h b/Marlin/src/pins/mega/pins_MEGATRONICS_3.h index 7a6465471c..23fbe7636c 100644 --- a/Marlin/src/pins/mega/pins_MEGATRONICS_3.h +++ b/Marlin/src/pins/mega/pins_MEGATRONICS_3.h @@ -164,7 +164,7 @@ #define SHIFT_OUT 34 #define SHIFT_EN 44 - #if MB(MEGATRONICS_31) || MB(MEGATRONICS_32) + #if MB(MEGATRONICS_31, MEGATRONICS_32) #define SD_DETECT_PIN 56 #endif diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index 39afc2b388..8db40bd5e2 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -35,15 +35,15 @@ #define MAX_EXTRUDERS 6 -#if MB(RAMPS_13_EFB) || MB(RAMPS_14_EFB) || MB(RAMPS_PLUS_EFB) || MB(RAMPS_14_RE_ARM_EFB) || MB(RAMPS_SMART_EFB) || MB(RAMPS_DUO_EFB) || MB(RAMPS4DUE_EFB) +#if MB(RAMPS_13_EFB, RAMPS_14_EFB, RAMPS_PLUS_EFB, RAMPS_14_RE_ARM_EFB, RAMPS_SMART_EFB, RAMPS_DUO_EFB, RAMPS4DUE_EFB) #define IS_RAMPS_EFB -#elif MB(RAMPS_13_EEB) || MB(RAMPS_14_EEB) || MB(RAMPS_PLUS_EEB) || MB(RAMPS_14_RE_ARM_EEB) || MB(RAMPS_SMART_EEB) || MB(RAMPS_DUO_EEB) || MB(RAMPS4DUE_EEB) +#elif MB(RAMPS_13_EEB, RAMPS_14_EEB, RAMPS_PLUS_EEB, RAMPS_14_RE_ARM_EEB, RAMPS_SMART_EEB, RAMPS_DUO_EEB, RAMPS4DUE_EEB) #define IS_RAMPS_EEB -#elif MB(RAMPS_13_EFF) || MB(RAMPS_14_EFF) || MB(RAMPS_PLUS_EFF) || MB(RAMPS_14_RE_ARM_EFF) || MB(RAMPS_SMART_EFF) || MB(RAMPS_DUO_EFF) || MB(RAMPS4DUE_EFF) +#elif MB(RAMPS_13_EFF, RAMPS_14_EFF, RAMPS_PLUS_EFF, RAMPS_14_RE_ARM_EFF, RAMPS_SMART_EFF, RAMPS_DUO_EFF, RAMPS4DUE_EFF) #define IS_RAMPS_EFF -#elif MB(RAMPS_13_EEF) || MB(RAMPS_14_EEF) || MB(RAMPS_PLUS_EEF) || MB(RAMPS_14_RE_ARM_EEF) || MB(RAMPS_SMART_EEF) || MB(RAMPS_DUO_EEF) || MB(RAMPS4DUE_EEF) +#elif MB(RAMPS_13_EEF, RAMPS_14_EEF, RAMPS_PLUS_EEF, RAMPS_14_RE_ARM_EEF, RAMPS_SMART_EEF, RAMPS_DUO_EEF, RAMPS4DUE_EEF) #define IS_RAMPS_EEF -#elif MB(RAMPS_13_SF) || MB(RAMPS_14_SF) || MB(RAMPS_PLUS_SF) || MB(RAMPS_14_RE_ARM_SF) || MB(RAMPS_SMART_SF) || MB(RAMPS_DUO_SF) || MB(RAMPS4DUE_SF) +#elif MB(RAMPS_13_SF, RAMPS_14_SF, RAMPS_PLUS_SF, RAMPS_14_RE_ARM_SF, RAMPS_SMART_SF, RAMPS_DUO_SF, RAMPS4DUE_SF) #define IS_RAMPS_SF #endif @@ -185,7 +185,7 @@ #elif MB(RAMBO) #include "rambo/pins_RAMBO.h" // ATmega2560 env:rambo -#elif MB(MINIRAMBO) || MB(MINIRAMBO_10A) +#elif MB(MINIRAMBO, MINIRAMBO_10A) #include "rambo/pins_MINIRAMBO.h" // ATmega2560 env:rambo #elif MB(EINSY_RAMBO) #include "rambo/pins_EINSY_RAMBO.h" // ATmega2560 env:rambo @@ -214,7 +214,7 @@ #include "mega/pins_MEGATRONICS.h" // ATmega2560 env:megaatmega2560 #elif MB(MEGATRONICS_2) #include "mega/pins_MEGATRONICS_2.h" // ATmega2560 env:megaatmega2560 -#elif MB(MEGATRONICS_3) || MB(MEGATRONICS_31) || MB(MEGATRONICS_32) +#elif MB(MEGATRONICS_3, MEGATRONICS_31, MEGATRONICS_32) #include "mega/pins_MEGATRONICS_3.h" // ATmega2560 env:megaatmega2560 #elif MB(ELEFU_3) #include "mega/pins_ELEFU_3.h" // ATmega2560 env:megaatmega2560 diff --git a/Marlin/src/pins/sanguino/pins_MELZI.h b/Marlin/src/pins/sanguino/pins_MELZI.h index 1ccf5ac064..ad0a58509b 100644 --- a/Marlin/src/pins/sanguino/pins_MELZI.h +++ b/Marlin/src/pins/sanguino/pins_MELZI.h @@ -29,5 +29,4 @@ #define BOARD_INFO_NAME "Melzi" #endif -#define IS_MELZI #include "pins_SANGUINOLOLU_12.h" diff --git a/Marlin/src/pins/sanguino/pins_SANGUINOLOLU_11.h b/Marlin/src/pins/sanguino/pins_SANGUINOLOLU_11.h index 0b119a422c..e4fdf69065 100644 --- a/Marlin/src/pins/sanguino/pins_SANGUINOLOLU_11.h +++ b/Marlin/src/pins/sanguino/pins_SANGUINOLOLU_11.h @@ -115,7 +115,7 @@ #endif -#if !defined(FAN_PIN) && (MB(AZTEEG_X1) || MB(STB_11) || ENABLED(IS_MELZI)) +#if !defined(FAN_PIN) && (MB(AZTEEG_X1, STB_11) || IS_MELZI) #define FAN_PIN 4 // Works for Panelolu2 too #endif @@ -132,7 +132,7 @@ //#define SDSS 24 #define SDSS 31 -#if ENABLED(IS_MELZI) +#if IS_MELZI #define LED_PIN 27 #elif MB(STB_11) #define LCD_BACKLIGHT_PIN 17 // LCD backlight LED @@ -160,7 +160,7 @@ #if ENABLED(U8GLIB_ST7920) // SPI GLCD 12864 ST7920 ( like [www.digole.com] ) For Melzi V2.0 - #if ENABLED(IS_MELZI) + #if IS_MELZI #define LCD_PINS_RS 30 // CS chip select /SS chip slave select #define LCD_PINS_ENABLE 29 // SID (MOSI) #define LCD_PINS_D4 17 // SCK (CLK) clock @@ -187,7 +187,7 @@ #define DOGLCD_CS 17 #define LCD_BACKLIGHT_PIN 28 // PA3 - #elif ENABLED(IS_MELZI) + #elif IS_MELZI #define BEEPER_PIN 27 #define DOGLCD_CS 28 @@ -219,7 +219,7 @@ #if ENABLED(LCD_I2C_PANELOLU2) - #if ENABLED(IS_MELZI) + #if IS_MELZI #define BTN_ENC 29 #define LCD_SDSS 30 // Panelolu2 SD card reader rather than the Melzi #else diff --git a/buildroot/share/tests/STM32F103RC_bigtree_USB-tests b/buildroot/share/tests/STM32F103RC_bigtree_USB-tests index 50c37e36de..8c83c029e6 100644 --- a/buildroot/share/tests/STM32F103RC_bigtree_USB-tests +++ b/buildroot/share/tests/STM32F103RC_bigtree_USB-tests @@ -1,6 +1,6 @@ #!/usr/bin/env bash # -# Build tests for STM32F103RC Bigtreetech (SKR Mini v1.1) +# Build tests for STM32F103RC Bigtreetech (SKR Mini E3) # # exit on first failure @@ -10,10 +10,10 @@ set -e # Build with the default configurations # restore_configs -opt_set MOTHERBOARD BOARD_BIGTREE_SKR_MINI_V1_1 +opt_set MOTHERBOARD BOARD_BIGTREE_SKR_MINI_E3 opt_set SERIAL_PORT 1 opt_set SERIAL_PORT_2 -1 -exec_test $1 $2 "Bigtreetech SKR Mini v1.1 - Basic Configuration" +exec_test $1 $2 "Bigtreetech SKR Mini E3 - Basic Configuration" # clean up restore_configs