1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-28 08:02:23 +01:00

Make UART flush function consistent (#748)

See also 78be9d2937
This commit is contained in:
Otto Winter
2019-10-17 16:54:38 +02:00
committed by GitHub
parent e15071228e
commit 78c1adafcd
4 changed files with 9 additions and 6 deletions

View File

@@ -316,7 +316,9 @@ uint8_t ESP8266SoftwareSerial::peek_byte() {
return 0;
return this->rx_buffer_[this->rx_out_pos_];
}
void ESP8266SoftwareSerial::flush() { this->rx_in_pos_ = this->rx_out_pos_ = 0; }
void ESP8266SoftwareSerial::flush() {
// Flush is a NO-OP with software serial, all bytes are written immediately.
}
int ESP8266SoftwareSerial::available() {
int avail = int(this->rx_in_pos_) - int(this->rx_out_pos_);
if (avail < 0)

View File

@@ -61,6 +61,7 @@ class UARTComponent : public Component, public Stream {
int available() override;
/// Block until all bytes have been written to the UART bus.
void flush() override;
float get_setup_priority() const override { return setup_priority::BUS; }