diff --git a/goflying b/goflying index 0ba3e51b..d0268b1b 160000 --- a/goflying +++ b/goflying @@ -1 +1 @@ -Subproject commit 0ba3e51be74b4848488e06ec0fee74ebaa7ef705 +Subproject commit d0268b1b182f79d34af4f3a7524ae0b4c18c41e0 diff --git a/main/sensors.go b/main/sensors.go index 171c226f..15108433 100644 --- a/main/sensors.go +++ b/main/sensors.go @@ -123,7 +123,7 @@ func tempAndPressureSender() { } func initIMU() (ok bool) { - imu, err := sensors.NewMPU9250() + imu, err := sensors.NewMPU9250(&i2cbus) if err == nil { myIMUReader = imu return true diff --git a/sensors/mpu9250.go b/sensors/mpu9250.go index 6ba9e003..1186b821 100644 --- a/sensors/mpu9250.go +++ b/sensors/mpu9250.go @@ -3,6 +3,7 @@ package sensors import ( "../goflying/mpu9250" + "github.com/kidoman/embd" ) const ( @@ -19,14 +20,14 @@ type MPU9250 struct { // NewMPU9250 returns an instance of the MPU9250 IMUReader, connected to an // MPU9250 attached on the I2C bus with either valid address. -func NewMPU9250() (*MPU9250, error) { +func NewMPU9250(i2cbus *embd.I2CBus) (*MPU9250, error) { var ( m MPU9250 mpu *mpu9250.MPU9250 err error ) - mpu, err = mpu9250.NewMPU9250(gyroRange, accelRange, updateFreq, true, false) + mpu, err = mpu9250.NewMPU9250(i2cbus, gyroRange, accelRange, updateFreq, true, false) if err != nil { return nil, err }