@@ -14,6 +14,7 @@ CONFIG_FILE = "/etc/plasma/plasma.conf"
1414PIPE_FILE = "/tmp/plasma"
1515PATTERNS = "/etc/plasma/"
1616FPS = 30
17+ BRIGHTNESS = 1.0
1718LIGHTS = 10 # Actual number of pixels is 4x this number
1819DEBUG = False
1920
@@ -115,6 +116,12 @@ def main():
115116 log ("Framerate set to: {}fps" .format (rgb [1 ]))
116117 except ValueError :
117118 log ("Invalid framerate: {}" .format (rgb [1 ]))
119+ elif len (rgb ) == 2 and rgb [0 ] == "brightness" :
120+ try :
121+ args .brightness = float (rgb [1 ])
122+ log ("Brightness set to: {}" .format (args .brightness ))
123+ except ValueError :
124+ log ("Invalid brightness {}" .format (rgb [1 ]))
118125 else :
119126 pattern , pattern_w , pattern_h , pattern_meta = load_pattern (command )
120127 alpha = pattern_meta ['alpha' ]
@@ -126,9 +133,9 @@ def main():
126133 for x in range (plasma .get_pixel_count ()):
127134 offset_x = (x * channels ) % (pattern_w * channels )
128135 r , g , b = row [offset_x :offset_x + 3 ]
129- plasma .set_pixel (x , r , g , b )
136+ plasma .set_pixel (x , r , g , b , brightness = args . brightness )
130137 else :
131- plasma .set_all (r , g , b )
138+ plasma .set_all (r , g , b , brightness = args . brightness )
132139
133140 plasma .show ()
134141
@@ -152,6 +159,8 @@ def get_args():
152159 help = "run plasma as a daemon" )
153160 parser .add_argument ("-f" , "--fps" , type = int , default = FPS ,
154161 help = "set plasma LED update framerate" )
162+ parser .add_argument ("-b" , "--brightness" , type = float , default = BRIGHTNESS ,
163+ help = "set plasma LED brightness" )
155164 parser .add_argument ("-c" , "--config" , type = str , default = CONFIG_FILE ,
156165 help = "path to plasma config file" )
157166 return parser .parse_known_args ()[0 ]
0 commit comments