MobiFlight Community Support

Welcome to the forum for MobiFlight! Feel free to reach out to the community in case you have questions, issues or just want to share great ideas or details about your latest home cockpit project.

You like MobiFlight? Donate via PayPal and support the MobiFlight development. Thanks! 

icon
Avatar
RudyB
Posts: 13
Hi all,

I have an encoder working perfectly well to move the heading bug with the HEADING_BUG_DEC / _INC events.

What I haven't found yet is how to set the heading bug to the current heading with the press of a button, simulating a press of the G1000 HDG knob.

Is there someone who knows the way?

Greetings, Rudy.
Always have fun!
2020-05-22 13:34
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 3417
Supporter
Hi

Not posible at the moment with Mobiflight !

Thats the first time a User request for that..... When we implement "Placeholder tool" 7 Month ago i also vote to use it in Inputs.... But finaly Sebastian and also Stephan and myself decide to implement this "at first" only for Outputs.

This situation would need it in INPUT..... then we can say:
Read Current Heading in a output Config Called e.g. "HDG" .
Then we define in INPUT Config a Placeholder ..... Symbol "a" und use the HDG Config for it.
Finaly we say ON PRESS "a"
Means it send on press simply the current value of HDG Config to the AP Heading Bug.

Whatever again.... NOT Possible a.t.m.

****************
Solution:
1. You can send a "hard" value..... For example 360(0) Degrees..... So a press set HDG to Zero ( Or each other value you like) But always only this fix value you define in the Config.

2. With a LUA Script you can write this code yourself as i said Above.... If script is running it must read Current Heading from it´s Offset and then it must write that value to the AP Heading Offset.
With porgramming skills pretty sure no problem to do.
Good Luck !
2020-05-22 21:58
Avatar
RydyB
Posts: 18
Thanks for your reply pizman. I bet also the G1000 press of the CRS knob to align the VOR needle is not (yet) implemented?

I have been writing LUA code before, so that should not be too hard. What I haven't tried yet is how to get a LUA script to work with/in MobiFlight. I'll make a start studying that. Any tips as to where I can find some info on how to use LUA with MF?
Always have fun.
2020-05-23 00:39
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 3417
Supporter
2 Questions...... 2 awnsers :lol:

1. G1000.
I not use those stuff so i´m not a pro here.... Do you mean if you press this virtual button then the Bug is do exactly what you need ??
If Yes the logical result should be to try to controll this button..... then you need no difficult code or workaround.
Check the EventID List..... On first view all Buttons got a EventID.
For example: G1000 MFD SOFTKEY1---- 66789

EDIT: Logging Mode show me "HEADING BUG SET 66042" when i use that button. Pleae try out with parameter 0..... Maybe it work !




About LUA Macro.
Here you got a lot of ways.

Most easy is to assign the macro to a Key in FSUIPC (Registred Version) ..... then In mobiflight you just use Keypress (with that key) ...... So you Press button and mobiflight send e.g. a "A" Button..... And in FSUIPC you say : If "A" is pressed execute your macro.
This also works for Joybuttons ( Via VJOY and Mobiflight OR Via a real JoystickController like LeoBodnar external of Mobiflight)


More advanced is to bind the macro to a Offset.... So macro runs if Offset e.g. 66C0 is "1" and set the offset after running back to "0".
Here you say in Mobiflight Buttonpress should write that Offset to 1

Also Possible is the LUA MACRO Function of Mobiflight..... In Input you can use this to start/stop a Macro or script.
https://www.mobiflight.com/forum/message/10232.html
[Last edited by pizman82, 2020-05-23 04:09]
Good Luck !
2020-05-23 03:57
Avatar
RydyB
Posts: 18
Yes, the G1000, used in many 'glass cockpits', has HDG and CRS knobs that can be rotated with the mouse and they can also be pressed. Pressing HDG sets the heading bug to the current heading, eliminating the need to rotate the knob. Same for the CRS knob, it aligns the VOR needle, eliminating the need to rotate.

So yes, they are virtual switches, and I reckon they have an Event ID or an FSUIPC offset ... it's just that I can't find them. For the heading bug there are:
HEADING_BUG_SELECT: I have no idea what it does, nothing seems to happen
HEADING_BUG_SET: it sets the HB to North, 0/360

I haven't tried all the possible G1000 codes yet ... I was hoping maybe someone had already found the right ones. :)

I'll have a look into how to run a LUA script and see if I can get that to work one way or another. Once I understand how to start and stop a script then maybe I can get set the HB to the current heading via LUA code.
[Last edited by RydyB, 2020-05-23 09:49]
Always have fun.
2020-05-23 09:31
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 3417
Supporter
Do you have FSUIPC in registred Version ???

With "logging Mode Typ Event" you can click on a spot and you see there the event that was executed.

I will also check this within the next time and will report results here.
Good Luck !
2020-05-23 18:57
Avatar
RudyB
Posts: 13
Been on a holiday ... back to hobby now.

Yes, the FSUIPC logging is very helpful. It works with the unregistered version too. Via the logging I found the two Event ID's I was looking for with the G1000 glass cockpit:

Press CRS knob: ID 65716 PAR 223 VOR1_SET
Press HDG knob: ID 66042 PAR 216 HEADING_BUG_SET

Now having some trouble finding the correct ID for several autopilot push buttons, FSUIPC often gives a series of events, not just one. Figuring that out now, will post here when I have it working.
Always have fun!
2020-05-29 13:21
icon