Jump to content
The simFlight Network Forums

GoFlight GFdisplay - How to display frame rate?


Recommended Posts

I'm hoping someone can help me.

I have spent a good day reading through the GFdisplay manual and have successfully assigned switches and lights on my GoFlight panels using GFdisplay over WideFS.

However, there is just one thing that I can't get right. I want to display the current frame rate (FPS) on my GF45 display. The frame rate offset is 0274. However, the frame rate is calculated by 32768/this value. Dividing 32768 by the raw value of X0274 on my calculator does indeed equate to the correct FPS. The raw value is currently showing on my GF45 display:

[GF45.0]

D0.1=X0274 U16

How do I write the 'code' so that 32768 is divided by this value? Examples that are shown are the other way round - take the offset and then the extra calculations e.g. X7CC U16 *360/65536 (for the autopilot heading).

It's so simple what I want to do but I just can't figure it out! :-0

Best wishes,

Darren Sugden

Link to comment
Share on other sites

I

How do I write the 'code' so that 32768 is divided by this value? Examples that are shown are the other way round - take the offset and then the extra calculations e.g. X7CC U16 *360/65536 (for the autopilot heading).

Sorry, but there isn't any way to do that using GFDisplay alone.

The only way would be to write a little Lua plug-in:

[EDITED TO CORRECT CODE THANKS TO Darren]

while 1 do
   frate = 32768 / ipc.readUW(0x0274)
   ipc.writeUW(0x66C0, frate)
   ipc.sleep(500)
end

Save this in the Modules folder as ipcReady.lua, so it gets loaded and run automatically.

Display the Word from offset 0x66C0 (a user-offset), without any computations.

Regards

Pete

Link to comment
Share on other sites

Thank you, Peter.

Very much appreciated.

Just so that people don't get confused from Peter's example, the code for frames per second is:

while 1 do

frate = 32768 / ipc.readUW(0x0274)

ipc.writeUW(0x66C0, frate)

ipc.sleep(500)

end

Peter used a different offset as his example and missed off a bracket.

Regards,

Darren Sugden

Link to comment
Share on other sites

Peter used a different offset as his example and missed off a bracket.

Oops.Sorry, and thanks! Should take more care. Was rushing off for a flight with friend Ray! ;-)

I'll correct my original too ...

Oh. one other thought. Really you should read 0274 separately and check that it isn't zero, before dividing it into 32768. If it ever is zero, then the overflow error would terminate the Lua plug-in with an error in the log.

So:

    frate = ipc.readUW(0x0274)
    if frate ~= 0 then
        ....
    else
        ....
    end

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.