ntnll Posted May 29, 2016 Report Posted May 29, 2016 Good morning, I'm trying to make 124thATCv2 compatible with this beautiful model. The plugin (an ATC emulator), needs to know the state of autopilot mode for better behave (avoid to flood user with heading instructions while LNAV is active) With all the models I tested until today, I successful read the autopilot state using SDK dataref with C++: XPLMFindDataRef("sim/cockpit/autopilot/autopilot_state"); The read result is a int value that change whenever HDG, VNAV, LNAV modes are engaged (default value is 132). When using IXEG model, this code never change, it keeps to "132" value (the default value), always with VNAV, LNAV or HDG engaged. In a support ticket, Cameron explained to me that it is not a bug, because IXEG provide its own custom datarefs. I red the documentation and I can't find out the way to read the autopilot state or LNAV state, I only found these values: ixeg/733/autopilot/LNAV_mode_toggle ixeg/733/MCP/mcp_lnav_act but it doesn't seems to be (as my understanding), the status of LNAV, but rather a writable dataref for toggle LNAV, indeed, I tried to read it via XPLMFindDataRef, and the result is always 0. Can anyone please explain me the way to know the autopilot state with the IXEG 737? 124thATCv2 is a free project plugin, any help will be very appreciate. Thanks in advance Antonello Quote
Rodeo Posted May 29, 2016 Report Posted May 29, 2016 I've yet to see a write-only dataref for X-Plane. My guess it you're trying to read it with the wrong accessor (e.g. trying to read it as a float and it's an int dataref, or vice-versa). Quote
ntnll Posted May 29, 2016 Author Report Posted May 29, 2016 Hi Rodeo, Thanks for reply. Yes as told I'm afraid these are only toggle, I also tried to import like float, but also from doc description looks like writable dataref. So there is not any way to know the autopilot state with the IXEG? I'll open a new ticket to the support Quote
Nils Posted May 29, 2016 Report Posted May 29, 2016 Hi Antonello, the 737 autopilot is a 100% custom coded system so you will unfortunately not have any use for the default autopilot datarefs. If you specify in detail what you need we can possibly put some new datarefs on our to-do list. Quote
Slayer Posted May 29, 2016 Report Posted May 29, 2016 (edited) ixeg/733/MCP/mcp_lnav_act definately works I use that for my profile - it's a 0 or 1 You can't read ixeg/733/autopilot/LNAV_mode_toggle because it is a command Edited May 29, 2016 by Slayer Quote
ntnll Posted May 29, 2016 Author Report Posted May 29, 2016 3 minutes ago, Slayer said: ixeg/733/MCP/mcp_lnav_act definately works I use that for my profile - it's a 0 or 1 Hi all, thanks for your replies. Slayer you "read" this dataref via c++ and xplane sdk? I get always 0. You read it as float or int? You are using XPLMDataRef too? Quote
Slayer Posted May 29, 2016 Report Posted May 29, 2016 (edited) I'm using a Goflight Interface Tool for programming my MCP. I use that dataref but I'm afraid I can't tell you if it's for sure an int as that software handles all the reading and writing internally so I never see it, only the dataref. There is a way to read that info though but I'm not a C++ programmer so I can't tell you the method. Suggest you have a look at the DRT source code , you will find a clue in there . Edited May 29, 2016 by Slayer Quote
jfjoubert Posted May 29, 2016 Report Posted May 29, 2016 Hi guys, Just had a look and the dataref is working fine... the problem is that this dataref will only show the state of the switch. Due to fact that it's a momentary push button you will only get 1 if you hold down the button. It does not give you the actual state of LNAV. IXEG will have to "expose" more datarefs which will allow you to get the actual state of things behind the scenes. Quote
Slayer Posted May 29, 2016 Report Posted May 29, 2016 Sorry I misspoke myself. I was looking at the button itself not the indicator light which will tell you if it's active or not. the dataref you need is: ixeg/733/MCP/mcp_lnav_ann Quote
jfjoubert Posted May 29, 2016 Report Posted May 29, 2016 That's weird... I'm still getting 1 only when I keep the button down. The annunciator should at least give the correct value when lit... hmmm. Quote
ntnll Posted May 29, 2016 Author Report Posted May 29, 2016 (edited) @jfjoubert, thanks, it make sense, I'll make some tests. @Slayer, I'm already reading from mcp_lnav_act, but the result is always 0. Maybe jfjoubert is right, and the dataref returns 1 only in the moment is pressed, I'll make some tests. Now I'm reading these datarefs, all results in a 0 value: gVNav_IXEG_AutopilotStateRef = XPLMFindDataRef("ixeg/733/MCP/mcp_vnav_act"); gLNav_IXEG_AutopilotStateRef = XPLMFindDataRef("ixeg/733/MCP/mcp_lnav_act"); gHdg_IXEG_AutopilotStateRef = XPLMFindDataRef("ixeg/733/MCP/mcp_hdg_select_act");@Nils, many thanks for your support, I'll try to better explain my problem: Xplane sdk provides a dataref that represents the autopilot state. When no autopilot, HDG, VNAV etc is engaged, dataref return a int value 132. When you engage LNAV, for example, the int value raise: Depending on what is enabled, if is climbing, on cruise, if LNAV or VNAV is engaged, etc, the dataref return a differente code. These are some I red up today from other models: 529, 560, 561, 616, 672, 16896, 16897 This datarefs permits to figure if LNAV, HDG, o VNAV is engaged. For my plugin is crucial to understand these informations. Edited May 29, 2016 by ntnllxpilot Quote
Nils Posted May 29, 2016 Report Posted May 29, 2016 Ok to detect LNAV you could probably use ixeg/733/MCP/mcp_lnav_ann for most purposes. Our dataref convention is to suffix dataref names with _act for actuators (e.g. buttons and switches), _ind for indicators (i.e. animated needles) and _ann for annunciators (e.g. the little lights on the mcp buttons). Quote
Slayer Posted May 29, 2016 Report Posted May 29, 2016 (edited) reread my post: ixeg/733/MCP/mcp_lnav_ann that is the annunciator light so it's only on when lnav is on and active. Sorry for the confusion. if you want heading select and VNAV those are: ixeg/733/MCP/mcp_vnav_ann ixeg/733/MCP/mcp_hdg_ann Edited May 29, 2016 by Slayer Quote
jfjoubert Posted May 29, 2016 Report Posted May 29, 2016 (edited) Thanks. Did another check and the "ixeg/733/MCP/mcp_lnav_ann" dataref is displaying the state of the LNAV annunciator. Forgot to mention that I'm using XPLMGetDataf. So read it as a float. Edited May 29, 2016 by jfjoubert Update Quote
ntnll Posted May 30, 2016 Author Report Posted May 30, 2016 (edited) Hi all, thanks for the replies. mcp_hdg_select_ann is not present in the documentation, where can I found an updated list of datarefs? Anyway, I just make a lot of tests, and I still get "0" results for all reads: my code: XPLMDataRef gVNav_IXEG_AutopilotStateRef = NULL; XPLMDataRef gLNav_IXEG_AutopilotStateRef = NULL; gVNav_IXEG_AutopilotStateRef = XPLMFindDataRef("ixeg/733/MCP/mcp_vnav_ann"); gLNav_IXEG_AutopilotStateRef = XPLMFindDataRef("ixeg/733/MCP/mcp_lnav_ann"); int statoVNAV_IXEG; int statoLNAV_IXEG; statoVNAV_IXEG=XPLMGetDatai(gVNav_IXEG_AutopilotStateRef); statoLNAV_IXEG=XPLMGetDatai(gLNav_IXEG_AutopilotStateRef); Hi tried with both, int and float type (and XPLMGetDataf), but I will get always 0. I can't understand, I'm reading tons of dataref from SDK, but I can't read these datarefs, is this syntax correct? gLNav_IXEG_AutopilotStateRef = XPLMFindDataRef("ixeg/733/MCP/mcp_lnav_ann") Which type should be used for read these datarefs? I use to rely to sdk dataref table for know it:http://www.xsquawkbox.net/xpsdk/docs/DataRefs.html But in the documentation there is any reference to the data type. Edited May 31, 2016 by ntnllxpilot Quote
sparker256 Posted May 30, 2016 Report Posted May 30, 2016 I use this tool. https://github.com/leecbaker/datareftool/releases I do not have this plane but have used it with many planes and it has parsed out the datarefs. Bill Quote
jsnapp Posted May 31, 2016 Report Posted May 31, 2016 Good info in this thread. I will be following. Quote
Ben Russell Posted May 31, 2016 Report Posted May 31, 2016 14 hours ago, sparker256 said: I use this tool. https://github.com/leecbaker/datareftool/releases I do not have this plane but have used it with many planes and it has parsed out the datarefs. Bill Recent builds of DRT seem to make some incorrect assumptions about the rules regarding array datarefs. I've seen some junk in log files about it throwing tantrums. I'd fix it but the project started using boost a long time ago and I lost interest. Quote
ntnll Posted May 31, 2016 Author Report Posted May 31, 2016 Hi guys, I think I found the reason that is causing the issue, is due to plugin boot order, I'll try to defer dataref initialization, thanks all for replies and to huge Sandy Barbour. This is the post I found that suggest the solution, I hope it could helps others: http://forums.x-plane.org/index.php?/forums/topic/50889-dataref-x737-help-needed/ Edit: I deferred dataref initialization and solved the issue, definitively a problem of plugin boot order Quote
Rodeo Posted June 1, 2016 Report Posted June 1, 2016 On 31 May 2016 at 0:31 PM, Ben Russell said: Recent builds of DRT seem to make some incorrect assumptions about the rules regarding array datarefs. Do you know what the issue(s) might be? Maybe someone else can fix them. Or maybe you have a link to one of these junk-filled logs? Quote
Ben Russell Posted June 1, 2016 Report Posted June 1, 2016 40 minutes ago, Rodeo said: Do you know what the issue(s) might be? Maybe someone else can fix them. Or maybe you have a link to one of these junk-filled logs? Lee has made it clear in his own way that he's not interested in contributions from me. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.