Stop receiving sensor data or emit commands after being connected to the board for some time

I'm having the problem described on the title. I know I'm not the first one having such problems, but I have implemented the solutions given in the forum to similar questions and the problem still happens. 

Right now I'm streaming data from the gyro and accel at 50Hz as well as altitude data with a stand by time of 0.5. I'm also controlling the built-in LED with a UI button. What happens is that after a while my app stops being able to control the LED and the sensor data streams stop..

That being said, I already use the packed data for the gyro/accel and I also have the max connection interval set to 11.25f / 7.5f depending on the version. 

Comments

    • What Android device and OS are you using?
    • What firmware is the board running?
    • What board do you have?
    • Do you see a similar issue when using the MetaHub app?
  • nubnub
    edited April 2017
    • What Android device and OS are you using?
    Huawei p9 lite and android 6.0

    • What firmware is the board running?
    • What board do you have?
    It's a CPRO with the latest firmware

    • Do you see a similar issue when using the MetaHub app?
    I don't seem to find any problems when using the MetaHub app.

    I noticed that I didn't set a reconnect for the UnexpectedDisconnect and after doing so the problem seems less common (but still not totally fixed). I also noticed that most of the times my app doesn't connect to the board on its first try, but on a reconnect call afterwards (I'm using the scan activity from the sample app).

  • Assuming you have no issues running the gyro and acc at 50Hz each, try reducing the barometer's standby time.
  • Won't reducing the barometer's standby time increase the frequency?
  • edited April 2017
    Sorry, I mean  increase the standby time which reduces the frequency.
  • Even after reducing the frequency of the barometer, I still have the same problem from time to time.

    Another thing I noticed is that it looks like sometimes only one of the sensors is correctly initialized, that is, either only the accelerometer or gyroscope starts streaming data. What's the correct way to setup data routes for multiple sensors?

    Right now, I'm doing it like this: https://pastebin.com/1C3saUiN
    However I found out that sometimes I only get data (by checking the logs) from one of the sensors.
  • Do I really need to chain the addRouteAsyncs? I'm asking this, because I'm trying to use reactive extensions to have an observable stream of the sensor data, which means that I need to create an observable for each sensor. This makes it hard to chain them, however it's not impossible.
  • Yes, async tasks need to be chained.  Also, don't start the sensors until all routes have been setup.
This discussion has been closed.