Jump to content
Sign in to follow this  
Paul Crumley

Buttons don't work

Recommended Posts

I did some searching through this forum, but couldn't find anything helpful about my problem.

 

I am using LINDA Version 2.7, The module information is all n/a (module, author, version and date) - I don't know if this matters.

 

My flight sim is FSX-SE, FSUIPC Version 4.947c, properly registered, and I am trying to develop a personal model of the MAAM type DC-3 with a physical switch panel.  I have a homemade joystick system that provides 8 analog channels and 112 push buttons.

 

The system-level joystick properties form recognizes the joystick, as do FSUIPC and LINDA.  When I push a button the red dot illuminates in the windows calibration utility, and FSUIPC recognizes the button on the "Buttons + Switches" tab.  So I don't think I have any hardware issues or ms-fs-fsuipc software problems.  However, I haven't been able to get any of my functions in LINDA to work with a button press.

 

i can read and set all the L:Vars with the LINDA application, and when I select the FSUICP Buttons and Switches tab the LINDA trace window reports "FirstButtonChange res = 0000100 (0.1,0)"  when I click button 1.

 

In the actions.lua file I have the following simple functions:

 

function Battery_on ()
         ipc.writeLvar("L:Battery_Switch",1)
end

function Battery_off ()
         ipc.writeLvar("L:Battery_Switch",0)
end

 

The config-hid.lua reads:

 

-- ## MJ16 ## (000000020) ## {1.3} ############

JSTK["000000020"][1]="Battery_on"
JSTKrl["000000020"][1]="Battery_off"

 

Button 1 does nothing either way.

 

If I disable and reenable the device in the Setup Joysticks mode I get:

 

[LINDA] HID - Switch Device 1

 

then the following sequence:

 

HID Switch Device - hidTreeFill entered

HID Switch Device - hidTreeFill knownid 1

HID Switch Device - hidTreeFill update buttons

HID Switch Device - hidTreeFill update buttons end

HID Switch Device - hidTreeFill update hats

HID Switch Device - hidTreeFill update end

LUA.0: [EVNT] Configs reloaded!

 

Where do I go from here?
 

Share this post


Link to post
Share on other sites

Hi Paul

 

Welcome to LINDA. Thank you for the detailed description. I am away at present so I can't you a definite answer or delve deep into you problem.

 

First are your Joystick buttons on/off or toggle switches. The assignment using OnPress and OnRelease only applies to switch implementations. You may need to write your own toggle function.

 

Second, to better see whether LINDA is seeing you button operation is to switch on debugging. Find the config-vri.lua file in /modules/linda-cfg/system. Edit the line DEBUG=1 to =2, save and restart LINDA. You will see each button press and corresponding function displayed in the Console.

 

Finally, the strange issue is your Joystick has no or 0000 as the VID and PID. But it does have a serial number.


Andrew Gransden

Scotland, UK

LINDA Support/Developer - VATSIM and BAVirtual - Airbus Flyer

i7 1TB SSD GTX980 - FSX/P3D - Aerosoft Airbus A318/A319/A320/A321 - FS2Crew

Share this post


Link to post
Share on other sites

Thanks for the very fast response!

 

The control in question is a toggle switch, but I wasn't sure that would have an effect -  I do have sixteen software toggles, each one sending a different button bit for each state change. I'll try that, though it seems to me that the sim/fsuipc, etc. wouldn't know if it was a toggle switch or a heavy finger on a button!

 

The VID is set to zero and the PID should be 0x0002 in this device, since it uses home-brew software (thanks to Mindaugas Milasauskas, who, regrettably, seems to have disappeared. . .).  Through a convoluted process I have disassembled and reconstructed the Atmel asm source code for this, intending to create more rows of toggle-to-button conversions if necessary. The source code reads:

 

.equ    USBversion        =0x0100        ;USB version (1.00)
.equ    VendorID        =0x0000        ;Vendor identifier
.equ    ProductID        =0x0002        ;product identifier (USB Joystick)
.equ    DeviceVersion    =0x0103        ;version number of product (version=1.3 - MJ16 with autocalibration)
.equ    MaxUSBCurrent    =0xA0        ;current consumption from USB (100mA - arbitrary)
;------------------------------------------------------------------------------------------
DeviceDescriptor:
    .db        0x12,0x01    ;0E1D 0112
    .dw        USBversion    ;0x00,0x01  
    .db        0x00,0x00    ;0E1F 0000
    .db        0x00,0x08    ;0E20 0800
VendorDescriptor:
    .dw        VendorID    ;0x00,0x00
    .dw        ProductID    ;0x02,0x00
    .dw        DeviceVersion    ;0E23 0103
    .db        0x01,0x02    ;0E24 0201
    .db        0x03,0x01    ;0E25 0103 (0x03 is a reference to a serial number, but I don't know how it would b assigned.)
DeviceDescriptorEnd:

 

I can easily reconfigure my joystick (which is actually being used as a throttle and switch panel controller) to send the converted toggle-to-buttons as the first 32 buttons, so that will probably be my first try.

 

Again, thanks for the quick answer.

 

Paul

Share this post


Link to post
Share on other sites

Okay!!!  I did the reconfiguration, and it works.  A couple of minor things. . . there are only 16 available toggle/buttons available.  This means reprogramming the ATMEGA, but that should be doable.

 

The ATMEGA software sends the Button six times per switch movement - this results in six iterations of the related functions, but again, this should be fixable.

 

I also think the software allows for synchronization of the toggles to the aircraft state.  That's my next step - verify that it works that way, and then. . . well, I'm cooking along now.  Still a long way on the physical side, but fun, nonetheless.

 

Thanks for your suggestion - You saved me a lot of head scratching an poking around.

 

Paul

Share this post


Link to post
Share on other sites

Glad to have helped. I found with the Saitek Panels that the switches/buttons are not been read on start up but are all positions are read when the first one is operated. I have yet to find a solution in LINDA to overcome this.


Andrew Gransden

Scotland, UK

LINDA Support/Developer - VATSIM and BAVirtual - Airbus Flyer

i7 1TB SSD GTX980 - FSX/P3D - Aerosoft Airbus A318/A319/A320/A321 - FS2Crew

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  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...