Add timeout to serial debug (#253)

* Wait 30s for serial debug instead of waiting forever
* Delay of 50ms to allow FTDI debugger to connect at startup
This commit is contained in:
Ben Lye 2019-09-05 07:33:01 +01:00 committed by pascallanger
parent 0603d220a9
commit d80c218744
2 changed files with 20 additions and 1 deletions

View File

@ -224,7 +224,25 @@ void setup()
// Setup diagnostic uart before anything else
#ifdef DEBUG_SERIAL
Serial.begin(115200,SERIAL_8N1);
while (!Serial); // Wait for ever for the serial port to connect...
// Wait up to 30s for a serial connection; double-blink the LED while we wait
unsigned long currMillis = millis();
unsigned long initMillis = currMillis;
pinMode(LED_pin,OUTPUT);
LED_off;
while (!Serial && (currMillis - initMillis) <= 30000) {
LED_on;
delay(100);
LED_off;
delay(100);
LED_on;
delay(100);
LED_off;
delay(500);
currMillis = millis();
}
delay(50); // Brief delay for FTDI debugging
debugln("Multiprotocol version: %d.%d.%d.%d", VERSION_MAJOR, VERSION_MINOR, VERSION_REVISION, VERSION_PATCH_LEVEL);
#endif

View File

@ -15,6 +15,7 @@
- **_Fast blink(on=0.1s,off=0.1s)_**: bind in progress
- **_Slow blink(on=0.5s,off=0.5s)_**: serial has been selected but no valid signal is being seen on the RX pin.
- **_Slower blink(on=1s,off=1s)_**: PPM has been selected but no valid signal is being seen on the PPM pin.
- **_Fast double blink(on=0.1s,off=0.1s,on=0.1s,off=0.5s)_**: serial debugging is enabled and is waiting for a serial connection
- **_On_**: Module is in normal operation mode (transmitting control signals).
## Protocol selection