Browse Source

HAL and serial cleanup

Co-Authored-By: Jason Smith <20053467+sjasonsmith@users.noreply.github.com>
Scott Lahteine 3 years ago
parent
commit
4b928b2da8
33 changed files with 220 additions and 420 deletions
  1. 1
    20
      Marlin/src/HAL/AVR/HAL.h
  2. 10
    10
      Marlin/src/HAL/AVR/MarlinSerial.cpp
  3. 3
    3
      Marlin/src/HAL/AVR/MarlinSerial.h
  4. 12
    35
      Marlin/src/HAL/DUE/HAL.h
  5. 0
    3
      Marlin/src/HAL/ESP32/HAL.h
  6. 6
    0
      Marlin/src/HAL/HAL.h
  7. 0
    1
      Marlin/src/HAL/LINUX/HAL.h
  8. 1
    1
      Marlin/src/HAL/LINUX/main.cpp
  9. 12
    35
      Marlin/src/HAL/LPC1768/HAL.h
  10. 25
    12
      Marlin/src/HAL/LPC1768/inc/SanityCheck.h
  11. 11
    35
      Marlin/src/HAL/SAMD51/HAL.h
  12. 23
    58
      Marlin/src/HAL/STM32/HAL.h
  13. 1
    1
      Marlin/src/HAL/STM32/pinsDebug_STM32GENERIC.h
  14. 1
    4
      Marlin/src/HAL/STM32F1/HAL.h
  15. 1
    0
      Marlin/src/HAL/STM32F1/MarlinSerial.h
  16. 1
    1
      Marlin/src/HAL/STM32F1/sdio.cpp
  17. 10
    51
      Marlin/src/HAL/STM32_F4_F7/HAL.h
  18. 5
    9
      Marlin/src/HAL/TEENSY31_32/HAL.h
  19. 5
    9
      Marlin/src/HAL/TEENSY35_36/HAL.h
  20. 9
    42
      Marlin/src/HAL/TEENSY40_41/HAL.h
  21. 8
    10
      Marlin/src/MarlinCore.cpp
  22. 3
    16
      Marlin/src/gcode/config/M575.cpp
  23. 34
    6
      Marlin/src/inc/SanityCheck.h
  24. 1
    5
      Marlin/src/lcd/extui/malyan_lcd.cpp
  25. 4
    4
      Marlin/src/pins/stm32f1/pins_BTT_SKR_E3_DIP.h
  26. 4
    4
      Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_V1_0.h
  27. 4
    4
      Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_V2_0.h
  28. 4
    4
      Marlin/src/pins/stm32f1/pins_FYSETC_AIO_II.h
  29. 5
    11
      Marlin/src/pins/stm32f1/pins_MKS_ROBIN.h
  30. 4
    4
      Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_common.h
  31. 5
    11
      Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h
  32. 6
    11
      Marlin/src/pins/stm32f1/pins_MKS_ROBIN_PRO.h
  33. 1
    0
      buildroot/tests/malyan_M300-tests

+ 1
- 20
Marlin/src/HAL/AVR/HAL.h View File

81
 
81
 
82
 // Serial ports
82
 // Serial ports
83
 #ifdef USBCON
83
 #ifdef USBCON
84
-  #if ENABLED(BLUETOOTH)
85
-    #define MYSERIAL0 bluetoothSerial
86
-  #else
87
-    #define MYSERIAL0 Serial
88
-  #endif
89
-  #define NUM_SERIAL 1
84
+  #define MYSERIAL0 TERN(BLUETOOTH, bluetoothSerial, Serial)
90
 #else
85
 #else
91
   #if !WITHIN(SERIAL_PORT, -1, 3)
86
   #if !WITHIN(SERIAL_PORT, -1, 3)
92
     #error "SERIAL_PORT must be from -1 to 3. Please update your configuration."
87
     #error "SERIAL_PORT must be from -1 to 3. Please update your configuration."
97
   #ifdef SERIAL_PORT_2
92
   #ifdef SERIAL_PORT_2
98
     #if !WITHIN(SERIAL_PORT_2, -1, 3)
93
     #if !WITHIN(SERIAL_PORT_2, -1, 3)
99
       #error "SERIAL_PORT_2 must be from -1 to 3. Please update your configuration."
94
       #error "SERIAL_PORT_2 must be from -1 to 3. Please update your configuration."
100
-    #elif SERIAL_PORT_2 == SERIAL_PORT
101
-      #error "SERIAL_PORT_2 must be different than SERIAL_PORT. Please update your configuration."
102
     #endif
95
     #endif
103
     #define MYSERIAL1 customizedSerial2
96
     #define MYSERIAL1 customizedSerial2
104
-    #define NUM_SERIAL 2
105
-  #else
106
-    #define NUM_SERIAL 1
107
   #endif
97
   #endif
108
 #endif
98
 #endif
109
 
99
 
110
 #ifdef DGUS_SERIAL_PORT
100
 #ifdef DGUS_SERIAL_PORT
111
   #if !WITHIN(DGUS_SERIAL_PORT, -1, 3)
101
   #if !WITHIN(DGUS_SERIAL_PORT, -1, 3)
112
     #error "DGUS_SERIAL_PORT must be from -1 to 3. Please update your configuration."
102
     #error "DGUS_SERIAL_PORT must be from -1 to 3. Please update your configuration."
113
-  #elif DGUS_SERIAL_PORT == SERIAL_PORT
114
-    #error "DGUS_SERIAL_PORT must be different than SERIAL_PORT. Please update your configuration."
115
-  #elif defined(SERIAL_PORT_2) && DGUS_SERIAL_PORT == SERIAL_PORT_2
116
-    #error "DGUS_SERIAL_PORT must be different than SERIAL_PORT_2. Please update your configuration."
117
   #endif
103
   #endif
118
   #define DGUS_SERIAL internalDgusSerial
104
   #define DGUS_SERIAL internalDgusSerial
119
-
120
   #define DGUS_SERIAL_GET_TX_BUFFER_FREE DGUS_SERIAL.get_tx_buffer_free
105
   #define DGUS_SERIAL_GET_TX_BUFFER_FREE DGUS_SERIAL.get_tx_buffer_free
121
 #endif
106
 #endif
122
 
107
 
123
 #ifdef ANYCUBIC_LCD_SERIAL_PORT
108
 #ifdef ANYCUBIC_LCD_SERIAL_PORT
124
   #if !WITHIN(ANYCUBIC_LCD_SERIAL_PORT, -1, 3)
109
   #if !WITHIN(ANYCUBIC_LCD_SERIAL_PORT, -1, 3)
125
     #error "ANYCUBIC_LCD_SERIAL_PORT must be from -1 to 3. Please update your configuration."
110
     #error "ANYCUBIC_LCD_SERIAL_PORT must be from -1 to 3. Please update your configuration."
126
-  #elif ANYCUBIC_LCD_SERIAL_PORT == SERIAL_PORT
127
-    #error "ANYCUBIC_LCD_SERIAL_PORT must be different than SERIAL_PORT. Please update your configuration."
128
-  #elif defined(SERIAL_PORT_2) && ANYCUBIC_LCD_SERIAL_PORT == SERIAL_PORT_2
129
-    #error "ANYCUBIC_LCD_SERIAL_PORT must be different than SERIAL_PORT_2. Please update your configuration."
130
   #endif
111
   #endif
131
   #define ANYCUBIC_LCD_SERIAL anycubicLcdSerial
112
   #define ANYCUBIC_LCD_SERIAL anycubicLcdSerial
132
 #endif
113
 #endif

+ 10
- 10
Marlin/src/HAL/AVR/MarlinSerial.cpp View File

712
   }
712
   }
713
 
713
 
714
   // Hookup ISR handlers
714
   // Hookup ISR handlers
715
-  ISR(SERIAL_REGNAME(USART,SERIAL_PORT,_RX_vect)) {
715
+  ISR(SERIAL_REGNAME(USART, SERIAL_PORT, _RX_vect)) {
716
     MarlinSerial<MarlinSerialCfg<SERIAL_PORT>>::store_rxd_char();
716
     MarlinSerial<MarlinSerialCfg<SERIAL_PORT>>::store_rxd_char();
717
   }
717
   }
718
 
718
 
719
-  ISR(SERIAL_REGNAME(USART,SERIAL_PORT,_UDRE_vect)) {
719
+  ISR(SERIAL_REGNAME(USART, SERIAL_PORT, _UDRE_vect)) {
720
     MarlinSerial<MarlinSerialCfg<SERIAL_PORT>>::_tx_udr_empty_irq();
720
     MarlinSerial<MarlinSerialCfg<SERIAL_PORT>>::_tx_udr_empty_irq();
721
   }
721
   }
722
 
722
 
729
   #ifdef SERIAL_PORT_2
729
   #ifdef SERIAL_PORT_2
730
 
730
 
731
     // Hookup ISR handlers
731
     // Hookup ISR handlers
732
-    ISR(SERIAL_REGNAME(USART,SERIAL_PORT_2,_RX_vect)) {
732
+    ISR(SERIAL_REGNAME(USART, SERIAL_PORT_2, _RX_vect)) {
733
       MarlinSerial<MarlinSerialCfg<SERIAL_PORT_2>>::store_rxd_char();
733
       MarlinSerial<MarlinSerialCfg<SERIAL_PORT_2>>::store_rxd_char();
734
     }
734
     }
735
 
735
 
736
-    ISR(SERIAL_REGNAME(USART,SERIAL_PORT_2,_UDRE_vect)) {
736
+    ISR(SERIAL_REGNAME(USART, SERIAL_PORT_2, _UDRE_vect)) {
737
       MarlinSerial<MarlinSerialCfg<SERIAL_PORT_2>>::_tx_udr_empty_irq();
737
       MarlinSerial<MarlinSerialCfg<SERIAL_PORT_2>>::_tx_udr_empty_irq();
738
     }
738
     }
739
 
739
 
749
 
749
 
750
 #ifdef INTERNAL_SERIAL_PORT
750
 #ifdef INTERNAL_SERIAL_PORT
751
 
751
 
752
-  ISR(SERIAL_REGNAME(USART,INTERNAL_SERIAL_PORT,_RX_vect)) {
752
+  ISR(SERIAL_REGNAME(USART, INTERNAL_SERIAL_PORT, _RX_vect)) {
753
     MarlinSerial<MarlinInternalSerialCfg<INTERNAL_SERIAL_PORT>>::store_rxd_char();
753
     MarlinSerial<MarlinInternalSerialCfg<INTERNAL_SERIAL_PORT>>::store_rxd_char();
754
   }
754
   }
755
 
755
 
756
-  ISR(SERIAL_REGNAME(USART,INTERNAL_SERIAL_PORT,_UDRE_vect)) {
756
+  ISR(SERIAL_REGNAME(USART, INTERNAL_SERIAL_PORT, _UDRE_vect)) {
757
     MarlinSerial<MarlinInternalSerialCfg<INTERNAL_SERIAL_PORT>>::_tx_udr_empty_irq();
757
     MarlinSerial<MarlinInternalSerialCfg<INTERNAL_SERIAL_PORT>>::_tx_udr_empty_irq();
758
   }
758
   }
759
 
759
 
776
     return ret;
776
     return ret;
777
   }
777
   }
778
 
778
 
779
-  ISR(SERIAL_REGNAME(USART,DGUS_SERIAL_PORT,_RX_vect)) {
779
+  ISR(SERIAL_REGNAME(USART, DGUS_SERIAL_PORT, _RX_vect)) {
780
     MarlinSerial<MarlinInternalSerialCfg<DGUS_SERIAL_PORT>>::store_rxd_char();
780
     MarlinSerial<MarlinInternalSerialCfg<DGUS_SERIAL_PORT>>::store_rxd_char();
781
   }
781
   }
782
 
782
 
783
-  ISR(SERIAL_REGNAME(USART,DGUS_SERIAL_PORT,_UDRE_vect)) {
783
+  ISR(SERIAL_REGNAME(USART, DGUS_SERIAL_PORT, _UDRE_vect)) {
784
     MarlinSerial<MarlinInternalSerialCfg<DGUS_SERIAL_PORT>>::_tx_udr_empty_irq();
784
     MarlinSerial<MarlinInternalSerialCfg<DGUS_SERIAL_PORT>>::_tx_udr_empty_irq();
785
   }
785
   }
786
 
786
 
794
 
794
 
795
 #ifdef ANYCUBIC_LCD_SERIAL_PORT
795
 #ifdef ANYCUBIC_LCD_SERIAL_PORT
796
 
796
 
797
-  ISR(SERIAL_REGNAME(USART,ANYCUBIC_LCD_SERIAL_PORT,_RX_vect)) {
797
+  ISR(SERIAL_REGNAME(USART, ANYCUBIC_LCD_SERIAL_PORT, _RX_vect)) {
798
     MarlinSerial<AnycubicLcdSerialCfg<ANYCUBIC_LCD_SERIAL_PORT>>::store_rxd_char();
798
     MarlinSerial<AnycubicLcdSerialCfg<ANYCUBIC_LCD_SERIAL_PORT>>::store_rxd_char();
799
   }
799
   }
800
 
800
 
801
-  ISR(SERIAL_REGNAME(USART,ANYCUBIC_LCD_SERIAL_PORT,_UDRE_vect)) {
801
+  ISR(SERIAL_REGNAME(USART, ANYCUBIC_LCD_SERIAL_PORT, _UDRE_vect)) {
802
     MarlinSerial<AnycubicLcdSerialCfg<ANYCUBIC_LCD_SERIAL_PORT>>::_tx_udr_empty_irq();
802
     MarlinSerial<AnycubicLcdSerialCfg<ANYCUBIC_LCD_SERIAL_PORT>>::_tx_udr_empty_irq();
803
   }
803
   }
804
 
804
 

+ 3
- 3
Marlin/src/HAL/AVR/MarlinSerial.h View File

48
 
48
 
49
   // These are macros to build serial port register names for the selected SERIAL_PORT (C preprocessor
49
   // These are macros to build serial port register names for the selected SERIAL_PORT (C preprocessor
50
   // requires two levels of indirection to expand macro values properly)
50
   // requires two levels of indirection to expand macro values properly)
51
-  #define SERIAL_REGNAME(registerbase,number,suffix) SERIAL_REGNAME_INTERNAL(registerbase,number,suffix)
51
+  #define SERIAL_REGNAME(registerbase,number,suffix) _SERIAL_REGNAME(registerbase,number,suffix)
52
   #if SERIAL_PORT == 0 && (!defined(UBRR0H) || !defined(UDR0)) // use un-numbered registers if necessary
52
   #if SERIAL_PORT == 0 && (!defined(UBRR0H) || !defined(UDR0)) // use un-numbered registers if necessary
53
-    #define SERIAL_REGNAME_INTERNAL(registerbase,number,suffix) registerbase##suffix
53
+    #define _SERIAL_REGNAME(registerbase,number,suffix) registerbase##suffix
54
   #else
54
   #else
55
-    #define SERIAL_REGNAME_INTERNAL(registerbase,number,suffix) registerbase##number##suffix
55
+    #define _SERIAL_REGNAME(registerbase,number,suffix) registerbase##number##suffix
56
   #endif
56
   #endif
57
 
57
 
58
   // Registers used by MarlinSerial class (expanded depending on selected serial port)
58
   // Registers used by MarlinSerial class (expanded depending on selected serial port)

+ 12
- 35
Marlin/src/HAL/DUE/HAL.h View File

38
 
38
 
39
 #include <stdint.h>
39
 #include <stdint.h>
40
 
40
 
41
+#define _MSERIAL(X) Serial##X
42
+#define MSERIAL(X) _MSERIAL(X)
43
+#define Serial0 Serial
44
+
41
 // Define MYSERIAL0/1 before MarlinSerial includes!
45
 // Define MYSERIAL0/1 before MarlinSerial includes!
42
 #if SERIAL_PORT == -1 || ENABLED(EMERGENCY_PARSER)
46
 #if SERIAL_PORT == -1 || ENABLED(EMERGENCY_PARSER)
43
   #define MYSERIAL0 customizedSerial1
47
   #define MYSERIAL0 customizedSerial1
44
-#elif SERIAL_PORT == 0
45
-  #define MYSERIAL0 Serial
46
-#elif SERIAL_PORT == 1
47
-  #define MYSERIAL0 Serial1
48
-#elif SERIAL_PORT == 2
49
-  #define MYSERIAL0 Serial2
50
-#elif SERIAL_PORT == 3
51
-  #define MYSERIAL0 Serial3
48
+#elif WITHIN(SERIAL_PORT, 0, 3)
49
+  #define MYSERIAL0 MSERIAL(SERIAL_PORT)
52
 #else
50
 #else
53
   #error "The required SERIAL_PORT must be from -1 to 3. Please update your configuration."
51
   #error "The required SERIAL_PORT must be from -1 to 3. Please update your configuration."
54
 #endif
52
 #endif
55
 
53
 
56
 #ifdef SERIAL_PORT_2
54
 #ifdef SERIAL_PORT_2
57
-  #if SERIAL_PORT_2 == SERIAL_PORT
58
-    #error "SERIAL_PORT_2 must be different from SERIAL_PORT. Please update your configuration."
59
-  #elif SERIAL_PORT_2 == -1 || ENABLED(EMERGENCY_PARSER)
55
+  #if SERIAL_PORT_2 == -1 || ENABLED(EMERGENCY_PARSER)
60
     #define MYSERIAL1 customizedSerial2
56
     #define MYSERIAL1 customizedSerial2
61
-  #elif SERIAL_PORT_2 == 0
62
-    #define MYSERIAL1 Serial
63
-  #elif SERIAL_PORT_2 == 1
64
-    #define MYSERIAL1 Serial1
65
-  #elif SERIAL_PORT_2 == 2
66
-    #define MYSERIAL1 Serial2
67
-  #elif SERIAL_PORT_2 == 3
68
-    #define MYSERIAL1 Serial3
57
+  #elif WITHIN(SERIAL_PORT_2, 0, 3)
58
+    #define MYSERIAL1 MSERIAL(SERIAL_PORT_2)
69
   #else
59
   #else
70
     #error "SERIAL_PORT_2 must be from -1 to 3. Please update your configuration."
60
     #error "SERIAL_PORT_2 must be from -1 to 3. Please update your configuration."
71
   #endif
61
   #endif
72
-  #define NUM_SERIAL 2
73
-#else
74
-  #define NUM_SERIAL 1
75
 #endif
62
 #endif
76
 
63
 
77
 #ifdef DGUS_SERIAL_PORT
64
 #ifdef DGUS_SERIAL_PORT
78
-  #if DGUS_SERIAL_PORT == SERIAL_PORT
79
-    #error "DGUS_SERIAL_PORT must be different from SERIAL_PORT. Please update your configuration."
80
-  #elif defined(SERIAL_PORT_2) && DGUS_SERIAL_PORT == SERIAL_PORT_2
81
-    #error "DGUS_SERIAL_PORT must be different than SERIAL_PORT_2. Please update your configuration."
82
-  #elif DGUS_SERIAL_PORT == -1
65
+  #if DGUS_SERIAL_PORT == -1
83
     #define DGUS_SERIAL internalDgusSerial
66
     #define DGUS_SERIAL internalDgusSerial
84
-  #elif DGUS_SERIAL_PORT == 0
85
-    #define DGUS_SERIAL Serial
86
-  #elif DGUS_SERIAL_PORT == 1
87
-    #define DGUS_SERIAL Serial1
88
-  #elif DGUS_SERIAL_PORT == 2
89
-    #define DGUS_SERIAL Serial2
90
-  #elif DGUS_SERIAL_PORT == 3
91
-    #define DGUS_SERIAL Serial3
67
+  #elif WITHIN(DGUS_SERIAL_PORT, 0, 3)
68
+    #define DGUS_SERIAL MSERIAL(DGUS_SERIAL_PORT)
92
   #else
69
   #else
93
     #error "DGUS_SERIAL_PORT must be from -1 to 3. Please update your configuration."
70
     #error "DGUS_SERIAL_PORT must be from -1 to 3. Please update your configuration."
94
   #endif
71
   #endif

+ 0
- 3
Marlin/src/HAL/ESP32/HAL.h View File

58
   #else
58
   #else
59
     #define MYSERIAL1 webSocketSerial
59
     #define MYSERIAL1 webSocketSerial
60
   #endif
60
   #endif
61
-  #define NUM_SERIAL 2
62
-#else
63
-  #define NUM_SERIAL 1
64
 #endif
61
 #endif
65
 
62
 
66
 #define CRITICAL_SECTION_START() portENTER_CRITICAL(&spinlock)
63
 #define CRITICAL_SECTION_START() portENTER_CRITICAL(&spinlock)

+ 6
- 0
Marlin/src/HAL/HAL.h View File

25
 
25
 
26
 #include HAL_PATH(.,HAL.h)
26
 #include HAL_PATH(.,HAL.h)
27
 
27
 
28
+#ifdef SERIAL_PORT_2
29
+  #define NUM_SERIAL 2
30
+#else
31
+  #define NUM_SERIAL 1
32
+#endif
33
+
28
 #define HAL_ADC_RANGE _BV(HAL_ADC_RESOLUTION)
34
 #define HAL_ADC_RANGE _BV(HAL_ADC_RESOLUTION)
29
 
35
 
30
 #ifndef I2C_ADDRESS
36
 #ifndef I2C_ADDRESS

+ 0
- 1
Marlin/src/HAL/LINUX/HAL.h View File

62
 
62
 
63
 extern HalSerial usb_serial;
63
 extern HalSerial usb_serial;
64
 #define MYSERIAL0 usb_serial
64
 #define MYSERIAL0 usb_serial
65
-#define NUM_SERIAL 1
66
 
65
 
67
 #define ST7920_DELAY_1 DELAY_NS(600)
66
 #define ST7920_DELAY_1 DELAY_NS(600)
68
 #define ST7920_DELAY_2 DELAY_NS(750)
67
 #define ST7920_DELAY_2 DELAY_NS(750)

+ 1
- 1
Marlin/src/HAL/LINUX/main.cpp View File

107
   std::thread write_serial (write_serial_thread);
107
   std::thread write_serial (write_serial_thread);
108
   std::thread read_serial (read_serial_thread);
108
   std::thread read_serial (read_serial_thread);
109
 
109
 
110
-  #if NUM_SERIAL > 0
110
+  #ifdef MYSERIAL0
111
     MYSERIAL0.begin(BAUDRATE);
111
     MYSERIAL0.begin(BAUDRATE);
112
     SERIAL_ECHOLNPGM("x86_64 Initialized");
112
     SERIAL_ECHOLNPGM("x86_64 Initialized");
113
     SERIAL_FLUSHTX();
113
     SERIAL_FLUSHTX();

+ 12
- 35
Marlin/src/HAL/LPC1768/HAL.h View File

63
   #define ST7920_DELAY_3 DELAY_NS(750)
63
   #define ST7920_DELAY_3 DELAY_NS(750)
64
 #endif
64
 #endif
65
 
65
 
66
+#define _MSERIAL(X) MSerial##X
67
+#define MSERIAL(X) _MSERIAL(X)
68
+#define MSerial0 MSerial
69
+
66
 #if SERIAL_PORT == -1
70
 #if SERIAL_PORT == -1
67
   #define MYSERIAL0 UsbSerial
71
   #define MYSERIAL0 UsbSerial
68
-#elif SERIAL_PORT == 0
69
-  #define MYSERIAL0 MSerial
70
-#elif SERIAL_PORT == 1
71
-  #define MYSERIAL0 MSerial1
72
-#elif SERIAL_PORT == 2
73
-  #define MYSERIAL0 MSerial2
74
-#elif SERIAL_PORT == 3
75
-  #define MYSERIAL0 MSerial3
72
+#elif WITHIN(SERIAL_PORT, 0, 3)
73
+  #define MYSERIAL0 MSERIAL(SERIAL_PORT)
76
 #else
74
 #else
77
   #error "SERIAL_PORT must be from -1 to 3. Please update your configuration."
75
   #error "SERIAL_PORT must be from -1 to 3. Please update your configuration."
78
 #endif
76
 #endif
79
 
77
 
80
 #ifdef SERIAL_PORT_2
78
 #ifdef SERIAL_PORT_2
81
-  #if SERIAL_PORT_2 == SERIAL_PORT
82
-    #error "SERIAL_PORT_2 must be different than SERIAL_PORT. Please update your configuration."
83
-  #elif SERIAL_PORT_2 == -1
79
+  #if SERIAL_PORT_2 == -1
84
     #define MYSERIAL1 UsbSerial
80
     #define MYSERIAL1 UsbSerial
85
-  #elif SERIAL_PORT_2 == 0
86
-    #define MYSERIAL1 MSerial
87
-  #elif SERIAL_PORT_2 == 1
88
-    #define MYSERIAL1 MSerial1
89
-  #elif SERIAL_PORT_2 == 2
90
-    #define MYSERIAL1 MSerial2
91
-  #elif SERIAL_PORT_2 == 3
92
-    #define MYSERIAL1 MSerial3
81
+  #elif WITHIN(SERIAL_PORT_2, 0, 3)
82
+    #define MYSERIAL1 MSERIAL(SERIAL_PORT_2)
93
   #else
83
   #else
94
     #error "SERIAL_PORT_2 must be from -1 to 3. Please update your configuration."
84
     #error "SERIAL_PORT_2 must be from -1 to 3. Please update your configuration."
95
   #endif
85
   #endif
96
-  #define NUM_SERIAL 2
97
-#else
98
-  #define NUM_SERIAL 1
99
 #endif
86
 #endif
100
 
87
 
101
 #ifdef DGUS_SERIAL_PORT
88
 #ifdef DGUS_SERIAL_PORT
102
-  #if DGUS_SERIAL_PORT == SERIAL_PORT
103
-    #error "DGUS_SERIAL_PORT must be different than SERIAL_PORT. Please update your configuration."
104
-  #elif defined(SERIAL_PORT_2) && DGUS_SERIAL_PORT == SERIAL_PORT_2
105
-    #error "DGUS_SERIAL_PORT must be different than SERIAL_PORT_2. Please update your configuration."
106
-  #elif DGUS_SERIAL_PORT == -1
89
+  #if DGUS_SERIAL_PORT == -1
107
     #define DGUS_SERIAL UsbSerial
90
     #define DGUS_SERIAL UsbSerial
108
-  #elif DGUS_SERIAL_PORT == 0
109
-    #define DGUS_SERIAL MSerial
110
-  #elif DGUS_SERIAL_PORT == 1
111
-    #define DGUS_SERIAL MSerial1
112
-  #elif DGUS_SERIAL_PORT == 2
113
-    #define DGUS_SERIAL MSerial2
114
-  #elif DGUS_SERIAL_PORT == 3
115
-    #define DGUS_SERIAL MSerial3
91
+  #elif WITHIN(DGUS_SERIAL_PORT, 0, 3)
92
+    #define DGUS_SERIAL MSERIAL(DGUS_SERIAL_PORT)
116
   #else
93
   #else
117
     #error "DGUS_SERIAL_PORT must be from -1 to 3. Please update your configuration."
94
     #error "DGUS_SERIAL_PORT must be from -1 to 3. Please update your configuration."
118
   #endif
95
   #endif

+ 25
- 12
Marlin/src/HAL/LPC1768/inc/SanityCheck.h View File

89
  * Serial2 | P0_10 | P0_11 |
89
  * Serial2 | P0_10 | P0_11 |
90
  * Serial3 | P0_00 | P0_01 |
90
  * Serial3 | P0_00 | P0_01 |
91
  */
91
  */
92
+#define ANY_TX(N,V...) DO(IS_TX##N,||,V)
93
+#define ANY_RX(N,V...) DO(IS_RX##N,||,V)
94
+
92
 #if (defined(SERIAL_PORT) && SERIAL_PORT == 0) || (defined(SERIAL_PORT_2) && SERIAL_PORT_2 == 0) || (defined(DGUS_SERIAL_PORT) && DGUS_SERIAL_PORT == 0)
95
 #if (defined(SERIAL_PORT) && SERIAL_PORT == 0) || (defined(SERIAL_PORT_2) && SERIAL_PORT_2 == 0) || (defined(DGUS_SERIAL_PORT) && DGUS_SERIAL_PORT == 0)
93
   #define IS_TX0(P) (P == P0_02)
96
   #define IS_TX0(P) (P == P0_02)
94
   #define IS_RX0(P) (P == P0_03)
97
   #define IS_RX0(P) (P == P0_03)
106
 #if SERIAL_PORT == 1 || SERIAL_PORT_2 == 1 || DGUS_SERIAL_PORT == 1
109
 #if SERIAL_PORT == 1 || SERIAL_PORT_2 == 1 || DGUS_SERIAL_PORT == 1
107
   #define IS_TX1(P) (P == P0_15)
110
   #define IS_TX1(P) (P == P0_15)
108
   #define IS_RX1(P) (P == P0_16)
111
   #define IS_RX1(P) (P == P0_16)
112
+  #define _IS_TX1_1 IS_TX1
113
+  #define _IS_RX1_1 IS_RX1
109
   #if IS_TX1(TMC_SW_SCK)
114
   #if IS_TX1(TMC_SW_SCK)
110
     #error "Serial port pins (1) conflict with other pins!"
115
     #error "Serial port pins (1) conflict with other pins!"
111
   #elif HAS_SPI_LCD
116
   #elif HAS_SPI_LCD
112
     #if IS_TX1(BTN_EN2) || IS_RX1(BTN_EN1)
117
     #if IS_TX1(BTN_EN2) || IS_RX1(BTN_EN1)
113
       #error "Serial port pins (1) conflict with Encoder Buttons!"
118
       #error "Serial port pins (1) conflict with Encoder Buttons!"
114
-    #elif IS_TX1(SCK_PIN) || IS_TX1(LCD_PINS_D4) || IS_TX1(DOGLCD_SCK) || IS_TX1(LCD_RESET_PIN) || IS_TX1(LCD_PINS_RS) || IS_TX1(SHIFT_CLK) \
115
-      || IS_RX1(LCD_SDSS) || IS_RX1(LCD_PINS_RS) || IS_RX1(MISO_PIN) || IS_RX1(DOGLCD_A0) || IS_RX1(SS_PIN) || IS_RX1(LCD_SDSS) || IS_RX1(DOGLCD_CS) || IS_RX1(LCD_RESET_PIN) || IS_RX1(LCD_BACKLIGHT_PIN)
119
+    #elif ANY_TX(1, SCK_PIN, LCD_PINS_D4, DOGLCD_SCK, LCD_RESET_PIN, LCD_PINS_RS, SHIFT_CLK) \
120
+       || ANY_RX(1, LCD_SDSS, LCD_PINS_RS, MISO_PIN, DOGLCD_A0, SS_PIN, LCD_SDSS, DOGLCD_CS, LCD_RESET_PIN, LCD_BACKLIGHT_PIN)
116
       #error "Serial port pins (1) conflict with LCD pins!"
121
       #error "Serial port pins (1) conflict with LCD pins!"
117
     #endif
122
     #endif
118
   #endif
123
   #endif
119
   #undef IS_TX1
124
   #undef IS_TX1
120
   #undef IS_RX1
125
   #undef IS_RX1
126
+  #undef _IS_TX1_1
127
+  #undef _IS_RX1_1
121
 #endif
128
 #endif
122
 
129
 
123
 #if SERIAL_PORT == 2 || SERIAL_PORT_2 == 2 || DGUS_SERIAL_PORT == 2
130
 #if SERIAL_PORT == 2 || SERIAL_PORT_2 == 2 || DGUS_SERIAL_PORT == 2
124
   #define IS_TX2(P) (P == P0_10)
131
   #define IS_TX2(P) (P == P0_10)
125
   #define IS_RX2(P) (P == P0_11)
132
   #define IS_RX2(P) (P == P0_11)
126
-  #if  IS_TX2(X2_ENABLE_PIN) || IS_RX2(X2_DIR_PIN) || IS_RX2(X2_STEP_PIN) || (AXIS_HAS_SPI(X2) && IS_TX2(X2_CS_PIN))
133
+  #define _IS_TX2_1 IS_TX2
134
+  #define _IS_RX2_1 IS_RX2
135
+  #if IS_TX2(X2_ENABLE_PIN) || ANY_RX(2, X2_DIR_PIN, X2_STEP_PIN) || (AXIS_HAS_SPI(X2) && IS_TX2(X2_CS_PIN))
127
     #error "Serial port pins (2) conflict with X2 pins!"
136
     #error "Serial port pins (2) conflict with X2 pins!"
128
-  #elif IS_TX2(Y2_ENABLE_PIN) || IS_RX2(Y2_DIR_PIN) || IS_RX2(Y2_STEP_PIN) || (AXIS_HAS_SPI(Y2) && IS_TX2(Y2_CS_PIN))
137
+  #elif IS_TX2(Y2_ENABLE_PIN) || ANY_RX(2, Y2_DIR_PIN, Y2_STEP_PIN) || (AXIS_HAS_SPI(Y2) && IS_TX2(Y2_CS_PIN))
129
     #error "Serial port pins (2) conflict with Y2 pins!"
138
     #error "Serial port pins (2) conflict with Y2 pins!"
130
-  #elif IS_TX2(Z2_ENABLE_PIN) || IS_RX2(Z2_DIR_PIN) || IS_RX2(Z2_STEP_PIN) || (AXIS_HAS_SPI(Z2) && IS_TX2(Z2_CS_PIN))
139
+  #elif IS_TX2(Z2_ENABLE_PIN) || ANY_RX(2, Z2_DIR_PIN, Z2_STEP_PIN) || (AXIS_HAS_SPI(Z2) && IS_TX2(Z2_CS_PIN))
131
     #error "Serial port pins (2) conflict with Z2 pins!"
140
     #error "Serial port pins (2) conflict with Z2 pins!"
132
-  #elif IS_TX2(Z3_ENABLE_PIN) || IS_RX2(Z3_DIR_PIN) || IS_RX2(Z3_STEP_PIN) || (AXIS_HAS_SPI(Z3) && IS_TX2(Z3_CS_PIN))
141
+  #elif IS_TX2(Z3_ENABLE_PIN) || ANY_RX(2, Z3_DIR_PIN, Z3_STEP_PIN) || (AXIS_HAS_SPI(Z3) && IS_TX2(Z3_CS_PIN))
133
     #error "Serial port pins (2) conflict with Z3 pins!"
142
     #error "Serial port pins (2) conflict with Z3 pins!"
134
-  #elif IS_TX2(Z4_ENABLE_PIN) || IS_RX2(Z4_DIR_PIN) || IS_RX2(Z4_STEP_PIN) || (AXIS_HAS_SPI(Z4) && IS_TX2(Z4_CS_PIN))
143
+  #elif IS_TX2(Z4_ENABLE_PIN) || ANY_RX(2, Z4_DIR_PIN, Z4_STEP_PIN) || (AXIS_HAS_SPI(Z4) && IS_TX2(Z4_CS_PIN))
135
     #error "Serial port pins (2) conflict with Z4 pins!"
144
     #error "Serial port pins (2) conflict with Z4 pins!"
136
-  #elif IS_RX2(X_DIR_PIN) || IS_RX2(Y_DIR_PIN)
145
+  #elif ANY_RX(2, X_DIR_PIN, Y_DIR_PIN)
137
     #error "Serial port pins (2) conflict with other pins!"
146
     #error "Serial port pins (2) conflict with other pins!"
138
   #elif Y_HOME_DIR < 0 && IS_TX2(Y_STOP_PIN)
147
   #elif Y_HOME_DIR < 0 && IS_TX2(Y_STOP_PIN)
139
     #error "Serial port pins (2) conflict with Y endstop pin!"
148
     #error "Serial port pins (2) conflict with Y endstop pin!"
140
   #elif HAS_CUSTOM_PROBE_PIN && IS_TX2(Z_MIN_PROBE_PIN)
149
   #elif HAS_CUSTOM_PROBE_PIN && IS_TX2(Z_MIN_PROBE_PIN)
141
     #error "Serial port pins (2) conflict with probe pin!"
150
     #error "Serial port pins (2) conflict with probe pin!"
142
-  #elif IS_TX2(X_ENABLE_PIN) || IS_RX2(X_DIR_PIN) || IS_TX2(Y_ENABLE_PIN) || IS_RX2(Y_DIR_PIN)
151
+  #elif ANY_TX(2, X_ENABLE_PIN, Y_ENABLE_PIN) || ANY_RX(2, X_DIR_PIN, Y_DIR_PIN)
143
     #error "Serial port pins (2) conflict with X/Y stepper pins!"
152
     #error "Serial port pins (2) conflict with X/Y stepper pins!"
144
   #elif HAS_MULTI_EXTRUDER && (IS_TX2(E1_ENABLE_PIN) || (AXIS_HAS_SPI(E1) && IS_TX2(E1_CS_PIN)))
153
   #elif HAS_MULTI_EXTRUDER && (IS_TX2(E1_ENABLE_PIN) || (AXIS_HAS_SPI(E1) && IS_TX2(E1_CS_PIN)))
145
     #error "Serial port pins (2) conflict with E1 stepper pins!"
154
     #error "Serial port pins (2) conflict with E1 stepper pins!"
146
-  #elif EXTRUDERS && (IS_RX2(E0_DIR_PIN) || IS_RX2(E0_STEP_PIN))
155
+  #elif EXTRUDERS && ANY_RX(2, E0_DIR_PIN, E0_STEP_PIN)
147
     #error "Serial port pins (2) conflict with E stepper pins!"
156
     #error "Serial port pins (2) conflict with E stepper pins!"
148
   #endif
157
   #endif
149
   #undef IS_TX2
158
   #undef IS_TX2
150
   #undef IS_RX2
159
   #undef IS_RX2
160
+  #undef _IS_TX2_1
161
+  #undef _IS_RX2_1
151
 #endif
162
 #endif
152
 
163
 
153
 #if SERIAL_PORT == 3 || SERIAL_PORT_2 == 3 || DGUS_SERIAL_PORT == 3
164
 #if SERIAL_PORT == 3 || SERIAL_PORT_2 == 3 || DGUS_SERIAL_PORT == 3
155
   #define PIN_IS_RX3(P) (P##_PIN == P0_01)
166
   #define PIN_IS_RX3(P) (P##_PIN == P0_01)
156
   #if PIN_IS_TX3(X_MIN) || PIN_IS_RX3(X_MAX)
167
   #if PIN_IS_TX3(X_MIN) || PIN_IS_RX3(X_MAX)
157
     #error "Serial port pins (3) conflict with X endstop pins!"
168
     #error "Serial port pins (3) conflict with X endstop pins!"
158
-  #elif PIN_IS_TX3(Y_SERIAL_TX) || PIN_IS_TX3(Y_SERIAL_RX) \
159
-    ||  PIN_IS_RX3(X_SERIAL_TX) || PIN_IS_RX3(X_SERIAL_RX)
169
+  #elif PIN_IS_TX3(Y_SERIAL_TX) || PIN_IS_TX3(Y_SERIAL_RX) || PIN_IS_RX3(X_SERIAL_TX) || PIN_IS_RX3(X_SERIAL_RX)
160
     #error "Serial port pins (3) conflict with X/Y axis UART pins!"
170
     #error "Serial port pins (3) conflict with X/Y axis UART pins!"
161
   #elif PIN_IS_TX3(X2_DIR) || PIN_IS_RX3(X2_STEP)
171
   #elif PIN_IS_TX3(X2_DIR) || PIN_IS_RX3(X2_STEP)
162
     #error "Serial port pins (3) conflict with X2 pins!"
172
     #error "Serial port pins (3) conflict with X2 pins!"
175
   #undef PIN_IS_RX3
185
   #undef PIN_IS_RX3
176
 #endif
186
 #endif
177
 
187
 
188
+#undef ANY_TX
189
+#undef ANY_RX
190
+
178
 //
191
 //
179
 // Flag any i2c pin conflicts
192
 // Flag any i2c pin conflicts
180
 //
193
 //

+ 11
- 35
Marlin/src/HAL/SAMD51/HAL.h View File

35
 
35
 
36
   // MYSERIAL0 required before MarlinSerial includes!
36
   // MYSERIAL0 required before MarlinSerial includes!
37
 
37
 
38
+  #define _MSERIAL(X) Serial##X
39
+  #define MSERIAL(X) _MSERIAL(INCREMENT(X))
40
+
38
   #if SERIAL_PORT == -1
41
   #if SERIAL_PORT == -1
39
     #define MYSERIAL0 Serial
42
     #define MYSERIAL0 Serial
40
-  #elif SERIAL_PORT == 0
41
-    #define MYSERIAL0 Serial1
42
-  #elif SERIAL_PORT == 1
43
-    #define MYSERIAL0 Serial2
44
-  #elif SERIAL_PORT == 2
45
-    #define MYSERIAL0 Serial3
46
-  #elif SERIAL_PORT == 3
47
-    #define MYSERIAL0 Serial4
43
+  #elif WITHIN(SERIAL_PORT, 0, 3)
44
+    #define MYSERIAL0 MSERIAL(SERIAL_PORT)
48
   #else
45
   #else
49
     #error "SERIAL_PORT must be from -1 to 3. Please update your configuration."
46
     #error "SERIAL_PORT must be from -1 to 3. Please update your configuration."
50
   #endif
47
   #endif
51
 
48
 
52
   #ifdef SERIAL_PORT_2
49
   #ifdef SERIAL_PORT_2
53
-    #if SERIAL_PORT_2 == SERIAL_PORT
54
-      #error "SERIAL_PORT_2 must be different than SERIAL_PORT. Please update your configuration."
55
-    #elif SERIAL_PORT_2 == -1
50
+    #if SERIAL_PORT_2 == -1
56
       #define MYSERIAL1 Serial
51
       #define MYSERIAL1 Serial
57
-    #elif SERIAL_PORT_2 == 0
58
-      #define MYSERIAL1 Serial1
59
-    #elif SERIAL_PORT_2 == 1
60
-      #define MYSERIAL1 Serial2
61
-    #elif SERIAL_PORT_2 == 2
62
-      #define MYSERIAL1 Serial3
63
-    #elif SERIAL_PORT_2 == 3
64
-      #define MYSERIAL1 Serial4
52
+    #elif WITHIN(SERIAL_PORT_2, 0, 3)
53
+      #define MYSERIAL0 MSERIAL(SERIAL_PORT_2)
65
     #else
54
     #else
66
       #error "SERIAL_PORT_2 must be from -1 to 3. Please update your configuration."
55
       #error "SERIAL_PORT_2 must be from -1 to 3. Please update your configuration."
67
     #endif
56
     #endif
68
-    #define NUM_SERIAL 2
69
-  #else
70
-    #define NUM_SERIAL 1
71
   #endif
57
   #endif
72
 
58
 
73
   #ifdef DGUS_SERIAL_PORT
59
   #ifdef DGUS_SERIAL_PORT
74
-    #if DGUS_SERIAL_PORT == SERIAL_PORT
75
-      #error "DGUS_SERIAL_PORT must be different than SERIAL_PORT. Please update your configuration."
76
-    #elif defined(SERIAL_PORT_2) && DGUS_SERIAL_PORT == SERIAL_PORT_2
77
-      #error "DGUS_SERIAL_PORT must be different than SERIAL_PORT_2. Please update your configuration."
78
-    #elif DGUS_SERIAL_PORT == -1
60
+    #if DGUS_SERIAL_PORT == -1
79
       #define DGUS_SERIAL Serial
61
       #define DGUS_SERIAL Serial
80
-    #elif DGUS_SERIAL_PORT == 0
81
-      #define DGUS_SERIAL Serial1
82
-    #elif DGUS_SERIAL_PORT == 1
83
-      #define DGUS_SERIAL Serial2
84
-    #elif DGUS_SERIAL_PORT == 2
85
-      #define DGUS_SERIAL Serial3
86
-    #elif DGUS_SERIAL_PORT == 2
87
-      #define DGUS_SERIAL Serial4
62
+    #elif WITHIN(DGUS_SERIAL_PORT, 0, 3)
63
+      #define MYSERIAL0 MSERIAL(DGUS_SERIAL_PORT)
88
     #else
64
     #else
89
       #error "DGUS_SERIAL_PORT must be from -1 to 3. Please update your configuration."
65
       #error "DGUS_SERIAL_PORT must be from -1 to 3. Please update your configuration."
90
     #endif
66
     #endif

+ 23
- 58
Marlin/src/HAL/STM32/HAL.h View File

43
 // ------------------------
43
 // ------------------------
44
 // Defines
44
 // Defines
45
 // ------------------------
45
 // ------------------------
46
+#define _MSERIAL(X) MSerial##X
47
+#define MSERIAL(X) _MSERIAL(X)
46
 
48
 
47
-#if SERIAL_PORT == 0
48
-  #error "SERIAL_PORT cannot be 0. (Port 0 does not exist.) Please update your configuration."
49
-#elif SERIAL_PORT == -1
49
+#if SERIAL_PORT == -1
50
   #define MYSERIAL0 SerialUSB
50
   #define MYSERIAL0 SerialUSB
51
-#elif SERIAL_PORT == 1
52
-  #define MYSERIAL0 MSerial1
53
-#elif SERIAL_PORT == 2
54
-  #define MYSERIAL0 MSerial2
55
-#elif SERIAL_PORT == 3
56
-  #define MYSERIAL0 MSerial3
57
-#elif SERIAL_PORT == 4
58
-  #define MYSERIAL0 MSerial4
59
-#elif SERIAL_PORT == 5
60
-  #define MYSERIAL0 MSerial5
61
-#elif SERIAL_PORT == 6
62
-  #define MYSERIAL0 MSerial6
51
+#elif WITHIN(SERIAL_PORT, 1, 6)
52
+  #define MYSERIAL0 MSERIAL(SERIAL_PORT)
63
 #else
53
 #else
64
-  #error "SERIAL_PORT must be from -1 to 6. Please update your configuration."
54
+  #error "SERIAL_PORT must be -1 or from 1 to 6. Please update your configuration."
65
 #endif
55
 #endif
66
 
56
 
67
 #ifdef SERIAL_PORT_2
57
 #ifdef SERIAL_PORT_2
68
-  #define NUM_SERIAL 2
69
-  #if SERIAL_PORT_2 == 0
70
-    #error "SERIAL_PORT_2 cannot be 0. (Port 0 does not exist.) Please update your configuration."
71
-  #elif SERIAL_PORT_2 == SERIAL_PORT
72
-    #error "SERIAL_PORT_2 must be different than SERIAL_PORT. Please update your configuration."
73
-  #elif SERIAL_PORT_2 == -1
58
+  #if SERIAL_PORT_2 == -1
74
     #define MYSERIAL1 SerialUSB
59
     #define MYSERIAL1 SerialUSB
75
-  #elif SERIAL_PORT_2 == 1
76
-    #define MYSERIAL1 MSerial1
77
-  #elif SERIAL_PORT_2 == 2
78
-    #define MYSERIAL1 MSerial2
79
-  #elif SERIAL_PORT_2 == 3
80
-    #define MYSERIAL1 MSerial3
81
-  #elif SERIAL_PORT_2 == 4
82
-    #define MYSERIAL1 MSerial4
83
-  #elif SERIAL_PORT_2 == 5
84
-    #define MYSERIAL1 MSerial5
85
-  #elif SERIAL_PORT_2 == 6
86
-    #define MYSERIAL1 MSerial6
60
+  #elif WITHIN(SERIAL_PORT_2, 1, 6)
61
+    #define MYSERIAL1 MSERIAL(SERIAL_PORT_2)
87
   #else
62
   #else
88
-    #error "SERIAL_PORT_2 must be from -1 to 6. Please update your configuration."
63
+    #error "SERIAL_PORT_2 must be -1 or from 1 to 6. Please update your configuration."
89
   #endif
64
   #endif
90
-#else
91
-  #define NUM_SERIAL 1
92
 #endif
65
 #endif
93
 
66
 
94
 #if HAS_DGUS_LCD
67
 #if HAS_DGUS_LCD
95
-  #if DGUS_SERIAL_PORT == 0
96
-    #error "DGUS_SERIAL_PORT cannot be 0. (Port 0 does not exist.) Please update your configuration."
97
-  #elif DGUS_SERIAL_PORT == SERIAL_PORT
98
-    #error "DGUS_SERIAL_PORT must be different than SERIAL_PORT. Please update your configuration."
99
-  #elif defined(SERIAL_PORT_2) && DGUS_SERIAL_PORT == SERIAL_PORT_2
100
-    #error "DGUS_SERIAL_PORT must be different than SERIAL_PORT_2. Please update your configuration."
101
-  #elif DGUS_SERIAL_PORT == -1
68
+  #if DGUS_SERIAL_PORT == -1
102
     #define DGUS_SERIAL SerialUSB
69
     #define DGUS_SERIAL SerialUSB
103
-  #elif DGUS_SERIAL_PORT == 1
104
-    #define DGUS_SERIAL MSerial1
105
-  #elif DGUS_SERIAL_PORT == 2
106
-    #define DGUS_SERIAL MSerial2
107
-  #elif DGUS_SERIAL_PORT == 3
108
-    #define DGUS_SERIAL MSerial3
109
-  #elif DGUS_SERIAL_PORT == 4
110
-    #define DGUS_SERIAL MSerial4
111
-  #elif DGUS_SERIAL_PORT == 5
112
-    #define DGUS_SERIAL MSerial5
113
-  #elif DGUS_SERIAL_PORT == 6
114
-    #define DGUS_SERIAL MSerial6
70
+  #elif WITHIN(DGUS_SERIAL_PORT, 1, 6)
71
+    #define DGUS_SERIAL MSERIAL(DGUS_SERIAL_PORT)
115
   #else
72
   #else
116
-    #error "DGUS_SERIAL_PORT must be from -1 to 6. Please update your configuration."
73
+    #error "DGUS_SERIAL_PORT must be -1 or from 1 to 6. Please update your configuration."
117
   #endif
74
   #endif
118
-
119
   #define DGUS_SERIAL_GET_TX_BUFFER_FREE DGUS_SERIAL.availableForWrite
75
   #define DGUS_SERIAL_GET_TX_BUFFER_FREE DGUS_SERIAL.availableForWrite
120
 #endif
76
 #endif
121
 
77
 
78
+#if ENABLED(MALYAN_LCD)
79
+  #if LCD_SERIAL_PORT == -1
80
+    #define LCD_SERIAL SerialUSB
81
+  #elif WITHIN(LCD_SERIAL_PORT, 1, 6)
82
+    #define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT)
83
+  #else
84
+    #error "LCD_SERIAL_PORT must be -1 or from 1 to 6. Please update your configuration."
85
+  #endif
86
+#endif
122
 
87
 
123
 /**
88
 /**
124
  * TODO: review this to return 1 for pins that are not analog input
89
  * TODO: review this to return 1 for pins that are not analog input

+ 1
- 1
Marlin/src/HAL/STM32/pinsDebug_STM32GENERIC.h View File

98
     timer_dev * const tdev = PIN_MAP[pin].timer_device;
98
     timer_dev * const tdev = PIN_MAP[pin].timer_device;
99
     const uint8_t channel = PIN_MAP[pin].timer_channel;
99
     const uint8_t channel = PIN_MAP[pin].timer_channel;
100
     const char num = (
100
     const char num = (
101
-      #if defined(STM32_HIGH_DENSITY) || defined(STM32_XL_DENSITY)
101
+      #if EITHER(STM32_HIGH_DENSITY, STM32_XL_DENSITY)
102
         tdev == &timer8 ? '8' :
102
         tdev == &timer8 ? '8' :
103
         tdev == &timer5 ? '5' :
103
         tdev == &timer5 ? '5' :
104
       #endif
104
       #endif

+ 1
- 4
Marlin/src/HAL/STM32F1/HAL.h View File

53
 // ------------------------
53
 // ------------------------
54
 
54
 
55
 #ifndef STM32_FLASH_SIZE
55
 #ifndef STM32_FLASH_SIZE
56
-  #if defined(MCU_STM32F103RE) || defined(MCU_STM32F103VE)
56
+  #if EITHER(MCU_STM32F103RE, MCU_STM32F103VE)
57
     #define STM32_FLASH_SIZE 512
57
     #define STM32_FLASH_SIZE 512
58
   #else
58
   #else
59
     #define STM32_FLASH_SIZE 256
59
     #define STM32_FLASH_SIZE 256
106
   #else
106
   #else
107
     #error "SERIAL_PORT_2 must be from -1 to 5. Please update your configuration."
107
     #error "SERIAL_PORT_2 must be from -1 to 5. Please update your configuration."
108
   #endif
108
   #endif
109
-  #define NUM_SERIAL 2
110
-#else
111
-  #define NUM_SERIAL 1
112
 #endif
109
 #endif
113
 
110
 
114
 #ifdef DGUS_SERIAL
111
 #ifdef DGUS_SERIAL

+ 1
- 0
Marlin/src/HAL/STM32F1/MarlinSerial.h View File

30
   #include "../../feature/e_parser.h"
30
   #include "../../feature/e_parser.h"
31
 #endif
31
 #endif
32
 
32
 
33
+// Increase priority of serial interrupts, to reduce overflow errors
33
 #define UART_IRQ_PRIO 1
34
 #define UART_IRQ_PRIO 1
34
 
35
 
35
 class MarlinSerial : public HardwareSerial {
36
 class MarlinSerial : public HardwareSerial {

+ 1
- 1
Marlin/src/HAL/STM32F1/sdio.cpp View File

26
 
26
 
27
 #include "../../inc/MarlinConfig.h" // Allow pins/pins.h to set density
27
 #include "../../inc/MarlinConfig.h" // Allow pins/pins.h to set density
28
 
28
 
29
-#if defined(STM32_HIGH_DENSITY) || defined(STM32_XL_DENSITY)
29
+#if EITHER(STM32_HIGH_DENSITY, STM32_XL_DENSITY)
30
 
30
 
31
 #include "sdio.h"
31
 #include "sdio.h"
32
 
32
 

+ 10
- 51
Marlin/src/HAL/STM32_F4_F7/HAL.h View File

46
 // Serial override
46
 // Serial override
47
 //extern HalSerial usb_serial;
47
 //extern HalSerial usb_serial;
48
 
48
 
49
+#define _MSERIAL(X) SerialUART##X
50
+#define MSERIAL(X) _MSERIAL(X)
51
+#define SerialUART0 Serial1
52
+
49
 #if defined(STM32F4) && SERIAL_PORT == 0
53
 #if defined(STM32F4) && SERIAL_PORT == 0
50
   #error "SERIAL_PORT cannot be 0. (Port 0 does not exist.) Please update your configuration."
54
   #error "SERIAL_PORT cannot be 0. (Port 0 does not exist.) Please update your configuration."
51
 #elif SERIAL_PORT == -1
55
 #elif SERIAL_PORT == -1
52
   #define MYSERIAL0 SerialUSB
56
   #define MYSERIAL0 SerialUSB
53
-#elif SERIAL_PORT == 0
54
-  #define MYSERIAL0 Serial1
55
-#elif SERIAL_PORT == 1
56
-  #define MYSERIAL0 SerialUART1
57
-#elif SERIAL_PORT == 2
58
-  #define MYSERIAL0 SerialUART2
59
-#elif SERIAL_PORT == 3
60
-  #define MYSERIAL0 SerialUART3
61
-#elif SERIAL_PORT == 4
62
-  #define MYSERIAL0 SerialUART4
63
-#elif SERIAL_PORT == 5
64
-  #define MYSERIAL0 SerialUART5
65
-#elif SERIAL_PORT == 6
66
-  #define MYSERIAL0 SerialUART6
57
+#elif WITHIN(SERIAL_PORT, 0, 6)
58
+  #define MYSERIAL0 MSERIAL(SERIAL_PORT)
67
 #else
59
 #else
68
   #error "SERIAL_PORT must be from -1 to 6. Please update your configuration."
60
   #error "SERIAL_PORT must be from -1 to 6. Please update your configuration."
69
 #endif
61
 #endif
71
 #ifdef SERIAL_PORT_2
63
 #ifdef SERIAL_PORT_2
72
   #if defined(STM32F4) && SERIAL_PORT_2 == 0
64
   #if defined(STM32F4) && SERIAL_PORT_2 == 0
73
     #error "SERIAL_PORT_2 cannot be 0. (Port 0 does not exist.) Please update your configuration."
65
     #error "SERIAL_PORT_2 cannot be 0. (Port 0 does not exist.) Please update your configuration."
74
-  #elif SERIAL_PORT_2 == SERIAL_PORT
75
-    #error "SERIAL_PORT_2 must be different than SERIAL_PORT. Please update your configuration."
76
   #elif SERIAL_PORT_2 == -1
66
   #elif SERIAL_PORT_2 == -1
77
     #define MYSERIAL1 SerialUSB
67
     #define MYSERIAL1 SerialUSB
78
-  #elif SERIAL_PORT_2 == 0
79
-    #define MYSERIAL1 Serial1
80
-  #elif SERIAL_PORT_2 == 1
81
-    #define MYSERIAL1 SerialUART1
82
-  #elif SERIAL_PORT_2 == 2
83
-    #define MYSERIAL1 SerialUART2
84
-  #elif SERIAL_PORT_2 == 3
85
-    #define MYSERIAL1 SerialUART3
86
-  #elif SERIAL_PORT_2 == 4
87
-    #define MYSERIAL1 SerialUART4
88
-  #elif SERIAL_PORT_2 == 5
89
-    #define MYSERIAL1 SerialUART5
90
-  #elif SERIAL_PORT_2 == 6
91
-    #define MYSERIAL1 SerialUART6
68
+  #elif WITHIN(SERIAL_PORT_2, 0, 6)
69
+    #define MYSERIAL1 MSERIAL(SERIAL_PORT_2)
92
   #else
70
   #else
93
     #error "SERIAL_PORT_2 must be from -1 to 6. Please update your configuration."
71
     #error "SERIAL_PORT_2 must be from -1 to 6. Please update your configuration."
94
   #endif
72
   #endif
95
-  #define NUM_SERIAL 2
96
-#else
97
-  #define NUM_SERIAL 1
98
 #endif
73
 #endif
99
 
74
 
100
 #ifdef DGUS_SERIAL_PORT
75
 #ifdef DGUS_SERIAL_PORT
101
   #if defined(STM32F4) && DGUS_SERIAL_PORT == 0
76
   #if defined(STM32F4) && DGUS_SERIAL_PORT == 0
102
     #error "DGUS_SERIAL_PORT cannot be 0. (Port 0 does not exist.) Please update your configuration."
77
     #error "DGUS_SERIAL_PORT cannot be 0. (Port 0 does not exist.) Please update your configuration."
103
-  #elif DGUS_SERIAL_PORT == SERIAL_PORT
104
-    #error "DGUS_SERIAL_PORT must be different than SERIAL_PORT. Please update your configuration."
105
-  #elif defined(SERIAL_PORT_2) && DGUS_SERIAL_PORT == SERIAL_PORT_2
106
-    #error "DGUS_SERIAL_PORT must be different than SERIAL_PORT_2. Please update your configuration."
107
   #elif DGUS_SERIAL_PORT == -1
78
   #elif DGUS_SERIAL_PORT == -1
108
     #define DGUS_SERIAL SerialUSB
79
     #define DGUS_SERIAL SerialUSB
109
-  #elif DGUS_SERIAL_PORT == 0
110
-    #define DGUS_SERIAL Serial1
111
-  #elif DGUS_SERIAL_PORT == 1
112
-    #define DGUS_SERIAL SerialUART1
113
-  #elif DGUS_SERIAL_PORT == 2
114
-    #define DGUS_SERIAL SerialUART2
115
-  #elif DGUS_SERIAL_PORT == 3
116
-    #define DGUS_SERIAL SerialUART3
117
-  #elif DGUS_SERIAL_PORT == 4
118
-    #define DGUS_SERIAL SerialUART4
119
-  #elif DGUS_SERIAL_PORT == 5
120
-    #define DGUS_SERIAL SerialUART5
121
-  #elif DGUS_SERIAL_PORT == 6
122
-    #define DGUS_SERIAL SerialUART6
80
+  #elif WITHIN(DGUS_SERIAL_PORT, 0, 6)
81
+    #define DGUS_SERIAL MSERIAL(DGUS_SERIAL_PORT)
123
   #else
82
   #else
124
     #error "DGUS_SERIAL_PORT must be from -1 to 6. Please update your configuration."
83
     #error "DGUS_SERIAL_PORT must be from -1 to 6. Please update your configuration."
125
   #endif
84
   #endif

+ 5
- 9
Marlin/src/HAL/TEENSY31_32/HAL.h View File

49
   #define IS_TEENSY32 1
49
   #define IS_TEENSY32 1
50
 #endif
50
 #endif
51
 
51
 
52
-#define NUM_SERIAL 1
52
+#define _MSERIAL(X) Serial##X
53
+#define MSERIAL(X) _MSERIAL(X)
54
+#define Serial0 Serial
53
 
55
 
54
 #if SERIAL_PORT == -1
56
 #if SERIAL_PORT == -1
55
   #define MYSERIAL0 SerialUSB
57
   #define MYSERIAL0 SerialUSB
56
-#elif SERIAL_PORT == 0
57
-  #define MYSERIAL0 Serial
58
-#elif SERIAL_PORT == 1
59
-  #define MYSERIAL0 Serial1
60
-#elif SERIAL_PORT == 2
61
-  #define MYSERIAL0 Serial2
62
-#elif SERIAL_PORT == 3
63
-  #define MYSERIAL0 Serial3
58
+#elif WITHIN(SERIAL_PORT, 0, 3)
59
+  #define MYSERIAL0 MSERIAL(SERIAL_PORT)
64
 #endif
60
 #endif
65
 
61
 
66
 #define HAL_SERVO_LIB libServo
62
 #define HAL_SERVO_LIB libServo

+ 5
- 9
Marlin/src/HAL/TEENSY35_36/HAL.h View File

54
   #define IS_TEENSY36 1
54
   #define IS_TEENSY36 1
55
 #endif
55
 #endif
56
 
56
 
57
-#define NUM_SERIAL 1
57
+#define _MSERIAL(X) Serial##X
58
+#define MSERIAL(X) _MSERIAL(X)
59
+#define Serial0 Serial
58
 
60
 
59
 #if SERIAL_PORT == -1
61
 #if SERIAL_PORT == -1
60
   #define MYSERIAL0 SerialUSB
62
   #define MYSERIAL0 SerialUSB
61
-#elif SERIAL_PORT == 0
62
-  #define MYSERIAL0 Serial
63
-#elif SERIAL_PORT == 1
64
-  #define MYSERIAL0 Serial1
65
-#elif SERIAL_PORT == 2
66
-  #define MYSERIAL0 Serial2
67
-#elif SERIAL_PORT == 3
68
-  #define MYSERIAL0 Serial3
63
+#elif WITHIN(SERIAL_PORT, 0, 3)
64
+  #define MYSERIAL0 MSERIAL(SERIAL_PORT)
69
 #endif
65
 #endif
70
 
66
 
71
 #define HAL_SERVO_LIB libServo
67
 #define HAL_SERVO_LIB libServo

+ 9
- 42
Marlin/src/HAL/TEENSY40_41/HAL.h View File

50
   #define IS_TEENSY41 1
50
   #define IS_TEENSY41 1
51
 #endif
51
 #endif
52
 
52
 
53
+#define _MSERIAL(X) Serial##X
54
+#define MSERIAL(X) _MSERIAL(X)
55
+#define Serial0 Serial
56
+
53
 #if SERIAL_PORT == -1
57
 #if SERIAL_PORT == -1
54
   #define MYSERIAL0 SerialUSB
58
   #define MYSERIAL0 SerialUSB
55
-#elif SERIAL_PORT == 0
56
-  #define MYSERIAL0 Serial
57
-#elif SERIAL_PORT == 1
58
-  #define MYSERIAL0 Serial1
59
-#elif SERIAL_PORT == 2
60
-  #define MYSERIAL0 Serial2
61
-#elif SERIAL_PORT == 3
62
-  #define MYSERIAL0 Serial3
63
-#elif SERIAL_PORT == 4
64
-  #define MYSERIAL0 Serial4
65
-#elif SERIAL_PORT == 5
66
-  #define MYSERIAL0 Serial5
67
-#elif SERIAL_PORT == 6
68
-  #define MYSERIAL0 Serial6
69
-#elif SERIAL_PORT == 7
70
-  #define MYSERIAL0 Serial7
71
-#elif SERIAL_PORT == 8
72
-  #define MYSERIAL0 Serial8
59
+#elif WITHIN(SERIAL_PORT, 0, 8)
60
+  #define MYSERIAL0 MSERIAL(SERIAL_PORT)
73
 #else
61
 #else
74
   #error "The required SERIAL_PORT must be from -1 to 8. Please update your configuration."
62
   #error "The required SERIAL_PORT must be from -1 to 8. Please update your configuration."
75
 #endif
63
 #endif
76
 
64
 
77
 #ifdef SERIAL_PORT_2
65
 #ifdef SERIAL_PORT_2
78
-  #if SERIAL_PORT_2 == SERIAL_PORT
79
-    #error "SERIAL_PORT_2 must be different from SERIAL_PORT. Please update your configuration."
80
-  #elif SERIAL_PORT_2 == -1
66
+  #if SERIAL_PORT_2 == -1
81
     #define MYSERIAL1 usbSerial
67
     #define MYSERIAL1 usbSerial
82
-  #elif SERIAL_PORT_2 == 0
83
-    #define MYSERIAL1 Serial
84
-  #elif SERIAL_PORT_2 == 1
85
-    #define MYSERIAL1 Serial1
86
-  #elif SERIAL_PORT_2 == 2
87
-    #define MYSERIAL1 Serial2
88
-  #elif SERIAL_PORT_2 == 3
89
-    #define MYSERIAL1 Serial3
90
-  #elif SERIAL_PORT_2 == 4
91
-    #define MYSERIAL1 Serial4
92
-  #elif SERIAL_PORT_2 == 5
93
-    #define MYSERIAL1 Serial5
94
-  #elif SERIAL_PORT_2 == 6
95
-    #define MYSERIAL1 Serial6
96
-  #elif SERIAL_PORT_2 == 7
97
-    #define MYSERIAL1 Serial7
98
-  #elif SERIAL_PORT_2 == 8
99
-    #define MYSERIAL1 Serial8
68
+  #elif WITHIN(SERIAL_PORT_2, 0, 8)
69
+    #define MYSERIAL0 MSERIAL(SERIAL_PORT_2)
100
   #else
70
   #else
101
       #error "SERIAL_PORT_2 must be from -1 to 8. Please update your configuration."
71
       #error "SERIAL_PORT_2 must be from -1 to 8. Please update your configuration."
102
   #endif
72
   #endif
103
-  #define NUM_SERIAL 2
104
-#else
105
-  #define NUM_SERIAL 1
106
 #endif
73
 #endif
107
 
74
 
108
 #define HAL_SERVO_LIB libServo
75
 #define HAL_SERVO_LIB libServo

+ 8
- 10
Marlin/src/MarlinCore.cpp View File

912
     #endif
912
     #endif
913
   #endif
913
   #endif
914
 
914
 
915
-  #if NUM_SERIAL > 0
916
-    MYSERIAL0.begin(BAUDRATE);
917
-    uint32_t serial_connect_timeout = millis() + 1000UL;
918
-    while (!MYSERIAL0 && PENDING(millis(), serial_connect_timeout)) { /*nada*/ }
919
-    #if HAS_MULTI_SERIAL
920
-      MYSERIAL1.begin(BAUDRATE);
921
-      serial_connect_timeout = millis() + 1000UL;
922
-      while (!MYSERIAL1 && PENDING(millis(), serial_connect_timeout)) { /*nada*/ }
923
-    #endif
924
-    SERIAL_ECHO_MSG("start");
915
+  MYSERIAL0.begin(BAUDRATE);
916
+  uint32_t serial_connect_timeout = millis() + 1000UL;
917
+  while (!MYSERIAL0 && PENDING(millis(), serial_connect_timeout)) { /*nada*/ }
918
+  #if HAS_MULTI_SERIAL
919
+    MYSERIAL1.begin(BAUDRATE);
920
+    serial_connect_timeout = millis() + 1000UL;
921
+    while (!MYSERIAL1 && PENDING(millis(), serial_connect_timeout)) { /*nada*/ }
925
   #endif
922
   #endif
923
+  SERIAL_ECHO_MSG("start");
926
 
924
 
927
   #if BOTH(HAS_TFT_LVGL_UI, USE_WIFI_FUNCTION)
925
   #if BOTH(HAS_TFT_LVGL_UI, USE_WIFI_FUNCTION)
928
     mks_esp_wifi_init();
926
     mks_esp_wifi_init();

+ 3
- 16
Marlin/src/gcode/config/M575.cpp View File

53
     case 115200: case 250000: case 500000: case 1000000: {
53
     case 115200: case 250000: case 500000: case 1000000: {
54
       const int8_t port = parser.intval('P', -99);
54
       const int8_t port = parser.intval('P', -99);
55
       const bool set0 = (port == -99 || port == 0);
55
       const bool set0 = (port == -99 || port == 0);
56
-      if (set0) {
57
-        SERIAL_ECHO_START();
58
-        SERIAL_ECHOLNPAIR(" Serial "
59
-          #if HAS_MULTI_SERIAL
60
-            , '0',
61
-          #else
62
-            "0"
63
-          #endif
64
-          " baud rate set to ", baud
65
-        );
66
-      }
56
+      if (set0) SERIAL_ECHO_MSG(" Serial ", '0', " baud rate set to ", baud);
67
       #if HAS_MULTI_SERIAL
57
       #if HAS_MULTI_SERIAL
68
         const bool set1 = (port == -99 || port == 1);
58
         const bool set1 = (port == -99 || port == 1);
69
-        if (set1) {
70
-          SERIAL_ECHO_START();
71
-          SERIAL_ECHOLNPAIR(" Serial ", '1', " baud rate set to ", baud);
72
-        }
59
+        if (set1) SERIAL_ECHO_MSG(" Serial ", '1', " baud rate set to ", baud);
73
       #endif
60
       #endif
74
 
61
 
75
       SERIAL_FLUSH();
62
       SERIAL_FLUSH();
85
   }
72
   }
86
 }
73
 }
87
 
74
 
88
-#endif // NUM_SERIAL > 0 && BAUD_RATE_GCODE
75
+#endif // BAUD_RATE_GCODE

+ 34
- 6
Marlin/src/inc/SanityCheck.h View File

582
   #error "SERIAL_XON_XOFF and SERIAL_STATS_* features not supported on USB-native AVR devices."
582
   #error "SERIAL_XON_XOFF and SERIAL_STATS_* features not supported on USB-native AVR devices."
583
 #endif
583
 #endif
584
 
584
 
585
-#if SERIAL_PORT > 7
586
-  #error "Set SERIAL_PORT to the port on your board. Usually this is 0."
587
-#endif
588
-
589
-#if defined(SERIAL_PORT_2) && NUM_SERIAL < 2
590
-  #error "SERIAL_PORT_2 is not supported for your MOTHERBOARD. Disable it to continue."
585
+#ifndef SERIAL_PORT
586
+  #error "SERIAL_PORT must be defined in Configuration.h"
587
+#elif defined(SERIAL_PORT_2) && SERIAL_PORT_2 == SERIAL_PORT
588
+  #error "SERIAL_PORT_2 cannot be the same as SERIAL_PORT. Please update your configuration."
591
 #endif
589
 #endif
592
 
590
 
593
 /**
591
 /**
2281
 #endif
2279
 #endif
2282
 
2280
 
2283
 /**
2281
 /**
2282
+ * Serial displays require a dedicated serial port
2283
+ */
2284
+#if HAS_DGUS_LCD
2285
+  #ifndef DGUS_SERIAL_PORT
2286
+    #error "The DGUS LCD requires DGUS_SERIAL_PORT to be defined in Configuration.h"
2287
+  #elif DGUS_SERIAL_PORT == SERIAL_PORT
2288
+    #error "DGUS_SERIAL_PORT cannot be the same as SERIAL_PORT. Please update your configuration."
2289
+  #elif defined(SERIAL_PORT_2) && DGUS_SERIAL_PORT == SERIAL_PORT_2
2290
+    #error "DGUS_SERIAL_PORT cannot be the same as SERIAL_PORT_2. Please update your configuration."
2291
+  #endif
2292
+#elif ENABLED(MALYAN_LCD)
2293
+  #ifndef LCD_SERIAL_PORT
2294
+    #error "MALYAN_LCD requires LCD_SERIAL_PORT to be defined in Configuration.h"
2295
+  #elif LCD_SERIAL_PORT == SERIAL_PORT
2296
+    #error "LCD_SERIAL_PORT cannot be the same as SERIAL_PORT. Please update your configuration."
2297
+  #elif defined(SERIAL_PORT_2) && LCD_SERIAL_PORT == SERIAL_PORT_2
2298
+    #error "LCD_SERIAL_PORT cannot be the same as SERIAL_PORT_2. Please update your configuration."
2299
+  #endif
2300
+#elif EITHER(ANYCUBIC_LCD_I3MEGA, ANYCUBIC_LCD_CHIRON)
2301
+  #ifndef ANYCUBIC_LCD_SERIAL_PORT
2302
+    #error "The ANYCUBIC LCD requires ANYCUBIC_LCD_SERIAL_PORT to be defined in Configuration.h"
2303
+  #elif ANYCUBIC_LCD_SERIAL_PORT == SERIAL_PORT
2304
+    #error "ANYCUBIC_LCD_SERIAL_PORT cannot be the same as SERIAL_PORT. Please update your configuration."
2305
+  #elif defined(SERIAL_PORT_2) && ANYCUBIC_LCD_SERIAL_PORT == SERIAL_PORT_2
2306
+    #error "ANYCUBIC_LCD_SERIAL_PORT cannot be the same as SERIAL_PORT_2. Please update your configuration."
2307
+  #endif
2308
+  #define ANYCUBIC_LCD_SERIAL anycubicLcdSerial
2309
+#endif
2310
+
2311
+/**
2284
  * FYSETC Mini 12864 RGB backlighting required
2312
  * FYSETC Mini 12864 RGB backlighting required
2285
  */
2313
  */
2286
 #if EITHER(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) && DISABLED(RGB_LED)
2314
 #if EITHER(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) && DISABLED(RGB_LED)

+ 1
- 5
Marlin/src/lcd/extui/malyan_lcd.cpp View File

45
 
45
 
46
 #if ENABLED(MALYAN_LCD)
46
 #if ENABLED(MALYAN_LCD)
47
 
47
 
48
-#define DEBUG_MALYAN_LCD
48
+//#define DEBUG_MALYAN_LCD
49
 
49
 
50
 #include "ui_api.h"
50
 #include "ui_api.h"
51
 
51
 
61
 #define DEBUG_OUT ENABLED(DEBUG_MALYAN_LCD)
61
 #define DEBUG_OUT ENABLED(DEBUG_MALYAN_LCD)
62
 #include "../../core/debug_out.h"
62
 #include "../../core/debug_out.h"
63
 
63
 
64
-// On the Malyan M200, this will be Serial1. On a RAMPS board,
65
-// it might not be.
66
-#define LCD_SERIAL Serial1
67
-
68
 // This is based on longest sys command + a filename, plus some buffer
64
 // This is based on longest sys command + a filename, plus some buffer
69
 // in case we encounter some data we don't recognize
65
 // in case we encounter some data we don't recognize
70
 // There is no evidence a line will ever be this long, but better safe than sorry
66
 // There is no evidence a line will ever be this long, but better safe than sorry

+ 4
- 4
Marlin/src/pins/stm32f1/pins_BTT_SKR_E3_DIP.h View File

117
    * Hardware serial communication ports.
117
    * Hardware serial communication ports.
118
    * If undefined software serial is used according to the pins below
118
    * If undefined software serial is used according to the pins below
119
    */
119
    */
120
-  //#define X_HARDWARE_SERIAL  Serial1
121
-  //#define Y_HARDWARE_SERIAL  Serial1
122
-  //#define Z_HARDWARE_SERIAL  Serial1
123
-  //#define E0_HARDWARE_SERIAL Serial1
120
+  //#define X_HARDWARE_SERIAL  MSerial1
121
+  //#define Y_HARDWARE_SERIAL  MSerial1
122
+  //#define Z_HARDWARE_SERIAL  MSerial1
123
+  //#define E0_HARDWARE_SERIAL MSerial1
124
 
124
 
125
   //
125
   //
126
   // Software serial
126
   // Software serial

+ 4
- 4
Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_V1_0.h View File

30
  * Hardware serial communication ports.
30
  * Hardware serial communication ports.
31
  */
31
  */
32
 #if HAS_TMC_UART
32
 #if HAS_TMC_UART
33
-  #define X_HARDWARE_SERIAL  Serial4
34
-  #define Y_HARDWARE_SERIAL  Serial4
35
-  #define Z_HARDWARE_SERIAL  Serial4
36
-  #define E0_HARDWARE_SERIAL Serial4
33
+  #define X_HARDWARE_SERIAL  MSerial4
34
+  #define Y_HARDWARE_SERIAL  MSerial4
35
+  #define Z_HARDWARE_SERIAL  MSerial4
36
+  #define E0_HARDWARE_SERIAL MSerial4
37
 #endif
37
 #endif

+ 4
- 4
Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_V2_0.h View File

52
  * Hardware serial communication ports.
52
  * Hardware serial communication ports.
53
  */
53
  */
54
 #if HAS_TMC_UART
54
 #if HAS_TMC_UART
55
-  #define X_HARDWARE_SERIAL  Serial4
56
-  #define Y_HARDWARE_SERIAL  Serial4
57
-  #define Z_HARDWARE_SERIAL  Serial4
58
-  #define E0_HARDWARE_SERIAL Serial4
55
+  #define X_HARDWARE_SERIAL  MSerial4
56
+  #define Y_HARDWARE_SERIAL  MSerial4
57
+  #define Z_HARDWARE_SERIAL  MSerial4
58
+  #define E0_HARDWARE_SERIAL MSerial4
59
 #endif
59
 #endif

+ 4
- 4
Marlin/src/pins/stm32f1/pins_FYSETC_AIO_II.h View File

93
   //
93
   //
94
   // Hardware serial with switch
94
   // Hardware serial with switch
95
   //
95
   //
96
-  #define X_HARDWARE_SERIAL  Serial1
97
-  #define Y_HARDWARE_SERIAL  Serial1
98
-  #define Z_HARDWARE_SERIAL  Serial1
99
-  #define E0_HARDWARE_SERIAL Serial1
96
+  #define X_HARDWARE_SERIAL  MSerial1
97
+  #define Y_HARDWARE_SERIAL  MSerial1
98
+  #define Z_HARDWARE_SERIAL  MSerial1
99
+  #define E0_HARDWARE_SERIAL MSerial1
100
 
100
 
101
   // The 4xTMC2209 module doesn't have a serial multiplexer and
101
   // The 4xTMC2209 module doesn't have a serial multiplexer and
102
   // needs to set *_SLAVE_ADDRESS in Configuration_adv.h for X,Y,Z,E0
102
   // needs to set *_SLAVE_ADDRESS in Configuration_adv.h for X,Y,Z,E0

+ 5
- 11
Marlin/src/pins/stm32f1/pins_MKS_ROBIN.h View File

188
    * Hardware serial communication ports.
188
    * Hardware serial communication ports.
189
    * If undefined software serial is used according to the pins below
189
    * If undefined software serial is used according to the pins below
190
    */
190
    */
191
-  //#define X_HARDWARE_SERIAL  Serial1
192
-  //#define X2_HARDWARE_SERIAL Serial1
193
-  //#define Y_HARDWARE_SERIAL  Serial1
194
-  //#define Y2_HARDWARE_SERIAL Serial1
195
-  //#define Z_HARDWARE_SERIAL  Serial1
196
-  //#define Z2_HARDWARE_SERIAL Serial1
197
-  //#define E0_HARDWARE_SERIAL Serial1
198
-  //#define E1_HARDWARE_SERIAL Serial1
199
-  //#define E2_HARDWARE_SERIAL Serial1
200
-  //#define E3_HARDWARE_SERIAL Serial1
201
-  //#define E4_HARDWARE_SERIAL Serial1
191
+  //#define X_HARDWARE_SERIAL  MSerial1
192
+  //#define Y_HARDWARE_SERIAL  MSerial1
193
+  //#define Z_HARDWARE_SERIAL  MSerial1
194
+  //#define E0_HARDWARE_SERIAL MSerial1
195
+  //#define E1_HARDWARE_SERIAL MSerial1
202
 
196
 
203
   // Unused servo pins may be repurposed with SoftwareSerialM
197
   // Unused servo pins may be repurposed with SoftwareSerialM
204
   //#define X_SERIAL_TX_PIN                 PF8   // SERVO3_PIN -- XS2 - 6
198
   //#define X_SERIAL_TX_PIN                 PF8   // SERVO3_PIN -- XS2 - 6

+ 4
- 4
Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_common.h View File

83
    * Hardware serial communication ports.
83
    * Hardware serial communication ports.
84
    * If undefined software serial is used according to the pins below
84
    * If undefined software serial is used according to the pins below
85
    */
85
    */
86
-  //#define X_HARDWARE_SERIAL  Serial1
87
-  //#define Y_HARDWARE_SERIAL  Serial1
88
-  //#define Z_HARDWARE_SERIAL  Serial1
89
-  //#define E0_HARDWARE_SERIAL Serial1
86
+  //#define X_HARDWARE_SERIAL  MSerial1
87
+  //#define Y_HARDWARE_SERIAL  MSerial1
88
+  //#define Z_HARDWARE_SERIAL  MSerial1
89
+  //#define E0_HARDWARE_SERIAL MSerial1
90
 
90
 
91
   //
91
   //
92
   // Software serial
92
   // Software serial

+ 5
- 11
Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h View File

132
    * Hardware serial communication ports.
132
    * Hardware serial communication ports.
133
    * If undefined software serial is used according to the pins below
133
    * If undefined software serial is used according to the pins below
134
    */
134
    */
135
-  //#define X_HARDWARE_SERIAL  Serial1
136
-  //#define X2_HARDWARE_SERIAL Serial1
137
-  //#define Y_HARDWARE_SERIAL  Serial1
138
-  //#define Y2_HARDWARE_SERIAL Serial1
139
-  //#define Z_HARDWARE_SERIAL  Serial1
140
-  //#define Z2_HARDWARE_SERIAL Serial1
141
-  //#define E0_HARDWARE_SERIAL Serial1
142
-  //#define E1_HARDWARE_SERIAL Serial1
143
-  //#define E2_HARDWARE_SERIAL Serial1
144
-  //#define E3_HARDWARE_SERIAL Serial1
145
-  //#define E4_HARDWARE_SERIAL Serial1
135
+  //#define X_HARDWARE_SERIAL  MSerial1
136
+  //#define Y_HARDWARE_SERIAL  MSerial1
137
+  //#define Z_HARDWARE_SERIAL  MSerial1
138
+  //#define E0_HARDWARE_SERIAL MSerial1
139
+  //#define E1_HARDWARE_SERIAL MSerial1
146
 
140
 
147
   //
141
   //
148
   // Software serial
142
   // Software serial

+ 6
- 11
Marlin/src/pins/stm32f1/pins_MKS_ROBIN_PRO.h View File

125
    * Hardware serial communication ports.
125
    * Hardware serial communication ports.
126
    * If undefined software serial is used according to the pins below
126
    * If undefined software serial is used according to the pins below
127
    */
127
    */
128
-  //#define X_HARDWARE_SERIAL  Serial1
129
-  //#define X2_HARDWARE_SERIAL Serial1
130
-  //#define Y_HARDWARE_SERIAL  Serial1
131
-  //#define Y2_HARDWARE_SERIAL Serial1
132
-  //#define Z_HARDWARE_SERIAL  Serial1
133
-  //#define Z2_HARDWARE_SERIAL Serial1
134
-  //#define E0_HARDWARE_SERIAL Serial1
135
-  //#define E1_HARDWARE_SERIAL Serial1
136
-  //#define E2_HARDWARE_SERIAL Serial1
137
-  //#define E3_HARDWARE_SERIAL Serial1
138
-  //#define E4_HARDWARE_SERIAL Serial1
128
+  //#define X_HARDWARE_SERIAL  MSerial1
129
+  //#define Y_HARDWARE_SERIAL  MSerial1
130
+  //#define Z_HARDWARE_SERIAL  MSerial1
131
+  //#define E0_HARDWARE_SERIAL MSerial1
132
+  //#define E1_HARDWARE_SERIAL MSerial1
133
+  //#define E2_HARDWARE_SERIAL MSerial1
139
 
134
 
140
   //
135
   //
141
   // Software serial
136
   // Software serial

+ 1
- 0
buildroot/tests/malyan_M300-tests View File

9
 restore_configs
9
 restore_configs
10
 use_example_configs "delta/Malyan M300"
10
 use_example_configs "delta/Malyan M300"
11
 opt_disable AUTO_BED_LEVELING_3POINT
11
 opt_disable AUTO_BED_LEVELING_3POINT
12
+opt_set LCD_SERIAL_PORT 1
12
 exec_test $1 $2 "Malyan M300 (delta)"
13
 exec_test $1 $2 "Malyan M300 (delta)"
13
 
14
 
14
 # cleanup
15
 # cleanup

Loading…
Cancel
Save