From f598173199cd80726cfd2d297476db6ea5b631f9 Mon Sep 17 00:00:00 2001 From: Christian Frenzl Date: Sat, 17 Nov 2018 22:43:42 +0100 Subject: [PATCH] added "repeatTransmit" parameter to codesend --- RPi_utils/codesend.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/RPi_utils/codesend.cpp b/RPi_utils/codesend.cpp index afed6fc..c3a40b8 100644 --- a/RPi_utils/codesend.cpp +++ b/RPi_utils/codesend.cpp @@ -29,13 +29,15 @@ int main(int argc, char *argv[]) { // Parse the first parameter to this command as an integer int protocol = 0; // A value of 0 will use rc-switch's default value int pulseLength = 0; + int repeatTransmit = 0; // If no command line argument is given, print the help text if (argc == 1) { - printf("Usage: %s decimalcode [protocol] [pulselength]\n", argv[0]); + printf("Usage: %s decimalcode [protocol] [pulselength] [repeatTransmit]\n", argv[0]); printf("decimalcode\t- As decoded by RFSniffer\n"); printf("protocol\t- According to rc-switch definitions\n"); printf("pulselength\t- pulselength in microseconds\n"); + printf("repeatTransmit\t- How often to repeat the code. Defaults to 10.\n"); return -1; } @@ -43,12 +45,14 @@ int main(int argc, char *argv[]) { int code = atoi(argv[1]); if (argc >= 3) protocol = atoi(argv[2]); if (argc >= 4) pulseLength = atoi(argv[3]); + if (argc >= 5) repeatTransmit = atoi(argv[4]); if (wiringPiSetup () == -1) return 1; printf("sending code[%i]\n", code); RCSwitch mySwitch = RCSwitch(); if (protocol != 0) mySwitch.setProtocol(protocol); if (pulseLength != 0) mySwitch.setPulseLength(pulseLength); + if (repeatTransmit != 0) mySwitch.setRepeatTransmit(repeatTransmit); mySwitch.enableTransmit(PIN); mySwitch.send(code, 24);