File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -313,6 +313,12 @@ def setGain(self, gain):
313
313
# the TSL2561, adjusting gain if auto-gain is enabled
314
314
#**************************************************************************/
315
315
def getLuminosity (self ):
316
+ # This is a hack to ensure that when looping with autogain the gain can go up and down as without
317
+ # setting the gain to 1X before every reading it doesn't seem able to go from 16X
318
+ # back to 1X again. Going from 1X to 16X works fine. - IC
319
+ if (self ._tsl2561AutoGain ):
320
+ self .setGain (self .TSL2561_GAIN_1X )
321
+
316
322
if (self ._debug == True ): print "getLuminosity"
317
323
valid = False
318
324
@@ -484,7 +490,6 @@ def calculateLux(self):
484
490
# Calculates an averaged Lux value over default 30 samples
485
491
#**************************************************************************/
486
492
def calculateAvgLux (self , testavg = int (30 )):
487
- self .setGain (self .TSL2561_GAIN_1X )
488
493
# Set initial vars
489
494
count = 0
490
495
luxavgtotal = 0
You can’t perform that action at this time.
0 commit comments