Search found 878 matches

by jimmo
Wed Nov 27, 2019 12:51 am
Forum: micro:bit boards
Topic: bytearray objects use too much memory?
Replies: 3
Views: 112

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: 311

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: 6167

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: 163

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: 189

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: 189

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...
by jimmo
Tue Nov 26, 2019 8:12 am
Forum: Pyboard D-series
Topic: _thread not being enabled
Replies: 8
Views: 189

Re: _thread not being enabled

From memory, I don't know think threading can be controlled from the Makefile. You'll need to set it in mpconfigport.h or mpconfigboard.h (or add the plumbing to set it from the Makefile).
by jimmo
Tue Nov 26, 2019 3:45 am
Forum: General Discussion and Questions
Topic: Whats this all about?
Replies: 5
Views: 188

Re: Whats this all about?

I forgot to add, there was some recent discussion about this topic on the github issue tracker. I don't think it's related to what you're seeing, but I believe there is a bug when printing _without_ an explicit number of decimal places (so that's why I recommend always using str.format or the % oper...
by jimmo
Tue Nov 26, 2019 3:03 am
Forum: General Discussion and Questions
Topic: Whats this all about?
Replies: 5
Views: 188

Re: Whats this all about?

Hi, The simple answer is that it did correctly add 32, which you can see by subtraction. >>> a = 31.1 * 9 / 5 >>> b = 31.1 * 9 / 5 + 32 >>> print(a) 55.98 >>> print(b) 87.97999 >>> print(b-a) 32.0 The more complicated answer is that it's impossible to represent every floating point number in binary ...
by jimmo
Tue Nov 26, 2019 2:41 am
Forum: General Discussion and Questions
Topic: Micropython conditional compilation
Replies: 2
Views: 112

Re: Micropython conditional compilation

You can certainly put an if around the import. But I think the solution you've come up with (providing a micropython.py with a no-op version of the const function and viper/native/etc decorators for CPython) is the intended way of solving this. You might be able to do something like have main.py edi...