示例#1
0
import term_menu, tasks.powermanagement as pm

umenu = term_menu.UartMenu(None, pm, False)
umenu.main()

start()


def goToSleep(unused_variable=None):
    system.home()


# Read configuration from NVS or apply default values
cfg_term_menu = machine.nvs_get_u8(
    'splash',
    'term_menu')  # Show a menu on the serial port instead of a prompt
if cfg_term_menu == None:
    cfg_term_menu = True  # If not set the menu is shown

# Scheduler
virtualtimers.activate(100)  # Start scheduler with 100ms ticks
virtualtimers.new(100, updateEink)

# Terminal menu
if cfg_term_menu:
    init_power_management()
    umenu = term_menu.UartMenu(system.home, pm, False, "< Back")
    umenu.main()

#(Note: power management is disabled when the menu is disabled, to keep the python prompt clean and usefull)

term.header(True, "Python shell")
print("Type \"import menu\" to access the menu.")
示例#3
0
print('[BOOT] Choosing boot mode')
if badge.safe_mode():
	print('[BOOT] Safe mode')
	# draw(False)
	# services.force_draw()
	# draw(True)
else:
	print('[BOOT] Normal boot mode')
	print('[BOOT] Finding services')
	have_services = services.setup() # Start services
	if not have_services:
		print('[BOOT] No services found')
		# draw(False)
		# services.force_draw()
		# draw(True)

print('[BOOT] Disabling WiFi and running garbage collection')
easywifi.disable()
gc.collect()

# virtualtimers.activate(25)
# pm.callback(onSleep)
# pm.feed()
#
# virtualtimers.new(10, ledAnimationTask)

print('[BOOT] Launching UART menu')
umenu = term_menu.UartMenu(goToSleep, pm, badge.safe_mode())
umenu.main()
示例#4
0
led_app = None
if cfg_led_animation != None:
	try:
		led_app = __import__('/lib/'+cfg_led_animation+'/ledsrv')
		try:
			led_app.init()
		except:
			pass
	except:
		pass
else:
	_thread.start_new_thread("LED", ledThread, ())

# Terminal menu

if cfg_term_menu:
	umenu = term_menu.UartMenu(cbSleep, pm, False)
	umenu.main()
else:
	print("Welcome!")
	print("The homescreen and it's services are currently being run.")
	print("Press CTRL+C to reboot directly to a Python prompt.")
	wait = True
	while wait:
		c = machine.stdin_get(1,1)
		if c == "\x03" or c == "\x04": # CTRL+C or CTRL+D
			wait = False
	stopThreads = True
	import shell
    buttons.register(defines.BTN_UP, input_up)
    buttons.register(defines.BTN_DOWN, input_down)
    buttons.register(defines.BTN_LEFT, input_left)
    buttons.register(defines.BTN_RIGHT, input_right)

    populate_apps()
    render_current_app()


start()
init_power_management()

# Install CZ countdown app to replace activities app
if not machine.nvs_getint('system', 'czcount_inst'):
    import uinterface
    if uinterface.connect_wifi():
        import woezel
        uinterface.loading_text('Installing CZ20 countdown')
        if woezel.is_installed('campzone_2020_countdown') or woezel.install(
                'campzone_2020_countdown'):
            machine.nvs_setint('system', 'czcount_inst', 1)
            system.reboot()
        else:
            rgb.clear()
            uinterface.skippabletext('Installation failed')

    render_current_app()

menu = term_menu.UartMenu(deepsleep.start_sleeping, pm)
menu.main()
示例#6
0
import system, display, valuestore, wifi
import os, term_menu, time, machine
import hardware

menu = term_menu.UartMenu()
menu.main()

hardware.mountsd()