Jump to content
The simFlight Network Forums

Problem with reading PMDG CDU Screen Data offsets using LUA


Recommended Posts

Posted

using LUA I can read PMDG offsets but I have a problem with CDU Screen Data offset 0x5400-0x57FF. Can anyone help me how to read these offsets correctly using LUA script.

Thanks for any help.

Dominik.

Posted

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

Posted
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.

Posted
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.

 

Posted

In the LUA code, I added print (CDU_data) to display this data in the console. CDU_Data is displayed as a string that is constantly changing. Do you need to format this data somehow after reading? In the attachment I am sending the log file.

 

 

FSUIPC7_prev.log

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.