-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
T1932 Brake type = Magnetic or Motor #20
Comments
Looks like a problem with junk data or some kind of out-of-sync of commands and answers ... For my brake FortiusAnt sometimes prints nothing and sometimes wrong values like
TTY1941 says:
100ms should be safe to not overrun the serial communication. But it is difficult to sync commands and answers of the brake until you wait for an expected answer after doing some dummy reads to remove old data or junk communication pipe of the headunit-to-host communication. Short test ... after repeating the version request in usbTrainer.py Line 2486 like this
I got
Result: After sending 5 request, I only got 4 answer: 1 wrong and 3 valid. |
To conclude the whole thing: There are a lot of buffers on the way
If you send a command from the host to the head unit you cannot ensure, that the next USB read is the direct answer on your request. If you startup the brake it even sends some junk. Better you do some dummy reads on the USB before sending the first command. And maybe you should even send the version request more than one time, until you got a valid and expected version answer from the brake. The "random" version messages I got in my test above are very probably old answers on a control command from the last run. |
Thanks for quick reply, I will add a sort-of initialization loop. Now you mention it -we also found this- the MotorBrakeUnitSerial (see https://github.com/totalreverse/ttyT1941/wiki#t1941-motor-brake-version-message) is not always tt-YY-##### the actual serial number can also be ####; something for the wiki if you like. I was put on the wrong leg because the MotorBrakeUnitSerial is received as int, but it better be processed as str(MotorBrakeUnitSerial). |
In the meantime I heard from @BikeBeppe64 that a magnetic brake returns MotorBrakeUnitSerial = 0. |
Will do |
Ok. In this case the head unit must emulate a serial number, because the old magnetic breaks are just too dump to report a serial. |
Thanks |
Pffff... this appears to be a misunderstanding
What would you think that T1932 returns for a magnetic brake?
|
Just went downstairs and connected my old eddy current brake to a T1932 head unit.
The important parts are bytes 24..27 (the standard version command answer header) and bytes 28..31, which converts to 0x00001902 if you read them as little endian encoded uint32. I think ,it is a good idea to check these 8 bytes. Edit:
|
@totalreverse you're a great help; thank you very much. |
Summer and better times will come. Would be a long ride for a beer, though; at least 330km. |
That's a deal🍺🍻 |
Which is quite funny, since that suggests the T1932 headunit operates in a sort of T1902 head unit mode, although the interface is different. Good reason to display the firmware in hex-format. |
The code now is
So it's always a motor-brake, unless a message is received with MotorBrakeUnitSerial OR -t MagneticBrake |
I do not only retry on the length but also the expected header. Thanks, some other steps forward
|
I would appreciate your view on the decision whether a T1932 is connected to a magnetic or motorbrake.
Current options:
BUT: there appear to be more types (e.g. 49)
AND: not always a correct message is returned, even after retry
causing FortiusAnt to behave like a magnetic brake, where a motor brake is connected
Issue: WouterJD/FortiusANT#200
Code:
https://github.com/WouterJD/FortiusANT/blob/5.1%2B4.2-Quality-upgrade/pythoncode/usbTrainer.py#L2516
https://github.com/WouterJD/FortiusANT/blob/5.1%2B4.2-Quality-upgrade/pythoncode/usbTrainer.py#L2141
Would 0.1 seconds wait-time be too short?
According to good old code comment, 100ms should be safe ??
'# TRAINER- SHOULD WRITE THEN READ 70MS LATER REALLY
The text was updated successfully, but these errors were encountered: