uasyncio - asyncio-like cooperative multitasking framework for uPy
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: uasyncio - asyncio-like cooperative multitasking framework for uPy
Excellent! Task cancellation and timeouts are great features and it's good to see them fully merged
(I haven't tried UDP yet)
(I haven't tried UDP yet)
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
Re: uasyncio - asyncio-like cooperative multitasking framework for uPy
Besides in-tree example https://github.com/pfalcon/micropython- ... ns_junk.py , there's a more involved module to interface with Xiaomi Mi Home Gateway: https://github.com/pfalcon/uaio_xiaomi_gw
Awesome MicroPython list
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/
Re: uasyncio - asyncio-like cooperative multitasking framework for uPy
As a newbee, I am still confused about when to use the u-prefix in module names.
I got the following error when trying out the uasyncio module on a Pycom LoPy ESP32:
Neither was upip of any help:
I got the following error when trying out the uasyncio module on a Pycom LoPy ESP32:
Code: Select all
File "/flash/lib/uasyncio/__init__.py", line 2, in <module>
ImportError: no module named 'uselect'
Code: Select all
$ ./micropython -m upip install uselect
Installing to: /home/serge/.micropython/lib/
Warning: pypi.python.org SSL certificate is not validated
Error installing 'uselect': Package not found, packages may be partially installed
Serge
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: uasyncio - asyncio-like cooperative multitasking framework for uPy
I think you've uncovered a build problem with certain platforms. uselect is provided by a C module (extmod/moduslect.c) so this needs to be specified in the makefile.
Your best recourse is to raise issues on GitHub with the platform maintainers, which I see you've done against the ESP32. I'm unfamiliar with the PyCom boards and whether their firmware will automatically pick up fixes applied to the official ESP32 port.
Your best recourse is to raise issues on GitHub with the platform maintainers, which I see you've done against the ESP32. I'm unfamiliar with the PyCom boards and whether their firmware will automatically pick up fixes applied to the official ESP32 port.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
Re: uasyncio - asyncio-like cooperative multitasking framework for uPy
Thanks, Peter. Actually, I got one step further by replacing uselect by select in the source code of __init__.py.
However, then I get stuck on import utimeq in core.py for which I find no alternative with Pycom.
However, then I get stuck on import utimeq in core.py for which I find no alternative with Pycom.
Serge
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: uasyncio - asyncio-like cooperative multitasking framework for uPy
The utimeq module is fundamental to uasyncio. If you did a pip install it should be there. Alternatively it may be found in micropython-lib. It is a Python file.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
Re: uasyncio - asyncio-like cooperative multitasking framework for uPy
It seems your uasyncio module is in high demand on Pycom, Peter!
Somebody else is also trying to get it running on a WiPy 2.
Somebody else is also trying to get it running on a WiPy 2.
Serge
Re: uasyncio - asyncio-like cooperative multitasking framework for uPy
Dear Peter,
This is exactly the issue. The module utimeq is not a python file in micropython-lib, but rather c source compiled into the standard library.
Unfortunately, this is not the case with default Pycom MicroPython.
This is exactly the issue. The module utimeq is not a python file in micropython-lib, but rather c source compiled into the standard library.
Unfortunately, this is not the case with default Pycom MicroPython.
Serge
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: uasyncio - asyncio-like cooperative multitasking framework for uPy
I must correct that - uasyncio is the work of the MicroPython maintainers, notably Paul. I am merely an enthusiastic user.
You are of course right about utimeq - I posted that in a hurry before turning off my PC which is usually a mistake.
Opinions on PyCom support vary - it will be an interesting test of it. I'd have thought that an up-to-date uasyncio was near-vital on a wireless enabled product.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
Re: uasyncio - asyncio-like cooperative multitasking framework for uPy
I fully agree. It also comes a bit as a surprise and disappointment that they are not more in step with Pyboard MicroPython.pythoncoder wrote: ↑Sun Dec 24, 2017 8:23 amOpinions on PyCom support vary [...] I'd have thought that an up-to-date uasyncio was near-vital on a wireless enabled product.
Do you recon I could manage to achieve acceptable performance using just Pycom's _thread and machine.Timer?
I need to simultaneously manage a user interface with screen and buttons, as well as a periodic measuring and transmission process.
What would be the most important uasyncio feature I will miss out on?
(The answers to these questions form perhaps additional material for your excellent uasyncio tutorial.
Serge