Reduce overhead in SEN5X probing
This commit is contained in:
@@ -140,7 +140,7 @@ bool ScanI2CTwoWire::i2cCommandResponseLength(ScanI2C::DeviceAddress addr, uint1
|
|||||||
#include "../modules/Telemetry/Sensor/SEN5XSensor.h"
|
#include "../modules/Telemetry/Sensor/SEN5XSensor.h"
|
||||||
bool probeSEN5X(TwoWire *i2cBus, uint8_t address, ScanI2C::I2CPort port)
|
bool probeSEN5X(TwoWire *i2cBus, uint8_t address, ScanI2C::I2CPort port)
|
||||||
{
|
{
|
||||||
SEN5XSensor sen5xsensor = SEN5XSensor();
|
SEN5XSensor sen5xsensor;
|
||||||
return sen5xsensor.probe(i2cBus, address, port);
|
return sen5xsensor.probe(i2cBus, address, port);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -86,16 +86,8 @@ bool SEN5XSensor::probe(TwoWire *bus, uint8_t address, ScanI2C::I2CPort port)
|
|||||||
reClockI2C.setup(_bus, _port);
|
reClockI2C.setup(_bus, _port);
|
||||||
#endif /* SEN5X_I2C_CLOCK_SPEED */
|
#endif /* SEN5X_I2C_CLOCK_SPEED */
|
||||||
|
|
||||||
delay(50); // without this there is an error on the deviceReset function
|
|
||||||
|
|
||||||
if (!sendCommand(SEN5X_RESET)) {
|
|
||||||
LOG_ERROR("SEN5X: error resetting device");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
delay(200); // From Sensirion Datasheet
|
|
||||||
|
|
||||||
if (!findModel()) {
|
if (!findModel()) {
|
||||||
LOG_ERROR("SEN5X: error finding sensor model");
|
LOG_DEBUG("SEN5X: can't find SEN5X model");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user