File tree 1 file changed +3
-9
lines changed
1 file changed +3
-9
lines changed Original file line number Diff line number Diff line change 13
13
LIS2DW12_OUT_X_L = const (0x28 )
14
14
LIS2DW12_OUT_Y_L = const (0x2A )
15
15
LIS2DW12_OUT_Z_L = const (0x2C )
16
- LIS2DW12_2G = const (0 )
17
- LIS2DW12_4G = const (1 )
18
- LIS2DW12_8G = const (2 )
19
- LIS2DW12_16G = const (3 )
16
+
20
17
LIS2DW12_SCALE = ('2g' , '4g' , '8g' , '16g' )
21
18
22
19
class LIS2DW12 ():
@@ -96,7 +93,7 @@ def temperature(self):
96
93
try :
97
94
return self .int16 (self .get2reg (LIS2DW12_OUT_T_L ))/ 256 + 25
98
95
except MemoryError :
99
- self .temperature_irq ()
96
+ return self .temperature_irq ()
100
97
101
98
def temperature_irq (self ):
102
99
self .getreg (LIS2DW12_OUT_T_L + 1 )
@@ -107,10 +104,7 @@ def scale(self, dat=None):
107
104
if dat is None :
108
105
return LIS2DW12_SCALE [self ._scale ]
109
106
else :
110
- if type (dat ) is int :
111
- if dat > 3 or dat < 0 : return
112
- self ._scale = dat
113
- elif type (dat ) is str :
107
+ if type (dat ) is str :
114
108
if not dat in LIS2DW12_SCALE : return
115
109
self ._scale = LIS2DW12_SCALE .index (dat )
116
110
else : return
You can’t perform that action at this time.
0 commit comments