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.

"Stuffing" a K_event...

Featured Replies

In XML it's a trivial matter to "stuff" a value into a K_xxx_SET type event like this:(A:Plane heading degrees gyro, degrees) (>K:HEADING_BUG_SET)This will take the value of the current heading and force the Heading Bug to rotate to that setting.Is there a way to implement this in C at all? I've not been successful so far... :(BillAVSIM OmbudsmanFounder and Director,Creative Recycling of Aircraft Partshttp://catholic-hymns.com/frbill/FS2002/images/fartslogo.jpg

Hey Bill,Thanks to the wonderful MS SDK, we don't exactly know all the parameters that go into each EventID. The event you wanna use is, I believe, KEY_HEADING_BUG_SET.I think a couple people might pop in here and answer this properly, but for now I'd use that and try a couple possibilities, likeint hdgbug;(in here you define what value the neading bug will be)KEY_HEADING_BUG_SET(hdgbug, NULL);Or you may try just KEY_HEADING_BUG_SET(hdgbug). Again, you can try different ones. I took a look at gauges.h, but the definition of KEY_HEADING_BUG_SET didn't really tell me anything. Guess that means I gotta better my knowledge of C/C++ ;-)

trigger_key_event(KEY_HEADING_BUG_SET,hdg);Arne Bartels

>trigger_key_event(KEY_HEADING_BUG_SET,hdg);>Arne BartelsArne, I know what the key_event is already...What I do not know, is how to stuff the value INTO the key_event!I am using KEY_HEADING_BUG_DEC and KEY_HEADING_BUG_INC to adjust the "bug" manually. What I need to do is to define a click point where the "bug" will be automatically set to the same

>KEY_HEADING_BUG_SET(hdgbug, NULL);Hmmm... then it might just be possible to use this:KEY_HEADING_BUG_SET(PLANE HEADING DEGREES GYRO)Nope: this is the error the compiler gives:In file included from Cit2_EHSI.c:9:Cit2_EHSIG.c: In function `mouse_cb4':Cit2_EHSIG.c:135: called object is not a functionI'm still open to ideas! :)BillAVSIM OmbudsmanFounder and Director,Creative Recycling of Aircraft Partshttp://catholic-hymns.com/frbill/FS2002/images/fartslogo.jpg

Hey Bill,Hold on, no worries m8, no need to get bold with Arne (absolute pun intended :-)))).He gave you the answer. I was wrong in the syntax and idea, and Arne corrected me as usual. By stuffing the current heading to the hdg variable (read it from a Token Var), you can pass it to the key event like Arne has written above, and voila, your gauge will work like you want it too.

>He gave you the answer. I was wrong in the syntax and idea,>and Arne corrected me as usual. By stuffing the current>heading to the hdg variable (read it from a Token Var),>you can pass it to the key event like Arne has written above,>and voila, your gauge will work like you want it too.Thanks to both of you!I had to 'hand edit' the .c file to this:trigger_key_event (KEY_HEADING_BUG_SET,( hdgbug )) ;Unfortunately, EasyGauge simply won't pass the command properly, but now that I know how to 'fix' the command, it is working perfectly! :)BillAVSIM OmbudsmanFounder and Director,Creative Recycling of Aircraft Partshttp://catholic-hymns.com/frbill/FS2002/images/fartslogo.jpg

Sorry I didn't know it was an EG produced c file. I have the feeling the function construction isn't as straightforward in EasyGauge as it is directly in C. Onelast thing I forgot, the last argument of trigger_key_event is always an UINT32 value (unsigned 32bit integer) so dependend of the type of "hdgbug" a so called "type cast" might be needed: trigger_key_event (KEY_HEADING_BUG_SET,(UINT32) hdgbug ) ;or a rounding is needed:#include <math.h>#define ROUND(val) floor((val)+0.5)....trigger_key_event (KEY_HEADING_BUG_SET,ROUND(hdgbug) ) ;Arne Bartels

>Sorry I didn't know it was an EG produced c file. I have the>feeling the function construction isn't as straightforward in>EasyGauge as it is directly in C. Onelast thing I forgot, the>last argument of trigger_key_event is always an UINT32 value>(unsigned 32bit integer) so dependend of the type of "hdgbug">a so called "type cast" might be needed: >trigger_key_event (KEY_HEADING_BUG_SET,(UINT32) hdgbug ) ;>or a rounding is needed:>>#include >#define ROUND(val) floor((val)+0.5)>....>trigger_key_event (KEY_HEADING_BUG_SET,ROUND(hdgbug) ) ;Thanks once again, Arne.Actually, the thrill of discovery is part of the charm with EG, to be sure. You see, there really isn't much in the way of documentation to explain the multiple uses of the so-called "Number" dialog box that's one of the "choices" in a list of available commands during construction. Although there have been 'hints' scattered around here and there about various ways of using this largely undocumented feature.EG will in fact take anything you type in the entry field and pass it on quite literally, with no error checkig for syntax (which is not at all surprising, since the original intent of the 'Number' field was to enter, well, numbers! :)So, the 'trick' is to discover/learn the precise syntax necessary before entering the 'Number box.' For example, EG will append the trailing ';' to the typed input, so there's no need to enter it directly. Further, once entered, there's no way to 'edit' the entry within EG, so it's necessary to load the gaugename.esk file (the working file that EG uses to construct the various .c and .h files) into a text editor and make corrections, additions, etc. In fact, if the expression is complex enough, it's actually easier to simply place a 'dummy entry' in the field and then edit the file manually, then reload the saved file back into EG.Further to the above considerations, with the so-called "Programmers Edition," it is entirely possible to simply use EG to lay out the basic visual elements and mouse points for a complex gauge, and then add all the calculations, etc. to the generated .c file manually, and run the compiler from the Explorer screen or a "DOS Window."Now, I do have one other question regarding XML to C 'translation,' Arne if you'd be so kind... :) What would the C equivalent be for an expression like this? I've looked through my C reference books but have been unable to determine the correct expression... :((A:NAV1 Radial, degrees) 180 + dnor near (>K:VOR1_SET)BillAVSIM OmbudsmanFounder and Director,Creative Recycling of Aircraft Partshttp://catholic-hymns.com/frbill/FS2002/images/fartslogo.jpg

Hey Bill,I might be able to help, but I do not speak XML. What does that do, or better, what do you want to do?

"dnor" is "degrees normalized to north" or something like that, al degrees are wrapped around 360

Setting the OBS so the HSI always point to the VOR-Station, I presume.Arne Bartels

>Setting the OBS so the HSI always point to the VOR-Station, I>presume.>Arne BartelsThat is precisely correct, Arne. The HSI I'm programming has the ability to "Sync OBS To Station Bearing," based on what is driving the HSI at the moment: GPS, NAV1, NAV2, or nothing (in which case, it simply synchs the needle to the current gyro heading.If GPS active: (A:Plane heading degrees gyro, degrees) dnor near (>K:VOR1_SET)If VOR1 active: (A:NAV1 Radial, degrees) 180 + dnor near (>K:VOR1_SET)If VOR2 active: (A:NAV2 Radial, degrees) 180 + dnor near (>K:VOR2_SET)else: (A:Plane heading degrees gyro, degrees) dnor near (>K:VOR1_SET)Since the 'else' condition is functionally equivalent to the "Sync HDG To Current Plane Heading" function, I simply used the same command for that as I did the HDG previously discussed.Thanks again for all the help!BillAVSIM OmbudsmanFounder and Director,Creative Recycling of Aircraft Partshttp://catholic-hymns.com/frbill/FS2002/images/fartslogo.jpg

Thanks again, Arne! I've printed this off for further study later today when I get back to actually programming again... :)BillAVSIM OmbudsmanFounder and Director,Creative Recycling of Aircraft Partshttp://catholic-hymns.com/frbill/FS2002/images/fartslogo.jpg

Hello Bill,So when in GPS, it performs the same function as when nothing is selected, setting the OBS needle to the plane heading? Should't it be to the waypoint heading?Also, you will be using KEY_VOR1_SET instead of KEY_HEADING_BUG_SET, of course, so it ain't exactly the same command as before. Same arrangement with different event ID.

Create an account or sign in to comment

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.