Results 1 to 7 of 7
  1. #1
    150+ Forum Groupie sas550's Avatar
    Join Date
    May 2007
    Location
    Sweden
    Posts
    236
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Hat switch for view control with SIOC

    Hi! Need a sioc expert advice.

    I have struggled with a hat switch on a slaughtered CH Yoke to try to make work as pov hat to use for changing views.
    I have come so far that I got it to shift the views properly except for the up button.
    The up button has to be set to "pan_up" so that I can use it to tilt with in outside view. But that's no biggie since I use the "ptt" button in front of the hat to reset the view forward in cockpit view.

    The hat switch is 4 separate buttons and I've managed to program them so that I have seven views (forward missing as explained earlier).
    What I cant get to work is having the commands repeating so I don't have to push several times in outside view to pan.
    Having looked at Nico page on how to do an auto repeat function but I can't implement it on my code. Now maybe there's an easier way of coding this but that's over my head.

    Here's my code:

    Var 0080, name hat_up, Link IOCARD_SW, Input 58
    {
    IF &hat_up = 1
    {
    IF &hat_left = 0
    {
    IF &hat_right = 0
    {
    &Send_fscontrol = 65734 //pan_up
    }
    }
    }
    IF &hat_up = 1
    {
    IF &hat_right = 1
    {
    &Send_fscontrol = 65856 //pan_right_up
    }
    }
    ELSE
    {
    &Send_fscontrol = 0
    }
    }
    Var 0081, name hat_right, Link IOCARD_SW, Input 61
    {
    IF &hat_right = 1
    {
    IF &hat_up = 0
    {
    IF &hat_down = 0
    {
    &Send_fscontrol = 65672 //pan_right
    }
    }
    }
    IF &hat_right = 1
    {
    IF &hat_down = 1
    {
    &Send_fscontrol = 65857 //pan_right_down
    }
    }
    ELSE
    {
    &Send_fscontrol = 0
    }
    }
    Var 0082, name hat_down, Link IOCARD_SW, Input 59
    {
    IF &hat_down = 1
    {
    IF &hat_right = 0
    {
    IF &hat_left = 0
    {
    &Send_fscontrol = 65735 //pan_down
    }
    }
    }
    IF &hat_down = 1
    {
    IF &hat_left = 1
    {
    &Send_fscontrol = 65855 //pan_down_left
    }
    }
    ELSE
    {
    &Send_fscontrol = 0
    }
    }
    Var 0083, name hat_left, Link IOCARD_SW, Input 62
    {
    IF &hat_left = 1
    {
    IF &hat_down = 0
    {
    IF &hat_up = 0
    {
    &Send_fscontrol = 65671 //pan_left
    }
    }
    }
    IF &hat_left = 1
    {
    IF &hat_up = 1
    {
    &Send_fscontrol = 65854 //pan_left_up
    }
    }
    ELSE
    {
    &Send_fscontrol = 0
    }
    }
    Var 0084, name Send_fscontrol, Link FSUIPC_OUT, Offset $3110, Length 4
    Regards Anders Eriksson


    www.simcockpit.se

    FS9

  2. #2
    150+ Forum Groupie Suggy's Avatar
    Join Date
    Oct 2005
    Location
    Hull, England
    Posts
    153
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Hello, Anders.

    It is much easier if you assign the switch as a joystick button and then assign the action in FSUIPC. This method allows you to assign 32 buttons for each virtual joystick. I have used this method myself to assign pan view commands. If you use all 32 buttons on your virtual joystick i.e. 0-31 bit toggles, then simply create another one (you need to add 4 to the offset - see the last 2 lines for explanation).
    It's MUCH easier to do it this way!
    Hope this helps,
    Darren Sugden


    Here is a section of my code to give you an idea:

    //************************
    //Joystick Button Emulator
    //************************

    Var 200 Link IOCARD_SW Input 152 Type I
    {
    &FO_JoyStick65 = CHANGEBIT 0 v200 // toggle bit 0 of joystick 65
    }


    Var 201 Link IOCARD_SW Input 163 Type I //
    {
    &FO_JoyStick65 = CHANGEBIT 1 v201 // toggle bit 1 of joystick 65
    }


    Var 202 Link IOCARD_SW Input 160 Type I //
    {
    &FO_JoyStick65 = CHANGEBIT 2 v202 // toggle bit 2 of joystick 65
    }


    Var 203 Link IOCARD_SW Input 162 Type I //
    {
    &FO_JoyStick65 = CHANGEBIT 3 v203 // toggle bit 3 of joystick 65
    }

    Var 224 name FO_JoyStick65 Link FSUIPC_OUT Offset $3340 Length 4

    //To assign another joystick then it would look like:
    //Var 230 name FO_JoyStick66 Link FSUIPC_OUT Offset $3344 Length 4

  3. #3
    150+ Forum Groupie sas550's Avatar
    Join Date
    May 2007
    Location
    Sweden
    Posts
    236
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Quote Originally Posted by Suggy View Post
    Hello, Anders.

    It is much easier if you assign the switch as a joystick button and then assign the action in FSUIPC. This method allows you to assign 32 buttons for each virtual joystick. I have used this method myself to assign pan view commands. If you use all 32 buttons on your virtual joystick i.e. 0-31 bit toggles, then simply create another one (you need to add 4 to the offset - see the last 2 lines for explanation).
    It's MUCH easier to do it this way!
    Hope this helps,
    Darren Sugden


    4
    Hi! Tnx for your answer. The problem with this solition is that you cannot get the side views working, ie. right_up where both up and right buttons are pushed, since you cannot assign a two button push this way.
    I had that setup and I also found some stuff in the FSUIPC for advanced users about assigning one function to a two button push but I didn't get it working, or more likely , didn't understand it fully.
    With my code I can have all the eight views working but I need them to repeat while held. That's needed in the outside view. For the cockpit view it's working since there I only need a pulse.
    Regards Anders Eriksson


    www.simcockpit.se

    FS9

  4. #4
    150+ Forum Groupie Suggy's Avatar
    Join Date
    Oct 2005
    Location
    Hull, England
    Posts
    153
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    ..."The problem with this solition is that you cannot get the side views working, ie. right_up where both up and right buttons are pushed, since you cannot assign a two button push this way."

    When you select 'Buttons + Switches" in the FSUIPC tab, press the joystick button. Then make sure the 'Select for FS control' is ticked. Then scroll down the 'Control sent when button pressed' box until you see 'Pan Right Up'. Select that and make sure the 'Control to repeat held' is selected.

    Plug in a joystick to try it. If it works then it will work through a virtual joystick button. At the moment I have a Thrustmaster analogue controller connected to the sim and I have assigned the 8 way analogue D-pad as above. Works perfectly including the outside view with continuuos panning.

    Regards,
    Darren

  5. #5
    150+ Forum Groupie sas550's Avatar
    Join Date
    May 2007
    Location
    Sweden
    Posts
    236
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    I hear you brother.

    My hat switch isn't driven by any software and consists of 4 buttons. To have a sideview like right_up both up and right buttons must be pushed. That works perfectly when the yoke is driven by it's ch software wich takes care of a double button push and send a signal to Fsuipc or Fs itself as a normal button with a uniqe id.

    But this yoke consists of nothing but the hardware swithes wich I have soldered new wires on and connected to a mastercard so if there isn't an option for two button pushing in Fsuipc, wich I didn't find, I think a timer is the way to go here. I struggled abit whit the examples from nico's side but again it very complex when You only have a very basic understanding.
    Regards Anders Eriksson


    www.simcockpit.se

    FS9

  6. #6
    150+ Forum Groupie Suggy's Avatar
    Join Date
    Oct 2005
    Location
    Hull, England
    Posts
    153
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Quote Originally Posted by sas550 View Post
    I hear you brother.

    My hat switch isn't driven by any software and consists of 4 buttons. To have a sideview like right_up both up and right buttons must be pushed. That works perfectly when the yoke is driven by it's ch software wich takes care of a double button push and send a signal to Fsuipc or Fs itself as a normal button with a uniqe id.

    But this yoke consists of nothing but the hardware swithes wich I have soldered new wires on and connected to a mastercard so if there isn't an option for two button pushing in Fsuipc, wich I didn't find, I think a timer is the way to go here. I struggled abit whit the examples from nico's side but again it very complex when You only have a very basic understanding.

    Hello Anders.
    Sorry, I now understand your 'problem'.
    I am unable to help any further
    Darren

  7. #7
    150+ Forum Groupie sas550's Avatar
    Join Date
    May 2007
    Location
    Sweden
    Posts
    236
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Quote Originally Posted by Suggy View Post
    Hello Anders.
    Sorry, I now understand your 'problem'.
    I am unable to help any further
    Darren

    Tnx for trying
    Regards Anders Eriksson


    www.simcockpit.se

    FS9

Similar Threads

  1. outside cockpit View
    By 747captian in forum Cockpit Outside Visualization
    Replies: 2
    Last Post: 01-02-2009, 08:32 AM
  2. 360 view of several cockpits
    By ivar hestnes in forum Pilots Lounge - Let your Hair down
    Replies: 1
    Last Post: 12-30-2008, 05:32 PM
  3. Anyone need a fuel control switch???
    By Michael Carter in forum Where to Start Building a Home Cockpit
    Replies: 11
    Last Post: 09-12-2008, 11:25 PM
  4. Using of Real VNC to View & Control All PC's
    By chrisdanker in forum Computer Hardware Setup
    Replies: 30
    Last Post: 08-28-2008, 08:50 PM