Пример #1
0
def main():
    while True:
        try:
            unittest.main()
        except MemoryError as e:
            #print("MemoryError:", e)
            pyb.info()
            raise
Пример #2
0
def main():
    while True:
        try:
            unittest.main()
        except MemoryError as e:
            #print("MemoryError:", e)
            pyb.info()
            raise
Пример #3
0
 def testMaxFutures(self):
     fl = []
     for i in range(1000):
         try:
             n = i
             fl.append(Future())
         except MemoryError as e:
             pyb.info()
             del (fl)
             print("Got %d empty futures before running out of memory" % n)
             return
Пример #4
0
 def testMaxFutures(self):
     fl = []
     for i in range(1000):
         try:
             n = i
             fl.append(Future())
         except MemoryError as e:
             pyb.info()
             del(fl)
             print("Got %d empty futures before running out of memory" % n)
             return
Пример #5
0
 def main_loop(q):
     a = 0
     while(1):
         a += 1
         if a % 100000 == 0:
             #q.demo_lcd()
             pass
         if a == 1000000:
             print(str(a) + 'cycles')
             a = 0
         pass
     #pyb.wfi() # https://docs.micropython.org/en/latest/pyboard/library/pyb.html
     #pyb.standby()
     pyb.info()
Пример #6
0
				return None

			if buttons.is_triggered("BTN_A"):
				return displayed_apps[options.selected_index()]

	finally:
		for component in components:
			component.destroy()

app_to_load = file_loader()
if app_to_load:
	try:
		buttons.enable_menu_reset()
		empty_local_app_cache()
		gc.collect()
		pyb.info()
		print("Loading: %s" % app_to_load)
		mod = __import__(app_to_load.main_path[:-3])
		if "main" in dir(mod):
			mod.main()
	except Exception as e:
		s = uio.StringIO()
		sys.print_exception(e, s)
		u=pyb.USB_VCP()
		if u.isconnected():
			raise(e)
		else:
			ugfx.clear()
			ugfx.set_default_font(ugfx.FONT_SMALL)
			w=ugfx.Container(0,0,ugfx.width(),ugfx.height())
			l=ugfx.Label(0,0,ugfx.width(),ugfx.height(),s.getvalue(),parent=w)
Пример #7
0
            if buttons.is_triggered("BTN_A"):
                return displayed_apps[options.selected_index()]

    finally:
        for component in components:
            component.destroy()


app_to_load = file_loader()
if app_to_load:
    try:
        buttons.enable_menu_reset()
        empty_local_app_cache()
        gc.collect()
        pyb.info()
        print("Loading: %s" % app_to_load)
        mod = __import__(app_to_load.main_path[:-3])
        if "main" in dir(mod):
            mod.main()
    except Exception as e:
        s = uio.StringIO()
        sys.print_exception(e, s)
        u = pyb.USB_VCP()
        if u.isconnected():
            raise (e)
        else:
            ugfx.clear()
            ugfx.set_default_font(ugfx.FONT_SMALL)
            w = ugfx.Container(0, 0, ugfx.width(), ugfx.height())
            l = ugfx.Label(0,