@@ -233,6 +233,7 @@ def get_data(self):
233
233
self .disable ()
234
234
logging .debug ('getData_end"' )
235
235
236
+ # noinspection PyMissingConstructor
236
237
def __init__ (self , address = TSL2561_ADDR_FLOAT , debug = False ):
237
238
"""
238
239
Constructor
@@ -364,7 +365,7 @@ def get_luminosity(self):
364
365
return
365
366
366
367
# Read data until we find a valid range */
367
- _agcCheck = False
368
+ agc_check = False
368
369
while not valid :
369
370
_it = self ._tsl2561IntegrationTime
370
371
@@ -382,21 +383,21 @@ def get_luminosity(self):
382
383
self .get_data ()
383
384
384
385
# Run an auto-gain check if we haven't already done so ... */
385
- if not _agcCheck :
386
+ if not agc_check :
386
387
if (self ._broadband < _lo ) and (self ._tsl2561Gain == self .TSL2561_GAIN_1X ):
387
388
# Increase the gain and try again */
388
389
self .set_gain (self .TSL2561_GAIN_16X )
389
390
# Drop the previous conversion results */
390
391
self .get_data ()
391
392
# Set a flag to indicate we've adjusted the gain */
392
- _agcCheck = True
393
+ agc_check = True
393
394
elif (self ._broadband > _hi ) and (self ._tsl2561Gain == self .TSL2561_GAIN_16X ):
394
395
# Drop gain to 1x and try again */
395
396
self .set_gain (self .TSL2561_GAIN_1X )
396
397
# Drop the previous conversion results */
397
398
self .get_data ()
398
399
# Set a flag to indicate we've adjusted the gain */
399
- _agcCheck = True
400
+ agc_check = True
400
401
else :
401
402
# Nothing to look at here, keep moving ....
402
403
# Reading is either valid, or we're already at the chips limits */
@@ -436,7 +437,7 @@ def calculate_lux(self):
436
437
elif self ._tsl2561IntegrationTime == self .TSL2561_INTEGRATIONTIME_101MS :
437
438
ch_scale = self .TSL2561_LUX_CHSCALE_TINT1
438
439
else :
439
- ch_scale = ( 1 << self .TSL2561_LUX_CHSCALE )
440
+ ch_scale = 1 << self .TSL2561_LUX_CHSCALE
440
441
441
442
# Scale for gain (1x or 16x) */
442
443
if not self ._tsl2561Gain :
@@ -507,14 +508,14 @@ def calculate_lux(self):
507
508
# endif
508
509
509
510
# noinspection PyUnboundLocalVariable,PyUnboundLocalVariable
510
- temp = (( channel0 * b ) - (channel1 * m ) )
511
+ temp = (channel0 * b ) - (channel1 * m )
511
512
512
513
# Do not allow negative lux value */
513
514
if temp < 0 :
514
515
temp = 0
515
516
516
517
# Round lsb (2^(LUX_SCALE-1)) */
517
- temp += ( 1 << (self .TSL2561_LUX_LUXSCALE - 1 ) )
518
+ temp += 1 << (self .TSL2561_LUX_LUXSCALE - 1 )
518
519
519
520
# Strip off fractional portion */
520
521
lux = temp >> self .TSL2561_LUX_LUXSCALE
0 commit comments