Skip to content

Commit

Permalink
Fix and improve STM32F1 serial (MarlinFirmware#19464)
Browse files Browse the repository at this point in the history
  • Loading branch information
sjasonsmith authored and thinkyhead committed Apr 29, 2021
1 parent 449a31d commit 9d02ced
Show file tree
Hide file tree
Showing 28 changed files with 947 additions and 880 deletions.
5 changes: 4 additions & 1 deletion Marlin/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -2165,6 +2165,9 @@
// Touch-screen LCD for Malyan M200/M300 printers
//
//#define MALYAN_LCD
#if ENABLED(MALYAN_LCD)
#define LCD_SERIAL_PORT 1 // Default is 1 for Malyan M200
#endif

//
// Touch UI for FTDI EVE (FT800/FT810) displays
Expand All @@ -2178,7 +2181,7 @@
//#define ANYCUBIC_LCD_I3MEGA
//#define ANYCUBIC_LCD_CHIRON
#if EITHER(ANYCUBIC_LCD_I3MEGA, ANYCUBIC_LCD_CHIRON)
#define ANYCUBIC_LCD_SERIAL_PORT 3
#define LCD_SERIAL_PORT 3 // Default is 3 for Anycubic
//#define ANYCUBIC_LCD_DEBUG
#endif

Expand Down
10 changes: 5 additions & 5 deletions Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -1404,8 +1404,8 @@
// Additional options for DGUS / DWIN displays
//
#if HAS_DGUS_LCD
#define DGUS_SERIAL_PORT 3
#define DGUS_BAUDRATE 115200
#define LCD_SERIAL_PORT 3
#define LCD_BAUDRATE 115200

#define DGUS_RX_BUFFER_SIZE 128
#define DGUS_TX_BUFFER_SIZE 48
Expand Down Expand Up @@ -3419,10 +3419,10 @@
#if ENABLED(PRUSA_MMU2)

// Serial port used for communication with MMU2.
// For AVR enable the UART port used for the MMU. (e.g., internalSerial)
// For AVR enable the UART port used for the MMU. (e.g., mmuSerial)
// For 32-bit boards check your HAL for available serial ports. (e.g., Serial2)
#define INTERNAL_SERIAL_PORT 2
#define MMU2_SERIAL internalSerial
#define MMU2_SERIAL_PORT 2
#define MMU2_SERIAL mmuSerial

// Use hardware reset for MMU if a pin is defined for it
//#define MMU2_RST_PIN 23
Expand Down
17 changes: 6 additions & 11 deletions Marlin/src/HAL/AVR/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,19 +96,14 @@ typedef int8_t pin_t;
#endif
#endif

#ifdef DGUS_SERIAL_PORT
#if !WITHIN(DGUS_SERIAL_PORT, -1, 3)
#error "DGUS_SERIAL_PORT must be from -1 to 3. Please update your configuration."
#ifdef LCD_SERIAL_PORT
#if !WITHIN(LCD_SERIAL_PORT, -1, 3)
#error "LCD_SERIAL_PORT must be from -1 to 3. Please update your configuration."
#endif
#define DGUS_SERIAL internalDgusSerial
#define DGUS_SERIAL_GET_TX_BUFFER_FREE DGUS_SERIAL.get_tx_buffer_free
#endif

#ifdef ANYCUBIC_LCD_SERIAL_PORT
#if !WITHIN(ANYCUBIC_LCD_SERIAL_PORT, -1, 3)
#error "ANYCUBIC_LCD_SERIAL_PORT must be from -1 to 3. Please update your configuration."
#define LCD_SERIAL lcdSerial
#if HAS_DGUS_LCD
#define SERIAL_GET_TX_BUFFER_FREE() LCD_SERIAL.get_tx_buffer_free()
#endif
#define ANYCUBIC_LCD_SERIAL anycubicLcdSerial
#endif

// ------------------------
Expand Down
Loading

0 comments on commit 9d02ced

Please sign in to comment.