mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-30 03:26:13 +01:00
Serial check, mostly for Teensy, does not impact startup if Serial is available
This commit is contained in:
parent
d5955a36bf
commit
1416f83f8c
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* © 2021 Chris Harlow
|
* © 2021 Chris Harlow
|
||||||
|
* © 2022 Harald Barth
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* This file is part of DCC++EX
|
* This file is part of DCC++EX
|
||||||
|
@ -19,18 +20,21 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "SerialManager.h"
|
#include "SerialManager.h"
|
||||||
#include "DCCEXParser.h"
|
#include "DCCEXParser.h"
|
||||||
SerialManager * SerialManager::first=NULL;
|
SerialManager * SerialManager::first=NULL;
|
||||||
|
|
||||||
SerialManager::SerialManager(Stream * myserial) {
|
SerialManager::SerialManager(Stream * myserial) {
|
||||||
serial=myserial;
|
serial=myserial;
|
||||||
next=first;
|
next=first;
|
||||||
first=this;
|
first=this;
|
||||||
bufferLength=0;
|
bufferLength=0;
|
||||||
inCommandPayload=false;
|
inCommandPayload=false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SerialManager::init() {
|
void SerialManager::init() {
|
||||||
|
while (!Serial && millis() < 5000); // wait max 5s for Serial to start
|
||||||
|
Serial.begin(115200);
|
||||||
|
new SerialManager(&Serial);
|
||||||
#ifdef SERIAL3_COMMANDS
|
#ifdef SERIAL3_COMMANDS
|
||||||
Serial3.begin(115200);
|
Serial3.begin(115200);
|
||||||
new SerialManager(&Serial3);
|
new SerialManager(&Serial3);
|
||||||
|
@ -43,8 +47,6 @@ void SerialManager::init() {
|
||||||
Serial1.begin(115200);
|
Serial1.begin(115200);
|
||||||
new SerialManager(&Serial1);
|
new SerialManager(&Serial1);
|
||||||
#endif
|
#endif
|
||||||
Serial.begin(115200);
|
|
||||||
new SerialManager(&Serial);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SerialManager::broadcast(RingStream * ring) {
|
void SerialManager::broadcast(RingStream * ring) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user