Skip to content

Commit bbf620f

Browse files
committed
Fix SensorSaturatedException.
I'm not sure whether this ever worked for me, but the old code certainly doesn't work on Python 2.7 for me now. The replacement code does what I intended the old code to do, plus adds a channel instance variable in case that's useful to anyone.
1 parent 24a54ff commit bbf620f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Adafruit_TSL2561/Adafruit_TSL2561.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@ def _sleepms(ms):
1818
class SensorSaturatedException(Exception):
1919
"""Used when the sensor is saturated and cannot provide accurate readings."""
2020
def __init__(self, channel):
21+
self.channel = channel
2122
if type(channel) == int:
22-
self.msg('Channel {0} is saturated.'.format(channel))
23+
message = 'Channel {0} is saturated.'.format(channel)
2324
else:
24-
self.msg('Both channels are saturated.')
25+
message = 'Both channels are saturated.'
26+
super(SensorSaturatedException, self).__init__(message)
2527

2628

2729
class _integrationTime:

0 commit comments

Comments
 (0)