def start():
	ugfx.input_init()
	ugfx.set_lut(ugfx.LUT_FASTER)
	ugfx.clear(ugfx.WHITE)

	# Instructions
	if orientation.isLandscape():
		if display.width() > 128:
			x0 = int(display.width()/2)
			currentY = 20
			
			display.drawText(x0+((display.width()-x0)//2)-(display.getTextWidth("BADGE.TEAM", "fairlight12")//2), currentY, "BADGE.TEAM\n", 0x000000, "fairlight12")
			currentY += display.getTextHeight("BADGE.TEAM", "fairlight12")
			
			display.drawText(x0+int((display.width()-x0)/2)-int(display.getTextWidth("ESP32 platform", "roboto_regular12")/2), currentY, "ESP32 platform\n", 0x000000, "roboto_regular12")
			display.drawLine(x0,0,x0,display.height()-1,0x000000)
			pixHeight = display.getTextHeight(" ", "roboto_regular12")
			currentY = pixHeight*5
			
			lineY = display.height()-pixHeight*6-pixHeight//2
			display.drawLine(x0, lineY, display.width()-1, lineY, 0x000000)
			
			display.drawText(x0+5, display.height()-pixHeight*6, "A: Run\n", 0x000000, "roboto_regular12")
			display.drawText(x0+5, display.height()-pixHeight*5, "START: Return to home\n", 0x000000, "roboto_regular12")
			display.drawText(x0+5, display.height()-pixHeight*4, "SELECT: Uninstall app\n", 0x000000, "roboto_regular12")
			
			lineY = display.height()-pixHeight*2-pixHeight//2
			display.drawLine(x0, lineY, display.width()-1, lineY, 0x000000)
			display.drawText(x0+5, display.height()-pixHeight*2, consts.INFO_FIRMWARE_NAME, 0x000000, "roboto_regular12")
			display.drawText(x0+5, display.height()-pixHeight, "Build "+str(consts.INFO_FIRMWARE_BUILD), 0x000000, "roboto_regular12")
	else:
		pixHeight = display.getTextHeight(" ", "roboto_regular12")
		display.drawLine(0, display.height()-18*4, display.width(), display.height()-18*4, ugfx.BLACK)
		display.drawText(0, display.height()-pixHeight*6, "A: Run\n", 0x000000, "roboto_regular12")
		display.drawText(0, display.height()-pixHeight*5, "START: Home\n", 0x000000, "roboto_regular12")
		display.drawText(0, display.height()-pixHeight*4, "SELECT: Uninstall\n", 0x000000, "roboto_regular12")
		
		lineY = display.height()-pixHeight*2-pixHeight//2
		display.drawLine(0, lineY, display.width()-1, lineY, 0x000000)
		display.drawText(0, display.height()-pixHeight*2, consts.INFO_FIRMWARE_NAME, 0x000000, "roboto_regular12")
		display.drawText(0, display.height()-pixHeight, "Build "+str(consts.INFO_FIRMWARE_BUILD), 0x000000, "roboto_regular12")

	global options
	global install_path
	options = None
	install_path = None

	ugfx.input_attach(ugfx.BTN_OK,    input_a)
	ugfx.input_attach(ugfx.BTN_BACK,  input_b)
	ugfx.input_attach(ugfx.JOY_UP,    input_other)
	ugfx.input_attach(ugfx.JOY_DOWN,  input_other)
	ugfx.input_attach(ugfx.JOY_RIGHT, input_a)
	ugfx.input_attach(ugfx.JOY_LEFT, input_select)

	populate_apps()
	populate_category()
	populate_options()

	# do a greyscale flush on start
	ugfx.flush(ugfx.GREYSCALE)
示例#2
0
def start():
    ugfx.input_init()
    ugfx.set_lut(ugfx.LUT_FASTER)
    ugfx.clear(ugfx.WHITE)

    # Instructions
    if orientation.isLandscape():
        ugfx.line(148, 78, 296, 78, ugfx.BLACK)
        ugfx.string_box(148, 78, 148, 18, " A: Run", "Roboto_Regular12",
                        ugfx.BLACK, ugfx.justifyLeft)
        ugfx.string_box(148, 78, 148, 18, " B: Return to home",
                        "Roboto_Regular12", ugfx.BLACK, ugfx.justifyRight)
        ugfx.string_box(148, 92, 148, 18, " SELECT: Uninstall",
                        "Roboto_Regular12", ugfx.BLACK, ugfx.justifyLeft)
        ugfx.line(148, 110, 296, 110, ugfx.BLACK)
        ugfx.string_box(148, 110, 148, 18, " " + version.name,
                        "Roboto_Regular12", ugfx.BLACK, ugfx.justifyLeft)
    else:
        ugfx.line(0,
                  ugfx.height() - 18 * 4, ugfx.width(),
                  ugfx.height() - 18 * 4, ugfx.BLACK)
        ugfx.string_box(0,
                        ugfx.height() - 18 * 4, ugfx.width(), 18, " A: Run",
                        "Roboto_Regular12", ugfx.BLACK, ugfx.justifyLeft)
        ugfx.string_box(0,
                        ugfx.height() - 18 * 3, ugfx.width(), 18,
                        " B: Return to home", "Roboto_Regular12", ugfx.BLACK,
                        ugfx.justifyLeft)
        ugfx.string_box(0,
                        ugfx.height() - 18 * 2, ugfx.width(), 18,
                        " SELECT: Uninstall", "Roboto_Regular12", ugfx.BLACK,
                        ugfx.justifyLeft)
        ugfx.line(0,
                  ugfx.height() - 18 * 1, ugfx.width(),
                  ugfx.height() - 18 * 1, ugfx.BLACK)
        ugfx.string_box(0,
                        ugfx.height() - 18 * 1, ugfx.width(), 18,
                        " " + version.name, "Roboto_Regular12", ugfx.BLACK,
                        ugfx.justifyLeft)

    global options
    global install_path
    options = None
    install_path = None

    ugfx.input_attach(ugfx.BTN_A, input_a)
    ugfx.input_attach(ugfx.BTN_B, input_b)
    ugfx.input_attach(ugfx.BTN_SELECT, input_select)
    ugfx.input_attach(ugfx.JOY_UP, input_other)
    ugfx.input_attach(ugfx.JOY_DOWN, input_other)
    ugfx.input_attach(ugfx.JOY_LEFT, input_other)
    ugfx.input_attach(ugfx.JOY_RIGHT, input_other)
    ugfx.input_attach(ugfx.BTN_START, input_other)

    populate_apps()
    populate_category()
    populate_options()

    # do a greyscale flush on start
    ugfx.flush(ugfx.GREYSCALE)
def populate_options():
    global options
    if orientation.isLandscape():
        options = ugfx.List(0, 0, int(ugfx.width() / 2), ugfx.height())
    else:
        options = ugfx.List(0, 0, ugfx.width(), int(ugfx.height() - 18 * 4))
    global currentListTitles
    for title in currentListTitles:
        options.add_item(title)
示例#4
0
import display, badge, version, time, orientation, machine

if orientation.isLandscape():
    NUM_LINES = 9
else:
    NUM_LINES = 21


# Functions
def msg_nosplit(message, title='Loading...', reset=False):
    global NUM_LINES
    """Show a terminal style loading screen with title

	title can be optionaly set when resetting or first call
	"""
    global messageHistory

    try:
        messageHistory
        if reset:
            raise exception
    except:
        display.greyscale(False)
        display.fill(0xFFFFFF)
        display.textColor(0x000000)
        display.font(version.font_header)
        display.cursor(0, 0)
        display.print(title)
        messageHistory = []

    display.font(version.font_default)
def start():
    ugfx.input_init()
    ugfx.set_lut(ugfx.LUT_FASTER)
    ugfx.clear(ugfx.WHITE)

    # Instructions
    if orientation.isLandscape():
        x0 = int(display.width() / 2)
        display.font("fairlight8")
        currentY = 20
        display.cursor(
            x0 + int((display.width() - x0) / 2) -
            int(display.get_string_width("BADGE.TEAM") / 2), currentY)
        display.print("BADGE.TEAM\n")
        display.font("pixelade9")
        (_, currentY) = display.cursor()
        display.cursor(
            x0 + int((display.width() - x0) / 2) -
            int(display.get_string_width("ESP32 platform") / 2), currentY)
        display.print("ESP32 platform\n")
        display.line(x0, 0, x0, display.height() - 1, 0x000000)
        display.textColor(0x000000)
        display.font("pixelade9")
        currentY = display.get_string_height(" ") * 5 - 5
        display.line(x0, currentY, display.width() - 1, currentY, 0x000000)
        display.cursor(x0 + 5, currentY + 5)
        display.print("A: Run\n")
        display.print("B: Return to home\n")
        display.print("SELECT: Uninstall app\n")
        (_, currentY) = display.cursor()
        display.line(x0, currentY, display.width() - 1, currentY, 0x000000)
        _ = display.cursor(x0 + 5, currentY + 5)
        display.print(consts.INFO_FIRMWARE_NAME)
    else:
        ugfx.line(0,
                  ugfx.height() - 18 * 4, ugfx.width(),
                  ugfx.height() - 18 * 4, ugfx.BLACK)
        ugfx.string_box(0,
                        ugfx.height() - 18 * 4, ugfx.width(), 18, " A: Run",
                        "Roboto_Regular12", ugfx.BLACK, ugfx.justifyLeft)
        ugfx.string_box(0,
                        ugfx.height() - 18 * 3, ugfx.width(), 18,
                        " B: Return to home", "Roboto_Regular12", ugfx.BLACK,
                        ugfx.justifyLeft)
        ugfx.string_box(0,
                        ugfx.height() - 18 * 2, ugfx.width(), 18,
                        " SELECT: Uninstall", "Roboto_Regular12", ugfx.BLACK,
                        ugfx.justifyLeft)
        ugfx.line(0,
                  ugfx.height() - 18 * 1, ugfx.width(),
                  ugfx.height() - 18 * 1, ugfx.BLACK)
        ugfx.string_box(0,
                        ugfx.height() - 18 * 1, ugfx.width(), 18,
                        " " + consts.INFO_FIRMWARE_NAME, "Roboto_Regular12",
                        ugfx.BLACK, ugfx.justifyLeft)

    global options
    global install_path
    options = None
    install_path = None

    ugfx.input_attach(ugfx.BTN_A, input_a)
    ugfx.input_attach(ugfx.BTN_B, input_b)
    ugfx.input_attach(ugfx.BTN_SELECT, input_select)
    ugfx.input_attach(ugfx.JOY_UP, input_other)
    ugfx.input_attach(ugfx.JOY_DOWN, input_other)
    ugfx.input_attach(ugfx.JOY_LEFT, input_other)
    ugfx.input_attach(ugfx.JOY_RIGHT, input_other)
    ugfx.input_attach(ugfx.BTN_START, input_other)

    populate_apps()
    populate_category()
    populate_options()

    # do a greyscale flush on start
    ugfx.flush(ugfx.GREYSCALE)