Engage nRF advertising boost on button press (ordering fix)#71
Open
balloob wants to merge 1 commit into
Open
Conversation
e655037 to
02dc1f5
Compare
…datemsdata The button handler called updatemsdata() (which restarts nRF advertising via ble_nrf_apply_adv_interval()) and only then ble_nrf_boost_advertising(). Since the boost deadline was still unset during the restart, apply_adv_interval used the normal interval, and ble_nrf_advertising_tick() merely returns while boosting without restarting advertising. Net effect: a single button press never actually applied the 20-30 ms boost interval (it only engaged if a second event restarted advertising within the 3 s window). Set the boost deadline before updatemsdata() so its advertising restart picks up the fast interval. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MgW3EZCfMkGFffseDPwV74
02dc1f5 to
f7f4684
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On nRF, a button press is supposed to briefly boost the advertising rate (20–30 ms interval for 3 s) so the change propagates quickly. But it never engages on a single press.
The button handler did:
updatemsdata()restarts advertising throughble_nrf_apply_adv_interval(), but at that point the boost deadline is still unset, so it applies the normal interval.ble_nrf_boost_advertising()then sets the deadline, butble_nrf_advertising_tick()merelyreturns while boosting without re-applying the interval or restarting advertising. So the boost interval is only ever applied if a second event restarts advertising within the 3 s window.Fix
Set the boost deadline before
updatemsdata(), so its advertising restart picks up the fast interval.Verification
nrf52840customandesp32-N4.Testing to do on hardware
On an nRF device, press a configured button and confirm (e.g. via a BLE sniffer or faster scan-response updates) that advertising speeds up for ~3 s after the press.