Page 8 of 12

Re: uasyncio - asyncio-like cooperative multitasking framework for uPy

Posted: Sat Dec 16, 2017 8:50 am
by pythoncoder
Excellent! Task cancellation and timeouts are great features and it's good to see them fully merged :D

(I haven't tried UDP yet)

Re: uasyncio - asyncio-like cooperative multitasking framework for uPy

Posted: Sat Dec 16, 2017 3:05 pm
by pfalcon
pfalcon wrote:
Fri Dec 15, 2017 10:45 pm
UDP module is added: ...
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

Re: uasyncio - asyncio-like cooperative multitasking framework for uPy

Posted: Fri Dec 22, 2017 11:44 pm
by on4aa
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:

Code: Select all

File "/flash/lib/uasyncio/__init__.py", line 2, in <module>
ImportError: no module named 'uselect'
Neither was upip of any help:

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

Re: uasyncio - asyncio-like cooperative multitasking framework for uPy

Posted: Sat Dec 23, 2017 8:26 am
by pythoncoder
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.

Re: uasyncio - asyncio-like cooperative multitasking framework for uPy

Posted: Sat Dec 23, 2017 4:40 pm
by on4aa
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.

Re: uasyncio - asyncio-like cooperative multitasking framework for uPy

Posted: Sat Dec 23, 2017 6:47 pm
by pythoncoder
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.

Re: uasyncio - asyncio-like cooperative multitasking framework for uPy

Posted: Sat Dec 23, 2017 9:13 pm
by on4aa
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.

Re: uasyncio - asyncio-like cooperative multitasking framework for uPy

Posted: Sat Dec 23, 2017 9:52 pm
by on4aa
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.

Re: uasyncio - asyncio-like cooperative multitasking framework for uPy

Posted: Sun Dec 24, 2017 8:23 am
by pythoncoder
on4aa wrote:
Sat Dec 23, 2017 9:13 pm
It seems your uasyncio module is in high demand on Pycom, Peter!
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.

Re: uasyncio - asyncio-like cooperative multitasking framework for uPy

Posted: Tue Dec 26, 2017 10:32 pm
by on4aa
pythoncoder wrote:
Sun Dec 24, 2017 8:23 am
Opinions on PyCom support vary [...] I'd have thought that an up-to-date uasyncio was near-vital on a wireless enabled product.
I fully agree. It also comes a bit as a surprise and disappointment that they are not more in step with Pyboard MicroPython.

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.