current = badge.nvs_get_str('splash', 'ledApp', None) while True: options = [] for service in services: title = service if service == current: title += " [Enabled]" options.append(title) options.append(" None (disable LED services)") options.append("< Exit") selected = term.menu("Services", options, 0, "") if selected > len(services): system.home(True) if selected == len(services): current = None try: badge.nvs_erase_key('splash', 'ledApp') except: pass term.header(True, "Services") print("LED services disabled") time.sleep(1) else: current = services[selected] badge.nvs_set_str('splash', 'ledApp', current) term.header(True, "Services") print("Selected "+current) time.sleep(1)
splash = splash[7:len(splash)] badge.mount_sdcard() def back_button_default_action(pressed): if pressed: esp.rtcmem_write_string("") machine.deepsleep(1) ugfx.input_attach(ugfx.BTN_B, back_button_default_action) __import__(splash) else: ugfx.clear(ugfx.WHITE) ugfx.flush(ugfx.LUT_FULL) except BaseException as e: sys.print_exception(e) import easydraw easydraw.msg("", "Fatal exception", True) # if we started the splash screen and it is not the default splash screen, # then revert to original splash screen. if splash == badge.nvs_get_str('boot', 'splash', 'splash') and splash != 'splash': print(">> Restored default splashscreen! <<") badge.nvs_erase_key('boot', 'splash') easydraw.msg(str(e)) import time time.sleep(5) import appglue appglue.home()
current = badge.nvs_get_str('splash', 'logo', None) while True: options = [] for f in pictures: title = f if f == current: title += " [Enabled]" options.append(title) options.append("Default logo") options.append("< Exit") selected = term.menu("Picture", options, 0, "") if selected > len(pictures): system.home(True) if selected == len(pictures): current = None try: badge.nvs_erase_key('splash', 'logo') except: pass term.header(True, "Picture") print("Default picture selected") time.sleep(1) else: current = pictures[selected] badge.nvs_set_str('splash', 'logo', current) term.header(True, "Picture") print("Selected "+current) time.sleep(1)