Ver código fonte

Fix DUE HAL serial defines (#15536)

Bo Herrmannsen 4 anos atrás
pai
commit
5ad9257df4
1 arquivos alterados com 28 adições e 11 exclusões
  1. 28
    11
      Marlin/src/HAL/HAL_DUE/HAL.h

+ 28
- 11
Marlin/src/HAL/HAL_DUE/HAL.h Ver arquivo

@@ -38,22 +38,39 @@
38 38
 
39 39
 #include <stdint.h>
40 40
 
41
-// Serial ports
42
-#if !WITHIN(SERIAL_PORT, -1, 3)
43
-  #error "SERIAL_PORT must be from -1 to 3"
41
+// Define MYSERIAL0/1 before MarlinSerial includes!
42
+#if SERIAL_PORT == -1
43
+  #define MYSERIAL0 Serial1
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
52
+#else
53
+  #error "The required SERIAL_PORT must be from -1 to 3. Please update your configuration."
44 54
 #endif
45 55
 
46
-// MYSERIAL0 required before MarlinSerial includes!
47
-#define MYSERIAL0 customizedSerial1
48
-
49 56
 #ifdef SERIAL_PORT_2
50
-  #if !WITHIN(SERIAL_PORT_2, -1, 3)
51
-    #error "SERIAL_PORT_2 must be from -1 to 3"
52
-  #elif SERIAL_PORT_2 == SERIAL_PORT
53
-    #error "SERIAL_PORT_2 must be different than SERIAL_PORT"
57
+  #if SERIAL_PORT_2 == SERIAL_PORT
58
+    #error "SERIAL_PORT_2 must be different from SERIAL_PORT. Please update your configuration."
59
+  #endif
60
+  #if SERIAL_PORT_2 == -1
61
+    #define MYSERIAL1 Serial1
62
+  #elif SERIAL_PORT_2 == 0
63
+    #define MYSERIAL1 Serial
64
+  #elif SERIAL_PORT_2 == 1
65
+    #define MYSERIAL1 Serial1
66
+  #elif SERIAL_PORT_2 == 2
67
+    #define MYSERIAL1 Serial2
68
+  #elif SERIAL_PORT_2 == 3
69
+    #define MYSERIAL1 Serial3
70
+  #else
71
+    #error "SERIAL_PORT_2 must be from -1 to 3. Please update your configuration."
54 72
   #endif
55 73
   #define NUM_SERIAL 2
56
-  #define MYSERIAL1 customizedSerial2
57 74
 #else
58 75
   #define NUM_SERIAL 1
59 76
 #endif

Carregando…
Cancelar
Salvar