File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,10 @@ def print(self, value):
51
51
:type value: str or int or float
52
52
53
53
"""
54
+ # Attempt to round off so we can still display the value
55
+ if isinstance (value , float ) and len (str (value )) > 5 :
56
+ value = round (value )
57
+
54
58
self ._segments .print (value )
55
59
self ._segments .show ()
56
60
@@ -97,8 +101,10 @@ def brightness(self):
97
101
Brightness returns the current display brightness.
98
102
0-15 = Dimmest to Brightest Setting
99
103
"""
100
- return self ._segments .brightness
104
+ return round ( self ._segments .brightness * 15 )
101
105
102
106
@brightness .setter
103
107
def brightness (self , brightness ):
104
- self ._segments .brightness = brightness
108
+ if not 0 <= brightness <= 15 :
109
+ raise ValueError ('Brightness must be a value between 0 and 15' )
110
+ self ._segments .brightness = brightness / 15
Original file line number Diff line number Diff line change @@ -174,8 +174,10 @@ def brightness(self):
174
174
Brightness returns the current display brightness.
175
175
0-15 = Dimmest to Brightest Setting
176
176
"""
177
- return self ._matrix .brightness
177
+ return round ( self ._matrix .brightness * 15 )
178
178
179
179
@brightness .setter
180
180
def brightness (self , brightness ):
181
- self ._matrix .brightness = brightness
181
+ if not 0 <= brightness <= 15 :
182
+ raise ValueError ('Brightness must be a value between 0 and 15' )
183
+ self ._matrix .brightness = brightness / 15
You can’t perform that action at this time.
0 commit comments