PDA

View Full Version : Something not working with SIOC and FSUIPC



Jake 747 400
03-14-2015, 09:05 PM
Hey all, not posted on her for a long while but got back into building my 744 sim again, got my opencockpits boards out.

I never really knew anything about SIOC or FSUIPC of the boards either but I have a simple push button rigged up to the master card and that in turn is plugged into the USB expansion card.

When I press the push button it shows up as input 1 on the control loader software so I know that button is working correctly.

I am using PMDG's 747-400X and have a mouse macro set for the Clock button

I have his script for the button to work in FSUIPC:

Var 1, name S_CLOCK, Link IOCARD_SW, Device 0, Input 1, Type I //Chronograph
{
if &S_CLOCK = 1
{
&FO_JoyStick64 = CHANGEBIT 0 v1 // toggle bit 0 of joystick 64
}
}


Var 2 name FO_JoyStick64 Link FSUIPC_OUT Offset $3340 Length 4

The above is something I found on here for a battery switch on a thread about calling up macros with SIOC and FSUIPC but I used it as a template for the clock.

Heres my problem, I cannot get the button to be registered in FSUIPC when I press it, now I actually had the "if&S_CLOCK = 1" set to =0 previously and realised that is probably why it wont work so I changed it to 1, and then it worked first time and I set the macro to button 64 bit 0 but when I went back in to FSX and pressed the physical button nothing happened so I went back in to FSUIPC and pressed it again and this time it didn't register the button again and it wont do any more either but now and again it works but if you go back to FSX or reset and try again it wont register.

But the button works every time when I check it on the SIOC control loader software

Im confused, have I wrote the script wrong? That doesn't explain why FSUIPC see's it then not for a long period of attempts, or is SIOC not communicating with FSUIPC correctly I just dont know.
By the way I have no knowledge on FSUIPC or SIOC I have literally just started so forgive my basic explanation

Any help would be greatly appreciated
Thanks
Jake

Danilo
03-15-2015, 04:08 AM
What kind of a switch do you have, toggle switch or pushbutton?
If you have a pushbutton and you also want to emulate a pushbutton with a virtual joystick you have to change the value of bit back to zero, when the pushbutton is released. In that case the value of bit 0 of virtual joystick should be the same as value of variable S_CLOCK:

Var 1, name S_CLOCK, Link IOCARD_SW, Device 0, Input 1, Type I //Chronograph
{
&FO_JoyStick64 = CHANGEBIT 0 &S_CLOCK
}

Var 2 name FO_JoyStick64 Link FSUIPC_OUT Offset $3340 Length 4

In your code the value of bit 0 stays on value 1 after a first push. It never goes back to zero due to if condition.

Regards,
Danilo

Jake 747 400
03-15-2015, 05:19 AM
What kind of a switch do you have, toggle switch or pushbutton?
If you have a pushbutton and you also want to emulate a pushbutton with a virtual joystick you have to change the value of bit back to zero, when the pushbutton is released. In that case the value of bit 0 of virtual joystick should be the same as value of variable S_CLOCK:

Var 1, name S_CLOCK, Link IOCARD_SW, Device 0, Input 1, Type I //Chronograph
{
&FO_JoyStick64 = CHANGEBIT 0 &S_CLOCK
}

Var 2 name FO_JoyStick64 Link FSUIPC_OUT Offset $3340 Length 4

In your code the value of bit 0 stays on value 1 after a first push. It never goes back to zero due to if condition.

Regards,
Danilo


Thanks for the reply Danilo

Yeah its a push button that I have, so I need to change the if condition to make the bit value go back to 0 after I release the button, does this need another IF code to make that happen?



Thanks
Jake

Jake 747 400
03-15-2015, 05:39 AM
When in FSUIPC the button will only be registered once if you hit cancel and re open fsuipc and try to register it again it wont unless you re-load the script file in SIOC but that doesnt always work either.

Jake 747 400
03-15-2015, 07:09 AM
Managed to get it working, I changed the function of the IF code like you said, thank you for your help :)

Var 0001, name S_CLOCK, Link IOCARD_SW, Input 1, Type I // Chronograph
{
IF &S_CLOCK = 1
{
&FO_JoyStick64 = TOGGLE &FO_JoyStick64 // toggle bit 0 of joystick 64
}
}


Var 0002, name FO_JoyStick64, Link FSUIPC_OUT, Offset $3340, Length 4, Value 0


This is working now returning the value to 0 once the button is released

Thanks again
Jake

Danilo
03-15-2015, 03:37 PM
Yeah its a push button that I have, so I need to change the if condition to make the bit value go back to 0 after I release the button, does this need another IF code to make that happen?

You don't need any IF condition, the code that I proposed is enough for your purpose since the variable S_CLOCK is called every time when the pushbutton changes its state (push, release). At that event the variable of virtual button simply takes the value of S_CLOCK.


When in FSUIPC the button will only be registered once if you hit cancel and re open fsuipc and try to register it again it wont unless you re-load the script file in SIOC but that doesnt always work either.Sorry, but I don't quite understand the problem you have regarding assignment to the button in FSUIPC.

Danilo

Danilo
03-15-2015, 03:40 PM
Yeah its a push button that I have, so I need to change the if condition to make the bit value go back to 0 after I release the button, does this need another IF code to make that happen?

You don't need any IF condition, the code that I proposed is enough for your purpose since the variable S_CLOCK is called every time when the pushbutton changes its state (push, release). At that event the variable of virtual button simply takes the value of S_CLOCK.


When in FSUIPC the button will only be registered once if you hit cancel and re open fsuipc and try to register it again it wont unless you re-load the script file in SIOC but that doesnt always work either.Sorry, but I don't quite understand the problem you have regarding assignment to the button in FSUIPC.

Danilo