Jump to content
The simFlight Network Forums

Reading the state of lights in PMDG 737


Recommended Posts

Hi,

I searched the forum before I post and I saw that someone tried to communicate the Lua script and Arduino. We're sharing the same purposes.

Let me say the problem I deal: For PMDG 737,  I can control any button, switch in the simulation by sending data from Arduino to Lua script. Also, I have no problem to send data from Lua script to Arduino by using Lvar list in FSUIPC documents.

However, I can't read the state of any warning light as Overheat Lights in the overhead panel.

Only need to know, what should be the way of reading the state of lights in PMDG 737.

If there is a small example or showing a way to go, I will be grateful 🙂 

Link to comment
Share on other sites

1 hour ago, _albatros_ said:

However, I can't read the state of any warning light as Overheat Lights in the overhead panel.

Only need to know, what should be the way of reading the state of lights in PMDG 737.

There is a list of offsets for the PMDG 737NGX is your FSUIPC Documents folder. In a Lua program you read offsets using the ipc.readXX set of functions (where XX is the type, like UB, UD etc). Of you can use event.offset or event.offsetmask to react to changes.

Pete

 

Link to comment
Share on other sites

Thanks a lot for replying quickly.

I've already found the list. And, I tried to use ICE_annunFO_PITOT which has 64B2 offset in following code lines seperately:

n = ipc.readUB(64B2)
print(n)

and 

n = ipc.readUB('64B2')
print(n)

and

function fo_pitot_led(offset, value)
print(value)
if value == 0 then
print("state 0")
else
print("state 1")
end
end
 
event.offset(64B2, "UB", "fo_pitot_led")

When I switch the Probe heat, the LED in P3D is on, and the script still returning 0. What's the point I'm missing ?

Edited by _albatros_
wrong emoji used.
Link to comment
Share on other sites

Pete, I tried a few minutes ago. Result is the same. It always returning 0 😕
function fo_pitot_led(offset, value)
   print(value)
   if value == 1 then
   print("state 1")
   else
   print("state 0")
   end
end
 
event.offset(25778, "UB", "fo_pitot_led")

 

 

Link to comment
Share on other sites

45 minutes ago, _albatros_ said:

Pete, I tried a few minutes ago. Result is the same. It always returning 0 😕

Are any of the offsets fulfilled? Did you enable them in the PMDG SDK as described at the beginning of the offsets document( the "PLEASE READ THIS FIRST" section)?

BTW there are also parameters in the FSUIPC INI file to switch the action on and off, but they default to "Auto".  Check for "PMDG737offsets". you can set it to "Yes", "Auto" or "No". The Auto mode depends on detecting the PMDG aircraft by its original name.

I cannot really support PMDG aircraft. I don't even have any installed. The offsets are mapped directly from the data supplied by the code in the PMDG software, so if they don't work even when enabled you may want to ask in their forums.

Pete

 

Link to comment
Share on other sites

Quote

Are any of the offsets fulfilled? Did you enable them in the PMDG SDK as described at the beginning of the offsets document( the "PLEASE READ THIS FIRST" section)?

I missed it. Now, it's done. I checked whether my code works, it doesn't make any sense 😞  

Quote

BTW there are also parameters in the FSUIPC INI file to switch the action on and off, but they default to "Auto".  Check for "PMDG737offsets". you can set it to "Yes", "Auto" or "No". The Auto mode depends on detecting the PMDG aircraft by its original name.

 

I couldn't see anything related 'PMDG'. Can you check my file?

FSUIPC5.ini

The thing makes me confused is that: I can use readLvar to check the LED's on the MCP. It works well. For example:

if ipc.readLvar("L:ngx_MCP_CMDA") == 1 then
   ipc.display("1")
   print("MCP_CMDA_ON")
else
   ipc.display("0")
   print("MCP_CMDA_OFF")
end
Edited by _albatros_
Link to comment
Share on other sites

17 minutes ago, _albatros_ said:

it doesn't make any sense 😞  

In what way?

18 minutes ago, _albatros_ said:

I couldn't see anything related 'PMDG'. Can you check my file?

Ouch! You are still using one of the first versions of FSUIPC5 and P3D 4.0. Why have you never updated?

Sorry. The currently supported version of FSUIPC is 5.15 or later, and you need to be on P3D4.1 or later -- current is 4.4.

20 minutes ago, _albatros_ said:

The thing makes me confused is that: I can use readLvar to check the LED's on the MCP.

LVars are totally unrelated. Why confusing?

Pete

 

Link to comment
Share on other sites

Quote

In what way?

I mean it didn't work.

15 minutes ago, Pete Dowson said:

The currently supported version of FSUIPC is 5.15 or later,

Okey, I'm updating immediately 🙂 

15 minutes ago, Pete Dowson said:

LVars are totally unrelated. Why confusing?

I thought that if I reach that offsets, that shows it's accessible for other code lines which are written for same purpose. 

Link to comment
Share on other sites

6 hours ago, _albatros_ said:

I thought that if I reach that offsets, that shows it's accessible for other code lines which are written for same purpose. 

There may well be L:Vars for what you want. I don't know. Did you check? You can list all the L:Vars using an assignable FSUIPC control or monitor them with one of the Lua examples provided.

Pete

 

Link to comment
Share on other sites

Quote

There may well be L:Vars for what you want. I don't know. Did you check? You can list all the L:Vars using an assignable FSUIPC control or monitor them with one of the Lua examples provided.

I saw your code in examples 🙂 

Lvars worked well. I think Lvars makes code so clear. After all, I still want to use offset and ipc.readXX commands.

Now, programs are upgrading to the new versions. If it works, nothing would be better than 🙂

By the way, thank you so much Pete 

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.