WouterJD / FortiusANT

FortiusANT enables a pre-smart Tacx trainer (usb- or ANT-connected) to communicate with TrainerRoad, Rouvy or Zwift through ANT or Bluetooth LE.
GNU General Public License v3.0
143 stars 77 forks source link

Tacx Training Desktop App (Win) crashes FortiusANT #429

Closed szczurem closed 1 year ago

szczurem commented 1 year ago

I occasionally use FortiusANT with TTDA on windows (current version, Ant+) and now 80% of the time it crashes Fortius with the following. The TTDA then "detects" Tacx Neo2T, but shows no wattage. Same config no problems with Rouvy.

Exception in thread Thread-1: Traceback (most recent call last): File "threading.py", line 932, in _bootstrap_inner File "threading.py", line 870, in run File "FortiusAnt.py", line 486, in Tacx2DongleThread File "FortiusAnt.py", line 167, in Tacx2Dongle File "FortiusAntBody.py", line 676, in Tacx2Dongle File "FortiusAntBody.py", line 1098, in Tacx2DongleSub File "usbTrainer.py", line 689, in Refresh File "usbTrainer.py", line 2553, in SendToTrainer AssertionError

The weird thing is that things work great for a spell of time (I was able to start it day after day last month), and then stops. The last time I got the error with ver 6.7, I managed to start FortiusANT 6.4 without problems. Today both fail to work (the lines reported are different, but the error is the same). The current version of Tacx software is 4.41.0.0, it says it was upgraded on 29 March (but I was using it on the 1 April with FortiusANT 6.4).

WouterJD commented 1 year ago

I'll have a look tonight

WouterJD commented 1 year ago

Hi Line 2553 = "assert(self.UserAndBikeWeight >= 0x0a) # Avoid surprises"

Could it be that you have defined a UserAndBikeWeith of less than 10 kilo's?

I have updated usbTrainer.py; so the python version should recover from a weard setting. Or do you need windows.exe?

WouterJD commented 1 year ago

Please refer to https://github.com/WouterJD/FortiusANT/blob/master/pythoncode/usbTrainer.py#L559

And let me know whether the message "UserAndBikeWeight is set to %d, which is below the expected minimum of 70kg; corrected to 85kg." appears and what value is reported.

szczurem commented 1 year ago

Success! Indeed, I do now get: "UserAndBikeWeight is set to 0, which is below the expected minimum of 70kg; corrected to 85kg" The message was repeated three times within 0.5 second and then it stopped.

I take it user and bike weight are taken from the trainer software? That in turn is taken dynamically from Garmin Connect in Tacx case. So perhaps there is a short period when Tacx downloads the weight parameters and was reporting zero and that was killing USBtrainer.py? I tried to start FortiusANT after Tacx and that did not help though.

WouterJD commented 1 year ago

Hi @szczurem I have modified the handling of the strange record; instead of setting an arbitrary value, the command is ignored. The advantage is that, if a correct value was set and the erroneous record is received, it does not reset the previous value. Could you be so kind to test this, so I know the solution works.

Also, the function SetUserConfiguration() is not traced when debug=f is specified.

szczurem commented 1 year ago

I run the code and it works - the error popped out numerous times for about 30secs, then stopped, allowing trainer detection by Tacx software. From then on it seems to work well.

I am afraid I am not experienced enough in debugging python code to trace what value of the userweight is eventually set.

WouterJD commented 1 year ago

I can add that if you like

szczurem commented 1 year ago

Many thanks, but I guess need to learn to do such stuff on my own. So far my coding learning curve is very erratic- I did a fork of your code to play with live led wall panels changing colours with power generated and it kind of works, but I still have not learned how to make sure I have the latest versions from the repository.

WouterJD commented 1 year ago

need to learn to do such stuff on my ow

Good idea, start in usbTrainer to add the mesage and you'll learn quick enough.

Github has many options and is well documented, so lots to explore there as well.

I suppose this issuecan ve closed now; if you have other questions don't hesitate to raise a new issue