Search found 10 matches

by Polo
Sun Jul 05, 2020 5:38 pm
Forum: MicroPython pyboard
Topic: How to know when it's safe to restart after a write to flash
Replies: 5
Views: 2676

Re: How to know when it's safe to restart after a write to flash

The receiving pyboard is not connected to a PC. The filesystem is only updated from code. Maybe this could help to clarify. import machine with open('main.py', 'w') as f: f.write('print("hello world")') while flash.active(): pass machine.reset() I'd like to know if there's a function or method like ...
by Polo
Sun Jul 05, 2020 5:08 pm
Forum: MicroPython pyboard
Topic: How to know when it's safe to restart after a write to flash
Replies: 5
Views: 2676

Re: How to know when it's safe to restart after a write to flash

Thanks for the response. Could you elaborate what these precautions are? Using rshell is not an option for me. I'm sending filecontents from one pyboard to another. Then the receiving pyboard writes the filecontents to flash. At this point I'd like to know when the flash write was completed and the ...
by Polo
Fri Jul 03, 2020 5:41 pm
Forum: MicroPython pyboard
Topic: How to know when it's safe to restart after a write to flash
Replies: 5
Views: 2676

How to know when it's safe to restart after a write to flash

Hi everyone,

A lot of times resetting too early corrupts the filesystem.

I know the red LED indicates when the flash is being written to, but is there a way to check for this in software?
by Polo
Mon Jan 28, 2019 10:39 am
Forum: Development of MicroPython
Topic: Bug with micropython.const
Replies: 4
Views: 3496

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

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

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

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

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

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

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...