Search found 892 matches

by jimmo
Sun Dec 01, 2019 11:08 am
Forum: General Discussion and Questions
Topic: create dynamic strings
Replies: 5
Views: 203

Re: create dynamic strings

Definitely yes. They work in the same way, by appending to a vstr which grows as the string is generated.

The reason that ''.format() is preferred over % is that not all ports of MicroPython have % enabled.
by jimmo
Sun Dec 01, 2019 11:05 am
Forum: General Discussion and Questions
Topic: The optimization thread... ;)
Replies: 7
Views: 302

Re: The optimization thread... ;)

Did you have a question about the code snippet?
by jimmo
Sun Dec 01, 2019 11:02 am
Forum: Programs, Libraries and Tools
Topic: The threading question...
Replies: 4
Views: 201

Re: The threading question...

I will need to spend some more time reading your code, but I did notice that both threads have sleeps in them, which might not work the way you expect. See https://github.com/micropython/micropython/issues/5344#issuecomment-558865337 for some discussion about this (it's about ESP32, but the point ge...
by jimmo
Sun Dec 01, 2019 10:52 am
Forum: General Discussion and Questions
Topic: AttributeError: 'StreamReader' object has no attribute 'readinto'
Replies: 3
Views: 111

Re: AttributeError: 'StreamReader' object has no attribute 'readinto'

Not at the moment, but you might be able to add it yourself?

FYI, there's a new version of uasyncio that will hopefully be merged soon but you can see it at https://github.com/micropython/micropython/pull/5332
by jimmo
Wed Nov 27, 2019 12:51 am
Forum: micro:bit boards
Topic: bytearray objects use too much memory?
Replies: 3
Views: 168

Re: bytearray objects use too much memory?

Your code isn't really using bytearrays other than for self.buffer. self.leds is a list of arrays, and creates a large number of small objects. bytearrays themselves are quite efficient (16-byte object metadata, plus one byte per actual byte). In your code, it ends up creating a large number of smal...
by jimmo
Wed Nov 27, 2019 12:42 am
Forum: Development of MicroPython
Topic: Question about the dht module (and maybe some more)
Replies: 14
Views: 399

Re: Question about the dht module (and maybe some more)

This seems to be very common in most of the DHT22/AM2303 drivers. People seem to say stuff like "The sensors claim to not like being read more than every 250 ms." but I can't find any definitive documentation or explanation for this. I'm guessing that there are a bunch of different variants and some...
by jimmo
Wed Nov 27, 2019 12:25 am
Forum: Development of MicroPython
Topic: Porting Mirocpython to Risc V ?
Replies: 8
Views: 6264

Re: Porting Mirocpython to Risc V ?

Not sure if useful but I know the FuPy team have been working a lot on riscv support for MicroPython -- https://fupy.github.io/
by jimmo
Wed Nov 27, 2019 12:22 am
Forum: General Discussion and Questions
Topic: Is it possible to remove modules from the import cache?
Replies: 5
Views: 195

Re: Is it possible to remove modules from the import cache?

Is it somehow possible to force importing certain modules from scratch? Soft reboot would do, but I'm looking for something faster. I think avoiding the risk of extremely confusing behavior due to strange side effects is probably worth the extra time taken for the soft reset. How long does a soft r...
by jimmo
Wed Nov 27, 2019 12:14 am
Forum: Pyboard D-series
Topic: _thread not being enabled
Replies: 8
Views: 279

Re: _thread not being enabled

How are you deploying the firmware? Are you using the same arguments for the `make deploy` invocation?
by jimmo
Tue Nov 26, 2019 10:26 am
Forum: Pyboard D-series
Topic: _thread not being enabled
Replies: 8
Views: 279

Re: _thread not being enabled

What's changed? Did this used to be possible? I don't see a way that the stm32 Makefile takes this argument. Is it possible you're thinking of the Unix port? But if you want to do this in your GNUmakefile, you need to add -DMICROPY_PY_THREAD=1 to the compiler flags. e.g. CFLAGS_MOD += -DMICROPY_PY_T...