cagnulein / qdomyos-zwift

Zwift bridge for smart treadmills and bike/cyclette
https://www.qzfitness.com/
GNU General Public License v3.0
434 stars 117 forks source link

Logs from T900C #13

Closed Martoni74 closed 4 years ago

Martoni74 commented 4 years ago

Hello,

thanks for the great work. I tested, by curiosity, with my Domyos T900C + RPi3 type B. It fail during the BLE discovery. (I switch on T900C, launch the latest release) Probably incompatible as it's older generation.

Here are the logs if it can helps : (didn't find anything else in /var/logs) I'm no more really familiar with C++ but happy to test if required.

sudo ./qdomyos-zwift Found new device: "Domyos-TC-1441" ( "00:00:0C:1B:15:01" ) qt.bluetooth: Using BlueZ LE DBus API Controller connected. Search services... serviceDiscovered "{00001801-0000-1000-8000-00805f9b34fb}" serviceDiscovered "{0000180a-0000-1000-8000-00805f9b34fb}" serviceDiscovered "{49535343-fe7d-4ae5-8fa9-9fafd205e455}" serviceScanDone stateChanged QLowEnergyService::ServiceState(DiscoveringServices) stateChanged QLowEnergyService::ServiceState(ServiceDiscovered) creating virtual treadmill interface... qt.bluetooth: Using BlueZ kernel ATT interface stateChanged QLowEnergyService::ServiceState(InvalidService)

cagnulein commented 4 years ago

@rickoneeleven ok when you will have a big uptime, please post it here https://github.com/cagnulein/qdomyos-zwift/issues/44 😆

rickoneeleven commented 4 years ago

it lasted a good while, got a seg fault after about 45 minutes, i left zwift on the "connected devices" screen, and the treadmill running at 2k don't know if the log will be helpful. anyway i've got to go to work, cheers

debug-Tue Nov 3 07_55_38 2020.log

cagnulein commented 4 years ago

@rickoneeleven understood the issue, it was releated to the different behaviour of the T900C. I will fix it ASAP

cagnulein commented 4 years ago

@rickoneeleven i guess i fixed it, try https://github.com/cagnulein/qdomyos-zwift/commit/fbe457173452dc0805082b9a49098a9a67315019

rickoneeleven commented 4 years ago

Cool thanks, I'll check it out tonight and remember to "make" this time too and test! (got a few errands to run after work, so it will be in 8 or so hours from now)

cagnulein commented 4 years ago

@rickoneeleven no problem :) have a nice day, we will catch up tonight

rickoneeleven commented 4 years ago

@cagnulein mines been running 51 minutes, so broke the 45 minute mark from last time! using fbe4571 - i also started a workout on zwift and just left the avatar going around the track at 3-4kph, so don't know if that has made a difference (doubt it), probably your most recent patch. ill check it again over the next hour or so and let you know, and if it's all good I may even have a run in a couple of hours

😄

rickoneeleven commented 4 years ago

ohhhh no it just seg faulted again debug-Tue Nov 3 17_58_31 2020.log

cagnulein commented 4 years ago

@rickoneeleven understood i have to do another little modification. We are almost there 👍

rickoneeleven commented 4 years ago

if it gives a clue, it seems i have to reboot the pi to get it to connect again to treadmil, even after turning bluetooth off/on' on the pi, and rebooting the treadmill, it won't connect it seems until i've done a full reboot of the pi

cagnulein commented 4 years ago

@rickoneeleven try now, i just pulled a new commit for the segfault issue

cagnulein commented 4 years ago

if it gives a clue, it seems i have to reboot the pi to get it to connect again to treadmil, even after turning bluetooth off/on' on the pi, and rebooting the treadmill, it won't connect it seems until i've done a full reboot of the pi

did you try to restart the bridge?

rickoneeleven commented 4 years ago

what the rasberry pi? i restarted the ras pi and it fixed it, starting the "script" again as no-gui didn't seem to make any difference, tried a few times, couldn't get it to connect without rebooting the pi.

do i just pull the latest commit and "make" and retest?

cagnulein commented 4 years ago

what the rasberry pi? i restarted the ras pi and it fixed it, starting the "script" again as no-gui didn't seem to make any difference, tried a few times, couldn't get it to connect without rebooting the pi.

i don't know, one problem at a time 👍

do i just pull the latest commit and "make" and retest?

yes please

rickoneeleven commented 4 years ago

running the latest build now, let's try and get an hour!

https://photos.app.goo.gl/jxb6gFGnkd6a8NQq6

rickoneeleven commented 4 years ago

@cagnulein this one seg faulted much quicker debug-Tue Nov 3 19_32_28 2020.log

rickoneeleven commented 4 years ago

i've rebooted, and tried the same build, but this time removed my raspi logitech wireless keyboard and plugged in usb keyboard and mouse incase they are causing any issues?

cagnulein commented 4 years ago

i've rebooted, and tried the same build, but this time removed my raspi logitech wireless keyboard and plugged in usb keyboard and mouse incase they are causing any issues?

Is it still running? The log seems to describe a different scenario. Wireless gadget could case interferences, but I don't think they are related. I will check the log tomorrow morning

rickoneeleven commented 4 years ago

yeah still running at the moment, about 30 minutes. i'll see if I can make at least an hour and post the logs when testing is over.

cagnulein commented 4 years ago

yeah still running at the moment, about 30 minutes. i'll see if I can make at least an hour and post the logs when testing is over.

Great, thank you

rickoneeleven commented 4 years ago

okay, so new PR 😄 no crash, and over an hours worth of data. was it related to unplugging the logitech wireless keyboard? i don't think so either, maybe we just had a lucky run - do "successful" log files provide any value?

debug-Tue Nov 3 19_47_05 2020.log

i'll give it another hour or so tomorrow morning, don't really want to run on it until i'm pretty happy, as if it cuts out whilst im running..... 😆

rickoneeleven commented 4 years ago

another thing worth noting, in addition to it running over an hour with no crash, when I CTRL-C'd the program, let the bluetooth connection to the treadmil time out, and then started the program again - it connected to the treadmil right away. so seems I only need to reboot the rasberry pi after the seg fault... hmm interesting maybe?

cagnulein commented 4 years ago

@rickoneeleven try my last commit https://github.com/cagnulein/qdomyos-zwift/commit/0fa8873e19102a7797dac4cd98631f33c2509237 i'm really confident this time ;)

rickoneeleven commented 4 years ago

Okay bro, the mill is rolling, can probably leave it going two hours before work this morning so fingers cross we hit that mark

rickoneeleven commented 4 years ago

okay a bit different this morning, treadmill has stopped, bluetooth light is off on treadmill, BUT the program has not crashed and it still appears connected to zwift

debug-Wed Nov 4 06_32_06 2020.log

AND, if i CTRL-C the program and restart it, it DOES connect back to treadmill and allows me control speed if zwift, so seems a step forward in my opinion

rickoneeleven commented 4 years ago

another thing worth noting, the log i've uploaded above seems to stop at 07:18, but the console was still scrolling when I went in the garage 2 minutes ago at about 07:55 (only then did I CTRL-C the program) and restart it

cagnulein commented 4 years ago

another thing worth noting, the log i've uploaded above seems to stop at 07:18, but the console was still scrolling when I went in the garage 2 minutes ago at about 07:55 (only then did I CTRL-C the program) and restart it

probably because when you press CTRL+C the buffer on the file has been truncated. I will have a look in the log file.

rickoneeleven commented 4 years ago

sorry I mean I CTRL-C'd - then uploaded log file, but even though I CTRL-C'd at 07:55, the log file only ran to 07:18 if that makes sense. anyway, i'll leave it with you for review, thank you.

cagnulein commented 4 years ago

okay a bit different this morning, treadmill has stopped, bluetooth light is off on treadmill, BUT the program has not crashed and it still appears connected to zwift

debug-Wed Nov 4 06_32_06 2020.log

AND, if i CTRL-C the program and restart it, it DOES connect back to treadmill and allows me control speed if zwift, so seems a step forward in my opinion

you're right is absolutely a step forward, means that the issue that you discovered yesterday was completely fixed. Now, this morning behaviour is very strange. Is it possible that you had a mini-power surge? As you said, the log is useless because is truncated. :( we need another run tonight to understand it better :)

Thank you again for your time!

rickoneeleven commented 4 years ago

i doubt the power surge, but couldn't rule it out to be fair. i'll give it another run tonight when back from work 🥂

rickoneeleven commented 4 years ago

actually i kicked it off again after the failure this morning, and it's stopped again, so fresh log file with same behaviour, my qwift avatar was still walking (so still connected?), treadmill had stopped and bluetooth light off. I CTRL-C'd the program as it was still running and THEN uploaded log file:

debug-Wed Nov 4 07_52_42 2020.log

similar thing, even though the console was running at 08:21, the logs stops at 08:07 - seems when the treadmill "disconnects" the logging stops... hmmm

cagnulein commented 4 years ago

@rickoneeleven very strange, i will look into it. Could you please send me a copy&paste of the scrollback of the terminal where you run the bridge? i guess there we will find more info

rickoneeleven commented 4 years ago

ahhhhhh **** i've just shut it down, will have to be tonight, cheers.

cagnulein commented 4 years ago

no problem :) @rickoneeleven i've just pushed a new commit with the flush of the file every time that a line has written. Give it a try tonight.

rickoneeleven commented 4 years ago

okay i've just started test with latest build, for future reference, rather than me deleting the directory, cloning, and making again, can I just git pull and then make -j4?

rickoneeleven commented 4 years ago

okay the treadmill disconnected quite quick this time, it still didn't write the extra stuff scrolling in the console after the treadmill disconnected, so i copy and pasted it to bottom of log manually

debug-Wed Nov 4 17_17_38 2020.log

cagnulein commented 4 years ago

okay i've just started test with latest build, for future reference, rather than me deleting the directory, cloning, and making again, can I just git pull and then make -j4?

Yes, sure

cagnulein commented 4 years ago

okay the treadmill disconnected quite quick this time, it still didn't write the extra stuff scrolling in the console after the treadmill disconnected, so i copy and pasted it to bottom of log manually

debug-Wed Nov 4 17_17_38 2020.log

Ok I guess I understand the issue, the treadmill disconnects because the bridge doesn't poll it anymore. It's all about the problem that we saw yesterday. I will work on it and I will let you know

cagnulein commented 4 years ago

@rickoneeleven could you please try my last commit? i put some mechanism to avoid corrupted packets

rickoneeleven commented 4 years ago

we can but try my friend, so I ran "git pull", then "qmake" and "make -j4" which seemed to (compile?) a lot quicker, only seemed to update 3 or so files - hope that's right. I've now started the test which is currently running 👍

cagnulein commented 4 years ago

@rickoneeleven is it still running?

rickoneeleven commented 4 years ago

it had been running a while, i checked just after your comment and it had just seg faulted, so slighty different behaviour to last 24 hours where the app carries on running but the treddy disconnects - this time it actually seg faulted and it looks like the log got everything

debug-Wed Nov 4 20_20_52 2020.log

rickoneeleven commented 4 years ago

i seems as well that this line at the end "BTLE stateChanged InvalidService" kind of indicates it won't work neither until a reboot the pi, can't get it to reconnect. don't know if something absolutely craps out when you see that?

rickoneeleven commented 4 years ago

honestly though, I remember when I first got the treadmill, just under a year ago, I'm sure - although I can't quite remember - that kinomaps would drop bluetooth intermittently after a certain period, so maybe the 900c is just a bit..... crappy with bluetooth? the commit before last, at least when the treadmill stopped you could just relaunch it straight away and it would reconnect - (granted you may get a bit of a shock when it disconnects) - but with the previous commit it was easy to get going again

when it does this seg fault and "BTLE stateChanged InvalidService" it's a bit of a pain to restart the pi..... hmmmm just thinking out loud

is there a way to, I don't know - programmatically store the current speed and incline, and then like restart the bluetooth connection every minute or so and feed the last speed and incline back in? constantly "refreshing" the bluetooth connection?

lol i don't know, just thinking our loud

cagnulein commented 4 years ago

@rickoneeleven no we have to fix it cleanly, is possible I guess. We have only to cover all the holes that domyos did.

For sure your treadmill or, in general the t900c, sends sometimes corrupted packets, but we can handle it and discard it.

So please, let's continue on this way, we will get it :)

I will look the logs and I will let you know

rickoneeleven commented 4 years ago

@cagnulein awesome, i'm at home for the next 5 days, so we can crush some additional testing and move things a little quicker if you're up for it 🥰

cagnulein commented 4 years ago

@rickoneeleven could you try my last commit? i added some more debug print and i tried to manage the communication error. I'm really curious about its behaviour.

rickoneeleven commented 4 years ago

okay it's running my friend 🤞

rickoneeleven commented 4 years ago

latest log

debug-Thu Nov 5 07_37_29 2020.log

rickoneeleven commented 4 years ago

and when i try and restart your program without reboot first debug-Thu Nov 5 08_52_29 2020.log