Search found 7 matches

by Polo
Mon Jan 28, 2019 10:39 am
Forum: Development of MicroPython
Topic: Bug with micropython.const
Replies: 4
Views: 435

Re: Bug with micropython.const

That makes sense. Thank you
by Polo
Wed Jan 23, 2019 1:38 pm
Forum: Development of MicroPython
Topic: Bug with micropython.const
Replies: 4
Views: 435

Re: Bug with micropython.const

Oh, I see. So this is perfectly normal since b is not available at compile time? # test.py from micropython import const b = const(1) # main.py from micropython import const from test import b a = const(1) c = const(a + 1) # works d = const(b + 1) # SyntaxError: constant must be an integer I'm still...
by Polo
Tue Jan 22, 2019 1:11 pm
Forum: Development of MicroPython
Topic: Bug with micropython.const
Replies: 4
Views: 435

Bug with micropython.const

This seems like a bug to me: MicroPython v1.9.4-740-gdc23978dd on 2018-12-10; PYBv1.1 with STM32F405RG Type "help()" for more information. >>> from micropython import const >>> a = const(1) >>> b = const(int(1)) Traceback (most recent call last): File "<stdin>", line 1 SyntaxError: constant must be ...
by Polo
Fri Jan 11, 2019 11:48 am
Forum: General Discussion and Questions
Topic: namedtuple to JSON possible?
Replies: 2
Views: 288

Re: namedtuple to JSON possible?

Yes! That works.
Thank you very much!
by Polo
Thu Jan 10, 2019 9:10 pm
Forum: General Discussion and Questions
Topic: namedtuple to JSON possible?
Replies: 2
Views: 288

namedtuple to JSON possible?

Hello everyone. I've been trying to find a good way to serialize objects, but there's always something missing in the micropython implementation. My goal is a Setting class where: - I can access parameters by name (not key lookup) - I can serialize the parameters to JSON Something that can do: objec...
by Polo
Wed Oct 03, 2018 8:05 pm
Forum: MicroPython pyboard
Topic: heap_lock heap_unlock not working
Replies: 9
Views: 780

Re: heap_lock heap_unlock not working

The responses on the issue explain the behavior.
You can't use the console with the heap locked, and heap_unlock without a previous lock "fails".

Thanks everyone!
by Polo
Tue Oct 02, 2018 1:23 pm
Forum: MicroPython pyboard
Topic: heap_lock heap_unlock not working
Replies: 9
Views: 780

heap_lock heap_unlock not working

New account, so no code tags, sorry When I run this code I get a MemmoryError: memory allocation failed, heap is locked import micropython micropython.alloc_emergency_exception_buf(100) micropython.heap_lock() micropython.heap_unlock() Running this also locks the heap: import micropython micropython...