Jump to content

HOW TO: Use snapviews to easily manipulate the cockpit switches while keeping sight


Recommended Posts

Posted (edited)

Hello everyone, after reading about the discussion about the MiG-21Bis and the problem of the keymapping for the switches, I had the idea to use the snap views instead.

 

Here is a short tutorial to use the weapon panel and radar panel on the MiG-21Bis:

 

(1)

Assign TMS left, right and down buttons on the joystick to snap views 4, 6 and 2 (example for TARGET).

Long press (300 ms) will bring the snap view, short press will reset the view to normal:

////////////////////////////////////////////////////////////
define TPULSE 70
define TDELAY 50
define TEMPODELAY 300

int snapviewlist;
int snapview(int s)
{
   snapviewlist = SEQ(KP0,KP1,KP2,KP3,KP4,KP5,KP6,KP7,KP8,KP9);
   ActKey(KEYON+CHAIN(
       PULSE+R_CTL+KP0            ,D(TPULSE+TDELAY),
       PULSE+X(snapviewlist,s)    ));
}

int main() {
   // ... configure devices, start event handler
   SetKBRate(TPULSE, TDELAY); // Keyboard pulse and delay times in ms
   SetKBLayout(KB_ENG);
   // ... stuff
   MapKey(&Joystick, H2L, TEMPO(KP0,EXEC("snapview(6);"),TEMPODELAY));    // Upper Panel Snap View
   MapKey(&Joystick, H2R, TEMPO(KP0,EXEC("snapview(4);"),TEMPODELAY));    // Upper panel Snap View (Zoomed)
   MapKey(&Joystick, H2D, TEMPO(KP0,EXEC("snapview(2);"),TEMPODELAY));    // Lower Panel Snap View
   // ... more stuff
}

Note that the shortcut to activate a snapview temporarily (i.e. without using the snap view mode) is LWIN+NumX.

 

(2)

Backup file Saved Games/DCS/Config/View/SnapViews.lua

This is where the custom snap views are stored, you can delete it safely also to reset the views completely.

 

(3)

Start the game, pause TrackIR (although you can keep it on, it will be more difficult to set the snap view position with it on)

 

(4)

Set the view to be centered / zoomed on the upper panel (use numpad keys to look around and RCtrl+RShift+numpad keys to translate the view).

Hit LWin+Num6 then RAlt+Num0, this will save the view to custom snapview Num6

Now pressing LWin+Num6 will bring the weapon panel view.

 

You can also press LCTRL+Num0 to enter snap view mode then press Num6 to activate the view, then press Num0 to exit snap view mode (this is what the TARGET code above is doing).

 

Note that pressing RAlt+Num0 without having selected a snapview beforehand will save the default view for this aircraft.

 

attachment.php?attachmentid=119785&stc=1&d=1437101920

 

(5)

Redo step (4) with lower panel (making sure the radar switches on the right, the engine switches on he left and the tactical release in the middle are visible) and Num2

 

attachment.php?attachmentid=119784&stc=1&d=1437101920

 

 

(6)

Put your mouse near your throttle (because your joystick hand will be a bit busy), activate the TrackIR and go for a flight.

When you have you eyes on something (e.g. bandit), you can press TMS left, right or down (long) on the joystick, this will bring the appropriate panel into view (do not move your head).

Use the mouse to manipulate the switch you want (e.g. sight mode or weapon selection), then press one of TMS left, right or down (short) to exit the snap view mode.

 

As soon as you leave the snap view mode, the view will come back to where you left it.

 

attachment.php?attachmentid=119515&stc=1&d=1436319248

 

(7)

I also use a close up on the ASP with Num4:

 

attachment.php?attachmentid=119786&stc=1&d=1437101920

 

 

This procedure can be used for any panel, any aircraft, whenever you prefer to use the cockpit switches instead of the joystick or the keyboard.

 

Have fun :smartass:

MiG-21Bis-6-tally-bandit-.PNG.c7b00a45a4f773e79d5f01acb8aacb8a.PNG

SnapLower.thumb.PNG.d6bbfc62987f31c2e0833d4ba81ed100.PNG

SnapUpper.thumb.PNG.b6a357651496b38d433fe658a86cf543.PNG

SnapUpperZoomed.thumb.PNG.b9814929c272954027cfb30334442cab.PNG

Edited by PiedDroit
Rewritten with better views and better TARGET code
Posted (edited)

You can also use the SnapView Toggle function so you don't need to hold down TMS while using the mouse.

MapKeyIO(&Joystick, H2L, KP0, CHAIN(R_CTL+KP0,D(100),KP4)); 
MapKeyIO(&Joystick, H2R, KP0, CHAIN(R_CTL+KP0,D(100),KP6)); 

You can shrink the delay value to whatever you like.

 

You can also assign a SnapView function and assign all of the SnapView keypad numbers to an array.

int SnapViewState;
int SnapViewsT;

int main()
{
//Toggle SnapViews
SnapViewsT    =    SEQ(KP0,                    //0         placeholder, also cancels toggle.  
                   SnapView1t,                    //1
                   SnapView2t,                    //2
                   SnapView3t,                    //3  
                   SnapView4t,                    //4  
                   SnapView5t,                    //5 
                   SnapView6t,                    //6  
                   SnapView7t,                    //7    
                   SnapView8t,                    //8    
                   SnapView9t                    //9    
                   );    


MapKeyIO(&Joystick, H2L, EXEC("SnapViewModRelease();"), EXEC("SetSnapViewT(4);")
MapKeyIO(&Joystick, H2R, EXEC("SnapViewModRelease();"), EXEC("SetSnapViewT(6);")
}


int SetSnapViewT(int kp)
{
if (SnapViewState == 0)
   {
   ActKey(KEYON+SnapViewHold);
   DeferCall(100, &ActKey,SnapViewHold);
   SnapViewState = 1;
   if (kp > 0) DeferCall(150, &ActKey,KEYON+PULSE+X(SnapViewsT,kp));    //SnapViews using 0 are satisfied with SnapViewHold and if condition prevents kp0 from resetting the view
   }
else
   {
   if (kp == 0)    //releases view then resets to 0
       {
       ActKey(KEYON+PULSE+SnapViewRelease);
       DeferCall(50, &ActKey,KEYON+SnapViewHold);
       DeferCall(100, &ActKey,SnapViewHold);
       }
   else ActKey(KEYON+PULSE+X(SnapViewsT,kp));
   }
}

int SnapViewModRelease(int mod=0)
{
SnapViewState = 0;
DeferCall(mod, &ActKey, KEYON+PULSE+SnapViewRelease);
}

 

in your tmm file:

define    SnapViewHold                R_CTL+KP0
define    SnapViewRelease                KP0
define    SnapView1t                    KP1
define    SnapView2t                    KP2
define    SnapView3t                    KP3
define    SnapView4t                    KP4
define    SnapView5t                    KP5
define    SnapView6t                    KP6
define    SnapView7t                    KP7
define    SnapView8t                    KP8
define    SnapView9t                    KP9

The above example is for using the array with the toggle function (where it is most useful). /I for releasing the view and /O for activating it. You can also set it to a TEMPO instead (this is actually what I prefer).

 

The Array and subroutine is nice because it allows you to go directly between snapviews without having to press RCTL+KP0 again (which could actually dump your SnapView if the timing is off). The DeferCall in the SnapViewModRelease() function allows you to insert a delay if necessary (i.e. if you sup up the function to add modifiers for CDU direct entry).

 

I find SnapViews to be quite useful (obviously), so hopefully you will find this code helpful for your own use.

Edited by Home Fries
Posted

Thanks for the tips :thumbup:

I just threw the basics, I didn't want to clutter the first post with technical details about how to activate the snap views.

Posted (edited)

Here's the code I wrote to toggle the views, long press (300 ms) will bring the snap view, short press will reset the view to normal (it does the same as your code basically, except it's simplified with PULSE instead of using deferCall):

 

////////////////////////////////////////////////////////////
define TPULSE 70
define TDELAY 50
define TEMPODELAY 300

int snapviewlist;
int snapview(int s)
{
   snapviewlist = SEQ(KP0,KP1,KP2,KP3,KP4,KP5,KP6,KP7,KP8,KP9);
   ActKey(KEYON+CHAIN(
       PULSE+R_CTL+KP0            ,D(TPULSE+TDELAY),
       PULSE+X(snapviewlist,s)    ));
}

int main() {
   // ... configure devices, start event handler
   SetKBRate(TPULSE, TDELAY); // Keyboard pulse and delay times in ms
   SetKBLayout(KB_ENG);
   // ... stuff
   MapKey(&Joystick, H2D, TEMPO(KP0,EXEC("snapview(2);"),TEMPODELAY));    // Radar Panel Snap View
   MapKey(&Joystick, H2L, TEMPO(KP0,EXEC("snapview(4);"),TEMPODELAY));    // Weapon Panel Snap View
   MapKey(&Joystick, H2R, TEMPO(KP0,EXEC("snapview(6);"),TEMPODELAY));    // Radar Filter Snap View
   // ... more stuff
}

Edited by PiedDroit
Posted (edited)
Cool. I didn't know you could tie a chain to an ActKey command. That is very useful.

The order of the KEYON, CHAIN and PULSE statements is quite important (KEYON outside the CHAIN, PULSE inside).

The delay inside the CHAIN is tricky, the way I put it works fine, you can use the event analyser to make test by yourself.

Edited by PiedDroit
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...