Skip to content

Engage nRF advertising boost on button press (ordering fix)#71

Open
balloob wants to merge 1 commit into
OpenDisplay:mainfrom
balloob:fix/nrf-adv-boost-ordering
Open

Engage nRF advertising boost on button press (ordering fix)#71
balloob wants to merge 1 commit into
OpenDisplay:mainfrom
balloob:fix/nrf-adv-boost-ordering

Conversation

@balloob

@balloob balloob commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

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 via ble_nrf_apply_adv_interval()
#ifdef TARGET_NRF
ble_nrf_boost_advertising();   // only NOW sets s_nrf_adv_boost_until
#endif

updatemsdata() restarts advertising through ble_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, but ble_nrf_advertising_tick() merely returns 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

  • Compiled clean (not flashed) for nrf52840custom and esp32-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.

@balloob balloob requested a review from jonasniesner as a code owner July 3, 2026 21:26
@balloob balloob force-pushed the fix/nrf-adv-boost-ordering branch from e655037 to 02dc1f5 Compare July 3, 2026 21:29
…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
@balloob balloob force-pushed the fix/nrf-adv-boost-ordering branch from 02dc1f5 to f7f4684 Compare July 3, 2026 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant