InfraredLibに対応したMSC
Dependencies: BLE_API RemoteIR mbed nRF51822
Fork of nRF51822_SimpleChat_IRRX_nRF51DK by
Diff: main.cpp
- Revision:
- 5:1bf7a84598a1
- Parent:
- 4:f1923d9f536e
- Child:
- 6:976503121a46
diff -r f1923d9f536e -r 1bf7a84598a1 main.cpp --- a/main.cpp Fri Dec 02 02:14:10 2016 +0000 +++ b/main.cpp Sat Dec 03 03:21:22 2016 +0000 @@ -76,6 +76,7 @@ static int st = 0; +int flagMargine = -1; int receivedFlag = 0; GattCharacteristic txCharacteristic (uart_tx_uuid, txPayload, 1, TXRX_BUF_LEN, GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_WRITE | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_WRITE_WITHOUT_RESPONSE); @@ -352,7 +353,15 @@ { bitlength1 = receive(&format, buf1, sizeof(buf1)); if (bitlength1 < 0) { - receivedFlag = 0; + if(flagMargine <= 0) { + receivedFlag = 0; + } else { + flagMargine--; + } + + if(flagMargine < -1000) { + flagMargine = -1; + } continue; } pc.printf("receive ok! \r\n"); @@ -360,8 +369,7 @@ display_data(buf1, bitlength1); display_format(format); receivedFlag = 1; - - + flagMargine = 100; } } }