From f6f5ed166fd625475c3262a497be66cf58643fbf Mon Sep 17 00:00:00 2001 From: X-Ryl669 Date: Sun, 14 Mar 2021 18:11:11 +0100 Subject: [PATCH] Fix build with Meatpack only on 2nd port (#21336) Co-authored-by: Scott Lahteine --- Marlin/src/HAL/HAL.h | 6 ----- Marlin/src/feature/meatpack.cpp | 1 - Marlin/src/inc/Conditionals_LCD.h | 26 ++++++++++++++----- Marlin/src/inc/Conditionals_adv.h | 7 +++++ Marlin/src/inc/Conditionals_post.h | 13 ---------- .../PlatformIO/scripts/common-dependencies.h | 2 -- 6 files changed, 26 insertions(+), 29 deletions(-) diff --git a/Marlin/src/HAL/HAL.h b/Marlin/src/HAL/HAL.h index 9eefda8fb1..0cd836af2b 100644 --- a/Marlin/src/HAL/HAL.h +++ b/Marlin/src/HAL/HAL.h @@ -29,12 +29,6 @@ #include HAL_PATH(.,HAL.h) -#ifdef SERIAL_PORT_2 - #define NUM_SERIAL 2 -#else - #define NUM_SERIAL 1 -#endif - #define HAL_ADC_RANGE _BV(HAL_ADC_RESOLUTION) #ifndef I2C_ADDRESS diff --git a/Marlin/src/feature/meatpack.cpp b/Marlin/src/feature/meatpack.cpp index 178831c9bb..44567ac482 100644 --- a/Marlin/src/feature/meatpack.cpp +++ b/Marlin/src/feature/meatpack.cpp @@ -42,7 +42,6 @@ #if HAS_MEATPACK #include "meatpack.h" -MeatPack meatpack; #define MeatPack_ProtocolVersion "PV01" //#define MP_DEBUG diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index e5f7441e77..b9b86a7bf3 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -654,13 +654,6 @@ #define UNUSED_E(E) UNUSED(E) #endif -#if ENABLED(DWIN_CREALITY_LCD) - #define SERIAL_CATCHALL 0 - #ifndef LCD_SERIAL_PORT - #define LCD_SERIAL_PORT 3 // Creality 4.x board - #endif -#endif - /** * The BLTouch Probe emulates a servo probe * and uses "special" angles for its state. @@ -950,6 +943,18 @@ #define HAS_CLASSIC_E_JERK 1 #endif +// +// Serial Port Info +// +#ifdef SERIAL_PORT_2 + #define NUM_SERIAL 2 + #define HAS_MULTI_SERIAL 1 +#elif defined(SERIAL_PORT) + #define NUM_SERIAL 1 +#else + #define NUM_SERIAL 0 + #undef BAUD_RATE_GCODE +#endif #if SERIAL_PORT == -1 || SERIAL_PORT_2 == -1 #define HAS_USB_SERIAL 1 #endif @@ -957,6 +962,13 @@ #define HAS_ETHERNET 1 #endif +#if ENABLED(DWIN_CREALITY_LCD) + #define SERIAL_CATCHALL 0 + #ifndef LCD_SERIAL_PORT + #define LCD_SERIAL_PORT 3 // Creality 4.x board + #endif +#endif + // Fallback Stepper Driver types that don't depend on Configuration_adv.h #ifndef X_DRIVER_TYPE #define X_DRIVER_TYPE A4988 diff --git a/Marlin/src/inc/Conditionals_adv.h b/Marlin/src/inc/Conditionals_adv.h index 00b9b1faef..490766bd7a 100644 --- a/Marlin/src/inc/Conditionals_adv.h +++ b/Marlin/src/inc/Conditionals_adv.h @@ -542,3 +542,10 @@ #else #define HAS_USER_ITEM(N) 0 #endif + +#if !HAS_MULTI_SERIAL + #undef MEATPACK_ON_SERIAL_PORT_2 +#endif +#if EITHER(MEATPACK_ON_SERIAL_PORT_1, MEATPACK_ON_SERIAL_PORT_2) + #define HAS_MEATPACK 1 +#endif diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index a6567e9714..fb06a7a3f3 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -2906,16 +2906,3 @@ #if BUTTONS_EXIST(EN1, EN2, ENC) #define HAS_ROTARY_ENCODER 1 #endif - -#if !NUM_SERIAL - #undef BAUD_RATE_GCODE -#elif NUM_SERIAL > 1 - #define HAS_MULTI_SERIAL 1 -#endif - -#if !HAS_MULTI_SERIAL - #undef MEATPACK_ON_SERIAL_PORT_2 -#endif -#if EITHER(MEATPACK_ON_SERIAL_PORT_1, MEATPACK_ON_SERIAL_PORT_2) - #define HAS_MEATPACK 1 -#endif diff --git a/buildroot/share/PlatformIO/scripts/common-dependencies.h b/buildroot/share/PlatformIO/scripts/common-dependencies.h index ed2f46abae..03fae56fdb 100644 --- a/buildroot/share/PlatformIO/scripts/common-dependencies.h +++ b/buildroot/share/PlatformIO/scripts/common-dependencies.h @@ -26,8 +26,6 @@ * Used by common-dependencies.py */ -#define NUM_SERIAL 1 // Normally provided by HAL/HAL.h - #include "../../../../Marlin/src/inc/MarlinConfig.h" //