Search found 8 matches

by apois
Sat Sep 28, 2019 11:57 am
Forum: ESP32 boards
Topic: ESP32 and LoRa
Replies: 70
Views: 100055

Re: ESP32 and LoRa

Hi - are there any updated recommendations for pure Micropython Lora libraries - are any of the ones described above "stable" (loboris/MZachmann/Wei1234c)? I tried a Lopy a year or two ago and had a few issues with timings in the Lora firmware and hardware (deep sleep) (although I think Pycom have r...
by apois
Thu Nov 22, 2018 12:24 pm
Forum: General Discussion and Questions
Topic: Learning uasyncio and futures
Replies: 20
Views: 11147

Re: Learning uasyncio and futures

@pfalcon - thanks for your advice. Yes - I agree - compatibility with (a subset of) Python 3 is a crucial goal. That's kind of how I ended up down the rabbit-hole of this thread - I wanted to do what I thought would be a simple asyncio.gather() but realised that this functionality wasn't available i...
by apois
Wed Nov 21, 2018 10:53 am
Forum: General Discussion and Questions
Topic: Learning uasyncio and futures
Replies: 20
Views: 11147

Re: Learning uasyncio and futures

I've been doing a bit of reading around futures to learn a bit more and found a couple of interesting references: Firstly, Javascript has the Promises/A+ specification - https://promisesaplus.com - which has been widely adopted and is largely seen as a step-up from the previous "callback hell". I qu...
by apois
Sat Nov 17, 2018 10:18 am
Forum: General Discussion and Questions
Topic: Learning uasyncio and futures
Replies: 20
Views: 11147

Re: Learning uasyncio and futures

Ah - many thanks pythoncoder - that would explain it. I wasn't aware of that subtlety of python closures, I'm more used to Javascript.

I don't know why it worked at all without the nonlocal keyword - I was running on a linux 1.9.4 build.
by apois
Fri Nov 16, 2018 10:28 pm
Forum: General Discussion and Questions
Topic: Learning uasyncio and futures
Replies: 20
Views: 11147

Re: Learning uasyncio and futures

I've been trying to simplify my gather() and have come up with a version using just coros that doesn't need the PoorFuture wrapper class. import uasyncio as asyncio async def slow_task(seconds, answer): '''Demo function to build coros that simulate slow-running tasks''' for i in range(seconds): prin...
by apois
Fri Nov 16, 2018 3:17 pm
Forum: General Discussion and Questions
Topic: Learning uasyncio and futures
Replies: 20
Views: 11147

Re: Learning uasyncio and futures

Thanks - yes, the editor didn't seem to let me insert code blocks properly for some reason - maybe because I am new? It seems to be working now however. You are nearly there with your indentation, but I think you have some extra indention after this for loop - it should be: # start all the futures a...
by apois
Fri Nov 16, 2018 1:06 pm
Forum: General Discussion and Questions
Topic: Learning uasyncio and futures
Replies: 20
Views: 11147

Re: Learning uasyncio and futures

Thanks - glad to hear I'm not totally off-course :) No - I don't have any ambitions beyond my simple "gather" use case for collecting results concurrently from a number of sensors - I just wanted a simple way of doing this. I'm not familiar enough with the asyncio library or futures in general to pr...
by apois
Thu Nov 15, 2018 9:23 pm
Forum: General Discussion and Questions
Topic: Learning uasyncio and futures
Replies: 20
Views: 11147

Learning uasyncio and futures

Hi, I've been playing with micropython and have a situation where I want to collect results concurrently from a number of slow (ie. a few seconds) sensors. I thought this could be a job for uasyncio and futures, but I have seen that uasyncio focuses on coroutines in preference to futures for perform...