DerJantob / TSW2_Controller

Control TSW2 with a joystick or other controllers
26 stars 4 forks source link

BR 403 - Brake lever - Bypass #55

Closed danbaz101 closed 1 year ago

danbaz101 commented 1 year ago

Hi Jannik,

The Brake in BR403 as in other trains has 9 notches and a spring loaded bypass. I would like to use the Controller as a button option to trigger the bypass as follows: <-95 --> hold oem1 key for 1 second. This works if the joystick is not used to also control the brakes, but the combination I did not get to work.

The brake lever goes from -100 to 100. This is how I would like to assign: Controller: -100 to -90 no assignment Controller: -90 to 100 used for the 9 notches Controller as a Button: <95 hold oem1 key for 1 second

When I set -90 = 0 and 100 = 100, then between -100 and -90 the program sees this as 100 and goes to full brake application. Ideally it would see this as undefined and does nothing so the Controller as a Button can work. I hope I explained it well enough..

Kind regards,

Daniel

DerJantob commented 1 year ago

I think I understand what you mean. You should be able to fix the problem if you press the "edit" button and adjust the value as I did. grafik

Here is why: If you say that -90=100, the program assumes that -90 is the maximum of your joystick. All values below -90 are continued linearly (see red line). But if you then say that -100 also equals 100, then the program knows that all values between point A and B must still be 100.

X-axis=Joystick value Y-axis=Converted value grafik grafik

I hope that was understandable and fixes your problem.

Regards Jannik

danbaz101 commented 1 year ago

Thanks for explanation!

I needed it inverted so did it like this. However, when pushing lever below -95 still no button kicked in. Earlier when my lever between -100 and 0 was not detected it worked, hence I guess that if we can make -100 to -90 as undefined, then it would work, or perhaps this is a hierarchy thing where detected lever range overrules controller as button?

image

DerJantob commented 1 year ago

Woops, don't know how this bug has been undiscovered since probably v2.0.0. ^^ Please try out this version: TSW2_Controller_PreRelease_2.zip

danbaz101 commented 1 year ago

Haha. I appreciate all your help today! It works great now. :)

DerJantob commented 1 year ago

Great to hear! I will try to do some more improvements and will release it as an update. Thank you for helping!