airforce2 Posted November 14, 2006 Report Posted November 14, 2006 Pete; Is there a way in FSUIPC to assign a hardware axis to send its value straight to an offset? I need to be able to take a joystick lever raw value and access it via an offset without trying to assign it to an FS axis...I'm out of usable FS axes. Thanks
Pete Dowson Posted November 15, 2006 Report Posted November 15, 2006 Is there a way in FSUIPC to assign a hardware axis to send its value straight to an offset? Not at present, at least not without writing a program to do it. Oddly enough it has never been requested. I need to be able to take a joystick lever raw value and access it via an offset without trying to assign it to an FS axis...I'm out of usable FS axes. Out of usable axes? That doesn't sound possible! Even FSUIPC calibrates over 40 and there are others that can set values like axes. Perhaps you could explain what you want to do so I can suggest solutions? Looking at what could be done otherwise to meet your perceived solution, the only thing I can think of off the top of my head would be the possibility of expanding the Axis Assignment section, right-hand side, where you can assign controls to ranges of axis movement. At present you can assign any control there, including the FSUIPC Offset setting controls. Normally the parameter this takes would be fixed, but supposing I allowed a special entry for the parameter, say * (an asterisk), to mean "this axis value", and, even more special, for this to operate as long as the axis value is changing within that range? (Normally there are only the entry and exit events). The simplest case would be a single range from one axis extreme to the other, in both directions, assigned to the Offset Word Set with parameter *. This is only a first thought, and it may seem a bit contrived, but there's nowhere else where it would fit without a lot more work. BTW are you talking about FS9 or FSX or both at present? Regards Pete
airforce2 Posted November 15, 2006 Author Report Posted November 15, 2006 Hi Pete; What I am trying to do is read a raw joystick axis value and, based on the value, control flap detent settings. I have to do it apart from the regular flap axis because I want to separate flap handle movement from flap position. This allows the flap handle to be moved, and if system configuration is not appropriate (hydraulic press, electrics, no assymetry etc) the flaps won't move with it. I've used the mask feature, but it tries to move the flaps initially before your code catches it and puts the lever back...and which also triggers sounds etc. I can think of other uses for such a feature as well. What you described...a special value for Parameter that would cause the axis raw value (scaled 0-16384?) to be sent to the offset if it has changed, is exactly what I had in mind. That gives a panel programmer direct access to hardware lever position data that can be used to perform proportional control over other than established FS axes...like operating an externally programmed engine supercharger, as one example. My current project (the TinMouse II B732 panel) is still FS9-only, but my intent is to port it to FSX at some point. As always, many thanks for your wizardry and help Cheers
ddawson Posted November 15, 2006 Report Posted November 15, 2006 Bob, Have a look at the GAUGE_KEY_EVENT_HANDLER function in gauges.h. The reaction to an FS control by this function is immediate. You can use it to completely inhibit user control over the flaps (or any other control surface for that matter.) Drop me a PM or e-mail if you want help with it. Doug Dawson
Pete Dowson Posted November 15, 2006 Report Posted November 15, 2006 What I am trying to do is read a raw joystick axis value and, based on the value, control flap detent settings. Eryou mean MOVE the detentes? Change the number of flap detentes or change the angle? Sorry, I'm lostI know of no way of changing any of that. It is pre-defined in the Aircraft.CFG file, or possibly for old versions the AIR file, surely? I have to do it apart from the regular flap axis because I want to separate flap handle movement from flap position. This allows the flap handle to be moved, and if system configuration is not appropriate (hydraulic press, electrics, no assymetry etc) the flaps won't move with it. I'd like to know how to do that in order to make my flap operation mask facility work better. Please, tell me how you manage to separate these things. You are doing this from an external program, or is this a Gauge or DLL? If you are actually writing a program to do these things, why not just read the relevant joystick axis yourself, using joyGetPosEx, same as FSUIPC does? If this is from a Gauge or DLL internal to FS actually controlling your own graphics lever, why not simply assign your flaps axis to a different, otherwise unused FS axis control, monitor that via the built-in PANELS facility for doing such things (register_key_event_handler), move your lever accordingly and IF the flaps should be working okay, send on the appropriate flaps operation by trigger_key_event? What you described...a special value for Parameter that would cause the axis raw value (scaled 0-16384?) I think RAW values are more usually in the 0-255 sort of area. Check by setting the RAW option in FSUIPC Axis Calibrations. Scaling is part of Windows calibration, scaled values are those read normaly. The joyGetPosEx facilities will only provide RAW or Calibrated for all 6 axes on a joystick, you can't mix them, so you might be limited as to which mode according to how the others are being used. ... to be sent to the offset if it has changed, is exactly what I had in mind. That gives a panel programmer direct access to hardware lever position data Ah. So you are writing a gauge/panel? I therefore really don't understand the requirement of FSUIPC. If you are writing a program which is running in FS, why not simply read the axis yourself? Anyway, after sleeping on my idea I decided it was too messy. If I were to do it (if I could see the need, which now I can't), now that I know it is for programmatic use, not for some existing interface program, I think I would opt to implement is all via offset writes and reads, like the FSUIPC HotButton facility. You would register an intrest in an axis and FSUIPC would scan it for you and return regular updates. However, all it would be doing for you is sending a joyGetPosEx function to Windows, so I'm not sure it is useful UNLESS the application is running externally and therefore possibly on another PC, via WideFS. Regards Pete
Pete Dowson Posted November 15, 2006 Report Posted November 15, 2006 Have a look at the GAUGE_KEY_EVENT_HANDLER function in gauges.h. The reaction to an FS control by this function is immediate. You can use it to completely inhibit user control over the flaps (or any other control surface for that matter.) Hi Doug, That's the procedure set up by "register_key_event_handler". I use it myself for intercepting and logging events, but I didn't know there was any way to CHANGE or STOP the events it intercepted. How's that done, please? The parameters received by the handler are simply the event and its parameter (not a pointer to them for changing), and the return is void so you cannot indicate acceptance or rejection. Is is done somehow via the PVOID userdata parameter? Thanks, Pete
airforce2 Posted November 15, 2006 Author Report Posted November 15, 2006 Eryou mean MOVE the detentes? Change the number of flap detentes or change the angle? No, I want to move the flap handle through the detents, but without necessarily moving the flaps. I'd like to know how to do that in order to make my flap operation mask facility work better. Please, tell me how you manage to separate these things. The flap handle position set & displayed with the make_slider macro uses an internal variable rather than the flap handle position in FS. The FS flap handle position (which seems inextricably linked to the actual flap position) is set by the gauge based on the internal flap handle position variable and the other conditions necesary to move the flaps. Changing the displayed flap handle position is done currently by writing a value to offset 0x6D11...2 for raising, 3 for lowering the flap handle position. Users map buttons via FSUIPC to control the flap handle (like my PFC quadrant's double-throw spring-centered switch) What I want to do is allow a hardware lever's position (mapped via FSUIPC so a user can use any lever FSUIPC can detect via a common interface) to be used to set the flap handle variable in the same manner. You are doing this from an external program, or is this a Gauge or DLL? gauge now...but access to the joystick values by an external program via FSUIPC would be useful. If you are actually writing a program to do these things, why not just read the relevant joystick axis yourself, using joyGetPosEx, same as FSUIPC does? The problem is that the relevant axis will vary from user to user. What I want to do is allow users to map any hardware lever to control the function. The lever on a CH yoke will be different than a PFC lever. FSUIPC does a nice job of detecting a hardware device and allowing it to be mapped to where needed. In this case I want to allow a user to select any FSUIPC-detected lever and have it send its position directly to a specific FSUIPC offset which is used to control the custom flap handle pos. If this is from a Gauge or DLL internal to FS actually controlling your own graphics lever, why not simply assign your flaps axis to a different, otherwise unused FS axis control, monitor that via the built-in PANELS facility for doing such things (register_key_event_handler), move your lever accordingly and IF the flaps should be working okay, send on the appropriate flaps operation by trigger_key_event? I did that for the spoilers using PROP1 and PROP2 axes. But I don't see a lot of usable but unused axes. I think RAW values are more usually in the 0-255 sort of area. Check by setting the RAW option in FSUIPC Axis Calibrations. Scaling is part of Windows calibration, scaled values are those read normaly. The joyGetPosEx facilities will only provide RAW or Calibrated for all 6 axes on a joystick, you can't mix them, so you might be limited as to which mode according to how the others are being used. I can use any scale...0-255 works fine. Anyway, after sleeping on my idea I decided it was too messy. If I were to do it (if I could see the need, which now I can't), now that I know it is for programmatic use, not for some existing interface program, I think I would opt to implement is all via offset writes and reads, like the FSUIPC HotButton facility. You would register an intrest in an axis and FSUIPC would scan it for you and return regular updates. That'd work fine. The desired endstate is to have a user use FSUIPC as the single routing function for key/button/axis assignments, and to be able to select which hardware joystick axis will be used to make the input to (in this case) an internal flap handle position variable via an FSUIPC offset used internally. Hope this is clearer. Cheers
airforce2 Posted November 15, 2006 Author Report Posted November 15, 2006 Have a look at the GAUGE_KEY_EVENT_HANDLER function in gauges.h. The reaction to an FS control by this function is immediate. You can use it to completely inhibit user control over the flaps (or any other control surface for that matter.) Drop me a PM or e-mail if you want help with it. Thanks Doug...I'll do that. Cheers
Pete Dowson Posted November 15, 2006 Report Posted November 15, 2006 The flap handle position set & displayed with the make_slider macro uses an internal variable rather than the flap handle position in FS. Ah, not something FSUIPC can influence on all aircraft then. You mean this is for a specific panel implementation. In that case I would have thought you could do what you liked with the flap handle? What I want to do is allow a hardware lever's position (mapped via FSUIPC so a user can use any lever FSUIPC can detect via a common interface) to be used to set the flap handle variable in the same manner. Okay, but that is something you could do in any case, if you are reading 6D11 and applying it, why not simply read an FS control parameter and apply that? I did that for the spoilers using PROP1 and PROP2 axes. But I don't see a lot of usable but unused axes. Really? Just about all those with SET as well as AXIS in the name take a parameter and can therefore be assigned to an axis. Have you looked in the Drop Down for FSUIPC's Axis Assignments (for FS controls). There are over 40 for direct FSUIPC-calibrated axes, but more in the FS assignments list. Surely an aircraft likely to use your flaps gauge will never be utilising all of those for other things? The desired endstate is to have a user use FSUIPC as the single routing function for key/button/axis assignments, and to be able to select which hardware joystick axis will be used to make the input to (in this case) an internal flap handle position variable via an FSUIPC offset used internally. At present, asnd for this particular purpose, it seems to me that either of the two choices I can see would be better. i.e. (a) using another axis assignment as mentioned above, or (b) using the current axis assignment facilities in FSUIPC, programming your flaps axis detentes in the "ranges" part of the assignment, with the actions assigned being an Offset Byte Inc in one direction, or Dec in the other (or a Set in both with the value you want in 6D11 as parameter. The latter is akin to my original suggestion, but with calibrated notch positions thus saving the need to have a new facility to send continually changing values. I'll sit on all this while you give it more thought, okay? I still don't see the need for changesyet. Regards Pete
ddawson Posted November 15, 2006 Report Posted November 15, 2006 Hi Doug, That's the procedure set up by "register_key_event_handler". I use it myself for intercepting and logging events, but I didn't know there was any way to CHANGE or STOP the events it intercepted. How's that done, please? The parameters received by the handler are simply the event and its parameter (not a pointer to them for changing), and the return is void so you cannot indicate acceptance or rejection. Is is done somehow via the PVOID userdata parameter? Thanks, Pete Pete, When the event being controlled is detected, measure the current position of the related control surface. Then issue an Axis Set command with the current position as the parameter. Also set a user declared control variable to allow this responding command to bypass the test. The original command will go through, but have no effect. Doug
Pete Dowson Posted November 15, 2006 Report Posted November 15, 2006 The original command will go through, but have no effect. So you really send the second command so close after the original arrives that there's no Sim Time between them? Just a sort of instant-reaction. Hmmm. never thought of that. I'll see if I can use that to help improve some of my masking/inhibiting facilities. Thanks! Pete
freak.zp Posted April 1, 2011 Report Posted April 1, 2011 I see that it has been 6 years since the last report, but I need help. When the event being controlled is detected, measure the current position of the related control surface. Then issue an Axis Set command with the current position as the parameter. Also set a user declared control variable to allow this responding command to bypass the test. The original command will go through, but have no effect. Does it work? My messages come directly from the joystick to the simulator, and I need to somehow intercept this messages. Sorry for my english :)
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now