Jump to content
The simFlight Network Forums

Problem with reading PMDG CDU Screen Data offsets using LUA


Dominik

Recommended Posts

How do you want to read this data, and what do you want to do with it?
If you want to read all of the CDU data, you can do this using a multi-dimensional array.  Something like:
 

-- Define the size of the array - we will start are indeces at 0 to make offset calculation easier
CDU_Colums = 24 - 1
CDU_Rows = 14 - 1

-- Initializing the array
CDU_data = {}

for i=0,CDU_Colums do
   CDU_data[i] = {}
	
   for j=0,CDU_Rows do
      CDU_data[i][j] = 0
   end
end

-- Read the data: 0x5400 == 21504 in decimal
for i=0,CDU_Colums do
   for j=0,CDU_Rows do
     CDU_data[i][j] = ipc.readUB(21504 + i + (j*(CDU_Colums+1)))
   end
end

I haven't tried this!

John

Link to comment
Share on other sites

5 hours ago, John Dowson said:

How do you want to read this data, and what do you want to do with it?

It uses LUA to read the offsets and write this data as text to a txt file. The second program reads this data from the txt file and sends it to the Arduino. My point is to use LUA to read the text lines on the CDU and save them as text in a txt file. Then the second program will read this data from the txt file and send it to the Arduino.

Link to comment
Share on other sites

1 minute ago, Dominik said:

t uses LUA to read the offsets and write this data as text to a txt file. The second program reads this data from the txt file and sends it to the Arduino. My point is to use LUA to read the text lines on the CDU and save them as text in a txt file. Then the second program will read this data from the txt file and send it to the Arduino.

The lua example I showed you should do the first part -  you need to add the ability to write out the CDU_data array variable to a text file.

 

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.