PDA

View Full Version : FSUIPC Offset value only taken for a second



michael1508
12-27-2017, 04:15 PM
I am having a strange phenomenon with my self build gear lever.
It used to work, but since a couple of days - don't ask me, what has changed - the programmed offset is not working anymore.

I am using Arduino/Mobiflight, to read the value of a switch like this one:https://www.reichelt.de/Schnappschalter-Endschalter/MAR-1050-5202/3/index.html?ACTION=3&LA=3&ARTICLE=32729&GROUPID=7599&SID=94WkPucqwQATYAADhtV0Q7f058a4a58b01aa3040103c5b7fa26c9

One switch is triggered, when gear lever is down, another when the gear lever is moved up.
Now when I move the gear lever down for example, the switch is triggered (can see that in Mobilflight), but the value is only read for a second, than immediately jumps back to the previous value (see that in FSUIPC logging), although the switch is still in the push position.

I disabled the function to see, if another mechanism is causing this, but there is none. It's just that single switch being involved.

Any ideas, why the new value is not kept?

Fess_ter
12-29-2017, 02:52 AM
Michael,

Could be a bad or noisy switch.
If its not bad, then you may need some debounce code in your Arduino for the switch. Sometimes switches make multiple contacts sending multiple signals.
I would also check your wiring for shorts. Push on connectors can cause problems. Soldering the connections can prevent shorts.
Are your switches wired up to the Arduino using INPUT_PULLUP code to make the pin HIGH and then detect a LOW when pressed?
If you do it the other way with the pin LOW and then detect HIGH when pressed you can get issues if your pulldown resistor wiring gets a short and then the pin starts to float.

INPUT_PULLUP is my preferred way as it does not require a pulldown resistor.

~Fess

michael1508
12-29-2017, 06:24 PM
I found out, the button is working with the standard FSX planes. So the root cause lies within the plane software (Jeehell A320). Actually I installed a new release shortly. So will investigate there.

But thanks for the quick support!

Michael