From 48f6bfce5960c79e42557ebde41073c755db3628 Mon Sep 17 00:00:00 2001 From: Denis Bodor Date: Fri, 20 Mar 2015 12:12:34 +0100 Subject: [PATCH 1/4] added Cardin S466-TX2 garage door remote --- include/rtl_433_devices.h | 1 + src/CMakeLists.txt | 1 + src/Makefile.am | 1 + src/devices/cardin.c | 99 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 102 insertions(+) create mode 100644 src/devices/cardin.c diff --git a/include/rtl_433_devices.h b/include/rtl_433_devices.h index e1af20c8..89853f97 100644 --- a/include/rtl_433_devices.h +++ b/include/rtl_433_devices.h @@ -18,6 +18,7 @@ DECL(intertechno) \ DECL(newkaku) \ DECL(alectov1) \ + DECL(cardin) \ DECL(fineoffset_WH2) #define BITBUF_COLS 34 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c2197e5b..d8ef9537 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -31,6 +31,7 @@ add_executable(rtl_433 devices/intertechno.c devices/alecto.c devices/newkaku.c + devices/cardin.c devices/fineoffset.c) target_link_libraries(rtl_433 diff --git a/src/Makefile.am b/src/Makefile.am index 836056c2..05ee992c 100755 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -17,6 +17,7 @@ rtl_433_SOURCES = rtl_433.c \ devices/mebus.c \ devices/prologue.c \ devices/steffen.c \ + devices/cardin.c \ devices/fineoffset.c rtl_433_LDADD = $(LIBRTLSDR) $(LIBM) diff --git a/src/devices/cardin.c b/src/devices/cardin.c new file mode 100644 index 00000000..4f36a1e9 --- /dev/null +++ b/src/devices/cardin.c @@ -0,0 +1,99 @@ +#include "rtl_433.h" + +/* + * Cardin S466-TX2 generic garage door remote control on 27.195 Mhz + * Use with "-f 27195000" + * May be usefull for other Cardin product too + */ + +static int cardin_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS], int16_t bits_per_row[BITBUF_ROWS]) { + int i, j, k; + unsigned char dip[10] = {'-','-','-','-','-','-','-','-','-', '\0'}; + + fprintf(stderr, "\nprotocol = Cardin S466\n"); + fprintf(stderr, "message = "); + for (i=0 ; i<3 ; i++) { + for (k = 7; k >= 0; k--) { + if (bb[0][i] & 1 << k) + fprintf(stderr, "1"); + else + fprintf(stderr, "0"); + } + fprintf(stderr, " "); + } + fprintf(stderr, "\n"); + + // Dip 1 + if(bb[0][0] & 8) { + dip[0]='o'; + if(bb[0][1] & 8) + dip[0]='+'; + } + // Dip 2 + if(bb[0][0] & 16) { + dip[1]='o'; + if(bb[0][1] & 16) + dip[1]='+'; + } + // Dip 3 + if(bb[0][0] & 32) { + dip[2]='o'; + if(bb[0][1] & 32) + dip[2]='+'; + } + // Dip 4 + if(bb[0][0] & 64) { + dip[3]='o'; + if(bb[0][1] & 64) + dip[3]='+'; + } + // Dip 5 + if(bb[0][0] & 128) { + dip[4]='o'; + if(bb[0][1] & 128) + dip[4]='+'; + } + // Dip 6 + if(bb[0][2] & 128) { + dip[5]='o'; + if(bb[0][2] & 64) + dip[5]='+'; + } + // Dip 7 + if(bb[0][0] & 1) { + dip[6]='o'; + if(bb[0][1] & 1) + dip[6]='+'; + } + // Dip 8 + if(bb[0][0] & 2) { + dip[7]='o'; + if(bb[0][1] & 2) + dip[7]='+'; + } + // Dip 9 + if(bb[0][0] & 4) { + dip[8]='o'; + if(bb[0][1] & 4) + dip[8]='+'; + } + + fprintf(stderr, " 123456789\n"); + fprintf(stderr, "dipswitch = %s\n",dip); + + + + return 1; +} + +r_device cardin = { + /* .id = */ 12, + /* .name = */ "Cardin S466-TX2", + /* .modulation = */ OOK_PWM_D, + /* .short_limit = */ 303, + /* .long_limit = */ 400, + /* .reset_limit = */ 8000, + /* .json_callback = */ &cardin_callback, + /* .disabled = */ 0, + /* .json_callback = */ //&debug_callback, +}; From 3bd07cfbe08bc335dfdb658809050b0f9bfe622d Mon Sep 17 00:00:00 2001 From: Denis Bodor Date: Fri, 20 Mar 2015 13:29:10 +0100 Subject: [PATCH 2/4] added chan selection switch display --- src/devices/cardin.c | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/src/devices/cardin.c b/src/devices/cardin.c index 4f36a1e9..833f0b23 100644 --- a/src/devices/cardin.c +++ b/src/devices/cardin.c @@ -10,7 +10,8 @@ static int cardin_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS], int16_t bits_pe int i, j, k; unsigned char dip[10] = {'-','-','-','-','-','-','-','-','-', '\0'}; - fprintf(stderr, "\nprotocol = Cardin S466\n"); + fprintf(stderr, "------------------------------\n"); + fprintf(stderr, "protocol = Cardin S466\n"); fprintf(stderr, "message = "); for (i=0 ; i<3 ; i++) { for (k = 7; k >= 0; k--) { @@ -21,7 +22,11 @@ static int cardin_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS], int16_t bits_pe } fprintf(stderr, " "); } - fprintf(stderr, "\n"); + if(bb[0][2] == 0) { + fprintf(stderr, "\npartial message - abording\n"); + return 0; + } + fprintf(stderr, "\n\n"); // Dip 1 if(bb[0][0] & 8) { @@ -79,9 +84,26 @@ static int cardin_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS], int16_t bits_pe } fprintf(stderr, " 123456789\n"); - fprintf(stderr, "dipswitch = %s\n",dip); - + fprintf(stderr, "dipswitch = %s\n\n",dip); + fprintf(stderr, " -->ON\n"); + fprintf(stderr, "right button = "); + if((bb[0][2] & 3) == 3) { + fprintf(stderr, "2 --o (this is rigt button)\n"); + fprintf(stderr, " 1 --o\n"); + } + if((bb[0][2] & 9) == 9) { + fprintf(stderr, "2 --o (this is rigt button)\n"); + fprintf(stderr, " 1 o--\n"); + } + if((bb[0][2] & 12) == 12) { + fprintf(stderr, "2 o-- (this is left button or two buttons on same channel)\n"); + fprintf(stderr, " 1 o--\n"); + } + if((bb[0][2] & 6) == 6) { + fprintf(stderr, "2 o-- (this is rigt button)\n"); + fprintf(stderr, " 1 --o\n"); + } return 1; } From 37f4f0038053a62108e2c0dad9411a8fbd99d09c Mon Sep 17 00:00:00 2001 From: Denis Bodor Date: Fri, 20 Mar 2015 14:13:27 +0100 Subject: [PATCH 3/4] fixed typo --- src/devices/cardin.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/devices/cardin.c b/src/devices/cardin.c index 833f0b23..fe712f70 100644 --- a/src/devices/cardin.c +++ b/src/devices/cardin.c @@ -89,11 +89,11 @@ static int cardin_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS], int16_t bits_pe fprintf(stderr, " -->ON\n"); fprintf(stderr, "right button = "); if((bb[0][2] & 3) == 3) { - fprintf(stderr, "2 --o (this is rigt button)\n"); + fprintf(stderr, "2 --o (this is right button)\n"); fprintf(stderr, " 1 --o\n"); } if((bb[0][2] & 9) == 9) { - fprintf(stderr, "2 --o (this is rigt button)\n"); + fprintf(stderr, "2 --o (this is right button)\n"); fprintf(stderr, " 1 o--\n"); } if((bb[0][2] & 12) == 12) { @@ -101,7 +101,7 @@ static int cardin_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS], int16_t bits_pe fprintf(stderr, " 1 o--\n"); } if((bb[0][2] & 6) == 6) { - fprintf(stderr, "2 o-- (this is rigt button)\n"); + fprintf(stderr, "2 o-- (this is right button)\n"); fprintf(stderr, " 1 --o\n"); } From 4e667bf3a68e8a9d045938330fd953c50d415937 Mon Sep 17 00:00:00 2001 From: Denis Bodor Date: Sat, 21 Mar 2015 09:38:42 +0100 Subject: [PATCH 4/4] added copyright and licence --- src/devices/cardin.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/devices/cardin.c b/src/devices/cardin.c index fe712f70..e5a1a4f4 100644 --- a/src/devices/cardin.c +++ b/src/devices/cardin.c @@ -2,8 +2,13 @@ /* * Cardin S466-TX2 generic garage door remote control on 27.195 Mhz - * Use with "-f 27195000" + * Remember to set de freq right with -f 27195000 * May be usefull for other Cardin product too + * + * Copyright (C) 2015 Denis Bodor + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ static int cardin_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS], int16_t bits_per_row[BITBUF_ROWS]) {