@@ -81,7 +81,7 @@ class PyBadger:
81
81
BUTTON_A = const (2 )
82
82
BUTTON_B = const (1 )
83
83
84
- def __init__ (self , i2c = None ):
84
+ def __init__ (self , i2c = None , * , pixels_brightness = 1.0 ):
85
85
# Accelerometer
86
86
if i2c is None :
87
87
try :
@@ -103,6 +103,7 @@ def __init__(self, i2c=None):
103
103
104
104
# Display
105
105
self .display = board .DISPLAY
106
+ self ._display_brightness = 1.0
106
107
107
108
# Light sensor
108
109
self ._light_sensor = analogio .AnalogIn (board .A7 )
@@ -116,7 +117,7 @@ def __init__(self, i2c=None):
116
117
# Count is hardcoded - should be based on board ID, currently no board info for PyBadge LC
117
118
neopixel_count = 5
118
119
self ._neopixels = neopixel .NeoPixel (board .NEOPIXEL , neopixel_count ,
119
- pixel_order = neopixel .GRB )
120
+ brightness = pixels_brightness , pixel_order = neopixel .GRB )
120
121
121
122
# Auto dim display based on movement
122
123
self ._last_accelerometer = None
@@ -154,7 +155,7 @@ def auto_dim_display(self, delay=5.0, movement_threshold=10):
154
155
self .display .brightness = 0.1
155
156
self ._start_time = current_time
156
157
else :
157
- self .display .brightness = 1
158
+ self .display .brightness = self . _display_brightness
158
159
159
160
@property
160
161
def pixels (self ):
@@ -206,7 +207,7 @@ def light(self):
206
207
207
208
@property
208
209
def acceleration (self ):
209
- """Accelerometer data."""
210
+ """Accelerometer data, +/- 2G sensitivity ."""
210
211
return self ._accelerometer .acceleration if self ._accelerometer is not None else None
211
212
212
213
@property
@@ -216,6 +217,7 @@ def brightness(self):
216
217
217
218
@brightness .setter
218
219
def brightness (self , value ):
220
+ self ._display_brightness = value
219
221
self .display .brightness = value
220
222
221
223
# pylint: disable=too-many-locals
0 commit comments