-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add feature to encode and decode MakeCode's infrared pulses #26
Comments
I'm currently about a quarter of the way through a python library implementation of this based on the c++ code ... |
There's some primitive field type encoding going on too, 12345 is sent with 0xcd prefix and 0xc1 suffix - see https://github.com/microsoft/pxt-common-packages/blob/2a109627f598f96e836eb2bd55745e9bf5ed3c17/libs/base/buffer.ts#L136 |
We use https://msgpack.org/ as the format for messages, hence the 0xcd |
It looks like you are following msgpack standard and transmitting data in big endian ("network order") but sending the 16 bit CRC in little endian? I'm also seeing a consistent 6500 us start bit but your code has 25 1s (marks) which suggests that should be 6250us? I've not thoroughly gone through the MakeCode code yet but is that intentional? Minor possiblity the CircuitPython code adds 250us to the first pulse but that seems unlikely. |
This is decode in
Data written in https://github.com/microsoft/pxt-common-packages/blob/2a109627f598f96e836eb2bd55745e9bf5ed3c17/libs/base/buffer.cpp#L248 The "combined" single byte msgpack format+data is used too: https://github.com/msgpack/msgpack/blob/master/spec.md#int-format-family visible in https://github.com/microsoft/pxt-common-packages/blob/2a109627f598f96e836eb2bd55745e9bf5ed3c17/libs/base/buffer.ts#L149 (
|
Short string support might be a useful enhancement. Check how practical this is in terms of receiving in CircuitPython, e.g. required size pulseio object. |
This requires a very simple implementation of msgpack encode/decode. Points to consider here:
|
I did not finish this but adafruit/circuitpython#3659 looks like it implements |
MakeCode has its own IR protocol/encoding for sending a list of one or more 16 bit unsigned numbers. To allow MakeCode devices to communicate with CircuitPython it would be useful to implement this niche protocol. CircuitPython users may also like to use it.
The protocol is described by @mmoskal on https://makecode.com/blog/timing-adventures-in-infrared but the actual implementation in https://github.com/microsoft/pxt-common-packages/blob/master/libs/pulse/pulse.cpp differs slightly, the start of frame being obviously different, for example.
I think this would be best implemented in a separate file so it is only
import
'ed by those that wish to use it to avoid memory bloat.The text was updated successfully, but these errors were encountered: