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: BLE_API mbed nRF51822
Fork of Inp_Fiber_Logo_FOTA by
Revision 14:698909b62531, committed 2017-08-31
- Comitter:
- shimoyamada
- Date:
- Thu Aug 31 07:49:28 2017 +0000
- Parent:
- 13:eb29ef0d97e5
- Commit message:
- correct the length of IBI value for BLE transfer
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Fri Aug 25 08:54:28 2017 +0000 +++ b/main.cpp Thu Aug 31 07:49:28 2017 +0000 @@ -314,7 +314,7 @@ byte_t msgHeader[3] = {0x49,0x4e,0x50}; // byte_t msg[19]; - byte_t msg[7]; + byte_t msg[10]; // int nMsgLen = 0; int i; @@ -931,16 +931,15 @@ // sprintf(msg,"%s%s%s%s\0", msgIBI, msgHappy, msgRelax, msgConcentration); - unsigned char IBIChar = (unsigned char)IBI; unsigned char happyRatioChar = (unsigned char)(happyRatio * 100); unsigned char stressRatioChar = (unsigned char)((1 - relaxRatio) * 100); unsigned char conRatioChar = (unsigned char)(conRatio * 100); memcpy(msg, msgHeader, sizeof(msgHeader)); - memcpy(&(msg[3]), &IBIChar , sizeof(IBIChar) ); - memcpy(&(msg[4]), &happyRatioChar , sizeof(happyRatioChar)); - memcpy(&(msg[5]), &stressRatioChar , sizeof(stressRatioChar)); - memcpy(&(msg[6]), &conRatioChar , sizeof(conRatioChar) ); + memcpy(&(msg[3]), &IBI , sizeof(IBI) ); + memcpy(&(msg[7]), &happyRatioChar , sizeof(happyRatioChar)); + memcpy(&(msg[8]), &stressRatioChar , sizeof(stressRatioChar)); + memcpy(&(msg[9]), &conRatioChar , sizeof(conRatioChar) ); ble.updateCharacteristicValue(uartServicePtr->getRXCharacteristicHandle(), (uint8_t*)msg, sizeof(msg)); // (uint8_t*)msg, nMsgIBILen + nMsgHappyLen + nMsgRelaxLen + nMsgConcentrationLen);