add second accelerometer for comparison
Some checks failed
Build / build (macos-12) (push) Waiting to run
Build / build (macos-14) (push) Waiting to run
Build / build (windows-2022) (push) Waiting to run
Build / build (ubuntu-22.04) (push) Failing after 15s
Documentation / build (push) Successful in 3s

This commit is contained in:
2024-04-28 00:35:57 -06:00
parent da8f165451
commit 7fddc21eee
3 changed files with 40 additions and 11 deletions

View File

@ -154,19 +154,19 @@ static int bmx055_channel_get(const struct device *dev,
val->val2 = 0; // TODO: don't throw out LSB
break;
case SENSOR_CHAN_ACCEL_X:
case SENSOR_CHAN_ACCEL_Y:
return -ENOTSUP;
case SENSOR_CHAN_ACCEL_Z:
// For now assume 2g since that's the default value
// 2g 0.98mg/LSB
// 4g 1.95mg/LSB
// 8g 3.91mg/LSB
// 16g 7.81mg/LSB
// 1 g = 9.80665 m/s^2
float accel = data->accel_x * 0.00098 * 9.80665; // to gees, to m/s^2
float accel = data->accel_z * 0.00098 * 9.80665; // to gees, to m/s^2
val->val1 = accel;
val->val2 = (accel - val->val1) * 1000000;
break;
case SENSOR_CHAN_ACCEL_Y:
case SENSOR_CHAN_ACCEL_Z:
return -ENOTSUP;
case SENSOR_CHAN_GYRO_X:
case SENSOR_CHAN_GYRO_Y:
case SENSOR_CHAN_GYRO_Z: