More detailed serial config error

This commit is contained in:
Scott Lahteine 2021-04-18 18:24:08 -05:00
parent dc6c977766
commit 550a806d77
9 changed files with 34 additions and 30 deletions

View file

@ -93,13 +93,13 @@ typedef int8_t pin_t;
#define MYSERIAL1 TERN(BLUETOOTH, btSerial, MSerial0) #define MYSERIAL1 TERN(BLUETOOTH, btSerial, MSerial0)
#else #else
#if !WITHIN(SERIAL_PORT, -1, 3) #if !WITHIN(SERIAL_PORT, -1, 3)
#error "SERIAL_PORT must be from -1 to 3. Please update your configuration." #error "SERIAL_PORT must be from 0 to 3. You can also use -1 if the board supports Native USB."
#endif #endif
#define MYSERIAL1 customizedSerial1 #define MYSERIAL1 customizedSerial1
#ifdef SERIAL_PORT_2 #ifdef SERIAL_PORT_2
#if !WITHIN(SERIAL_PORT_2, -1, 3) #if !WITHIN(SERIAL_PORT_2, -1, 3)
#error "SERIAL_PORT_2 must be from -1 to 3. Please update your configuration." #error "SERIAL_PORT_2 must be from 0 to 3. You can also use -1 if the board supports Native USB."
#endif #endif
#define MYSERIAL2 customizedSerial2 #define MYSERIAL2 customizedSerial2
#endif #endif
@ -107,14 +107,14 @@ typedef int8_t pin_t;
#ifdef MMU2_SERIAL_PORT #ifdef MMU2_SERIAL_PORT
#if !WITHIN(MMU2_SERIAL_PORT, -1, 3) #if !WITHIN(MMU2_SERIAL_PORT, -1, 3)
#error "MMU2_SERIAL_PORT must be from -1 to 3. Please update your configuration." #error "MMU2_SERIAL_PORT must be from 0 to 3. You can also use -1 if the board supports Native USB."
#endif #endif
#define MMU2_SERIAL mmuSerial #define MMU2_SERIAL mmuSerial
#endif #endif
#ifdef LCD_SERIAL_PORT #ifdef LCD_SERIAL_PORT
#if !WITHIN(LCD_SERIAL_PORT, -1, 3) #if !WITHIN(LCD_SERIAL_PORT, -1, 3)
#error "LCD_SERIAL_PORT must be from -1 to 3. Please update your configuration." #error "LCD_SERIAL_PORT must be from 0 to 3. You can also use -1 if the board supports Native USB."
#endif #endif
#define LCD_SERIAL lcdSerial #define LCD_SERIAL lcdSerial
#if HAS_DGUS_LCD #if HAS_DGUS_LCD

View file

@ -56,7 +56,7 @@ extern DefaultSerial4 MSerial3;
#elif WITHIN(SERIAL_PORT, 0, 3) #elif WITHIN(SERIAL_PORT, 0, 3)
#define MYSERIAL1 MSERIAL(SERIAL_PORT) #define MYSERIAL1 MSERIAL(SERIAL_PORT)
#else #else
#error "The required SERIAL_PORT must be from -1 to 3. Please update your configuration." #error "The required SERIAL_PORT must be from 0 to 3. You can also use -1 if the board supports Native USB."
#endif #endif
#ifdef SERIAL_PORT_2 #ifdef SERIAL_PORT_2
@ -65,7 +65,7 @@ extern DefaultSerial4 MSerial3;
#elif WITHIN(SERIAL_PORT_2, 0, 3) #elif WITHIN(SERIAL_PORT_2, 0, 3)
#define MYSERIAL2 MSERIAL(SERIAL_PORT_2) #define MYSERIAL2 MSERIAL(SERIAL_PORT_2)
#else #else
#error "SERIAL_PORT_2 must be from -1 to 3. Please update your configuration." #error "SERIAL_PORT_2 must be from 0 to 3. You can also use -1 if the board supports Native USB."
#endif #endif
#endif #endif
@ -73,7 +73,7 @@ extern DefaultSerial4 MSerial3;
#if WITHIN(MMU2_SERIAL_PORT, 0, 3) #if WITHIN(MMU2_SERIAL_PORT, 0, 3)
#define MMU2_SERIAL MSERIAL(MMU2_SERIAL_PORT) #define MMU2_SERIAL MSERIAL(MMU2_SERIAL_PORT)
#else #else
#error "MMU2_SERIAL_PORT must be from 0 to 3. Please update your configuration." #error "MMU2_SERIAL_PORT must be from 0 to 3."
#endif #endif
#endif #endif
@ -83,7 +83,7 @@ extern DefaultSerial4 MSerial3;
#elif WITHIN(LCD_SERIAL_PORT, 0, 3) #elif WITHIN(LCD_SERIAL_PORT, 0, 3)
#define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT) #define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT)
#else #else
#error "LCD_SERIAL_PORT must be from -1 to 3. Please update your configuration." #error "LCD_SERIAL_PORT must be from 0 to 3. You can also use -1 if the board supports Native USB."
#endif #endif
#endif #endif

View file

@ -71,7 +71,7 @@ extern DefaultSerial1 USBSerial;
#elif WITHIN(SERIAL_PORT, 0, 3) #elif WITHIN(SERIAL_PORT, 0, 3)
#define MYSERIAL1 MSERIAL(SERIAL_PORT) #define MYSERIAL1 MSERIAL(SERIAL_PORT)
#else #else
#error "SERIAL_PORT must be from -1 to 3. Please update your configuration." #error "SERIAL_PORT must be from 0 to 3. You can also use -1 if the board supports Native USB."
#endif #endif
#ifdef SERIAL_PORT_2 #ifdef SERIAL_PORT_2
@ -80,7 +80,7 @@ extern DefaultSerial1 USBSerial;
#elif WITHIN(SERIAL_PORT_2, 0, 3) #elif WITHIN(SERIAL_PORT_2, 0, 3)
#define MYSERIAL2 MSERIAL(SERIAL_PORT_2) #define MYSERIAL2 MSERIAL(SERIAL_PORT_2)
#else #else
#error "SERIAL_PORT_2 must be from -1 to 3. Please update your configuration." #error "SERIAL_PORT_2 must be from 0 to 3. You can also use -1 if the board supports Native USB."
#endif #endif
#endif #endif
@ -90,7 +90,7 @@ extern DefaultSerial1 USBSerial;
#elif WITHIN(MMU2_SERIAL_PORT, 0, 3) #elif WITHIN(MMU2_SERIAL_PORT, 0, 3)
#define MMU2_SERIAL MSERIAL(MMU2_SERIAL_PORT) #define MMU2_SERIAL MSERIAL(MMU2_SERIAL_PORT)
#else #else
#error "MMU2_SERIAL_PORT must be from -1 to 3. Please update your configuration." #error "MMU2_SERIAL_PORT must be from 0 to 3. You can also use -1 if the board supports Native USB."
#endif #endif
#endif #endif
@ -100,7 +100,7 @@ extern DefaultSerial1 USBSerial;
#elif WITHIN(LCD_SERIAL_PORT, 0, 3) #elif WITHIN(LCD_SERIAL_PORT, 0, 3)
#define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT) #define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT)
#else #else
#error "LCD_SERIAL_PORT must be from -1 to 3. Please update your configuration." #error "LCD_SERIAL_PORT must be from 0 to 3. You can also use -1 if the board supports Native USB."
#endif #endif
#if HAS_DGUS_LCD #if HAS_DGUS_LCD
#define SERIAL_GET_TX_BUFFER_FREE() MSerial0.available() #define SERIAL_GET_TX_BUFFER_FREE() MSerial0.available()

View file

@ -54,7 +54,7 @@
#elif WITHIN(SERIAL_PORT, 0, 3) #elif WITHIN(SERIAL_PORT, 0, 3)
#define MYSERIAL1 MSERIAL(SERIAL_PORT) #define MYSERIAL1 MSERIAL(SERIAL_PORT)
#else #else
#error "SERIAL_PORT must be from -1 to 3. Please update your configuration." #error "SERIAL_PORT must be from 0 to 3. You can also use -1 if the board supports Native USB."
#endif #endif
#ifdef SERIAL_PORT_2 #ifdef SERIAL_PORT_2
@ -63,7 +63,7 @@
#elif WITHIN(SERIAL_PORT_2, 0, 3) #elif WITHIN(SERIAL_PORT_2, 0, 3)
#define MYSERIAL2 MSERIAL(SERIAL_PORT_2) #define MYSERIAL2 MSERIAL(SERIAL_PORT_2)
#else #else
#error "SERIAL_PORT_2 must be from -1 to 3. Please update your configuration." #error "SERIAL_PORT_2 must be from 0 to 3. You can also use -1 if the board supports Native USB."
#endif #endif
#endif #endif
@ -73,7 +73,7 @@
#elif WITHIN(MMU2_SERIAL_PORT, 0, 3) #elif WITHIN(MMU2_SERIAL_PORT, 0, 3)
#define MMU2_SERIAL MSERIAL(MMU2_SERIAL_PORT) #define MMU2_SERIAL MSERIAL(MMU2_SERIAL_PORT)
#else #else
#error "MMU2_SERIAL_PORT must be from -1 to 3. Please update your configuration." #error "MMU2_SERIAL_PORT must be from 0 to 3. You can also use -1 if the board supports Native USB."
#endif #endif
#endif #endif
@ -83,7 +83,7 @@
#elif WITHIN(LCD_SERIAL_PORT, 0, 3) #elif WITHIN(LCD_SERIAL_PORT, 0, 3)
#define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT) #define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT)
#else #else
#error "LCD_SERIAL_PORT must be from -1 to 3. Please update your configuration." #error "LCD_SERIAL_PORT must be from 0 to 3. You can also use -1 if the board supports Native USB."
#endif #endif
#endif #endif

View file

@ -55,7 +55,7 @@
#elif WITHIN(SERIAL_PORT, 1, 6) #elif WITHIN(SERIAL_PORT, 1, 6)
#define MYSERIAL1 MSERIAL(SERIAL_PORT) #define MYSERIAL1 MSERIAL(SERIAL_PORT)
#else #else
#error "SERIAL_PORT must be -1 or from 1 to 6. Please update your configuration." #error "SERIAL_PORT must be from 1 to 6. You can also use -1 if the board supports Native USB."
#endif #endif
#ifdef SERIAL_PORT_2 #ifdef SERIAL_PORT_2
@ -64,7 +64,7 @@
#elif WITHIN(SERIAL_PORT_2, 1, 6) #elif WITHIN(SERIAL_PORT_2, 1, 6)
#define MYSERIAL2 MSERIAL(SERIAL_PORT_2) #define MYSERIAL2 MSERIAL(SERIAL_PORT_2)
#else #else
#error "SERIAL_PORT_2 must be -1 or from 1 to 6. Please update your configuration." #error "SERIAL_PORT_2 must be from 1 to 6. You can also use -1 if the board supports Native USB."
#endif #endif
#endif #endif
@ -74,7 +74,7 @@
#elif WITHIN(MMU2_SERIAL_PORT, 1, 6) #elif WITHIN(MMU2_SERIAL_PORT, 1, 6)
#define MMU2_SERIAL MSERIAL(MMU2_SERIAL_PORT) #define MMU2_SERIAL MSERIAL(MMU2_SERIAL_PORT)
#else #else
#error "MMU2_SERIAL_PORT must be -1 or from 1 to 6. Please update your configuration." #error "MMU2_SERIAL_PORT must be from 1 to 6. You can also use -1 if the board supports Native USB."
#endif #endif
#endif #endif
@ -84,7 +84,7 @@
#elif WITHIN(LCD_SERIAL_PORT, 1, 6) #elif WITHIN(LCD_SERIAL_PORT, 1, 6)
#define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT) #define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT)
#else #else
#error "LCD_SERIAL_PORT must be -1 or from 1 to 6. Please update your configuration." #error "LCD_SERIAL_PORT must be from 1 to 6. You can also use -1 if the board supports Native USB."
#endif #endif
#if HAS_DGUS_LCD #if HAS_DGUS_LCD
#define SERIAL_GET_TX_BUFFER_FREE() LCD_SERIAL.availableForWrite() #define SERIAL_GET_TX_BUFFER_FREE() LCD_SERIAL.availableForWrite()

View file

@ -87,9 +87,9 @@
#else #else
#define MYSERIAL1 MSERIAL(1) // dummy port #define MYSERIAL1 MSERIAL(1) // dummy port
#if NUM_UARTS == 5 #if NUM_UARTS == 5
#error "SERIAL_PORT must be -1 or from 1 to 5. Please update your configuration." #error "SERIAL_PORT must be from 1 to 5. You can also use -1 if the board supports Native USB."
#else #else
#error "SERIAL_PORT must be -1 or from 1 to 3. Please update your configuration." #error "SERIAL_PORT must be from 1 to 3. You can also use -1 if the board supports Native USB."
#endif #endif
#endif #endif
@ -101,9 +101,9 @@
#else #else
#define MYSERIAL2 MSERIAL(1) // dummy port #define MYSERIAL2 MSERIAL(1) // dummy port
#if NUM_UARTS == 5 #if NUM_UARTS == 5
#error "SERIAL_PORT_2 must be -1 or from 1 to 5. Please update your configuration." #error "SERIAL_PORT_2 must be from 1 to 5. You can also use -1 if the board supports Native USB."
#else #else
#error "SERIAL_PORT_2 must be -1 or from 1 to 3. Please update your configuration." #error "SERIAL_PORT_2 must be from 1 to 3. You can also use -1 if the board supports Native USB."
#endif #endif
#endif #endif
#endif #endif
@ -116,9 +116,9 @@
#else #else
#define MMU2_SERIAL MSERIAL(1) // dummy port #define MMU2_SERIAL MSERIAL(1) // dummy port
#if NUM_UARTS == 5 #if NUM_UARTS == 5
#error "MMU2_SERIAL_PORT must be -1 or from 1 to 5. Please update your configuration." #error "MMU2_SERIAL_PORT must be from 1 to 5. You can also use -1 if the board supports Native USB."
#else #else
#error "MMU2_SERIAL_PORT must be -1 or from 1 to 3. Please update your configuration." #error "MMU2_SERIAL_PORT must be from 1 to 3. You can also use -1 if the board supports Native USB."
#endif #endif
#endif #endif
#endif #endif
@ -131,9 +131,9 @@
#else #else
#define LCD_SERIAL MSERIAL(1) // dummy port #define LCD_SERIAL MSERIAL(1) // dummy port
#if NUM_UARTS == 5 #if NUM_UARTS == 5
#error "LCD_SERIAL_PORT must be -1 or from 1 to 5. Please update your configuration." #error "LCD_SERIAL_PORT must be from 1 to 5. You can also use -1 if the board supports Native USB."
#else #else
#error "LCD_SERIAL_PORT must be -1 or from 1 to 3. Please update your configuration." #error "LCD_SERIAL_PORT must be from 1 to 3. You can also use -1 if the board supports Native USB."
#endif #endif
#endif #endif
#if HAS_DGUS_LCD #if HAS_DGUS_LCD

View file

@ -35,6 +35,8 @@
#define IMPLEMENT_SERIAL(X) _IMPLEMENT_SERIAL(X) #define IMPLEMENT_SERIAL(X) _IMPLEMENT_SERIAL(X)
#if WITHIN(SERIAL_PORT, 0, 3) #if WITHIN(SERIAL_PORT, 0, 3)
IMPLEMENT_SERIAL(SERIAL_PORT); IMPLEMENT_SERIAL(SERIAL_PORT);
#else
#error "SERIAL_PORT must be from 0 to 3."
#endif #endif
USBSerialType USBSerial(false, SerialUSB); USBSerialType USBSerial(false, SerialUSB);

View file

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

View file

@ -74,7 +74,7 @@ extern USBSerialType USBSerial;
DECLARE_SERIAL(SERIAL_PORT); DECLARE_SERIAL(SERIAL_PORT);
#define MYSERIAL1 MSERIAL(SERIAL_PORT) #define MYSERIAL1 MSERIAL(SERIAL_PORT)
#else #else
#error "The required SERIAL_PORT must be from -1 to 8. Please update your configuration." #error "The required SERIAL_PORT must be from 0 to 8, or -1 for Native USB."
#endif #endif
#ifdef SERIAL_PORT_2 #ifdef SERIAL_PORT_2
@ -85,7 +85,7 @@ extern USBSerialType USBSerial;
#elif WITHIN(SERIAL_PORT_2, 0, 8) #elif WITHIN(SERIAL_PORT_2, 0, 8)
#define MYSERIAL2 MSERIAL(SERIAL_PORT_2) #define MYSERIAL2 MSERIAL(SERIAL_PORT_2)
#else #else
#error "SERIAL_PORT_2 must be from -2 to 8. Please update your configuration." #error "SERIAL_PORT_2 must be from 0 to 8, or -1 for Native USB, or -2 for Ethernet."
#endif #endif
#endif #endif