+ rf_asksin_task(void)
+ {
+@@ -77,18 +105,41 @@
+ uint8_t dec[MAX_ASKSIN_MSG];
+ uint8_t rssi;
+ uint8_t l;
++ uint8_t rxfifo_cnt;
+
+ if(!asksin_on)
+ return;
+
+- // see if a CRC OK pkt has been arrived
+- if (bit_is_set( CC1100_IN_PORT, CC1100_IN_PIN )) {
++ // see if there is data to be read
++ while (bit_is_set( CC1100_IN_PORT, CC1100_IN_PIN )) {
++ rxfifo_cnt = read_cc1100_rxbytes();
+
++ if (rxfifo_cnt & 0x80) // Overflow
++ break;
++
++ rxfifo_cnt &= 0x7f;
++
+ enc[0] = cc1100_readReg( CC1100_RXFIFO ) & 0x7f; // read len
++ rxfifo_cnt--;
+
+- if (enc[0]>=MAX_ASKSIN_MSG)
+- enc[0] = MAX_ASKSIN_MSG-1;
+-
++ if (enc[0] >= MAX_ASKSIN_MSG) {
++ // Something went horribly wrong, out of sync?
++ rf_asksin_reset_rx();
++ return;
++ }
++
++ l = 50;
++ while (l-- && ((enc[0] + 2) < rxfifo_cnt)) { // Wait for more data
++ my_delay_ms(1);
++ rxfifo_cnt = (read_cc1100_rxbytes() & 0x7f);
++ }
++
++ if (!l) {
++ // Not enough data received, out of sync?
++ rf_asksin_reset_rx();
++ return;
++ }
++
+ CC1100_ASSERT;
+ cc1100_sendbyte( CC1100_READ_BURST | CC1100_RXFIFO );
+
+@@ -97,14 +148,19 @@