Skip to content

Commit 1084371

Browse files
committedFeb 10, 2025·
Fix indentation for kx132 method
1 parent d3ec8a0 commit 1084371

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed
 

‎qwiic_kx13x.py

+25-25
Original file line numberDiff line numberDiff line change
@@ -910,31 +910,31 @@ def get_accel_data(self):
910910
self.get_raw_accel_data()
911911
self.conv_accel_data()
912912

913-
def conv_accel_data(self):
914-
"""!
915-
Converts raw acceleration data according to the range setting and
916-
stores it
917-
"""
918-
accel_range = self._i2c.readByte(self.address, self.KX13X_CNTL1)
919-
accel_range &= 0x18
920-
accel_range = accel_range >> 3
921-
922-
if accel_range == self.KX132_RANGE2G:
923-
self.kx132_accel.x = round(self.raw_output_data.x * self.CONV_2G, 6)
924-
self.kx132_accel.y = round(self.raw_output_data.y * self.CONV_2G, 6)
925-
self.kx132_accel.z = round(self.raw_output_data.z * self.CONV_2G, 6)
926-
elif accel_range == self.KX132_RANGE4G:
927-
self.kx132_accel.x = round(self.raw_output_data.x * self.CONV_4G, 6)
928-
self.kx132_accel.y = round(self.raw_output_data.y * self.CONV_4G, 6)
929-
self.kx132_accel.z = round(self.raw_output_data.z * self.CONV_4G, 6)
930-
elif accel_range == self.KX132_RANGE8G:
931-
self.kx132_accel.x = round(self.raw_output_data.x * self.CONV_8G, 6)
932-
self.kx132_accel.y = round(self.raw_output_data.y * self.CONV_8G, 6)
933-
self.kx132_accel.z = round(self.raw_output_data.z * self.CONV_8G, 6)
934-
elif accel_range == self.KX132_RANGE16G:
935-
self.kx132_accel.x = round(self.raw_output_data.x * self.CONV_16G, 6)
936-
self.kx132_accel.y = round(self.raw_output_data.y * self.CONV_16G, 6)
937-
self.kx132_accel.z = round(self.raw_output_data.z * self.CONV_16G, 6)
913+
def conv_accel_data(self):
914+
"""!
915+
Converts raw acceleration data according to the range setting and
916+
stores it
917+
"""
918+
accel_range = self._i2c.readByte(self.address, self.KX13X_CNTL1)
919+
accel_range &= 0x18
920+
accel_range = accel_range >> 3
921+
922+
if accel_range == self.KX132_RANGE2G:
923+
self.kx132_accel.x = round(self.raw_output_data.x * self.CONV_2G, 6)
924+
self.kx132_accel.y = round(self.raw_output_data.y * self.CONV_2G, 6)
925+
self.kx132_accel.z = round(self.raw_output_data.z * self.CONV_2G, 6)
926+
elif accel_range == self.KX132_RANGE4G:
927+
self.kx132_accel.x = round(self.raw_output_data.x * self.CONV_4G, 6)
928+
self.kx132_accel.y = round(self.raw_output_data.y * self.CONV_4G, 6)
929+
self.kx132_accel.z = round(self.raw_output_data.z * self.CONV_4G, 6)
930+
elif accel_range == self.KX132_RANGE8G:
931+
self.kx132_accel.x = round(self.raw_output_data.x * self.CONV_8G, 6)
932+
self.kx132_accel.y = round(self.raw_output_data.y * self.CONV_8G, 6)
933+
self.kx132_accel.z = round(self.raw_output_data.z * self.CONV_8G, 6)
934+
elif accel_range == self.KX132_RANGE16G:
935+
self.kx132_accel.x = round(self.raw_output_data.x * self.CONV_16G, 6)
936+
self.kx132_accel.y = round(self.raw_output_data.y * self.CONV_16G, 6)
937+
self.kx132_accel.z = round(self.raw_output_data.z * self.CONV_16G, 6)
938938

939939

940940
class QwiicKX134(QwiicKX13XCore):

0 commit comments

Comments
 (0)
Please sign in to comment.