Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Revision 6:1fe84e29b486, committed 2015-11-11
- Comitter:
- mfrede
- Date:
- Wed Nov 11 00:46:15 2015 +0000
- Parent:
- 5:387b2ebf6b91
- Child:
- 7:67b40640ddb6
- Commit message:
- added headers back in...not sure if we need them
Changed in this revision
remote.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/remote.cpp Tue Nov 10 23:30:11 2015 +0000 +++ b/remote.cpp Wed Nov 11 00:46:15 2015 +0000 @@ -39,8 +39,22 @@ int rf_receive(packet *data, uint8_t maxLength) { uint8_t len = mrf.Receive((uint8_t *)data, maxLength); - + uint8_t header[8]= {1, 8, 0, 0xA1, 0xB2, 0xC3, 0xD4, 0x00}; + if(len > 10) { + pc.printf("got data\r\n"); + //Remove the header and footer of the message + for(uint8_t i = 0; i < len-2; i++) { + if(i<8) { + //Make sure our header is valid first + if(((uint8_t *)data)[i] != header[i]) + return 0; + } else { + ((uint8_t *)data)[i-8] = ((uint8_t *)data)[i]; + } + } + len = len - 8; + } if(len > 4) { //valid data with full header if(data->to != NODE) @@ -104,7 +118,7 @@ while(true) { //Try to receive some data - rxLen = rf_receive(rxBuffer, 2); + rxLen = rf_receive(rxBuffer, 128); if(rxLen > 0) {