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.
Dependents: Data-Management-Honka
Diff: BluetoothComm.cpp
- Revision:
- 14:ac9949a0aff5
- Parent:
- 13:67492109a66d
- Child:
- 15:a492356f5485
--- a/BluetoothComm.cpp Thu Mar 12 20:59:57 2015 +0000 +++ b/BluetoothComm.cpp Sat Mar 14 00:09:22 2015 +0000 @@ -215,7 +215,7 @@ * @author Michael Ling * @date 2/4/2015 */ -void BluetoothComm::send_values(char* paramList, short *dataOut) +void BluetoothComm::send_values(char* paramList, char *message, short *dataOut) { char msg[2*_numVars+6]; int len=2; @@ -250,25 +250,25 @@ msg[len+2] = checksum[2]; len += 3; for (int j = 0; j < len; j++) { - printf("Sending char %x \r\n", msg[j]); + // printf("Sending char %x \r\n", msg[j]); _rn42.putc(msg[j]); } if (dataOut != NULL) { - int ind = 0; + int ind = 1; int j; for (j = 0; j < len-1; j+=2) { - dataOut[ind] = (msg[j]<<8)|msg[j+1]; + dataOut[ind] = (message[j+1]<<8)|message[j]; printf("Index %d is %x\r\n", ind, dataOut[ind]); ind += 1; } if (j < len) { - dataOut[ind] = msg[j] << 8; + dataOut[ind] = message[j]; printf("Index %d is %x\r\n", ind, dataOut[ind]); } } - printf("Placed in dataOut\r\n"); + // printf("Placed in dataOut\r\n"); memcpy(_lastCmd, msg, 50); free(checksum); return ; @@ -297,14 +297,14 @@ //printf("%d readonly parameters", _numReadOnlyParams); for (int i = 0; i < _numReadOnlyParams; i++) { if (i == _escapeNeeded[escapes]) { - printf("Escape char. needed at index %d \r\n", i); + // printf("Escape char. needed at index %d \r\n", i); //char conflict = (char)(_readOnlyParams[i] & 0xff); char conflict = (char)(_paramMap[_indexMap[i+_numVars]] & 0xff); //printf("%x possibly has a conflict in %x \r\n", _readOnlyParams[i], conflict); escapes += 1; //message[msgInd+1] = (char) (_readOnlyParams[i] >> 8); message[msgInd+1] = (char) (_paramMap[_indexMap[i+_numVars]] >> 8); - printf("Set msgInd+1 to %x \r\n", message[msgInd+1]); + // printf("Set msgInd+1 to %x \r\n", message[msgInd+1]); if (conflict == (char) 0xfe) { message[msgInd] = 1; message[msgInd+2] = 0xfc; @@ -331,7 +331,7 @@ message[msgLen-1] = checksum[2]; //printf("Sending the following readONly values: \r\n"); for (int j=0; j < msgLen; j++) { - printf("%x \r\n", message[j]); + // printf("%x \r\n", message[j]); _rn42.putc(message[j]); } memcpy(_lastCmd, message, 50); @@ -491,11 +491,11 @@ } if (message[len-5] == READONLY_IND) { - printf("Need to send RO vals\r\n"); + // printf("Need to send RO vals\r\n"); send_read_only_values(); } - printf("About to send PARAMLIST\r\n"); - send_values(paramList, NULL); + // printf("About to send PARAMLIST\r\n"); + send_values(paramList, NULL, NULL); } /** @@ -536,7 +536,8 @@ //printf("Wrote %x to index %d of localValues \r\n", localValues[index], index); } - send_values(paramList, dataOut); + send_values(paramList, message, dataOut); + write_params_to_sd_card(); //SD_Card.write(localValues) //sendToControlBed(localValues+1, len-2)