mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-26 17:46:14 +01:00
Exrail startup diags and Wifi don't trust available() call.
This commit is contained in:
parent
e8817d6b4b
commit
ee6e6fecc4
|
@ -196,6 +196,7 @@ LookList* RMFT2::LookListLoader(OPCODE op1, OPCODE op2, OPCODE op3) {
|
||||||
case OPCODE_IFNOT: {
|
case OPCODE_IFNOT: {
|
||||||
int16_t pin = (int16_t)operand;
|
int16_t pin = (int16_t)operand;
|
||||||
if (pin<0) pin = -pin;
|
if (pin<0) pin = -pin;
|
||||||
|
DIAG(F("EXRAIL input vpin %d"),pin);
|
||||||
IODevice::configureInput((VPIN)pin,true);
|
IODevice::configureInput((VPIN)pin,true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -205,6 +206,7 @@ LookList* RMFT2::LookListLoader(OPCODE op1, OPCODE op2, OPCODE op3) {
|
||||||
case OPCODE_IFGTE:
|
case OPCODE_IFGTE:
|
||||||
case OPCODE_IFLT:
|
case OPCODE_IFLT:
|
||||||
case OPCODE_DRIVE: {
|
case OPCODE_DRIVE: {
|
||||||
|
DIAG(F("EXRAIL analog input vpin %d"),(VPIN)operand);
|
||||||
IODevice::configureAnalogIn((VPIN)operand);
|
IODevice::configureAnalogIn((VPIN)operand);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -341,9 +341,14 @@ void WifiInterface::ATCommand(HardwareSerial * stream,const byte * command) {
|
||||||
while(stream->available()) stream->read(); // Drain serial input first
|
while(stream->available()) stream->read(); // Drain serial input first
|
||||||
bool startOfLine=true;
|
bool startOfLine=true;
|
||||||
while(true) {
|
while(true) {
|
||||||
while (wifiStream->available()) stream->write(wifiStream->read());
|
while (wifiStream->available()>=0) {
|
||||||
|
int cx=wifiStream->read();
|
||||||
|
if (cx<=0) break;
|
||||||
|
stream->write(cx);
|
||||||
|
}
|
||||||
if (stream->available()) {
|
if (stream->available()) {
|
||||||
int cx=stream->read();
|
int cx=stream->read();
|
||||||
|
if (cx<0) continue;
|
||||||
// A newline followed by !!! is an exit
|
// A newline followed by !!! is an exit
|
||||||
if (cx=='\n' || cx=='\r') startOfLine=true;
|
if (cx=='\n' || cx=='\r') startOfLine=true;
|
||||||
else if (startOfLine && cx=='!') break;
|
else if (startOfLine && cx=='!') break;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user