Search the archive:
YaBB - Yet another Bulletin Board
 
   
 
Page Index Toggle Pages: 1
Send Topic Print
New "glass cockpit" Gauges Written (Read 1617 times)
Oct 27th, 2003 at 2:34am

JBaymore   Offline
Global Moderator
Under the curse of the
hombuilt cockpit!

Gender: male
Posts: 10261
*****
 
Moving toward the new cockpit some more.

I spent some time today with VB6 and wrote a couple of new external gauge programs for FS2004 that access the data stream with FSUIPC.  I am quite excited about getting the hang of some simple programming using the interface.  It isn't all that hard.  And there is an amazing amount of stuff you can access this way.

My "generic jet" homebuild cockpit project is being influenced a lot by the BAe 146-200 that I fly a lot.  That aircraft has a digital readout radio altimeter with the decision height readout right next to it on the main panel.  So I set out to recreate it for my cockpit.

A bit of VB6 code....... and I now have a radio altimeter gauge that reflects the AGL altitude (not necessarily matching the regular altimeter).  Displayed next to that reading is the decision height that has been selected in the sim.

The "range" of the radio altimeter is 4500 feet AGL (matches the BAe specs I have).  Above that, the display changes to a red "-RNG-" warning.  The normal display I created is white on black.  When the AGL gets below 1000 feet.... the display changes to a pink color....and when the AGL gets to the decision height that has been set, it turns to red.

I likely will add some aural tone alerts as well later.


Then I also wanted a set of Outer, Middle, and Inner marker indicator lights.  I now have them in blue, orange, and white.  This was a really simple gauge to write.

I also now have a small annunciator panel that gives me "Overspeed", "Low Altitude", "Master Caution" and Master Warning" indicators.

These kinds of things are amazingly easy to do using FSUIPC and the interface code supplied in the SDK.  I expect to eventually share these external gauges as "freeware" when I get them fully debugged and tested out.

Just a note here in case you are not really familiar with the "homebuild cockpits" concept.........

These gauges I am writing are not for use in "normal" virtual aircraft in the sim.  They work as external gauges running outside the sim on stand alone PC's.

best,

.....................john
 

... ...Intel i7 960 quad 3.2G LGA 1366, Asus P6X58D Premium, 750W Corsair, 6 gig 1600 DDR3, Spinpoint 1TB 7200 HD, Caviar 500G 7200 HD, GTX275 1280M,  Logitec Z640, Win7 Pro 64b, CH Products yoke, pedals + throttle quad, simpit
IP Logged
 
Reply #1 - Oct 28th, 2003 at 1:43am

JBaymore   Offline
Global Moderator
Under the curse of the
hombuilt cockpit!

Gender: male
Posts: 10261
*****
 
Started working on the "fine details" on the BAe type radar altimeter.

It now writes the exact location of the gauge (display window) on the screen to the Windows Registry on exit and reads it back when it starts......... so that when you restart the program the next time.... it is in the place you left it.  Necessary to keep them aligned with the panel holes you cut Wink.

I figured out how to play a .wav file out of VB6.... so there is now a tone alert when you reach the decision height.... but it still needs tweaking.  Plays on the way UP too.  Drat.  Got me stumped for the moment.  Other tones will be added for some other events after I figure out this one.

I also now have it so that you can't inadvertantly run two instances of the gauge at the same time.

Programming can get addictive....... you always want to add just one more feature  Wink.


best,

......................john
 

... ...Intel i7 960 quad 3.2G LGA 1366, Asus P6X58D Premium, 750W Corsair, 6 gig 1600 DDR3, Spinpoint 1TB 7200 HD, Caviar 500G 7200 HD, GTX275 1280M,  Logitec Z640, Win7 Pro 64b, CH Products yoke, pedals + throttle quad, simpit
IP Logged
 
Reply #2 - Oct 28th, 2003 at 2:40pm

Smoke2much   Offline
Colonel
The Unrepentant Heretic
Sittingbourne, Kent,

Posts: 3879
*****
 
I can't program for toffee but I believe you should be able to make a sound dependant on two variables.  If you were to have it:

"If height = 250feet and VSI<-1FPM then play sound"

The VSI would then have to be negative and you would therefore have to be descending to make the .wav file play.

Will

 

Who switched the lights off?  I can't see a thing.......  Hold on, my eyes were closed.  Oops, my bad...............&&...
IP Logged
 
Reply #3 - Oct 28th, 2003 at 8:25pm

JBaymore   Offline
Global Moderator
Under the curse of the
hombuilt cockpit!

Gender: male
Posts: 10261
*****
 
Will,

THANKS!

Never thought of the VSI reading!  That will help a LOT.  I am already looking at two variables in the decision to play the tone....... the radar altitude (which I get by subtracting the ASL altitude from the ground altitude under the lat/long of the plane) when compared to the decision altitude.

I know that the VSI variable is output in FSUIPC somewhere... just have to look in the docs and find the hex address.  That would stop the tone on the climb.

Appreciate the nudge in the right direction.  Wink

best,

.................john
 

... ...Intel i7 960 quad 3.2G LGA 1366, Asus P6X58D Premium, 750W Corsair, 6 gig 1600 DDR3, Spinpoint 1TB 7200 HD, Caviar 500G 7200 HD, GTX275 1280M,  Logitec Z640, Win7 Pro 64b, CH Products yoke, pedals + throttle quad, simpit
IP Logged
 
Reply #4 - Oct 29th, 2003 at 8:02am

Smoke2much   Offline
Colonel
The Unrepentant Heretic
Sittingbourne, Kent,

Posts: 3879
*****
 
That's no problem John.  I know what I want to do with programming I simply don't have the skills to do it Smiley

Will
 

Who switched the lights off?  I can't see a thing.......  Hold on, my eyes were closed.  Oops, my bad...............&&...
IP Logged
 
Reply #5 - Oct 30th, 2003 at 8:03am

JBaymore   Offline
Global Moderator
Under the curse of the
hombuilt cockpit!

Gender: male
Posts: 10261
*****
 
Will,

I have found that programming is about 90 pecent about spending the TIME to do it.  You learn a LOT by just writing code and then running it.

My guess is from you past comments that if you could find the time to just write some stuff....... that you'd get the hang of it pretty well.

I am NOT any good at it.  Too out of practice.  My code may work..... but a "real" programmer would probably have a coronary.  Plus I am relegated to visual BASIC at this point.  I knew BASIC pretty well years and years ago.  That background actually helps even with the current version.

best,

...............john
 

... ...Intel i7 960 quad 3.2G LGA 1366, Asus P6X58D Premium, 750W Corsair, 6 gig 1600 DDR3, Spinpoint 1TB 7200 HD, Caviar 500G 7200 HD, GTX275 1280M,  Logitec Z640, Win7 Pro 64b, CH Products yoke, pedals + throttle quad, simpit
IP Logged
 
Reply #6 - Oct 30th, 2003 at 8:12am

Smoke2much   Offline
Colonel
The Unrepentant Heretic
Sittingbourne, Kent,

Posts: 3879
*****
 
I have visual basic John but I cant work out where to start.  It wants me to fill out forms or something ???

there doesn't seem to be anywhere to put the:

10 ? "I am silly"
20 goto 10

Will
 

Who switched the lights off?  I can't see a thing.......  Hold on, my eyes were closed.  Oops, my bad...............&&...
IP Logged
 
Reply #7 - Oct 30th, 2003 at 10:13am

JBaymore   Offline
Global Moderator
Under the curse of the
hombuilt cockpit!

Gender: male
Posts: 10261
*****
 
Will,

Let's see if this helps a tad for you to get going......

The "form" is the place that you get the output to the windows screen to show up when you run the program.  It is sort of the "visual" part of visual basic  Wink.

You create a form...... give it a name related to it's function (you can make multiple "windows....which are the "forms").  In this example let's call it "frmName".  On the frmName form you locate stuff that you can sort of think of as "variables".  These variables are more actually like "containers" for stuff.  These containers have properties that you can manipulate.

One property that you can manipulate is the "caption" that is displayed where a "container" is located on the screen.  You alter this "caption" by assigning a "value" to the "caption" of the container.  The properties of a visual basic container are pretty logically named and are designated by a period after the "container's name" and the property you want to alter.  So for example........

lblMyName.caption = "JOHN" would print  JOHN in the location whre you placed the "container" you called "lblMyName" (using "lbl" to start the name is a way to remember what the thing you are working with is) on the frmName form.

Bet you know what the "frm" part relates to now  Wink.

If you wanted to change the font for the word JOHN on the screen...that is possible..... if you want to change the color...... if you want to do a LOT of things it is possible.

Within the frmName form.... you can assign actual code.  If you look at the upper control bar on VB you'll see a pull diown menu that includes "View Code" in it's options.  If you do this you see the code that is associated with frmName.

In this area you can use BASIC code that is VERY similar to what you seem to already know.  But line numbers are no longer needed in BASIC.  You reference in different ways. (Too complex to explain perfectly right now.)  The jumping around is sort of like the old GOTO or GOSUB statements.

So you can create subroutines that do stuff you want.  You get to them by calling their NAME .... not a line number.  On the frmName form.... you can associate stuff like clicking on a particular "container" with a "call" to "GOSUB" a particular routine of code.  Or to open another form (window).  And so on.

The code flows as it always did....top down.  So if on frmName you put in the code

X=1
If x = 1 then
lblMyName.caption= "JOHN"
else lblMyName.caption = "Not JOHN"
end if

This would assign "JOHN" to the caption displayed on the form when it is run. 


Anyway..... hope this is a start.

best,

...................john
 

... ...Intel i7 960 quad 3.2G LGA 1366, Asus P6X58D Premium, 750W Corsair, 6 gig 1600 DDR3, Spinpoint 1TB 7200 HD, Caviar 500G 7200 HD, GTX275 1280M,  Logitec Z640, Win7 Pro 64b, CH Products yoke, pedals + throttle quad, simpit
IP Logged
 
Page Index Toggle Pages: 1
Send Topic Print