• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

Simconnect - "On button release" event

Messages
2
Country
italy
Hi everyone,

I just build a panel with two way switches (ON, OFF) for MSFS. Every switch remains "pressed" when is activated.
I created an app in c++ to catch the "ON" event, but, there is a way to catch when the switch is turned off?

Thank you.
 
Ciao Massimo,

Is this a question about switches in the simulator or your physical switches?
Which events are you trying to "catch," when a switch gets toggled in the simulator itself? I'm confused since you'd detect "off" the same way you'd detect the "on" events from sim.

Please clarify.

Best,
-Max
 
Ciao Massimo,

Is this a question about switches in the simulator or your physical switches?
Which events are you trying to "catch," when a switch gets toggled in the simulator itself? I'm confused since you'd detect "off" the same way you'd detect the "on" events from sim.

Please clarify.

Best,
-Max
I am talking about the phisycal switch.

I am using this lines of code (part of the app)

hr = SimConnect_MapClientEventToSimEvent(hSimConnect, EVENT_TOGGLE_BEACON_LIGHTS, "TOGGLE_BEACON_LIGHTS");

hr = SimConnect_AddClientEventToNotificationGroup(hSimConnect, GROUP_0, EVENT_TOGGLE_BEACON_LIGHTS);

hr = SimConnect_SetNotificationGroupPriority(hSimConnect, GROUP_0, SIMCONNECT_GROUP_PRIORITY_HIGHEST);

hr = SimConnect_MapInputEventToClientEvent(hSimConnect, INPUT_0, "joystick:1:button:17", EVENT_TOGGLE_BEACON_LIGHTS);

hr = SimConnect_SetInputGroupState(hSimConnect,INPUT_0, SIMCONNECT_STATE_ON);

When switch is turned ON EVENT_TOGGLE_BEACON_LIGHTS is fired.
 
I'm not sure how any input event (mouse, key, or joystick button) would have an "off" state. They're momentary controls. You can detect when the control is released (vs. pressed) but that's not going to help here, if I understand you right.

I'm guessing you have to keep track of the switch state yourself...? Toggled once, switch is on, toggled again, now it's off. That's typically how momentary switches are handled in hardware, anyway, when they need to act as toggles.

-Max
 
PS. The switch events also have distinct _ON and _OFF events (eg. BEACON_LIGHTS_ON/BEACON_LIGHTS_OFF). Perhaps you could map two different controls/events to those.
 
I use Spad.neXt to program my Saitek X56 HOTAS switches and rotaries to work with the sim. I can even set it up to send custom defined SimConnect events.
 
That's something I've sort-of skim-looked-at in the past but never given it much thought. Time to think again.
 
Back
Top