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,7 +190,11 @@ private:
} else if (_enabledPhy[ble::phy_t::LE_2M]) { } else if (_enabledPhy[ble::phy_t::LE_2M]) {
return 1; return 1;
} else if (_enabledPhy[ble::phy_t::LE_CODED]) { } else if (_enabledPhy[ble::phy_t::LE_CODED]) {
return 2; if (isSwapped()) {
return 1;
} else {
return 2;
}
} }
} }
@ -206,17 +210,13 @@ private:
bool was_swapped = false; bool was_swapped = false;
bool is_swapped = false; bool is_swapped = false;
if (_enabledPhy[ble::phy_t::LE_1M] && if (isSwapped()) {
!_enabledPhy[ble::phy_t::LE_2M] &&
_enabledPhy[ble::phy_t::LE_CODED]) {
was_swapped = true; was_swapped = true;
} }
_enabledPhy[phy.value()] = enable; _enabledPhy[phy.value()] = enable;
if (_enabledPhy[ble::phy_t::LE_1M] && if (isSwapped()) {
!_enabledPhy[ble::phy_t::LE_2M] &&
_enabledPhy[ble::phy_t::LE_CODED]) {
is_swapped = true; is_swapped = true;
} }
@ -231,6 +231,12 @@ private:
return index; 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. */ /** Handle the swapping of 2M and CODED so that the array is ready for the pal call. */
void swapCodedAnd2M() { void swapCodedAnd2M() {
uint16_t scanInterval = _scanInterval[ble::phy_t::LE_2M]; uint16_t scanInterval = _scanInterval[ble::phy_t::LE_2M];