Elgato Stream Deck as configurable button box - ED Forums
 


Notices

Reply
 
Thread Tools Display Modes
Old 06-16-2017, 02:20 AM   #1
Ranma13
Member
 
Join Date: Feb 2013
Posts: 280
Default Elgato Stream Deck as configurable button box

Recently, Elgato released the Stream Deck, which is a device that looks like this:



It consists of an array of 5x3 buttons (15 buttons total), where each button has a small LCD screen built into it that can display a 72x72 pixel image. The intended market is for streamers so that they can push a button to do various things with their stream, such as automatically post on Twitter or display an overlay video in OBS. The official software is great when it comes to supporting these features, but outside of streamers, the software is limited to only pressing keyboard keys.

Through the magic of reverse-engineering the USB protocol, I was able to get the Stream Deck to display what I want it to:



By grabbing data through DCS BIOS, I'm also able to toggle the button images to reflect the state of the aircraft. Here is the Ka-50 in flight-ready mode, with master caution flashing:



There's also paging support:







The images will update correctly whether you click the button in the aircraft, or press the key on the Stream Deck itself. The Ka-50 is particularly well-suited for this device, as the aircraft uses plenty of LED push buttons.

In order to get this all working, I had to write two API libraries using NodeJS, one to convert the binary DCS BIOS export format into something easier to use (JavaScript objects), and another to interface with the Stream Deck through its USB HID protocol:

https://github.com/danieltian/dcs-bios-api
https://github.com/danieltian/stream-deck-api

They are available in NPM as well:

https://www.npmjs.com/package/dcs-bios-api
https://www.npmjs.com/package/stream-deck-api

Note that if you're interested in using these libraries, they are still under heavy development and will not be semver compatible until version 1.0.0. In other words, function names and signatures may change until I decide that they're stable.

If you have a Stream Deck and want to try it out with the Ka-50, you can check out this repo:

https://github.com/danieltian/dcs-stream-deck-ka50

You must have DCS BIOS installed first. Get it from https://github.com/dcs-bios/dcs-bios, then copy the Scripts folder to %USERPROFILE%\Saved Games\DCS\Scripts. If you already have an Export.lua file in that folder (most likely from Tacview), you will need to append this to the file instead:

Code:
dofile(lfs.writedir()..[[Scripts\DCS-BIOS\BIOS.lua]])
Then download dcs-stream-deck-ka50, go over to the folder and run npm install, then npm start. You will need to have NodeJS installed. Keep in mind that the Ka-50 repo is my own playground for the controls, so the layout and functionality of the keys will probably change a lot, but it can serve as a good example if you're interested in developing your own.

Last edited by Ranma13; 06-16-2017 at 02:26 AM.
Ranma13 is offline   Reply With Quote
Old 06-16-2017, 04:48 AM   #2
hansangb
Veteran
 
hansangb's Avatar
 
Join Date: May 2013
Location: New York
Posts: 3,704
Default

damn, that's pretty cool! Well done.
__________________
hsb
HW Spec in Spoiler
---
Spoiler:
i7-8700K Delid/OC'ed to 5.1GHz, EVGA Z370 MB, 32GB DDR4 3200MHz, EVGA 2080 Ti FTW3, NVMe+SSD, Win 10 x64 Pro, MFG, JetSeat, Warthog, TM MFDs, Komodo Huey set, CV1
hansangb is offline   Reply With Quote
Old 06-16-2017, 04:36 PM   #3
Ragtop
Member
 
Ragtop's Avatar
 
Join Date: Sep 2010
Location: Kent, UK
Posts: 595
Default

Outstanding work. I could use this to make an all-in-one radio panel for the A-10C, or naturally, anything else!
__________________
Ragtop is offline   Reply With Quote
Old 06-16-2017, 07:16 PM   #4
Lobinjaevel
Member
 
Lobinjaevel's Avatar
 
Join Date: Aug 2013
Location: Sweden
Posts: 173
Default

Fantastic work!
Looking forward to more, there is a LOT of potential in this!
Lobinjaevel is offline   Reply With Quote
Old 06-16-2017, 11:10 PM   #5
Ranma13
Member
 
Join Date: Feb 2013
Posts: 280
Default

Quote:
Originally Posted by Ragtop View Post
Outstanding work. I could use this to make an all-in-one radio panel for the A-10C, or naturally, anything else!
You read my mind ;-)







Instead of using images, I'm dynamically drawing the text. It doesn't look great though, and there are some centering issues (some of the text is shifted too far left). I'm still looking into how to make it look better, but for now it works pretty good. It sends keyboards commands rapidly to control the radio, which definitely feels a lot better than pressing the F keys.
Ranma13 is offline   Reply With Quote
Old 06-17-2017, 09:57 AM   #6
horus-DCS
Junior Member
 
Join Date: Sep 2016
Posts: 52
Default

This is awesome! I gotta search amazon for this device right now.


Sent from my iPhone using Tapatalk
horus-DCS is offline   Reply With Quote
Old 06-17-2017, 10:36 AM   #7
Ragtop
Member
 
Ragtop's Avatar
 
Join Date: Sep 2010
Location: Kent, UK
Posts: 595
Default

I may PM you soon with some questions. If I can do what I need with this, I'm buying one!
__________________
Ragtop is offline   Reply With Quote
Old 06-17-2017, 01:29 PM   #8
Thermal
Member
 
Join Date: Dec 2010
Location: South Aust
Posts: 208
Default

I have never run Javascript before, so its a bit of a journey to get this up and running, you need the entire environment set up.

1. Install node.js
https://nodejs.org/en/

2. You need to install the build-scripts for node.js, including python.
Open an admin powershell and run:
Code:
npm install --global --production windows-build-tools
(This took something like 5 minutes to complete)

3. Still in powershell, run:
Code:
npm install --global node-gyp
4. Open the node.js command prompt from the start menu (installed with node.js) and run:
Code:
setx PYTHON "%USERPROFILE%\.windows-build-tools\python27\python.exe"
Close the cmd prompt and run it again. Do "set PYTHON" to verify that its working.

5. In node.js command prompt, install the stream-deck-api <--- I dont think you need to do this, its installed with dcs-stream-deck-ka50
"npm install stream-deck-api"

6. Install Git (needed for dc-stream-deck-ka50 to install)
https://www.atlassian.com/git/tutori...ll-git#windows

7. Install dcs-stream-deck-ka50
Grab the zip from https://github.com/danieltian/dcs-stream-deck-ka50, unzip into a folder and from in that same directory, using the node.js command line:
Code:
npm install
8. Run it
Code:
npm start
9. Bathe in the glorious-ness of your Stream Deck being bent to you will!

Last edited by Thermal; 06-17-2017 at 01:38 PM.
Thermal is offline   Reply With Quote
Old 06-17-2017, 02:35 PM   #9
Ranma13
Member
 
Join Date: Feb 2013
Posts: 280
Default

Now would be a good time to mention that, at this time, the libraries are written by a dev, intended for other devs. I do have plans to create a UI for all this in the future, but I'm still working towards a v1.0 stable release for the libraries. There's still some missing features that I'd like to add first (like good text support and good documentation) before I can start work on the UI. The UI will also take some time to complete because I intend for it to be generic, with features added through plugins. There's already some interest in using the Stream Deck for other purposes besides DCS, such as a MIDI controller, so the UI will need to support these kinds of workflows.

With that said, if you want to be on the bleeding edge of pre-pre-pre-alpha, you can give it a try now and it should work for the most part. The above post with the instructions is good, but you should be able to follow this set of simplified steps:

1. Install node.js from https://nodejs.org. Download the LTS (long-term support) version.

2. Install DCS BIOS if you haven't already.

3. Download dcs-stream-deck-ka50 from https://github.com/danieltian/dcs-stream-deck-ka50 by clicking on the green Clone or download button on the upper right, then Download ZIP. Unzip it somewhere.

4. Open up command prompt (or PowerShell, both will work) and cd over to the unzipped folder. Run "npm install". This will take a while to complete.

5. Run "npm start" and it should display stuff on the Stream Deck.

If you're getting errors about needing windows-build-tools, please let me know what the error is. I purposely designed the library to minimize external dependencies, so even Python shouldn't be necessary.

As a side note, I was curious whether it would work, so I gave this a try:



It will instantly set every switch in the Ka-50 to the correct position, and will also start up the APU, wait for it to be ready, start both engines, and then plays "aircraft is ready" through the text-to-speech engine. Realistic? No way . But it's fun to go from a ramp start to fully flyable in less than a minute , by pressing a single key (even auto-start requires 2 key presses!).
Ranma13 is offline   Reply With Quote
Old 06-17-2017, 03:05 PM   #10
Thermal
Member
 
Join Date: Dec 2010
Location: South Aust
Posts: 208
Default

Quote:
Originally Posted by Ranma13 View Post
Now would be a good time to mention that, at this time, the libraries are written by a dev, intended for other devs.
Totally understood. I've not looked at Javascript before, so why not start now

FYI, dcs-stream-deck-ka50 was not installing because it could not find my GIT path.
Thermal is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT. The time now is 03:50 PM. vBulletin Skin by ForumMonkeys. Powered by vBulletin®.
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.