mirror of
https://github.com/esphome/esphome.git
synced 2024-11-10 09:17:46 +01:00
SenseAir: flush input buffer on read error (#1017)
* SenseAir: flush input buffer on read error * SenseAir: flush input buffer on read error - fix typo * SenseAir: flush input buffer on read error - fix formating * SenseAir: flush input buffer on read error - fix formating2 * SenseAir: flush input buffer on read error - fix formating3 * SenseAir: flush input buffer on read error - fix formating4 * Update esphome/components/senseair/senseair.cpp * Update esphome/components/senseair/senseair.cpp Co-authored-by: Guillermo Ruffino <glm.net@gmail.com>
This commit is contained in:
parent
b650704877
commit
35a2258f12
1 changed files with 12 additions and 1 deletions
|
@ -18,8 +18,19 @@ void SenseAirComponent::update() {
|
|||
}
|
||||
|
||||
if (response[0] != 0xFE || response[1] != 0x04) {
|
||||
ESP_LOGW(TAG, "Invalid preamble from SenseAir!");
|
||||
ESP_LOGW(TAG, "Invalid preamble from SenseAir! %02x%02x%02x%02x %02x%02x%02x%02x %02x%02x%02x%02x %02x",
|
||||
response[0], response[1], response[2], response[3], response[4], response[5], response[6], response[7],
|
||||
response[8], response[9], response[10], response[11], response[12]);
|
||||
|
||||
this->status_set_warning();
|
||||
while (this->available()) {
|
||||
unsigned char b;
|
||||
if (this->read_byte(&b)) {
|
||||
ESP_LOGD(TAG, " ... %02x", b);
|
||||
} else {
|
||||
ESP_LOGD(TAG, " ... nothing read");
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue