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)
#else
#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
#define MYSERIAL1 customizedSerial1
#ifdef SERIAL_PORT_2
#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
#define MYSERIAL2 customizedSerial2
#endif
@ -107,14 +107,14 @@ typedef int8_t pin_t;
#ifdef MMU2_SERIAL_PORT
#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
#define MMU2_SERIAL mmuSerial
#endif
#ifdef LCD_SERIAL_PORT
#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
#define LCD_SERIAL lcdSerial
#if HAS_DGUS_LCD

View File

@ -56,7 +56,7 @@ extern DefaultSerial4 MSerial3;
#elif WITHIN(SERIAL_PORT, 0, 3)
#define MYSERIAL1 MSERIAL(SERIAL_PORT)
#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
#ifdef SERIAL_PORT_2
@ -65,7 +65,7 @@ extern DefaultSerial4 MSerial3;
#elif WITHIN(SERIAL_PORT_2, 0, 3)
#define MYSERIAL2 MSERIAL(SERIAL_PORT_2)
#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
@ -73,7 +73,7 @@ extern DefaultSerial4 MSerial3;
#if WITHIN(MMU2_SERIAL_PORT, 0, 3)
#define MMU2_SERIAL MSERIAL(MMU2_SERIAL_PORT)
#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
@ -83,7 +83,7 @@ extern DefaultSerial4 MSerial3;
#elif WITHIN(LCD_SERIAL_PORT, 0, 3)
#define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT)
#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

View File

@ -71,7 +71,7 @@ extern DefaultSerial1 USBSerial;
#elif WITHIN(SERIAL_PORT, 0, 3)
#define MYSERIAL1 MSERIAL(SERIAL_PORT)
#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
#ifdef SERIAL_PORT_2
@ -80,7 +80,7 @@ extern DefaultSerial1 USBSerial;
#elif WITHIN(SERIAL_PORT_2, 0, 3)
#define MYSERIAL2 MSERIAL(SERIAL_PORT_2)
#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
@ -90,7 +90,7 @@ extern DefaultSerial1 USBSerial;
#elif WITHIN(MMU2_SERIAL_PORT, 0, 3)
#define MMU2_SERIAL MSERIAL(MMU2_SERIAL_PORT)
#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
@ -100,7 +100,7 @@ extern DefaultSerial1 USBSerial;
#elif WITHIN(LCD_SERIAL_PORT, 0, 3)
#define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT)
#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
#if HAS_DGUS_LCD
#define SERIAL_GET_TX_BUFFER_FREE() MSerial0.available()

View File

@ -54,7 +54,7 @@
#elif WITHIN(SERIAL_PORT, 0, 3)
#define MYSERIAL1 MSERIAL(SERIAL_PORT)
#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
#ifdef SERIAL_PORT_2
@ -63,7 +63,7 @@
#elif WITHIN(SERIAL_PORT_2, 0, 3)
#define MYSERIAL2 MSERIAL(SERIAL_PORT_2)
#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
@ -73,7 +73,7 @@
#elif WITHIN(MMU2_SERIAL_PORT, 0, 3)
#define MMU2_SERIAL MSERIAL(MMU2_SERIAL_PORT)
#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
@ -83,7 +83,7 @@
#elif WITHIN(LCD_SERIAL_PORT, 0, 3)
#define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT)
#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

View File

@ -55,7 +55,7 @@
#elif WITHIN(SERIAL_PORT, 1, 6)
#define MYSERIAL1 MSERIAL(SERIAL_PORT)
#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
#ifdef SERIAL_PORT_2
@ -64,7 +64,7 @@
#elif WITHIN(SERIAL_PORT_2, 1, 6)
#define MYSERIAL2 MSERIAL(SERIAL_PORT_2)
#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
@ -74,7 +74,7 @@
#elif WITHIN(MMU2_SERIAL_PORT, 1, 6)
#define MMU2_SERIAL MSERIAL(MMU2_SERIAL_PORT)
#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
@ -84,7 +84,7 @@
#elif WITHIN(LCD_SERIAL_PORT, 1, 6)
#define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT)
#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
#if HAS_DGUS_LCD
#define SERIAL_GET_TX_BUFFER_FREE() LCD_SERIAL.availableForWrite()

View File

@ -87,9 +87,9 @@
#else
#define MYSERIAL1 MSERIAL(1) // dummy port
#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
#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
@ -101,9 +101,9 @@
#else
#define MYSERIAL2 MSERIAL(1) // dummy port
#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
#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
@ -116,9 +116,9 @@
#else
#define MMU2_SERIAL MSERIAL(1) // dummy port
#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
#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
@ -131,9 +131,9 @@
#else
#define LCD_SERIAL MSERIAL(1) // dummy port
#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
#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
#if HAS_DGUS_LCD

View File

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

View File

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

View File

@ -74,7 +74,7 @@ extern USBSerialType USBSerial;
DECLARE_SERIAL(SERIAL_PORT);
#define MYSERIAL1 MSERIAL(SERIAL_PORT)
#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
#ifdef SERIAL_PORT_2
@ -85,7 +85,7 @@ extern USBSerialType USBSerial;
#elif WITHIN(SERIAL_PORT_2, 0, 8)
#define MYSERIAL2 MSERIAL(SERIAL_PORT_2)
#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