Grob Tutor gauges coding

Help creating logic scripts for Air Manager Instruments

Moderators: russ, Ralph

Message
Author
User avatar
CI Dan Saxton
Posts: 51
Joined: Mon Apr 30, 2018 4:07 pm

Grob Tutor gauges coding

#1 Post by CI Dan Saxton »

Hi everyone,

I'm in the process of creating a full set of Grob Tutor gauges (see example below), but the script code is alien to me.
I've tried watching the youtube videos, but i'm just not getting it quick enough.

I'm hoping there's someone out there that I could work with to get these working in P3D V4, please?

Many thanks in advance,

Dan

Image

User avatar
Ralph
Posts: 7921
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: Grob Tutor gauges coding

#2 Post by Ralph »

For this instrument you might want to watch this video: https://www.youtube.com/watch?v=gfABSyd5KsA
I would also suggest giving the needle some shadow, so it doesn't disappear in the background.

User avatar
CI Dan Saxton
Posts: 51
Joined: Mon Apr 30, 2018 4:07 pm

Re: Grob Tutor gauges coding

#3 Post by CI Dan Saxton »

thanks Ralph, that's a really useful video!

I'll give it a go and see where it gets me.

P.S. ignore the needle - i meant to turn off that layer before i saved it.

User avatar
CI Dan Saxton
Posts: 51
Joined: Mon Apr 30, 2018 4:07 pm

Re: Grob Tutor gauges coding

#4 Post by CI Dan Saxton »

ok, so based on your video (albeit not quite the same) i have the oil pressure working fine.

What do i do on the oil temp where the scale is going in the opposite direction?

thanks in advance,

Dan

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

Re: Grob Tutor gauges coding

#5 Post by Sling »

CI Dan Saxton wrote: Mon Nov 05, 2018 7:41 pm ok, so based on your video (albeit not quite the same) i have the oil pressure working fine.

What do i do on the oil temp where the scale is going in the opposite direction?

thanks in advance,

Dan
The rotation just needs to happen in the opposite direction. So work out the starting angle at 40C and the end angle at 130C and you then have the range as before. All you do is add or subtract the delta or some fraction of it to the staring angle.

Tony

User avatar
CI Dan Saxton
Posts: 51
Joined: Mon Apr 30, 2018 4:07 pm

Re: Grob Tutor gauges coding

#6 Post by CI Dan Saxton »

sorry...no idea...maths was never my strong point...

i can get somewhere close with this, but the angles just aren't quite right.

Code: Select all

if degrees > 40 then
	img_rotate(img_oiltemp, 71 / 90 * 53 - (degrees - 130))
My angles are:

Code: Select all

-- oil temp degrees
-- oil temp degrees
-- 0°C = 140
-- 40°C = 124
-- 60°C = 113.5
-- 100°C = 76.5
-- 130°C = 53

User avatar
Ralph
Posts: 7921
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: Grob Tutor gauges coding

#7 Post by Ralph »

It works exactly the same:

Code: Select all

if oiltemp > 100 then
  rotate(img_oiltemp, 76.5 - (23.5 / 30 * (degrees - 100)) )
elseif oiltemp > 60 then
  rotate(img_oiltemp, 113.5 - (37 / 40 * (degrees - 60)) )
etc....

User avatar
CI Dan Saxton
Posts: 51
Joined: Mon Apr 30, 2018 4:07 pm

Re: Grob Tutor gauges coding

#8 Post by CI Dan Saxton »

ok thanks for that - it's working fine now.

What's next?

1. gauge on/off depending on battery on/off?
2. other conditions that cause the gauge to fail?
2. lighting?

looking at the Cessna 172 gauge as a comparison, they've got lots of code in there which i dont understand.

Dan

User avatar
Ralph
Posts: 7921
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: Grob Tutor gauges coding

#9 Post by Ralph »

A very simple battery on/off would be like:

Code: Select all

if battery_on then
  degrees = oil_temp_from_sim
else
  degrees = 0
end

User avatar
CI Dan Saxton
Posts: 51
Joined: Mon Apr 30, 2018 4:07 pm

Re: Grob Tutor gauges coding

#10 Post by CI Dan Saxton »

thanks again Ralph,

the Cessna 172 code for the equivalent gauges says the following....it looks like it's doing something with the images depending on the condition of something...should i be doing something similar?

Code: Select all

---------------------------------------------
--   Properties                            --
---------------------------------------------
prop_BG = user_prop_add_boolean("Background",true,"Hide background?")
prop_DO = user_prop_add_boolean("Dimming overlay",false,"Enable dimming overlay?")

---------------------------------------------
--   Load and display images in Z-order    --
--   Loaded images selectable with prop    --
---------------------------------------------
img_add_fullscreen("OilPressTempFace.png")
img_oilt = img_add("needle3.png", -150, 0, 512, 512)
img_oilp = img_add("needle3.png", 150, 0, 512, 512)
if user_prop_get(prop_BG) == false then
	img_add_fullscreen("OilPressTempCover.png")
else
	img_add_fullscreen("OilPressTempCoverwBG.png")
end	
if user_prop_get(prop_DO) == true then
	img_add_fullscreen("dimoverlay.png")
end

Post Reply