Closed jwatral closed 1 year ago
thanks for the deep analysis! the things that seems in common with the issue is the presence and usage of the bluetooth at the same time of ant+
BUT this seems to go to the other hand
Question - Have you tried to enable fake device and check if that helps with the issue? Outcome - Yes, it didn't change anything
could you please try to disable the virtual device also? if it doesn't change anything, could you please also disable the bluetooth scanning at all?
if you want i can do a fork for this tests
could you please also disable the bluetooth scanning at all
in the c++ code or like disable bluetooth on android device?
could you please try to disable the virtual device also?
sure, with fake device enabled? What does the virtual device do btw?
if you want i can do a fork for this tests
please do.
But please keep in mind, that the issue does not occur, when the QZ is not connected to domyos bike.
Question - Have managed to obtain stable speed readings from QZ app in any setup? Outcome - Yes, if I start the channels from MyActivity and set some dummy speed values the speed readings are fine BUT, as soon as the QZ connects to the stationary bike, the problem starts occurring (still with dummy value set in onCreate in MyActivity.
in the c++ code or like disable bluetooth on android device?
c++
sure, with fake device enabled?
yes
What does the virtual device do btw?
send metrics to peloton or zwift for example
if you want i can do a fork for this tests
please do.
ok
But please keep in mind, that the issue does not occur, when the QZ is not connected to domyos bike.
yes this is exactly the scope of my previous questions
Ok, I've just done the following:
Speed = 22;
in fakebike.cpp
I've tried following 4 option permutations (QZ was closed and started from Qt Creator once again after each change):
Not sure why it works with fake bike ON now - I might have made a mistake testing it last time. edit - ok, I've just checked in the mail history with you - it was working fine with fake bike last time as well - it's just my memory that failed this time ;-) I'll update the description. Sorry for the confusion.
According to this test
ok so we know for sure that bluetooth is interfering.
so last test: remove this line https://github.com/cagnulein/qdomyos-zwift/blob/732e84d2e36e254c8f87a41044229839d5bf1bda/src/domyosbike.cpp#L66
if i'm right you should be able to fix the issue in this way (maybe the domyos bike would not work, but at least we will know if it's releated to a thread issue or a bluetooth issue)
let me know, i'm very curious
I just did the test - doesn't seem to have any influence. I've removed the line, build in Qt Creator, and hit run. During first attempt, the bike disconnected for a short while, but that's it. Everything seems to be the same - including speed drops every 20 seconds.
Ok so it's the Bluetooth for sure. Another test:
If everything works it means that the issue is inside qz, so it's something that we can fix If it doesn't work neither in this way, it means that the conflict is inside android itself.
How does it sound to you?
Nice idea! Thanks. I did the following:
So unfortunately it's something releated to android. I guess our best hope are 1) running 1 instance of qz for ant on a device and another device with qz for Bluetooth 2) trying an external ant+ usb key
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
@jwatral any news?
I have had same issue Samsung Galaxy A5, speed data provided via ant to garmin are with 0 values and power getting too 0 value but, not often than speed. DIf between qz and garmin mesure for same track is hor one hour time 30 min move/30 pause by garmin computing
@wajo666 it seems an unresolvable bug because ANT+ on android can't coexist with bluetooth. Disable the speed sensr and at least you should have a stable power source. Let me know
@cagnulein
trying an external ant+ usb key
Unfortunately, I don't have one. Could someone try it? I'm quite interested in the outcome.
running 1 instance of qz for ant on a device and another device with qz for Bluetooth
will they share the speed and power data somehow? How to setup it?
will they share the speed and power data somehow? How to setup it?
yes I will need to add the support of this without using bluetooth. I can use DIRCON in the opposite way of what I'm doing now. DIRCON now is sending metrics via wifi to zwift. I should implement also the opposite.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
@cagnulein I've kind of fixed it finally. After changing the implementation to the one imitating speed&cadence sensor, everything works fine. Tested in 3 training sessions already, one of which >2h. Looks like, the issue is connected to timing after all. The old speed sensor, required 4 pages to be interleaved and operated with a different period. Speed&cadence sensor only requires one page to be transmitted and works well in my setup. Not sure if the solution is acceptable for you, though?
wow! i guess it doesn't have any downside so it's absolutely perfect to me! thanks!
is #1110 live on android because I seem to have the same issue right now.
@rykzon it's in the beta! join from the play store page of qz let me know
I tested latest beta version. New sensor is speed/cadence on garmin , but speed is blinking real from domyos or 0km/h. Watt I didn't check it. Next weekend I will can check it
@jwatral any hint to help @wajo666 in the test?
@wajo666 what’s the phone and garmin you’re using? Have you set 100mm wheel diameter in garmin for this new sensor? Is the ant+ HR sensor off in settings?
tbh I haven’t tested it with the beta just yet - only with locally compiled version of qz.
If beta is 2.12.36 still same issue, any settings I can try?
If beta is 2.12.36 still same issue, any settings I can try?
ant heart is disabled?
In Ant+ Options I only have cadence enabled
did you check the @jwatral suggestion's?
ant heart is disabled, yes it is 2.12.36 . samsung galaxy A5. wheel is 100mm
ok let's wait the test of @jwatral maybe we're missing something
Ok, I've just did some tests.
Test procedure:
Outcome:
So it looks like, the fix doesn't work on A5 for whatever reason. I've disabled battery optimization for 3 ant+ related services and for QZ - didn't help. The behavior seems to be exactly the same as before the fix on this phone. Not sure how to approach this issue tbh.
yes described case for samsung galaxy a5 is my case. speed is oscilated between value and 0. could you change refresh from 1hz to bigger value as is in domyos should fix it
@jwatral can't be a channel collision on the A5? I saw that you removed the channel collision handling in your PR https://github.com/cagnulein/qdomyos-zwift/pull/1110/files#diff-4c927bf91e86767382b4457c671514064c14963a9a6126ee9bae8ad6bd460d7f maybe adding a debug line there you should be able to check if it's the case?
@cagnulein - don't think so:
From my pov, it's hardware / core qz related. The sensor should broadcast number of wheel and pedal spins ~ 4 times a second, and for whatever reason it fails doing so every second for at least 2 messages. @cagnulein when QZ connects to a bike, does it keep discovering bt devices? And what's the frequency of BLE ftms broadcasting? Can the BLE be turned off for testing?
@cagnulein when QZ connects to a bike, does it keep discovering bt devices?
nope, it shuts it down.
And what's the frequency of BLE ftms broadcasting?
1hz
Can the BLE be turned off for testing?
mmm you can disable the ble permission
mmm you can disable the ble permission
not sure if that's possible on Android 8. Where can I change this value? I will try to set smth like 0,1Hz and check if the issue starts occurring every 10 seconds.
@jwatral in the app settings on android settings
or you can simply disable the location services, in this way qz can't use the discovery mode
Hi all, I took my activity Samsung A3 same as A5 2017 still same problem with latest version. You can check in my garmin activity
Have you tried the suggestions from @cagnulein? To disable BLE broadcasting and check if it helps?
how can i disable ble broadcasting?
@wajo666 first test: disable virtual bluetooth device setting in the experimental settings and restart qz
let me know
I disabled virtual bluetooth device and problem is still existing
I tried on second device tablet Lenovo - YT-X705L android 10 cadence ok power ok but speed is not recognize on garmin
https://drive.google.com/drive/folders/1-3vWb5WzYLlYj1FanP4C9L2MrtVJnDoa
debug from lenovo
@jwatral why don't we change approach? I mean another way to solve this is using bluetooth. Most of the garmin devices can connect to a bluetooth sensor. Until now, qz can advertise itself to a garmin device, but here https://github.com/cagnulein/qdomyos-zwift/tree/garmin_power_sensor_over_bluetooth with another user on facebook we made some improvements, at least on ios.
It seemed that garmin needs some swapped bytes in the bluetooth configuration. I don't have a garmin on my own right now, but i guess it's doable on your end. What do you think?
@wajo666 Lenovo does not support ant+ afaik - you might be picking up the BLE sensors from QZ.
@cagnulein my watch does not support BLE sensors, only ant+. With QZ working correctly on Galaxy S7 I'm more than happy with current setup. We could try adding a BLE / ANT+ switch in QZ - like you can only have one of the enabled at the same time - it might help on the newer Samsung phones. Is that a big effort? I wasn't able to set any of your suggestions - there's no special permissions for BLE on Android 8. And disabling location makes the QZ to disconnect / not being able to connect to domyos bike.
are you surr my lenovo is not support ant? because ant tester said it works ![Uploading image.jpg…]()
@jwatral what do you mean about ble/ant switch? @wajo666 had already tried and the advertising it's not the issue. the issue is probably a connection to a fitness device itself.
maybe an experiment that you can do @jwatral on a phone that doesn't work with qz is
i guess ant will not work or work with the issues that we well know
what do you think?
@cagnulein Ok, so I've got a little bit confused, because I understood, that there is no way to disable QZ BLE sensor broadcasting.
So, just to confirm - disabling Virtual Device Bluetooth
in Experimental Features
fully stops broadcasting BLE FTMS sensors by QZ and makes it use Bluetooth only for communicating with fitness devices?
maybe an experiment that you can do...
That's a good idea for a test - will try that later this week.
@wajo666 no, I'm not sure - it's just, the lenovo devices are not listed here: https://www.thisisant.com/directory/ . But it might be the case, that they somehow didn't pay the license, but included the hardware anyway? Sorry for the confusion - just please make sure that's ant+ sensors you're connecting to, because it's not always that obvious.
@cagnulein Ok, so I've got a little bit confused, because I understood, that there is no way to disable QZ BLE sensor broadcasting. So, just to confirm - disabling
Virtual Device Bluetooth
inExperimental Features
fully stops broadcasting BLE FTMS sensors by QZ and makes it use Bluetooth only for communicating with fitness devices?
exaclty :)
Describe the bug
The ant+ speed sensor from QZ has some weird stability issues - it either disconnects or broadcasts 0.0 values periodically.
To Reproduce
Steps to reproduce the behavior:
Ant+ Cadence
option inAnt+ Options
inSettings
Bide indoor
activity on Garmin Watch (in my case Forerunner 255)100
in sensor options on the watchExpected behavior
Speed value reading is correct and stable
Actual behavior
Galaxy S7 - speed sensor disconnects every ~20 seconds, leaving ~3-4 second gaps in speed value reading (see screenshot from garmin connect) Galaxy A5 - each second, the speed value oscillates between showing correct value, and 0.0
Smartphone (please complete the following information):
Append a debug log
//TODO
Additional context
The problem was uncovered after fixing speed value reading in #167 and shortly described in #953
Analyses so far
Notes:
Qt Creator
Question - maybe that's an issue with the watch? Outcome - No, I've tried to read the speed value using yet another samsung phone with installed ANT+ Plugin Sampler app. Same issue can be observed, with some additional details. During the "disconnection" the estimated timestamp stops to increment for a few seconds and the receiver changes status to
SEARCHING
Question - is the behavior the same while QZ is used on different Android devices? Outcome - no:
Question - do you observe the same behavior in the dummy app? Outcome - no, no matter what I do, the dummy app behaves correctly and speed sensor is stable.
Question - so maybe it's something with passing the speed value from Qt/c++ to Android/java? Outcome - no, I've tired to disable the
antObject
management completely fromKeepAwakeHelper
andbluetooth.cpp
and add dummy increments of timestamp and revolutions inSpeedChannelController
- it didn't help.Question - is there something interesting in the logs? Outcome - no, nothing obvious so far (both in core and android logs)
Question - why is the power sensor, ok and speed not? Outcome - I don't know yet. I've ruled out the calculation difference (dummy revolutions and time increments didn't help). The other thing that's different is different broadcast frequency 4.04Hz vs 4Hz and number of channel pages
Question - Have you tried to completely disable power and heart sensor channel controllers and only leave SpeedChannelController running? Outcome - Yes, it didn't change anything
Question - Have managed to obtain stable speed readings from QZ app in any setup? Outcome - Yes, if I start the channels from MyActivity and set some dummy speed values the speed readings are fine BUT, as soon as the QZ connects to the stationary bike, the problem starts occurring (still with dummy value set in
onCreate
in MyActivity.Question - Have you tried to enable
fake device
and check if that helps with the issue? Outcome - Yes, it helps - the speed reading is rock stable using withfake device
enabled andSpeed
variable set to a constant22
infakebike.cpp
. What's more - thevirtual device
option does not have any influence on that issue.Question - Have you tried to profile android app using Android Studio profiler? Outcome - Yes, there wasn't nothing obviously wrong with threads / cpu and memory usage. Looks like, we need a deeper look, including dmesg
What else we can try
That's a good question actually. I'm a bit lost at the moment. I'll have another look at speed sensor channel paging docs and try to spot a potential timing issue. I'll document all further developments in this ticket. @cagnulein - any other ideas, what we can try?