• 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.

Requesting Axis/Button/Key data

Messages
65
Country
us-massachusetts
Hi folks,

I'm writing a simconnect client and want to turn on and off certain joystick and keyboard inputs. Specifically, I'm masking the Joystick input and using it to control a tug instead of the aircraft, but of course, I only want to mask it while in "tug mode". It works great, but after maybe 5 cycles or so it stops working, and I'm unable to mask to get the joystick info. Is there a built-in limit to how many times you can request and unrequest or mask and unmask, or am I not using the right functions?

This is how I'm turning it on:

SimConnect_MapClientEventToSimEvent(hSimConnect, temp.id);
SimConnect_AddClientEventToNotificationGroup(hSimConnect, temp.id, temp.id, true);

SimConnect_MapInputEventToClientEvent(hSimConnect, temp.id, name, temp.id, 0, SIMCONNECT_UNUSED, SIMCONNECT_UNUSED, true);

SimConnect_SetInputGroupState(hSimConnect, temp.id, SIMCONNECT_STATE_ON);
SimConnect_SetInputGroupPriority(hSimConnect, temp.id, SIMCONNECT_GROUP_PRIORITY_HIGHEST_MASKABLE);

/////////////////////
where <temp.id> is a unique serial number and <name> is the axis string name.

Here's how I'm turning it off:

SimConnect_SetInputGroupState(hSimConnect, id, SIMCONNECT_STATE_OFF);
SimConnect_RemoveInputEvent(hSimConnect, id, name);

id == same serial number as used to turn it on


What am I missing? Or is it (hopefully not) that Simconnect just doesn't take kindly to my incessant masking/unmasking?


Any guidance will be very much appreciated,
Farley
 
If it were me, I wouldn't be calling SimConnect_RemoveInputEvent when I shut the thing off.
I would set it all up once and then just call SimConnect_SetInputGroupState to turn the masking on and off.
If you're not doing so, have a look at using the logging capability of SimConnect. You might see something in the log that will be of some help.
 
Hello Mr. Dawson,

Been busy, I apologize. But to update: I implemented your advice, made the IDs static members of the tug class and reused them, calling only SetInputGroupState() when destroying the class and again with the old IDs on subsequent instantiations. It works perfectly and solved my problem completely. Thank you very much sir!

Farley
 
Back
Top