fix first element of array selection

pull/8738/head
paul-szczepanek-arm 2018-11-12 08:20:41 +00:00 committed by Vincent Coubard
parent fd880d1e6b
commit 565f1e0131
1 changed files with 13 additions and 7 deletions

View File

@ -190,9 +190,13 @@ private:
} else if (_enabledPhy[ble::phy_t::LE_2M]) {
return 1;
} else if (_enabledPhy[ble::phy_t::LE_CODED]) {
if (isSwapped()) {
return 1;
} else {
return 2;
}
}
}
/** Handle toggling PHYs on and off and return the correct index to use to set the configuration elements.
*
@ -206,17 +210,13 @@ private:
bool was_swapped = false;
bool is_swapped = false;
if (_enabledPhy[ble::phy_t::LE_1M] &&
!_enabledPhy[ble::phy_t::LE_2M] &&
_enabledPhy[ble::phy_t::LE_CODED]) {
if (isSwapped()) {
was_swapped = true;
}
_enabledPhy[phy.value()] = enable;
if (_enabledPhy[ble::phy_t::LE_1M] &&
!_enabledPhy[ble::phy_t::LE_2M] &&
_enabledPhy[ble::phy_t::LE_CODED]) {
if (isSwapped()) {
is_swapped = true;
}
@ -231,6 +231,12 @@ private:
return index;
}
bool isSwapped() const {
return (_enabledPhy[ble::phy_t::LE_1M] &&
!_enabledPhy[ble::phy_t::LE_2M] &&
_enabledPhy[ble::phy_t::LE_CODED]);
}
/** Handle the swapping of 2M and CODED so that the array is ready for the pal call. */
void swapCodedAnd2M() {
uint16_t scanInterval = _scanInterval[ble::phy_t::LE_2M];