mirror of https://github.com/noisymime/Arduino.git
Merge branch 'fix-flush' of https://github.com/cmaglie/Arduino
This commit is contained in:
commit
ca5aff00e8
|
@ -2,6 +2,9 @@ ARDUINO 1.6.7
|
||||||
|
|
||||||
[libraries]
|
[libraries]
|
||||||
* SPI: Added SPI.transfer16(...) function to SAM core.
|
* SPI: Added SPI.transfer16(...) function to SAM core.
|
||||||
|
* Ethernet, WiFi, SoftwareSerial: Fixed flush() behaviour:
|
||||||
|
the flush function is no more dropping the receive buffer, as per
|
||||||
|
1.0 API specification. Thanks @drmpf
|
||||||
|
|
||||||
[core]
|
[core]
|
||||||
* Fixed wrong timings for HardwareSerial::flush() in SAM core. Thanks @borisff
|
* Fixed wrong timings for HardwareSerial::flush() in SAM core. Thanks @borisff
|
||||||
|
|
|
@ -469,13 +469,7 @@ size_t SoftwareSerial::write(uint8_t b)
|
||||||
|
|
||||||
void SoftwareSerial::flush()
|
void SoftwareSerial::flush()
|
||||||
{
|
{
|
||||||
if (!isListening())
|
// There is no tx buffering, simply return
|
||||||
return;
|
|
||||||
|
|
||||||
uint8_t oldSREG = SREG;
|
|
||||||
cli();
|
|
||||||
_receive_buffer_head = _receive_buffer_tail = 0;
|
|
||||||
SREG = oldSREG;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int SoftwareSerial::peek()
|
int SoftwareSerial::peek()
|
||||||
|
|
|
@ -118,7 +118,12 @@ size_t EthernetUDP::write(const uint8_t *buffer, size_t size)
|
||||||
int EthernetUDP::parsePacket()
|
int EthernetUDP::parsePacket()
|
||||||
{
|
{
|
||||||
// discard any remaining bytes in the last packet
|
// discard any remaining bytes in the last packet
|
||||||
flush();
|
while (_remaining) {
|
||||||
|
// could this fail (loop endlessly) if _remaining > 0 and recv in read fails?
|
||||||
|
// should only occur if recv fails after telling us the data is there, lets
|
||||||
|
// hope the w5100 always behaves :)
|
||||||
|
read();
|
||||||
|
}
|
||||||
|
|
||||||
if (recvAvailable(_sock) > 0)
|
if (recvAvailable(_sock) > 0)
|
||||||
{
|
{
|
||||||
|
@ -206,14 +211,7 @@ int EthernetUDP::peek()
|
||||||
|
|
||||||
void EthernetUDP::flush()
|
void EthernetUDP::flush()
|
||||||
{
|
{
|
||||||
// could this fail (loop endlessly) if _remaining > 0 and recv in read fails?
|
// TODO: we should wait for TX buffer to be emptied
|
||||||
// should only occur if recv fails after telling us the data is there, lets
|
|
||||||
// hope the w5100 always behaves :)
|
|
||||||
|
|
||||||
while (_remaining)
|
|
||||||
{
|
|
||||||
read();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Start EthernetUDP socket, listening at local port PORT */
|
/* Start EthernetUDP socket, listening at local port PORT */
|
||||||
|
|
|
@ -140,8 +140,7 @@ int WiFiClient::peek() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void WiFiClient::flush() {
|
void WiFiClient::flush() {
|
||||||
while (available())
|
// TODO: a real check to ensure transmission has been completed
|
||||||
read();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WiFiClient::stop() {
|
void WiFiClient::stop() {
|
||||||
|
|
|
@ -155,8 +155,7 @@ int WiFiUDP::peek()
|
||||||
|
|
||||||
void WiFiUDP::flush()
|
void WiFiUDP::flush()
|
||||||
{
|
{
|
||||||
while (available())
|
// TODO: a real check to ensure transmission has been completed
|
||||||
read();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IPAddress WiFiUDP::remoteIP()
|
IPAddress WiFiUDP::remoteIP()
|
||||||
|
|
Loading…
Reference in New Issue