From 06e7a308632efc97bd119d7a81ad07eb55d8a293 Mon Sep 17 00:00:00 2001 From: siddacious Date: Tue, 4 Feb 2020 12:42:20 -0800 Subject: [PATCH 1/2] fixing magnetometer for issue #1 --- adafruit_lis3mdl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adafruit_lis3mdl.py b/adafruit_lis3mdl.py index 85a8668..8d01fe6 100644 --- a/adafruit_lis3mdl.py +++ b/adafruit_lis3mdl.py @@ -72,7 +72,7 @@ _LIS3MDL_INT_CFG = const(0x30) # Interrupt configuration register _LIS3MDL_INT_THS_L = const(0x32) # Low byte of the irq threshold -_GAUSS_TO_MT = 0.1 #1 Gauss [G] = 0.1 Millitesla [mT] +_GAUSS_TO_MT = 100 class CV: """struct helper""" From 6b090ba40897d8cf807a3ac15a5f04c520887001 Mon Sep 17 00:00:00 2001 From: siddacious Date: Tue, 4 Feb 2020 12:47:48 -0800 Subject: [PATCH 2/2] fixing conversion unit name --- adafruit_lis3mdl.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/adafruit_lis3mdl.py b/adafruit_lis3mdl.py index 8d01fe6..fa065b3 100644 --- a/adafruit_lis3mdl.py +++ b/adafruit_lis3mdl.py @@ -72,7 +72,7 @@ _LIS3MDL_INT_CFG = const(0x30) # Interrupt configuration register _LIS3MDL_INT_THS_L = const(0x32) # Low byte of the irq threshold -_GAUSS_TO_MT = 100 +_GAUSS_TO_UT = 100 class CV: """struct helper""" @@ -233,7 +233,7 @@ def magnetic(self): return(x, y, z) def _scale_mag_data(self, raw_measurement): #pylint: disable=no-self-use - return (raw_measurement / Range.lsb[self.range]) * _GAUSS_TO_MT + return (raw_measurement / Range.lsb[self.range]) * _GAUSS_TO_UT @property def range(self):