Skip to content

Commit 7f59bb5

Browse files
S-Golm-rtijn
andauthored
Update mpu6050/mpu6050.py
Co-authored-by: Martijn <martijn@mrtijn.nl>
1 parent ab14069 commit 7f59bb5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

mpu6050/mpu6050.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,9 @@ def set_gyro_range(self, gyro_range):
190190

191191
def set_filter_range(self, filter_range=FILTER_BW_256):
192192
"""Sets the low-pass bandpass filter frequency"""
193-
#TODO - Currently overwrites bits 3,4,5 used for FSYNC pin. Change implementation to fix this.
194-
return self.bus.write_byte_data(self.address, self.MPU_CONFIG,filter_range)
193+
# Keep the current EXT_SYNC_SET configuration in bits 3, 4, 5 in the MPU_CONFIG register
194+
EXT_SYNC_SET = self.bus.read_byte_data(self.address, self.MPU_CONFIG) & 0b00111000
195+
return self.bus.write_byte_data(self.address, self.MPU_CONFIG, EXT_SYNC_SET | filter_range)
195196

196197

197198
def read_gyro_range(self, raw = False):

0 commit comments

Comments
 (0)