xdrv_17_rcswitch.ino pulselen overwritten with rfsend command #10864
Replies: 1 comment 10 replies
-
As per the known lyrics: "I don't subscribe to your point of view" Although pulse is initialized to 350 at the beginning of the function, then it is read from the command line following one of 2 format : JSON or comma-separated. The simplified whole sequence is:
The 1st case get pulse form a JSON. Providing the current pulse value (350) insure that pulse always gets a good value even if not present in the JSON. With your code, pulse would be set to the library if it is different than 350. May be you can elaborate on the use-case where the current code makes a problem ? |
Beta Was this translation helpful? Give feedback.
-
rcswitch:
Pulselen is a part of the protocol and should not be overwritten if not specified in the rfsend command.
Overwriting it will result in the wrong (protocol1 default) pulselen for everyone not aware of the issue.
The lines 198 and 199:
if (!pulse) { pulse = 350; } // Default pulse length for protocol 1
mySwitch.setPulseLength(pulse);
should be replaced with:
if (pulse != 350) { mySwitch.setPulseLength(pulse); }
Pulse is initialized to 350 and guess what effect the
if (!pulse)
then has? Yes, none. If you want to use (!pulse) you cant init the value.Same with protocol, repeat, bits, if you init them you cant ask
if (!repeat) { repeat = 10; }
The whole section should look like:
Beta Was this translation helpful? Give feedback.
All reactions