Sign in to follow this  
bcs112

Disbale joystick axis with SimConnect -> doesn't work ?

Recommended Posts

Hi all,I've spent most of the past 2 days looking for a way to disable the joystick axis via SimConnect but it doesn't seem to want to work !Here's the code for the X axis:if (SUCCEEDED(SimConnect_Open(&hSimConnect, "A300 Event", NULL, 0, 0, 0))){SimConnectOpen = true;//I use this event to change the state of the axis hr = SimConnect_SubscribeToSystemEvent(hSimConnect, EVENT_1HZ, "1sec");hr = SimConnect_MapClientEventToSimEvent(hSimConnect, EVENT_XAXIS); hr = SimConnect_AddClientEventToNotificationGroup(hSimConnect, GROUP_JOYSTICK, EVENT_XAXIS);hr = SimConnect_SetNotificationGroupPriority(hSimConnect, GROUP_JOYSTICK, SIMCONNECT_GROUP_PRIORITY_HIGHEST_MASKABLE);hr = SimConnect_MapInputEventToClientEvent(hSimConnect, INPUT_XAXIS, "joystick:0:XAxis", EVENT_XAXIS, 0, (SIMCONNECT_CLIENT_EVENT_ID)SIMCONNECT_UNUSED, 0, true);hr = SimConnect_SetInputGroupPriority(hSimConnect, INPUT_XAXIS, SIMCONNECT_GROUP_PRIORITY_HIGHEST_MASKABLE); SimConnect_CallDispatch(hSimConnect, MyDispatchProcMI, NULL);}Then I catch the event:case SIMCONNECT_RECV_ID_EVENT:{ SIMCONNECT_RECV_EVENT *evt = (SIMCONNECT_RECV_EVENT*)pData; switch(evt->uEventID) {case EVENT_1HZ://Roll and pitchif ( green_accu_exp < 1450 && blue_accu_exp < 1450 && yellow_accu_exp < 1450 && XAXIS_ON ) { hr = SimConnect_SetInputGroupState(hSimConnect,INPUT_XAXIS, SIMCONNECT_STATE_OFF); XAXIS_ON = 0;}else { if ( XAXIS_ON == 0 && (green_accu_exp > 1450 || blue_accu_exp > 1450 || yellow_accu_exp > 1450)){ hr = SimConnect_SetInputGroupState(hSimConnect,INPUT_XAXIS, SIMCONNECT_STATE_ON); hr = SimConnect_SetInputGroupState(hSimConnect,INPUT_YAXIS, SIMCONNECT_STATE_ON); XAXIS_ON = 1; }}break;}All the hr's return S_OK so things seem to work as they should, but you guessed it... the joystick axis are not disabled !Did I miss anything ? I use the Saitek X52, would this need to be accessed as joystick:1 maybe ?Bj

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this