Skip to content

Commit 9d024d1

Browse files
authored
comments on Arduino flush() method (esp8266#8318)
1 parent 93b7325 commit 9d024d1

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

cores/esp8266/HardwareSerial.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ class HardwareSerial: public Stream
183183
{
184184
return static_cast<int>(uart_tx_free(_uart));
185185
}
186-
void flush(void) override;
186+
void flush(void) override; // wait for all outgoing characters to be sent, output buffer is empty after this call
187187
size_t write(uint8_t c) override
188188
{
189189
return uart_write_char(_uart, c);

cores/esp8266/Print.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,10 @@ class Print {
110110
size_t println(const Printable&);
111111
size_t println(void);
112112

113-
virtual void flush() { /* Empty implementation for backward compatibility */ }
113+
// flush():
114+
// Empty implementation by default in Print::
115+
// should wait for all outgoing characters to be sent, output buffer is empty after this call
116+
virtual void flush() { }
114117

115118
// by default write timeout is possible (outgoing data from network,serial..)
116119
// (children can override to false (like String))

libraries/ESP8266WiFi/src/WiFiClient.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class WiFiClient : public Client, public SList<WiFiClient> {
7272
size_t peekBytes(char *buffer, size_t length) {
7373
return peekBytes((uint8_t *) buffer, length);
7474
}
75-
virtual void flush() override { (void)flush(0); }
75+
virtual void flush() override { (void)flush(0); } // wait for all outgoing characters to be sent, output buffer should be empty after this call
7676
virtual void stop() override { (void)stop(0); }
7777
bool flush(unsigned int maxWaitMs);
7878
bool stop(unsigned int maxWaitMs);

libraries/ESP8266WiFi/src/WiFiUdp.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class WiFiUDP : public UDP, public SList<WiFiUDP> {
9292
int read(char* buffer, size_t len) override { return read((unsigned char*)buffer, len); };
9393
// Return the next byte from the current packet without moving on to the next byte
9494
int peek() override;
95-
void flush() override; // Finish reading the current packet
95+
void flush() override; // wait for all outgoing characters to be sent, output buffer is empty after this call
9696

9797
// Return the IP address of the host who sent the current incoming packet
9898
IPAddress remoteIP() override;

0 commit comments

Comments
 (0)