rc433/recv.c

changeset 29
ac763b87ee25
parent 23
d820a6f3ec16
child 51
a03b6dac5398
--- a/rc433/recv.c	Tue May 06 21:37:06 2014 +0200
+++ b/rc433/recv.c	Wed May 07 23:01:18 2014 +0200
@@ -43,12 +43,26 @@
     while (1) {
 	if (available()) {
 		         
-	    int value = getReceivedValue();
+	    unsigned long int value = getReceivedValue();
+	    int bitlen = getReceivedBitlength();
 			     
 	    if (value == 0) {
 		printf("Unknown encoding\n");
 	    } else {
-		printf("Received %ld/%d bit Protocol: %d\n", getReceivedValue(), getReceivedBitlength(), getReceivedProtocol() );
+		if (bitlen == 24) {
+		    printf("Received 0x%06lx/24 bit %s Protocol: %d", value, dec2binWzerofill(value, bitlen), getReceivedProtocol() );
+		    if ((value & 0x00000000000003f0) == 0x0000000000000150) {
+			printf(" Type A ");
+			printf("%c%c%c%c%c ", (value & 0xc00000) ? '0' : '1', (value & 0x300000) ? '0' : '1', (value & 0x0c0000) ? '0' : '1', (value & 0x030000) ? '0' : '1', (value & 0x00c000) ? '0' : '1');
+			printf("%c%c%c%c%c ", (value & 0x003000) ? '0' : '1', (value & 0x000c00) ? '0' : '1', (value & 0x000300) ? '0' : '1', (value & 0x0000c0) ? '0' : '1', (value & 0x000030) ? '0' : '1');
+		    }
+		    if ((value & 0x000000000000001c) == 0x0000000000000000) {
+			printf(" Type E");
+		    }
+		    printf("\n");
+		} else {
+		    printf("Received 0x%lx/%d bit %s Protocol: %d\n", value, bitlen, dec2binWzerofill(value, bitlen), getReceivedProtocol() );
+		}
 	    }
 
 	    resetAvailable();

mercurial