def showAuthScreen(): # start bt81x.dl_start() bt81x.clear(1, 1, 1) # image image = bt81x.Bitmap( 1, 0, (bt81x.ARGB4, 420 * 2), (bt81x.BILINEAR, bt81x.BORDER, bt81x.BORDER, 420, 480)) image.prepare_draw() image.draw((0, 0), vertex_fmt=0) # text txt = bt81x.Text( 590, 220, 28, bt81x.OPT_CENTERX | bt81x.OPT_CENTERY, "Press the push-link button of the Hue", ) bt81x.add_text(txt) txt.text = "bridge you want to connect to" txt.x = 590 txt.y = 260 bt81x.add_text(txt) # display bt81x.display() bt81x.swap_and_empty()
def displayUpdate(): global cpu_temp global cpu_load image_1 = bt81x.Bitmap( 1, 0, (bt81x.ARGB4, RLOGO_W * 2), (bt81x.BILINEAR, bt81x.BORDER, bt81x.BORDER, RLOGO_W, RLOGO_H)) bt81x.dl_start() bt81x.load_image(0, 0, 'rlogo.png') bt81x.clear(1, 1, 1) bt81x.set_background(255, 255, 255) image_1.prepare_draw() image_1.draw((248, 35), vertex_fmt=0) txt_temp = bt81x.Text( 500, 260, 31, bt81x.OPT_RIGHTX | bt81x.OPT_CENTERY, "Temperature : %2.1f" % cpu_temp, ) txt_load = bt81x.Text( 500, 320, 31, bt81x.OPT_RIGHTX | bt81x.OPT_CENTERY, "Load : %2.1f" % cpu_load, ) bt81x.add_text(txt_temp) bt81x.add_text(txt_load) bt81x.display() bt81x.swap_and_empty()
def showScreensaver(x, y): # start bt81x.dl_start() bt81x.clear_color(rgb=(0x00, 0x00, 0x00)) bt81x.clear(1, 1, 1) # image image = bt81x.Bitmap(1, 0, (bt81x.ARGB4, (300) * 2), (bt81x.BILINEAR, bt81x.BORDER, bt81x.BORDER, 300, 75)) image.prepare_draw() image.draw((x, y), vertex_fmt=0) # display bt81x.display() bt81x.swap_and_empty()
def showLogo(): # start bt81x.dl_start() bt81x.clear_color(rgb=(0xff, 0xff, 0xff)) bt81x.clear(1, 1, 1) # image image = bt81x.Bitmap( 1, 0, (bt81x.ARGB4, 642 * 2), (bt81x.BILINEAR, bt81x.BORDER, bt81x.BORDER, 642, 144)) image.prepare_draw() image.draw(((bt81x.display_conf.width - 642) // 2, (bt81x.display_conf.height - 144) // 2), vertex_fmt=0) # display bt81x.display() bt81x.swap_and_empty()
def showAddrScreen(ip): # start bt81x.dl_start() bt81x.clear(1, 1, 1) # image image = bt81x.Bitmap( 1, 0, (bt81x.ARGB4, 200 * 2), (bt81x.BILINEAR, bt81x.BORDER, bt81x.BORDER, 200, 200)) image.prepare_draw() image.draw((0, 255), vertex_fmt=0) # text txt = bt81x.Text( 225, 120, 29, bt81x.OPT_CENTERX | bt81x.OPT_CENTERY, "Enter IP address of HUE Bridge:", ) bt81x.add_text(txt) txt.text = ip txt.x = 225 txt.y = 195 txt.font = 31 bt81x.add_text(txt) # keys bt81x.track(450, 350, 280, 60, 0) bt81x.add_keys(450, 70, 280, 60, 30, 0, "123") bt81x.add_keys(450, 140, 280, 60, 30, 0, "456") bt81x.add_keys(450, 210, 280, 60, 30, 0, "789") bt81x.add_keys(450, 280, 280, 60, 30, 0, ".0C") # connect button btn = bt81x.Button(450, 350, 280, 60, 30, 0, "Connect") bt81x.tag(1) bt81x.add_button(btn) bt81x.display() bt81x.swap_and_empty()
def showMainMenu(saturation, hue, brightness): # start bt81x.dl_start() bt81x.clear(1, 1, 1) # image image = bt81x.Bitmap(1, 0, (bt81x.ARGB4, 800 * 2), (bt81x.BILINEAR, bt81x.BORDER, bt81x.BORDER, 800, 50)) image.prepare_draw() image.draw((0, 0), vertex_fmt=0) # buttons btn = bt81x.Button(0, 0, 170, 70, 31, 0, "") for button in buttons: btn.text = button["text"] btn.font = button["size"] btn.x = button["x_cord"] btn.y = button["y_cord"] btn.width = button["width"] btn.height = button["height"] bt81x.track(btn.x, btn.y, button["width"], button["height"], button["tag_id"]) bt81x.tag(button["tag_id"]) bt81x.add_button(btn) # text labels txt = bt81x.Text(0, 0, 0, 30, "") for label in labels: txt.text = label["text"] txt.x = label["x_cord"] txt.y = label["y_cord"] txt.font = label["size"] txt.options = label["options"] bt81x.add_text(txt) # saturation value label txt.text = str(int((saturation / 240) * 100)) + '%' txt.x = 622 txt.y = 175 txt.font = 30 txt.options = bt81x.OPT_CENTER bt81x.add_text(txt) # hue value label txt.text = str(int((hue / 65500) * 100)) + '%' txt.x = 622 txt.y = 275 txt.font = 30 txt.options = bt81x.OPT_CENTER bt81x.add_text(txt) # brightness value label txt.text = str(int((brightness / 240) * 100)) + '%' txt.x = 622 txt.y = 375 txt.font = 30 txt.options = bt81x.OPT_CENTER bt81x.add_text(txt) # display bt81x.display() bt81x.swap_and_empty()
import streams from riverdi.displays.bt81x import ctp50 from bridgetek.bt81x import bt81x streams.serial() new_resource('RiverdiLogo.png') LOGO_W = 642 LOGO_H = 144 linestride = LOGO_W * 2 # with ARGB1555 and ARGB4 formats, 2 bytes per pixel layout = (bt81x.ARGB4, linestride) # choose this layout for RiverdiLogo.png riverdi_logo = bt81x.Bitmap( 1, 0, layout, (bt81x.BILINEAR, bt81x.BORDER, bt81x.BORDER, LOGO_W, LOGO_H)) bt81x.init(SPI0, D4, D5, D34) bt81x.load_image(0, 0, 'RiverdiLogo.png') bt81x.dl_start() bt81x.clear_color(rgb=(0xff, 0xff, 0xff)) bt81x.clear(1, 1, 0) riverdi_logo.prepare_draw() riverdi_logo.draw(((bt81x.display_conf.width - LOGO_W) // 2, (bt81x.display_conf.height - LOGO_H) // 2), vertex_fmt=0) bt81x.display()