Sign in to follow this  
Guest Patrick_Waugh

Using the "starters"

Recommended Posts

I made a "starter" button, and hooked it all up to work with a mouse press, using it's own variable.Now, I am wanting to make it so that a user can assign a joystick button to the "starter button" rather than have to click it with the mouse.To do so, I decided that rather than use my own variable to control the MAKE_ICON, I'd just tie it to ENGINE1_STARTER_SWITCH_POS.The idea being the user would go to the joystick assignments and assign "Starter 1 On/Off" and set a joystick button to use.Problem is, this doesn't seem to work. I verified the MODULE_VAR does go to "1" (pushed), but interestingly, will not go back to "0" (out).Also, it seems that then I can't have the user push it with the mouse if I do the above, because there is no way to toggle the MODULE_VAR value programatically.What's the best way to do this, allow the user to use a joystick button assignment, and optionally click it with the mouse?

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

Patrick,""Problem is, this doesn't seem to work. I verified the MODULE_VAR does go to "1" (pushed), but interestingly, will not go back to "0" (out).""FS treats starters different from standard switchs. If you hit (click) the starter once, reading its related AVar will show 1 for a brief of time (aprox 3 seconds) and then go back to 0.Therefore you need to keep firing (clicking or pressing a joystick button) the starter until the engine starts. ""Also, it seems that then I can't have the user push it with the mouse if I do the above, because there is no way to toggle the MODULE_VAR value programatically.""The only way to handle the starters individually is through a KEY_TOGGLE_STARTERn (C version) event , and for sure it can be done by code, in XML and I guess C as well.Tom

Share this post


Link to post
Share on other sites

>Patrick,>>FS treats starters different from standard switchs. >If you hit (click) the starter once, reading its related AVar>will show 1 for a brief of time (aprox 3 seconds) and then go>back to 0.The XML var maybe, but not the C MODULE_VAR. I look at it with FSInterogate for example, and when you 'push' it, it goes to and stays at 1 (true).>Therefore you need to keep firing (clicking or pressing a>joystick button) the starter until the engine starts. This isn't the difficulty I'm having.>""Also, it seems that then I can't have the user push it with>the mouse if I do the above, because there is no way to toggle>the MODULE_VAR value programatically."">>The only way to handle the starters individually is through a>KEY_TOGGLE_STARTERn (C version) event , and for sure it can be>done by code, in XML and I guess C as well.Ah, where is my brain! Yes, KEY_TOGGLE.... think I was up too late and had too much caffine again. Ok, that part is solved.Thanks TomAnyone else have a fix for the C var getting stuck on 1 after activation?Patrick

Share this post


Link to post
Share on other sites

>Anyone else have a fix for the C var getting stuck on 1 after>activation?How aboutif (ENGINE1_STARTER_SWITCH_POSvar.var_value.n == 4){ isStarterActive = 1 ; ]else{ isStarterActive = 0 ; }The condition will be true only while the starter is, er, cranking... ;)Keep in mind though, that you'll have to have a way to set magnetos as well, since the engine won't run unless they are set for L, R, or BOTH.

Share this post


Link to post
Share on other sites

>>Anyone else have a fix for the C var getting stuck on 1>after>>activation?>>How about>>if (ENGINE1_STARTER_SWITCH_POSvar.var_value.n == 4)>{ isStarterActive = 1 ; ]>else>{ isStarterActive = 0 ; }>>The condition will be true only while the starter is, er,>cranking... ;)Problem with this approach, is that again the MODULE_VAR ENGINE1_STARTER_SWITCH_POS never goes back to "OFF", and so once you press the starter, you are done.While I can make the starter button without using the module_var, then I can't assign a key press to it.Patrick

Share this post


Link to post
Share on other sites

Ok, I figured out my limiting mis-conception.The value is intended to be used with muli-position switchs like in the Baron, and hence is not an On/Off.So, I'll have a look at the Jet starters, or have to figure out something like the above to toggle it off after a few frames.

Share this post


Link to post
Share on other sites

>Ok, I figured out my limiting mis-conception.>>The value is intended to be used with muli-position switchs>like in the Baron, and hence is not an On/Off.>>So, I'll have a look at the Jet starters, or have to figure>out something like the above to toggle it off after a few>frames.>Actually, you're still a bit confused. The starter switch position has off, left mag, right mag, both mags, start for positions. Their values are 0,1,2,3,4. Only a value of 4 indicates the STARTER is on. That value is indeed momentary, as in it gets turned on by the switch and will auto reset back to a value of both (3) after a few seconds.

Share this post


Link to post
Share on other sites

Ed,It does if it has a gauge driving it. It is just an enum not a bool, and that was the issue confusing me.Otherwise it just takes any value you give it and holds it.Patrick

Share this post


Link to post
Share on other sites

Right, however the normal 'behavior' is that the value be 3 or 4. 4 is starter on, and it WILL go back to 3 after a bit. If it is a value of 0... no magnetos, thus no electricity.

Share this post


Link to post
Share on other sites

Ok, I finally get what you are trying to knock into my thick head. Sorry I had a 24-hour block to new information, haha.So, FS itself will move 4 back to 3.Now given we only have one FS "key/joy press" in the assignments, I'm not sure how that is supposed to control this 4 position switch.I want it to go to 4 with the press of a joystick button assigned by the user, and then the auto-repeat will hold it. Then go to 3 as normal, although I'll change the button icon sooner.What I'm getting at is that to do this, I have to be able to detect when the user presses and releases the button. Seems that since this is an enum, all I get is FS setting it to one, and then from there I have to 'clear' or otherwise set it, and then FS will set it back to 1 if it is still pushed or pushed again.Seems like I must still be missing how to separate the detection of the assignment being pressed and the variable controlling the ICON.Patrick

Share this post


Link to post
Share on other sites

I looked up the code in the Baron's xml and it shows:(A:Old eng1 starter,enum)Now, of course, I'm using C, but what this shows me when I test it with the joystick assignment to the Engine1 Starter is that pushing the joystick button somehow immediately sends the thing to 4 to the start position, then it times out and goes back to the starting position.I think the problem may be in my gauge, because when I then view these variables with my aircraft, I don't see similar behavior.So, back to the drawing board.

Share this post


Link to post
Share on other sites

Patrick,This AVar (A:Old eng1 starter,enum) used in the Baron supports values from 0 to 4; 4 is momentary and quickly goes back to 3 as described above in this thread. Now, a Jet Starter is monitored by another AVar, (A:General Eng1 Starter, bool) that returns 1 momentary, then back to 0.Maybe you are monitoring the C equivalent of this last one?Tom

Share this post


Link to post
Share on other sites

Tom,Thanks for trying to help me with this.Ok, here is a summary after further research of where I think I am at.First, I am using a helicopter, and so Engine Type=3.What this means after looking at the variables in the B206 with standard instruments (so I know mine aren't interfering), is that only these MODULE_VARS are supported: GENERAL_ENGINE1_STARTER RECIP_ENGINE1_STARTERthis MODULE_VAR ENGINE1_STARTER_SWITCH_POSis not active apparently.What I mean by the above is that with the Standard B206, if I set a joystick button to "Engine Starter 1", that those first two go to "1", and the other remains at zero.Further, unlike in the Baron, they STAY at "1" and do not go to 4 or return to "0".Hence my problem. So, I am guessing that basically this may mean that I cannot use this variable with engine type=3.Any ideas?Edit: Additional test.I'm going to put the Baron gauge modified for my var into the b206 and see what happens.Patrick

Share this post


Link to post
Share on other sites

Seem to have ruled out my thought about being related to engine type as I tried it with engine type 1 and have the same problem. Of course that is a jet, not recip engine.Seems then that engine type 3, being a jet uses the jet enums:#define ENG_STARTER_STARTER_OFF 0 // values for jet engines#define ENG_STARTER_STARTER_START 1#define ENG_STARTER_STARTER_GEN 2and that the starter just goes to 1 and stays there, much as an engine stays lite once you light it. At least this is my working theory.Given this, maybe I need to use a jet_starter. But, while FS2004 has a "jet starter" in the key board assignments, I cannot seem to find a MODULE_VAR that would relate to it.Seems that it would just be the Eng1 starter variable.So, I'm not making any progress on this and it is making my hair grey as we speak.Patrick

Share this post


Link to post
Share on other sites

Ok,I figured out that probably what is necessary is a Jet starter, as I am dealing with engine type=3.So, given this:#define ENG_STARTER_STARTER_OFF 0 // values for jet engines#define ENG_STARTER_STARTER_START 1#define ENG_STARTER_STARTER_GEN 2It would seem that there are no magnetos to throw me for a loop, and basically one would expect the value to go to 1, not 4 which is what I observe with outside tools.However,being a jet, it does not snap back to 0 or go to 2 automatically.So, I peeked at the XML code for the 747, and see that they use a timer to reset the starter.This means that basically that given a push of the joystick button, I have to do the same. Now, since this must be done in the ICON callback, or gauge callback I would just count a certain number of loops, then move it back to 0.I'm not sure I need the GEN position, but I guess I could move it to 2 when the GEN is switched on.And I see these relevant KEYs:KEY_TOGGLE_STARTER1KEY_TOGGLE_ALL_STARTERSKEY_JET_STARTERKEY_STARTER1_OFFKEY_STARTER1_STARTKEY_STARTER1_GENKEY_STARTER1_SETI wonder if any can tell me how you use a _SET. I imagine this one is designed to allow you to send it a value to set: Off, Start, or Gen. Just curious.Also, I wonder what the KEY_JET_STARTER does vs. using the others.Patrick

Share this post


Link to post
Share on other sites

>KEY_STARTER1_SET>>I wonder if any can tell me how you use a _SET. I imagine>this one is designed to allow you to send it a value to set:>Off, Start, or Gen. Just curious.Good God man! You're flailing about so much it's difficult to keep up with you... ;)I've been out of town for the past few days, having just returned from my annual pilgrimage to the Shrine of All Things Aviation, aka: Airventure 2006 at Oshkosh... :)I tried to post this earlier this morning while still at the hotel, but of course since I was on a 'guest account' on the hotel's computer, I couldn't log on for posting with AVSIM (hotel's 'puter would not allow cookies).To _SET any of the key_events, one need only supply a legal value in the second parameter of the trigger_key_event macro, i.e.,KEY_STARTER1_SET,val // where val is an actual number or a variable with the appropriate data type and units.BTW, I got your code in my email inbasket, but I'm going to have to rest up a bit before responding. After 48+ hours of whirlwind activities, I'm absolutely wiped out and need a very long nap! ;)

Share this post


Link to post
Share on other sites

Hey Bill,Thanks for your response. Don't worry about the source code, I since figured out that it really wasn't the problem (although some things in it will look broken).Turns out that helo's are different, and the "starter" vars don't reset automatically, moreover, they cannot be reset with KEY_stuff.So, turns out the only way to use them is either use DirectInput, or FSUIPC.So, I think I'm going to not use that var at all, to avoid limitations in timing, and just use an unused var that does go on/off, or just use DirectInput.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this