mirror of
https://github.com/esphome/esphome.git
synced 2025-02-21 20:38:16 +00:00
hx711: Check for DOUT going high after a reading (#7214)
This commit is contained in:
parent
24b6c1d3eb
commit
7fd65987d3
@ -39,8 +39,8 @@ bool HX711Sensor::read_sensor_(uint32_t *result) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->status_clear_warning();
|
|
||||||
uint32_t data = 0;
|
uint32_t data = 0;
|
||||||
|
bool final_dout;
|
||||||
|
|
||||||
{
|
{
|
||||||
InterruptLock lock;
|
InterruptLock lock;
|
||||||
@ -59,8 +59,17 @@ bool HX711Sensor::read_sensor_(uint32_t *result) {
|
|||||||
this->sck_pin_->digital_write(false);
|
this->sck_pin_->digital_write(false);
|
||||||
delayMicroseconds(1);
|
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) {
|
if (data & 0x800000ULL) {
|
||||||
data |= 0xFF000000ULL;
|
data |= 0xFF000000ULL;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user