Jump to content
The simFlight Network Forums

Lvar to offset problem


dmordogan
 Share

Recommended Posts

Hello

I wanted to get door open lvar (DOOR_MAIN_DOOR_POS) to offset linked to the door (3367)

I tried these to manage it on Fsuipc7.ini file

[LvarOffsets.CRJ]
0=DOOR_MAIN_DOOR_POS=UD 0x3367

[LvarOffsets.CRJ]
0=DOOR_MAIN_DOOR_POS=UD 3367

[LvarOffsets.CRJ]
0=DOOR_MAIN_DOOR_POS=UD 15x3367

also i tried to use size as SB and SW

but no luck

What do i do wrong?

Thank you.

 

Link to comment
Share on other sites

9 minutes ago, dmordogan said:

What do i do wrong?

Several things...!
First, check that the lvar exists - is it listed when you list the available lvars (Add-ons->WASM->List Lvars menu option)?

If so, good. If not, the lvar doesn't exist, or has not been registered with FSUIPC. If the latter, you could try reloading the lvars after load (using the Add-ons->WASM->Reload menu option). If thats the case (i.e. the lvar is created AFTER FSUIPC requests the lvar list), then you can increase the LvarScanDelay WASM ini parameter (just noticed the name is missing in the Advanced User Guide - I will correct).

Then, you are specifying that the value should be written to offset 3367 (or trying to...). This is NOT a user offset. For lvars, you need to add them to free user offsets (e.g. starting at A000 or 66C0, etc).

And no spaces between the size an offset address (or though this may be allowed, I forget...but it IS NOT as specified to use, so best not to include spaces).

Also, check what the value of that lvar holds - if its an integer (unsigned), then use UW, if signed, use SW, if just a flag (0 or 1), use UB.

Link to comment
Share on other sites

our flight management system reads values via psuipc offsets to determine flight status

but in msfs there is no door value (3367 offset is empty)

thats why system cannot see the door is open

I though that if i can get Lvar(DOOR_MAIN_DOOR_POS) value to the offset(3367) then system can read it

and the other problem is in Lvar when door is closed value=0 but if it is open value=100

I thing offset value can be 0 or 1

Link to comment
Share on other sites

1 minute ago, dmordogan said:

I though that if i can get Lvar(DOOR_MAIN_DOOR_POS) value to the offset(3367) then system can read it

No, you cannot do this. You can 'spoof' the value in that offset to the lvar value if thats what you need to do. I have recently posted a lua script on how to do this for the Parking Brake offset in this post: 

If you want to spoof the value of offset 0x3367 to the lvar L:DOOR_MAIN_DOOR_POS, take the lua from that thread and adjust as needed.

3 minutes ago, dmordogan said:

this lvar is exist 

Then check the other issues I mentioned.

Link to comment
Share on other sites

5 minutes ago, dmordogan said:

and the other problem is in Lvar when door is closed value=0 but if it is open value=100

You can adjust for this in the lua script. Once the lvar value is read, just change it to the correct value in the lua script before writing.

Link to comment
Share on other sites

1 minute ago, John Dowson said:

You can adjust for this in the lua script. Once the lvar value is read, just change it to the correct value in the lua script before writing.

I understand that 3367 is not a user offset 

that means we cannot change it even there is no value for that in msfs?

if i would spoof it via lua script and change then can i write it to the offset 3367 with lua?

Link to comment
Share on other sites

our flight management system is reading door status from 3367 offset via fsuipc 

I want to write  DOOR_MAIN_DOOR_POS Lvar value to 3367 offset 

As i understand it is possible to write it jjust only via lua script right?

 

Link to comment
Share on other sites

Just now, dmordogan said:

if i would spoof it via lua script and change then can i write it to the offset 3367 with lua?

No!

What this does IS to write the value to the lvar offset...well, not exactly, what it does is that when ANYTHING (almost, see the description for offset 0024) reads that value, it will read the spoofed value. Just try it!

Link to comment
Share on other sites

Just now, dmordogan said:

our flight management system is reading door status from 3367 offset via fsuipc 

I want to write  DOOR_MAIN_DOOR_POS Lvar value to 3367 offset 

As i understand it is possible to write it jjust only via lua script right?

I have already explained how to do this....

What don't you understand?

Link to comment
Share on other sites

6 minutes ago, dmordogan said:

ok thank you very much for information i will try something according to you advices

Ok. But note that offset 3367 is a byte-oriented offset. So the value in each bit is a different door. So, a value of 100 is 0b1100100, so that is doors exit3, exit6 and exit7.
Write the appropriate value (for the doors you want to control) from the relevant lvars. i.e. if different doors are different lvars, they are distinct bits on the offset.

Link to comment
Share on other sites

1 minute ago, John Dowson said:

Ok. But note that offset 3367 is a byte-oriented offset. So the value in each bit is a different door. So, a value of 100 is 0b1100100, so that is doors exit3, exit6 and exit7.
Write the appropriate value (for the doors you want to control) from the relevant lvars. o.e. if different doors are different lvars, they are distinct bits on the offset.

I am planning to change tha value of Lvar   "value/100"  then when door closed value =0/100=0  when door open value=100/100=1 and then trying to bind the offset like you did A320ParkBrake.lua to the 0x3367

Link to comment
Share on other sites

Just now, dmordogan said:

am planning to change tha value of Lvar   "value/100"  then when door closed value =0/100=0  when door open value=100/100=1 and then trying to bind the offset like you did A320ParkBrake.lua to the 0x3367

Be aware:

3367 1 This byte shows doors that are open, one bit per door:
2^0 = Exit1 … 2^3 = Exit 4.

 

Link to comment
Share on other sites

Just now, dmordogan said:

I am planning to change tha value of Lvar   "value/100"  then when door closed value =0/100=0  when door open value=100/100=1 and then trying to bind the offset like you did A320ParkBrake.lua to the 0x3367

and value is 0 or 1 then i should use UB size for that i suppose

Link to comment
Share on other sites

1 minute ago, dmordogan said:

and value is 0 or 1 then i should use UB size for that i suppose

No!

Please re-read my posts....

It is a 1 byte offset, but each bit in that byte represents a value, 0 or 1, depending if the door for that bit is open or closed

....you seem to be posting many messages before I can respond...I suggest you read my posts and digest first....

 

Link to comment
Share on other sites

Just now, John Dowson said:

No!

Please re-read my posts....

It is a 1 byte offset, but each bit in that byte represents a value, 0 or 1, depending if the door for that bit is open or closed

....you seem to be posting many messages before I can respond...I suggest you read my posts and digest first....

 

"....you seem to be posting many messages before I can respond...I suggest you read my posts and digest first...."

sorry for that

Link to comment
Share on other sites

4 minutes ago, dmordogan said:

as i understand of this 0x3367 is exit1 1x3367 is exit2 etc

No! That is, sorry, just rubbish. 0x prefix indicates hexadecimal. 0b binary. 0x3367 is the offset address, which is 1 byte, 8 bits. We are talking about bits here...
Sorry, but you are obviously not  computer literate. Please just follow my advise....

Link to comment
Share on other sites

Each door is a separate bit (i.e. a 0 or 1 value) in offset address 0x3367, which is 1 byte, thus holding the state for 8 doors (Exit1 to Exit8). You need to write the byte value (i.e all 8 doors) to the offset, and each bit in that value will control doors 1-8 (or those that actually exist)

Link to comment
Share on other sites

10 minutes ago, John Dowson said:

No! That is, sorry, just rubbish. 0c indicates hexadecimal. 0b binary. )c3367 is the offset address, which is 1 byte, 8 bits. We are talkimng about bits here...
Sorry, but you are obviously not  computer literate. Please just follow my advise....

I am sorry about that

I came from x-plane and wrote many lua script there but here is different there is a concept "offset" which i am trying to understand

 

Link to comment
Share on other sites

22 minutes ago, dmordogan said:

I came from x-plane and wrote many lua script there but here is different there is a concept "offset" which i am trying to understand

An offset is just a memory starting address. You also need to consider the size (1 byte in this instance) and the data that it holds (bit-oriented flags for that offset address).
I'm sorry, but this is not the place for a tutorial on these concepts - there is google (or other search engines) to help you with basic understanding, And I'm sure its the same in xplane/xuipc. You just need to understand the concept of bit-wise flags. Its really not that difficult. Try by re-reading what I have explained. And, if you still don't understand, just do it by example: log the offset values for the different states, and write the value for the state you need when necessary....

Link to comment
Share on other sites

Maybe an example will help you....
Door 1 is bit 0, so to open just that door, you would set bit 0, i.e. write 0x1, or just 1.
Door 2 is bit 1, so to open just that door, you would set bit 1, i.e. write 0x2, or just 2.
Door 3 is bit 2, so to open that door, you would set bit 2, i.e. write 0x4, or just 4

If you write 0x3, or just 3, that is 0b11, so that would open doors 1 and 2 (bits 0 and 1 set).

So, as I said, if you write 100 (in decimal), that is in binary 0b1100100, which is:
   - door 1 closed 0b1100100 - bold is bit 0
   - door 2 closed  0b1100100 -  bold is bit 1
   - door 3 open  0b1100100 - bold is bit 2
   - etc

To change single doors, you need to read the offset value as it is, then change the bit (using the lua logic library) for the door you want to control.
You should or the original value with the bit flag you want to set, or and to clear.

I understand this may sound advanced for your understanding, but it really isn't that difficult. If you can tell me exactly want you want to achieve (i.e which aircraft and, if applicable, which mod, and which doors) then I can maybe help you further if you have issues.

John

[Note some folks call bit 0 bit 1, which is confusing. But you can usually tell by context]

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.