lsm6ds: fix swapped accel and gyro status bits
This commit is contained in:
1 parent
53218bd4de
commit
7adb22de2c
1 file changed
+2
-7
@@ -101,12 +101,7 @@ void LSM6DSComponent::update() {
|
|||||||
if (!this->read_register(0x1E, &status, 1))
|
if (!this->read_register(0x1E, &status, 1))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ESP_LOGW(TAG, "STATUS=0x%02X accel_odr=0x%02X gyro_odr=0x%02X",
|
if (this->gyro_odr_ != LSM6DS_ODR_OFF && (status & 0x02)) { // GDA - Gyroscope data available
|
||||||
status,
|
|
||||||
static_cast<uint8_t>(this->accel_odr_),
|
|
||||||
static_cast<uint8_t>(this->gyro_odr_));
|
|
||||||
|
|
||||||
if (this->gyro_odr_ != LSM6DS_ODR_OFF && (status & 0x01)) { // GDA - Gyroscope data available
|
|
||||||
uint8_t data[6];
|
uint8_t data[6];
|
||||||
if (this->read_register(0x22, data, 6)) {
|
if (this->read_register(0x22, data, 6)) {
|
||||||
int16_t gx = encode_uint16(data[1], data[0]);
|
int16_t gx = encode_uint16(data[1], data[0]);
|
||||||
@@ -121,7 +116,7 @@ void LSM6DSComponent::update() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this->accel_odr_ != LSM6DS_ODR_OFF && (status & 0x02)) { // XLDA - Accelerometer data available
|
if (this->accel_odr_ != LSM6DS_ODR_OFF && (status & 0x01)) { // XLDA - Accelerometer data available
|
||||||
uint8_t data[6];
|
uint8_t data[6];
|
||||||
if (this->read_register(0x28, data, 6)) {
|
if (this->read_register(0x28, data, 6)) {
|
||||||
int16_t ax = encode_uint16(data[1], data[0]);
|
int16_t ax = encode_uint16(data[1], data[0]);
|
||||||
|
|||||||
Reference in new issue
Block a user