Gadroc Posted September 27, 2009 Posted September 27, 2009 I built myself a quick general purpose pit, and I was able to snag myself a 15" touch screen on the cheap. I've been using TouchBuddy with DickDastardly's profiles so far, but following some of the other builders threads here inspired me to want a little more. Namely I want the indicators on the touch screen synced with those in game. I've had several times where some situations in game have de-synced my and it's a pain in mid mission to flip switches around to sync them again. That combined with the a few other annoyances from touch-buddy resulted in my starting to write a C# touch buddy replacement. I have the basics in place and thanks to Oakes and Panel Builders posts I have it communicating with Black Shark both to receive indicator lights and send commands. The problem I have is the inconsistency in the reading from get_argument_value(). For Bank Hold switch, which is argument 330. Starting from a cold bird will read 0.0, click on the button will switch it between 0.3 and 0.0. I then set up my software to turn the touch screen lamp on and off based on these values. Pop back into the sim and I can set autopilot modes from either virtual cockpit or my touch screen and every thing works! Yea! Now I load up the first mission of the campaign to test some more. Now there is a problem the virtual cockpit auto pilot lamps are on, but my touch screen has them showing off. After a little snooping I realize the value is reading 0.1 at the start of the mission, so I reset my software to look for 0.0 as off and any other value as on. Once again I think all is good until I test a little more. Now when I do a barrel roll which flashes the auto pilot panel and then turns it off. My touch screen flashes them but leaves them on. I look in the logs to discover that now the argument reads a 0.1, but the lamp is off in the virtual cockpit. Has anyone else figured out how to interpret these values correctly? Should I treat any reading lower than last frame as an indication the lamp is no longer lit and vice versa?
ruprecht Posted September 27, 2009 Posted September 27, 2009 I know, it's insane isn't it. I found the same with the Master Caution light - which starts off at 0.0, then on at 0.3, then off at 0.2 etc. What is so hard with 1=on, 0=off? Trial and error my friend! DCS Wishlist: | Navy F-14 | Navy F/A-18 | AH-6 | Navy A-6 | Official Navy A-4 | Carrier Ops | Dynamic Campaign | Marine AH-1 | Streaming DCS sometimes:
Oakes Posted September 27, 2009 Posted September 27, 2009 (edited) For the datalink buttons (haven't checked any other buttons) the following logic applies: 0 = Button is not pushed and indicator is off. 0.1 = Button is not pushed and indicator is on 0.2 = Button is pushed and indicator is off 0.3 = Button is pushed and indicator is on If round(lamp) == 0 or round(lamp) == 0.2 then -- code for lamp off else -- code for lamp on end I suspect that there is a smarter way to do this test since 0 = not pushed, 0.2 = pushed and if you add 0.1 to this it means that the indicator is on. Anyway, you can use this to know the complete status of the button not just the indicator. Secondly, I checked the values and I get something like 0.1000002325 and 0.200000423 rather than 0.1 and 0.2 so I use a round function to get rid of the "tail" so to say, you can check in ExportSupport.lua (<- from my scripts) for a good round function. /Oakes Edited September 27, 2009 by Oakes
Gadroc Posted September 28, 2009 Author Posted September 28, 2009 I did notice that I was not properly sending a stop action to release the buttons. Once I started correctly sending the stop action I had fewer problems. I'll reset my config to match your findings and see how it goes. I also noticed the rounding errors on the values. I send the values across and interpret them in my control application. I send the values using string.format("%.1f", lArgumentValue) which trims off the extra. I'd image those values hold true for all buttons with indicator lights.
ruprecht Posted September 28, 2009 Posted September 28, 2009 can the stop action be bound to a key? e.g. for master caution or the targeting mode control panel? cheers DCS Wishlist: | Navy F-14 | Navy F/A-18 | AH-6 | Navy A-6 | Official Navy A-4 | Carrier Ops | Dynamic Campaign | Marine AH-1 | Streaming DCS sometimes:
Gadroc Posted September 28, 2009 Author Posted September 28, 2009 I'm not sure about the question. The stop action is the equivalent of a keyup event for the push buttons in the sim. For example to press the Number 0 Key on the PVI keypad you need to execute two following commands. // The first call presses down the button (equivalent of key or mouse down) GetDevice(20):performClickableAction(3001,0.2); // The second call releases the button (equivalent of key or mouse up) GetDevice(20):performClickableAction(3001,0.0); If you never fire off the second command the button stays depressed and things don't quite work as expected. My current touch screen application sends the first command on mouse down and the second on mouse up. Multi-position switches work different though you only send one command with the value representing which switch setting you want.
ruprecht Posted September 29, 2009 Posted September 29, 2009 (edited) Hi Gadroc, The keyup event is my issue. I've built a Weapon System Control Panel as seen here: You can see at 1:30 when I press Reset, the light stays lit and doesn't go off until I hit backspace. The pushbutton is mapped to the key backspace, but it seems that the software only sends the key down event, not the keyup event. I'm wondering if theres any way to force a keyup via keyboard mapping rather than Lua direct. Appreciate that this may be a "feature" of the specific keymapping software I'm using (BetaInnovations F4IM). Edited September 29, 2009 by ruprecht DCS Wishlist: | Navy F-14 | Navy F/A-18 | AH-6 | Navy A-6 | Official Navy A-4 | Carrier Ops | Dynamic Campaign | Marine AH-1 | Streaming DCS sometimes:
Gadroc Posted September 29, 2009 Author Posted September 29, 2009 Ok I see what you mean. That would be an issue with the mapping software. I would hope that you could configure it to send both, but it looks like BetaInnovations is closed so I couldn't find any information on it. How are the buttons interfaced with the computer?
ruprecht Posted September 29, 2009 Posted September 29, 2009 It's a BetaInnovations GammaRayV2, wired direct to the switches. The issue's definitely in the software - it seems it only sends key down, and for most apps that's enough. Will keep poking around, thanks DCS Wishlist: | Navy F-14 | Navy F/A-18 | AH-6 | Navy A-6 | Official Navy A-4 | Carrier Ops | Dynamic Campaign | Marine AH-1 | Streaming DCS sometimes:
JAG Posted September 30, 2009 Posted September 30, 2009 Hi guys, the same values of: 0 0.1 0.2 0.3 applies to the left panel lamps? Saludos Quick guide to configure ABRIS and LCD mini monitor Quick Countermeasure Editor v1.3.0 Core i5 3570K 4.0Ghz | GIGABYTE MOTHERBOARD | Crucial M4 120GB | 8GB DDR3 1600 MHZ | ASUS GTX 670 | AOC LED 23" | AOC LCD 24" | HYBRID DUAL THROTTLE (SAITEK THROTTLE QUADRANT + SUNCOM DUAL THROTTLE) | CH FIGHTERSTICK | SAITEK PRO PEDALS |
ruprecht Posted September 30, 2009 Posted September 30, 2009 0 = Button is not pushed and indicator is off. 0.1 = Button is not pushed and indicator is on 0.2 = Button is pushed and indicator is off 0.3 = Button is pushed and indicator is on This is correct also for the Targeting Mode Control Panel and Master Caution Reset in my experience. DCS Wishlist: | Navy F-14 | Navy F/A-18 | AH-6 | Navy A-6 | Official Navy A-4 | Carrier Ops | Dynamic Campaign | Marine AH-1 | Streaming DCS sometimes:
C6_Hellfrog Posted December 16, 2009 Posted December 16, 2009 Up : what about the HUD switch, for which values are -1.0, 0.0, and 1.0 : does anyone understand how it work ?
Recommended Posts