Jump to content

Recommended Posts

Posted

I have looked around the forum but haven't seen a solution for effectively using a rotary knob to operate the bleed air switch since the "increase" and "decrease" function of the rotary will not let you go from state "3" (R OFF) to state "0" (OFF).  A rotary knob doesn't appear to allow you to make the 360 degree rotation that is required when doing a complete cold startup.

Wondering if there is a work around I might be missing?  Maybe their is a way to program the arduino to go to state "0" (OFF) when you click the rotary button?  That wouldn't be 1-to-1 as in the cockpit but would at least be functional for my custom control panel without having to reach for the mouse.

Posted

If you use DCS-BIOS, you can program an arduino to send any value you want using sendDcsBiosMessage. 

If you haven't already set up DCS-BIOS, I recommend the "Flightpanels fork " as that's currently actively updated. 

Posted

I'm a noob at arduino programming but have used the DCS Bios control reference to effectively code all my homemade control surfaces.  If anyone is willing to help with what code I can use to have the rotary button press register the bleed air knob to state "0", I'd appreciate it.  In the meantime I'll keep digging into the coding tutorials and documentation to see how much I can learn on my own.

Right now I am using this line to indicate the increase and decrease of the knob on the rotary switch:

DcsBios::RotaryEncoder bleedAirKnob("BLEED_AIR_KNOB", "DEC", "INC", 19, 20);

The button press of the rotary knob is connected to pin 18.

  • Like 1
Posted

Try this:

DcsBios::RotaryEncoder bleedAirKnob("BLEED_AIR_KNOB", "0", "INC", 19, 20);

I'm not sure it'll work, but from looking at the library source code, it looks like it might...

Posted

I am using a 45 degree rotary switch and i have just wired the pins every 90 degrees and then programed this function from FP DCS BIOS

const byte bleedAirKnobPins[4] = {PIN_0, PIN_1, PIN_2, PIN_3};
DcsBios::SwitchMultiPos bleedAirKnob("BLEED_AIR_KNOB", bleedAirKnobPins, 4);

Win11 64bit, AMD Ryzen 58003DX, GeForce 3070 8GB, 2TB SSD, 64GB DDR4 RAM at 3200MHz _ full 1:1 FA-18C Cockpit https://www.youtube.com/@TheHornetProject

Posted (edited)

you just open the rotary, "cut" the plastic stopper, and re asemble it, then its 360 deg rotation 

BUT becarfull not to let the balls spring out and loose them, yes its ok for them to come out, but not so fast you cant see where they go.

image.jpeg

IMG_0674.jpg

Edited by Ben-111
Spelling
Posted
On 8/13/2022 at 6:17 PM, No1sonuk said:

Try this:

DcsBios::RotaryEncoder bleedAirKnob("BLEED_AIR_KNOB", "0", "INC", 19, 20);

I'm not sure it'll work, but from looking at the library source code, it looks like it might...

Thanks, this code works for my purposes.  The rotary encoder to the right advances the knob while going to the left resets it back to 0.  It's not 1-to-1 movement to match the jet but allows me to go mouse free in the cockpit.  Finding an actual, 90 degree turning rotary switch would be the best as was posted by Sting and Ben but those were expensive to find / complicated to modify.

I don't know that my initial idea is even possible, that is having the click of the rotary encoder activate the set state to "0" while the rotation remains on "DEC" and "INC".  If I try to program a Switch2Pos for the bleedAirKnob and use the rotary encoder push, their is a conflict because I am listing the bleedAirKnob twice.  I guess I'd have to edit the F/A-18C DCS Bios library to create a second entry for the bleedAirKnob?

Posted
3 hours ago, Ben-111 said:

you just open the rotary, "cut" the plastic stopper, and re asemble it, then its 360 deg rotation 

BUT becarfull not to let the balls spring out and loose them, yes its ok for them to come out, but not so fast you cant see where they go.

 

 

Wouldn't removing the stop washer do that without opening the switch? 

Posted
2 hours ago, bigdave32 said:

I don't know that my initial idea is even possible, that is having the click of the rotary encoder activate the set state to "0" while the rotation remains on "DEC" and "INC".  If I try to program a Switch2Pos for the bleedAirKnob and use the rotary encoder push, their is a conflict because I am listing the bleedAirKnob twice.  I guess I'd have to edit the F/A-18C DCS Bios library to create a second entry for the bleedAirKnob?

Try adding this into the main void loop:

If(digitalRead(encoderPushPin)== 0){ sendDcsBiosMessage("BLEED_AIR_KNOB", "0");

delay(10);}

That should read the encoder switch every time through the loop and send a "0" to DCS if it's pushed.

it's quick and dirty, and you might want to add some state checking so it doesn't keep sending it.

Posted

Hi @No1sonuk and @bigdave32

few claifications from above 

Wouldn't removing the stop washer do that without opening the switch? 

The Washer with Tab allows a roatry to be set to a defined number of steps,. the platic is always at the last step, say if you have an 8 POS and wanted a 5, you put the washer with Tab in the slot that stops it at POS 5, if you leave it out the Rotary will alwasy stop at POS8 (or POS 4 for the Bleed air)

Finding an actual, 90 degree turning rotary switch would be the best as was posted by Sting and Ben but those were expensive to find / complicated to modify.

This is the one I now use, $5 and off the shelf here in AUS at jaycar

https://www.jaycar.com.au/4-pole-sealed-pcb-rotary/p/SR1216?pos=4&queryId=4cb96c93afc7f2ed0b9da7685c007a36

if not say mouser, E14, Digi Key ?? - part numbers for the other shops there too

8 Way 45 DEG- Mouser https://au.mouser.com/ProductDetail/611-A12505RNZQ

A12505RNZQ

4 way 90 DEG - Mouser https://au.mouser.com/ProductDetail/611-A12405RNZQ

 

A12405RNZQ

 

happy flying 

F18-3.jpg

F18-4.jpg

F18-5.jpg

  • Like 1
Posted

Having looked at the Arduino library code, it looks to me like all the switch types are fancy packaging that leads to sendDcsBiosMessage commands.
I think whatever comes after the switch type is an arbitrary name to prevent clashes.

So try this:
DcsBios::RotaryEncoder bleedAirKnob("BLEED_AIR_KNOB", "DEC", "INC", 19, 20);
DcsBios::ActionButton bleedAirKnobWIBBLE("BLEED_AIR_KNOB", "0",21); // or whatever pin the encoder switch is

Actionbutton only sends the command on the falling edge of the switch (connecting to gnd), not the rising edge.
"WIBBLE" is in there because it's pretty much guaranteed you won't have any other function with that in it. 🤣

Posted (edited)

@No1sonuk whilst the encoder will work, have you considreded the out of sync factor this will bring, you must ensure your knob is in the "default" postion on each start up the sim, that alignes with the actual sim, otherwise, yes it will tell it left or right, but the starting point in the sim, vs on screen will be different if you dont align it before start up and encoder cannot tell DCS BIOS a position, it can only tell it a movment, direction and steps, this it needs to know on each start up where it is first. using encoders for physical items in not advises, they are great for the UFC comms knobs etc, that dont need to marry up with a defined postion, just provide a direrction and steps 

Edited by Ben-111
spelling
  • Like 1
Posted (edited)

OK...
I'm answering the question asked...
Those two lines I sent in my last message should give what I thought was asked for:  Left and right rotation by the encoder and press to zero...

Edited by No1sonuk
Posted (edited)

@No1sonuk, no stress, just seams like a lot of work to a problem that is not there, including lossing the 4 POS, Click / lock in, 0/90/180/270

 

I respect the DCS knowlage, wish I hade that depth, Ben

 

I have provided option that I know work and have done, ill leave the thread to continue 

Edited by Ben-111
Posted
7 hours ago, No1sonuk said:

Having looked at the Arduino library code, it looks to me like all the switch types are fancy packaging that leads to sendDcsBiosMessage commands.
I think whatever comes after the switch type is an arbitrary name to prevent clashes.

So try this:
DcsBios::RotaryEncoder bleedAirKnob("BLEED_AIR_KNOB", "DEC", "INC", 19, 20);
DcsBios::ActionButton bleedAirKnobWIBBLE("BLEED_AIR_KNOB", "0",21); // or whatever pin the encoder switch is

Actionbutton only sends the command on the falling edge of the switch (connecting to gnd), not the rising edge.
"WIBBLE" is in there because it's pretty much guaranteed you won't have any other function with that in it. 🤣

@No1sonuk This did the trick.  Still learning the ins and outs of this arduino programming but is the WIBBLE is just a random word you added to the end to make the bleedAirKnob name unique or does it serve some purpose / already exist in the DCS Bios F/A-18C library?  Is the "BLEED_AIR_KNOB" portion of code after the parenthesis the reference that is looked up by the code to make the command work?  I was under the impression that all the buttons (i.e. Switch2Pos apuControlSw or ActionButton bleedAirKnob, etc.) all had to be predefined in the F/A-18C DCS Bios Library I had downloaded.

Thanks for this help everyone.  I look forward to more building, designing, coding for future modules.  Quite fun!

Posted
4 hours ago, bigdave32 said:

@No1sonuk This did the trick.  Still learning the ins and outs of this arduino programming but is the WIBBLE is just a random word you added to the end to make the bleedAirKnob name unique or does it serve some purpose / already exist in the DCS Bios F/A-18C library?  Is the "BLEED_AIR_KNOB" portion of code after the parenthesis the reference that is looked up by the code to make the command work?  I was under the impression that all the buttons (i.e. Switch2Pos apuControlSw or ActionButton bleedAirKnob, etc.) all had to be predefined in the F/A-18C DCS Bios Library I had downloaded.

Thanks for this help everyone.  I look forward to more building, designing, coding for future modules.  Quite fun!

Yes. In my post, I mentioned "WIBBLE" was just to make it unique. 

The label between the function and parenthesis (bleedAirKnobWIBBLE in this case) can be anything you want. That's to make the control in the arduino code unique.

The part inside the parenthesis is the critical part for DCS.

"BLEED_AIR_KNOB" is the start of the message sent to DCS, and that's the part that can't be changed.

  • Recently Browsing   0 members

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