Removed DBs that won't be used (using ACV until I can find an ESV). Added boot.py that's needed for micropython. Main.py scheduler needs to be cleaned up.
This commit is contained in:
7
boot.py
Normal file
7
boot.py
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# boot.py -- run on boot-up
|
||||||
|
# can run arbitrary Python, but best to keep it minimal
|
||||||
|
|
||||||
|
import pyb
|
||||||
|
#pyb.main('main.py') # main script to run after this one
|
||||||
|
#pyb.usb_mode('CDC+MSC') # act as a serial and a storage device
|
||||||
|
#pyb.usb_mode('CDC+HID') # act as a serial device and a mouse
|
||||||
26
timeout.py
26
timeout.py
@ -1,26 +0,0 @@
|
|||||||
import errno
|
|
||||||
import os
|
|
||||||
import signal
|
|
||||||
import functools
|
|
||||||
|
|
||||||
class TimeoutError(Exception):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def timeout(seconds=10, error_message=os.strerror(errno.ETIME)):
|
|
||||||
def decorator(func):
|
|
||||||
def _handle_timeout(signum, frame):
|
|
||||||
raise TimeoutError(error_message)
|
|
||||||
|
|
||||||
@functools.wraps(func)
|
|
||||||
def wrapper(*args, **kwargs):
|
|
||||||
signal.signal(signal.SIGALRM, _handle_timeout)
|
|
||||||
signal.alarm(seconds)
|
|
||||||
try:
|
|
||||||
result = func(*args, **kwargs)
|
|
||||||
finally:
|
|
||||||
signal.alarm(0)
|
|
||||||
return result
|
|
||||||
|
|
||||||
return wrapper
|
|
||||||
|
|
||||||
return decorator
|
|
||||||
Reference in New Issue
Block a user