Skip to content

Commit b857209

Browse files
committed
Remove power() from imu.py
It has some edge cases with the rate functions. We could handle them, but that's more effort than just removing power(). It's not really needed for the XRP, but users can still reduce power consumption by sending '0Hz' to the rate functions.
1 parent 974edd9 commit b857209

1 file changed

Lines changed: 0 additions & 26 deletions

File tree

XRPLib/imu.py

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,6 @@ def __init__(self, scl_pin: int, sda_pin: int, addr):
4040
# Vector of IMU measurements
4141
self.irq_v = [[0, 0, 0], [0, 0, 0]]
4242

43-
# Power control
44-
self._power = True
45-
self._power_a = 0x10
46-
self._power_g = 0x10
47-
4843
# Copies of registers. Bytes and structs share the same memory
4944
# addresses, so changing one changes the other
5045
self.reg_ctrl1_xl_byte = bytearray(1)
@@ -423,27 +418,6 @@ def gyro_rate(self, value=None):
423418
self.timer_frequency = int(value.rstrip('Hz'))
424419
self._start_timer()
425420

426-
def power(self, on:bool=None):
427-
"""
428-
Turn the LSM6DSO on or off.
429-
Pass in no parameters to retrieve the current value
430-
431-
:param on: Whether to turn the LSM6DSO on or off, or None
432-
:type on: bool (or None)
433-
"""
434-
if on is None:
435-
return self._power
436-
else:
437-
self._power = on
438-
if on:
439-
self._r_w_reg(LSM_REG_CTRL1_XL, self._power_a, 0x0F)
440-
self._r_w_reg(LSM_REG_CTRL2_G, self._power_g, 0x0F)
441-
else:
442-
self._power_a = self._getreg(LSM_REG_CTRL1_XL) & 0xF0
443-
self._power_g = self._getreg(LSM_REG_CTRL2_G) & 0xF0
444-
self._r_w_reg(LSM_REG_CTRL1_XL, 0, 0x0F)
445-
self._r_w_reg(LSM_REG_CTRL2_G, 0, 0x0F)
446-
447421
def calibrate(self, calibration_time:float=1, vertical_axis:int= 2):
448422
"""
449423
Collect readings for [calibration_time] seconds and calibrate the IMU based on those readings

0 commit comments

Comments
 (0)