PA28-161 Piper Warrior Engine Gages

Make requests for others to help test your instruments before they are ready for submission to the store

Moderators: russ, Ralph

Message
Author
gregr75
Posts: 23
Joined: Fri Aug 23, 2019 4:25 pm

PA28-161 Piper Warrior Engine Gages

#1 Post by gregr75 »

Hi All,

Building a Piper Warrior panel and this is my first gage. The "5-pack" oil and fuel gage seen on many PA28-161 piper Warriors in real life. Developed from Russ Green's PA28 gages with some graphic modifications and fixed fuel pressure pegging at 10 psi issue.

While I believe the gage behavior is realistic, I used MSPaint for 90% of the graphic mods, and zooming in close on gage graphics will show some editing artifacts. I'm welcome to comments/criticism. I'd love to get this added to community instruments since there's not a lot for piper warrior.

Tests good with JustFlight Piper Warrior and Native C172. X-plane only for now.

Greg
Warrior Engine Cluster.jpg
Attachments
Warrior Engine Cluster.siff
(177.35 KiB) Downloaded 309 times

SimPassion
Posts: 5336
Joined: Thu Jul 27, 2017 12:22 am

Re: PA28-161 Piper Warrior Engine Gages

#2 Post by SimPassion »

We are mainly using SkinMan which give nice results for graphics
There's tutos made by Russ and many discussions here on the forums

Gilles

SimPassion
Posts: 5336
Joined: Thu Jul 27, 2017 12:22 am

Re: PA28-161 Piper Warrior Engine Gages

#3 Post by SimPassion »

I've omitted to mention I will check your gauge

Gilles
Last edited by SimPassion on Mon Dec 12, 2022 12:03 am, edited 1 time in total.

User avatar
Sling
Posts: 5237
Joined: Mon Sep 11, 2017 2:37 pm
Contact:

Re: PA28-161 Piper Warrior Engine Gages

#4 Post by Sling »

Welcome,

You have got to start somewhere so good on you for having a go. We could always do with people developing new instruments. I’ll take a look.

Tony

User avatar
Sling
Posts: 5237
Joined: Mon Sep 11, 2017 2:37 pm
Contact:

Re: PA28-161 Piper Warrior Engine Gages

#5 Post by Sling »

Good effort Greg. The graphic editing was hardly noticeable unless the instrument is made large. I think at the sort of size you would have this on a panel It looks just fine. Everything seems to be working but I don't have that exact aircraft so was testing with the default C172.

If I could give you one tip moving forward it would be to try and make the code look a little better when viewed with the AM editor. I do a lot of my basic editing and looking at code for others with the inbuilt editor now as its so convenient. I have my 'Tab to spaces size' set to 4 to match my external editor and that ensures they look consistent. The tab to spaces size can be set by clicking the little gear wheel on the upper right side of the Create/Edit tab. It helps to indent the code as you have done, but it looks more consistent if its a single tab(4 spaces) between each indent level and any associated comments are also indented to the same level as the code, a bit like the sample below. The forum code window does make the indents look a big bigger than they actually do in the editor but you get the idea.

Great first instrument.

Tony

Code: Select all

local var = 0

function name(input)

	if input == 1 then
		--true comment here
		print("true")
	else
		--false comment here
		print("false")
	end
end

name(var)


gregr75
Posts: 23
Joined: Fri Aug 23, 2019 4:25 pm

Re: PA28-161 Piper Warrior Engine Gages

#6 Post by gregr75 »

Thanks for the feedback Tony, I can cleanup my code format per above, do you think the instrument is ready for submittal then?

greg

SimPassion
Posts: 5336
Joined: Thu Jul 27, 2017 12:22 am

Re: PA28-161 Piper Warrior Engine Gages

#7 Post by SimPassion »

Hello Greg

I don't see any issue in the graphics assuming we are seeing the instrument in the distance, but nothing noticeable when watching from nearest able

I've made three modifications to simplify the script
hope it could help

Gilles

Code: Select all

-----------------------------------------------------------------------
-- Author: Greg Ryan
-- Based on work by Russ Green
---------------------------------------------------------------------------

-------------------------------------
--     Load and display images     --
-------------------------------------
img_add_fullscreen("EnginerCluster_Fuel.png")
img_needle_Fuel_L = img_add("Needle.png",46,50,200,200)
img_needle_OilT = img_add("Needle.png",339,50,200,200)
img_needle_Fuel_P = img_add("Needle.png",631,50,200,200)
img_needle_OilP= img_add("Needle.png",923,50,200,200)
img_needle_Fuel_R = img_add("Needle.png",1215,50,200,200)
img_add_fullscreen("EngineClusters_Bezel.png")

function new_data(batt, fuelpres, fuelq, opress_xpl, otemp_xpl)

	fuelpressure = var_cap(fuelpres[1], 0, 30)
--X-plane fuelpressure dataref runs too high (20-30 psi) so increased upper limit to 30 capture the fluctuation
	fuel_left = var_cap(((fuelq[1]* 2.20462) / 6.0), 0, 24)
	fuel_right = var_cap(((fuelq[2]* 2.20462) / 6.0), 0, 24)
	oilt = var_cap(otemp_xpl[1], 75, 260)	-- Replaced variable assignment to make it simple
	oilp = var_cap(opress_xpl[1], 0, 100)	-- Replaced variable assignment to make it simple

	fuelp = fuelpressure*.2	-- Moved line to avoid making assignment twice
--0.2 seems about right. Knocks the fuel pressure down to 4-6 psi which we can now see on the 0-10 psi gage.

	if (batt[1] == 1) then
		left = fuel_left
		right = fuel_right
	else
		left = 0
		right = 0
	end

	if fuelp >= 0 and fuelp <= 5 then
		rotate(img_needle_Fuel_P, 36/5 * (fuelp) - 36)
	elseif fuelp > 5 then
		rotate(img_needle_Fuel_P, 42/5 * (fuelp) - 42)
	end

	if left >= 0 and left <= 10 then
		rotate(img_needle_Fuel_L, 22/5 * (left) - 34)
	elseif left > 10 then
		rotate(img_needle_Fuel_L, 2 * (left) - 10)
	end

	if right >= 0 and right <= 10 then
		rotate(img_needle_Fuel_R, 22/5 * (right) - 34)
	elseif right > 10 then
		rotate(img_needle_Fuel_R, 2 * (right) - 10)
	end

	if oilt >= 75 and oilt <= 180 then
		img_rotate(img_needle_OilT, 2/5 * (oilt) - 66)
	elseif oilt > 180 then
		img_rotate(img_needle_OilT, 7/20 * (oilt) - 57)
	end

	if oilp >= 0 and oilp <= 60 then
		img_rotate(img_needle_OilP, 7/10 * (oilp) - 36)
	elseif oilp > 60 then
		img_rotate(img_needle_OilP, 29/40 * (oilp) - 75/2)
	end

end

-- Subscribe to variables and datarefs					  
xpl_dataref_subscribe("sim/cockpit/electrical/battery_array_on", "INT[8]", 
					"sim/cockpit2/engine/indicators/fuel_pressure_psi", "FLOAT[8]",
					"sim/flightmodel/weight/m_fuel", "FLOAT[8]", 
					"sim/cockpit2/engine/indicators/oil_pressure_psi","FLOAT[8]",
					"sim/cockpit2/engine/indicators/oil_temperature_deg_C","FLOAT[8]",
					new_data)
PA-28-161_Engines_Instrument.jpg

User avatar
Sling
Posts: 5237
Joined: Mon Sep 11, 2017 2:37 pm
Contact:

Re: PA28-161 Piper Warrior Engine Gages

#8 Post by Sling »

gregr75 wrote: Mon Aug 26, 2019 3:09 pm Thanks for the feedback Tony, I can cleanup my code format per above, do you think the instrument is ready for submittal then?

greg
Go for it.

gregr75
Posts: 23
Joined: Fri Aug 23, 2019 4:25 pm

Re: PA28-161 Piper Warrior Engine Gages

#9 Post by gregr75 »

Thanks guys, will do

fhamoudi
Posts: 6
Joined: Tue Feb 23, 2021 11:29 pm
Location: London

Re: PA28-161 Piper Warrior Engine Gages

#10 Post by fhamoudi »

Good morning all and Happy New Year.

I was wondering how I can add a function and correct subscription to this panel for MSFS2020?

I would like to incorporate two panels I found on the forum by Russ Green (Fuel and Oil Temp, Pressure) designed to work on XPlane.

Any help would be much appreciated.

Kind regards

Feras

Post Reply