Jump to content

DCS-BIOS Discussion Thread


FSFIan

Recommended Posts

This might help you Adrian, these are for a 16x2 display.

 

 

 

void onVhfamFreq1Change(char* newValue) {

lcd2.setCursor(1, 0);

lcd2.print(newValue);

}

DcsBios::StringBuffer<2> vhfamFreq1StrBuffer(0x1190, onVhfamFreq1Change);

 

 

void onVhfamFreq4Change(char* newValue) {

lcd2.setCursor(8, 0);

lcd2.print(newValue);

}

DcsBios::StringBuffer<2> vhfamFreq4StrBuffer(0x1192, onVhfamFreq4Change);

 

void onVhffmFreq1Change(char* newValue) {

lcd2.setCursor(1, 1);

lcd2.print(newValue);

}

DcsBios::StringBuffer<2> vhffmFreq1StrBuffer(0x119a, onVhffmFreq1Change);

 

void onVhffmFreq4Change(char* newValue) {

lcd2.setCursor(8, 1);

lcd2.print(newValue);

}

DcsBios::StringBuffer<2> vhffmFreq4StrBuffer(0x119e, onVhffmFreq4Change);

 

void onDcsBiosWrite(unsigned int address, unsigned int value) {

 

 

if (address == 0x118e) {

unsigned int vhfamFreq2Value = (value & 0x00f0) >> 4;

lcd2.setCursor(4, 0);

lcd2.print(vhfamFreq2Value);

}

 

if (address == 0x118e) {

unsigned int vhfamFreq3Value = (value & 0x0f00) >> 8;

lcd2.setCursor(6, 0);

lcd2.print(vhfamFreq3Value);

}

if (address == 0x119c) {

unsigned int vhffmFreq2Value = (value & 0x000f) >> 0;

lcd2.setCursor(4, 1);

lcd2.print(vhffmFreq2Value);

}

if (address == 0x119c) {

unsigned int vhffmFreq3Value = (value & 0x00f0) >> 4;

lcd2.setCursor(6, 1);

lcd2.print(vhffmFreq3Value);

}

 

 

 

}

AMD A8-5600K @ 4GHz, Radeon 7970 6Gig, 16 Gig Ram, Win 10 , 250 gig SSD, 40" Screen + 22 inch below, Track Ir, TMWH, Saitek combat pedals & a loose nut behind the stick :thumbup:

Link to comment
Share on other sites

Hi guys, today I have been tinkering with the fuel gauge panel and I am trying to make my lcd display total amount of fuel and the truth is I can not. I listed the three numbers you can see in the picture, the lua code I'm using Arduino is as follows:

 

#include <DcsBios.h>

#include <Servo.h>

#include <LiquidCrystal.h>

 

LiquidCrystal lcd(12,11,5,4,3,2);

 

/**** Make your changes after this line ****/

void onDcsBiosWrite(unsigned int address, unsigned int value) {

if (address == 0x10ce) {

unsigned int fuelQty10000Value = (value & 0xffff) >> 0;

lcd.setCursor(0, 0);

lcd.print(fuelQty10000Value);

}

if (address == 0x10d0) {

unsigned int fuelQty1000Value = (value & 0xffff) >> 0;

lcd.setCursor(5, 0);

lcd.print(fuelQty1000Value);

}

if (address == 0x10d2) {

unsigned int fuelQty100Value = (value & 0xffff) >> 0;

lcd.setCursor(11, 0);

lcd.print(fuelQty100Value);

}

}

 

 

 

 

 

/**** In most cases, you do not have to change anything below this line ****/

 

/* Instantiate a ProtocolParser object to parse the DCS-BIOS export stream */

DcsBios:: ProtocolParser parser;

 

void setup() {

Serial.begin(500000);

lcd.begin(16,2);

lcd.clear();

}

 

 

 

3JlYQjH.jpg

 

Could you help me again? sorry for not be so skilled.

I use the Arduino Uno R3 is and have verified the correct connection of the LCD, it works correctly.

 

Thank you very much for your time.


Edited by Adrian_gc
Link to comment
Share on other sites

Hi guys, finally found the solution tinkering with a friend late in the morning lol. In case anyone has the same problem or need someone here it is:

 

jov8dMx.jpg

#include <DcsBios.h>

#include <Servo.h>

#include <LiquidCrystal.h>

 

LiquidCrystal lcd(12,11,5,4,3,2);

 

/**** Make your changes after this line ****/

void onDcsBiosWrite(unsigned int address, unsigned int value) {

 

if (address == 0x10ce) {

unsigned int fuelQty10000Value = (value & 0xffff) >> 0;

lcd.setCursor(0, 0);

lcd.print(fuelQty10000Value/6553);

}

if (address == 0x10d0) {

unsigned int fuelQty1000Value = (value & 0xffff) >> 0;

lcd.setCursor(1, 0);

lcd.print(fuelQty1000Value/6553);

}

if (address == 0x10d2) {

unsigned int fuelQty100Value = (value & 0xffff) >> 0;

lcd.setCursor(2, 0);

lcd.print(fuelQty100Value/6553);

}

 

}

 

DcsBios:: ProtocolParser parser;

 

void setup() {

Serial.begin(500000);

lcd.begin(16,2);

lcd.clear();

lcd.setCursor(3, 0);

lcd.print("00");

 

}

 

 

 

Thanks !!!!


Edited by Adrian_gc
Link to comment
Share on other sites

  • 3 weeks later...

Arduino wifi shield

 

Hi

Would there be any benefits of using Arduino WIFI shield instead of USB or RJ45?

 

Thanks

 

Neal

Desktop PC:

Intel i7 14700K, MSI Z790 MAG Tomahawk MOBO, 64Gb RAM , GPU Nvidia RTX 3080ti

Windows 11, VPC joystick, Crosswind rudder peddles, HP Reverb G2, VPC Collective, DOF Reality H2, Gametrix seat, WinWing panels.

Link to comment
Share on other sites

Hi

Would there be any benefits of using Arduino WIFI shield instead of USB or RJ45?

 

Thanks

 

Neal

 

I am slightly confused by your question -- the difference is obvious (communication is wireless, but your panel still needs power) and whether that is an advantage depends on your individual situation, so you are in a much better position to answer that question than anyone else.

 

If one of your panels happens to be in a location where power is available (i.e. from a wall socket next to it) but routing a cable from your PC to it is inconvenient for some reason (maybe you are building a door into your simpit?), then a wireless solution might be advantageous.

 

Otherwise, I don't think it would make any noticeable difference, assuming you are not in an area where the wifi frequency spectrum is very congested or your wifi module is designed to sacrifice latency for low energy consumption.

Link to comment
Share on other sites

Hi

the only reason for asking was one of type/ease of connection i.e. reducing cables to pc. I have the cockpit built and have just finished making the panel faceplates, I have purchased all the switches, rotaries etc, the only items left to purchase are the Arduino boards and my understanding is there are 3 main connection options USB, RJ45 and Wifi(?) I have been following a number of threads that are discussing (Gremlins) I2C bus and ethernet options,which led me to wonder what benefits wifi would offer, within this context. I dont have an overly long usb cable run from cockpit to PC but it does require approx 6m length of USB cable for example.

 

Thanks for your views and this excellent programme.

 

Neal

Desktop PC:

Intel i7 14700K, MSI Z790 MAG Tomahawk MOBO, 64Gb RAM , GPU Nvidia RTX 3080ti

Windows 11, VPC joystick, Crosswind rudder peddles, HP Reverb G2, VPC Collective, DOF Reality H2, Gametrix seat, WinWing panels.

Link to comment
Share on other sites

I've a question regarding voltage divider circuits. Does DCS Bios support switches which are connected to the analog inputs of the Arduino with a voltage divider? Is it possible to 'trigger' a DCS Bios 'update switch' with a function call?

Link to comment
Share on other sites

I've a question regarding voltage divider circuits. Does DCS Bios support switches which are connected to the analog inputs of the Arduino with a voltage divider?

 

That should be easy enough to add if you copy the SwitchMultiPos class and modify the readState() method to read from an analog pin instead.

 

DCS-BIOS supports anything that you can get your Arduino board to talk to. The "import protocol" is documented in the Developer Guide -- in the Arduino library, it boils down to calling sendDcsBiosMessage("CONTROL_INDENTIFIER", "ARGUMENT"). The accepted arguments depend on what input interfaces your control supports (those are listed in the control reference docs in "advanced view"). For multiposition switches, the argument is "0", "1", "2", etc. to select a specific position.

Link to comment
Share on other sites

Yeah,

 

I just read through the code. Should be quite easy. In Sept. I've holidays and then I'll recreate my existing button box. Right now, it uses a self developed Arduino board interfacing a python app on my computer. This app then send commands to DCS. Thus, mapping of hardware messages to dcs messages can be done on the fly.

 

I also consider using a Leonardo or a Arduino Mega + HID Flash to create a HID 'gamepad' thus my button box can be used in any game/sim...

Link to comment
Share on other sites

Hi

the only reason for asking was one of type/ease of connection i.e. reducing cables to pc. I have the cockpit built and have just finished making the panel faceplates, I have purchased all the switches, rotaries etc, the only items left to purchase are the Arduino boards and my understanding is there are 3 main connection options USB, RJ45 and Wifi(?) I have been following a number of threads that are discussing (Gremlins) I2C bus and ethernet options,which led me to wonder what benefits wifi would offer, within this context. I dont have an overly long usb cable run from cockpit to PC but it does require approx 6m length of USB cable for example.

 

Thanks for your views and this excellent programme.

 

Neal

Hi Neal

 

I've bounced around a few options and ended up using Ethernet for my pit. Whilst it means you have to understand a little about IP addressing it means the all of the output is completely isolated from the PC. It costs a little bit more with having an Ethernet shield for each Arduino, but you don't need that many in the bit. Another benefit is the output electronics is completely independent of any updates to the PC.

 

On powering the Arduinos, I still power them off USB hubs, I've found some shields haven't behaved as well as they could have using external power supplies. I don't connect the USB hubs to the PC, primarily so the sketches don't get unexpected resets doing a restart of the PC.

 

Cheers

 

Peter

Link to comment
Share on other sites

  • 2 weeks later...

Because there hasn't been a new release for quite a while, here's a quick update.

 

I am working on the next version of the DCS-BIOS Arduino library, which involves rewriting the majority of it. It will be released as v0.2.0 when it is done.

 

The following new features are planned for v0.2.x:

  • (1) RS-485 support. You will be able to turn an Arduino Mega into a hub that connects up to three RS-485 buses to the PC. Because of processing time limitations, this board will be dedicated to the hub function and you won't be able to use its remaining I/O pins to connect panels (I may add the ability to use those for inputs only at a later date).
     
  • (2) Support for I/O expanders, shift registers, etc. All classes that accept pin numbers (Switch2Pos, LED, etc.) will actually be class templates that accept a template parameter that allows you to supply your own versions of pinMode(), digitalRead(), digitalWrite() and analogRead(). With that feature, it will get easier to use I/O pins on I2C port expanders or shift registers.
     
  • (3) Standardization of the serial communication speed at 250000 bps.
     
  • (4) Interrupt-driven communication handling. Currently, defining lots of controls or having several outputs that take a while to update (such as LCDs) can cause the serial receive buffer to fill up. That causes incoming data to be lost, which results in no updates at all or garbage data being displayed. The current workaround is to reduce the serial communication speed and hope for the best.
     
    In v0.2.x of the library, all communication will be handled in interrupt service routines, so that a long display update can be interrupted to process a new incoming byte. That should guarantee reliable operation at 250000 bps.

 

(1), (2) and (3) are mostly implemented and I have a pretty good idea of the algorithms and data structures I want to use to implement (4) now.

 

I won't name any release date, because I don't want to make promises I can't keep. It's very hard for me to predict progress because the amount of time I have to work on this varies a lot. And then there's varying levels of productivity -- sometimes I spend an hour trying and failing to implement something, and then there are days where suddenly everything is going well and 12 hours later I have ignored everything else and bidirectional communication over RS-485 is working.

 

However, those of you who are interested in the RS-485 solution might want to order a bunch of MAX487 chips and one Arduino Mega now. You will need up to three MAX487 chips for the Mega acting as the hub and one per slave device.

 

If I understand this correctly, as long as the cable length is less than 10 meter, up to 126 MAX487 transceivers could be used on each RS-485 bus. This relies on the internal fail-safe biasing of the transceivers. For longer cable length and/or better noise margin, termination and biasing resistors can be added. Given Cat5 cable (characteristic impedance of 100 ohm) and selecting R_T1 = 100 ohm, R_T2 = 110 ohm and R_FS = 470 ohm would result in a noise margin of 50 mV and permit up to 25 MAX487 transceivers per bus (for a total of 25*3-3 = 72 slave devices connected to one Arduino Mega).

 

After v0.2.0 of the Arduino library is done, the next step will be to adapt the documentation and to finish a work-in-progress tool that can help with calibrating stepper and servo motors (i.e. finding out how to translate the value we get from DCS to the number of steps or pulse width in microseconds).

Link to comment
Share on other sites

Excellent news Ian. You really should get a donation button somewhere :-)

 

Cheers

Hans

 

+1

Modules: Well... all of 'em

 

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Motherboard: ASUS Maximus VIII Hero | CPU: i7-6700K @ 4.6GHz | RAM: 32GB Corsair Vengance LPX DDR4 | GPU: GTX TITAN X (Maxwell) | SSD1: 256GB NVMe SSD System | SSD2: 250GB Games | HDD 4TB WD Red

Link to comment
Share on other sites

Excellent news Ian. You really should get a donation button somewhere :-)

 

Cheers

Hans

 

One more for the button. Ian I do remember what conserns you had with this from our private convo, but these are really moot. So consider to reconsider :thumbup:

this is to significant of a work to not earn any kind of compensation/reward for it


Edited by agrasyuk

Anton.

 

My pit build thread .

Simple and cheap UFC project

Link to comment
Share on other sites

To those asking for a donation button: I am looking into it. But I live in Germany, and we love our bureaucracy! I just called our equivalent of the IRS to ask them some questions.

 

It's pretty clear that for tax purposes, money I get through a donation button counts as income (in that it is not a tax-deductible donation), because (a) helping others hook up electronics to their flight sims does not count as charity and (b) it's an exchange of money vs. goods (DCS-BIOS), it does not matter that you can also choose to exchange no money for the same thing.

 

It's also pretty clear that any income I can expect through a donation button will be low enough so I won't end up having to pay taxes on it.

 

Things get complicated because German law distinguishes between trades ("Gewerbe") and freelancers ("freie Berufe") and the law does not clearly specify whether programming counts as a trade or as freelancing. The tax office would make that decision after I'd file my first tax return based on individual circumstances. From what I gathered, my local tax office does not make that decision, so they could not give me any indication of whether making DCS-BIOS would count as a trade or as freelancing.

 

If they declare it as a trade (and maybe even if it's freelancing, I am not clear on that yet), I am forced to become a member of the trade association ("Berufsgenossenschaft") and the chamber of industry and commerce ("Industrie- und Handelskammer"). These organisations, which trace their roots to the medieval guilds, have mandatory annual fees, which may or may not be waived for members in certain trades or who make profit below a certain threshold.

 

In the worst case, I could end up having to pay more in member fees than I'd ever realistically make through donations.

In the best case, there would be no members fees, and I'd have my own business which would mean being able to order from any of the major distributors of electronic components. Due to our strict consumer protection laws, the big distributors only deal with businesses (although one of them makes an exception for students).

 

I need to gather more information.

I'll keep you posted once I either set up a means to donate or decide it's definitely not worth the hassle.


Edited by [FSF]Ian
Link to comment
Share on other sites

Hi

 

another potential option is that you have a shopping list of materials and goods that you personally need for your flight sim i.e. Arduino Mega boards, which people can buy for you through ebay etc as goods for service. Good old fashioned medieval bartering. I for one would be happy to donate a couple of Mega boards!

 

Neal

Desktop PC:

Intel i7 14700K, MSI Z790 MAG Tomahawk MOBO, 64Gb RAM , GPU Nvidia RTX 3080ti

Windows 11, VPC joystick, Crosswind rudder peddles, HP Reverb G2, VPC Collective, DOF Reality H2, Gametrix seat, WinWing panels.

Link to comment
Share on other sites

Ian;2445915']But I live in Germany' date=' and we love our bureaucracy! [/quote']

 

:lol::lol::lol: Saying that is falling short :lol::lol::lol: I moved to Germany 9 months ago, and my new most feared word is steuererklärung :helpsmilie:

 

Anyway, I don't think this should give you a big headache, Ian... it will just require three times the amount of paper than in any other country, though ;)

Link to comment
Share on other sites

After reading through some websites, I have learned that I won't have to pay annual fees to the trade association (because disability insurance is optional for the owner of a business) and the chamber of commerce (because I won't make more than 5200 €/yr).

 

The next step is to contact the tax office and my health insurance to find out what paperwork is required. I'll get started with that after I have moved out of the dorms (they kick you out after six years, so I have to leave by September 31st) -- I don't want my mailing address to change in the middle of all this.

 

According to my unconfirmed sources German law does not require you to declare anything below 500 Euro.

There is a 410 Euro cutoff below which you are not required to file a tax return ("Einkommensteuererklärung"). But I don't know whether the income from my student job counts towards that or not and I suspect that even if you don't have to declare the amount below 410 Euro, you still have to tell the tax office that you are starting a business or something.


Edited by [FSF]Ian
Link to comment
Share on other sites

Hello Community.

 

Due to personal treatment by Ian (I'll build a monument of You and put flowers there every day) I managed my first steps in DCS-BIOS. Amazing!!

Have a look at if you want (german)

 

Now I wanted to come to business with my good old CDU (started thinking in Feb 2015 - finished in July 2015). This thing works as a keyboard. The result isn't what makes me really smile :)

(it workED as a Keybd - I flashed it already)

 

Messing around with Keycodes of two different languages and modifiers sucks.

 

Today (I broke my job and ran home) I did a first attempt to convert this CDU to a REAL device, using (you'll already know) DCS-BIOS.

 

I'd need some input cause I stuck again...

My hardware is Arduino Leonardo with Centipede.

 

To read or write I/Os on a stand-allone-Board with DCSBios is now easy to me.

But I have coplete no idea, how to map(?) 64 IOs of centipede.

Origin IOs of Leonardo I'll need too.

 

I could trickle around as a blind dog, but this here is a shorter way. Maybe.

 

If this has been diskussed and solved at other place so give me a link. Please.

 

Thank you in advance :)

 

Edit: The layout of CDU's PCB prevents making a matrix. All buttons sit with one leg on ground. So I need really ALL Inputs of both boards (for CDU and AAP).


Edited by Tekkx

Manual for my version of RS485-Hardware, contact: tekkx@dresi.de

Please do not PM me with DCS-BIOS-related questions. If the answer might also be useful to someone else, it belongs in a public thread where it can be discovered by everyone using the search function. Thank You.

Link to comment
Share on other sites

I can attest to Ian's involvement, many thanks for pushing me forward this spring.

 

Matrix for such amount of buttons is very complex (to me) , but duable with pair of single layer PCBs :

http://forums.eagle.ru/showpost.php?p=2409067&postcount=166

 

My experimenting with CDU interfacing can be found at link below. Perhaps not applying directly to your hardware, but still should give you some ideas

http://forums.eagle.ru/showthread.php?t=137157&page=2

 

 

I have my cdu near complete but wirh no progress past couple month. I so want to get back to working on this. Dealing with couple very serious setbacks from earlier this summer don't leave me a free moment... :(

Anton.

 

My pit build thread .

Simple and cheap UFC project

Link to comment
Share on other sites

  • Recently Browsing   0 members

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