#How to use Or logic with input devices
1 messages · Page 1 of 1 (latest)
Set Code is this:
p0 1 min 0 max (>O:AUTOPILOT_FD_1_Mode_Position) 1 if{
1 (>K:TOGGLE_FLIGHT_DIRECTOR)
} 1 (>O:_ButtonAnimVar) (A:AUTOPILOT FLIGHT DIRECTOR ACTIVE:1, Bool) sp0 1 0 l0 ? (>O:AUTOPILOT_FD_1_Mode_Position)
if needed
how does it behave in the airplane?
See the 1 before the K: event call? That tells the event code which Flight Director button was pressed.
every time the k event is fired it toggles the switch
is there a way to add logic so it checks if the switch is toggled and if so then it wont do anything?
stupid question maybe, are you using latching switches for this?
like toggle switches?
any kind where the state is latched, either on or off, not like a push button that is on only when pushed.
because with push buttons, the toggle event turns on or off with every push.
ye i get what you mean
the way im doing it is that i have it as on pressed as the on state and the on reallse as the off state
this variable (A:AUTOPILOT FLIGHT DIRECTOR ACTIVE, bool) tells whether the Flight Director is on or off
yes
do you have two flight director switches left and right side?
yep
that is a problem
the variable only knows if the Flight director is on or off
not what is the state of the left or right switch
all I need it to do
is that if one of them are on all of flight director is on
and if both are on its on
and if both are off its off
you also said that both needed to be off for flight director to be off
yes
that is a problem
because we only have one variable
you will need to create one Lvar for the left switch and another for the right switch.
how would i do that
wait, let's discuss this a bit
with on and off events, we can make either switch turn the system on and the other switch will do nothing if turned on.
yea
why would you require both switches to turn off in order to turn the system off???
if the Capt wants to turn it off, he simply flicks his switch off.
regardless of the state of the FO switch
which is really how the pushbuttons work
hm
because you have latching switches, if the FO turned FD on, but the capt wants to turn it off, he will need to flick his switch to on and then to off.
in your design, both Capt and FO would need to turn their switch to off, in order to turn the FD off. which sounds kind of weird to me.
the issue with having it with what you ar suggesting is that you would end up with it being confused if lets say the capt's switch is on and the FO's is on and the FO switches it off and the captain doesnt then it would turn off when it shouldnt (if i am understanding correctly)
why wouldn-t it turn off if the FO has the command and wants to turn it off. Only one pilot flies at any given time.
another stupid question, why did you choose to install latching switches for this function???
true
because its how it is on the actual plane
what? the 787 has latching switches?
hang on, I need to see that... I never fly the 787
ok, but then most likely the sim logic knows how to handle this
give 5 minutes to load that aircraft
alright
lol
did you try flicking those switches on both sides. They both move at the same time.
yes i know
so technically they act like push buttons
I said it wrong
to make it so if one is on then the other switch does nothing?
they don't act like push buttons... rather they act like one switch, not like two.
yea
wait, do you actually know how they behave in the real aircraft_
the sim doesn't have that limitation
?
I am sure the switches can be independent in the sim. There is no obligation for them to be moving in sync
unless the airplane does it like that
ive seen it happen before but there is no variable to do that
There are 2 output variables
(A:AUTOPILOT FLIGHT DIRECTOR ACTIVE:1, Bool)
(A:AUTOPILOT FLIGHT DIRECTOR ACTIVE:2, Bool)
but there is only 1 Kvar
there are 2 Ovars but those are inaccessible
I have just tested both FD events and both FD variables
they all work in sync
both K events with 1 or 2 indices will both change both A: variables at the same time
they work as if there is only one switch and one variable
if one changes the other changes in sync
hm
so do you think you can make it so if one switch is on the other is basicly disabled
I can do what you requested initially, I never said it was impossible, just weird
or what you request now, also weird IMHO.
that would be great
lol
LEFT ON EVENT, may not be perfect on the first round.
(A:AUTOPILOT FLIGHT DIRECTOR ACTIVE:1, Bool) !
if{ 1 (>K:TOGGLE_FLIGHT_DIRECTOR) }
1 (>L:FD1_IS_ON,Bool)
LEFT OFF EVENT
(A:AUTOPILOT FLIGHT DIRECTOR ACTIVE:1, Bool) (L:FD2_IS_ON) ! and
if{ 1 (>K:TOGGLE_FLIGHT_DIRECTOR) }
0 (>L:FD1_IS_ON,Bool)
RIGHT ON EVENT,
(A:AUTOPILOT FLIGHT DIRECTOR ACTIVE:2, Bool) !
if{ 2 (>K:TOGGLE_FLIGHT_DIRECTOR) }
1 (>L:FD2_IS_ON,Bool)
RIGHT OFF EVENT,
(A:AUTOPILOT FLIGHT DIRECTOR ACTIVE:2, Bool) (L:FD1_IS_ON) ! and
if{ 2 (>K:TOGGLE_FLIGHT_DIRECTOR) }
0 (>L:FD2_IS_ON,Bool)
ok try those
either switch will turn on
if the system is on, the switch moved to on does nothing
if you turn one switch to off, the other switch must already be in off, for the system to turn off.
alr thank you so much lemme quicly test this and ill tell you how it works
hm rthe right switch seems to be turning FD off when the left switch is still on
the left switch doesnt do this
double check the code
maybe restart Mobiflight too.
you can create output configs for all the variables so you can monitor their values.
and also, both switches must be off when you start the sim because the default value of any Lvar is 0 or off.
or you have auto retrigger enabled.
how do i check if i have that
let me try this
alright
@mild basin I’ve tried both and neither have worked
what is the behavior?
I tried the events with two toggle switches in my panel and they work as expected.
you are putting the ON to On Press and OFF to On Release, correct?
Show screenshots of your four input configs please
sorry for the late response but here
the pilot side on press and on release is reverse because i made a mistake with soldering the toggle switch and did it the wrong way lol
i have to sleep now so if i dont respond for a while thats why sorry in advance if there is any update send it here and ill check it in the morning
the pilot side events seem to be inverted
are your toggles wired inverted i.e. up is off and down is on????
The pilots side one is inverted
The FO side inst
Can't you turn the switch around so that up is on? I am thinking this makes a difference in how the auto retrigger is handled.
i dont think its possible for me to moce the swith
wait now its working perfectly
thank you so much for your help with this
i was stuck on it for days lmao
What changed?
Idk I just repasted the code for all of them then it worked