Updated gauges.h file

SDK supports Prepar3D’s philosophy of an open development architecture and encourages third parties to bring new innovations with improved add-ons and training content.
Locked
dragonflightdesign
Posts: 4
Joined: Tue Nov 01, 2011 5:39 pm

Post by dragonflightdesign »

I see some familiar names here.... At John Nicol's request I'm posting a copy of the updated gauges.h file (called fsxgauges_sp2.h) that I've included in the sd2gau-series C-gauge builder's tutorial hosted over on the Avsim forums.



John - it would be easier for you to read down through the header file as all of the changes I've made over the years are clearly commented. Most are ease-of-use, some are corrections but where stuff has been changed the original line(s) have been commented and not removed. I also 'cleaned up' the file last time round and passed out a lot of the ease-of-use stuff into a new header called conversions.h. However, I'm sure that some of the macros in that file are not really accurate enough for the Prepar3D SDK.



I cannot claim any form of copyright on any of those changes. If they are of any use, please feel free to use them.



I'd also like to draw your attention to these lines here (information passed to me by Bill Leaming):



Code:
#define KEY_FREEZE_LATITUDE_LONGITUDE_TOGGLE (KEY_ID_MIN + 1293) //LONGITUE typo fix
#define KEY_FREEZE_LATITUDE_LONGITUDE_SET (KEY_ID_MIN + 1294) //LONGITUE typo fix



Is the key event ID correct? These lines are also listed for key events 1295 and 1296.



-Dai



www.simpilot.net/~sc/prepar3d/dfd_gaugesh.zip
User avatar
Beau Hollis
Lockheed Martin
Posts: 2452
Joined: Wed Oct 06, 2010 3:25 pm

Post by Beau Hollis »

I think the original listings are missing a d. It seems that when typos were fixed, the misspelled version was left in for backward compatibility.

Beau
Beau Hollis
Prepar3D Software Architect
dragonflightdesign
Posts: 4
Joined: Tue Nov 01, 2011 5:39 pm

Post by dragonflightdesign »

Hello Beau



Thank you for the response. It's more than likely I didn't make myself too clear: what concerns me is that your corrected lines use key IDs 1293 and 1294, but if you check your existing gauges.h files, you'll find this directly below:



Code:
#define KEY_FREEZE_LATITUDE_LONGITUE_TOGGLE (KEY_ID_MIN + 1295)
#define KEY_FREEZE_LATITUDE_LONGITUE_SET (KEY_ID_MIN + 1296)



i.e. the lines are repeated (with the incorrect spelling) but with a different pair of key IDs. It's entirely possible that I was given the wrong information, but I'd rather ask a silly question and be safe.



-Dai
Adam Breed
Lockheed Martin
Posts: 1382
Joined: Mon Sep 20, 2010 6:17 pm

Post by Adam Breed »

Hi Dai,



You are correct. The information currently inside the gauges.h file is the correct information.

I am assuming those entries were created by whoever updated the gauges.h you are using (there is a gap between 1290 and 1295).

We have not modified the key sequencing from the original ESP other than adding to the end of the sequence, which would not cause the misalignment you are referencing.



Let us know if you need any more details,

Adam
Prepar3D® Engineering Project Manager
N4GIX
Posts: 617
Joined: Wed Dec 08, 2010 6:52 pm

Post by N4GIX »

Adam, I'm a bit confused now, since this information came from Beau Hollis to begin with! See the thread immediately below this one:

http://www.prepar3d.com/forum-5/?mingle ... opic&t=518



I should like to point out that neither FSX nor ESP1 had these corrected entries in their SDK's gauges.h files either. It appears that MS/ACES never updated them to reflect the addition of the two missing key_events or the two spelling corrections... :o
Bill Leaming
Modeler and Programmer
Military Visualizations
Erhan Atesoglu
Posts: 11
Joined: Sat Oct 30, 2010 12:42 am

Post by Erhan Atesoglu »

Don't know but I've been using it as documented no problems here. My understanding this issue was fixed in SP2, but the old stuff was left in for backwards compatibility
N4GIX
Posts: 617
Joined: Wed Dec 08, 2010 6:52 pm

Post by N4GIX »

Ethan, how could you possibly use events that aren't #define(d) in guages.h?

Yes, you could use the two misspelled ones by simply misspelling them in your code, but the two completely missing events?
Bill Leaming
Modeler and Programmer
Military Visualizations
dragonflightdesign
Posts: 4
Joined: Tue Nov 01, 2011 5:39 pm

Post by dragonflightdesign »

If I had to take a flyer at this (oof. Sorry about the unintended pun), my guess would be that Beau meant this:-

Code:
#define KEY_FREEZE_LATITUDE_LONGITUDE_TOGGLE (KEY_ID_MIN + 1293) //LONGITUE typo fix
#define KEY_FREEZE_LATITUDE_LONGITUDE_SET (KEY_ID_MIN + 1294) //LONGITUE typo fix
#define KEY_FREEZE_LATITUDE_LONGITUE_TOGGLE (KEY_ID_MIN + 1293)
#define KEY_FREEZE_LATITUDE_LONGITUE_SET (KEY_ID_MIN + 1294)

- and that he meant to keep the backwards compatibility but fell prey to our very old friend Finger Trouble. Now there's someone who's knocked at my front door far too often...



-Dai
User avatar
Beau Hollis
Lockheed Martin
Posts: 2452
Joined: Wed Oct 06, 2010 3:25 pm

Post by Beau Hollis »

I did a copy and paste from source code. I'm pretty sure we handle both events the same, so it doesn't really matter which one you use. I know it seems silly to create new KEY_ID entries just to fix a typo, but there is a little method to the madness. Gauges use a header, so we could fix the misspelling without breaking comparability by redefining the same id as was suggested above. SimConnect add-ons use stings though, so an older SimConnect addon may use "KEY_FREEZE_LATITUDE_LONGITUE_TOGGLE" while a new one uses "KEY_FREEZE_LATITUDE_LONGITUDE_TOGGLE". We need a unique key id in the back-end because of the way our string-lookup table is generated.



The moral of the story is that we should really try to spell things right the first time :)



Beau
Beau Hollis
Prepar3D Software Architect
dragonflightdesign
Posts: 4
Joined: Tue Nov 01, 2011 5:39 pm

Post by dragonflightdesign »

Beau - thank you very much for clearing this up. I appreciate the time you've taken to look into it.



-Dai
Locked