Przeglądaj źródła

Serial and pins debug cleanup

- Rename some AVR / DUE / ESP32 serial types
- Reduce two #error to one static_assert
- Update AVR/DUE error messages
Scott Lahteine 3 lat temu
rodzic
commit
be6fbc76a1

+ 4
- 4
Marlin/src/HAL/AVR/HAL.h Wyświetl plik

@@ -93,13 +93,13 @@ typedef int8_t pin_t;
93 93
   #define MYSERIAL1 TERN(BLUETOOTH, btSerial, MSerial0)
94 94
 #else
95 95
   #if !WITHIN(SERIAL_PORT, -1, 3)
96
-    #error "SERIAL_PORT must be from 0 to 3. You can also use -1 if the board supports Native USB."
96
+    #error "SERIAL_PORT must be from 0 to 3, or -1 for USB Serial."
97 97
   #endif
98 98
   #define MYSERIAL1 customizedSerial1
99 99
 
100 100
   #ifdef SERIAL_PORT_2
101 101
     #if !WITHIN(SERIAL_PORT_2, -1, 3)
102
-      #error "SERIAL_PORT_2 must be from 0 to 3. You can also use -1 if the board supports Native USB."
102
+      #error "SERIAL_PORT_2 must be from 0 to 3, or -1 for USB Serial."
103 103
     #endif
104 104
     #define MYSERIAL2 customizedSerial2
105 105
   #endif
@@ -107,14 +107,14 @@ typedef int8_t pin_t;
107 107
 
108 108
 #ifdef MMU2_SERIAL_PORT
109 109
   #if !WITHIN(MMU2_SERIAL_PORT, -1, 3)
110
-    #error "MMU2_SERIAL_PORT must be from 0 to 3. You can also use -1 if the board supports Native USB."
110
+    #error "MMU2_SERIAL_PORT must be from 0 to 3, or -1 for USB Serial."
111 111
   #endif
112 112
   #define MMU2_SERIAL mmuSerial
113 113
 #endif
114 114
 
115 115
 #ifdef LCD_SERIAL_PORT
116 116
   #if !WITHIN(LCD_SERIAL_PORT, -1, 3)
117
-    #error "LCD_SERIAL_PORT must be from 0 to 3. You can also use -1 if the board supports Native USB."
117
+    #error "LCD_SERIAL_PORT must be from 0 to 3, or -1 for USB Serial."
118 118
   #endif
119 119
   #define LCD_SERIAL lcdSerial
120 120
   #if HAS_DGUS_LCD

+ 4
- 4
Marlin/src/HAL/AVR/MarlinSerial.cpp Wyświetl plik

@@ -567,7 +567,7 @@ ISR(SERIAL_REGNAME(USART, SERIAL_PORT, _UDRE_vect)) {
567 567
 
568 568
 // Because of the template definition above, it's required to instantiate the template to have all methods generated
569 569
 template class MarlinSerial< MarlinSerialCfg<SERIAL_PORT> >;
570
-MSerialT customizedSerial1(MSerialT::HasEmergencyParser);
570
+MSerialT1 customizedSerial1(MSerialT1::HasEmergencyParser);
571 571
 
572 572
 #ifdef SERIAL_PORT_2
573 573
 
@@ -596,7 +596,7 @@ MSerialT customizedSerial1(MSerialT::HasEmergencyParser);
596 596
   }
597 597
 
598 598
   template class MarlinSerial< MMU2SerialCfg<MMU2_SERIAL_PORT> >;
599
-  MSerialT3 mmuSerial(MSerialT3::HasEmergencyParser);
599
+  MSerialMMU2 mmuSerial(MSerialMMU2::HasEmergencyParser);
600 600
 
601 601
 #endif // MMU2_SERIAL_PORT
602 602
 
@@ -611,7 +611,7 @@ MSerialT customizedSerial1(MSerialT::HasEmergencyParser);
611 611
   }
612 612
 
613 613
   template class MarlinSerial< LCDSerialCfg<LCD_SERIAL_PORT> >;
614
-  MSerialT4 lcdSerial(MSerialT4::HasEmergencyParser);
614
+  MSerialLCD lcdSerial(MSerialLCD::HasEmergencyParser);
615 615
 
616 616
   #if HAS_DGUS_LCD
617 617
     template<typename Cfg>
@@ -630,7 +630,7 @@ MSerialT customizedSerial1(MSerialT::HasEmergencyParser);
630 630
 
631 631
 // For AT90USB targets use the UART for BT interfacing
632 632
 #if defined(USBCON) && ENABLED(BLUETOOTH)
633
-  MSerialT5 bluetoothSerial(false);
633
+  MSerialBT bluetoothSerial(false);
634 634
 #endif
635 635
 
636 636
 #endif // __AVR__

+ 8
- 8
Marlin/src/HAL/AVR/MarlinSerial.h Wyświetl plik

@@ -238,8 +238,8 @@
238 238
     static constexpr bool MAX_RX_QUEUED     = ENABLED(SERIAL_STATS_MAX_RX_QUEUED);
239 239
   };
240 240
 
241
-  typedef Serial1Class< MarlinSerial< MarlinSerialCfg<SERIAL_PORT> > > MSerialT;
242
-  extern MSerialT customizedSerial1;
241
+  typedef Serial1Class< MarlinSerial< MarlinSerialCfg<SERIAL_PORT> > > MSerialT1;
242
+  extern MSerialT1 customizedSerial1;
243 243
 
244 244
   #ifdef SERIAL_PORT_2
245 245
     typedef Serial1Class< MarlinSerial< MarlinSerialCfg<SERIAL_PORT_2> > > MSerialT2;
@@ -262,8 +262,8 @@
262 262
     static constexpr bool RX_OVERRUNS       = false;
263 263
   };
264 264
 
265
-  typedef Serial1Class< MarlinSerial< MMU2SerialCfg<MMU2_SERIAL_PORT> > > MSerialT3;
266
-  extern MSerialT3 mmuSerial;
265
+  typedef Serial1Class< MarlinSerial< MMU2SerialCfg<MMU2_SERIAL_PORT> > > MSerialMMU2;
266
+  extern MSerialMMU2 mmuSerial;
267 267
 #endif
268 268
 
269 269
 #ifdef LCD_SERIAL_PORT
@@ -281,12 +281,12 @@
281 281
     static constexpr bool RX_OVERRUNS       = BOTH(HAS_DGUS_LCD, SERIAL_STATS_RX_BUFFER_OVERRUNS);
282 282
   };
283 283
 
284
-  typedef Serial1Class< MarlinSerial< LCDSerialCfg<LCD_SERIAL_PORT> > > MSerialT4;
285
-  extern MSerialT4 lcdSerial;
284
+  typedef Serial1Class< MarlinSerial< LCDSerialCfg<LCD_SERIAL_PORT> > > MSerialLCD;
285
+  extern MSerialLCD lcdSerial;
286 286
 #endif
287 287
 
288 288
 // Use the UART for Bluetooth in AT90USB configurations
289 289
 #if defined(USBCON) && ENABLED(BLUETOOTH)
290
-  typedef Serial1Class<HardwareSerial> MSerialT5;
291
-  extern MSerialT5 bluetoothSerial;
290
+  typedef Serial1Class<HardwareSerial> MSerialBT;
291
+  extern MSerialBT bluetoothSerial;
292 292
 #endif

+ 4
- 7
Marlin/src/HAL/DUE/HAL.h Wyświetl plik

@@ -50,13 +50,12 @@ extern DefaultSerial4 MSerial3;
50 50
 #define _MSERIAL(X) MSerial##X
51 51
 #define MSERIAL(X) _MSERIAL(X)
52 52
 
53
-// Define MYSERIAL1/2 before MarlinSerial includes!
54 53
 #if SERIAL_PORT == -1 || ENABLED(EMERGENCY_PARSER)
55 54
   #define MYSERIAL1 customizedSerial1
56 55
 #elif WITHIN(SERIAL_PORT, 0, 3)
57 56
   #define MYSERIAL1 MSERIAL(SERIAL_PORT)
58 57
 #else
59
-  #error "The required SERIAL_PORT must be from 0 to 3. You can also use -1 if the board supports Native USB."
58
+  #error "The required SERIAL_PORT must be from 0 to 3, or -1 for USB Serial."
60 59
 #endif
61 60
 
62 61
 #ifdef SERIAL_PORT_2
@@ -65,7 +64,7 @@ extern DefaultSerial4 MSerial3;
65 64
   #elif WITHIN(SERIAL_PORT_2, 0, 3)
66 65
     #define MYSERIAL2 MSERIAL(SERIAL_PORT_2)
67 66
   #else
68
-    #error "SERIAL_PORT_2 must be from 0 to 3. You can also use -1 if the board supports Native USB."
67
+    #error "SERIAL_PORT_2 must be from 0 to 3, or -1 for USB Serial."
69 68
   #endif
70 69
 #endif
71 70
 
@@ -78,12 +77,10 @@ extern DefaultSerial4 MSerial3;
78 77
 #endif
79 78
 
80 79
 #ifdef LCD_SERIAL_PORT
81
-  #if LCD_SERIAL_PORT == -1
82
-    #define LCD_SERIAL lcdSerial
83
-  #elif WITHIN(LCD_SERIAL_PORT, 0, 3)
80
+  #if WITHIN(LCD_SERIAL_PORT, 0, 3)
84 81
     #define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT)
85 82
   #else
86
-    #error "LCD_SERIAL_PORT must be from 0 to 3. You can also use -1 if the board supports Native USB."
83
+    #error "LCD_SERIAL_PORT must be from 0 to 3."
87 84
   #endif
88 85
 #endif
89 86
 

+ 1
- 1
Marlin/src/HAL/DUE/MarlinSerial.cpp Wyświetl plik

@@ -478,7 +478,7 @@ void MarlinSerial<Cfg>::flushTX() {
478 478
 // If not using the USB port as serial port
479 479
 #if defined(SERIAL_PORT) && SERIAL_PORT >= 0
480 480
   template class MarlinSerial< MarlinSerialCfg<SERIAL_PORT> >;
481
-  MSerialT customizedSerial1(MarlinSerialCfg<SERIAL_PORT>::EMERGENCYPARSER);
481
+  MSerialT1 customizedSerial1(MarlinSerialCfg<SERIAL_PORT>::EMERGENCYPARSER);
482 482
 #endif
483 483
 
484 484
 #if defined(SERIAL_PORT_2) && SERIAL_PORT_2 >= 0

+ 2
- 2
Marlin/src/HAL/DUE/MarlinSerial.h Wyświetl plik

@@ -141,8 +141,8 @@ struct MarlinSerialCfg {
141 141
 };
142 142
 
143 143
 #if defined(SERIAL_PORT) && SERIAL_PORT >= 0
144
-  typedef Serial1Class< MarlinSerial< MarlinSerialCfg<SERIAL_PORT> > > MSerialT;
145
-  extern MSerialT customizedSerial1;
144
+  typedef Serial1Class< MarlinSerial< MarlinSerialCfg<SERIAL_PORT> > > MSerialT1;
145
+  extern MSerialT1 customizedSerial1;
146 146
 #endif
147 147
 
148 148
 #if defined(SERIAL_PORT_2) && SERIAL_PORT_2 >= 0

+ 5
- 5
Marlin/src/HAL/DUE/MarlinSerialUSB.cpp Wyświetl plik

@@ -19,13 +19,13 @@
19 19
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20 20
  *
21 21
  */
22
+#ifdef ARDUINO_ARCH_SAM
22 23
 
23 24
 /**
24 25
  * MarlinSerial_Due.cpp - Hardware serial library for Arduino DUE
25 26
  * Copyright (c) 2017 Eduardo José Tagle. All right reserved
26 27
  * Based on MarlinSerial for AVR, copyright (c) 2006 Nicholas Zambetti.  All right reserved.
27 28
  */
28
-#ifdef ARDUINO_ARCH_SAM
29 29
 
30 30
 #include "../../inc/MarlinConfig.h"
31 31
 
@@ -65,7 +65,7 @@ int MarlinSerialUSB::peek() {
65 65
 
66 66
   pending_char = udi_cdc_getc();
67 67
 
68
-  TERN_(EMERGENCY_PARSER, emergency_parser.update(static_cast<MSerialT*>(this)->emergency_state, (char)pending_char));
68
+  TERN_(EMERGENCY_PARSER, emergency_parser.update(static_cast<MSerialT1*>(this)->emergency_state, (char)pending_char));
69 69
 
70 70
   return pending_char;
71 71
 }
@@ -87,7 +87,7 @@ int MarlinSerialUSB::read() {
87 87
 
88 88
   int c = udi_cdc_getc();
89 89
 
90
-  TERN_(EMERGENCY_PARSER, emergency_parser.update(static_cast<MSerialT*>(this)->emergency_state, (char)c));
90
+  TERN_(EMERGENCY_PARSER, emergency_parser.update(static_cast<MSerialT1*>(this)->emergency_state, (char)c));
91 91
 
92 92
   return c;
93 93
 }
@@ -129,10 +129,10 @@ size_t MarlinSerialUSB::write(const uint8_t c) {
129 129
 
130 130
 // Preinstantiate
131 131
 #if SERIAL_PORT == -1
132
-  MSerialT customizedSerial1(TERN0(EMERGENCY_PARSER, true));
132
+  MSerialT1 customizedSerial1(TERN0(EMERGENCY_PARSER, true));
133 133
 #endif
134 134
 #if SERIAL_PORT_2 == -1
135
-  MSerialT customizedSerial2(TERN0(EMERGENCY_PARSER, true));
135
+  MSerialT2 customizedSerial2(TERN0(EMERGENCY_PARSER, true));
136 136
 #endif
137 137
 
138 138
 #endif // HAS_USB_SERIAL

+ 5
- 7
Marlin/src/HAL/DUE/MarlinSerialUSB.h Wyświetl plik

@@ -27,11 +27,9 @@
27 27
  */
28 28
 
29 29
 #include "../../inc/MarlinConfig.h"
30
-#if HAS_USB_SERIAL
31
-
32
-#include <WString.h>
33 30
 #include "../../core/serial_hook.h"
34 31
 
32
+#include <WString.h>
35 33
 
36 34
 struct MarlinSerialUSB {
37 35
   void begin(const long);
@@ -50,14 +48,14 @@ struct MarlinSerialUSB {
50 48
     FORCE_INLINE int rxMaxEnqueued() { return 0; }
51 49
   #endif
52 50
 };
53
-typedef Serial1Class<MarlinSerialUSB> MSerialT;
54 51
 
55 52
 #if SERIAL_PORT == -1
56
-  extern MSerialT customizedSerial1;
53
+  typedef Serial1Class<MarlinSerialUSB> MSerialT1;
54
+  extern MSerialT1 customizedSerial1;
57 55
 #endif
58 56
 
59 57
 #if SERIAL_PORT_2 == -1
60
-  extern MSerialT customizedSerial2;
58
+  typedef Serial1Class<MarlinSerialUSB> MSerialT2;
59
+  extern MSerialT2 customizedSerial2;
61 60
 #endif
62 61
 
63
-#endif // HAS_USB_SERIAL

+ 1
- 1
Marlin/src/HAL/ESP32/WebSocketSerial.cpp Wyświetl plik

@@ -29,7 +29,7 @@
29 29
 #include "wifi.h"
30 30
 #include <ESPAsyncWebServer.h>
31 31
 
32
-MSerialT webSocketSerial(false);
32
+MSerialWebSocketT webSocketSerial(false);
33 33
 AsyncWebSocket ws("/ws"); // TODO Move inside the class.
34 34
 
35 35
 // RingBuffer impl

+ 2
- 2
Marlin/src/HAL/ESP32/WebSocketSerial.h Wyświetl plik

@@ -81,5 +81,5 @@ public:
81 81
   #endif
82 82
 };
83 83
 
84
-typedef Serial1Class<WebSocketSerial> MSerialT;
85
-extern MSerialT webSocketSerial;
84
+typedef Serial1Class<WebSocketSerial> MSerialWebSocketT;
85
+extern MSerialWebSocketT webSocketSerial;

+ 4
- 4
Marlin/src/HAL/LPC1768/MarlinSerial.cpp Wyświetl plik

@@ -26,9 +26,9 @@
26 26
 #include "../../inc/MarlinConfig.h"
27 27
 
28 28
 #if USING_HW_SERIAL0
29
-  MarlinSerial _MSerial(LPC_UART0);
30
-  MSerialT MSerial0(true, _MSerial);
31
-  extern "C" void UART0_IRQHandler() { _MSerial.IRQHandler(); }
29
+  MarlinSerial _MSerial0(LPC_UART0);
30
+  MSerialT MSerial0(true, _MSerial0);
31
+  extern "C" void UART0_IRQHandler() { _MSerial0.IRQHandler(); }
32 32
 #endif
33 33
 #if USING_HW_SERIAL1
34 34
   MarlinSerial _MSerial1((LPC_UART_TypeDef *) LPC_UART1);
@@ -52,7 +52,7 @@
52 52
     // Need to figure out which serial port we are and react in consequence (Marlin does not have CONTAINER_OF macro)
53 53
     if (false) {}
54 54
     #if USING_HW_SERIAL0
55
-      else if (this == &_MSerial) emergency_parser.update(MSerial0.emergency_state, c);
55
+      else if (this == &_MSerial0) emergency_parser.update(MSerial0.emergency_state, c);
56 56
     #endif
57 57
     #if USING_HW_SERIAL1
58 58
       else if (this == &_MSerial1) emergency_parser.update(MSerial1.emergency_state, c);

+ 0
- 2
Marlin/src/HAL/SAMD51/HAL.h Wyświetl plik

@@ -43,8 +43,6 @@
43 43
   extern DefaultSerial4 MSerial3;
44 44
   extern DefaultSerial5 MSerial4;
45 45
 
46
-  // MYSERIAL1 required before MarlinSerial includes!
47
-
48 46
   #define __MSERIAL(X) MSerial##X
49 47
   #define _MSERIAL(X) __MSERIAL(X)
50 48
   #define MSERIAL(X) _MSERIAL(INCREMENT(X))

+ 3
- 3
Marlin/src/HAL/STM32/HAL.h Wyświetl plik

@@ -37,6 +37,9 @@
37 37
 
38 38
 #include <stdint.h>
39 39
 
40
+//
41
+// Serial Ports
42
+//
40 43
 #ifdef USBCON
41 44
   #include <USBSerial.h>
42 45
   #include "../../core/serial_hook.h"
@@ -44,9 +47,6 @@
44 47
   extern DefaultSerial1 MSerial0;
45 48
 #endif
46 49
 
47
-// ------------------------
48
-// Defines
49
-// ------------------------
50 50
 #define _MSERIAL(X) MSerial##X
51 51
 #define MSERIAL(X) _MSERIAL(X)
52 52
 

+ 7
- 25
Marlin/src/HAL/STM32F1/HAL.h Wyświetl plik

@@ -36,7 +36,6 @@
36 36
 #include "fastio.h"
37 37
 #include "watchdog.h"
38 38
 
39
-
40 39
 #include <stdint.h>
41 40
 #include <util/atomic.h>
42 41
 
@@ -63,11 +62,10 @@
63 62
 #ifdef SERIAL_USB
64 63
   typedef ForwardSerial1Class< USBSerial > DefaultSerial1;
65 64
   extern DefaultSerial1 MSerial0;
66
-
67
-  #if !HAS_SD_HOST_DRIVE
68
-    #define UsbSerial MSerial0
69
-  #else
65
+  #if HAS_SD_HOST_DRIVE
70 66
     #define UsbSerial MarlinCompositeSerial
67
+  #else
68
+    #define UsbSerial MSerial0
71 69
   #endif
72 70
 #endif
73 71
 
@@ -86,11 +84,7 @@
86 84
   #define MYSERIAL1 MSERIAL(SERIAL_PORT)
87 85
 #else
88 86
   #define MYSERIAL1 MSERIAL(1) // dummy port
89
-  #if NUM_UARTS == 5
90
-    #error "SERIAL_PORT must be from 1 to 5. You can also use -1 if the board supports Native USB."
91
-  #else
92
-    #error "SERIAL_PORT must be from 1 to 3. You can also use -1 if the board supports Native USB."
93
-  #endif
87
+  static_assert(false, "SERIAL_PORT must be from 1 to " STRINGIFY(NUM_UARTS) ". You can also use -1 if the board supports Native USB.")
94 88
 #endif
95 89
 
96 90
 #ifdef SERIAL_PORT_2
@@ -100,11 +94,7 @@
100 94
     #define MYSERIAL2 MSERIAL(SERIAL_PORT_2)
101 95
   #else
102 96
     #define MYSERIAL2 MSERIAL(1) // dummy port
103
-    #if NUM_UARTS == 5
104
-      #error "SERIAL_PORT_2 must be from 1 to 5. You can also use -1 if the board supports Native USB."
105
-    #else
106
-      #error "SERIAL_PORT_2 must be from 1 to 3. You can also use -1 if the board supports Native USB."
107
-    #endif
97
+    static_assert(false, "SERIAL_PORT_2 must be from 1 to " STRINGIFY(NUM_UARTS) ". You can also use -1 if the board supports Native USB.")
108 98
   #endif
109 99
 #endif
110 100
 
@@ -115,11 +105,7 @@
115 105
     #define MMU2_SERIAL MSERIAL(MMU2_SERIAL_PORT)
116 106
   #else
117 107
     #define MMU2_SERIAL MSERIAL(1) // dummy port
118
-    #if NUM_UARTS == 5
119
-      #error "MMU2_SERIAL_PORT must be from 1 to 5. You can also use -1 if the board supports Native USB."
120
-    #else
121
-      #error "MMU2_SERIAL_PORT must be from 1 to 3. You can also use -1 if the board supports Native USB."
122
-    #endif
108
+    static_assert(false, "MMU2_SERIAL_PORT must be from 1 to " STRINGIFY(NUM_UARTS) ". You can also use -1 if the board supports Native USB.")
123 109
   #endif
124 110
 #endif
125 111
 
@@ -130,11 +116,7 @@
130 116
     #define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT)
131 117
   #else
132 118
     #define LCD_SERIAL MSERIAL(1) // dummy port
133
-    #if NUM_UARTS == 5
134
-      #error "LCD_SERIAL_PORT must be from 1 to 5. You can also use -1 if the board supports Native USB."
135
-    #else
136
-      #error "LCD_SERIAL_PORT must be from 1 to 3. You can also use -1 if the board supports Native USB."
137
-    #endif
119
+    static_assert(false, "LCD_SERIAL_PORT must be from 1 to " STRINGIFY(NUM_UARTS) ". You can also use -1 if the board supports Native USB.")
138 120
   #endif
139 121
   #if HAS_DGUS_LCD
140 122
     #define SERIAL_GET_TX_BUFFER_FREE() LCD_SERIAL.availableForWrite()

+ 2
- 0
Marlin/src/HAL/TEENSY31_32/HAL.h Wyświetl plik

@@ -68,6 +68,8 @@ extern USBSerialType USBSerial;
68 68
 #elif WITHIN(SERIAL_PORT, 0, 3)
69 69
   DECLARE_SERIAL(SERIAL_PORT);
70 70
   #define MYSERIAL1 MSERIAL(SERIAL_PORT)
71
+#else
72
+  #error "The required SERIAL_PORT must be from 0 to 3, or -1 for Native USB."
71 73
 #endif
72 74
 
73 75
 #define HAL_SERVO_LIB libServo

+ 5
- 9
Marlin/src/core/serial.h Wyświetl plik

@@ -87,16 +87,12 @@ extern uint8_t marlin_debug_flags;
87 87
   // If we have a catchall, use that directly
88 88
   #ifdef SERIAL_CATCHALL
89 89
     #define _SERIAL_LEAF_2 SERIAL_CATCHALL
90
+  #elif HAS_ETHERNET
91
+    typedef ConditionalSerial<decltype(MYSERIAL2)> SerialLeafT2;  // We need to create an instance here
92
+    extern SerialLeafT2 msSerial2;
93
+    #define _SERIAL_LEAF_2 msSerial2
90 94
   #else
91
-    #if HAS_ETHERNET
92
-      // We need to create an instance here
93
-      typedef ConditionalSerial<decltype(MYSERIAL2)> SerialLeafT2;
94
-      extern SerialLeafT2 msSerial2;
95
-      #define _SERIAL_LEAF_2 msSerial2
96
-    #else
97
-      // Don't create a useless instance here, directly use the existing instance
98
-      #define _SERIAL_LEAF_2 MYSERIAL2
99
-    #endif
95
+    #define _SERIAL_LEAF_2 MYSERIAL2 // Don't create a useless instance here, directly use the existing instance
100 96
   #endif
101 97
 
102 98
   // Hook Meatpack if it's enabled on the second leaf

+ 0
- 1
Marlin/src/inc/Conditionals_post.h Wyświetl plik

@@ -1949,7 +1949,6 @@
1949 1949
 #undef _SERIAL_ID
1950 1950
 #undef _TMC_UART_IS
1951 1951
 #undef TMC_UART_IS
1952
-#undef CONF_SERIAL_IS
1953 1952
 #undef ANY_SERIAL_IS
1954 1953
 
1955 1954
 //

+ 19
- 86
Marlin/src/pins/pinsDebug.h Wyświetl plik

@@ -45,34 +45,22 @@
45 45
 
46 46
 // manually add pins that have names that are macros which don't play well with these macros
47 47
 #if ANY(AVR_ATmega2560_FAMILY, AVR_ATmega1284_FAMILY, ARDUINO_ARCH_SAM, TARGET_LPC1768)
48
-  #if SERIAL_PORT == 0
48
+  #if CONF_SERIAL_IS(0)
49 49
     static const char RXD_NAME_0[] PROGMEM = { "RXD0" };
50 50
     static const char TXD_NAME_0[] PROGMEM = { "TXD0" };
51
-  #elif SERIAL_PORT == 1
51
+  #endif
52
+  #if CONF_SERIAL_IS(1)
52 53
     static const char RXD_NAME_1[] PROGMEM = { "RXD1" };
53 54
     static const char TXD_NAME_1[] PROGMEM = { "TXD1" };
54
-  #elif SERIAL_PORT == 2
55
+  #endif
56
+  #if CONF_SERIAL_IS(2)
55 57
     static const char RXD_NAME_2[] PROGMEM = { "RXD2" };
56 58
     static const char TXD_NAME_2[] PROGMEM = { "TXD2" };
57
-  #elif SERIAL_PORT == 3
59
+  #endif
60
+  #if CONF_SERIAL_IS(3)
58 61
     static const char RXD_NAME_3[] PROGMEM = { "RXD3" };
59 62
     static const char TXD_NAME_3[] PROGMEM = { "TXD3" };
60 63
   #endif
61
-  #ifdef SERIAL_PORT_2
62
-    #if SERIAL_PORT_2 == 0
63
-      static const char RXD_NAME_0[] PROGMEM = { "RXD0" };
64
-      static const char TXD_NAME_0[] PROGMEM = { "TXD0" };
65
-    #elif SERIAL_PORT_2 == 1
66
-      static const char RXD_NAME_1[] PROGMEM = { "RXD1" };
67
-      static const char TXD_NAME_1[] PROGMEM = { "TXD1" };
68
-    #elif SERIAL_PORT_2 == 2
69
-      static const char RXD_NAME_2[] PROGMEM = { "RXD2" };
70
-      static const char TXD_NAME_2[] PROGMEM = { "TXD2" };
71
-    #elif SERIAL_PORT_2 == 3
72
-      static const char RXD_NAME_3[] PROGMEM = { "RXD3" };
73
-      static const char TXD_NAME_3[] PROGMEM = { "TXD3" };
74
-    #endif
75
-  #endif
76 64
 #endif
77 65
 
78 66
 /////////////////////////////////////////////////////////////////////////////
@@ -103,12 +91,11 @@ const PinInfo pin_array[] PROGMEM = {
103 91
    *  Each entry takes up 6 bytes in FLASH:
104 92
    *     2 byte pointer to location of the name string
105 93
    *     2 bytes containing the pin number
106
-   *         analog pin numbers were convereted to digital when the array was created
94
+   *         analog pin numbers were converted to digital when the array was created
107 95
    *     2 bytes containing the digital/analog bool flag
108 96
    */
109 97
 
110
-  // manually add pins ...
111
-  #if SERIAL_PORT == 0
98
+  #if CONF_SERIAL_IS(0)
112 99
     #if EITHER(AVR_ATmega2560_FAMILY, ARDUINO_ARCH_SAM)
113 100
       { RXD_NAME_0, 0, true },
114 101
       { TXD_NAME_0, 1, true },
@@ -119,7 +106,9 @@ const PinInfo pin_array[] PROGMEM = {
119 106
       { RXD_NAME_0, 3, true },
120 107
       { TXD_NAME_0, 2, true },
121 108
     #endif
122
-  #elif SERIAL_PORT == 1
109
+  #endif
110
+
111
+  #if CONF_SERIAL_IS(1)
123 112
     #if EITHER(AVR_ATmega2560_FAMILY, ARDUINO_ARCH_SAM)
124 113
       { RXD_NAME_1, 19, true },
125 114
       { TXD_NAME_1, 18, true },
@@ -135,7 +124,9 @@ const PinInfo pin_array[] PROGMEM = {
135 124
         { TXD_NAME_1, 15, true },
136 125
       #endif
137 126
     #endif
138
-  #elif SERIAL_PORT == 2
127
+  #endif
128
+
129
+  #if CONF_SERIAL_IS(2)
139 130
     #if EITHER(AVR_ATmega2560_FAMILY, ARDUINO_ARCH_SAM)
140 131
       { RXD_NAME_2, 17, true },
141 132
       { TXD_NAME_2, 16, true },
@@ -148,7 +139,9 @@ const PinInfo pin_array[] PROGMEM = {
148 139
         { TXD_NAME_2, 10, true },
149 140
       #endif
150 141
     #endif
151
-  #elif SERIAL_PORT == 3
142
+  #endif
143
+
144
+  #if CONF_SERIAL_IS(3)
152 145
     #if EITHER(AVR_ATmega2560_FAMILY, ARDUINO_ARCH_SAM)
153 146
       { RXD_NAME_3, 15, true },
154 147
       { TXD_NAME_3, 14, true },
@@ -166,68 +159,8 @@ const PinInfo pin_array[] PROGMEM = {
166 159
     #endif
167 160
   #endif
168 161
 
169
-  #ifdef SERIAL_PORT_2
170
-    #if SERIAL_PORT_2 == 0
171
-      #if EITHER(AVR_ATmega2560_FAMILY, ARDUINO_ARCH_SAM)
172
-        { RXD_NAME_0, 0, true },
173
-        { TXD_NAME_0, 1, true },
174
-      #elif AVR_ATmega1284_FAMILY
175
-        { RXD_NAME_0, 8, true },
176
-        { TXD_NAME_0, 9, true },
177
-      #elif defined(TARGET_LPC1768)           // TX P0_02  RX P0_03
178
-        { RXD_NAME_0, 3, true },
179
-        { TXD_NAME_0, 2, true },
180
-      #endif
181
-    #elif SERIAL_PORT_2 == 1
182
-      #if EITHER(AVR_ATmega2560_FAMILY, ARDUINO_ARCH_SAM)
183
-        { RXD_NAME_1, 19, true },
184
-        { TXD_NAME_1, 18, true },
185
-      #elif AVR_ATmega1284_FAMILY
186
-        { RXD_NAME_1, 10, true },
187
-        { TXD_NAME_1, 11, true },
188
-      #elif defined(TARGET_LPC1768)
189
-        #ifdef LPC_PINCFG_UART1_P2_00         // TX P2_00  RX P2_01
190
-          { RXD_NAME_1, 0x41, true },
191
-          { TXD_NAME_1, 0x40, true },
192
-        #else                                 // TX P0_15  RX P0_16
193
-          { RXD_NAME_1, 16, true },
194
-          { TXD_NAME_1, 15, true },
195
-        #endif
196
-      #endif
197
-    #elif SERIAL_PORT_2 == 2
198
-      #if EITHER(AVR_ATmega2560_FAMILY, ARDUINO_ARCH_SAM)
199
-        { RXD_NAME_2, 17, true },
200
-        { TXD_NAME_2, 16, true },
201
-      #elif defined(TARGET_LPC1768)
202
-        #ifdef LPC_PINCFG_UART2_P2_08         // TX P2_08  RX P2_09
203
-          { RXD_NAME_2, 0x49, true },
204
-          { TXD_NAME_2, 0x48, true },
205
-        #else                                 // TX P0_10  RX P0_11
206
-          { RXD_NAME_2, 11, true },
207
-          { TXD_NAME_2, 10, true },
208
-        #endif
209
-      #endif
210
-    #elif SERIAL_PORT_2 == 3
211
-      #if EITHER(AVR_ATmega2560_FAMILY, ARDUINO_ARCH_SAM)
212
-        { RXD_NAME_3, 15, true },
213
-        { TXD_NAME_3, 14, true },
214
-      #elif defined(TARGET_LPC1768)
215
-        #ifdef LPC_PINCFG_UART3_P0_25         // TX P0_25  RX P0_26
216
-          { RXD_NAME_3, 0x1A, true },
217
-          { TXD_NAME_3, 0x19, true },
218
-        #elif defined(LPC_PINCFG_UART3_P4_28) // TX P4_28  RX P4_29
219
-          { RXD_NAME_3, 0x9D, true },
220
-          { TXD_NAME_3, 0x9C, true },
221
-        #else                                 // TX P0_00  RX P0_01
222
-          { RXD_NAME_3, 1, true },
223
-          { TXD_NAME_3, 0, true },
224
-        #endif
225
-      #endif
226
-    #endif
227
-  #endif
228
-
229 162
   #include "pinsDebug_list.h"
230
-  #line 231
163
+  #line 164
231 164
 
232 165
 };
233 166
 

Ładowanie…
Anuluj
Zapisz