Procházet zdrojové kódy

Number serial from 1 to match settings

Scott Lahteine před 3 roky
rodič
revize
dbd28eecc9
51 změnil soubory, kde provedl 156 přidání a 161 odebrání
  1. 1
    1
      Marlin/src/HAL/AVR/HAL.cpp
  2. 6
    6
      Marlin/src/HAL/AVR/HAL.h
  3. 5
    5
      Marlin/src/HAL/AVR/MarlinSerial.h
  4. 4
    4
      Marlin/src/HAL/DUE/HAL.cpp
  5. 13
    14
      Marlin/src/HAL/DUE/HAL.h
  6. 2
    2
      Marlin/src/HAL/DUE/MarlinSerial.h
  7. 1
    1
      Marlin/src/HAL/DUE/MarlinSerialUSB.h
  8. 1
    1
      Marlin/src/HAL/ESP32/FlushableHardwareSerial.cpp
  9. 1
    1
      Marlin/src/HAL/ESP32/FlushableHardwareSerial.h
  10. 1
    1
      Marlin/src/HAL/ESP32/HAL.cpp
  11. 5
    5
      Marlin/src/HAL/ESP32/HAL.h
  12. 1
    1
      Marlin/src/HAL/ESP32/WebSocketSerial.h
  13. 1
    1
      Marlin/src/HAL/LINUX/HAL.h
  14. 1
    1
      Marlin/src/HAL/LINUX/include/serial.h
  15. 2
    2
      Marlin/src/HAL/LINUX/main.cpp
  16. 1
    1
      Marlin/src/HAL/LPC1768/HAL.cpp
  17. 6
    7
      Marlin/src/HAL/LPC1768/HAL.h
  18. 2
    2
      Marlin/src/HAL/LPC1768/MarlinSerial.cpp
  19. 2
    2
      Marlin/src/HAL/LPC1768/MarlinSerial.h
  20. 5
    5
      Marlin/src/HAL/SAMD51/HAL.cpp
  21. 18
    18
      Marlin/src/HAL/SAMD51/HAL.h
  22. 1
    1
      Marlin/src/HAL/SAMD51/MarlinSerial_AGCM4.h
  23. 1
    1
      Marlin/src/HAL/STM32/HAL.cpp
  24. 8
    8
      Marlin/src/HAL/STM32/HAL.h
  25. 1
    1
      Marlin/src/HAL/STM32/MarlinSerial.h
  26. 2
    2
      Marlin/src/HAL/STM32F1/HAL.cpp
  27. 7
    7
      Marlin/src/HAL/STM32F1/HAL.h
  28. 3
    3
      Marlin/src/HAL/STM32F1/HAL_MinSerial.cpp
  29. 3
    3
      Marlin/src/HAL/STM32F1/MarlinSerial.cpp
  30. 1
    1
      Marlin/src/HAL/STM32F1/MarlinSerial.h
  31. 1
    1
      Marlin/src/HAL/STM32F1/msc_sd.cpp
  32. 1
    1
      Marlin/src/HAL/STM32F1/msc_sd.h
  33. 1
    1
      Marlin/src/HAL/TEENSY31_32/HAL.cpp
  34. 5
    6
      Marlin/src/HAL/TEENSY31_32/HAL.h
  35. 1
    1
      Marlin/src/HAL/TEENSY35_36/HAL.cpp
  36. 5
    6
      Marlin/src/HAL/TEENSY35_36/HAL.h
  37. 1
    1
      Marlin/src/HAL/TEENSY40_41/HAL.cpp
  38. 8
    9
      Marlin/src/HAL/TEENSY40_41/HAL.h
  39. 3
    3
      Marlin/src/core/serial.cpp
  40. 4
    4
      Marlin/src/core/serial.h
  41. 3
    3
      Marlin/src/core/serial_hook.h
  42. 1
    1
      Marlin/src/feature/ethernet.cpp
  43. 2
    2
      Marlin/src/gcode/config/M575.cpp
  44. 4
    4
      Marlin/src/gcode/control/M111.cpp
  45. 2
    2
      Marlin/src/gcode/queue.cpp
  46. 1
    1
      Marlin/src/lcd/extui/lib/mks_ui/draw_gcode.cpp
  47. 1
    1
      Marlin/src/lcd/extui/lib/mks_ui/draw_keyboard.cpp
  48. 2
    2
      Marlin/src/lcd/extui/malyan_lcd.cpp
  49. 1
    1
      Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.cpp
  50. 1
    1
      Marlin/src/sd/usb_flashdrive/lib-uhs2/settings.h
  51. 2
    2
      docs/Serial.md

+ 1
- 1
Marlin/src/HAL/AVR/HAL.cpp Zobrazit soubor

@@ -25,7 +25,7 @@
25 25
 #include "HAL.h"
26 26
 
27 27
 #ifdef USBCON
28
-  DefaultSerial MSerial(false, Serial);
28
+  DefaultSerial1 MSerial0(false, Serial);
29 29
   #ifdef BLUETOOTH
30 30
     BTSerial btSerial(false, bluetoothSerial);
31 31
   #endif

+ 6
- 6
Marlin/src/HAL/AVR/HAL.h Zobrazit soubor

@@ -83,25 +83,25 @@ typedef int8_t pin_t;
83 83
 // Serial ports
84 84
 #ifdef USBCON
85 85
   #include "../../core/serial_hook.h"
86
-  typedef ForwardSerial0Type< decltype(Serial) > DefaultSerial;
87
-  extern DefaultSerial MSerial;
86
+  typedef ForwardSerial1Class< decltype(Serial) > DefaultSerial1;
87
+  extern DefaultSerial1 MSerial0;
88 88
   #ifdef BLUETOOTH
89
-    typedef ForwardSerial0Type< decltype(bluetoothSerial) > BTSerial;
89
+    typedef ForwardSerial1Class< decltype(bluetoothSerial) > BTSerial;
90 90
     extern BTSerial btSerial;
91 91
   #endif
92 92
 
93
-  #define MYSERIAL0 TERN(BLUETOOTH, btSerial, MSerial)
93
+  #define MYSERIAL1 TERN(BLUETOOTH, btSerial, MSerial0)
94 94
 #else
95 95
   #if !WITHIN(SERIAL_PORT, -1, 3)
96 96
     #error "SERIAL_PORT must be from -1 to 3. Please update your configuration."
97 97
   #endif
98
-  #define MYSERIAL0 customizedSerial1
98
+  #define MYSERIAL1 customizedSerial1
99 99
 
100 100
   #ifdef SERIAL_PORT_2
101 101
     #if !WITHIN(SERIAL_PORT_2, -1, 3)
102 102
       #error "SERIAL_PORT_2 must be from -1 to 3. Please update your configuration."
103 103
     #endif
104
-    #define MYSERIAL1 customizedSerial2
104
+    #define MYSERIAL2 customizedSerial2
105 105
   #endif
106 106
 #endif
107 107
 

+ 5
- 5
Marlin/src/HAL/AVR/MarlinSerial.h Zobrazit soubor

@@ -238,11 +238,11 @@
238 238
     static constexpr bool MAX_RX_QUEUED     = ENABLED(SERIAL_STATS_MAX_RX_QUEUED);
239 239
   };
240 240
 
241
-  typedef Serial0Type< MarlinSerial< MarlinSerialCfg<SERIAL_PORT> > > MSerialT;
241
+  typedef Serial1Class< MarlinSerial< MarlinSerialCfg<SERIAL_PORT> > > MSerialT;
242 242
   extern MSerialT customizedSerial1;
243 243
 
244 244
   #ifdef SERIAL_PORT_2
245
-    typedef Serial0Type< MarlinSerial< MarlinSerialCfg<SERIAL_PORT_2> > > MSerialT2;
245
+    typedef Serial1Class< MarlinSerial< MarlinSerialCfg<SERIAL_PORT_2> > > MSerialT2;
246 246
     extern MSerialT2 customizedSerial2;
247 247
   #endif
248 248
 
@@ -262,7 +262,7 @@
262 262
     static constexpr bool RX_OVERRUNS       = false;
263 263
   };
264 264
 
265
-  typedef Serial0Type< MarlinSerial< MMU2SerialCfg<MMU2_SERIAL_PORT> > > MSerialT3;
265
+  typedef Serial1Class< MarlinSerial< MMU2SerialCfg<MMU2_SERIAL_PORT> > > MSerialT3;
266 266
   extern MSerialT3 mmuSerial;
267 267
 #endif
268 268
 
@@ -292,12 +292,12 @@
292 292
   };
293 293
 
294 294
 
295
-  typedef Serial0Type< MarlinSerial< LCDSerialCfg<LCD_SERIAL_PORT> > > MSerialT4;
295
+  typedef Serial1Class< MarlinSerial< LCDSerialCfg<LCD_SERIAL_PORT> > > MSerialT4;
296 296
   extern MSerialT4 lcdSerial;
297 297
 #endif
298 298
 
299 299
 // Use the UART for Bluetooth in AT90USB configurations
300 300
 #if defined(USBCON) && ENABLED(BLUETOOTH)
301
-  typedef Serial0Type<HardwareSerial> MSerialT5;
301
+  typedef Serial1Class<HardwareSerial> MSerialT5;
302 302
   extern MSerialT5 bluetoothSerial;
303 303
 #endif

+ 4
- 4
Marlin/src/HAL/DUE/HAL.cpp Zobrazit soubor

@@ -107,16 +107,16 @@ uint16_t HAL_adc_get_result() {
107 107
 
108 108
 // Forward the default serial ports
109 109
 #if ANY_SERIAL_IS(0)
110
-  DefaultSerial MSerial(false, Serial);
110
+  DefaultSerial1 MSerial0(false, Serial);
111 111
 #endif
112 112
 #if ANY_SERIAL_IS(1)
113
-  DefaultSerial1 MSerial1(false, Serial1);
113
+  DefaultSerial2 MSerial1(false, Serial1);
114 114
 #endif
115 115
 #if ANY_SERIAL_IS(2)
116
-  DefaultSerial2 MSerial2(false, Serial2);
116
+  DefaultSerial3 MSerial2(false, Serial2);
117 117
 #endif
118 118
 #if ANY_SERIAL_IS(3)
119
-  DefaultSerial3 MSerial3(false, Serial3);
119
+  DefaultSerial4 MSerial3(false, Serial3);
120 120
 #endif
121 121
 
122 122
 #endif // ARDUINO_ARCH_SAM

+ 13
- 14
Marlin/src/HAL/DUE/HAL.h Zobrazit soubor

@@ -38,33 +38,32 @@
38 38
 
39 39
 #include "../../core/serial_hook.h"
40 40
 
41
-typedef ForwardSerial0Type< decltype(Serial) > DefaultSerial;
42
-typedef ForwardSerial0Type< decltype(Serial1) > DefaultSerial1;
43
-typedef ForwardSerial0Type< decltype(Serial2) > DefaultSerial2;
44
-typedef ForwardSerial0Type< decltype(Serial3) > DefaultSerial3;
45
-extern DefaultSerial MSerial;
46
-extern DefaultSerial1 MSerial1;
47
-extern DefaultSerial2 MSerial2;
48
-extern DefaultSerial3 MSerial3;
41
+typedef ForwardSerial1Class< decltype(Serial) > DefaultSerial1;
42
+typedef ForwardSerial1Class< decltype(Serial1) > DefaultSerial2;
43
+typedef ForwardSerial1Class< decltype(Serial2) > DefaultSerial3;
44
+typedef ForwardSerial1Class< decltype(Serial3) > DefaultSerial4;
45
+extern DefaultSerial1 MSerial0;
46
+extern DefaultSerial2 MSerial1;
47
+extern DefaultSerial3 MSerial2;
48
+extern DefaultSerial4 MSerial3;
49 49
 
50 50
 #define _MSERIAL(X) MSerial##X
51 51
 #define MSERIAL(X) _MSERIAL(X)
52
-#define MSerial0 MSerial
53 52
 
54
-// Define MYSERIAL0/1 before MarlinSerial includes!
53
+// Define MYSERIAL1/2 before MarlinSerial includes!
55 54
 #if SERIAL_PORT == -1 || ENABLED(EMERGENCY_PARSER)
56
-  #define MYSERIAL0 customizedSerial1
55
+  #define MYSERIAL1 customizedSerial1
57 56
 #elif WITHIN(SERIAL_PORT, 0, 3)
58
-  #define MYSERIAL0 MSERIAL(SERIAL_PORT)
57
+  #define MYSERIAL1 MSERIAL(SERIAL_PORT)
59 58
 #else
60 59
   #error "The required SERIAL_PORT must be from -1 to 3. Please update your configuration."
61 60
 #endif
62 61
 
63 62
 #ifdef SERIAL_PORT_2
64 63
   #if SERIAL_PORT_2 == -1 || ENABLED(EMERGENCY_PARSER)
65
-    #define MYSERIAL1 customizedSerial2
64
+    #define MYSERIAL2 customizedSerial2
66 65
   #elif WITHIN(SERIAL_PORT_2, 0, 3)
67
-    #define MYSERIAL1 MSERIAL(SERIAL_PORT_2)
66
+    #define MYSERIAL2 MSERIAL(SERIAL_PORT_2)
68 67
   #else
69 68
     #error "SERIAL_PORT_2 must be from -1 to 3. Please update your configuration."
70 69
   #endif

+ 2
- 2
Marlin/src/HAL/DUE/MarlinSerial.h Zobrazit soubor

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

+ 1
- 1
Marlin/src/HAL/DUE/MarlinSerialUSB.h Zobrazit soubor

@@ -50,7 +50,7 @@ struct MarlinSerialUSB {
50 50
     FORCE_INLINE int rxMaxEnqueued() { return 0; }
51 51
   #endif
52 52
 };
53
-typedef Serial0Type<MarlinSerialUSB> MSerialT;
53
+typedef Serial1Class<MarlinSerialUSB> MSerialT;
54 54
 
55 55
 #if SERIAL_PORT == -1
56 56
   extern MSerialT customizedSerial1;

+ 1
- 1
Marlin/src/HAL/ESP32/FlushableHardwareSerial.cpp Zobrazit soubor

@@ -24,6 +24,6 @@
24 24
 
25 25
 #include "FlushableHardwareSerial.h"
26 26
 
27
-Serial0Type<FlushableHardwareSerial> flushableSerial(false, 0);
27
+Serial1Class<FlushableHardwareSerial> flushableSerial(false, 0);
28 28
 
29 29
 #endif

+ 1
- 1
Marlin/src/HAL/ESP32/FlushableHardwareSerial.h Zobrazit soubor

@@ -31,4 +31,4 @@ public:
31 31
   FlushableHardwareSerial(int uart_nr) : HardwareSerial(uart_nr) {}
32 32
 };
33 33
 
34
-extern Serial0Type<FlushableHardwareSerial> flushableSerial;
34
+extern Serial1Class<FlushableHardwareSerial> flushableSerial;

+ 1
- 1
Marlin/src/HAL/ESP32/HAL.cpp Zobrazit soubor

@@ -41,7 +41,7 @@
41 41
 #endif
42 42
 
43 43
 #if ENABLED(ESP3D_WIFISUPPORT)
44
-  DefaultSerial MSerial(false, Serial2Socket);
44
+  DefaultSerial1 MSerial0(false, Serial2Socket);
45 45
 #endif
46 46
 
47 47
 // ------------------------

+ 5
- 5
Marlin/src/HAL/ESP32/HAL.h Zobrazit soubor

@@ -51,15 +51,15 @@
51 51
 
52 52
 extern portMUX_TYPE spinlock;
53 53
 
54
-#define MYSERIAL0 flushableSerial
54
+#define MYSERIAL1 flushableSerial
55 55
 
56 56
 #if EITHER(WIFISUPPORT, ESP3D_WIFISUPPORT)
57 57
   #if ENABLED(ESP3D_WIFISUPPORT)
58
-    typedef ForwardSerial0Type< decltype(Serial2Socket) > DefaultSerial;
59
-    extern DefaultSerial MSerial;
60
-    #define MYSERIAL1 MSerial
58
+    typedef ForwardSerial1Class< decltype(Serial2Socket) > DefaultSerial1;
59
+    extern DefaultSerial1 MSerial0;
60
+    #define MYSERIAL2 MSerial0
61 61
   #else
62
-    #define MYSERIAL1 webSocketSerial
62
+    #define MYSERIAL2 webSocketSerial
63 63
   #endif
64 64
 #endif
65 65
 

+ 1
- 1
Marlin/src/HAL/ESP32/WebSocketSerial.h Zobrazit soubor

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

+ 1
- 1
Marlin/src/HAL/LINUX/HAL.h Zobrazit soubor

@@ -61,7 +61,7 @@ uint8_t _getc();
61 61
 #define SHARED_SERVOS HAS_SERVOS
62 62
 
63 63
 extern MSerialT usb_serial;
64
-#define MYSERIAL0 usb_serial
64
+#define MYSERIAL1 usb_serial
65 65
 
66 66
 #define ST7920_DELAY_1 DELAY_NS(600)
67 67
 #define ST7920_DELAY_2 DELAY_NS(750)

+ 1
- 1
Marlin/src/HAL/LINUX/include/serial.h Zobrazit soubor

@@ -115,4 +115,4 @@ struct HalSerial {
115 115
   volatile bool host_connected;
116 116
 };
117 117
 
118
-typedef Serial0Type<HalSerial> MSerialT;
118
+typedef Serial1Class<HalSerial> MSerialT;

+ 2
- 2
Marlin/src/HAL/LINUX/main.cpp Zobrazit soubor

@@ -105,8 +105,8 @@ int main() {
105 105
   std::thread write_serial (write_serial_thread);
106 106
   std::thread read_serial (read_serial_thread);
107 107
 
108
-  #ifdef MYSERIAL0
109
-    MYSERIAL0.begin(BAUDRATE);
108
+  #ifdef MYSERIAL1
109
+    MYSERIAL1.begin(BAUDRATE);
110 110
     SERIAL_ECHOLNPGM("x86_64 Initialized");
111 111
     SERIAL_FLUSHTX();
112 112
   #endif

+ 1
- 1
Marlin/src/HAL/LPC1768/HAL.cpp Zobrazit soubor

@@ -29,7 +29,7 @@
29 29
   #include "watchdog.h"
30 30
 #endif
31 31
 
32
-DefaultSerial USBSerial(false, UsbSerial);
32
+DefaultSerial1 USBSerial(false, UsbSerial);
33 33
 
34 34
 uint32_t HAL_adc_reading = 0;
35 35
 

+ 6
- 7
Marlin/src/HAL/LPC1768/HAL.h Zobrazit soubor

@@ -60,26 +60,25 @@ extern "C" volatile uint32_t _millis;
60 60
   #define ST7920_DELAY_3 DELAY_NS(750)
61 61
 #endif
62 62
 
63
-typedef ForwardSerial0Type< decltype(UsbSerial) > DefaultSerial;
64
-extern DefaultSerial USBSerial;
63
+typedef ForwardSerial1Class< decltype(UsbSerial) > DefaultSerial1;
64
+extern DefaultSerial1 USBSerial;
65 65
 
66 66
 #define _MSERIAL(X) MSerial##X
67 67
 #define MSERIAL(X) _MSERIAL(X)
68
-#define MSerial0 MSerial
69 68
 
70 69
 #if SERIAL_PORT == -1
71
-  #define MYSERIAL0 USBSerial
70
+  #define MYSERIAL1 USBSerial
72 71
 #elif WITHIN(SERIAL_PORT, 0, 3)
73
-  #define MYSERIAL0 MSERIAL(SERIAL_PORT)
72
+  #define MYSERIAL1 MSERIAL(SERIAL_PORT)
74 73
 #else
75 74
   #error "SERIAL_PORT must be from -1 to 3. Please update your configuration."
76 75
 #endif
77 76
 
78 77
 #ifdef SERIAL_PORT_2
79 78
   #if SERIAL_PORT_2 == -1
80
-    #define MYSERIAL1 USBSerial
79
+    #define MYSERIAL2 USBSerial
81 80
   #elif WITHIN(SERIAL_PORT_2, 0, 3)
82
-    #define MYSERIAL1 MSERIAL(SERIAL_PORT_2)
81
+    #define MYSERIAL2 MSERIAL(SERIAL_PORT_2)
83 82
   #else
84 83
     #error "SERIAL_PORT_2 must be from -1 to 3. Please update your configuration."
85 84
   #endif

+ 2
- 2
Marlin/src/HAL/LPC1768/MarlinSerial.cpp Zobrazit soubor

@@ -26,7 +26,7 @@
26 26
 
27 27
 #if ANY_SERIAL_IS(0)
28 28
   MarlinSerial _MSerial(LPC_UART0);
29
-  MSerialT MSerial(true, _MSerial);
29
+  MSerialT MSerial0(true, _MSerial);
30 30
   extern "C" void UART0_IRQHandler() { _MSerial.IRQHandler(); }
31 31
 #endif
32 32
 #if ANY_SERIAL_IS(1)
@@ -51,7 +51,7 @@
51 51
     // Need to figure out which serial port we are and react in consequence (Marlin does not have CONTAINER_OF macro)
52 52
     if (false) {}
53 53
     #if ANY_SERIAL_IS(0)
54
-      else if (this == &_MSerial) emergency_parser.update(MSerial.emergency_state, c);
54
+      else if (this == &_MSerial) emergency_parser.update(MSerial0.emergency_state, c);
55 55
     #endif
56 56
     #if ANY_SERIAL_IS(1)
57 57
       else if (this == &_MSerial1) emergency_parser.update(MSerial1.emergency_state, c);

+ 2
- 2
Marlin/src/HAL/LPC1768/MarlinSerial.h Zobrazit soubor

@@ -54,8 +54,8 @@ public:
54 54
 // On LPC176x framework, HardwareSerial does not implement the same interface as Arduino's Serial, so overloads
55 55
 // of 'available' and 'read' method are not used in this multiple inheritance scenario.
56 56
 // Instead, use a ForwardSerial here that adapts the interface.
57
-typedef ForwardSerial0Type<MarlinSerial> MSerialT;
58
-extern MSerialT MSerial;
57
+typedef ForwardSerial1Class<MarlinSerial> MSerialT;
58
+extern MSerialT MSerial0;
59 59
 extern MSerialT MSerial1;
60 60
 extern MSerialT MSerial2;
61 61
 extern MSerialT MSerial3;

+ 5
- 5
Marlin/src/HAL/SAMD51/HAL.cpp Zobrazit soubor

@@ -26,19 +26,19 @@
26 26
 
27 27
 #ifdef ADAFRUIT_GRAND_CENTRAL_M4
28 28
   #if ANY_SERIAL_IS(-1)
29
-    DefaultSerial MSerial(false, Serial);
29
+    DefaultSerial1 MSerial0(false, Serial);
30 30
   #endif
31 31
   #if ANY_SERIAL_IS(0)
32
-    DefaultSerial1 MSerial1(false, Serial1);
32
+    DefaultSerial2 MSerial1(false, Serial1);
33 33
   #endif
34 34
   #if ANY_SERIAL_IS(1)
35
-    DefaultSerial2 MSerial2(false, Serial2);
35
+    DefaultSerial3 MSerial2(false, Serial2);
36 36
   #endif
37 37
   #if ANY_SERIAL_IS(2)
38
-    DefaultSerial3 MSerial3(false, Serial3);
38
+    DefaultSerial4 MSerial3(false, Serial3);
39 39
   #endif
40 40
   #if ANY_SERIAL_IS(3)
41
-    DefaultSerial4 MSerial4(false, Serial4);
41
+    DefaultSerial5 MSerial4(false, Serial4);
42 42
   #endif
43 43
 #endif
44 44
 

+ 18
- 18
Marlin/src/HAL/SAMD51/HAL.h Zobrazit soubor

@@ -32,36 +32,36 @@
32 32
   #include "MarlinSerial_AGCM4.h"
33 33
 
34 34
   // Serial ports
35
-  typedef ForwardSerial0Type< decltype(Serial) > DefaultSerial;
36
-  typedef ForwardSerial0Type< decltype(Serial1) > DefaultSerial1;
37
-  typedef ForwardSerial0Type< decltype(Serial2) > DefaultSerial2;
38
-  typedef ForwardSerial0Type< decltype(Serial3) > DefaultSerial3;
39
-  typedef ForwardSerial0Type< decltype(Serial4) > DefaultSerial4;
40
-  extern DefaultSerial MSerial;
41
-  extern DefaultSerial1 MSerial1;
42
-  extern DefaultSerial2 MSerial2;
43
-  extern DefaultSerial3 MSerial3;
44
-  extern DefaultSerial4 MSerial4;
45
-
46
-  // MYSERIAL0 required before MarlinSerial includes!
35
+  typedef ForwardSerial1Class< decltype(Serial) > DefaultSerial1;
36
+  typedef ForwardSerial1Class< decltype(Serial1) > DefaultSerial2;
37
+  typedef ForwardSerial1Class< decltype(Serial2) > DefaultSerial3;
38
+  typedef ForwardSerial1Class< decltype(Serial3) > DefaultSerial4;
39
+  typedef ForwardSerial1Class< decltype(Serial4) > DefaultSerial5;
40
+  extern DefaultSerial1 MSerial0;
41
+  extern DefaultSerial2 MSerial1;
42
+  extern DefaultSerial3 MSerial2;
43
+  extern DefaultSerial4 MSerial3;
44
+  extern DefaultSerial5 MSerial4;
45
+
46
+  // MYSERIAL1 required before MarlinSerial includes!
47 47
 
48 48
   #define __MSERIAL(X) MSerial##X
49 49
   #define _MSERIAL(X) __MSERIAL(X)
50 50
   #define MSERIAL(X) _MSERIAL(INCREMENT(X))
51 51
 
52 52
   #if SERIAL_PORT == -1
53
-    #define MYSERIAL0 MSerial
53
+    #define MYSERIAL1 MSerial0
54 54
   #elif WITHIN(SERIAL_PORT, 0, 3)
55
-    #define MYSERIAL0 MSERIAL(SERIAL_PORT)
55
+    #define MYSERIAL1 MSERIAL(SERIAL_PORT)
56 56
   #else
57 57
     #error "SERIAL_PORT must be from -1 to 3. Please update your configuration."
58 58
   #endif
59 59
 
60 60
   #ifdef SERIAL_PORT_2
61 61
     #if SERIAL_PORT_2 == -1
62
-      #define MYSERIAL1 MSerial
62
+      #define MYSERIAL2 MSerial0
63 63
     #elif WITHIN(SERIAL_PORT_2, 0, 3)
64
-      #define MYSERIAL1 MSERIAL(SERIAL_PORT_2)
64
+      #define MYSERIAL2 MSERIAL(SERIAL_PORT_2)
65 65
     #else
66 66
       #error "SERIAL_PORT_2 must be from -1 to 3. Please update your configuration."
67 67
     #endif
@@ -69,7 +69,7 @@
69 69
 
70 70
   #ifdef MMU2_SERIAL_PORT
71 71
     #if MMU2_SERIAL_PORT == -1
72
-      #define MMU2_SERIAL MSerial
72
+      #define MMU2_SERIAL MSerial0
73 73
     #elif WITHIN(MMU2_SERIAL_PORT, 0, 3)
74 74
       #define MMU2_SERIAL MSERIAL(MMU2_SERIAL_PORT)
75 75
     #else
@@ -79,7 +79,7 @@
79 79
 
80 80
   #ifdef LCD_SERIAL_PORT
81 81
     #if LCD_SERIAL_PORT == -1
82
-      #define LCD_SERIAL MSerial
82
+      #define LCD_SERIAL MSerial0
83 83
     #elif WITHIN(LCD_SERIAL_PORT, 0, 3)
84 84
       #define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT)
85 85
     #else

+ 1
- 1
Marlin/src/HAL/SAMD51/MarlinSerial_AGCM4.h Zobrazit soubor

@@ -22,7 +22,7 @@
22 22
 
23 23
 #include "../../core/serial_hook.h"
24 24
 
25
-typedef Serial0Type<Uart> UartT;
25
+typedef Serial1Class<Uart> UartT;
26 26
 
27 27
 extern UartT Serial2;
28 28
 extern UartT Serial3;

+ 1
- 1
Marlin/src/HAL/STM32/HAL.cpp Zobrazit soubor

@@ -29,7 +29,7 @@
29 29
 #include "../shared/Delay.h"
30 30
 
31 31
 #ifdef USBCON
32
-  DefaultSerial MSerial(false, SerialUSB);
32
+  DefaultSerial1 MSerial0(false, SerialUSB);
33 33
 #endif
34 34
 
35 35
 #if ENABLED(SRAM_EEPROM_EMULATION)

+ 8
- 8
Marlin/src/HAL/STM32/HAL.h Zobrazit soubor

@@ -40,8 +40,8 @@
40 40
 #ifdef USBCON
41 41
   #include <USBSerial.h>
42 42
   #include "../../core/serial_hook.h"
43
-  typedef ForwardSerial0Type< decltype(SerialUSB) > DefaultSerial;
44
-  extern DefaultSerial MSerial;
43
+  typedef ForwardSerial1Class< decltype(SerialUSB) > DefaultSerial1;
44
+  extern DefaultSerial1 MSerial0;
45 45
 #endif
46 46
 
47 47
 // ------------------------
@@ -51,18 +51,18 @@
51 51
 #define MSERIAL(X) _MSERIAL(X)
52 52
 
53 53
 #if SERIAL_PORT == -1
54
-  #define MYSERIAL0 MSerial
54
+  #define MYSERIAL1 MSerial0
55 55
 #elif WITHIN(SERIAL_PORT, 1, 6)
56
-  #define MYSERIAL0 MSERIAL(SERIAL_PORT)
56
+  #define MYSERIAL1 MSERIAL(SERIAL_PORT)
57 57
 #else
58 58
   #error "SERIAL_PORT must be -1 or from 1 to 6. Please update your configuration."
59 59
 #endif
60 60
 
61 61
 #ifdef SERIAL_PORT_2
62 62
   #if SERIAL_PORT_2 == -1
63
-    #define MYSERIAL1 MSerial
63
+    #define MYSERIAL2 MSerial0
64 64
   #elif WITHIN(SERIAL_PORT_2, 1, 6)
65
-    #define MYSERIAL1 MSERIAL(SERIAL_PORT_2)
65
+    #define MYSERIAL2 MSERIAL(SERIAL_PORT_2)
66 66
   #else
67 67
     #error "SERIAL_PORT_2 must be -1 or from 1 to 6. Please update your configuration."
68 68
   #endif
@@ -70,7 +70,7 @@
70 70
 
71 71
 #ifdef MMU2_SERIAL_PORT
72 72
   #if MMU2_SERIAL_PORT == -1
73
-    #define MMU2_SERIAL MSerial
73
+    #define MMU2_SERIAL MSerial0
74 74
   #elif WITHIN(MMU2_SERIAL_PORT, 1, 6)
75 75
     #define MMU2_SERIAL MSERIAL(MMU2_SERIAL_PORT)
76 76
   #else
@@ -80,7 +80,7 @@
80 80
 
81 81
 #ifdef LCD_SERIAL_PORT
82 82
   #if LCD_SERIAL_PORT == -1
83
-    #define LCD_SERIAL MSerial
83
+    #define LCD_SERIAL MSerial0
84 84
   #elif WITHIN(LCD_SERIAL_PORT, 1, 6)
85 85
     #define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT)
86 86
   #else

+ 1
- 1
Marlin/src/HAL/STM32/MarlinSerial.h Zobrazit soubor

@@ -42,7 +42,7 @@ protected:
42 42
   usart_rx_callback_t _rx_callback;
43 43
 };
44 44
 
45
-typedef Serial0Type<MarlinSerial> MSerialT;
45
+typedef Serial1Class<MarlinSerial> MSerialT;
46 46
 extern MSerialT MSerial1;
47 47
 extern MSerialT MSerial2;
48 48
 extern MSerialT MSerial3;

+ 2
- 2
Marlin/src/HAL/STM32F1/HAL.cpp Zobrazit soubor

@@ -84,7 +84,7 @@
84 84
 
85 85
 #if defined(SERIAL_USB) && !HAS_SD_HOST_DRIVE
86 86
   USBSerial SerialUSB;
87
-  DefaultSerial MSerial(true, SerialUSB);
87
+  DefaultSerial1 MSerial0(true, SerialUSB);
88 88
 
89 89
   #if ENABLED(EMERGENCY_PARSER)
90 90
     #include "../libmaple/usb/stm32f1/usb_reg_map.h"
@@ -107,7 +107,7 @@
107 107
       len = usb_cdcacm_peek(buf, total);
108 108
 
109 109
       for (uint32 i = 0; i < len; i++)
110
-        emergency_parser.update(MSerial.emergency_state, buf[i + total - len]);
110
+        emergency_parser.update(MSerial0.emergency_state, buf[i + total - len]);
111 111
     }
112 112
   #endif
113 113
 #endif

+ 7
- 7
Marlin/src/HAL/STM32F1/HAL.h Zobrazit soubor

@@ -61,11 +61,11 @@
61 61
 #endif
62 62
 
63 63
 #ifdef SERIAL_USB
64
-  typedef ForwardSerial0Type< USBSerial > DefaultSerial;
65
-  extern DefaultSerial MSerial;
64
+  typedef ForwardSerial1Class< USBSerial > DefaultSerial1;
65
+  extern DefaultSerial1 MSerial0;
66 66
 
67 67
   #if !HAS_SD_HOST_DRIVE
68
-    #define UsbSerial MSerial
68
+    #define UsbSerial MSerial0
69 69
   #else
70 70
     #define UsbSerial MarlinCompositeSerial
71 71
   #endif
@@ -81,9 +81,9 @@
81 81
 #endif
82 82
 
83 83
 #if SERIAL_PORT == -1
84
-  #define MYSERIAL0 UsbSerial
84
+  #define MYSERIAL1 UsbSerial
85 85
 #elif WITHIN(SERIAL_PORT, 1, NUM_UARTS)
86
-  #define MYSERIAL0 MSERIAL(SERIAL_PORT)
86
+  #define MYSERIAL1 MSERIAL(SERIAL_PORT)
87 87
 #elif NUM_UARTS == 5
88 88
   #error "SERIAL_PORT must be -1 or from 1 to 5. Please update your configuration."
89 89
 #else
@@ -92,9 +92,9 @@
92 92
 
93 93
 #ifdef SERIAL_PORT_2
94 94
   #if SERIAL_PORT_2 == -1
95
-    #define MYSERIAL1 UsbSerial
95
+    #define MYSERIAL2 UsbSerial
96 96
   #elif WITHIN(SERIAL_PORT_2, 1, NUM_UARTS)
97
-    #define MYSERIAL1 MSERIAL(SERIAL_PORT_2)
97
+    #define MYSERIAL2 MSERIAL(SERIAL_PORT_2)
98 98
   #elif NUM_UARTS == 5
99 99
     #error "SERIAL_PORT_2 must be -1 or from 1 to 5. Please update your configuration."
100 100
   #else

+ 3
- 3
Marlin/src/HAL/STM32F1/HAL_MinSerial.cpp Zobrazit soubor

@@ -44,8 +44,8 @@ static void TXBegin() {
44 44
     #warning "Using POSTMORTEM_DEBUGGING requires a physical U(S)ART hardware in case of severe error."
45 45
     #warning "Disabling the severe error reporting feature currently because the used serial port is not a HW port."
46 46
   #else
47
-    // We use MYSERIAL0 here, so we need to figure out how to get the linked register
48
-    struct usart_dev* dev = MYSERIAL0.c_dev();
47
+    // We use MYSERIAL1 here, so we need to figure out how to get the linked register
48
+    struct usart_dev* dev = MYSERIAL1.c_dev();
49 49
 
50 50
     // Or use this if removing libmaple
51 51
     // int irq = dev->irq_num;
@@ -80,7 +80,7 @@ static void TXBegin() {
80 80
 #define sw_barrier() __asm__ volatile("": : :"memory");
81 81
 static void TX(char c) {
82 82
   #if WITHIN(SERIAL_PORT, 1, 6)
83
-    struct usart_dev* dev = MYSERIAL0.c_dev();
83
+    struct usart_dev* dev = MYSERIAL1.c_dev();
84 84
     while (!(dev->regs->SR & USART_SR_TXE)) {
85 85
       TERN_(USE_WATCHDOG, HAL_watchdog_refresh());
86 86
       sw_barrier();

+ 3
- 3
Marlin/src/HAL/STM32F1/MarlinSerial.cpp Zobrazit soubor

@@ -134,12 +134,12 @@ constexpr bool IsSerialClassAllowed(const HardwareSerial&) { return false; }
134 134
 // If you encounter this error, replace SerialX with MSerialX, for example MSerial3.
135 135
 
136 136
 // Non-TMC ports were already validated in HAL.h, so do not require verbose error messages.
137
-#ifdef MYSERIAL0
138
-  CHECK_CFG_SERIAL(MYSERIAL0);
139
-#endif
140 137
 #ifdef MYSERIAL1
141 138
   CHECK_CFG_SERIAL(MYSERIAL1);
142 139
 #endif
140
+#ifdef MYSERIAL2
141
+  CHECK_CFG_SERIAL(MYSERIAL2);
142
+#endif
143 143
 #ifdef LCD_SERIAL
144 144
   CHECK_CFG_SERIAL(LCD_SERIAL);
145 145
 #endif

+ 1
- 1
Marlin/src/HAL/STM32F1/MarlinSerial.h Zobrazit soubor

@@ -47,7 +47,7 @@ struct MarlinSerial : public HardwareSerial {
47 47
   #endif
48 48
 };
49 49
 
50
-typedef Serial0Type<MarlinSerial> MSerialT;
50
+typedef Serial1Class<MarlinSerial> MSerialT;
51 51
 
52 52
 extern MSerialT MSerial1;
53 53
 extern MSerialT MSerial2;

+ 1
- 1
Marlin/src/HAL/STM32F1/msc_sd.cpp Zobrazit soubor

@@ -24,7 +24,7 @@
24 24
 #define PRODUCT_ID 0x29
25 25
 
26 26
 USBMassStorage MarlinMSC;
27
-Serial0Type<USBCompositeSerial> MarlinCompositeSerial(true);
27
+Serial1Class<USBCompositeSerial> MarlinCompositeSerial(true);
28 28
 
29 29
 #include "../../inc/MarlinConfig.h"
30 30
 

+ 1
- 1
Marlin/src/HAL/STM32F1/msc_sd.h Zobrazit soubor

@@ -21,6 +21,6 @@
21 21
 #include "../../core/serial_hook.h"
22 22
 
23 23
 extern USBMassStorage MarlinMSC;
24
-extern Serial0Type<USBCompositeSerial> MarlinCompositeSerial;
24
+extern Serial1Class<USBCompositeSerial> MarlinCompositeSerial;
25 25
 
26 26
 void MSC_SD_init();

+ 1
- 1
Marlin/src/HAL/TEENSY31_32/HAL.cpp Zobrazit soubor

@@ -31,7 +31,7 @@
31 31
 
32 32
 #include <Wire.h>
33 33
 
34
-DefaultSerial MSerial(false);
34
+DefaultSerial1 MSerial0(false);
35 35
 USBSerialType USBSerial(false, SerialUSB);
36 36
 
37 37
 uint16_t HAL_adc_result;

+ 5
- 6
Marlin/src/HAL/TEENSY31_32/HAL.h Zobrazit soubor

@@ -51,19 +51,18 @@
51 51
 #endif
52 52
 
53 53
 #include "../../core/serial_hook.h"
54
-typedef Serial0Type<decltype(Serial)> DefaultSerial;
55
-extern DefaultSerial MSerial;
56
-typedef ForwardSerial0Type<decltype(SerialUSB)> USBSerialType;
54
+typedef Serial1Class<decltype(Serial)> DefaultSerial1;
55
+extern DefaultSerial1 MSerial0;
56
+typedef ForwardSerial1Class<decltype(SerialUSB)> USBSerialType;
57 57
 extern USBSerialType USBSerial;
58 58
 
59 59
 #define _MSERIAL(X) MSerial##X
60 60
 #define MSERIAL(X) _MSERIAL(X)
61
-#define MSerial0 MSerial
62 61
 
63 62
 #if SERIAL_PORT == -1
64
-  #define MYSERIAL0 USBSerial
63
+  #define MYSERIAL1 USBSerial
65 64
 #elif WITHIN(SERIAL_PORT, 0, 3)
66
-  #define MYSERIAL0 MSERIAL(SERIAL_PORT)
65
+  #define MYSERIAL1 MSERIAL(SERIAL_PORT)
67 66
 #endif
68 67
 
69 68
 #define HAL_SERVO_LIB libServo

+ 1
- 1
Marlin/src/HAL/TEENSY35_36/HAL.cpp Zobrazit soubor

@@ -31,7 +31,7 @@
31 31
 
32 32
 #include <Wire.h>
33 33
 
34
-DefaultSerial MSerial(false);
34
+DefaultSerial1 MSerial0(false);
35 35
 USBSerialType USBSerial(false, SerialUSB);
36 36
 
37 37
 uint16_t HAL_adc_result, HAL_adc_select;

+ 5
- 6
Marlin/src/HAL/TEENSY35_36/HAL.h Zobrazit soubor

@@ -54,19 +54,18 @@
54 54
 #endif
55 55
 
56 56
 #include "../../core/serial_hook.h"
57
-typedef Serial0Type<decltype(Serial)> DefaultSerial;
58
-extern DefaultSerial MSerial;
59
-typedef ForwardSerial0Type<decltype(SerialUSB)> USBSerialType;
57
+typedef Serial1Class<decltype(Serial)> DefaultSerial1;
58
+extern DefaultSerial1 MSerial0;
59
+typedef ForwardSerial1Class<decltype(SerialUSB)> USBSerialType;
60 60
 extern USBSerialType USBSerial;
61 61
 
62 62
 #define _MSERIAL(X) MSerial##X
63 63
 #define MSERIAL(X) _MSERIAL(X)
64
-#define MSerial0 MSerial
65 64
 
66 65
 #if SERIAL_PORT == -1
67
-  #define MYSERIAL0 USBSerial
66
+  #define MYSERIAL1 USBSerial
68 67
 #elif WITHIN(SERIAL_PORT, 0, 3)
69
-  #define MYSERIAL0 MSERIAL(SERIAL_PORT)
68
+  #define MYSERIAL1 MSERIAL(SERIAL_PORT)
70 69
 #endif
71 70
 
72 71
 #define HAL_SERVO_LIB libServo

+ 1
- 1
Marlin/src/HAL/TEENSY40_41/HAL.cpp Zobrazit soubor

@@ -32,7 +32,7 @@
32 32
 
33 33
 #include <Wire.h>
34 34
 
35
-DefaultSerial MSerial(false);
35
+DefaultSerial1 MSerial0(false);
36 36
 USBSerialType USBSerial(false, SerialUSB);
37 37
 
38 38
 uint16_t HAL_adc_result, HAL_adc_select;

+ 8
- 9
Marlin/src/HAL/TEENSY40_41/HAL.h Zobrazit soubor

@@ -56,30 +56,29 @@
56 56
 #endif
57 57
 
58 58
 #include "../../core/serial_hook.h"
59
-typedef Serial0Type<decltype(Serial)> DefaultSerial;
60
-extern DefaultSerial MSerial;
61
-typedef ForwardSerial0Type<decltype(SerialUSB)> USBSerialType;
59
+typedef Serial1Class<decltype(Serial)> DefaultSerial1;
60
+extern DefaultSerial1 MSerial0;
61
+typedef ForwardSerial1Class<decltype(SerialUSB)> USBSerialType;
62 62
 extern USBSerialType USBSerial;
63 63
 
64 64
 #define _MSERIAL(X) MSerial##X
65 65
 #define MSERIAL(X) _MSERIAL(X)
66
-#define MSerial0 MSerial
67 66
 
68 67
 #if SERIAL_PORT == -1
69
-  #define MYSERIAL0 SerialUSB
68
+  #define MYSERIAL1 SerialUSB
70 69
 #elif WITHIN(SERIAL_PORT, 0, 8)
71
-  #define MYSERIAL0 MSERIAL(SERIAL_PORT)
70
+  #define MYSERIAL1 MSERIAL(SERIAL_PORT)
72 71
 #else
73 72
   #error "The required SERIAL_PORT must be from -1 to 8. Please update your configuration."
74 73
 #endif
75 74
 
76 75
 #ifdef SERIAL_PORT_2
77 76
   #if SERIAL_PORT_2 == -1
78
-    #define MYSERIAL1 usbSerial
77
+    #define MYSERIAL2 usbSerial
79 78
   #elif SERIAL_PORT_2 == -2
80
-    #define MYSERIAL1 ethernet.telnetClient
79
+    #define MYSERIAL2 ethernet.telnetClient
81 80
   #elif WITHIN(SERIAL_PORT_2, 0, 8)
82
-    #define MYSERIAL1 MSERIAL(SERIAL_PORT_2)
81
+    #define MYSERIAL2 MSERIAL(SERIAL_PORT_2)
83 82
   #else
84 83
     #error "SERIAL_PORT_2 must be from -2 to 8. Please update your configuration."
85 84
   #endif

+ 3
- 3
Marlin/src/core/serial.cpp Zobrazit soubor

@@ -43,12 +43,12 @@ PGMSTR(SP_X_LBL, " X:"); PGMSTR(SP_Y_LBL, " Y:"); PGMSTR(SP_Z_LBL, " Z:"); PGMST
43 43
   #else
44 44
     #if HAS_ETHERNET
45 45
       // Runtime checking of the condition variable
46
-      ConditionalSerial<decltype(MYSERIAL1)> serialOut1(ethernet.have_telnet_client, MYSERIAL1, false); // Takes reference here
46
+      ConditionalSerial<decltype(MYSERIAL2)> serialOut2(ethernet.have_telnet_client, MYSERIAL2, false); // Takes reference here
47 47
     #else
48 48
       // Don't pay for runtime checking a true variable, instead use the output directly
49
-      #define serialOut1 MYSERIAL1
49
+      #define serialOut2 MYSERIAL2
50 50
     #endif
51
-    SerialOutputT multiSerial(MYSERIAL0, serialOut1);
51
+    SerialOutputT multiSerial(MYSERIAL1, serialOut2);
52 52
   #endif
53 53
 #endif
54 54
 

+ 4
- 4
Marlin/src/core/serial.h Zobrazit soubor

@@ -69,15 +69,15 @@ extern uint8_t marlin_debug_flags;
69 69
   #ifdef SERIAL_CATCHALL
70 70
     typedef MultiSerial<decltype(MYSERIAL), decltype(SERIAL_CATCHALL), 0> SerialOutputT;
71 71
   #else
72
-    typedef MultiSerial<decltype(MYSERIAL0), TERN(HAS_ETHERNET, ConditionalSerial<decltype(MYSERIAL1)>, decltype(MYSERIAL1)), 0> SerialOutputT;
72
+    typedef MultiSerial<decltype(MYSERIAL1), TERN(HAS_ETHERNET, ConditionalSerial<decltype(MYSERIAL2)>, decltype(MYSERIAL2)), 0> SerialOutputT;
73 73
   #endif
74
-  extern SerialOutputT        multiSerial;
75
-  #define _SERIAL_IMPL        multiSerial
74
+  extern SerialOutputT multiSerial;
75
+  #define _SERIAL_IMPL multiSerial
76 76
 #else
77 77
   #define _PORT_REDIRECT(n,p) NOOP
78 78
   #define _PORT_RESTORE(n)    NOOP
79 79
   #define SERIAL_ASSERT(P)    NOOP
80
-  #define _SERIAL_IMPL        MYSERIAL0
80
+  #define _SERIAL_IMPL MYSERIAL1
81 81
 #endif
82 82
 
83 83
 #if ENABLED(MEATPACK)

+ 3
- 3
Marlin/src/core/serial_hook.h Zobrazit soubor

@@ -257,8 +257,8 @@ struct MultiSerial : public SerialBase< MultiSerial<Serial0T, Serial1T, offset,
257 257
 };
258 258
 
259 259
 // Build the actual serial object depending on current configuration
260
-#define Serial0Type TERN(SERIAL_RUNTIME_HOOK, RuntimeSerial, BaseSerial)
261
-#define ForwardSerial0Type TERN(SERIAL_RUNTIME_HOOK, RuntimeSerial, ForwardSerial)
260
+#define Serial1Class TERN(SERIAL_RUNTIME_HOOK, RuntimeSerial, BaseSerial)
261
+#define ForwardSerial1Class TERN(SERIAL_RUNTIME_HOOK, RuntimeSerial, ForwardSerial)
262 262
 #ifdef HAS_MULTI_SERIAL
263
-  #define Serial1Type ConditionalSerial
263
+  #define Serial2Class ConditionalSerial
264 264
 #endif

+ 1
- 1
Marlin/src/feature/ethernet.cpp Zobrazit soubor

@@ -124,7 +124,7 @@ void MarlinEthernet::check() {
124 124
       if (!Ethernet.localIP()) break;
125 125
 
126 126
       SERIAL_ECHOPGM("Successfully started telnet server with IP ");
127
-      MYSERIAL0.println(Ethernet.localIP());
127
+      MYSERIAL1.println(Ethernet.localIP());
128 128
 
129 129
       linkState = LINKED;
130 130
       break;

+ 2
- 2
Marlin/src/gcode/config/M575.cpp Zobrazit soubor

@@ -61,10 +61,10 @@ void GcodeSuite::M575() {
61 61
 
62 62
       SERIAL_FLUSH();
63 63
 
64
-      if (set0) { MYSERIAL0.end(); MYSERIAL0.begin(baud); }
64
+      if (set0) { MYSERIAL1.end(); MYSERIAL1.begin(baud); }
65 65
 
66 66
       #if HAS_MULTI_SERIAL
67
-        if (set1) { MYSERIAL1.end(); MYSERIAL1.begin(baud); }
67
+        if (set1) { MYSERIAL2.end(); MYSERIAL2.begin(baud); }
68 68
       #endif
69 69
 
70 70
     } break;

+ 4
- 4
Marlin/src/gcode/control/M111.cpp Zobrazit soubor

@@ -57,19 +57,19 @@ void GcodeSuite::M111() {
57 57
     SERIAL_ECHOPGM(STR_DEBUG_OFF);
58 58
     #if !defined(__AVR__) || !defined(USBCON)
59 59
       #if ENABLED(SERIAL_STATS_RX_BUFFER_OVERRUNS)
60
-        SERIAL_ECHOPAIR("\nBuffer Overruns: ", MYSERIAL0.buffer_overruns());
60
+        SERIAL_ECHOPAIR("\nBuffer Overruns: ", MYSERIAL1.buffer_overruns());
61 61
       #endif
62 62
 
63 63
       #if ENABLED(SERIAL_STATS_RX_FRAMING_ERRORS)
64
-        SERIAL_ECHOPAIR("\nFraming Errors: ", MYSERIAL0.framing_errors());
64
+        SERIAL_ECHOPAIR("\nFraming Errors: ", MYSERIAL1.framing_errors());
65 65
       #endif
66 66
 
67 67
       #if ENABLED(SERIAL_STATS_DROPPED_RX)
68
-        SERIAL_ECHOPAIR("\nDropped bytes: ", MYSERIAL0.dropped());
68
+        SERIAL_ECHOPAIR("\nDropped bytes: ", MYSERIAL1.dropped());
69 69
       #endif
70 70
 
71 71
       #if ENABLED(SERIAL_STATS_MAX_RX_QUEUED)
72
-        SERIAL_ECHOPAIR("\nMax RX Queue Size: ", MYSERIAL0.rxMaxEnqueued());
72
+        SERIAL_ECHOPAIR("\nMax RX Queue Size: ", MYSERIAL1.rxMaxEnqueued());
73 73
       #endif
74 74
     #endif // !__AVR__ || !USBCON
75 75
   }

+ 2
- 2
Marlin/src/gcode/queue.cpp Zobrazit soubor

@@ -635,10 +635,10 @@ void GCodeQueue::advance() {
635 635
 
636 636
         #if !defined(__AVR__) || !defined(USBCON)
637 637
           #if ENABLED(SERIAL_STATS_DROPPED_RX)
638
-            SERIAL_ECHOLNPAIR("Dropped bytes: ", MYSERIAL0.dropped());
638
+            SERIAL_ECHOLNPAIR("Dropped bytes: ", MYSERIAL1.dropped());
639 639
           #endif
640 640
           #if ENABLED(SERIAL_STATS_MAX_RX_QUEUED)
641
-            SERIAL_ECHOLNPAIR("Max RX Queue Size: ", MYSERIAL0.rxMaxEnqueued());
641
+            SERIAL_ECHOLNPAIR("Max RX Queue Size: ", MYSERIAL1.rxMaxEnqueued());
642 642
           #endif
643 643
         #endif
644 644
 

+ 1
- 1
Marlin/src/lcd/extui/lib/mks_ui/draw_gcode.cpp Zobrazit soubor

@@ -80,7 +80,7 @@ void lv_serial_capt_hook(void * userPointer, uint8_t c)
80 80
 void lv_eom_hook(void *)
81 81
 {
82 82
   // Message is done, let's remove the hook now
83
-  MYSERIAL0.setHook();
83
+  MYSERIAL1.setHook();
84 84
   // We are back from the keyboard, so let's redraw ourselves
85 85
   draw_return_ui();
86 86
 }

+ 1
- 1
Marlin/src/lcd/extui/lib/mks_ui/draw_keyboard.cpp Zobrazit soubor

@@ -164,7 +164,7 @@ static void lv_kb_event_cb(lv_obj_t *kb, lv_event_t event) {
164 164
         case GCodeCommand:
165 165
           if (!queue.ring_buffer.full(3)) {
166 166
             // Hook anything that goes to the serial port
167
-            MYSERIAL0.setHook(lv_serial_capt_hook, lv_eom_hook, 0);
167
+            MYSERIAL1.setHook(lv_serial_capt_hook, lv_eom_hook, 0);
168 168
             queue.enqueue_one_now(ret_ta_txt);
169 169
           }
170 170
           lv_clear_keyboard();

+ 2
- 2
Marlin/src/lcd/extui/malyan_lcd.cpp Zobrazit soubor

@@ -414,8 +414,8 @@ void update_usb_status(const bool forceUpdate) {
414 414
   // This is mildly different than stock, which
415 415
   // appears to use the usb discovery status.
416 416
   // This is more logical.
417
-  if (last_usb_connected_status != MYSERIAL0.connected() || forceUpdate) {
418
-    last_usb_connected_status = MYSERIAL0.connected();
417
+  if (last_usb_connected_status != MYSERIAL1.connected() || forceUpdate) {
418
+    last_usb_connected_status = MYSERIAL1.connected();
419 419
     write_to_lcd_P(last_usb_connected_status ? PSTR("{R:UC}\r\n") : PSTR("{R:UD}\r\n"));
420 420
   }
421 421
 }

+ 1
- 1
Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.cpp Zobrazit soubor

@@ -54,7 +54,7 @@
54 54
   #define UHS_DEVICE_WINDOWS_USB_SPEC_VIOLATION_DESCRIPTOR_DEVICE 1
55 55
   #define UHS_HOST_MAX_INTERFACE_DRIVERS 2
56 56
   #define MASS_MAX_SUPPORTED_LUN 1
57
-  #define USB_HOST_SERIAL MYSERIAL0
57
+  #define USB_HOST_SERIAL MYSERIAL1
58 58
 
59 59
   // Workaround for certain issues with UHS3
60 60
   #define SKIP_PAGE3F // Required for IOGEAR media adapter

+ 1
- 1
Marlin/src/sd/usb_flashdrive/lib-uhs2/settings.h Zobrazit soubor

@@ -66,7 +66,7 @@
66 66
  * For example Serial3.
67 67
  */
68 68
 #if ENABLED(USB_FLASH_DRIVE_SUPPORT)
69
-  #define USB_HOST_SERIAL MYSERIAL0
69
+  #define USB_HOST_SERIAL MYSERIAL1
70 70
 #endif
71 71
 
72 72
 #ifndef USB_HOST_SERIAL

+ 2
- 2
docs/Serial.md Zobrazit soubor

@@ -32,12 +32,12 @@ This is easily done via type definition of the feature.
32 32
 
33 33
 For example, to create a single serial interface with 2 serial outputs (one enabled at runtime and the other switchable):
34 34
 ```cpp
35
-typedef MultiSerial< RuntimeSerial<Serial>, ConditionalSerial<TelnetClient> > Serial0Type;
35
+typedef MultiSerial< RuntimeSerial<Serial>, ConditionalSerial<TelnetClient> > Serial1Class;
36 36
 ```
37 37
 
38 38
 To send the same output to 4 serial ports you could nest `MultiSerial` like this:
39 39
 ```cpp
40
-typedef MultiSerial< MultiSerial< BaseSerial<Serial>, BaseSerial<Serial1> >, MultiSerial< BaseSerial<Serial2>, BaseSerial<Serial3>, 2, 1>, 0, 2> Serial0Type;
40
+typedef MultiSerial< MultiSerial< BaseSerial<Serial>, BaseSerial<Serial1> >, MultiSerial< BaseSerial<Serial2>, BaseSerial<Serial3>, 2, 1>, 0, 2> Serial1Class;
41 41
 ```
42 42
 The magical numbers here are the step and offset for computing the serial port. Simplifying the above monster a bit:
43 43
 ```cpp

Loading…
Zrušit
Uložit