Jump to content
The simFlight Network Forums

"Break" in button conditionals?


pilotjohn

Recommended Posts

I have the following to try to toggle between auto/on for ignition (off is separate).

2041=D208C<2 P65,9,C67017,2     -{TURBINE_IGNITION_SWITCH_SET1}-
3041=D208C=2 P65,9,C67017,1     -{TURBINE_IGNITION_SWITCH_SET1}-

The above doesn't work because offset 208C is updated immediately with the state (2) after sequence 2041, so 3041 will always trigger.

Any chance you could add a "break" option to this syntax that would stop process or ignore sequences after the break?

The other option would be to treat the "state" as atomic across all sequences (or at least per button), but I imagine that would likely break lots of legacy stuff.

Or, do I have to use a Lua for this?

 

Link to comment
Share on other sites

13 hours ago, pilotjohn said:

I have the following to try to toggle between auto/on for ignition (off is separate).


2041=D208C<2 P65,9,C67017,2     -{TURBINE_IGNITION_SWITCH_SET1}-
3041=D208C=2 P65,9,C67017,1     -{TURBINE_IGNITION_SWITCH_SET1}-

The above doesn't work because offset 208C is updated immediately with the state (2) after sequence 2041, so 3041 will always trigger.

I assume these lines are sequential numbers in your list and there are not 999 more assignments between them? That might have an influence.  And check that 3041 actually being accepted. Those are really high button assignment numbers -- according to the documentation the allowable range is 0-2047. I suspect your second there is simply ignored (not being read).

14 hours ago, pilotjohn said:

Any chance you could add a "break" option to this syntax that would stop process or ignore sequences after the break?

The other option would be to treat the "state" as atomic across all sequences (or at least per button), but I imagine that would likely break lots of legacy stuff.

Or, do I have to use a Lua for this?

You can use the button flag facilities for this sort of thing.

I assume that it is FSUIPC which is setting the offset immediately, because there is very little (no chance at least in previous versions of FSUIPC) for the SimConnect variable change being read and acted upon by FSUIPC in the middle of the button action scan, which is a single loop in the same thread.

If FSUIPC is setting the offset at the same time as sending the value to SimConnect, you might as well change the button action to a simple toggle.

2041=CP(F-65,9)65,9,C67017,2     -{TURBINE_IGNITION_SWITCH_SET1}-
2042=CP(F+65,9)65,9,C67017,1     -{TURBINE_IGNITION_SWITCH_SET1}-
Link to comment
Share on other sites

16 hours ago, pilotjohn said:

Any chance you could add a "break" option to this syntax that would stop process or ignore sequences after the break?

As well as what Pete has said, there is a 'Pause Control' that you can use to insert a break in multiple assignments or macros (but not in compound assignments) Its FSUIPC added control 'Pause (ms)', number 1152:
 

Quote

    1152 Pause (ms) – this adds a delay in ms. It can be used to insert a delay between key press/releases and mouse
operations (where needed)

 

Link to comment
Share on other sites

2 hours ago, Pete Dowson said:

I assume these lines are sequential numbers in your list and there are not 999 more assignments between them? That might have an influence.  And check that 3041 actually being accepted. Those are really high button assignment numbers -- according to the documentation the allowable range is 0-2047. I suspect your second there is simply ignored (not being read).

They are in the INI (placed next to #42, #1042 etc.), but there is 2043 (for example). I'm basically trying to group button actions using this method. I have >200 "base" assignments (made in the UI), and to pick the right sequence when adding additional controls I would have to find the next highest one. So I'm using this schema, where additional actions for a given base are +1000 +2000 etc. In this case #41 is MAGNETO1_BOTH, #1041 is ENGINE_MASTER_1_SET. I'll verify that #3042 is being used. This works across many planes/types that achieve same functional result (e.g. some sort of ignition on).

Quote

You can use the button flag facilities for this sort of thing.

I assume that it is FSUIPC which is setting the offset immediately, because there is very little (no chance at least in previous versions of FSUIPC) for the SimConnect variable change being read and acted upon by FSUIPC in the middle of the button action scan, which is a single loop in the same thread.

If FSUIPC is setting the offset at the same time as sending the value to SimConnect, you might as well change the button action to a simple toggle.



2041=CP(F-65,9)65,9,C67017,2     -{TURBINE_IGNITION_SWITCH_SET1}-
2042=CP(F+65,9)65,9,C67017,1     -{TURBINE_IGNITION_SWITCH_SET1}-

I'll look at this, thanks.

Link to comment
Share on other sites

54 minutes ago, John Dowson said:

As well as what Pete has said, there is a 'Pause Control' that you can use to insert a break in multiple assignments or macros (but not in compound assignments) Its FSUIPC added control 'Pause (ms)', number 1152:
 

 

What would the pause help with in this case (assuming both actions are actually being executed).

Link to comment
Share on other sites

4 minutes ago, pilotjohn said:

What would the pause help with in this case (assuming both actions are actually being executed).

It won't - I just mentioned this as it is a general control to insert a pause, but it will not 'break' or prevent further assignments being executed. Sorry if that confused you.

Link to comment
Share on other sites

I tested with lower sequence numbers:

360=P65,9,C65930,0 	-{MAGNETO1_BOTH}-
361=P65,9,C67059,1 	-{ENGINE_MASTER_1_SET}-
362=D208C<2 P65,9,C67017,2 	-{TURBINE_IGNITION_SWITCH_SET1}-
363=D208C=2 P65,9,C67017,1 	-{TURBINE_IGNITION_SWITCH_SET1}-

And the result is the same. It appears offset values are modified immediately after #362, so pressing this button always just result in the ignition set to "1".

The flag idea works (thanks for the pointer), but it's less deterministic from a user standpoint (not predictable where the toggle state will land when switched off).

So is the only other option then a Lua?

Link to comment
Share on other sites

12 hours ago, pilotjohn said:

It appears offset values are modified immediately after #362

I still find this strange.  I will look at the code to see how the offset is changed whilst in the button action scan. The two things are in the same thread and the scan of buttons to act upon is a loop with no chance of Windows messages being processed in the middle. SimConnect data arrives by message notification. So you can see the puzzle. I thought the only assigned actions which could do that were the offset controls themselves.

[LATER]

Yes. That offset is only being set when FSUIPC receives the value from SimConnect. It doesn't set it at any other time. So your result is weird -- I can't see how it can happen. Could you please try this:

Before using any buttons, go to the Logging Monitor offsets facility and set it to monitor offset 208C as a U32. 
Also enable Button logging and Event logging.

When things are settled down and you already to fly, press button 65,9.

Show us the Log (or the parts of it relating to this offset and control).

This may not show us anything useful as the Monitor operates only at (short) intervals, not between every action. But it may show something. If not some additional log lines might need to be temporarily inserted.

12 hours ago, pilotjohn said:

The flag idea works (thanks for the pointer), but it's less deterministic from a user standpoint (not predictable where the toggle state will land when switched off).

Just set it specifically initially or when switching off.  There are Button flag controls you can use and assign as you wish.

Pete

 

Link to comment
Share on other sites

Ok, so it looks like this "should" work as expected (e.g. there's no update between the two sequences), but it doesn't because 208C only shows a value of 1 regardless of whether the control sends 1 or 2 as the param. The aircraft switch behaves correctly (Auto vs On) but  208C always reads 1, never 2, and 0 when off. I'm not sure if this is a sim/aircraft issue or whether the value is reflected incorrectly in this offset. Any thoughts?

Resetting the flag is a great idea, I should have thought of it, thanks.

Link to comment
Share on other sites

32 minutes ago, pilotjohn said:

but  208C always reads 1, never 2, and 0 when off. I'm not sure if this is a sim/aircraft issue or whether the value is reflected incorrectly in this offset. Any thoughts?

That offset is just showing the value of the TURB ENG IGNITION SWITCH variable, and at index 1. I've just checked the latest MSFS documentation, and it seems that this is no longer indexed and is a boolean, so just 0 and 1 (i.e. off/on - but I still don't understand why you just see 1!). However, there is also a new EX1 simvar for this:

TURB ENG IGNITION SWITCH EX1 Position of the Ignition Switch. Similar to SIMVAR_TURB_ENG_IGNITION_SWITCH but differentiates between ON and AUTO. (Enum) UNITS_ENUM TYPE_ENUM

 

 Is this what you need? I could add that to a different offset for you to try if that helps - let me know.

 

Link to comment
Share on other sites

1 hour ago, John Dowson said:

That offset is just showing the value of the TURB ENG IGNITION SWITCH variable, and at index 1. I've just checked the latest MSFS documentation, and it seems that this is no longer indexed and is a boolean, so just 0 and 1 (i.e. off/on - but I still don't understand why you just see 1!). However, there is also a new EX1 simvar for this:

TURB ENG IGNITION SWITCH EX1 Position of the Ignition Switch. Similar to SIMVAR_TURB_ENG_IGNITION_SWITCH but differentiates between ON and AUTO. (Enum) UNITS_ENUM TYPE_ENUM

 

 Is this what you need? I could add that to a different offset for you to try if that helps - let me know.

 

Yes, the individual ignition switch state for each engine would be ideal as multiple offsets.

 

Link to comment
Share on other sites

@pilotjohn Not sure whats going on with those simvars and controls, but testing in the King Air I only see a value of 0 or 1 for both the TURB ENG IGNITION SWITCH and the EX1 equivalent. Setting it to 2 (when 0) does nothing, however setting it to 2 when its 1 seems to turn the ignition switch off...

Anyway, I've made a few changes in the attached version v7.0.9a if you would like to try. Changes are:
   - offsets 0x208C, 0x218C, 0x228C & 0x238C were previously using (for write) the KEY_TURBINE_IGNITION_SWITCH_TOGGLE control with a parameter for the engine number. I've changed these to use the individual KEY_TURBINE_IGNITION_SWITCH_SET1/2/3/4 controls with the parameter thats written to the offsert
   - I have added 4 new one byte offsets at 0x02C0, 0x02C1, 0x02C2, 0x02C3 for the TURB ENG IGNITION SWITCH EX1:1/2/3/4 simvars. Writing to these offsets also triggers the KEY_TURBINE_IGNITION_SWITCH_SET1/2/3/4 controls.

Can you try this and let me know how this works for you. Which a/c are you using, and dies it actually have an off/on/auto setting for these switches?

FSUIPC7.exe

Link to comment
Share on other sites

4 hours ago, John Dowson said:

@pilotjohn Not sure whats going on with those simvars and controls, but testing in the King Air I only see a value of 0 or 1 for both the TURB ENG IGNITION SWITCH and the EX1 equivalent. Setting it to 2 (when 0) does nothing, however setting it to 2 when its 1 seems to turn the ignition switch off...

Anyway, I've made a few changes in the attached version v7.0.9a if you would like to try. Changes are:
   - offsets 0x208C, 0x218C, 0x228C & 0x238C were previously using (for write) the KEY_TURBINE_IGNITION_SWITCH_TOGGLE control with a parameter for the engine number. I've changed these to use the individual KEY_TURBINE_IGNITION_SWITCH_SET1/2/3/4 controls with the parameter thats written to the offsert
   - I have added 4 new one byte offsets at 0x02C0, 0x02C1, 0x02C2, 0x02C3 for the TURB ENG IGNITION SWITCH EX1:1/2/3/4 simvars. Writing to these offsets also triggers the KEY_TURBINE_IGNITION_SWITCH_SET1/2/3/4 controls.

Can you try this and let me know how this works for you. Which a/c are you using, and dies it actually have an off/on/auto setting for these switches?

FSUIPC7.exe 594.5 kB · 0 downloads

I'll try this. I was testing on the TBM930 which does have off/on/auto and setting them to 0/1/2 does correctly set the switch and function.

Link to comment
Share on other sites

15 hours ago, pilotjohn said:

I was testing on the TBM930 which does have off/on/auto and setting them to 0/1/2 does correctly set the switch and function.

Ok, tested with this and now both the old and the new offsets seem to work ok. The old offsets only allow 0/1, but you can also now write 2 to those offsets, which will set the EX1 simvar correctly but the non-EX1 version will get changed back to 1. I see no harm in allowing this, but I could also revert the old offsets back to only allow a 0/1 to force the new offsets to be used...

Link to comment
Share on other sites

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.