Jump to content
The simFlight Network Forums

Outputs from fsuipc dont follow lvars


Recommended Posts

Hello,
i am continuing to implement my maddogX. I managed to get also the IPC.lvar of the fuel quantity from the maddog team but I am noticing that the assignment of the output digits does not perfectly follow the output sent by fsuipc. The variable
it is assigned via offset lvar, but it seems to overlap values between them. Would anyone know how to help me?

I thank


- ################ FQTY
function md_ipc_fuelleft (varname, value) ipc.writeSTR (0x6950, value) end
function md_ipc_fuelright (varname, value) ipc.writeSTR (0x6954, value) end
function md_ipc_fuelcenter (varname, value) ipc.writeSTR (0x6958, value) end
function md_ipc_fueltotal (varname, value) ipc.writeSTR (0x696C, value) end
function md_ipc_weight (varname, value) ipc.writeSTR (0x6960, value) end


- ################ FQTY
event.Lvar ("md_ipc_fuelleft", lvps, "md_ipc_fuelleft") - (string) | substring with offset = 0x6950 | type = string | size = STR, 4 | substring 0 - 4
event.Lvar ("md_ipc_fuelright", lvps, "md_ipc_fuelright") - (string) | substring with offset = 0x6954 | type = string | size = STR, 4 | substring 0-4
event.Lvar ("md_ipc_fuelcenter", lvps, "md_ipc_fuelcenter") - (string) | offset = 0x6958 | type = string | size = STR, 4 | substring 0 - 4
event.Lvar ("md_ipc_fueltotal", lvps, "md_ipc_fueltotal") - (string) | offset = 0x696C | type = string | size = STR, 5 | substring 0 - 5
event.Lvar ("md_ipc_weight", lvps, "md_ipc_weight") - (string) | offset = 0x6960 | type = string | size = STR, 5 | substring 0 - 5

 

thanks

Simone

Link to comment
Share on other sites

Lvars are, by default, 8 bytes (64 bits).  If the strings aren't null terminated, ipc.writeSTR will write 8 bytes.

There are two things you could try - specifying the length of the string in the ipc.writeSTR function call, e.g.
     ipc.writeSTR (0x6950, value, 4)

You could also try logging the value, to see what is actually being received and written to the offsets, e.g.

function md_ipc_fuelleft (varname, value)
    ipc.log("md_ipc_fuelleft: received value '" .. value .. "' for lvar " .. varname)
    ipc.writeSTR (0x6950, value, 4)
end

Later: and this:
 

53 minutes ago, sisoffi said:

event.Lvar ("md_ipc_fueltotal", lvps, "md_ipc_fueltotal") - (string) | offset = 0x696C | type = string | size = STR, 5 | substring 0 - 5

should probably be:
    event.Lvar ("md_ipc_fueltotal", lvps, "md_ipc_fueltotal") - (string) | offset = 0x695C | type = string | size = STR, 5 | substring 0 - 5

BUT, you are also using an offset area that is not documented as free for general use - it is Reserved. Try with offsets free for general use, e.g. try from 66C0 or A000.

Edited by John Dowson
Further info added
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.