Search found 96 matches

by martincho
Mon Jul 11, 2022 7:23 am
Forum: General Discussion and Questions
Topic: @micropython.native not implemented too long
Replies: 14
Views: 5830

@micropython.native not implemented too long

I forget the exact error message. Is there documentation on what triggers this or where the limits are? Today, I took a MicroPython file that runs just fine and ran it through a minification program. It removes all comments, shortens all variable names, etc. The standard python_minifier tool. To my ...
by martincho
Mon Jul 11, 2022 7:05 am
Forum: General Discussion and Questions
Topic: Controlling micropython board from desktop computer
Replies: 13
Views: 5885

Re: Controlling micropython board from desktop computer

One of the things to watch out for with protocols such as MIDI and derivatives is that they have no way to validate communications. If you are not careful a system can very easily fall into a situation known in computer science as "The Two Generals Problem": https://en.wikipedia.org/wiki/Two_General...
by martincho
Mon Jul 11, 2022 6:32 am
Forum: General Discussion and Questions
Topic: General Question
Replies: 16
Views: 5193

Re: General Question

If you plan to make a shipping product then you should definitely be freezing the bytecode into the firmware (rather than just putting .py files on the filesystem). This not only makes it harder to obtain the code, but is more RAM efficient. I haven't thought this through or done any research at th...
by martincho
Mon Jul 11, 2022 6:22 am
Forum: General Discussion and Questions
Topic: Can you strip unneeded code somehow from MP?
Replies: 4
Views: 1265

Re: Can you strip unneeded code somehow from MP?

Not an easy problem. As an example, a number of IDE's try to help you by pointing out code that will never run. I use PyCharm Pro and, while I like the IDE, I see instances of the tool getting it wrong on a daily basis. One can only imagine the amount of effort and development that has gone into ana...
by martincho
Sun Jul 10, 2022 7:27 am
Forum: General Discussion and Questions
Topic: Do I need to recompile MicroPython for 16MB flash chip?
Replies: 5
Views: 1287

Re: Do I need to recompile MicroPython for 16MB flash chip?

Boards in hand now.

Nope, did not have to recompile. Of course the MicroPython file system is still sized for a 2 MB flash chip despite the installed device being 16 MB, but that's OK in this case.
by martincho
Sat Jul 09, 2022 4:51 am
Forum: General Discussion and Questions
Topic: bits to bytes
Replies: 58
Views: 25649

Re: bits to bytes

I ask because there are so many ways to handle input contacts (going back to your original question). Sure, looking at using struct or some other mechanism might be good, however, sometimes, when you look at the entirety of the problem a different perspective might surface. In this case you have to ...
by martincho
Sat Jul 09, 2022 3:39 am
Forum: General Discussion and Questions
Topic: bits to bytes
Replies: 58
Views: 25649

Re: bits to bytes

Lastly is bytesin=b'\xf0\x00' tup=struct.unpack('<H', bytesin) bytesout=bin(tup[0]) lst=[int(i) for i in bytesout[2:]] the best way to recover my original list? is "bytesin" what the received data? And, is it actually sending you a 16 bit value in two bytes, low byte first? And, if so, how many of ...
by martincho
Sat Jul 09, 2022 12:39 am
Forum: General Discussion and Questions
Topic: RP2040: How to determine we are coming back from a WDT reset?
Replies: 5
Views: 2297

Re: RP2040: How to determine we are coming back from a WDT reset?

Documentation note: There should be a link to this in the WDT documentation. At least a mention. I've been working on docs this week and this is one of the changes I've made, including bringing more of the port specific information into the machine docs. (Basically your point about having to read m...
by martincho
Fri Jul 08, 2022 8:21 pm
Forum: General Discussion and Questions
Topic: RP2040: How to determine we are coming back from a WDT reset?
Replies: 5
Views: 2297

Re: RP2040: How to determine we are coming back from a WDT reset?

https://docs.micropython.org/en/latest/library/machine.html Does the RP2040 not have: machine.WDT_RESET Ah. Completely missed that one. Thanks! I'll have to test and see if it covers all scenarios I need. Documentation note: There should be a link to this in the WDT documentation. At least a mentio...
by martincho
Fri Jul 08, 2022 6:56 pm
Forum: General Discussion and Questions
Topic: RP2040: How to determine we are coming back from a WDT reset?
Replies: 5
Views: 2297

RP2040: How to determine we are coming back from a WDT reset?

The SDK has a way to do this: https://raspberrypi.github.io/pico-sdk-doxygen/group__hardware__watchdog.html watchdog_caused_reboot(void) MicroPython does not seem to implement this function: https://docs.micropython.org/en/v1.19/library/machine.WDT.html Unless there's a memory location I can write d...