You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2021/10/04 10:37:39 UTC
[GitHub] [mynewt-nimble] andrzej-kaczmarek opened a new pull request #1045: nimble/ll: Simplify phy switching in scanner
andrzej-kaczmarek opened a new pull request #1045:
URL: https://github.com/apache/mynewt-nimble/pull/1045
This aims to make phy switching in scanner really simple.
Currently we have two separate scan windows (one for each phy) that
usually move at different interval and we are trying to select best
window to scan at the given moment. To make things simpler we can use
a common interval for both phys and scan them back to back. This means
we effectively have single scan window with phy switch at some point
during the window.
This is possible because we can select any window/interval values and
do not need to strictly follow those requested by host. Obviously we'll
try to select parameters that are somehow related to requested ones, so
we do as follows:
- use duty cycle for each phy as a guideline to calculate sub-window
duration for each phy
- use larger interval of both phys as interval
- scale phy window duration up or down to have proper duty cycle at
selected interval
So basically if host requests the same interval for both phys, we will
use sub-window duration for each phy as requested, unless both do not
fit in single interval (i.e. sum of window duration for each phy is
larger than interval) so we'll scale them down in such case to fit.
If intervals on both phys are not the same, we'll recalculate windows
to have the same duty cycle as requested, but with different (common)
interval.
The same calculations also work well for single phy since in that case
one of phys will have window=0 which means also its duty cycle will be
calculated as 0.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [mynewt-nimble] sjanc commented on a change in pull request #1045: nimble/ll: Simplify phy switching in scanner
Posted by GitBox <gi...@apache.org>.
sjanc commented on a change in pull request #1045:
URL: https://github.com/apache/mynewt-nimble/pull/1045#discussion_r722148485
##########
File path: nimble/controller/src/ble_ll_scan.c
##########
@@ -2570,17 +2533,70 @@ ble_ll_scan_hci_set_params(const uint8_t *cmdbuf, uint8_t len)
scanp = &g_ble_ll_scan_params.scan_phys[PHY_UNCODED];
scanp->configured = 1;
scanp->scan_type = cmd->scan_type;
- scanp->timing.interval = ble_ll_scan_time_hci_to_ticks(scan_itvl);
- scanp->timing.window = ble_ll_scan_time_hci_to_ticks(scan_window);
#if (BLE_LL_SCAN_PHY_NUMBER == 2)
scanp = &g_ble_ll_scan_params.scan_phys[PHY_CODED];
scanp->configured = 0;
#endif
+ scan_win = &g_ble_ll_scan_params.scan_win;
+ scan_win->tick_start = 0;
+ scan_win->tick_switch_phy = ble_ll_scan_time_hci_to_ticks(scan_window);
+ scan_win->tick_end = scan_win->tick_switch_phy;
+ scan_win->tick_next_win = ble_ll_scan_time_hci_to_ticks(scan_itvl);
+
return 0;
}
+static inline uint32_t
Review comment:
nitpick: not a huge fan of static inline in c files :-)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org