adaptation for bkap
Fork of X_NUCLEO_IDB0XA1 by
Diff: source/BlueNRGGap.cpp
- Revision:
- 145:024a552e4715
- Parent:
- 144:bdf5e8432131
- Child:
- 150:b37ec5129f3c
- Child:
- 152:4afc5c2fc4f3
--- a/source/BlueNRGGap.cpp Wed Oct 21 11:56:41 2015 +0200 +++ b/source/BlueNRGGap.cpp Tue Oct 27 10:18:55 2015 +0100 @@ -1018,15 +1018,17 @@ // The discovery is complete. If this is due to a stop scanning (i.e., the device // we are interested in has been found) and a connection has been requested // then we start the device connection. Otherwise, we restart the scanning. + PRINTF("DISCOVERY_COMPLETE\n\r"); _scanning = false; if(_connecting) { // We need to wait for a while before creating a connection due to // BlueNRG process queue handling - Clock_Wait(10); + Clock_Wait(100); makeConnection(); } else { + PRINTF("re-startRadioScan\n\r"); startRadioScan(_scanningParams); } @@ -1039,12 +1041,17 @@ uint8_t ret = BLE_STATUS_SUCCESS; + printf("Scanning...\n\r"); + // We received a start scan request from the application level. // If we are on X-NUCLEO-IDB04A1 (playing a single role at time), // we need to re-init our expansion board to specify the GAP CENTRAL ROLE - btle_init(isSetAddress, GAP_CENTRAL_ROLE_IDB04A1); - - PRINTF("BTLE re-init\n\r"); + if(!btle_reinited) { + btle_init(isSetAddress, GAP_CENTRAL_ROLE_IDB04A1); + btle_reinited = true; + + PRINTF("BTLE re-init\n\r"); + } ret = aci_gap_start_general_discovery_proc(scanningParams.getInterval(), scanningParams.getWindow(), @@ -1090,6 +1097,9 @@ int8_t paLevel = 0; #ifdef DEBUG int8_t dbmActuallySet = getHighPowerAndPALevelValue(txPower, enHighPower, paLevel); +#else + /* avoid compiler warnings about unused variables */ + (void)txPower; #endif PRINTF("txPower=%d, dbmActuallySet=%d\n\r", txPower, dbmActuallySet);