mirror of
https://github.com/esphome/esphome.git
synced 2024-12-26 15:34:53 +01:00
hx711: Check for DOUT going high after a reading (#7214)
This commit is contained in:
parent
24b6c1d3eb
commit
7fd65987d3
1 changed files with 10 additions and 1 deletions
|
@ -39,8 +39,8 @@ bool HX711Sensor::read_sensor_(uint32_t *result) {
|
|||
return false;
|
||||
}
|
||||
|
||||
this->status_clear_warning();
|
||||
uint32_t data = 0;
|
||||
bool final_dout;
|
||||
|
||||
{
|
||||
InterruptLock lock;
|
||||
|
@ -59,8 +59,17 @@ bool HX711Sensor::read_sensor_(uint32_t *result) {
|
|||
this->sck_pin_->digital_write(false);
|
||||
delayMicroseconds(1);
|
||||
}
|
||||
final_dout = this->dout_pin_->digital_read();
|
||||
}
|
||||
|
||||
if (!final_dout) {
|
||||
ESP_LOGW(TAG, "HX711 DOUT pin not high after reading (data 0x%" PRIx32 ")!", data);
|
||||
this->status_set_warning();
|
||||
return false;
|
||||
}
|
||||
|
||||
this->status_clear_warning();
|
||||
|
||||
if (data & 0x800000ULL) {
|
||||
data |= 0xFF000000ULL;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue