Skip to content

Commit cbabb4e

Browse files
committed
Merge @nuhash branch to fix init issue
Fixes: sparkfun#35
1 parent 18d3181 commit cbabb4e

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

src/SparkFunLSM9DS1.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ Distributed as-is; no warranty is given.
5050

5151
LSM9DS1::LSM9DS1()
5252
{
53+
init(); //Initialise settings
5354
}
5455

5556
void LSM9DS1::init()
@@ -152,8 +153,6 @@ uint16_t LSM9DS1::begin(uint8_t agAddress, uint8_t mAddress, TwoWire &wirePort)
152153
_xgAddress = settings.device.agAddress;
153154
_mAddress = settings.device.mAddress;
154155

155-
init();
156-
157156
constrainScales();
158157
// Once we have the scale values, we can calculate the resolution
159158
// of each sensor. That's what these functions are for. One for each sensor
@@ -198,8 +197,6 @@ uint16_t LSM9DS1::beginSPI(uint8_t ag_CS_pin, uint8_t m_CS_pin)
198197
_xgAddress = settings.device.agAddress;
199198
_mAddress = settings.device.mAddress;
200199

201-
init();
202-
203200
constrainScales();
204201
// Once we have the scale values, we can calculate the resolution
205202
// of each sensor. That's what these functions are for. One for each sensor

src/SparkFunLSM9DS1.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,8 @@ class LSM9DS1
7171
// If IMU_MODE_SPI, this is the cs pin of the magnetometer (CS_M)
7272
LSM9DS1();
7373

74-
// begin() and beginSPI() -- Initialize the gyro, accelerometer, and magnetometer.
75-
// This will set up the scale and output rate of each sensor. The values set
76-
// in the IMUSettings struct will take effect after calling this function.
74+
// begin() and beginSPI() -- The values set in the IMUSettings struct will take
75+
// effect after calling this function.
7776
// INPUTS:
7877
// - agAddress - Sets either the I2C address of the accel/gyro or SPI chip
7978
// select pin connected to the CS_XG pin.

0 commit comments

Comments
 (0)