txBufPtr = msg;
}
}
- signal ByteRadio.rts();
+ signal ByteRadio.rts(msg);
return SUCCESS;
}
cc1000_metadata_t *rxMetadata = getMetadata(rxBufPtr);
if (result != SUCCESS)
- rxMetadata->strength = 0;
+ rxMetadata->strength_or_preamble = 0;
else
- rxMetadata->strength = data;
+ rxMetadata->strength_or_preamble = data;
}
void rxData(uint8_t in) {
uint8_t nextByte;
cc1000_header_t *rxHeader = getHeader(rxBufPtr);
-
- // rxLength is the offset into a message_t at which the packet
- // data ends: it is NOT equal to the number of bytes received,
- // as there may be padding in the message_t before the packet.
- uint8_t rxLength = rxHeader->length + offsetof(message_t, data);
+ uint8_t rxLength = rxHeader->length;
// Reject invalid length packets
- if (rxLength > TOSH_DATA_LENGTH + offsetof(message_t, data))
+ if (rxLength > TOSH_DATA_LENGTH)
{
// The packet's screwed up, so just dump it
enterListenState();
nextByte = rxShiftBuf >> f.rxBitOffset;
((uint8_t *)rxBufPtr)[count++] = nextByte;
+ // Adjust rxLength to correspond to the corresponding offset in message_t
+ rxLength += offsetof(message_t, data);
if (count <= rxLength)
runningCrc = crcByte(runningCrc, nextByte);
if (f.ack &&
rxFooter->crc &&
- rxHeader->addr == call amAddress())
+ rxHeader->dest == call amAddress())
{
enterAckState();
call CC1000Control.txMode();