endail/hx711

HX711::powerUp should not block to sleep for settling time

endail opened this issue · 0 comments

hx711/src/HX711.cpp

Lines 367 to 387 in 42d6305

void HX711::powerUp() {
std::lock_guard<std::mutex> lock(this->_commLock);
/**
* "When PD_SCK returns to low,
* chip will reset and enter normal operation mode"
* Datasheet pg. 5
*/
Utility::writeGpio(this->_gpioHandle, this->_clockPin, GpioLevel::LOW);
/**
* "Settling time refers to the time from power up, reset,
* input channel change and gain change to valid stable output data."
* Datasheet pg. 3
*/
if(this->_rate != Rate::OTHER) {
Utility::sleep(_SETTLING_TIMES.at(this->_rate));
}
}

Sleeping for settling time should be separate to powering up.