#Can a switch have an action based on its state?

1 messages · Page 1 of 1 (latest)

trail needle
#

I have an on-off toggle switch set up to control the parking brake. Flipping the switch ON turns the parking brake on. Flipping the switch turns OFF turns the parking brake off.
This means that the parking brake is not set to the switch position until I flip it to generate the on and off events. I'd like to set the parking brake off as long as the switch is off, and turn it on as long as the switch is on, using the switches state instead of switching events.
Is this something I can do wiht MobiFlight?
Thanks for any help you can give

ionic brook
#

There is a retrigger function, but it is a general function that will attempt to sync the simulator to the state of all what all the switches in your MF panel.

#

on the other hand, if you are using an ON/OFF event (not a toggle event), then your switch should only enable the parking brakes if the parking brakes are disabled or else do nothing, which syncs at that moment your switch state with the simulator.

trail needle
#

I'm new to MobiFlight so maybe I'm missing something, but my parking brake is only updated when the switch changes. So if the switch is OFF, but the default parking brake position is ON, then when the sim starts, I have to turn the switch ON, then OFF to turn the brake OFF. The arduino knows the state of the switch all the time, so I'm wondering if the brake can be set based on the switch state, instead of being triggered by switch change events.

ionic brook
#

and there is an option in Mobiflight settings to do an auto-retrigger on startup.

#

so that the sim is instructed to sync to whatever your switches states in your panels are at the time of starting.

trail needle
#

Cool, that sounds like what I'm looking for, thanks

ionic brook
strange spear
#

with 9.7 the retrigger is performed automatically

#

just update to the latest beta if you need it NOW or wait for 9.7 which i will release today or tomorrow officially

zinc stirrup
#

I am having a problem with retrigger if I understand it operation correctly. If I have a hardware switch in my home cockpit set to off, when it auotruns it switches the in simulator to on. If I stop Mobiflight and hit run again it will flip it back to on. IT will do this for all my switches. Does it not check the actual state of the switch? I am running 9.7

last anvil
#

@zinc stirrup

  1. The Retrigger will be done for all your Inputs you use within your config.
    So not only for the one single Switch that is in this example in wrong position.... It is executed for all switches in a row.... No mater if they still correct or not in the Sim.

  2. MF know the Real switch Position and simply send the Command that is used for that Position. So for ON Position it send the PRESS for OFF Position it send the RELEASE.

  3. Your Problem.....

#

You pretty sure use by fault a "Toggle" Event for your switch.
So you tell the sim not to SET the Virtual switch into Position A or B .... You simply say "Toggle Switch in Sim" whatever for Press or Release.
This is not recommend.... Cause Retrigger can´t work and also your cockpit can get unsync while you fly with it by itself.

Solution: Use clean SET Commands or Code Logics that check the Virtual Switch and compare this data into the Input action.

#

Summary: I expect MF work 100% correctly.... The issue is in case of wrong events in your case.

zinc stirrup
ionic brook
# zinc stirrup Thanks <@421423606032236554> . I don't know how to use the SET command or Code L...

In order to help we need to know what you did. So, please post your input config for the switch with the issue, in particular which events are you using? which airplane is this for?
As @last anvil mentioned, you are most likely putting a toggle type event in both the on press and on release configs, those can easily be converted (if they are not already in the database) into on and off events.

last anvil
#

🙂
Jaime and me write same time

SET Events exist for lots of things additional to Toggle...
Cause some Builders prefer a Momentary switch (e.g. 1 press simply toggle the situation) and other builders work with a latching ON-OFF Switch who need a SET Event.

So first step.... Use our Preset Tool in MF.
For Lots of Elements you would find 3 Events.... E.g. : ParkingBrake Toggle .... ParkingBrake ON .... Parking Brake OFF.

What i mean with "logics".
Some Aircrafts have no "SET" Event.... they only have a Toggle.
Here we use Logic and read the Virtual Switch....
In code we say e.g. for ON Input ...... IF Virtual switch is currently OFF then send a Toggle.... ELSE (If its still in ON) do nothing.

Also those codes are mostly already available as a Preset in Mobiflight.
Here people like Jaime do this work for you and create those code within our PReset Lists.

zinc stirrup
#

I am making this for PMDG 737. I was using the presets for Engine Start Lever, Flight director, and Autothrottle for example. All of those are connected to Hardware toggle switches.

ionic brook
ionic brook
zinc stirrup
#

Here are some example of what I am using

ionic brook
#

ok, as we said, if you use toggle events in both on press and on release configs, you cannot expect auto-trigger to sync correctly the sim to your panel state. This is because you are executing the same command whether the state is on or off. You need to use ON and OFF commands, not toggle.

#

for FD, use the event I indicated above for the On Press and its companion for Off (On Release).

#

if you search for system: Autopilot and text: "A/T" you will find events for the autothrottle switch both on and off.... use those instead of the toggle.

#

Lastly, for the Fuel Lever, isn't it working correctly with those events????

zinc stirrup
#

@ionic brook thanks for your help! Yes, the Fuel lever doesn't work either

zinc stirrup
#

@ionic brook The on off presets work perfectly now, I don't now how I missed those presets. The start levers are still not working.

ionic brook
#

try this for Eng1 fuel cutoff lever down (and its companions named like that for Eng2 lever up and lever down)

zinc stirrup
#

Yes, those work. On (IDLE) is down and Off (Cutoff) is up. The other presets were under Engines, and these are under Fuel. It's always tricky to find the correct presets. Thank you so much for your help!!!!

empty yoke
#

I've come across this post in my search for help getting a parking brake toggle to work; I have a momentary switch with a corresponding LED that I want to toggle the parking brake. I believe there is something similar to: IF(0=0,100,0) I should be using but I'm not quite there yet and that statement returns an error message. I am attempting to do this primarily with the ZIBO 738 but I figure it should likely be fairly universal with aircraft that move a control and show the state with an annunciator...
IMPORTANT NOTE: I am NOT a programmer nor have had any training therein so if you have a suggestion for me please assume I know (almost) nothing...

ionic brook