Jump to content
The simFlight Network Forums

Recommended Posts

Posted

Hi,

 

I have been trying to have to different commands setup into the same pushbutton (non-latching) The idea is to have button 13 in Joy 3 execute the offset 78EB bit 2 when pushed once, then when I push the same button (13) i want it to execute offset 78EB bit 1. In other words, if I push the button once and release it it executes the first command, and if I push it again and release it it executes the second command, and then if pushed again it needs to execute the first command again, pretty much its a cycle between the commands.

The button on the .ini file is written as follows:

 

20=P3,13,Cx010078EB,x02 

 

Now  in order to have this button 13  do this, Cx010078EB,x01 I understand I need a sequence or a flag, but I do not know how to do it. I've looked in the FSUIPC documentation and online with no luck so far. Any help would be greatly appreciated.

 

Thanks,

 

Jose

Posted

I have been trying to have to different commands setup into the same pushbutton (non-latching) The idea is to have button 13 in Joy 3 execute the offset 78EB bit 2 when pushed once, then when I push the same button (13) i want it to execute offset 78EB bit 1. In other words, if I push the button once and release it it executes the first command, and if I push it again and release it it executes the second command, and then if pushed again it needs to execute the first command again, pretty much its a cycle between the commands.

The button on the .ini file is written as follows:

 

20=P3,13,Cx010078EB,x02 

 

If the value in that offset is always 1 or 2 (already), then all you needs is to use "toggle bits" with a parameter of 3 instead of "Set". You can do such an assignment direct in FSUIPC options, you don't need to edit the INI file.

 

If it isn't 1 or 2 initially, but 0, say, then, yes you'd best use a flag to get a goling action between two "sets". But check first.

 

Pete

  • 2 weeks later...
Posted

Pete,

Thanks for the help, I did create the command correctly for one action. So the pushbutton reads,

0=P3,13,Cx0D0078EB,x01

Now to make the same button cycle through bit 1 and 2 I created a flag and it reads,

1=CP(F+3,13)3,13,Cx0D0078EB,x02

But it's wrong, because it does not toggle through the bits of the same offset. Any help would be greatly appreciated.

Thanks again,

Jose

Posted

Pete,

Thanks for the help, I did create the command correctly for one action. So the pushbutton reads,

0=P3,13,Cx0D0078EB,x01

Now to make the same button cycle through bit 1 and 2 I created a flag and it reads,

1=CP(F+3,13)3,13,Cx0D0078EB,x02

But it's wrong, because it does not toggle through the bits of the same offset. Any help would be greatly appreciated.

 

You seem to have missed the whole point of using "toggle bits". By having a parameter of 3 then toggling will give you alternately 1 or 2 depending on thether you start with 2 or 1.

 

i.e. 1 toggled by 3 = 2,  2 toggled by 3 = 1.

 

Please re-read my previous reply. 

 

To do it with flags is unnecessary UNLESS you cannot ensure the offset starts with 1 or 2. If it does not, then you cannot use toggle bits in any case, but the set control instead, and a flag. But the flag must be tested when setting both conditions -- one for flag not set, one for flag set.

 

But first read my previous reply which you seem to have misreadcompletely.

 

Pete

Posted

Pete,

A parameter of 3 will toggle bit 3 on the same offset 78EB, making another function toggle, I guess what I need to do is the flags, I have read the manual and it still a bit hazy for me, you said I need a flag for when it is on and a flag for when it is off correct?

I guess I am completely misunderstanding the explanation you are giving me, if I put a parameter of 3 on FSUIPC, it does a different function. The offset list is as follows.

Offset

78EB

Length (Bytes) 1

Function

FCU/EFIS controls.Set value:

0 SPD Pull

1 SPD Push

3 HDG Pull

And so on.....

Jose

Posted

A parameter of 3 will toggle bit 3 on the same offset 78EB, making another function toggle

 

No no no! The parameter for "Togglebits" is a MASK, NOT a bit number. Why on Earth do you think it is a bit number? Where do you get that idea from?

 

A mask of 255 changes all 8 bits, not bit 255!

 

Every bit set in the mask will be toggled. The value 3 is bit 0 and bit 1. both those bits will be toggled!

 

There are also "SetButs" and "ClearBits" controls. The three of them, together, do the logical operations "NEQ (togglebits), NAND (clearbits) and OR (setbits). If you do not understand logical operations I suggest you look them up -- Google is your friend! ;-)

 

0=P3,13,Cx0D0078EB,x01

1=CP(F+3,13)3,13,Cx0D0078EB,x02

2=CP(F-3,13)3,13,Cx0D0078EB,x01

Is this not correct?

 

Of course not! Line 0 will reverse bit 0 and set the flag. Then line 1 will reverse bit 2. You certainly don't want any of those things.

 

Think about it. Think logically about what is happening here!

 

Please, please, read what I say and see if you can take my advice?  :sad:

 

Pete

Posted

Pete,

Thanks for the help, I understand what you are trying to tell me, if I write a parameter of 3 under togglebits it should toggle between bit 1 and 2, the reason I believe the parameter 3 under toglebits change bit 3 which is another action, is because under FSUIPC I choose offset byte togglebits (and I have chosen every other togglebits under the offset list as well as the set bits and clearbits) on the offset window I write x78EB and under parameter I write 3 and it activates bit 3 under the offset 78EB instead of toggling through bit 1 and 2. If there is another way that you are telling me to so it, I do not know how. I am not very savvy when it comes to logic programming, sorry.

Jose

Posted

I understand what you are trying to tell me, if I write a parameter of 3 under togglebits it should toggle between bit 1 and 2, the reason I believe the parameter 3 under toglebits change bit 3 which is another action, is because under FSUIPC I choose offset byte togglebits (and I have chosen every other togglebits under the offset list as well as the set bits and clearbits) on the offset window I write x78EB and under parameter I write 3 and it activates bit 3 under the offset 78EB instead of toggling through bit 1 and 2.

 

There is no way possible for togglebits to set bit 3 with a parameter of 3 -- you would need a parameter of 8 (2x2x2 = 8 ). I believe you are misinterpreting what you are seeing. If the offset 78EB starts off as zero (0) then toggling with 3 would set the value 3, not 1 or 2, and alternate that with zero (0)

 

I did say right at the beginning that the easy method I was explaining would only work if that  offset was set to  or 2 at the start. did you miss that point altogether?

 

If you do not believe what I tell you then I think you must prove it to yourself. In the FSUIPC logging tab, on the right-hand side, enter 78EB in the first Offset space, and select type U8 in the type column. Then below check "normal log". Also enable button/key logging on the left. DO NOT PRESS ANY OTHER OPTION, just ok out.

 

Do your test and then get the FSUIPC4.LOG file from the Modules folder. Check that, or paste it here so I can explain it to you.

 

Pete

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
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.