Jump to content
The simFlight Network Forums
pilotjohn

Conditional Buttons on Axis Ranges

Recommended Posts

Can conditional button functionality be used on axis ranges? I looked at the manual but I don't see a format for this.

I'm looking to use the first small range of a throttle axes to send "small throttle increment" but only if the throttle is currently set below 0.

This would be used to get the throttle out of a reverse zone slowly instead of having the axis value "slam" to idle, and then have the remainder of the axis function as the normal throttle axis.

Share this post


Link to post
Share on other sites

Can conditional button functionality be used on axis ranges? I looked at the manual but I don't see a format for this.

No, there's no provision for conditionals in any sections other than the Buttons sections. Anything ambitious elsewhere has to be accomplished by Lua files. I added the complete Lua system, and continue to expand its capabilities with more and more library functions, in order to avoid the complications and more error-prone path of inserting extra facilities into existing mechanisms.

I'm looking to use the first small range of a throttle axes to send "small throttle increment" but only if the throttle is currently set below 0.

Why wouldn't that be possible by simply assigning it in that range? What would another condition add to the condition that the range imposes of itself?

This would be used to get the throttle out of a reverse zone slowly instead of having the axis value "slam" to idle, and then have the remainder of the axis function as the normal throttle axis.

There is no reason any reverse zone properly calibrated "slams" to idle. On most aircraft equipped with reverse there is a range of varying reverse thrust, from as much as 25% of full forward thrust (the actual proportion is set in the Aircraft.CFG file) down to zero. Why are you seeing a sudden "slam" movement?

Regards

Pete

Share this post


Link to post
Share on other sites

Why wouldn't that be possible by simply assigning it in that range? What would another condition add to the condition that the range imposes of itself?

There is no reason any reverse zone properly calibrated "slams" to idle. On most aircraft equipped with reverse there is a range of varying reverse thrust, from as much as 25% of full forward thrust (the actual proportion is set in the Aircraft.CFG file) down to zero. Why are you seeing a sudden "slam" movement?

There's no "reverse range" on the cheap Saitek throttle quadrant. I'm trying to set this up for the J41 which does not like going from reverse to idle in an instant. There's a detent, below which the throttle acts as a button. That button is assigned to small throttle decrement which works well since I can hold it there for some period of time to get the amount of "reverse" I need and then return to the detent. However to get out of the reverse a push forward from the detent is required which "slams" to idle. I was hoping to assign a small forward part of the axis as a conditional button that would provide a repeating "small throttle increment" if and only if the current throttle setting is below 0 (so that holding in that throttle axis range would not cause the throttle to go to full thrust). This way, below and above the detent could be used to "hunt" around the reverse zone based on timing, and the remaining axis above the button range would be as it was before, regular throttle.

I haven't looked at your Lua facilities yet. Do you think this is something it would handle? If it is, I'll start poking my nose into it.

Share this post


Link to post
Share on other sites

There's no "reverse range" on the cheap Saitek throttle quadrant.

There are no defined reverse ranges on most quadrants. FSUIPC allows you to determine the idle position and reverse section anywhere you like on the lever movement. That's the whole point of its definable centre idle section in the calibrations.

I'm trying to set this up for the J41 which does not like going from reverse to idle in an instant. There's a detent, below which the throttle acts as a button. That button is assigned to small throttle decrement which works well since I can hold it there for some period of time to get the amount of "reverse" I need and then return to the detent. However to get out of the reverse a push forward from the detent is required which "slams" to idle.

How is it achieving this "slam to idle"? What is it sending to do that? Presumbly the axis input isn't changing all this time, remaining zero, so it must be sending something on button release? Can you assign button release to something like a Lua which could do a timed loop to increase the throttle value to zero slowly?

Regards

Pete

Share this post


Link to post
Share on other sites

There are no defined reverse ranges on most quadrants. FSUIPC allows you to determine the idle position and reverse section anywhere you like on the lever movement. That's the whole point of its definable centre idle section in the calibrations.

How is it achieving this "slam to idle"? What is it sending to do that? Presumbly the axis input isn't changing all this time, remaining zero, so it must be sending something on button release? Can you assign button release to something like a Lua which could do a timed loop to increase the throttle value to zero slowly?

I know I can set reverse zones where ever I want. The problem with that is then I don't know where idle is exactly because it obviously won't be at the detent.

My goal would be to have the "button" below the detent decreases throttle slowly (repeat throttle small decr - this works now) and a small axis range above the detent increase throttle slowly (repeat throttle small incr - but only to idle). This would allow me to set the aircraft's reverse zone by holding the throttle below or above the detent for some period of time.

For example, on the J41 ground idle is just below flight idle (which is the 0 on the axes) but before full reverse. By pulling back the throttle and holding it there for 0.5 seconds (button for throttle decrease small) the throttle slowly moves enough to get to the ground idle area, and I move it back to the physical detent which stops the movement. If I now want to get back into flight idle, I move the throttle up a little which sets the throttle axes slightly above 0, which causes this "slam" (e.g. throttle setting likely goes from something like -2000 to 200 instantaneously) which causes an EGT spike and an engine fire if you're not careful. If I use a small axes range above the throttle detent as a button to "incr throttle small" I avoid the slam, but the throttle would continue increasing indefinitely. This is why I would want the conditional, so in that range of the axes the throttle would increase, but only until it reaches "0" setting (flight idle).

This "setup" would also be almost imperceptible during non-reverse or any other use. Since the small range only increase throttle if the throttle position read from FSX is below 0, moving the throttle forward will have no affect unless the throttle is in the reverse zone. So it will work with all planes, whether reversed or not, and would interfere with the full range of throttle axes very little.

If I do a simple timed increase to 0 with Lua I don't have control over placement with how long I hold the throttle lever in the range to increase throttle (this is the key). If the Lua script can repeat the increase while the axes range is still "pressed" and throttle position is less than 0, then it's the solution I'm looking for. Diagram of what I'm trying to achieve:

--- 16384
 |
 |   Remaining axes range mapped to throttle idle to max
 |
--- 1024
 |   Axes range used as button to slowly increase throttle (repeat while throttle lever position read < 0)
--- 0
 +   Physical detent (do nothing, no button being pressed, no axes set)
---
 X   Button used to slowly decrease throttle (repeat)
---

Share this post


Link to post
Share on other sites

I know I can set reverse zones where ever I want. The problem with that is then I don't know where idle is exactly because it obviously won't be at the detent.

Yes, that's something in common with pretty much every throttle quadrant. I've known folks to simply glue a small piece of rubber or plastic on the edges of the groove to act as a detente you can feel as you move the lever, but without obstructing the lever otherwise.

My goal would be to have the "button" below the detent decreases throttle slowly (repeat throttle small decr - this works now) and a small axis range above the detent increase throttle slowly (repeat throttle small incr - but only to idle). This would allow me to set the aircraft's reverse zone by holding the throttle below or above the detent for some period of time.

The problem then is that you have to divert the entire throttle axis through an alternative route, just so you can interfere with that lower region. That is unless you would be happy with all of that being calibrated as "idle" -- i.e. below the not-reverse-zone minimum calibration point. Then it would depend on the actual axis input seen by FSUIPC not changing so it doesn't override what you are trying to do.

Really that's pretty similar to calibrating that area as the reverse zone in any case.

For example, on the J41 ground idle is just below flight idle (which is the 0 on the axes) but before full reverse.

Are you saying it needs to be sent a negative throttle value to get ground idle? I've never seen anything do that. what negative range constitutes this "special" idle?

By pulling back the throttle and holding it there for 0.5 seconds (button for throttle decrease small) the throttle slowly moves enough to get to the ground idle area, and I move it back to the physical detent which stops the movement. If I now want to get back into flight idle, I move the throttle up a little which sets the throttle axes slightly above 0, which causes this "slam"

Right -- that sounds like the actual axis input stays at zero and doesn't change. Since FS/FSUIPC only act upon a change in axis inputs, you have to get to a positive number to get out of reverse.

(e.g. throttle setting likely goes from something like -2000 to 200 instantaneously) which causes an EGT spike and an engine fire if you're not careful. If I use a small axes range above the throttle detent as a button to "incr throttle small" I avoid the slam, but the throttle would continue increasing indefinitely. This is why I would want the conditional, so in that range of the axes the throttle would increase, but only until it reaches "0" setting (flight idle).

I assume the "reverse button" is released/unpressed when you let the lever go back to the detent? if so you could program the button release conditionally.

Trying to use a range is never going to work without a fairly sophisticated Lua plug-in handling the whole axis operation.. Why can't you tie the action you need to the button being released?

If I do a simple timed increase to 0 with Lua I don't have control over placement with how long I hold the throttle lever in the range to increase throttle (this is the key).

I thought the point was to let the reverse reduce slowly enough so you don't get the "slam". Why do you need to control it with the lever, how is that 'key'?

If the Lua script can repeat the increase while the axes range is still "pressed" and throttle position is less than 0, then it's the solution I'm looking for.

What do you mean by "pressed" here? The button can be pressed, not an axis range.

You can do almost anything with a Lua plug-in.

Diagram of what I'm trying to achieve:

That looks like something which would work okay with a reverse zone set between the lever positions you've labelled 1024 and 0. If the J41 needs a negative throttle value to achieve "ground idle" you'd need that in any case, surely?

Regards

Pete

Share this post


Link to post
Share on other sites

The problem then is that you have to divert the entire throttle axis through an alternative route, just so you can interfere with that lower region. That is unless you would be happy with all of that being calibrated as "idle" -- i.e. below the not-reverse-zone minimum calibration point. Then it would depend on the actual axis input seen by FSUIPC not changing so it doesn't override what you are trying to do.

Not sure what you mean "all of that being calibrated as idle". The small range that acts as a button press would just be a button, and anything above that range 1024-16384 would be mapped to 0-16384 throttle.

Are you saying it needs to be sent a negative throttle value to get ground idle? I've never seen anything do that. what negative range constitutes this "special" idle?

I assume the "reverse button" is released/unpressed when you let the lever go back to the detent? if so you could program the button release conditionally.

Yes. There's no specific value, it's a shaded area that's called "ground start", and is required for starting up, as well as 0 thrust operations, and shutdown.

If I use the "release" I don't have control over how much it moves, it's all or nothing no? This would not allow me to move to ground start area (or if I move past it by accident, to move up a little) since pulling past the detent decrease indefinitely, but in detent it increases.

Trying to use a range is never going to work without a fairly sophisticated Lua plug-in handling the whole axis operation.. Why can't you tie the action you need to the button being released?

I thought the point was to let the reverse reduce slowly enough so you don't get the "slam". Why do you need to control it with the lever, how is that 'key'?

The plane has [Max Thurst]-[Flight Idle: 0]-[Ground Start]-[Full Reverse]. If I pull back and let (wait for) the throttle decrease to "Ground Start' and move to the detent, all is good (movement stops, throttle remains in position). However, the only way to move out of Ground Start now is to move the throttle up past the detent which cause the "slam". If I do anything with the release, the throttle won't stay in the "Ground Start" position because it will begin to increase as soon as I move into the detent.

Basically, I'm trying to emulate that the first part of the axis range to be a button, to be able to control "reverse" position based on the amount of time the lever is held below or above the detent, and remap the remaining part of the axis to forward throttle. I thought since there was already an axis-range as button facility, it would be easy to make it a "conditional" button, and then remap the rest of the axes as 0-Max. From what you're saying, this is not trivial?

So no easy way to copy and paste the conditional button parsing/logic into the axes range part of the your code... :)

Share this post


Link to post
Share on other sites

Not sure what you mean "all of that being calibrated as idle". The small range that acts as a button press would just be a button, and anything above that range 1024-16384 would be mapped to 0-16384 throttle.

The range 0-1024 is all occupied by the button press? I thought the lever axis output would reach 0 before pressing the button and then there would be no more axis changes?

This is getting more and more confusing.

Yes. There's no specific value, it's a shaded area that's called "ground start", and is required for starting up, as well as 0 thrust operations, and shutdown.

There must be a recognised input value from the axis, else how can you select this separately from 0 = idle?

If I use the "release" I don't have control over how much it moves, it's all or nothing no?

Hmm. Yes, because "releases!" can't be repeated like presses. So, to get a slow return to 0 (or whatever your "ground idle" is) you'd need to assign the release to a Lua plug-in I think. That could simply loop do small increments with a delay built in till the value for ground idle is reached.

The plane has [Max Thurst]-[Flight Idle: 0]-[Ground Start]-[Full Reverse]. If I pull back and let (wait for) the throttle decrease to "Ground Start' and move to the detent, all is good (movement stops, throttle remains in position). However, the only way to move out of Ground Start now is to move the throttle up past the detent which cause the "slam". If I do anything with the release, the throttle won't stay in the "Ground Start" position because it will begin to increase as soon as I move into the detent.

See previous answer. You need to determine the throttle input value needed for "ground start2 and program the Lua to return to that.

Basically, I'm trying to emulate that the first part of the axis range to be a button, to be able to control "reverse" position based on the amount of time the lever is held below or above the detent, and remap the remaining part of the axis to forward throttle. I thought since there was already an axis-range as button facility, it would be easy to make it a "conditional" button, and then remap the rest of the axes as 0-Max. From what you're saying, this is not trivial?

No, it isn't really 'trivial' when you look at what is needed. It isn't just because there's no conditional facilities on the axis range assignments, but also because there's no way to "re-map" the rest of an axis separately without processing all of the values. The normal throttle assignment will be sending values to the throttle unless the area you wish to re-use alternatively is all calibrated as a dead zone returning 0.

So no easy way to copy and paste the conditional button parsing/logic into the axes range part of the your code.

No. Please see my earlier reply where I pointed out that the whole point of my adding the Lua facilities was to avoid tampering with and possibly wrecking original complex code dating many years. Lua adds ways of doing almost anything, and it is risk-free and much easier.

Regards

Pete

Share this post


Link to post
Share on other sites

The range 0-1024 is all occupied by the button press? I thought the lever axis output would reach 0 before pressing the button and then there would be no more axis changes?

Yes, 0-1024 would be all button press. Whatever is left over (1024-16384) would be forward throttle, preferably mapped idle-max. I'm just trying to emulate what I could do with two simple buttons.

Button 1, repeat decrease throttle small.

Button 2, repeat increase throttle small if throttle position < 0

Button 1 in this case is the button below the detent (no issues there)

Button 2 would have been the axis range 0-1023 with a conditional; can I assign the axis range to a Lua script, and have the Lua script do the repeat on conditional?

Then I just recalibrate the remaining axis values, so that 1024 is "minimum" so anything above the button axis range is as before and sets throttle (yes, the 0-1023 would be a dead-zone).

Share this post


Link to post
Share on other sites

Yes, 0-1024 would be all button press.

So the axis values still change below the detente? That's rather surprising. I did think the button was there instead of axis changes.

I assume then that you have to calibrate such that the 0-1024 range only supplies 0 to the sim, i.e. the idle dead zone?

can I assign the axis range to a Lua script, and have the Lua script do the repeat on conditional?

Yes of course. But why use this axis range when it all happens because the real button is released? Why not simple trigger the Lua on the button release?

What is the negative value the aircraft needs for "Ground Idle"? You need to determine that value first, surely, otherwise how can you hold it stable in ground idle as you said you needed?

Pete

Share this post


Link to post
Share on other sites

So the axis values still change below the detente? That's rather surprising. I did think the button was there instead of axis changes.

I assume then that you have to calibrate such that the 0-1024 range only supplies 0 to the sim, i.e. the idle dead zone?

Nono... below the detent acts as button, which I already have assigned to decrease throttle small. This allows me to move the aircraft throttle setting past the flight idle into ground start and then reverse based on how long I keep the lever past the detent.

I'm looking to configure the opposite of this "functionality" by using a small range of the "forward" axes (above the detent) as a conditional button press, that would increase the throttle slowly, until the FSX read value of the throttle position is 0. This would allow me to move the aircraft throttle setting from reverse to ground start, or reverse to idle depending on how long I keep it there, but will not increase the throttle to "max" because of the condition.

I don't want to do anything on "release" as it's suppose to do nothing.

Examples: Throttle is at flight idle, lever in detent. I want to get to ground start. I move below the detent (button press repeat small throttle decr) for 1 second, which moves the throttle setting to ground start, and then back the detent. If I want to continue to reverse, I move it below the detent again for 1 second. If I now want to get back to flight idle, I would need a conditional button, that would increase throttle small until the the throttle is 0. Or if I want to move from full reverse to ground start (has to do with prop locks) I would use this "increase" button for 1 second, and then move to the detent. I would like this increase button to be just above the detent, which is part of the throttle quadrant axis.

Share this post


Link to post
Share on other sites

Nono... below the detent acts as button, which I already have assigned to decrease throttle small. This allows me to move the aircraft throttle setting past the flight idle into ground start and then reverse based on how long I keep the lever past the detent.

Yes, I understood all that. But then you said

Yes, 0-1024 would be all button press.

which strongly suggests that the axis output is still changing below the detente!

I'm looking to configure the opposite of this "functionality" by using a small range of the "forward" axes (above the detent) as a conditional button press, that would increase the throttle slowly, until the FSX read value of the throttle position is 0. This would allow me to move the aircraft throttle setting from reverse to ground start, or reverse to idle depending on how long I keep it there, but will not increase the throttle to "max" because of the condition.

Yes, I understood that too --- it was you suddenly stating that the range you are talking about for this was still pressing the button! ("all button-press").

Also, i thought you wanted it increasing not to 0 but to the "ground idle" negative value, whatever that is.

Examples: Throttle is at flight idle, lever in detent. I want to get to ground start. I move below the detent (button press repeat small throttle decr) for 1 second, which moves the throttle setting to ground start, and then back the detent. If I want to continue to reverse, I move it below the detent again for 1 second.

How do you arrange that? What is timing this 1 second?

If I now want to get back to flight idle, I would need a conditional button, that would increase throttle small until the the throttle is 0.

Using the term "conditional button" is confusing here because there isn't one. Please instead describe what you are doing to invoke this change.

Or if I want to move from full reverse to ground start (has to do with prop locks) I would use this "increase" button for 1 second, and then move to the detent. I would like this increase button to be just above the detent, which is part of the throttle quadrant axis.

So this non-existent "increase button" is another one like the non-existent "conditional button"?

How do these buttons become invented? Surely all you are wanting to do is program different actions according the the state of the real reverser button and the current actual position of the axis? Such things can easily be dne in a Lua program.

Certainly all this can be done most cleanly in Lua. Another way, not needing to eat into your normal range of axis movement, would be to use the number of separate presses of the real button to select the next action i.e.

first real button press = throttle set to correct -ve value for "ground idle" (you still need to determine that value, as I keep asking).

second real button press = repeating 'throttle decr' whilst button held, for reverser application

third real button press = increasing throttle slowly to ground idle value

The return to normal idle is then the normal movement of the throttle. If you didn't want reverse, only use of ground idle, then you'd not pull back again, only pressing the reverser button the once.

The Lua plug-in can be Auto-loaded for that specific aircraft and simply loop monitoring the reverser button at, say, 50 msec intervals..

Regards

Pete

Share this post


Link to post
Share on other sites

Throttle = position of power set in FSX aircraft

Lever = position of physical throttle quadrant.

When lever is below detent, I have the button press assigned to "decrease throttle small" repeating. With this, it take about 2-3 seconds for the throttle to go from "idle" (0) to full reverse (rough timing by looking at the throttle moving in VC). Thus if I move the lever below detent for 1 second then back to the detent, the aircraft throttle will move for 1 second, go into ground idle, then stop when I moved to the detent.

All I want is the opposite functionality of this, but so that the FSX aircraft throttle is increased only if it's current state is below 0 (so that if I'm in reverse, or ground start the throttle is only increased until it gets to 0 - flight idle on the J41 - and not to max thrust). I was hoping to use an axis range to simulate this "button" being pressed repeatedly with the condition check.

So what I need is to have a Lua script that does something when the axis is in range? I'd like to simulate a repeating button press, preferably at the same rate that the regular button repeats happen. This has to be done via polling? So I could poll at the same rate with which repeating button presses happen? Can you give a pointer to get started with this? I'll start hunting in the docs.

Share this post


Link to post
Share on other sites

When lever is below detent, I have the button press assigned to "decrease throttle small" repeating. With this, it take about 2-3 seconds for the throttle to go from "idle" (0) to full reverse (rough timing by looking at the throttle moving in VC). Thus if I move the lever below detent for 1 second then back to the detent, the aircraft throttle will move for 1 second, go into ground idle, then stop when I moved to the detent.

Okay. so you know, or can determine, the correct negative FS throttle value for ground idle? That's one of the needed parameters.

All I want is the opposite functionality of this, but so that the FSX aircraft throttle is increased only if it's current state is below 0 (so that if I'm in reverse, or ground start the throttle is only increased until it gets to 0 - flight idle on the J41 - and not to max thrust). I was hoping to use an axis range to simulate this "button" being pressed repeatedly with the condition check.

Yes, i understood all that. what i don't understand is why you want to do it with a section of the forward thrust area of the throttle lever. Yes, you can do it like that -- with a Lua plug-in still -- but what is wrong with simple button programming, via Lua, to do it all in the actual button/detente area, as I suggested?

So what I need is to have a Lua script that does something when the axis is in range?

Yes, you can do that, but the hardware axis value isn't easily obtained. This does suggest to me that I should add a new function to the Lua ipc library to read a specific joystick axis value -- it can read button states and hats/POV (point of view) states, but not directly joystick axes at present (without using COM/HID direct device access facilities). The need has never arisen before. I'll put it on my list. Meanwhile, there's more on the rather awkward current alternatives below.

I'd like to simulate a repeating button press, preferably at the same rate that the regular button repeats happen.

Yes, you can do that. You might have to experiment with the timer to match it.

This has to be done via polling?

What better? You can poll in a loop with a delay, or simply use the timer event facility to call a function at the correct intervals.

Can you give a pointer to get started with this? I'll start hunting in the docs.

There are lots of Lua examples installed in your Modules/FSUIPC documents folder, and even more in the User Contributions sub-forum.

If you adopted my suggestion of using multiple pressings of the real reverser button instead of part of the forward axis range I could knock it up for you in a few minutes as it is so much simpler. With your method, to read the incoming axis value pre-calibration is not so easy though -- FS stores calibrated not raw values, so you'd either have to manage by using the axis range to set some FS offset, or probably more effectively use another Lua plug-in which stores the axis value as a Lua global so the resident polling one can get it from there. The whole method that way seems cumbersome and complicated comparatively. I'm not sure why you don't like my suggestion?

Lua, via the COM (serial port) library does support HID (human interface devices) -- joysticks -- and can read axes, buttons and so on directly. in fact it can read many more than those supported by FSX and FSUIPC nativelyt as it bypasses DirectInput. But that's a rather over-the-top route to what should be solved so much more simply.

I'm afraid I'm out for the rest of the evening, so I won't get back to you now till tomorrow (Wednesday), and late morning at the earliest as I have a dental check-up early on.

Regards

Pete

Share this post


Link to post
Share on other sites

Yes, i understood all that. what i don't understand is why you want to do it with a section of the forward thrust area of the throttle lever. Yes, you can do it like that -- with a Lua plug-in still -- but what is wrong with simple button programming, via

Because it naturally lends itself to that function. Detent ("do nothing"), below it decrease throttle below default idle (0), above it increase throttle to no more than idle, above it further functions as regular forward throttle. It would provide a logical behavior: pull back past detent, engines go into reverse at some rate, in detent, nothing happens, forward of detent engines come out of reverse but only to idle.

So if I can't read the axis position in Lua, how would I know that I should be simulating a repeating button press when the axis is in the range I pick?

Also the exact negative value for ground idle doesn't matter much. I can look when the throttle position is in the hatched area of the aircraft. What matters is being able to slowly increase throttle to only idle (0) setting. As I said, this can be done easily with a repeating conditional button, but I'd like to simulate it on an axis range.

Share this post


Link to post
Share on other sites

I think I was confusing you because I was using 0-16384 as a full range for the axis.... I should have used -16384..16384, with the virtual button axes range at -16384..-15360. That is, there's no axis range left below the button region.

Share this post


Link to post
Share on other sites

I think I was confusing you because I was using 0-16384 as a full range for the axis.... I should have used -16384..16384, with the virtual button axes range at -16384..-15360. That is, there's no axis range left below the button region.

So the question then becomes, how would I simulate a button press with Lua on this range. Since I can't monitor the axis, is there some other trigger mechanism available?

I was looking at you event.control Lua faciliy. It would be nice if this could be used like event.intercept to stop the control from happening. I could then use this to intercept "throttle incr small" and only forward it on if the current throttle position is less than 0. If i call ipc.control inside here, will it trigger another event? That is, will ipc.control trigger event.control callback? If not, I can negate the "incr small" control with a "decr small" if it should not have happened :), otherwise infinite loop.

2. I don't see any other way of triggering something on an axis range. Can Lua plugin even be triggered on axis range assignments?

3. Or, is there some temporary/flag FSUIPC offset I could use to assign the axis to, and then intercept it and trigger controls based on the param?

What is the overhead of these approaches? Any thoughts on which would work?

Share this post


Link to post
Share on other sites

So if I can't read the axis position in Lua, how would I know that I should be simulating a repeating button press when the axis is in the range I pick?

You can get the axis value in a Lua, but it currently means assigning the axis to execute the Lua plug-in (as well as the throttle as now). It gets the axis value as "ipcPARAM". But that Lua is re-executed every time the axis value changes, so all it can really do is store the value someplace that the true plug-in you need can get it -- either an offset or, better, a Lua global. That's what i meant by complication.

If you leave it a week or so, I'll be adding facilities to Lua to read joystick values, and then it'll be much cleaner.

Also the exact negative value for ground idle doesn't matter much. I can look when the throttle position is in the hatched area of the aircraft.

Hmm. I'm firmly of the belief that you shouldn't need to check with specific graphics on the screen. That's the idea of detentes on the hardware in the first place. Better, in my opinion, to just tell the axis value to go to the known position for ground idle. But that's your choice of course.

Regards

Pete

Share this post


Link to post
Share on other sites

If you leave it a week or so, I'll be adding facilities to Lua to read joystick values, and then it'll be much cleaner.

Sounds good... I'll wait for your new APIs. Are you planning events on ranges, or just a generic read axis functions that I can loop over?

Hmm. I'm firmly of the belief that you shouldn't need to check with specific graphics on the screen. That's the idea of detentes on the hardware in the first place. Better, in my opinion, to just tell the axis value to go to the known position for ground idle. But that's your choice of course.

I'm not sure if the real aircraft has detents, it's definitely not defined in the manuals; throttle at 0 moves to flight idle, and anything below that is "variable". It's a geared turboprop so I'm not sure what the deal is.

Share this post


Link to post
Share on other sites

Sounds good... I'll wait for your new APIs. Are you planning events on ranges, or just a generic read axis functions that I can loop over?

A new Lua function:

value = ipc.axis(joystick, axis)

which, like the button facilities operate only if the joystick is one being scanned by FSUIPC (i.e. the axis is assigned). The joystick can be a number or a letter (if joyletters are in use), and the axis is one of X Y Z R U V (plus S T on FSUIPC4).

I've implemented this already, it was so easy. I will post a link for you to download the update, and an example Lua for your problem in a short while.

I'm not sure if the real aircraft has detents, it's definitely not defined in the manuals; throttle at 0 moves to flight idle, and anything below that is "variable". It's a geared turboprop so I'm not sure what the deal is.

I think turboprop levers have fairly strong detents.

Regards

Pete

Share this post


Link to post
Share on other sites

which, like the button facilities operate only if the joystick is one being scanned by FSUIPC (i.e. the axis is assigned). The joystick can be a number or a letter (if joyletters are in use), and the axis is one of X Y Z R U V (plus S T on FSUIPC4).

So the axis has to be assigned via FSUIPC and removed from FSX? (e.g. send to FSUIPC Calibration?)

Share this post


Link to post
Share on other sites

So the axis has to be assigned via FSUIPC and removed from FSX? (e.g. send to FSUIPC Calibration?)

No, assigned in FSUIPC whichever way you like. If it isn't being scanned even by FSUIPC you cannot really do anything with it -- including your proposed "conditional button on range".

So i'm now confused. Are you not already assigning in FSUIPC?

Do not assign anything both in FS and FSUIPC!

Pete

Share this post


Link to post
Share on other sites

No, assigned in FSUIPC whichever way you like. If it isn't being scanned even by FSUIPC you cannot really do anything with it -- including your proposed "conditional button on range".

So i'm now confused. Are you not already assigning in FSUIPC?

It's being scanned by FSUIPC since it's doing calibration on it. What I meant was I didn't know if it needed to be assigned in "Axis Assignments".

Share this post


Link to post
Share on other sites

It's being scanned by FSUIPC since it's doing calibration on it. What I meant was I didn't know if it needed to be assigned in "Axis Assignments".

FSUIPC is NOT scanning the axis if it isn't assigned in FSUIPC! Calibration is on the FS control, NOT on the hardware axis! That's why it works with FS assignments as well as FSUIPC assignments. It doesn't know about the hardware and doesn't care.

If you aren't assigning in FSUIPC how did you hope to apply your conditional button to a range?

=======================================================

Download this update:

http://fsuipc.simflight.com/beta/FSUIPC4728b.zip

Then edit this little Lua program as described below and place it in the FSX modules folder as, say, J41Throttle.lua. Edit the FSUIPC4.INI file and add a new section:

[Auto.<name of aircraft>]

1=Lua J41throttle

where <name of aircraft> is either the full title, or, better, if you have "ShortAircraftnameOk=substring" set then just J41 (assuming that's part of the name).

That will make it run automatically when you load that aircraft.

-- Lua program to manipulate throttle in calibrated idle dead zone
joy = 1
axis = "S"
zonelo = -14000
zonehi = -12000
bestincr = 32
interval = 50
throttle = 0x088c --0x088C is for Throttle 1. For 2 use 0x0924

function pollaxis()
   val = ipc.axis(joy, axis)
   if (val &gt; -zonelo) and (val &lt; -zonehi) then 
		thr = ipc.readSW(throttle) 
  	if thr &lt; 0 then
  		inc = bestincr
  		if thr &gt; -inc then
     		inc = -thr
  		end
  		ipc.writeSW(throttle, thr + inc)
  	end
   end
end

event.timer(interval, "pollaxis")

You'll need to change these bits:

joy = 1 change to the joystick number or letter shown in the axis assignment for this axis

axis = "S" change to the axis letter shown in the axis assignment for this axis

zonelo = -14000 the low end of the range in which you want the throttle incrementing

zonehi = -12000 the high end of the range in which you want the throttle incrementing

bestincr = 32 the amount you want the throttle to increment each loop

interval = 50 the frequency of checks and increments (50 = 20 per second)

throttle = 0x088c 0x088C is for Throttle 1. For 2 use 0x0924

Note that rather than use the "small throttle inc" control as you proposed i've simply incremented the throttle directly. That gives you precise control over the fineness of the increments. I think the FS INCS are 512 and 256 respectively. Just adjust the time interval and/or the increment to get the speed you want.

This example is only for throttle1. If you are using the generic single throttle it should still work for both engines because they should be in sync. If you are using two throttle levers then you either need to run two Luas with the throttle offset and axis changed to match, or, more efficiently, do both in the one loop by duplicating this part:

   val = ipc.axis(joy, axis)
   if (val &gt; -zonelo) and (val &lt; -zonehi) then 
		thr = ipc.readSW(throttle) 
  	if thr &lt; 0 then
  		inc = bestincr
  		if thr &gt; -inc then
     		inc = -thr
  		end
  		ipc.writeSW(throttle, thr + inc)
  	end
   end

with the appropriate changes to joy, axis and throttle.

Have fun!

Pete

Share this post


Link to post
Share on other sites

If you aren't assigning in FSUIPC how did you hope to apply your conditional button to a range?

I was applying non-conditional "button" range in Axis Assignments. That worked, it just didn't stop at idle. :)

No biggie, I'll unassign in FSX and assign in FSUIPC it to send to calibration.

Thanks!

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

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