Fix and improve STM32F1 serial (#19464)

This commit is contained in:
Jason Smith
2020-09-24 18:28:48 -07:00
committed by GitHub
parent 6bb6f7f288
commit da6c8317a7
28 changed files with 1009 additions and 942 deletions

View File

@@ -422,3 +422,37 @@
#if ANY(AUTO_BED_LEVELING_UBL, AUTO_BED_LEVELING_LINEAR, Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS)
#define NEED_LSF 1
#endif
// Flag the indexed serial ports that are in use
#define ANY_SERIAL_IS(N) (defined(SERIAL_PORT) && SERIAL_PORT == (N)) || (defined(SERIAL_PORT_2) && SERIAL_PORT_2 == (N)) || (defined(LCD_SERIAL_PORT) && LCD_SERIAL_PORT == (N))
#if ANY_SERIAL_IS(-1)
#define USING_SERIAL_DEFAULT
#endif
#if ANY_SERIAL_IS(0)
#define USING_SERIAL_0 1
#endif
#if ANY_SERIAL_IS(1)
#define USING_SERIAL_1 1
#endif
#if ANY_SERIAL_IS(2)
#define USING_SERIAL_2 1
#endif
#if ANY_SERIAL_IS(3)
#define USING_SERIAL_3 1
#endif
#if ANY_SERIAL_IS(4)
#define USING_SERIAL_4 1
#endif
#if ANY_SERIAL_IS(5)
#define USING_SERIAL_5 1
#endif
#if ANY_SERIAL_IS(6)
#define USING_SERIAL_6 1
#endif
#if ANY_SERIAL_IS(7)
#define USING_SERIAL_7 1
#endif
#if ANY_SERIAL_IS(8)
#define USING_SERIAL_8 1
#endif
#undef ANY_SERIAL_IS

View File

@@ -477,6 +477,10 @@
#error "HOME_USING_SPREADCYCLE is now obsolete. Please remove it from Configuration_adv.h."
#elif defined(DGUS_LCD)
#error "DGUS_LCD is now DGUS_LCD_UI_(ORIGIN|FYSETC|HIPRECY). Please update your configuration."
#elif defined(DGUS_SERIAL_PORT)
#error "DGUS_SERIAL_PORT is now LCD_SERIAL_PORT. Please update your configuration."
#elif defined(DGUS_BAUDRATE)
#error "DGUS_BAUDRATE is now LCD_BAUDRATE. Please update your configuration."
#elif defined(X_DUAL_ENDSTOPS_ADJUSTMENT)
#error "X_DUAL_ENDSTOPS_ADJUSTMENT is now X2_ENDSTOP_ADJUSTMENT. Please update Configuration_adv.h."
#elif defined(Y_DUAL_ENDSTOPS_ADJUSTMENT)
@@ -2281,31 +2285,20 @@ static_assert(hbm[Z_AXIS] >= 0, "HOMING_BUMP_MM.Z must be greater than or equal
/**
* Serial displays require a dedicated serial port
*/
#if HAS_DGUS_LCD
#ifndef DGUS_SERIAL_PORT
#error "The DGUS LCD requires DGUS_SERIAL_PORT to be defined in Configuration.h"
#elif DGUS_SERIAL_PORT == SERIAL_PORT
#error "DGUS_SERIAL_PORT cannot be the same as SERIAL_PORT. Please update your configuration."
#elif defined(SERIAL_PORT_2) && DGUS_SERIAL_PORT == SERIAL_PORT_2
#error "DGUS_SERIAL_PORT cannot be the same as SERIAL_PORT_2. Please update your configuration."
#endif
#elif ENABLED(MALYAN_LCD)
#ifndef LCD_SERIAL_PORT
#error "MALYAN_LCD requires LCD_SERIAL_PORT to be defined in Configuration.h"
#elif LCD_SERIAL_PORT == SERIAL_PORT
#ifdef LCD_SERIAL_PORT
#if LCD_SERIAL_PORT == SERIAL_PORT
#error "LCD_SERIAL_PORT cannot be the same as SERIAL_PORT. Please update your configuration."
#elif defined(SERIAL_PORT_2) && LCD_SERIAL_PORT == SERIAL_PORT_2
#error "LCD_SERIAL_PORT cannot be the same as SERIAL_PORT_2. Please update your configuration."
#endif
#elif EITHER(ANYCUBIC_LCD_I3MEGA, ANYCUBIC_LCD_CHIRON)
#ifndef ANYCUBIC_LCD_SERIAL_PORT
#error "The ANYCUBIC LCD requires ANYCUBIC_LCD_SERIAL_PORT to be defined in Configuration.h"
#elif ANYCUBIC_LCD_SERIAL_PORT == SERIAL_PORT
#error "ANYCUBIC_LCD_SERIAL_PORT cannot be the same as SERIAL_PORT. Please update your configuration."
#elif defined(SERIAL_PORT_2) && ANYCUBIC_LCD_SERIAL_PORT == SERIAL_PORT_2
#error "ANYCUBIC_LCD_SERIAL_PORT cannot be the same as SERIAL_PORT_2. Please update your configuration."
#else
#if HAS_DGUS_LCD
#error "The DGUS LCD requires LCD_SERIAL_PORT to be defined in Configuration.h"
#elif EITHER(ANYCUBIC_LCD_I3MEGA, ANYCUBIC_LCD_CHIRON)
#error "The ANYCUBIC LCD requires LCD_SERIAL_PORT to be defined in Configuration.h"
#elif ENABLED(MALYAN_LCD)
#error "MALYAN_LCD requires LCD_SERIAL_PORT to be defined in Configuration.h"
#endif
#define ANYCUBIC_LCD_SERIAL anycubicLcdSerial
#endif
/**