Closed melyux closed 3 years ago
@melyux thank you for contributing!
The bug in verifying the string for the c:
and p:
is a good catch. I would prefer this as a separate commit (even better as a separate pull request).
About #48, I definitively welcome this feature!
But I don't like the proposal with a pointer as a function parameter. In this library I've avoided pointer parameters (unless they're an array) entirely. Furthermore, this change breaks the API, as you pointed out by changing the tests and examples.
I am open to other suggestions. Right now I don't have a good idea how to implement this in a clean way. How about a separate function int ESPiLight::stringToRepeats(const String &data, size_t maxlength)
that only parse for the repeats?
Sorry about the delay. That sounds like a good solution to the problem. Another one could be returning a struct, with one element being the int length and the other being the int repeats.
Split the change into two PRs.
Sorry for my late reply.
Probably my mistake, the maxlength
parameter is not needed, can you remove it?
If possible, also add a test into tests/test_parse/test_parse.ino
.
Removed the maxLength
parameter. Must have slipped my mind. Working on the test.
Added the test to the file mentioned.
Fixed the line length to make Travis happy.
Thanks, perfect.
This adds support for specifying repeats in the pulse train string input to
stringToPulseTrain
, as supported by Pilight (e.g.r:12
) here and here. This resolves #48.It also fixes an existing bug with verifying the string for the
c:
andp:
components which always produced false negatives.I'm not sure about the argument passing and returning implementation I've used here, so I'm open to suggestions on how to do it better. So I've held off on modifying the following test and example that use it:
https://github.com/puuu/ESPiLight/blob/969ab14113f19859e43ce7bc4db69104b30833db/tests/test_parse/test_parse.ino#L75
https://github.com/puuu/ESPiLight/blob/969ab14113f19859e43ce7bc4db69104b30833db/examples/Transmit_Raw/Transmit_Raw.ino#L20-L23