Jump to content
The simFlight Network Forums

Offset Number Confusions!


Recommended Posts

Hello Pete, I would appreciate if you could help me unravel a problem I'm having with FSUIPC (4.57) and Mark Hastings' Sim-Avionics (1.07) I have pored over the documentation for both FSUIPC and S-A and I'm still none the wiser.

I have a Leo Bodnar card with connected rotary switches that FSUIPC sees as button presses. I am trying to get the MCP Altitude increment function to work from one of the button presses (clockwise rotation) and decrement from anti-clockwise rotation (seperate button), but I am completely stuck on what selection to make from the 'Control sent when button pressed' drop-down list, and what parameter to enter. Offset is x53A4, as shown below.

From the S-A documentation:

[FSUIPC_MCP_INPUTS]

MCP_ALTITUDE=53A4

Note:

MCP_ALTITUDE 4 bytes (Dword)

{From S-A FSUIPC Help doc:

4 bytes (known as a DWORD or INTEGER or FLOAT32 or SINGLE depending on the usage)

can store a whole number between 0-4294967296 or decimal values}

// ALT = value ft /3.28084*65536

MCP_ALT_FS_FORMAT=1

MCP_ALTITUDE is expected FS formatting - like offsets 07D4.

ie: 31700ft = 317(00) = 317 * 1997537 = 633219229

write 633219229 to the MCP_ALTITUDE offset

Using the tools in S-A I am able to write the above specific value to the specific offset and I see the expected changes in S-A's MCP panel.

I have tried several of the drop-down options, but without success. It would appear that I need the Offset Float32 Inc/1000 selection, but using this with a parameter of only 1 immediately pushes the value in x53A4 above the maximum limit of the MCP Altitude, and the S-A display goes straight to 41000ft, whereas I obviously need 100ft increments/decrements.

Any guidance you can give me on this would be much appreciated!

Cheers, Rob Bowers

Link to comment
Share on other sites

I have a Leo Bodnar card with connected rotary switches that FSUIPC sees as button presses. I am trying to get the MCP Altitude increment function to work from one of the button presses (clockwise rotation) and decrement from anti-clockwise rotation (seperate button), but I am completely stuck on what selection to make from the 'Control sent when button pressed' drop-down list, and what parameter to enter. Offset is x53A4, as shown below.

It's a bit of a mismatch. Such offsets are designed to be read/written by programs, not by simple controls.

Doesn't Sim-Avionics react to the normal FS A/P altitude Inc/Dec controls, or have any INC/DEC type assignments? That's what you need. There's no way you can assign simply controls in FSUIPC to do the sort of computations that software needs for that offset. At the very least you'd need to write a Lua plug-in program to read the offset, compute a suitable increment or descrement, then write it back.

Using the tools in S-A I am able to write the above specific value to the specific offset and I see the expected changes in S-A's MCP panel.

So what is the problem? Cannot those tools be used from hardware at all? If not, what is the precise application of the tools?

I have tried several of the drop-down options, but without success. It would appear that I need the Offset Float32 Inc/1000 selection, but using this with a parameter of only 1 immediately pushes the value in x53A4 above the maximum limit of the MCP Altitude, and the S-A display goes straight to 41000ft, whereas I obviously need 100ft increments/decrements.

Does the Sim-Avionics documentation declare that offset as a FLOAT32? If not then writing a float value to it will certainly give weird results. You quote this:

MCP_ALTITUDE is expected FS formatting - like offsets 07D4.

ie: 31700ft = 317(00) = 317 * 1997537 = 633219229

write 633219229 to the MCP_ALTITUDE offset

but FSUIPC offset 07D4 is the FS AP Altitude and is a DWORD, not a Float32!

FSUIPC does not offer any DWORD increment/decrement controls (the range possibility is too great) but if it did the increment for 100 feet would be computed just as shown in your example, i.e. 1 * 1997537 = 1997537. But to use that knowledge you'd need to write a program or a small Lua plug-in for certain.

I thought Sim-Avionics was designed for cockpit builders using hardware such as the Leo Bodnar cards? Doesn't the documentation help? If not it might be a good idea to talk to their support, or visit their Forum. There are also a lot of users of both the cards and S-A (though possibly not both) on the MyCockpit forums (http://www.mycockpit.org/forums ) so you might also ask there.

Regards

Pete

Link to comment
Share on other sites

No, S-A assignments are made exclusively through the use of offsets. I did a check and it doesn't react to the FS AP offset in 07D4. In theory, there is a button combo that can be used, but the MCP application runs on a seperate PC to the hardware, and I'm not running WideFS.

The tools I mention simply allow you to monitor and write to offsets that you specify, running as part of the S-A server application.

In my OP I noted that S-A state the altitude is a 4-byte value, and their "FSUIPC Help" document says that this can be known as "a DWORD or INTEGER or FLOAT32 or SINGLE depending on the usage" - therefore, as there appeared to be no DWORD INC choice in the drop down, I assumed Offset Float32 Inc/1000 would be the same format. If there's no DWORD inc option, then I agree I may be scuppered!

Thanks for your prompt reply, Pete. I'll go to the S-A forums of course, and also check out MyCockpit. Once I've resolved this issue, I'll post back here.

Link to comment
Share on other sites

No, S-A assignments are made exclusively through the use of offsets. I did a check and it doesn't react to the FS AP offset in 07D4.

But Project Magenta operates via offsets too, but they provide offsets for the Altitude adjustment knob, so you can increment it and decrement it. Normally the only use of the actual Altitude readout is so you can display that value on your hardware MCP. How does S-A handle all of the buttons and knobs you might want to add? They surely cannot all be via actual final display values? That would mean just about every user needing to write interface programs.

In theory, there is a button combo that can be used, but the MCP application runs on a seperate PC to the hardware, and I'm not running WideFS.

Er .. so how does the MCP application change the offsets? Are you sure that the Sim-Avionics suite isn't designed to use WideFS or some sort of networking? Sounds a bit odd if not.

Regards

Pete

Link to comment
Share on other sites

It appears that S-A is based on the altitude number, as I can't see an offset relating to the inc/dec buttons. Most other functions (eg. battery switch) are defined as buttons, set via offsets, with in some cases corresponding output offsets to allow reading of the switch state.

In terms of widefs, S-A utilises a server application on the FSX machine, and my (proposed) set up runs all other S-A applications on a seperate low-spec PC. My hardware is connected to the FSX machine and configured in FSUIPC, and I presume the server application handles the communication to the low-spec machine displaying the MCP, Avionics, etc.

From the S-A documentation, it would appear that WideFS could be used as part of the setup, but as my current configuration is only 2 PCs, and hardware is fairly limited at this stage, I do not need that level of complexity.

Link to comment
Share on other sites

It appears that S-A is based on the altitude number, as I can't see an offset relating to the inc/dec buttons.

Well, by altitude "number" I take it you mean the altitude in the units used by FS's autopilot, because their software seems to have adopted the same. Evidently S-A needs hardware AND software attachments which can provide that sort of sophistication. I really don't see how you can achieve it with buttons alone. You could do it with an little Lua plug-in. Have you looked at that possibility?

Have you asked S-A folks, or on whatever forum they have? I really don't see why it should be that way it appears -- there must be many others with a similar problem, surely?

Regards

Pete

Link to comment
Share on other sites

I haven't had a chance to post on the S-A forum yet, but I'll let you know what I find. I agree that someone else must have tackled this in the past, although several users on the S-A forum refer to commercial (engravity, opencockpits, etc.) MCP and CDU hardware.

It may require a Lua plug-in to cope with my set-up so that'll be something else for me to learn!

Link to comment
Share on other sites

It may require a Lua plug-in to cope with my set-up so that'll be something else for me to learn!

Well, in this case it's only a little arithmetic I think. Let's see:

MCP_ALTITUDE=53A4 (DWORD)

// ALT = value ft /3.28084*65536

So, say you want to increment or decrement in 100 feet units, with the display rounded to the 100's

Save this in your FS Modules folder as "AltInc.lua":

-- Read the S-A A/P altitude and convert to the number of 100's of feet
alt = ipc.readUD(0x53A4) * 3.28084 / 6553600

-- Add 1 (increment by 100 feet) if not already max (990 ? Or less?)
if alt < 990 then 
    alt = alt + 1
end

-- write it back, converting to metres * 65536
ipc.writeUD(0x53A4, alt * 6553600 / 3.28084)

Do the same for a file called "AltDec.lua", except change the middle part to

-- Subtract 1 (decrement by 100 feet) if not already zero
if alt > 0 then 
    alt = alt - 1
end

Now all you need to do is assign your INCrement to "Lua AltInc" and your DECrement to "Lua AltDec" in the FSUIPC Buutons tab.

Regards

Pete

Link to comment
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...
 Share

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