Skip to content

Commit 6a47c4b

Browse files
committed
Move IMU timer definition
Needs to be defined before calling gyro_rate()
1 parent bfce0fa commit 6a47c4b

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

XRPLib/imu.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ def __init__(self, scl_pin: int, sda_pin: int, addr):
4949
self.reg_ctrl2_g_bits = struct(addressof(self.reg_ctrl2_g_byte), LSM_REG_LAYOUT_CTRL2_G)
5050
self.reg_ctrl3_c_bits = struct(addressof(self.reg_ctrl3_c_byte), LSM_REG_LAYOUT_CTRL3_C)
5151

52+
# Create timer
53+
self.update_timer = Timer(-1)
54+
5255
# Check if the IMU is connected
5356
if not self.is_connected():
5457
# TODO - do somehting intelligent here
@@ -77,10 +80,6 @@ def __init__(self, scl_pin: int, sda_pin: int, addr):
7780
self.running_yaw = 0
7881
self.running_roll = 0
7982

80-
# Create timer
81-
self.update_timer = Timer(-1)
82-
83-
8483
"""
8584
The following are private helper methods to read and write registers, as well as to convert the read values to the correct unit.
8685
"""

0 commit comments

Comments
 (0)