-
Notifications
You must be signed in to change notification settings - Fork 667
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
Send a free sequence of pulses with custom timings #170
base: master
Are you sure you want to change the base?
Send a free sequence of pulses with custom timings #170
Conversation
…timings. If pointer transmittimings is not null any send command saves the timings to the pointed array instead of sending the code
Please @sui77 , @fingolfin , @rotv , |
@1technophile |
Hello Martin, That's interesting! I don't understand how |
Thank you for looking into this. I assume that you had a look at the links in the OP. In the case of sending custom timings, you have an example of usage here: #163 (comment) In the case of getting an array of synthetic timings (i.e. you pass a code to the library and get an array of timings - no RF transmitting or receiving involved in this process), the only thing to do is to set a pointer in |
That's perfect, do you think you could add it as an example into the examples folder?
Ok I get it, if I understand well it could also be used to do some unit testing of the library; checking that the protocols, bits, translation generate the appropriate timings. |
Sure! I understand that you mean in my branch. I probably will need to find time in the weekend to do this.
You are right. But there are also the other possible applications: "ultra small just-one-code" sketches and using the timings with "different" RF systems (this may sound obscure, but I will release sketches and programs for different platforms after the merge). |
Exactly, the goal is to include them into this PR if possible.
It would be great ! |
This is very nice extension, I just used it for sending code to Nedis 433 outlet. But I had one problem which is not related to this change directly but I'd like to share it - it may help to someone. I'm not familiar with RcSwitch.h file. Problem was that sending array of timigs to that outlet wasn't received. It was because in RcSwitch.h is constant #define RCSWITCH_MAX_CHANGES 67 but my array if timings had 120 integers. Once I changed RCSWITCH_MAX_CHANGES to 167 it was received with no problems. I'm wondering if it would be helpful to change RCSWITCH_MAX_CHANGES to bigger vaule. Or do some check in send method that array of timings exceed RCSWITCH_MAX_CHANGES. (I'm using Arduino Mega 2560). From the comment of RCSWITCH_MAX_CHANGES I wasn;t able to understand what vaue I can set there. 500? 1000? |
@Martin-Laclaustra did this merge never happen? |
@cgmckeever Sorry, in this strange year I still did not produce the promised example. May be during the holiday season I can prepare it. |
This is a F'd up year, let alone strange -- thanks for the feedback ... Was just combing through the issues, and noticed so much referencing your branches ... and was thinking, hope all this goodness makes it in! .. Have a great new year -- |
This is an extension that does not break current API. The change increases the footprint of the program just a little with minimal impact on memory use on runtime.
It allows to send a free sequence of pulses with custom timings.
It also allows to generate such sequences from command functions.
This is the functionality that this API extension adds:
send(unsigned int *)
to send a starting-low zero-terminated array of timings.transmittimings
is not null any send command saves the timings to the pointed array instead of sending the code (the main program is responsible from memory management and coherent function calling that will not cause a buffer overflow).These modification tries to be as small as possible. Error checking has been left out.
A full explanation is in: #146
An example and small tutorial on how to use the custom timings send function: #163 (comment)
There are several issues asking for this functionality. Also issue #163 proves that there is demand and possible uses for this modification.
NOTE: This is an API compatible modification. I believe that the next major version advance of the library (new API) could implement a layered architecture ranging from functions to deal with brand/command to those managing low level control of the transmitter. I will open an issue with these ideas at some point or we could discuss them through email.