Autopilot engage buttun double press like a mouse double click
-
hi all
i need To program the autopilot engage button in follows 3 mode:
short press
Long press
double press like a mouse bouble clickfirst And second mode is Easy with tempo function But last mode is Very trouble.
any suggestions
tnx a lot
-
CHAIN(PULSE+DX1, D(), PULSE+DX1)
-
tnx for You suggestion. But i nedd dedect the double press of the button And Then generate a event
-
Oh. Well it probably needs to be some code which activates a function on short tempo. The function looks to see if a variable is set “has been activated recently”. If yes, this is second click. If no, this is first click (and also set variable true) and take first branch if timed out waiting for second click. Last the variable should be set false if second branch is taken or if some time has occurred since it was activated.
doubleClickTimeout = 0;
doubleClick = 0;MapKey(&Joystick, TG1, TEMPO(EXEC(functionSingleDouble,DX3,500));
functionDoubleSingle = "if(doubleClick == 0 && doubleClickTimeout == 0) doubleClick = 1; doubleClickTimeout = 10…
…and so on -
You can use logical flags in the script. Monitor for a state change in a given time period, If true have it fire off your command. Logic flags are covered in the manual on page 43. Dealing with timing maybe an issue, not sure if you could can use millis in target, it is not covered in the manual. But there is a clearly a time function as it’s the basis for Delay. Target script manual is here. http://ts.thrustmaster.com/download/accessories/pc/hotas/software/target/target_script_editor_basics_v1.5_eng.pdf
-
With the logical flag its not possible dedect if the sim disengage the autopilot automaticaly. AFAIK.
My gol is
short press ALT Hold
Long press ATT Hold
double press AP Off -
With the logical flag its not possible dedect if the sim disengage the autopilot automaticaly. AFAIK.
My gol is
short press ALT Hold
Long press ATT Hold
double press AP OffTarget doesn’t need to know which state the AP is in. You can just cast the respective keystrokes for the AP functions you want.
short press ALT Hold -> SimRightAPUp
Long press ATT Hold -> SimRightAPDown
double press AP Off -> SimRightAPMidIn my version of morphine’s profile I use the AP switch on the throttle to call keystrokes. That part of the target profile looks like this```
//Autopilot
MapKey(&Throttle, APPAT, PULSE+L_CTL+L_ALT+L_SHIFT+‘d’);
MapKey(&Throttle, APAH, PULSE+L_CTL+L_ALT+L_SHIFT+‘s’);
MapKey(&Throttle, APALT, PULSE+L_CTL+L_ALT+L_SHIFT+‘a’);The autopilot section of my Keyfile looks likes this
SimRightAPUp 319 0 0X1E 7 0 0 1 “MISC: PITCH Switch - ALT HOLD”
SimRightAPMid 320 0 0X1F 7 0 0 1 “MISC: PITCH Switch - A/P OFF”
SimRightAPDown 319 0 0X20 7 0 0 1 “MISC: PITCH Switch - ATT HOLD”So the profile doesn't get any data from the sim, it just cast keystrokes. You're just using the logical flags to count how many times the button has been pushed in a timeframe. If the button has been pressed 2 twice in 50 milliseconds, a new state is true. If new state = true, then PULSE+L_CTL+L_ALT+L_SHIFT+'a'
-
Doesn’t matter if TARGET knows the state of the AP pitch switch (and there are ways to integrate memory extraction data into TARGET if it did). The flag is to facilitate differentiating between single and double tap.
What I did is just use the 3-pos switch for the pitch channel and the AP ENG button to cycle the roll channel. It’s a lot simpler for me.
I was thinking it might be the easiest to use a simple counter that is incremented on every tap. If tap count was 0 then begin a timer and increment. If tap count is 1 increment to 2. At the end of timer do the action A or B if count is 1 or 2 and reset the count to 0.
-
What I did is just use the 3-pos switch for the pitch channel and the AP ENG button to cycle the roll channel. It’s a lot simpler for me.
The problem of this solution is that when the sim disconnect automatcally the AP the switch position in not sincronize with the position of corresponding switch on the sim. The AP button engage/disengage simulate better the magnetic master AP switch. infact if the sim disengage automaticaly the AP the switch return in the central position and the button not give a wrong informetion on the real status of the switch
-
The problem of this solution is that when the sim disconnect automatcally the AP the switch position in not sincronize with the position of corresponding switch on the sim. The AP button engage/disengage simulate better the magnetic master AP switch. infact if the sim disengage automaticaly the AP the switch return in the central position and the button not give a wrong informetion on the real status of the switch
Switch de-sync is not an issue. If the AP goes off all you have to do is move your physical switch to center. The profile and the way the software cast commands prevent de-sync from being an issue. The stick will only cast a keystroke if the state of a switch changes, and then it only momentarily sends the command. We handle changing the position of the AP switch by calling the specific position of the AP switch. Meaning you only get a specific position command if you move the switch, so when the AP shuts itself off you won’t get a ghost command.
If you can not figure how to implement your double tap function It’s probably better to just have the button trigger the callback SimRightAPSwitch which will cycle the position with each push.