Commit 411cba7
Fix virtual bike target power/resistance reset to 0 when using Dircon after a brief BLE touch
Reported in #4844 (issuecomment-5090946778): with
"virtual device bluetooth" enabled on iOS, the Target Power and Target
Resistance tiles intermittently showed 0 or wrong values during a ride,
even though auto-resistance itself worked. Disabling "virtual device
bluetooth" fixed it, which pointed at the iOS BLE bridge as the culprit.
Debug log analysis (two attached rides, one with virtual_device_bluetooth
enabled and one disabled) showed the following: the client (MyWhoosh)
briefly touched the BLE lockscreen bridge once at the very start of the
ride (a single 1-byte handshake frame), then moved over to Dircon (WiFi)
for the rest of the ride, which is expected. But virtualbike::bikeProvider()
treats lastFTMSFrameReceived as a permanent latch once set - it never
resets it when Dircon takes over, so it kept calling
writeP2AD9->changePower(h->virtualbike_getPowerRequested()) every ~second
with a cached BLE-side power request that was never actually updated
again (0 for the rest of the ride, 3625/3625 occurrences in the buggy
log), overwriting the correct value that Dircon had just set moments
earlier.
Fix: reset lastFTMSFrameReceived in dirconFtmsCharacteristicChanged()
whenever a Dircon frame arrives, so the stale BLE-side latch is
invalidated as soon as Dircon proves itself the active transport for
that ride. A genuine new BLE frame will re-arm the latch normally.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>1 parent 0f9684b commit 411cba7
1 file changed
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1787 | 1787 | | |
1788 | 1788 | | |
1789 | 1789 | | |
| 1790 | + | |
| 1791 | + | |
| 1792 | + | |
| 1793 | + | |
1790 | 1794 | | |
1791 | 1795 | | |
0 commit comments