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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • 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.