def panel_thread(): global running global powered global msg_until global msg_offset global message while running: if powered: if msg_until: bitmap = render_message_bitmap(message,0) if time.time() > msg_until: msg_until = None message = None else: bitmap = render_time_bitmap() hlock.acquire() for j in range(3): panels[j].setCompiledImage(bitmap) hlock.release() time.sleep(0.06) else: time.sleep(0.25) panels[0].setRelay(False) led_panel.shutdown()
def sigint_handler(signal, frame): print("Caught ctrl-C; shutting down.") panels[0].setRelay(False) led_panel.shutdown() sys.exit(0)
if __name__ == "__main__": if len(sys.argv) > 1 and sys.argv[1] == 'debug': debug = True led_panel.init(debug) panels[0].setRelay(True) def sigint_handler(signal, frame): print("Caught ctrl-C; shutting down.") panels[0].setRelay(False) led_panel.shutdown() sys.exit(0) signal.signal(signal.SIGINT, sigint_handler) while True: bitmap = render_time_bitmap() for j in range(3): panels[j].setCompiledImage(bitmap) time.sleep(0.10) panels[0].setRelay(False) led_panel.shutdown()
def sigint_handler(signal,frame): print("Caught ctrl-C; shutting down.") panels[0].setRelay(False) led_panel.shutdown() sys.exit(0)
if __name__=="__main__": if len(sys.argv) > 1 and sys.argv[1] == 'debug': debug = True led_panel.init(debug) panels[0].setRelay(True) def sigint_handler(signal,frame): print("Caught ctrl-C; shutting down.") panels[0].setRelay(False) led_panel.shutdown() sys.exit(0) signal.signal(signal.SIGINT,sigint_handler) while True: msg = time.strftime("%H:%M:%S") txtimg = base_font.strImg(msg) img = Image.new("1",(120,7)) img.paste(txtimg,(15,0)) img.paste(txtimg,(75,0)) bitmap = compile_image(img,0,0) for j in range(3): panels[j].setCompiledImage(bitmap) time.sleep(0.1) panels[0].setRelay(False) led_panel.shutdown()