In the LSM9DS1.cpp:
//stock settings for Gyro(CTRL_REG1_G) and Accelerometer(CTRL_REG6_XL)
//writeRegister(LSM9DS1_ADDRESS, LSM9DS1_CTRL_REG1_G, 0x78); // 119 Hz, 2000 dps, 16 Hz BW
//writeRegister(LSM9DS1_ADDRESS, LSM9DS1_CTRL_REG6_XL, 0x70); // 119 Hz, 4G
writeRegister(LSM9DS1_ADDRESS, LSM9DS1_CTRL_REG1_G, 0x00); // power down Gyro
//writeRegister(LSM9DS1_ADDRESS, LSM9DS1_CTRL_REG6_XL, 0x00); // power down Accelerometer
//writeRegister(LSM9DS1_ADDRESS, LSM9DS1_CTRL_REG1_G, 0x20); // 10 Hz, 245 dps, 100 Hz Low Pass Cutoff
//writeRegister(LSM9DS1_ADDRESS, LSM9DS1_CTRL_REG1_G, 0xa3); // 238 Hz, 245 dps, 100 Hz Low Pass Cutoff
//writeRegister(LSM9DS1_ADDRESS, LSM9DS1_CTRL_REG6_XL, 0x85); // 238 Hz, 2G, filter BW 211 Hz
//writeRegister(LSM9DS1_ADDRESS, LSM9DS1_CTRL_REG6_XL, 0xA0); // 476 Hz, 2G, filter BW 408 Hz
//writeRegister(LSM9DS1_ADDRESS, LSM9DS1_CTRL_REG1_G, 0xc3); // Max 952 Hz, 245 dps, 100 Hz Low Pass Cutoff
writeRegister(LSM9DS1_ADDRESS, LSM9DS1_CTRL_REG6_XL, 0xc4); // Max 952 Hz, 2G, filter BW 408 Hz
//Magnetometer Control Registers
writeRegister(LSM9DS1_ADDRESS_M, LSM9DS1_CTRL_REG1_M, 0xb4); // Temperature compensation enable, medium performance, 20 Hz
//writeRegister(LSM9DS1_ADDRESS_M, LSM9DS1_CTRL_REG1_M, 0x00); // lowest settings
writeRegister(LSM9DS1_ADDRESS_M, LSM9DS1_CTRL_REG2_M, 0x00); // 4 Gauss - Lowest
writeRegister(LSM9DS1_ADDRESS_M, LSM9DS1_CTRL_REG3_M, 0x00); // Continuous conversion mode
These are a few values I put in there for testing, calculated from the corresponding tables in the lsm9ds1 datasheet, such as Table 66. CTRL_REG6_XL register for the Accelerometer, then converting the required binary from the table to hex in the code.
If you change the G, DPS and Gauss then the corresponding values in the calculation also need changing in the following classes:
For Acc in LSM9DS1Class::readAcceleration, if using 2G, replace the 4 with 2 :
x = data[0]; // * 2.0 / 32768.0;
y = data[1]; // * 2.0 / 32768.0;
z = data[2]; // * 2.0 / 32768.0;
Then do the same within:
LSM9DS1Class::readGyroscope and
LSM9DS1Class::readMagneticField
to match the values chosen for DPS and Gauss.
For the current project I'll probably make do with 80Hz from the lowlatencylogger as it is consistent with timing, but for later in the year will likely try to get something going that is faster.