1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-26 09:36:13 +01:00

Exrail startup diags and Wifi don't trust available() call.

This commit is contained in:
Asbelos 2022-12-08 11:46:19 +00:00
parent e8817d6b4b
commit ee6e6fecc4
2 changed files with 8 additions and 1 deletions

View File

@ -196,6 +196,7 @@ LookList* RMFT2::LookListLoader(OPCODE op1, OPCODE op2, OPCODE op3) {
case OPCODE_IFNOT: {
int16_t pin = (int16_t)operand;
if (pin<0) pin = -pin;
DIAG(F("EXRAIL input vpin %d"),pin);
IODevice::configureInput((VPIN)pin,true);
break;
}
@ -205,6 +206,7 @@ LookList* RMFT2::LookListLoader(OPCODE op1, OPCODE op2, OPCODE op3) {
case OPCODE_IFGTE:
case OPCODE_IFLT:
case OPCODE_DRIVE: {
DIAG(F("EXRAIL analog input vpin %d"),(VPIN)operand);
IODevice::configureAnalogIn((VPIN)operand);
break;
}

View File

@ -341,9 +341,14 @@ void WifiInterface::ATCommand(HardwareSerial * stream,const byte * command) {
while(stream->available()) stream->read(); // Drain serial input first
bool startOfLine=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()) {
int cx=stream->read();
if (cx<0) continue;
// A newline followed by !!! is an exit
if (cx=='\n' || cx=='\r') startOfLine=true;
else if (startOfLine && cx=='!') break;