1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-23 00:05:33 +03:00

Merge pull request #10578 from mikeller/fix_dps310_i2c

Fixed initialisation of DPS310 when used over I2C.
This commit is contained in:
Michael Keller 2021-03-28 18:23:14 +13:00 committed by GitHub
commit 284ec67cad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -167,8 +167,16 @@ static bool deviceConfigure(busDevice_t * busDev)
// 1. Read the pressure calibration coefficients (c00, c10, c20, c30, c01, c11, and c21) from the Calibration Coefficient register.
// Note: The coefficients read from the coefficient register are 2's complement numbers.
uint8_t coef[18];
if (!busReadBuf(busDev, DPS310_REG_COEF, coef, sizeof(coef))) {
// Do the read of the coefficients in multiple parts, as the chip will return a read failure when trying to read all at once over I2C.
#define COEFFICIENT_LENGTH 18
#define READ_LENGTH (COEFFICIENT_LENGTH / 2)
uint8_t coef[COEFFICIENT_LENGTH];
if (!busReadBuf(busDev, DPS310_REG_COEF, coef, READ_LENGTH)) {
return false;
}
if (!busReadBuf(busDev, DPS310_REG_COEF + READ_LENGTH, coef + READ_LENGTH, COEFFICIENT_LENGTH - READ_LENGTH)) {
return false;
}