Giter Club home page Giter Club logo

Comments (12)

JF002 avatar JF002 commented on August 15, 2024 1

Here is a first analysis:

  • The class NimbleController should be refactored and improved (better state machine for service and characteristic discovery, handle the return codes of all functions from NimBLE, correctly de-init() all objects when disconnecting,...).
  • Some connection issue might be caused by handles that are not cleared on disconnection. We it reconnects to another device/app, it still use old handles values that are not valid anymore.
  • If NRFConnect and Gadgetbridge are installed on the smartphone, it seems that the CTS from NRFConnect confuses InfiniTime when connecting to gadgetbridge : InfiniTime/NimBLE find a reference to the CTS service during discovery, and fails when reading the time characteristic -> the error triggers a disconnection.
  • sometimes, NimBLE looks totally dead, advertising does not start anymore, only a system reset solves the issue

I still have to analyze this a bit deeper. In the mean time, I've observed that disabling the CTS service from NRFConnect improved the connection and reconnection stability for Gadgetbridge.

from infinitime.

JF002 avatar JF002 commented on August 15, 2024 1

Here is a first fix : the services are reset on disconnect, and advertising is not started if a connection is already established : https://github.com/JF002/Pinetime/tree/improve-ble-connection
With this fix, and if the CTS service of NRFConnect , connection and reconnection worked every time I tried.

from infinitime.

Avamander avatar Avamander commented on August 15, 2024

Yep, after a while it just seems to disconnect. For some reason the PineTime itself thinks the connection is alive, might need a bit better status polling/handling. Needs to be investigated more.

from infinitime.

JF002 avatar JF002 commented on August 15, 2024

I've just pushed a new commit. I refactored the service discovery procedure. It' now much cleaner and it does not try to get the time from CTS when it has not been discovered correctly.

There is still one issue, but I don't think it comes from InfiniTime : if the CTS service is enabled in NRFConnect when connecting using Gadgetbridge, CTS is discovered but does not respond to a read command, a timeout occurs which trigger the disconnection of the BLE connection...

@Avamander Can you try this branch and see if it improves the situation on your side?

from infinitime.

Avamander avatar Avamander commented on August 15, 2024

@JF002

Can you try this branch and see if it improves the situation on your side?

Can it wait until the middle of next week?

from infinitime.

Avamander avatar Avamander commented on August 15, 2024

Also, just wondering, did you test Out Of Range behavior?

from infinitime.

JF002 avatar JF002 commented on August 15, 2024

Can it wait until the middle of next week?

We are not in a hurry. I would like to merge this in InfiniTime 0.9 is it works correctly.

Also, just wondering, did you test Out Of Range behavior?

Yes, I did many tests, going out of range with my phone, disconnect the bluetooth adapter from my computer while it's connected, connect from NRFConnect, Gadgetbridge and my computer,...
As long as the CTS is disabled on NRFConnect, it works fine.

from infinitime.

JF002 avatar JF002 commented on August 15, 2024

I've just created the PR (#118). I'll merge it in develop and create a release candidate release for people to test it

from infinitime.

ashkitten avatar ashkitten commented on August 15, 2024

i'm having this problem on the latest release 0.9.0 with a sealed pinetime. after a while (some hours, it seems), it disconnects but still thinks it's connected (so can't reestablish connection) until a reboot.

from infinitime.

Avamander avatar Avamander commented on August 15, 2024

https://github.com/JF002/Pinetime/releases/tag/0.13.0 was just released, but it will take some time to monitor this

from infinitime.

JF002 avatar JF002 commented on August 15, 2024

I think we can say this bug was fixed in 0.12/0.13, what do you think @Avamander ?

from infinitime.

Avamander avatar Avamander commented on August 15, 2024

@JF002 Probably.

from infinitime.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.