Search found 5280 matches

by pythoncoder
Fri Jul 30, 2021 5:57 pm
Forum: Programs, Libraries and Tools
Topic: msgpack "trimmed down" for MicroPython on small controllers.
Replies: 15
Views: 478

Re: msgpack "trimmed down" for MicroPython on small controllers.

I've posted code here . The README is unfinished but comments on the code are welcome. I have refactored the code as a Python package. This enables lazy imports, minimising RAM consumption. There is also a very simple extension module which adds support for complex , set and tuple types. It serves a...
by pythoncoder
Thu Jul 29, 2021 7:34 am
Forum: Programs, Libraries and Tools
Topic: msgpack "trimmed down" for MicroPython on small controllers.
Replies: 15
Views: 478

Re: msgpack "trimmed down" for MicroPython on small controllers.

Thanks for that. The "trial and error" approach is rather inefficient. Prepending every message with its length is a good idea and would play nicely with uasyncio . It could be baked into the dump , dumps , load and loads routines so that it was transparent to the user. The drawbacks are that it bre...
by pythoncoder
Wed Jul 28, 2021 7:10 am
Forum: Programs, Libraries and Tools
Topic: msgpack "trimmed down" for MicroPython on small controllers.
Replies: 15
Views: 478

Asynchronous use: an interesting issue

I've been trying to figure out how to use MessagePack with uasyncio. This matters for slow and/or intermittent data sources such as UARTs and sockets. There is no problem with sending data: just convert it synchronously and await its transmission on a StreamWriter . The difficulty is on receive, and...
by pythoncoder
Tue Jul 27, 2021 3:30 pm
Forum: General Discussion and Questions
Topic: Different time settings under the same loop
Replies: 6
Views: 132

Re: Different time settings under the same loop

An alternative to using timers is schedule which uses a similar approach to Unix cron.
by pythoncoder
Tue Jul 27, 2021 3:23 pm
Forum: MicroPython pyboard
Topic: Simple connect liteboard -> rs3231 rtc module
Replies: 3
Views: 100

Re: Simple connect liteboard -> rs3231 rtc module

The Pyboard Lite does not have a crystal oscillator for the RTC so those error values are to be expected. A Pyboard 1.1 or D with a crystal oscillator can be calibrated to timepiece precision.
by pythoncoder
Tue Jul 27, 2021 8:11 am
Forum: Programs, Libraries and Tools
Topic: Password Generator Using by Python Script
Replies: 1
Views: 80

Re: Password Generator Using by Python Script

That solution is a little complicated. With some understanding of the ASCII character set, you could do something like this: import random def randchar(): while True: yield chr(48 + (random.getrandbits(30) % 75)) r = randchar() def random_string(length): return ''.join((next(r) for _ in range(length...
by pythoncoder
Mon Jul 26, 2021 9:22 am
Forum: General Discussion and Questions
Topic: AC Dimmer it possible.
Replies: 5
Views: 199

Re: AC Dimmer it possible.

STM32 could definitely do it and I'm pretty sure it could be done with ESP32 - the one caveat on that platform being interrupt latency. Best without SPIRAM.

You'll need a good grasp of electronic design, though.
by pythoncoder
Sun Jul 25, 2021 1:37 pm
Forum: Programs, Libraries and Tools
Topic: msgpack "trimmed down" for MicroPython on small controllers.
Replies: 15
Views: 478

Re: msgpack "trimmed down" for MicroPython on small controllers.

I started out looking for some quick fixes to help @WZab, so I did indeed begin with the wrong codebase. I have since done a line by line review against the vsergeev original. I have run its test suite (after adapting for the unsupported functionality mentioned above such as timestamps). I'm now pre...
by pythoncoder
Sat Jul 24, 2021 6:29 pm
Forum: Programs, Libraries and Tools
Topic: GPS click on micropython
Replies: 8
Views: 213

Re: GPS click on micropython

The GPS unit I use sends data regularly without needing any prompting. My library in normal use is listen-only. On a cold start it takes a few minutes before it starts sending because it waits to acquire sufficient satellites but then it sends once per second.
by pythoncoder
Sat Jul 24, 2021 6:18 pm
Forum: Raspberry Pi microcontroller boards
Topic: Trivial code sometimes takes 5ms and interrupts are missed
Replies: 11
Views: 384

Re: Trivial code sometimes takes 5ms and interrupts are missed

Interesting choice not to set the "hard" as the default on a low-level system such as this. I am not convinced that this was the right choice... The point of the machine module is that it is cross-platform: it should be possible to run code reliant on the module on any platform (subject to trivial ...