-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
start_advertising interval does not accept the minimum 20ms value and may not range check correctly #2930
Comments
One other thing I'm puzzling over is why the flags (0x01) appear if I run
Note |
Yes, |
There's something not quite right on
|
The floating-point conversations are apparently different for the C compiler and the CircuitPython/MicroPython converter. So for now, could you just use a larger value? I will try to make this more consistent. |
I'm not actively using that value in new code but I mentioned |
The |
I was reading https://developer.apple.com/accessories/Accessory-Design-Guidelines.pdf and page 126, section 35.5 recommends "an initial 30s of 20ms intervals" for advertising if I'm understanding this correctly.
I tried it on CircuitPython and it didn't behave. I've just run it again against 5.3.0 with 20200519 libs.
I had a brief discussion with @jepler on discord about this and we both assumed it was an unfortunate FP-ism. I had a glance at the code and it looks like it might unfortunately reject via an informational exception a 0.020 value because of the 30-bit fp conversion and then comparison of
< 0.020f
. The nice exception doesn't happen, I tried a few values to work out what's going on.Are these pair (https://github.com/adafruit/circuitpython/blob/master/shared-bindings/_bleio/Adapter.c#L36-L37) supposed to read
0.020
(20ms) rather than0.0020
(2ms)?The code is also not doing an explicit conversion to integer so gets truncation (round towards zero) semantics and judging by a test of this code that will also punt a 30bit 0.020 value into out of range territory:
Output is:
The middle one is actually the 0.020 with MicroPython's 30bit conversion applied and comes out as
31
which is below minimum.For anyone else stumbling across this issue, the value below works as a workaround that can be left in place after any fixes:
The text was updated successfully, but these errors were encountered: