Jump to content

DCS-BIOS Discussion Thread


FSFIan

Recommended Posts

Hey Ian,

 

finally had the time to use DCS-BIOS and it is a fine piece of software. Really appreciate all the effort you have put into this.

 

Quick question. Has anyone connected a NeoPixel (from Adafruit) to DCS BIOS.

 

It needs to use a routine called show() in order to trigger the light. I could just modify LED.h but I wondered if anyone had any thoughts.

 

Regards,

Tigershark

[sIGPIC][/sIGPIC]

 

Creator of:

 

F-18C VFA-195 "Dambusters" 1998 CAG Livery

https://forums.eagle.ru/showthread.php?t=213788

 

F-18C VFA-195 "Dambusters" July 2001 CAG Livery

https://forums.eagle.ru/showthread.php?t=215950

 

Pilot avatars for DCS Logbook

https://forums.eagle.ru/showthread.php?t=221160

 

How to make a DCS A-10C Panel

http://forums.eagle.ru/showthread.php?t=65998

Link to comment
Share on other sites

Quick question. Has anyone connected a NeoPixel (from Adafruit) to DCS BIOS.

 

Switch the control reference to "Advanced" view and grab the IntegerBuffer or StringBuffer code snippet for the output you are interested in. That provides you with a function that will be called whenever that value changes (the updated value is passed in the newValue parameter).

 

If you want to re-use the code, copy the LED class from LED.h, rename it and modify it to your needs.

  • Like 1
Link to comment
Share on other sites

Cheers Ian!

[sIGPIC][/sIGPIC]

 

Creator of:

 

F-18C VFA-195 "Dambusters" 1998 CAG Livery

https://forums.eagle.ru/showthread.php?t=213788

 

F-18C VFA-195 "Dambusters" July 2001 CAG Livery

https://forums.eagle.ru/showthread.php?t=215950

 

Pilot avatars for DCS Logbook

https://forums.eagle.ru/showthread.php?t=221160

 

How to make a DCS A-10C Panel

http://forums.eagle.ru/showthread.php?t=65998

Link to comment
Share on other sites

Tigershark

 

I've included some Neopixels in my Intercom panel. Rather than use push-pull switches, I used rotary encoders with the built in push buttons. Problem was I could not tell when a switch was in the mute position. So I added a Neopixel behind each switch label that shows green as normal backlighting and it shows red when I mute a switch. Simple if statement in the code to make it happen.

 

They are great for all kinds of indicators and effects as you've probably already seen. I'm planning on using some Neopixel strips to simulate an engine fire. When I have just the HUD turned on, I can't turn around to see an engine on fire. With a couple of strips placed behind my seat and integrate with DCS-BIOS, i will actually see a fire in my peripheral vision as apposed to turning and seeing it on the screen. I expect to use them for simulating a number of different effects that occur outside of the cockpit such as the flash of an explosion from being hit by a sam or maybe even lightening when flying in a storm. The possibilities are rather exciting and I intend to exploit these little buggers to their full capabilities.:thumbup:

Regards

John W

aka WarHog.

 

My Cockpit Build Pictures...



John Wall

 

My Arduino Sketches ... https://drive.google.com/drive/folders/1-Dc0Wd9C5l3uY-cPj1iQD3iAEHY6EuHg?usp=sharing

 

 

WIN 10 Pro, i8-8700k @ 5.0ghz, ASUS Maximus x Code, 16GB Corsair Dominator Platinum Ram,



AIO Water Cooler, M.2 512GB NVMe,

500gb SSD, EVGA GTX 1080 ti (11gb), Sony 65” 4K Display

VPC MongoosT-50, TM Warthog Throttle, TRK IR 5.0, Slaw Viper Pedals

Link to comment
Share on other sites

Tigershark

 

I've included some Neopixels in my Intercom panel. Rather than use push-pull switches, I used rotary encoders with the built in push buttons. Problem was I could not tell when a switch was in the mute position. So I added a Neopixel behind each switch label that shows green as normal backlighting and it shows red when I mute a switch. Simple if statement in the code to make it happen.

 

They are great for all kinds of indicators and effects as you've probably already seen. I'm planning on using some Neopixel strips to simulate an engine fire. When I have just the HUD turned on, I can't turn around to see an engine on fire. With a couple of strips placed behind my seat and integrate with DCS-BIOS, i will actually see a fire in my peripheral vision as apposed to turning and seeing it on the screen. I expect to use them for simulating a number of different effects that occur outside of the cockpit such as the flash of an explosion from being hit by a sam or maybe even lightening when flying in a storm. The possibilities are rather exciting and I intend to exploit these little buggers to their full capabilities.:thumbup:

 

That sounds awesome Warhog!

 

I got it working with a simple if statement and the advanced function Ian mentioned. The whole DCS Bios is such a significant body of work and a great credit to Ian.

 

We owe so much to some of the pioneers in this area. Gadroc and whole bunch of people who share their knowledge so readily.

 

Thanks for all the replies.

 

I will take the opportunity to ask one more thing. I am getting terrible bounce on my tactile switches.

 

Such that for some they even show values for others. I am simulating a UFC and when I press UFC 2 button the values it sends to the sim are UFC 2 and then a UFC 1 press.

 

Some pins show rock solid press down and press up messages. But most pins send three messages and send them all over the place.

 

Is this due to bounce? If so...why are some pins handling it fine and others not?

I am using pins 0-12 on a Arduino Uno R3. Omron tactile momentary switches. No pull down resistors or anything like that.

 

For example...when pressing the UFC 2 key, the serial program receives

UFC_2 0

UFC_1 1

UFC_1 0

 

Which is weird....this particular switch goes to pin 2.

 

But pin 8 consistently gives me good results with a UFC_8 1 then a separate message UFC_8 0 on release of the switch.

 

Any thoughts?

[sIGPIC][/sIGPIC]

 

Creator of:

 

F-18C VFA-195 "Dambusters" 1998 CAG Livery

https://forums.eagle.ru/showthread.php?t=213788

 

F-18C VFA-195 "Dambusters" July 2001 CAG Livery

https://forums.eagle.ru/showthread.php?t=215950

 

Pilot avatars for DCS Logbook

https://forums.eagle.ru/showthread.php?t=221160

 

How to make a DCS A-10C Panel

http://forums.eagle.ru/showthread.php?t=65998

Link to comment
Share on other sites

You can't use pins 0 and 1, those are the serial RX and TX lines.

 

For a primitive but effective debouncing method, just add a small delay to your loop() method (about 10 or 20 milliseconds).

 

Avoiding pins 0 and 1 (and 13 for inputs, as it's connected to the built-in LED) and maybe adding a "delay(10)" to your loop() method should take care of your issues. If there are still problems after that, it's either due to bad contacts or very long wires. In that case, you can try to add external pull-up resistors (about 1K to 10K); the built-in pull-up resistors are roughly 30K to 50K, so a switch might be susceptible to interference if several wires run in parallel over long distances.

Link to comment
Share on other sites

Hi Ian,

 

had finally some time to look at my AHCP again.

 

Yes, you are right about the pull-down resistors that I used, based upon tutorials that I've read/watched! :thumbup:

Now I changed the setup so that the middle pin is connected to ground and the other two are directly connected to the digital input of the Arduino. Then I changed the part in the Switch.h back to LOW.

Everything works fine now. :pilotfly:

 

Thank you very much for your help!

Link to comment
Share on other sites

Ian;2915670']You can't use pins 0 and 1, those are the serial RX and TX lines.

 

For a primitive but effective debouncing method, just add a small delay to your loop() method (about 10 or 20 milliseconds).

 

Avoiding pins 0 and 1 (and 13 for inputs, as it's connected to the built-in LED) and maybe adding a "delay(10)" to your loop() method should take care of your issues. If there are still problems after that, it's either due to bad contacts or very long wires. In that case, you can try to add external pull-up resistors (about 1K to 10K); the built-in pull-up resistors are roughly 30K to 50K, so a switch might be susceptible to interference if several wires run in parallel over long distances.

 

Unfortunately using delay(10) in the loop (placed after the DcsBios code) did not change anything. Some pins behave normally....others broadcast 3 lines each press instead of one down press and one up press.

[sIGPIC][/sIGPIC]

 

Creator of:

 

F-18C VFA-195 "Dambusters" 1998 CAG Livery

https://forums.eagle.ru/showthread.php?t=213788

 

F-18C VFA-195 "Dambusters" July 2001 CAG Livery

https://forums.eagle.ru/showthread.php?t=215950

 

Pilot avatars for DCS Logbook

https://forums.eagle.ru/showthread.php?t=221160

 

How to make a DCS A-10C Panel

http://forums.eagle.ru/showthread.php?t=65998

Link to comment
Share on other sites

Ian;2916415']Can you post a schematic and/or a picture of your setup?

 

Will do...at work at the moment but will post later.

[sIGPIC][/sIGPIC]

 

Creator of:

 

F-18C VFA-195 "Dambusters" 1998 CAG Livery

https://forums.eagle.ru/showthread.php?t=213788

 

F-18C VFA-195 "Dambusters" July 2001 CAG Livery

https://forums.eagle.ru/showthread.php?t=215950

 

Pilot avatars for DCS Logbook

https://forums.eagle.ru/showthread.php?t=221160

 

How to make a DCS A-10C Panel

http://forums.eagle.ru/showthread.php?t=65998

Link to comment
Share on other sites

Here's a pic:

IMG_1721.thumb.JPG.799d545e39b93582ebc0ad6405444962.JPG

[sIGPIC][/sIGPIC]

 

Creator of:

 

F-18C VFA-195 "Dambusters" 1998 CAG Livery

https://forums.eagle.ru/showthread.php?t=213788

 

F-18C VFA-195 "Dambusters" July 2001 CAG Livery

https://forums.eagle.ru/showthread.php?t=215950

 

Pilot avatars for DCS Logbook

https://forums.eagle.ru/showthread.php?t=221160

 

How to make a DCS A-10C Panel

http://forums.eagle.ru/showthread.php?t=65998

Link to comment
Share on other sites

I doubt that any of your switches have a bounce time of more than one, let alone 10 milliseconds. Bounce times longer than that exist, but I would only expect them in large toggle switches or big spring-loaded push buttons. I never had bouncing problems with tactile switches.

 

I suspect it's the wiring. Those dupont jumper wires can make bad connections when plugged into the Arduino headers. Sometimes it's a bad wire, sometimes it helps to unplug it and rotate it 90 degrees before plugging it back in. You can get a good continuity test with the multimeter, and then the contact will be interrupted momentarily by the slightest tug on the wire. And those wires easily get wiggled around as a side effect of pushing a button on that breadboard.

 

The dupont wires will connect reliably to a breadboard due to the spring contacts of the breadboard.

 

Identify a working switch (A) and a bouncing switch (B) and then try the following:

  • Swap the tactile push buttons. If the behavior is still the same (A works, B bounces), you know it's not the switch itself.
  • Swap the wires and see what happens.

 

Another way to test for wiggly wire problems: short out all your switches on the breadboard so they are "closed" all the time, then intentionally wiggle all the wires around. If any button presses are registered, you have a loose contact somewhere.

 

Of course, it could still be something in the code, so post your complete sketch just in case (and upload it once more to make extra sure that the Arduino board is running the code you think it is).

Link to comment
Share on other sites

DCS BIOS - .Cmd question

 

Good evening

 

I am gradually improving my knowledge of DCS BIOS. I have built the majority of my panels with 7 of them fully wired and connected to a combination of Arduino Mega (1x), Arduino Uno (4x) and Arduino Nano (4x). I have compiled my sketches and downloaded to each Arduino, and have tested all panels - Success.

 

I have now fitted my panels in my cockpit and connected them all to a powered Hub, I have then copied the 'connect-serial-port.cmd' once for each panel and renamed to match the panel, changing the port number as appropriate. The question I have is do I have to open all of the .cmd files (1 per panel) or is there a way of having a .cmd fie that will allow all to work. In a nutshell do I need to open a separate .cmd for all my panels, potentially 30 Ports?

 

I hope that makes sense?

 

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, thanks for the reply. I have wired in RS485 modules for each Arduino, but because of the difficulties of updating sketches etc i.e. quoting out RS485 comment to allow usb connection and update as required. I think when DCS Bios is developed to the next stage I will then initialise network.:thumbup:

IMG_0243.JPG.fa3f030c41479b791f7fbe37678dcf8d.JPG

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;2916831']I doubt that any of your switches have a bounce time of more than one, let alone 10 milliseconds. Bounce times longer than that exist, but I would only expect them in large toggle switches or big spring-loaded push buttons. I never had bouncing problems with tactile switches.

 

I suspect it's the wiring. Those dupont jumper wires can make bad connections when plugged into the Arduino headers. Sometimes it's a bad wire, sometimes it helps to unplug it and rotate it 90 degrees before plugging it back in. You can get a good continuity test with the multimeter, and then the contact will be interrupted momentarily by the slightest tug on the wire. And those wires easily get wiggled around as a side effect of pushing a button on that breadboard.

 

The dupont wires will connect reliably to a breadboard due to the spring contacts of the breadboard.

 

Identify a working switch (A) and a bouncing switch (B) and then try the following:

  • Swap the tactile push buttons. If the behavior is still the same (A works, B bounces), you know it's not the switch itself.
  • Swap the wires and see what happens.

 

Another way to test for wiggly wire problems: short out all your switches on the breadboard so they are "closed" all the time, then intentionally wiggle all the wires around. If any button presses are registered, you have a loose contact somewhere.

 

Of course, it could still be something in the code, so post your complete sketch just in case (and upload it once more to make extra sure that the Arduino board is running the code you think it is).

 

OK...great feedback on what I can do troubleshoot this. I will experiment and report back. Thanks again Ian.

[sIGPIC][/sIGPIC]

 

Creator of:

 

F-18C VFA-195 "Dambusters" 1998 CAG Livery

https://forums.eagle.ru/showthread.php?t=213788

 

F-18C VFA-195 "Dambusters" July 2001 CAG Livery

https://forums.eagle.ru/showthread.php?t=215950

 

Pilot avatars for DCS Logbook

https://forums.eagle.ru/showthread.php?t=221160

 

How to make a DCS A-10C Panel

http://forums.eagle.ru/showthread.php?t=65998

Link to comment
Share on other sites

Hi Ian,

 

I couldn't figure out how to log output to socat to a file so I made a video explaining the weirdness.

 

${1}

[sIGPIC][/sIGPIC]

 

Creator of:

 

F-18C VFA-195 "Dambusters" 1998 CAG Livery

https://forums.eagle.ru/showthread.php?t=213788

 

F-18C VFA-195 "Dambusters" July 2001 CAG Livery

https://forums.eagle.ru/showthread.php?t=215950

 

Pilot avatars for DCS Logbook

https://forums.eagle.ru/showthread.php?t=221160

 

How to make a DCS A-10C Panel

http://forums.eagle.ru/showthread.php?t=65998

Link to comment
Share on other sites

TigersharkBAS: Which pin does the sketch read for the UFC_1 pin?

 

I think what happened here is the following: you disconnected pins 0 and 1 to avoid the serial RX and TX pins, but the software on the Arduino is still the same (you either forgot to update the code, forgot to upload it again, or did not notice that something went wrong while uploading).

 

Now you push a button. The next call to DcsBios::loop() detects the pin change and ends up calling sendDcsBiosMessage(...) to send a message to the PC. The last character of that message is always a newline character. Now sendDcsBiosMessage() does not wait for the full message to be sent -- it will return as soon as the transmission of that last character has started! So when sendDcsBiosMessage() returns, the UART hardware will start to transmit 00001010 in binary over pin 1 (TX). Because the UART peripheral is independent of the processor, this happens while the program is still running.

 

Because the sketch has not been updated properly, it still thinks there is a button connected to pin 1. If it reads the state of pin 1 at the precise moment that one of the '1' bits of the newline character is being transmitted, it will detect that as a change and send 'UFC_1 1\n' to the PC!

 

This explains why it seems random which buttons are affected -- whether or not a button has this problem depends on the precise amount of time that it takes to get back to checking the button connected to pin 1 after sending the first message.

 

Bonus nitpick question: "But a pushed button results in a logic LOW -- wouldn't it be triggered by a '0' bit transmission?" No, because the UART also represents '1' as LOW and '0' as HIGH :)

Link to comment
Share on other sites

Thanks again. I will check the Sketch code and if it is still funky I will post the sketch as well. Thanks for your time Ian.

[sIGPIC][/sIGPIC]

 

Creator of:

 

F-18C VFA-195 "Dambusters" 1998 CAG Livery

https://forums.eagle.ru/showthread.php?t=213788

 

F-18C VFA-195 "Dambusters" July 2001 CAG Livery

https://forums.eagle.ru/showthread.php?t=215950

 

Pilot avatars for DCS Logbook

https://forums.eagle.ru/showthread.php?t=221160

 

How to make a DCS A-10C Panel

http://forums.eagle.ru/showthread.php?t=65998

Link to comment
Share on other sites

Ian.....you were on the money. Once I modified the sketch to disregard pins 0 and 1 everything behaved normally. Thanks a lot man!

[sIGPIC][/sIGPIC]

 

Creator of:

 

F-18C VFA-195 "Dambusters" 1998 CAG Livery

https://forums.eagle.ru/showthread.php?t=213788

 

F-18C VFA-195 "Dambusters" July 2001 CAG Livery

https://forums.eagle.ru/showthread.php?t=215950

 

Pilot avatars for DCS Logbook

https://forums.eagle.ru/showthread.php?t=221160

 

How to make a DCS A-10C Panel

http://forums.eagle.ru/showthread.php?t=65998

Link to comment
Share on other sites

Hi ,

I set up arduino for the first time using arduino micro card with 328 board , i set up a led for hyd preser and its work just fine with no problem at all .my problem , i followed the instruction of the user guide on the dcs bios website. Everything sounds to work , but when i open the connect-serial-port.cmd and toggle a switch , dcs-bios detect iT , in game whan i using the toggle its send command to the game but in the game the hyd toggel start to on/off very fest and nothing stop this .

I using the serial tamplet and with dcs uh-h.

 

Hoping that you can help me.

 

Thanks in advance.

issues

[sIGPIC][/sIGPIC]

 

IAF Bell205

IAF Anafa

 

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

DCS World Modules: A-10C, FC3, MiG-21BiS, F-86, P-51, KA-50, UH-1H Huey, Mi-8, M2000K, Gazal, Bf109, Mig-15, Hawk and NTTR

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

My System - ASUS Maximus HERO iiiv, CoolMaster 120 Sadion Plus, I7 -6700K @4.0, G.Skill ddr4 16GB ram, Gigabyte GTX 1070 G1 , PSU Seasonic X-650W, OCZ 150 500Gb ssd drive X2, Seagate 7200 1T X2.

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

Link to comment
Share on other sites

Hi ,

I set up arduino for the first time using arduino micro card with 328 board , i set up a led for hyd preser and its work just fine with no problem at all .my problem , i followed the instruction of the user guide on the dcs bios website. Everything sounds to work , but when i open the connect-serial-port.cmd and toggle a switch , dcs-bios detect iT , in game whan i using the toggle its send command to the game but in the game the hyd toggel start to on/off very fest and nothing stop this .

I using the serial tamplet and with dcs uh-h.

 

Please post your complete sketch.

Link to comment
Share on other sites

This is my simple code

 

/*

Tell DCS-BIOS to use a serial connection and use the default Arduino Serial

library. This will work on the vast majority of Arduino-compatible boards,

but you can get corrupted data if you have too many or too slow outputs

(e.g. when you have multiple character displays), because the receive

buffer can fill up if the sketch spends too much time updating them.

 

If you can, use the IRQ Serial connection instead.

*/

#define DCSBIOS_DEFAULT_SERIAL

 

#include "DcsBios.h"

 

/* paste code snippets from the reference documentation here */

DcsBios::ActionButton hydContSwToggle("HYD_CONT_SW", "TOGGLE", 10);

DcsBios::LED clD1(0x1414, 0x2000, 13);

void setup() {

DcsBios::setup();

}

 

void loop() {

DcsBios::loop();

}

 

 

 

First Arduino test with led's

 

 

Hyd Toggle Problem

 

[YOUTUBE]This is my simple code

 

/*

Tell DCS-BIOS to use a serial connection and use the default Arduino Serial

library. This will work on the vast majority of Arduino-compatible boards,

but you can get corrupted data if you have too many or too slow outputs

(e.g. when you have multiple character displays), because the receive

buffer can fill up if the sketch spends too much time updating them.

 

If you can, use the IRQ Serial connection instead.

*/

#define DCSBIOS_DEFAULT_SERIAL

 

#include "DcsBios.h"

 

/* paste code snippets from the reference documentation here */

DcsBios::ActionButton hydContSwToggle("HYD_CONT_SW", "TOGGLE", 10);

DcsBios::LED clD1(0x1414, 0x2000, 13);

void setup() {

DcsBios::setup();

}

 

void loop() {

DcsBios::loop();

}

 

 

 

First Arduino test with led's

 

${1}

 

Hyd Toggle Problem

 

${1}

Edited by assafm25

[sIGPIC][/sIGPIC]

 

IAF Bell205

IAF Anafa

 

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

DCS World Modules: A-10C, FC3, MiG-21BiS, F-86, P-51, KA-50, UH-1H Huey, Mi-8, M2000K, Gazal, Bf109, Mig-15, Hawk and NTTR

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

My System - ASUS Maximus HERO iiiv, CoolMaster 120 Sadion Plus, I7 -6700K @4.0, G.Skill ddr4 16GB ram, Gigabyte GTX 1070 G1 , PSU Seasonic X-650W, OCZ 150 500Gb ssd drive X2, Seagate 7200 1T X2.

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

Link to comment
Share on other sites

To make your toggle switch work properly, use DcsBios::Switch2Pos instead of DcsBios::ActionButton:

DcsBios::Switch2Pos hydContSwToggle("HYD_CONT_SW", 10);

 

The ActionButton is meant for using a physical tactile switch to trigger something that is not a push button in the sim (e.g. toggle a toggle switch, or move a dial one step to the left). It sends a command to the sim when the button is pressed and does nothing when it is released.

 

The constant toggling you see is a bug in the ActionButton implementation that was fixed in v0.2.4 of the Arduino library. You should update to the current version (v0.2.5).

Link to comment
Share on other sites

Ian Thx for the replay '

 

how can i check my DCS Bios Library version?

as i remember i use the 0.2.5 version.

 

i tray what u send me but the toggle work only one way (on) and when i move the toggle to the off position nothing heppen only if i move it back in the sim using my mouse .


Edited by assafm25

[sIGPIC][/sIGPIC]

 

IAF Bell205

IAF Anafa

 

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

DCS World Modules: A-10C, FC3, MiG-21BiS, F-86, P-51, KA-50, UH-1H Huey, Mi-8, M2000K, Gazal, Bf109, Mig-15, Hawk and NTTR

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

My System - ASUS Maximus HERO iiiv, CoolMaster 120 Sadion Plus, I7 -6700K @4.0, G.Skill ddr4 16GB ram, Gigabyte GTX 1070 G1 , PSU Seasonic X-650W, OCZ 150 500Gb ssd drive X2, Seagate 7200 1T X2.

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

Link to comment
Share on other sites

  • Recently Browsing   0 members

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