Skip to content
View in the app

A better way to browse. Learn more.

The AVSIM Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Working on HGJ Mercure AP with a HDG problem (deg vs rad)

Featured Replies

Hi, I'm now trying to make a HGJ Mecure module for my own use, mostly for AutoPilot function, so far so good, the only problem is Heading bug

I use:

function DM_HDG_dec()
    local HDG = ipc.readLvar("L:HDG HOLD")
    HDG = HDG - 1
    if HDG < 0 then
        HDG = 359
    end
    ipc.writeLvar("L:HDG HOLD",HDG)
end

function DM_HDG_inc()
    local HDG = ipc.readLvar("L:HDG HOLD")
    HDG = HDG + 1
    if HDG > 359 then
        HDG = 000
    end
    ipc.writeLvar("L:HDG HOLD",HDG)
end

To input heading knob, while the heading window on AP panel shows correct and AP flies what shown here in degree, the BUG on HSI jumps about 50 more degree (about exactly 1 radian:57.30degree if it's a coincidence),

I jumped into the gauges' xml, and find in AP panel, the xml is use: (L:HDG HOLD,degrees), but in HSI it uses: (L:HDG HOLD,radians). I can't simply change them as they also interact with other elements in their space.

eg:

HSI:
	<Element>
		<Position X="125.5" Y="126.5"/>
		<Image Name="HSI_POINTER_HDG.bmp" Luminous="Yes">
			<Axis X="5.5" Y="86.5"/>
		</Image>
		<Rotate>
			<Value>(L:HDG HOLD,radians) (L:VG2_HDG,number) -</Value>
		</Rotate>
	</Element>

AP:
		<Area Left="206" Top="67" Height="20" Width="10" >
			<Tooltip>HDG Sel Inrease</Tooltip>
			<Cursor Type="UpArrow"/>
			<Click>
				(L:HDG HOLD,degrees) 359 &lt; if{ (L:HDG HOLD,degrees) 1 + (&gt;L:HDG HOLD,degrees) } els{ 0 (&gt;L:HDG HOLD,degrees) }
				7 (&gt;L:Mercure_knob, number)
			</Click>
		</Area>


 

Seems if I use LINDA (or FSUIPC in general) to send "ipc.writeLvar("L:HDG HOLD",HDG)" both of them will recive the number, and as what it think it is, thus makes this problem, if I use mouse click on panel, it will know it's now on degrees and pass radians to HSI correctly.

After few hours of researching, I was able to make XML edit (in MN_Mercure, HSI_PILOT.xml and HSI_COPILOT.xml) to make it works for me :

	<Element>
		<Position X="125.5" Y="126.5"/>
		<Image Name="HSI_POINTER_HDG.bmp" Luminous="Yes">
			<Axis X="5.5" Y="86.5"/>
		</Image>
		<Rotate>
			<Value>!lua return dgrd(d360(varget("L:HDG HOLD","degrees") - rddg(varget("L:VG1_HDG","number"))))</Value>
		</Rotate>
	</Element>

 

But still,I would prefer just only make a better LINDA profile rather than have to edit the xml, and ideas?

 

Edited by C2615

  • Author

Here is full action.lua I got so far, for anyone who want a try, BTW the FD, AT and AP master are mostly using FSUIPC default control, so I don't included here:

-- EMPTY TEMPLATE -- 
-- Fill with what functions you need --


-- ## System functions ##

function InitVars ()

    -- uncomment to disable display
    -- AutopilotDisplayBlocked ()
end 

-- ## GEAR
function DM_GEAR_UP()
    ipc.writeLvar("L:GEAR_LEVER",0)
end

function DM_GEAR_OFF()
    ipc.writeLvar("L:GEAR_LEVER",1)
end

function DM_GEAR_DN()
    ipc.writeLvar("L:GEAR_LEVER",2)
end

-- ## AP ROLL

function DM_HDG_dec()
    local HDG = ipc.readLvar("L:HDG HOLD")
    HDG = HDG - 1
    if HDG < 0 then
        HDG = 359
    end
    ipc.writeLvar("L:HDG HOLD",HDG)
end

function DM_HDG_inc()
    local HDG = ipc.readLvar("L:HDG HOLD")
    HDG = HDG + 1
    if HDG > 359 then
        HDG = 000
    end
    ipc.writeLvar("L:HDG HOLD",HDG)
end

function DM_AP_LAND()
    ipc.writeLvar("L:AUTOPILOT_AUTOLAND",1)
    ipc.writeLvar("L:AUTOPILOT_GA",0)
end

function DM_AP_ILS()
    ipc.writeLvar("L:AUTOPILOT_ILS",1)
    ipc.writeLvar("L:AUTOPILOT_VOR",0)
    ipc.writeLvar("L:AUTOPILOT_GA",0)
end

function DM_AP_VOR()
    ipc.writeLvar("L:AUTOPILOT_VOR",1)
    ipc.writeLvar("L:AUTOPILOT_ILS",0)
    ipc.writeLvar("L:AUTOPILOT_GA",0)
end

function DM_AP_TURB()
    ipc.writeLvar("L:AUTOPILOT_TURB",1)
    ipc.writeLvar("L:AUTOPILOT_ILS",0)
    ipc.writeLvar("L:AUTOPILOT_VOR",0)
    ipc.writeLvar("L:AUTOPILOT_PSH",0)
    ipc.writeLvar("L:AUTOPILOT_GA",0)
end

function DM_AP_PSH()
    ipc.writeLvar("L:AUTOPILOT_PSH",1)
    ipc.writeLvar("L:AUTOPILOT_GA",0)
end

function DM_AP_RCLR()
    ipc.writeLvar("L:AUTOPILOT_AUTOLAND",0)
    ipc.writeLvar("L:AUTOPILOT_ILS",0)
    ipc.writeLvar("L:AUTOPILOT_VOR",0)
    ipc.writeLvar("L:AUTOPILOT_TURB",0)
    ipc.writeLvar("L:AUTOPILOT_PSH",0)
    ipc.writeLvar("L:AUTOPILOT_GA",0)
end

-- ## AP PITCH
function DM_ALT_dec()
    local ALT = ipc.readLvar("L:ALT_HOLD_VAR")
    ALTN = ALT - 100
    if ALTN < 1 then
        ALTN = 0
    end
    ipc.writeLvar("L:ALT_HOLD_VAR",ALTN)
end

function DM_ALT_inc()
    local ALT = ipc.readLvar("L:ALT_HOLD_VAR")
    ALTN = ALT + 100
    if ALTN > 49800 then
        ALTN = 49900
    end
    ipc.writeLvar("L:ALT_HOLD_VAR",ALTN)
end


function DM_AP_IAS()
    ipc.writeLvar("L:AUTOPILOT_IAS",1)
    ipc.writeLvar("L:AUTOPILOT_GA",0)
    ipc.writeLvar("L:AUTOPILOT_ALTH",0)
end

function DM_AP_ALTH()
    ipc.writeLvar("L:AUTOPILOT_ALTH",1)
    ipc.writeLvar("L:AUTOPILOT_GA",0)
    ipc.writeLvar("L:AUTOPILOT_ALTS",0)
    ipc.writeLvar("L:AUTOPILOT_IAS",0)
end

function DM_AP_ALTS()
    ipc.writeLvar("L:AUTOPILOT_ALTS",1)
    ipc.writeLvar("L:AUTOPILOT_GA",0)
    ipc.writeLvar("L:AUTOPILOT_ALTH",0)
end

function DM_AP_PCLR()
    ipc.writeLvar("L:AUTOPILOT_IAS",0)
    ipc.writeLvar("L:AUTOPILOT_ALTH",0)
    ipc.writeLvar("L:AUTOPILOT_ALTS",0)
    ipc.writeLvar("L:AUTOPILOT_GA",0)
end

function DM_AP_GA()
    ipc.writeLvar("L:AUTOPILOT_GA",1)
end

-- ## AP PANEL
function DM_AP_MAN()
    ipc.writeLvar("L:AP_MASTER",1)
end

function DM_AP_OFF()
    ipc.writeLvar("L:AP_MASTER",0)
end

 

Hi @C2615 I can't find any reference to a HGJ Mercure aircraft. Do you have a link?

You don't say which Flt Sim you are using. This will help me provide a more targeted answer.

I would look at an alternative HDG Lvar for the HSI to cope with the radians. Also if you are working with MSFS 2020 then I would look for an Event (Hvar or .EVT) that set the HDG value.

Andrew Gransden

Scotland, UK

LINDA Support/Developer - VATSIM and BAVirtual - Airbus Flyer

i7 1TB SSD GTX980 - FSX/P3D - Aerosoft Airbus A318/A319/A320/A321 - FS2Crew

  • Author
2 hours ago, ScotFlieger said:

Hi @C2615 I can't find any reference to a HGJ Mercure aircraft. Do you have a link?

You don't say which Flt Sim you are using. This will help me provide a more targeted answer.

I would look at an alternative HDG Lvar for the HSI to cope with the radians. Also if you are working with MSFS 2020 then I would look for an Event (Hvar or .EVT) that set the HDG value.

You can find free HGJ Mercure here:

https://simviation.com//hjg/aircraft2/dassault/dassault.htm

And here is how to use it in 64bit P3D, I now run it in v4.5HF3:
 
I don't have any SDKs, all Lvar was found using LINDA Console and Tracer

I no longer have a licence for P3Dv4.5 so can not install the aircraft to investigate. However here are a few trips.

The LINDA Tracer is the best place to start. By setting up watches on likely Lvars you can see how they change when items in the cockpit are operated. Lvars can be both read and write but can also be read only allowing you to read current values.

Also check out possible Offsets by referring to the FSUIPC documentation. This is particularly the case when dealing with the AP. Additionally see what effect certain FSUIPC Controls have either on their own or with a parameter.

Your current functions are looking good to me. To test functions being developed, you can right click on the function name to immediately execute the, without having to assign them to a button.

Andrew Gransden

Scotland, UK

LINDA Support/Developer - VATSIM and BAVirtual - Airbus Flyer

i7 1TB SSD GTX980 - FSX/P3D - Aerosoft Airbus A318/A319/A320/A321 - FS2Crew

Archived

This topic is now archived and is closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.