Flightdeck Solutions Forum Index Flightdeck Solutions
The place to meet and talk with fellow builders
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Radar Contact

 
Post new topic   Reply to topic    Flightdeck Solutions Forum Index -> Open Discussion
View previous topic :: View next topic  
Author Message
Winstonc



Joined: 09 Mar 2016
Posts: 272
Location: California

PostPosted: Thu Dec 01, 2016 9:56 pm    Post subject: Radar Contact Reply with quote

Here is the scenario.

I am running WideView for my 3 pc/views each with a copy of Prepar3D and FSUIPC (only the master has WideServer enabled). I want to run Radar Contact on my left view pc to spread the load.

I installed RC on the left computer which has a copy of FSUIPC runing (WideServer disabled)

Radar contact runs okay but gets stuck when I have to tune to a com frequency as requested by RC (I have auto tune option off in RC).

I change the frequency on my FDS com1 radio but nothing happens as far as RC is concerned.

I believe this is because the left hand screen computer does not get that frequency (only the master center screen pc).

After some research I found a pair of LUA scripts designed to write the radio offset frequencies from the "master" copy of Prepar3D/FSUIPC to a file that can then be read by a slave copy of Prepar3d/FSUIPC.

This is the LUA script that writes to a file

Code:

-- lua plugin to write updated COM/NAV frequencies and other data to local data.txt file at SERVER
-- this plugin to be located in the SERVER FSX\Modules folder
-- add this lua to the [Auto] section of the SERVER FSUIPC

function processdata(offset, value)

COM1freq = ipc.readUW(0x034E)
COM2freq = ipc.readUW(0x3118)
NAV1freq = ipc.readUW(0x0350)
NAV2freq = ipc.readUW(0x0352)


-- code string, just numbers in order with non-number separators
local value = string.format("COMone=" .. COM1freq .. ",COMtwo=" .. COM2freq .. ",NAVone=" .. NAV1freq .. ",NAVtwo=" .. NAV2freq)

file = io.open("data.txt","w")
file:write(value)
file:close()

end

event.offset(0x034E, "UW", "processdata")
event.offset(0x3118, "UW", "processdata")
event.offset(0x0350, "UW", "processdata")
event.offset(0x0352, "UW", "processdata")


and this is the script that reads from the file into the offsets on the slave screen pc

Code:

-- lua plugin to copy NAV/COM frequencies and other data from data.txt file in Server FSX\Modules to local FSUIPC offsets
-- this plugin to be located in the CLIENT FSX\Modules folder, and is run automatically on a 500 mSec interval (can be changed)
-- add this lua to the [Auto] section of the CLIENT FSUIPC

function processdata(time)

file = io.open("\\PREPAR3DCENTER\LockheedMartin\Prepar3D v3\Modules\data.txt","r")
value = file:read()
file:close()
-- decode string, just numbers in order with non-number separators
w = string.gmatch(value, "[+-]?[0-9%.?]+")

COM1freq = w()
COM2freq = w()
NAV1freq = w()
NAV2freq = w()

ipc.writeUW(0x034E, COM1freq)
ipc.writeUW(0x3118, COM2freq)
ipc.writeUW(0x0350, NAV1freq)
ipc.writeUW(0x0352, NAV2freq)

end

event.timer(500, "processdata")


The write script is working as its creating the data.txt file. However, the frequencies written to it do not reflect what I have input into the FDS radios and I cannot figure out why - Any ideas welcome.

Once I get the correct frequencies written to the data.txt file I can move onto testing the receive LUA script. I am not sure that I have got this line correct in the receive LUA script.

Code:
file = io.open("\\PREPAR3DCENTER\LockheedMartin\Prepar3D v3\Modules\data.txt","r")

in terms of the correct syntax for the master file location (the machine name is PREPAR3DCENTER - If someone could advise.

Once all the above is working I can then see if it solves the Radar Contact problem.

Off course there may be an easier way and again I am open to suggestions.

Once again thanks for any help.

David
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Flightdeck Solutions Forum Index -> Open Discussion All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group