def ota(status=False):
    if status:
        term.header(True, "Starting update...")
        device.showLoadingScreen("OTA update")
    rtc = machine.RTC()
    rtc.write(0, 1)  # Boot mode selection magic
    rtc.write(1, 254)
    reboot()
def start(app, status=False):
    if status:
        if app == "" or app == "launcher":
            term.header(True, "Loading menu...")
        else:
            term.header(True, "Loading application " + app + "...")
        device.showLoadingScreen(app)
    machine.RTC().write_string(app)
    reboot()
def onB(pressed):
    if pressed:
        device.showLoadingScreen("Homescreen")
        system.home()
def onA(pressed):
    global currentApp, apps
    if pressed:
        device.showLoadingScreen(apps[currentApp]["name"])
        system.start(apps[currentApp]["path"])