Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix beacon distance callouts at geofence transitions #109

Merged
merged 3 commits into from
Oct 3, 2024

Conversation

steinbro
Copy link
Member

There was a very subtle issue with how I implemented the configurable beacon immediate-vicinity distance (#102 ). The original non-configurable implementation had two distance threshold constants, one for entering the vicinity (15m) and one for exiting (30m). The setting I added was only for the first constant, which meant you could set an enter-vicinity distance greater than the exit-vicinity distance. When this was true, the region considered "near" the beacon was no longer a circle drawn around the location, but a donut-shaped area. This led to the weird callout behavior @fraziercarr observed, where walking towards the beacon led to repeated callouts of "Beacon within x units," which would be played each time the user crossed in or out of the donut. I've now updated it so that the exit-vicinity distance is always set to the enter-vicinity distance plus 15m, ensuring the exit-vicinity distance is always the outer of the two circles.

Fixing this revealed another bug. When the enter-vicinity distance was set to larger values (25m+), when walking away from the beacon, you would hear something like "Beacon: 110 feet" before "Beacon within 80ft," which was very confusing since it implied you were walking in the opposite direction. The periodic "Beacon: 110 feet" distance callouts were being prioritized over the "Beacon within 80ft" callout played only when entering or exiting the beacon vicinity. This was because large vicinity radii exceed the normal interval at which distance callouts are announced (50m), and periodic distance callouts are disabled when you are within the beacon vicinity, so the periodic distance callouts were overdue by the time you exited the beacon vicinity. I addressed this by only playing the "Beacon within x units" callouts when entering (not exiting) the beacon vicinity.

@RDMurray RDMurray merged commit b9568e1 into main Oct 3, 2024
1 check passed
@RDMurray RDMurray deleted the beacon-geofence-callouts branch October 3, 2024 21:53
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.

2 participants