highmatergogo
It seems like a hardware problem to me.
You are actually getting those values from the i2c reading. Take a look at how template <typename IO>
void LSM9DS1<IO>::readGyro()
behaves in this mod: It just dumps the raw values right after they are read.
Here's a python snippet that converts the 6 byte array to signed ints:
import struct
gyro_bytes = [0x1f, 0xfb, 0x9d, 0x06, 0x02, 0x00]
acel_bytes = [0xfc, 0x7f, 0x04, 0x80, 0xc3, 0x11]
def convert_to_int16_t(_six_char_array):
"""This function takes a 6 bytes array in the form
[ X_LSB, X_MSB, Y_LSB, Y_MSB, Z_LSB, Z_MSB ]
and returns 3 16bit signed integers"""
_b = bytes(bytearray(_six_char_array))
return struct.unpack("<hhh", _b)
print(convert_to_int16_t(gyro_bytes))
#(-1249, 1693, 2)
print(convert_to_int16_t(acel_bytes))
#(32764, -32764, 4547)
Check if the control registers are correctly set after running the notochord. You can use this script:
it assumes the KCeptor value is 0. If you have another value just apply an XOR with it to the address.
The result should be:
CTRL_REG1_G
0x00
CTRL_REG2_G
0x00
CTRL_REG3_G
0x00
CTRL_REG4_G
0x38
CTRL_REG5_XL
0x38
CTRL_REG6_XL
0x00
CTRL_REG7_XL
0x00
CTRL_REG8
0x04
CTRL_REG9
0x00
CTRL_REG10
0x00