Add reset() function for complete sensor reset
- Add reset() function that combines OTP memory reboot and algorithm reset - Integrate reset() call into begin() initialization sequence after isConnected() - Ensures clean sensor state before applying configuration settings - 5ms delay for proper sensor reset timing 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
cef5e156ec
commit
01d2459424
2 changed files with 26 additions and 0 deletions
|
|
@ -63,6 +63,10 @@ bool Adafruit_STHS34PF80::begin(uint8_t i2c_addr, TwoWire *wire) {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!reset()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Apply recommended default settings
|
||||
if (!setObjAveraging(STHS34PF80_AVG_TMOS_32)) {
|
||||
return false;
|
||||
|
|
@ -98,6 +102,27 @@ bool Adafruit_STHS34PF80::isConnected() {
|
|||
return chip_id.read() == 0xD3;
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief Reset the sensor completely
|
||||
* @return True if successful, false otherwise
|
||||
*/
|
||||
bool Adafruit_STHS34PF80::reset() {
|
||||
// Reboot OTP memory
|
||||
if (!rebootOTPmemory()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Wait for sensor reset to complete
|
||||
delay(5);
|
||||
|
||||
// Reset the internal algorithm
|
||||
if (!algorithmReset()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief Set the motion detection low-pass filter configuration
|
||||
* @param config The LPF configuration value
|
||||
|
|
|
|||
|
|
@ -133,6 +133,7 @@ public:
|
|||
|
||||
bool begin(uint8_t i2c_addr = STHS34PF80_DEFAULT_ADDR, TwoWire *wire = &Wire);
|
||||
bool isConnected();
|
||||
bool reset();
|
||||
|
||||
bool setMotionLowPassFilter(sths34pf80_lpf_config_t config);
|
||||
sths34pf80_lpf_config_t getMotionLowPassFilter();
|
||||
|
|
|
|||
Loading…
Reference in a new issue