Jump to content

DCS-BIOS Discussion Thread


FSFIan

Recommended Posts

Same issue connect serial port not working

 

My issue is the same as this video except his solution doesn't work with my win10 laptop rebooting running as admin checking Arduino port numbers to match connect serial port file does nothing it just hangs like the video.

 

${1}
Link to comment
Share on other sites

I need some help please!

 

Hello DCS_BIOS enthusiasts and gurus!

 

I wrote here some time ago about a project, but did not get much feedback. I think I asked the question the wrong way. :music_whistling:

 

I did manage to get something going on the Arduino that time, but the particular project is currently shelved.

 

I am building a Mi-24 pit in anticipation of Belsimtek's future module. I have acquired a soviet era ARK-15 Radio compass from a Mi-24 cockpit. It has these great clunky dials with really solid detents. Very mechanical.

 

The dials have up to 20 settings. These results are achieved by 5 switches. So for example the 0-1 khz dial has increments of .5 khz, 0 to 0.95. Each increment is achieved by a combination of high and low switch states. eg 0.0 is 1,1,1,1,1....while 3.0 is 1,0,1,1,0.

 

I have established which wires to connect to. There are 3 concentric dials. 2 use 5 switches (20 states) and the middle one uses 4 switches (10 states). There are 2 dials, as well as some momentary switches, toggle switches a rheostat/potentiometer and a 3 way rotary switch.

 

The dials are what I would like some guidance with. I can visualise a "pseudo-code". A series of conditional statements, "else if" type.

 

eg if pin 1=high, and pin 2=high, and pin 3=high, and pin 4=high, and pin 5=high, then set int_dial =0.0,

else if pin 1=low, and pin 2=high, and pin 3=high, and pin 4=high, and pin 5=high, then set int_dial =0.05

else if pin 1=high, and pin 2.....

etc.until all 20 options are covered. But that code seems very inelegant.... Is this some kind of Matrix idea? Can a value for a device in DCS be set from the values of more than 1 pin on the Arduino?

 

DCS needs to get the current value from the mechanical switched dial on startup, based on the states of the respective pins on the Arduino I guess...

 

I am just startin in on this coding thing, and I can sort of visualise the methoid. I have been scouring through this thread with great enthusiasm, but have noit found what I thin=k is the right way.

 

Any guidance is gratefully received!:helpsmilie:

 

Molevich

SCAN Intel Core i9 10850K "Comet Lake", 32GB DDR4, 10GB NVIDIA RTX 3080, HP Reverb G2

Custom Mi-24 pit with magnetic braked cyclic and collective. See it here: Molevitch Mi-24 Pit.

 

[sIGPIC][/sIGPIC] www.blacksharkden.com

bsd sig 2021.jpg

Link to comment
Share on other sites

Hi Mole,

 

Check out this post of mine; https://forums.eagle.ru/showpost.php?p=3336218&postcount=180

 

I think this may be what you looking for especially the port registers.

 

However this does require that the airframe works with DCS-BIOS, which means that the airframe has to be released and someone has to make the module for DCS-BIOS.

 

If you post a map of the switch may be able to assist a little further.

 

Cheers

Solo

Link to comment
Share on other sites

Hi Mole,

 

Check out this post of mine; https://forums.eagle.ru/showpost.php?p=3336218&postcount=180

 

I think this may be what you looking for especially the port registers.

 

However this does require that the airframe works with DCS-BIOS, which means that the airframe has to be released and someone has to make the module for DCS-BIOS.

 

If you post a map of the switch may be able to assist a little further.

 

Cheers

Solo

 

Thanks for the answer Hans! I was hoping you would have an idea.

 

With theMi-24 module not here yet, I am basing this project on the Mi-8, which shares so many systems with the Mi-24. This ARK-15 is almost identical to the ARK-9 in the Mi-8, so I will set it up for the 8, and transfer the code to the 24 in time.

 

The port registers sounds like the way to go, so I will explore that. What do you mean by a map of the switch? A drawing of the connections? A circuit diagram? I will knock something up and see what you think.

 

The switch itself is a rotary thing, with tumblers I guess, a bit like a key in a lock, or a mechanical drum piano. As the dial is turned, little sprung levers are raised or lowered to make discrete sets of contacts. Its rather lovely in its mixture of simplicity and complexity, almost Victorian. Very pre-digital. Sounds great.

 

Talk soon, gonna look at your port register thread.

 

Mole :thumbup:

 

(Just seen what you mean by a switch map.... On it!)


Edited by molevitch

SCAN Intel Core i9 10850K "Comet Lake", 32GB DDR4, 10GB NVIDIA RTX 3080, HP Reverb G2

Custom Mi-24 pit with magnetic braked cyclic and collective. See it here: Molevitch Mi-24 Pit.

 

[sIGPIC][/sIGPIC] www.blacksharkden.com

bsd sig 2021.jpg

Link to comment
Share on other sites

ARK-9 DCS-BIOS development

 

Hi again Hans,

 

So here is a Switch map of the 3 dials Channel 1. I am hoping that the Channel 2 Dials are the same!

 

I have a Mega 2560, which has lots of Ports of 8 pins. I need 4 ports to manage 5 pins each and 2 ports to manage 4 pins each. After those, 2 x toggle switches, 2 x momentary, and 1 x 4 position rotary switch. Should be plenty on the Mega.

 

Herre are some pics of the device. I will have to burrow deep under the cover plate for the top switches. Some contact points are more accessible than others.

 

I am going to try and use some of your coding idea , see if I can get somewhere with it....

 

Wish me luck!

 

Mole

 

attachment.php?attachmentid=184397&d=1526135454

 

attachment.php?attachmentid=184398&stc=1&d=1526136287

 

attachment.php?attachmentid=184399&stc=1&d=1526136287

 

attachment.php?attachmentid=184400&stc=1&d=1526136533

Switch map dials.pdf

DSCN8458-72.jpg.a6a749f3f8d714088ca2ee9bb8428087.jpg

DSCN8452-72.jpg.6a854d6d67862a41627fb1d560eaec3a.jpg

IMG_6331.thumb.JPG.b3e3caed9094b1aa4442257d1d18c6f2.JPG

SCAN Intel Core i9 10850K "Comet Lake", 32GB DDR4, 10GB NVIDIA RTX 3080, HP Reverb G2

Custom Mi-24 pit with magnetic braked cyclic and collective. See it here: Molevitch Mi-24 Pit.

 

[sIGPIC][/sIGPIC] www.blacksharkden.com

bsd sig 2021.jpg

Link to comment
Share on other sites

Hi again Hans,

 

So here is a Switch map of the 3 dials Channel 1. I am hoping that the Channel 2 Dials are the same!

 

I have a Mega 2560, which has lots of Ports of 8 pins. I need 4 ports to manage 5 pins each and 2 ports to manage 4 pins each. After those, 2 x toggle switches, 2 x momentary, and 1 x 4 position rotary switch. Should be plenty on the Mega.

 

Hello Mole,

 

IMHO it doesn't work that way. A port is 8 pins, no more and no less. So if you only need 5 pins you need to set the remaining as un-actuated.

 

From you switch map inner dial 0.0 reads = 1 1 1 1 1. Does this mean that there is continuity from you common pin to these 5 pins?

 

Middle dial: 10. and lowest blank are the same!

 

Cheers

Solo

Link to comment
Share on other sites

Hello Mole,

 

IMHO it doesn't work that way. A port is 8 pins, no more and no less. So if you only need 5 pins you need to set the remaining as un-actuated.

 

From you switch map inner dial 0.0 reads = 1 1 1 1 1. Does this mean that there is continuity from you common pin to these 5 pins?

 

Middle dial: 10. and lowest blank are the same!

 

Cheers

Solo

 

Hi HanSolo,

 

Thanks for the reply.

 

I understand the 8 pins per port. I think I didn't word my thoughts on it quite right. I meant that I would need 6 ports, and yes, some pins will be redundant/inactive.

 

Yes, when I put a 1 it means that switch is live, ie in complete circuit with ground.

 

Several of the "blank" dial positions have duplicates. I dont think this will be a problem in use. They are juxtaposed on the dials. In reality, one would keep turning until the right value was showing. I will test that aspect obviously.

 

One good thing I have seen, in DCS-BIOS, the Mi-8 ARK-9 dials have discrete values possible, not just INC or DEC. So I won't have your TACAN problem with using the timer. The Port value should inform DCS of the Dial setting. Not sure what would happen if I clicked the virtual dial in cockpit... I guess it would just reset to the physical dial setting.

 

So, I better start writing that Sketch! I will post here how it goes.

 

Yours,

 

Mole

SCAN Intel Core i9 10850K "Comet Lake", 32GB DDR4, 10GB NVIDIA RTX 3080, HP Reverb G2

Custom Mi-24 pit with magnetic braked cyclic and collective. See it here: Molevitch Mi-24 Pit.

 

[sIGPIC][/sIGPIC] www.blacksharkden.com

bsd sig 2021.jpg

Link to comment
Share on other sites

Looking forward for it molevitch. You just gave me a great idea. I am currently working on my AN/ARC-164 in test mode and had some of the dials running yesterday using basically same setup as my TACAN and AN/ARC-186's.

But now realised that the UHF (AN/ARC-164) also has the possibility to send the position directly. Made a small test tonight and that worked perfectly instead of INC/DEC.

 

Thanks a lot Sir :thumbup:

 

Cheers

Hans

Link to comment
Share on other sites

Looking forward for it molevitch. You just gave me a great idea. I am currently working on my AN/ARC-164 in test mode and had some of the dials running yesterday using basically same setup as my TACAN and AN/ARC-186's.

But now realised that the UHF (AN/ARC-164) also has the possibility to send the position directly. Made a small test tonight and that worked perfectly instead of INC/DEC.

 

Thanks a lot Sir :thumbup:

 

Cheers

Hans

 

:music_whistling::thumbup::doh: Glad I could help!

 

I start soldering tomorrow. Will set up one dial to test the theory, then move on to all six, and the rest of the "easy" switches. Exciting times!

 

Actually, I must post some pics of the stage of development I have reached on my pit....

 

Laterz,

 

Mole

SCAN Intel Core i9 10850K "Comet Lake", 32GB DDR4, 10GB NVIDIA RTX 3080, HP Reverb G2

Custom Mi-24 pit with magnetic braked cyclic and collective. See it here: Molevitch Mi-24 Pit.

 

[sIGPIC][/sIGPIC] www.blacksharkden.com

bsd sig 2021.jpg

Link to comment
Share on other sites

Hi everyone,

 

here's a short update about the current state and possible future of DCS-BIOS.

 

In October 2017, I stopped studying Computer Science and started to work full time at a web hosting company. Before that point, progress on DCS-BIOS was already slow. After that, it ground to a complete halt.

 

I thought this would be temporary -- that the job would become easier as I gained experience and I would find time and energy to hack on DCS-BIOS again. Unfortunately, that was not the case. Because my employer's web hosting platform is built around a closed-source third-party product, I could not improve my understanding of the system to a point where I would be confident that any configuration changes I was considering would not break anything. This uncertainty caused me a lot of stress.

 

I am sorry for my lack of communication over the last months. I didn't know what to write because I did not have any good news to share and I did not want to admit to myself that the project was dead.

 

Fortunately, now I do have some good news.

 

(1) On June 23 (only five more weeks to go!), I will go on a three week vacation. I am going to visit Warhog in Canada, where we plan to work on his cockpit and DCS-BIOS.

 

(2) When I return from my vacation, I will start at a new job. I found a position as a software developer not far from my parents house. This means I can move back to the country, commute by bicycle instead of public transport, and when I come home from work I will have access to space, a good selection of tools and the neighbors are far enough away that nobody is bothered if I use power tools at 9 PM.

 

Under those circumstances, it is inevitable that I'll start working on some kind of simpit of my own, probably a small collection of multi-function panels which will serve as a test bed for DCS-BIOS 2.

 

Unless there are some unforeseen nasty surprises on the new job (unlikely, but you never know how horrible and headache-inducing a codebase is until you have worked with it for a few weeks), things are looking well for the future of DCS-BIOS.

Link to comment
Share on other sites

Ian;3491212']Hi everyone,

 

here's a short update about the current state and possible future of DCS-BIOS.

 

In October 2017, I stopped studying Computer Science and started to work full time at a web hosting company. Before that point, progress on DCS-BIOS was already slow. After that, it ground to a complete halt.

 

I thought this would be temporary -- that the job would become easier as I gained experience and I would find time and energy to hack on DCS-BIOS again. Unfortunately, that was not the case. Because my employer's web hosting platform is built around a closed-source third-party product, I could not improve my understanding of the system to a point where I would be confident that any configuration changes I was considering would not break anything. This uncertainty caused me a lot of stress.

 

I am sorry for my lack of communication over the last months. I didn't know what to write because I did not have any good news to share and I did not want to admit to myself that the project was dead.

 

Fortunately, now I do have some good news.

 

(1) On June 23 (only five more weeks to go!), I will go on a three week vacation. I am going to visit Warhog in Canada, where we plan to work on his cockpit and DCS-BIOS.

 

(2) When I return from my vacation, I will start at a new job. I found a position as a software developer not far from my parents house. This means I can move back to the country, commute by bicycle instead of public transport, and when I come home from work I will have access to space, a good selection of tools and the neighbors are far enough away that nobody is bothered if I use power tools at 9 PM.

 

Under those circumstances, it is inevitable that I'll start working on some kind of simpit of my own, probably a small collection of multi-function panels which will serve as a test bed for DCS-BIOS 2.

 

Unless there are some unforeseen nasty surprises on the new job (unlikely, but you never know how horrible and headache-inducing a codebase is until you have worked with it for a few weeks), things are looking well for the future of DCS-BIOS.

 

 

very happy for you and for dcs bios :) :thumbup:

With respect

_________________

Kadda

_________________

My works

TL-39 (NewGen) project (Ру)/(EN)

Link to comment
Share on other sites

Hi all.

I started studying dcs-bios' objects (don't know if it's the right denomination).

I noticed something i can't understand.

Considering the upper left side of the overhead,the 2 4-ways switches for the lights and wiper

The 4 positions are OFF-10-30-100 and OFF-LOW-MED-HIGH

So i'd use a 4 positions (allegedly a rotary one) and 3 pins(if none is switched,the only possibility is the off position,right?),but the reference report a 5pos and 5 pins used.

There's a specific reason for that?

 

Thanks

 

Andrea

Jocman

"For once you have tasted flight you will walk the earth with your eyes turned skywards, for there you have been and there you will long to return" (L. Da Vinci)

Prev. Projects:

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

Link to comment
Share on other sites

Dear Ian,

 

Good to hear from you again. I can only try to image how frustrating the past month has been but I am very happy that your future looks a lot brighter now so a warm congratulation on your new job.

I cannot image a better and more well deserved vacation for you than to go see John and what he has accomplished with DCS-BIOS.

 

We all look forward to see what you have cocking in the future DCS-BIOS 2 considering what you have made possible with DCS-BIOS (1).

 

A warm welcome back Sir and once again congratulations on your new job. Have a wonderful vacation in Canada.

 

All the best

Hans

Link to comment
Share on other sites

Ian;3491212']Hi everyone,

 

here's a short update about the current state and possible future of DCS-BIOS.

 

In October 2017, I stopped studying Computer Science and started to work full time at a web hosting company. Before that point, progress on DCS-BIOS was already slow. After that, it ground to a complete halt.

 

I thought this would be temporary -- that the job would become easier as I gained experience and I would find time and energy to hack on DCS-BIOS again. Unfortunately, that was not the case. Because my employer's web hosting platform is built around a closed-source third-party product, I could not improve my understanding of the system to a point where I would be confident that any configuration changes I was considering would not break anything. This uncertainty caused me a lot of stress.

 

I am sorry for my lack of communication over the last months. I didn't know what to write because I did not have any good news to share and I did not want to admit to myself that the project was dead.

 

Fortunately, now I do have some good news.

 

(1) On June 23 (only five more weeks to go!), I will go on a three week vacation. I am going to visit Warhog in Canada, where we plan to work on his cockpit and DCS-BIOS.

 

(2) When I return from my vacation, I will start at a new job. I found a position as a software developer not far from my parents house. This means I can move back to the country, commute by bicycle instead of public transport, and when I come home from work I will have access to space, a good selection of tools and the neighbors are far enough away that nobody is bothered if I use power tools at 9 PM.

 

Under those circumstances, it is inevitable that I'll start working on some kind of simpit of my own, probably a small collection of multi-function panels which will serve as a test bed for DCS-BIOS 2.

 

Unless there are some unforeseen nasty surprises on the new job (unlikely, but you never know how horrible and headache-inducing a codebase is until you have worked with it for a few weeks), things are looking well for the future of DCS-BIOS.

 

Glad to see your post Ian. We understand life can get in the way sometimes. Looking forward to see whats next in DCS-BIOS!

Link to comment
Share on other sites

Ian;3491212']Hi everyone,

 

here's a short update about the current state and possible future of DCS-BIOS.

 

In October 2017, I stopped studying Computer Science and started to work full time at a web hosting company. Before that point, progress on DCS-BIOS was already slow. After that, it ground to a complete halt.

 

I thought this would be temporary -- that the job would become easier as I gained experience and I would find time and energy to hack on DCS-BIOS again. Unfortunately, that was not the case. Because my employer's web hosting platform is built around a closed-source third-party product, I could not improve my understanding of the system to a point where I would be confident that any configuration changes I was considering would not break anything. This uncertainty caused me a lot of stress.

 

I am sorry for my lack of communication over the last months. I didn't know what to write because I did not have any good news to share and I did not want to admit to myself that the project was dead.

 

Fortunately, now I do have some good news.

 

(1) On June 23 (only five more weeks to go!), I will go on a three week vacation. I am going to visit Warhog in Canada, where we plan to work on his cockpit and DCS-BIOS.

 

(2) When I return from my vacation, I will start at a new job. I found a position as a software developer not far from my parents house. This means I can move back to the country, commute by bicycle instead of public transport, and when I come home from work I will have access to space, a good selection of tools and the neighbors are far enough away that nobody is bothered if I use power tools at 9 PM.

 

Under those circumstances, it is inevitable that I'll start working on some kind of simpit of my own, probably a small collection of multi-function panels which will serve as a test bed for DCS-BIOS 2.

 

Unless there are some unforeseen nasty surprises on the new job (unlikely, but you never know how horrible and headache-inducing a codebase is until you have worked with it for a few weeks), things are looking well for the future of DCS-BIOS.

 

I am glad you are back on the track :thumbup: ... You did amazing job for DCS pit builders community and I am looking forward to see results of your next work :worthy: .

Congrats to new work ...

 

All the best

[sIGPIC][/sIGPIC]

Building FW190D pit ,,To Dora with love" http://forums.eagle.ru/showthread.php?t=132743

Link to comment
Share on other sites

For anyone who might be interested, I have added a DCS-BIOS profile for the SA342 Minigun Gazelle and added copilot intercom volume controls to all Gazelle profiles. You can find the files here:

 

https://forums.eagle.ru/showpost.php?p=3499153&postcount=778

 

Thanks,

Paul

Link to comment
Share on other sites

Looking forward for it molevitch. You just gave me a great idea. I am currently working on my AN/ARC-164 in test mode and had some of the dials running yesterday using basically same setup as my TACAN and AN/ARC-186's.

But now realised that the UHF (AN/ARC-164) also has the possibility to send the position directly. Made a small test tonight and that worked perfectly instead of INC/DEC.

 

Thanks a lot Sir :thumbup:

 

Cheers

Hans

 

Hi Hans,

 

Well.... I have very limited experience of coding.

 

Here is my latest attempt to get some of this idea working. I am trying to establish at least the principle, so that I can extend it to the other parts.

 

Problems:

1. I am trying to persuade an ARK-15 to be an ARK-9, for now.... But by using the DCS-BIOS code, I believe this is possible.

2. I am still getting to understand how the code works.

3. I have a limited understanding of Arduino as well.

 

So far, I have been able to get all the simple stuff working, momentary switches, toggle switches, multipos switches. Potentiometer for volume, no, but I think the code is missing in Mi-8 DCS-BIOS.

 

I have based my effort on your Tacan code, but so far, none of the Port stuff seems to work. I am not sure how to debug it. I am trying to get the simplest dial working first. Dial 2, which is 0-9 kHz, so 10 states. Using Port D, as it seems to offer 4 pins (or more unseen). Have scoured the web for info about Port D, but cannot find much to tell me if it works as 8 pins (0,1,2,3,x,x,x,7), or just the 5 with numbers.... I believe the Mega2560 offers up to 11 Ports, and I have 6 dials. Obviously, my other switches need some pin sockets too.

 

So struggling a bit!

 

My Sketch so far, (you will recognise some of it...)

 

/*

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"

 

int valueDial_2;

 

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

 

 

 

const byte arc9ModePins[4] = {10, 11, 12, 13};

DcsBios::SwitchMultiPos arc9Mode("ARC9_MODE", arc9ModePins, 4);

 

const byte arc9MainBackupPins[2] = {8, 9};

DcsBios::SwitchMultiPos arc9MainBackup("ARC9_MAIN_BACKUP", arc9MainBackupPins, 2);

 

const byte arc9TlfTlgPins[2] = {7, 6};

DcsBios::SwitchMultiPos arc9TlfTlg("ARC9_TLF_TLG", arc9TlfTlgPins, 2);

 

//DcsBios::Potentiometer arc9Vol("ARC9_VOL", A8);

 

 

 

void setup() {

DcsBios::setup();

 

//ARK-9 DIAL_1 inputs- 0-9.5 kHz Freq Main tune

DDRA = B00000000; // set PINA (digital 29-22) as inputs

PORTA = B11111111; // Sets (digital 29-22) with internal pull up

 

//ARK-9 DIAL_2 inputs- 0-90 kHz Main

DDRD = B00000000; // set PIND (digital 21-18) as inputs

PORTD = B11111111; // Sets (digital 21-18) with internal pull up

 

//ARK-9 DIAL_3 inputs- 100-1700 kHz Main

DDRC = B00000000; // set PINC (digital 37-30) as inputs

PORTC = B11111111; // Sets (digital 37-30) with internal pull up

 

//ARK-9 DIAL_4 inputs- 0-9.5 kHz Freq Back tune

DDRL = B00000000; // set PINL (digital 49-42) as inputs

PORTL = B11111111; // Sets (digital 49-42) with internal pull up

 

//ARK-9 DIAL_5 inputs- 0-90 kHz Back

DDRE = B00000000; // set PINE (digital 0-3) as inputs

PORTE = B11111111; // Sets (digital 0-3) with internal pull up

 

//ARK-9 DIAL_6 inputs- 100-1700 kHz Back

DDRK = B00000000; // set PINK (analog 0-7) as inputs

PORTK = B11111111; // Sets (digital 0-7) with internal pull up

 

 

}

 

int inputDial_2()

{

int valueDial_2;

if (PIND == B11111111) {

valueDial_2 = 0;

}

 

if (PIND == B01111111) {

valueDial_2 = 1;

}

 

if (PIND == B10111111) {

valueDial_2 = 2;

}

 

if (PIND == B00111111) {

valueDial_2 = 3;

}

 

if (PIND == B10101111) {

valueDial_2 = 4;

}

 

if (PIND == B00101111) {

valueDial_2 = 5;

}

 

if (PIND == B10011111) {

valueDial_2 = 6;

}

 

if (PIND == B00011111) {

valueDial_2 = 7;

}

 

if (PIND == B10001111) {

valueDial_2 = 8;

}

 

if (PIND == B00001111) {

valueDial_2 = 9;

}

 

return valueDial_2;

}

 

void onArcMain10khzChange(unsigned int newValue) {

valueDial_2 = newValue;

}

DcsBios::IntegerBuffer arcMain10khzBuffer(0x26a2, 0x00f0, 4, onArcMain10khzChange);

 

void loop() {

DcsBios::loop();

}

 

 

 

Any help you, or any other DCS-BIOS wizards can offer will be much appreciated. If I can do anything for you in return within my scope of abilities, please ask.

 

Mole

SCAN Intel Core i9 10850K "Comet Lake", 32GB DDR4, 10GB NVIDIA RTX 3080, HP Reverb G2

Custom Mi-24 pit with magnetic braked cyclic and collective. See it here: Molevitch Mi-24 Pit.

 

[sIGPIC][/sIGPIC] www.blacksharkden.com

bsd sig 2021.jpg

Link to comment
Share on other sites

Hi all.

Following my dream to build my cockpit, and thank to Ian for his outstanding creation (btw, by now good luck for your forthcoming issues, waiting for you back), and assuming that:

- I'm not a programmer

- I'm not an electronic engineer

I'm keeping learning DCS-BIOS to manage such....building strategy.

As my knowledges aren't enough to let me manage a...perfect system as the most of you, and as (unfortunately) there's no a "dummies guide to the cool cockpit" (but if I success maybe I can think about write one....), reading the Tekk's post about the use of matrix to drive btn, enc, etc etc, I made some math about the devices (switche, btns, etc) to drive, and I got the total of 359 pins needed (hope my maths are right) - I'm not considering LEDs or displays.

By considering the "matrix theory", and using a Mega, using a matrix 21x21 will give me 441 "pins" to connect switches, buttons and encoders.

Manage more boards via RS485 is (by now and for long time away) out of my science, even if I suppose it's the best (and right) way to build the system (otherwise none of you will "waste" time on that issue)

But in my sick mind, this way a mega could drive all the inputs (even the pots), a nano with max7221 could drive all the LEDs, a second nano (or a third one) with Max7221 could drive the 7seg displays for autopilot, radio, etc.

This means use 3 usb devices, plus the joysticks

My question is:

It can be done? not considering the "wiring" issue (I know, it would be a mess...), but the system designed this way could work?

I know it's a stupid question, otherwise I should have found some post about (I'm still reading the DCSBIOS discussion - 40 pages on 85 red...), but I didn't find none using this kind of approach.

Thanks

Andrea.

Jocman

"For once you have tasted flight you will walk the earth with your eyes turned skywards, for there you have been and there you will long to return" (L. Da Vinci)

Prev. Projects:

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

Link to comment
Share on other sites

Hi Molevitch,

 

To the best of my knowledge there is are two small mistakes.

 

First you are are defining two variables with the same name (valueDial_2). I don't think you can do that.

Second is that you are check the position of the dial but you are not using the information to anything. You are missing the comparison part

 

I have for simplicity renamed one of the variables which is used for getting the info out of DCS and added the comparision code

 

/*
 Tell DCS-BIOS to use a serial connection and use interrupt-driven
 communication. The main program will be interrupted to prioritize
 processing incoming data.
 
 This should work on any Arduino that has an ATMega328 controller
 (Uno, Pro Mini, many others).
*/
#define DCSBIOS_IRQ_SERIAL

#include "DcsBios.h"

int DCS_valueDial_2; // renamed this to be more saying (to me)

/* paste code snippets from the reference documentation here */
void onArcMain10khzChange(unsigned int newValue) {
DCS_valueDial_2 = newValue;
}
DcsBios::IntegerBuffer arcMain10khzBuffer(0x26a2, 0x00f0, 4, onArcMain10khzChange);


const byte arc9ModePins[4] = {10, 11, 12, 13};
DcsBios::SwitchMultiPos arc9Mode("ARC9_MODE", arc9ModePins, 4);

const byte arc9MainBackupPins[2] = {8, 9};
DcsBios::SwitchMultiPos arc9MainBackup("ARC9_MAIN_BACKUP", arc9MainBackupPins, 2);

const byte arc9TlfTlgPins[2] = {7, 6};
DcsBios::SwitchMultiPos arc9TlfTlg("ARC9_TLF_TLG", arc9TlfTlgPins, 2);

//DcsBios:otentiometer arc9Vol("ARC9_VOL", A;



void setup() {
DcsBios::setup();

//ARK-9 DIAL_2 inputs- 0-90 kHz Main
DDRD = B00000000; // set PIND (digital 21-1 as inputs
PORTD = B11111111; // Sets (digital 21-1 with internal pull up



}

int inputDial_2()
{
int valueDial_2;
if (PIND == B11111111) {
valueDial_2 = 0;
}

if (PIND == B01111111) {
valueDial_2 = 1;
}

if (PIND == B10111111) {
valueDial_2 = 2;
}

if (PIND == B00111111) {
valueDial_2 = 3;
}

if (PIND == B10101111) {
valueDial_2 = 4;
}

if (PIND == B00101111) {
valueDial_2 = 5;
}

if (PIND == B10011111) {
valueDial_2 = 6;
}

if (PIND == B00011111) {
valueDial_2 = 7;
}

if (PIND == B10001111) {
valueDial_2 = 8;
}

if (PIND == B00001111) {
valueDial_2 = 9;
}

return valueDial_2;
}



void loop() {
DcsBios::loop();

// Check and adjust 2nd dial
   if (DCS_valueDial_2 != inputDial_2()) {
    if ( inputDial_2() == 0){
   sendDcsBiosMessage("ARC_MAIN_10KHZ", "0");
 }
    if ( inputDial_2() == 1){
   sendDcsBiosMessage("ARC_MAIN_10KHZ", "1");
 }
    if ( inputDial_2() == 2){
   sendDcsBiosMessage("ARC_MAIN_10KHZ", "2");
 }
    if ( inputDial_2() == 3){
   sendDcsBiosMessage("ARC_MAIN_10KHZ", "3");
 }
    if ( inputDial_2() == 4){
   sendDcsBiosMessage("ARC_MAIN_10KHZ", "4");
 }
    if ( inputDial_2() == 5){
   sendDcsBiosMessage("ARC_MAIN_10KHZ", "5");
 }
    if ( inputDial_2() == 6){
   sendDcsBiosMessage("ARC_MAIN_10KHZ", "6");
 }
    if ( inputDial_2() == 7){
   sendDcsBiosMessage("ARC_MAIN_10KHZ", "7");
 }
    if ( inputDial_2() == 8){
   sendDcsBiosMessage("ARC_MAIN_10KHZ", "8");
 }
    if ( inputDial_2() == 9){
   sendDcsBiosMessage("ARC_MAIN_10KHZ", "9");
 }
}

}

 

The code compiles at my end but that doesn't mean it works :-)

 

I personally still belives you need the timer because I think this will spam the communication with new commands as the arduino is so fast. Try it out and see if you get a result.

 

Cheers

Solo

Link to comment
Share on other sites

WOW, Thank you Hans!

 

Yes, I didnt realise it needed to compare. I will try it tomorrow, or as soon as I can, and let you know how it goes for me.

 

Thank you,

 

Mole

SCAN Intel Core i9 10850K "Comet Lake", 32GB DDR4, 10GB NVIDIA RTX 3080, HP Reverb G2

Custom Mi-24 pit with magnetic braked cyclic and collective. See it here: Molevitch Mi-24 Pit.

 

[sIGPIC][/sIGPIC] www.blacksharkden.com

bsd sig 2021.jpg

Link to comment
Share on other sites

Hi all!

 

I'm trying to get my rotary selector switches to work with DCS Bios and Arduino, i have struggled few days with the arduino code without any results and now I'm begging you all to help me.

 

I have wired my rotary pins with 1kOhm resistors, so that I don't waste all 8 pins from arduino board, just like that picture:

 

rotary_a.png

 

Can someone guide me right direction, thank you :)

(And sorry for my bad english)

Link to comment
Share on other sites

Kyrmy, I don't know how to give you an answer (maybe out of my range of electric/C++ knowledges), but I've seen something similar to your layout here:

 

http://www.instructables.com/id/FSX-Boeing-737NG-Lights-overhead-panel-Italian-ver/

 

(I think there's an english version of the post)

 

Have a look, maybe you find something usefull to you (and if you will share I appreciate)

 

Andrea

Jocman

"For once you have tasted flight you will walk the earth with your eyes turned skywards, for there you have been and there you will long to return" (L. Da Vinci)

Prev. Projects:

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

Link to comment
Share on other sites

Hi Molevitch,

 

To the best of my knowledge there is are two small mistakes.

 

First you are are defining two variables with the same name (valueDial_2). I don't think you can do that.

Second is that you are check the position of the dial but you are not using the information to anything. You are missing the comparison part

 

I have for simplicity renamed one of the variables which is used for getting the info out of DCS and added the comparision code

 

The code compiles at my end but that doesn't mean it works :-)

 

I personally still belives you need the timer because I think this will spam the communication with new commands as the arduino is so fast. Try it out and see if you get a result.

 

Cheers

Solo

 

Hi Hansolo,

 

Thank you for the code. It has improved and increased my understanding of how this all works.

 

I think you are right about the timer! I changed a bit of your code version. I realised the intended Dial settings were wrong, should be 0-90 in increments of 10, not 0-9.

 

At the moment, the code changes the dial to "0" but nothing else moves when I turn the dial. I am going to try changing it to an 8 pin port like A, just to get it working, in case D is just not friendly to my use (!). If I can prove it works at least, then I can worry about changing to more exotic ports, or add more Arduino boards....

 

I also need to check my Pin values. I think I initially put them in back to front. I will make some test settings to check the correct pin values.

 

I tried to include the timer.h, but failed. I looked it up on Google, but cannot find how to include it.... I guess it is a library item, but could not find it!

 

Here is my updated code, including a stab at timer inclusion.

 

/*
 Tell DCS-BIOS to use a serial connection and use interrupt-driven
 communication. The main program will be interrupted to prioritize
 processing incoming data.
 
 This should work on any Arduino that has an ATMega328 controller
 (Uno, Pro Mini, many others).
*/
#define DCSBIOS_IRQ_SERIAL

#include "DcsBios.h"
#include <timer.h>

Timer tm;

int DCS_valueDial_2; // renamed this to be more saying (to me)

/* paste code snippets from the reference documentation here */
void onArcMain10khzChange(unsigned int newValue) {
DCS_valueDial_2 = newValue;
}
DcsBios::IntegerBuffer arcMain10khzBuffer(0x26a2, 0x00f0, 4, onArcMain10khzChange);


const byte arc9ModePins[4] = {10, 11, 12, 13};
DcsBios::SwitchMultiPos arc9Mode("ARC9_MODE", arc9ModePins, 4);

const byte arc9MainBackupPins[2] = {8, 9};
DcsBios::SwitchMultiPos arc9MainBackup("ARC9_MAIN_BACKUP", arc9MainBackupPins, 2);

const byte arc9TlfTlgPins[2] = {7, 6};
DcsBios::SwitchMultiPos arc9TlfTlg("ARC9_TLF_TLG", arc9TlfTlgPins, 2);

//DcsBios:Potentiometer arc9Vol("ARC9_VOL", A;



void setup() {
DcsBios::setup();

//ARK-9 DIAL_2 inputs- 0-90 kHz Main
DDRD = B00000000; // set PIND (digital 21-1 as inputs
PORTD = B11111111; // Sets (digital 21-1 with internal pull up
tm.startTimer(200, setARC9);


}

int inputDial_2()
{
int valueDial_2;
if (PIND == B11111111) {
valueDial_2 = 0;
}

if (PIND == B11111110) {
valueDial_2 = 1;
}

if (PIND == B11111101) {
valueDial_2 = 2;
}

if (PIND == B11111100) {
valueDial_2 = 3;
}

if (PIND == B11110101) {
valueDial_2 = 4;
}

if (PIND == B11110100) {
valueDial_2 = 5;
}

if (PIND == B11111001) {
valueDial_2 = 6;
}

if (PIND == B11111000) {
valueDial_2 = 7;
}

if (PIND == B11110001) {
valueDial_2 = 8;
}

if (PIND == B11110000) {
valueDial_2 = 9;
}

return valueDial_2;
}



void loop() {
DcsBios::loop();
tm.runTimers();

}

void setARC9 (int timer){


// Check and adjust 2nd dial
   if (DCS_valueDial_2 == inputDial_2()) {
    if ( inputDial_2() == 0){
   sendDcsBiosMessage("ARC_MAIN_10KHZ", "0");
 }
    if ( inputDial_2() == 1){
   sendDcsBiosMessage("ARC_MAIN_10KHZ", "10");
 }
    if ( inputDial_2() == 2){
   sendDcsBiosMessage("ARC_MAIN_10KHZ", "20");
 }
    if ( inputDial_2() == 3){
   sendDcsBiosMessage("ARC_MAIN_10KHZ", "30");
 }
    if ( inputDial_2() == 4){
   sendDcsBiosMessage("ARC_MAIN_10KHZ", "40");
 }
    if ( inputDial_2() == 5){
   sendDcsBiosMessage("ARC_MAIN_10KHZ", "50");
 }
    if ( inputDial_2() == 6){
   sendDcsBiosMessage("ARC_MAIN_10KHZ", "60");
 }
    if ( inputDial_2() == 7){
   sendDcsBiosMessage("ARC_MAIN_10KHZ", "70");
 }
    if ( inputDial_2() == 8){
   sendDcsBiosMessage("ARC_MAIN_10KHZ", "80");
 }
    if ( inputDial_2() == 9){
   sendDcsBiosMessage("ARC_MAIN_10KHZ", "90");
 }
}

}

 

Thanks for all your help! I really want to repay you somehow. I am a graphic designer and illustrator, pin-up artist and garment designer.... so if you think of anything let me know (within reason!)

 

Mole

 

Edit: I have got timer.h library now. Library installed... but still got to figure out use!


Edited by molevitch

SCAN Intel Core i9 10850K "Comet Lake", 32GB DDR4, 10GB NVIDIA RTX 3080, HP Reverb G2

Custom Mi-24 pit with magnetic braked cyclic and collective. See it here: Molevitch Mi-24 Pit.

 

[sIGPIC][/sIGPIC] www.blacksharkden.com

bsd sig 2021.jpg

Link to comment
Share on other sites

  • Recently Browsing   0 members

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