Ignore any '\r' characters received from Serial Monitor
This allows the Serial Monitor to send NL or CR/NL at end of each line. A newline ('\n') must be at the end to terminate reading from the Serial Monitor, but any preceeding carriage returns are stripped out.
This commit is contained in:
parent
d68c34c53f
commit
9f7d288d18
|
|
@ -55,10 +55,11 @@ char *Utils::readSerial(char *c, int max){
|
||||||
return(c); // return updated string
|
return(c); // return updated string
|
||||||
}
|
}
|
||||||
|
|
||||||
c[i]=buf; // store new character
|
if(buf!='\r'){ // save any character except carriage return
|
||||||
|
c[i]=buf; // store new character
|
||||||
if(i<max) // do not store more than max characters (excluding string terminator)
|
if(i<max) // do not store more than max characters (excluding string terminator)
|
||||||
i++;
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
} // while(1)
|
} // while(1)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue