mirror of
https://github.com/Threnklyn/esphome-dev.git
synced 2026-06-04 03:48:29 +02:00
Make UART flush function consistent (#748)
See also https://github.com/esphome/esphome/commit/78be9d29376d5fdcff81874540c540eb80a338f6
This commit is contained in:
@@ -77,16 +77,17 @@ void MHZ19Component::abc_disable() {
|
||||
}
|
||||
|
||||
bool MHZ19Component::mhz19_write_command_(const uint8_t *command, uint8_t *response) {
|
||||
this->flush();
|
||||
// Empty RX Buffer
|
||||
while (this->available())
|
||||
this->read();
|
||||
this->write_array(command, MHZ19_REQUEST_LENGTH);
|
||||
this->write_byte(mhz19_checksum(command));
|
||||
this->flush();
|
||||
|
||||
if (response == nullptr)
|
||||
return true;
|
||||
|
||||
bool ret = this->read_array(response, MHZ19_RESPONSE_LENGTH);
|
||||
this->flush();
|
||||
return ret;
|
||||
return this->read_array(response, MHZ19_RESPONSE_LENGTH);
|
||||
}
|
||||
float MHZ19Component::get_setup_priority() const { return setup_priority::DATA; }
|
||||
void MHZ19Component::dump_config() {
|
||||
|
||||
Reference in New Issue
Block a user