Jump to content

Recommended Posts

Posted

I'm trying to get the MWS, JMR, RWR, DISP switches on the CMSP wired and programmed and I'm not having any luck yet. I'm connecting the switches to an Arduino Mega and using DCS Bios. I've tried using OFF-ON-(ON) switches and then OFF-ON-ON switches and none of them have worked so far. I'm about 90% done with my sim pit and haven't had any other issues with wiring and programming switches so I'm not sure what's going on. I'm guessing since there are DCS Bios Sketches for these switches that they are able to be built and used in a home cockpit, or are they not and I've been wasting my time? Any help or suggestions would be greatly appreciated as far as what kind of switches you're using that are working or suggestions as to what I might be doing wrong with these. Thanks! .

Windows 10

ASRock Z370 Extreme4 LGA 1151 (300 Series) MOBO

intel i7-8700k (Not overclocked)

16 GB Ram

EVGA GeForce GTX 108ti SC Black Edition

SSD

Trackir

Posted (edited)

Just use ON-OFF-(ON) switches (same like with the IFF-Panel). These are wired to two different Arduino pins.

If using the Switch3Pos option DcsBios already knows how to code.

Therefore, either 0 or 2 is send by DcsBios, representing the two end positions (Low at one pin, High at the other pin). DcsBios even knows if the signals are High at both pins, that the switch is in middle position (sending 1).

 

Edit: If you really have OFF-ON-ON switches, you may have to change the order of sending the messages. Double check your switches, Ground is the middle pin, end positions are at first and third pin.

 

Regards, Vinc

Edited by Vinc_Vega

Regards, Vinc

real life: Royal Bavarian Airforce

online: VJS-GermanKnights.de

[sIGPIC][/sIGPIC]

Posted

Hey Vinc. The CMSP switches are OFF-ON-MENU. If I use ON-OFF-(ON) switches, how do I get them to act like OFF-ON-(ON) just like the ones in the sim? My  ON-OFF-(ON) switches only have 3 terminals, middle being Ground. Or do I just wire them like normal and deal with the switch not being completely accurate with the real switches on the panel and just use them as ON-OFF -(MENU)? Thanks!

Windows 10

ASRock Z370 Extreme4 LGA 1151 (300 Series) MOBO

intel i7-8700k (Not overclocked)

16 GB Ram

EVGA GeForce GTX 108ti SC Black Edition

SSD

Trackir

Posted
1 hour ago, Kenpilot said:

... wire them like normal and deal with the switch not being completely accurate with the real switches on the panel and just use them as ON-OFF -(MENU)? Thanks!

Yes, indeed the switches are ON-OFF-(momentary ON) switches but will act as if they were OFF-ON-MENU.

A Switch3Pos only needs two pins of the Arduino (A & B) to represent all 3 positions, using the connectors A, GND and B as follows:

pin A |  pin B  |   status

LOW  | HIGH  | (Off) returns 0

HIGH | HIGH  | (On) returns 1

HIGH |  LOW  | (Menu) returns 2

This logic already has been implemented within DcsBios and you can use the statements from BORT for the four switches:

DcsBios::Switch3Pos cmspDisp("CMSP_DISP", PIN_A, PIN_B);
DcsBios::Switch3Pos cmspJmr("CMSP_JMR", PIN_A, PIN_B);
DcsBios::Switch3Pos cmspMws("CMSP_MWS", PIN_A, PIN_B);
DcsBios::Switch3Pos cmspRwr("CMSP_RWR", PIN_A, PIN_B);

 

Regards, Vinc

Regards, Vinc

real life: Royal Bavarian Airforce

online: VJS-GermanKnights.de

[sIGPIC][/sIGPIC]

Posted
Just now, Vinc_Vega said:

Yes, indeed the switches are ON-OFF-(momentary ON) switches but will act as if they were OFF-ON-MENU.

A Switch3Pos only needs two pins of the Arduino (A & B) to represent all 3 positions, using the connectors A, GND and B as follows:

pin A |  pin B  |   status

LOW  | HIGH  | (Off) returns 0

HIGH | HIGH  | (On) returns 1

HIGH |  LOW  | (Menu) returns 2

This logic already has been implemented within DcsBios and you can use the statements from BORT for the four switches:

DcsBios::Switch3Pos cmspDisp("CMSP_DISP", PIN_A, PIN_B);
DcsBios::Switch3Pos cmspJmr("CMSP_JMR", PIN_A, PIN_B);
DcsBios::Switch3Pos cmspMws("CMSP_MWS", PIN_A, PIN_B);
DcsBios::Switch3Pos cmspRwr("CMSP_RWR", PIN_A, PIN_B);

 

Regards, Vinc

Okay awesome, thanks Vinc, I'll wire it up tonight and test it out! 

Windows 10

ASRock Z370 Extreme4 LGA 1151 (300 Series) MOBO

intel i7-8700k (Not overclocked)

16 GB Ram

EVGA GeForce GTX 108ti SC Black Edition

SSD

Trackir

Posted (edited)

I don't understand why these 4 switches will not work. I've tried the OFF-ON-(ON), OFF-ON-ON, ON-OFF-(ON), and a simple OFF-ON switch and none of them will work. Again, I have my simpit about 90% done, which as you all know, has A LOT of switches, and they all work, all kinds of different switches, so I know how to wire switches, copy the code from DCS Bios, and these are the only 4 switches that I can't get to work. Not just one, but all 4. Everything else on my CMSP panel is working fine.  These are the DCS Bios commands that I'm using in my arduino sketch. I've tried different arduino boards, different inputs and nothing is working for these 4 switches, I just don't get it. Is there maybe an updated DCS Bios Command for these switches? I feel like that's the only problem that it could be at this point, is the DCS Bios command, its not working for some reason. Its not the switches or the wiring or the Arduino board, but the language in the sketch for some reason. Any thoughts? 

DcsBios::Switch3Pos cmspMws("CMSP_MWS", PIN_A, PIN_B);

DcsBios::Switch3Pos cmspJmr("CMSP_JMR", PIN_A, PIN_B);

DcsBios::Switch3Pos cmspRwr("CMSP_RWR", PIN_A, PIN_B);

DcsBios::Switch3Pos cmspDisp("CMSP_DISP", PIN_A, PIN_B);

 

Edited by Kenpilot

Windows 10

ASRock Z370 Extreme4 LGA 1151 (300 Series) MOBO

intel i7-8700k (Not overclocked)

16 GB Ram

EVGA GeForce GTX 108ti SC Black Edition

SSD

Trackir

Posted (edited)

I finally found the time to do a quick test, just an Arduino Uno and some jump wires.

The following sketch on the a.m. switches is working for me at pins 4 to 11

#define DCSBIOS_IRQ_SERIAL
#include "DcsBios.h"

/* paste code snippets from the reference documentation here */
DcsBios::Switch3Pos cmspDisp("CMSP_DISP", 4, 5);
DcsBios::Switch3Pos cmspJmr("CMSP_JMR", 6, 7);
DcsBios::Switch3Pos cmspMws("CMSP_MWS", 8, 9);
DcsBios::Switch3Pos cmspRwr("CMSP_RWR", 10, 11);

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

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

 

May you post the entire sketch for the CSMP to see if something broke the logic?

 

Regards, Vinc

Edited by Vinc_Vega

Regards, Vinc

real life: Royal Bavarian Airforce

online: VJS-GermanKnights.de

[sIGPIC][/sIGPIC]

Posted

You'll have to use the ON-OFF-(ON) type for it to work.
DCS interprets the "OFF" position as the centre.

Have you tried using the CMSP switches to run another 3-position function you know works?  e.g. Landing/Taxi lights or Master Arm switches?

Posted (edited)

Yes, you are right! The above example is for regular ON-OFF-ON switches and prepaid DcsBios snippets. If other switches are in use, the pins may be read and modified 'sendDcsBiosMessage" send. In other words, for that sketch and switches some objects from the switches.h file could be adjusted to send the respective messages.

But I don't believe that's the real problem, because it's not the only panel with that kind of switches.

 

@Kenpilot Please post the entire sketch to see if there is something blocking.

 

Regards, Vinc

Edited by Vinc_Vega

Regards, Vinc

real life: Royal Bavarian Airforce

online: VJS-GermanKnights.de

[sIGPIC][/sIGPIC]

Posted

Okay, will do, thanks guys. It won't be until probably tomorrow but I'll post it. Thanks! 

Windows 10

ASRock Z370 Extreme4 LGA 1151 (300 Series) MOBO

intel i7-8700k (Not overclocked)

16 GB Ram

EVGA GeForce GTX 108ti SC Black Edition

SSD

Trackir

Posted (edited)

I tested another ON-OFF-(ON) switch with the same exact sketch as Vinc, but only using the DISP switch, and nothing else plugged in to the arduino, only this switch, and its still not working. I did test the switch on another panel and it is working. I'm stumped. I have absolutely no idea why none of these 4 switches are working. Is there another switch maybe that is on another panel that needs to be on or in a certain position for these toggle switches to be functional? Does the CMSP MODE switch need to be in a certain position? I'm out of ideas as to why in the world none of these 4 switches will work. I have seen several videos of other people's CMSP panel working with these switches, I'm just totally confused as to why mine won't work. This was the sketch:

 

#define DCSBIOS_IRQ_SERIAL
#include "DcsBios.h"

/* paste code snippets from the reference documentation here */
DcsBios::Switch3Pos cmspDisp("CMSP_DISP", 2, 3);


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

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

 

 

Edited by Kenpilot

Windows 10

ASRock Z370 Extreme4 LGA 1151 (300 Series) MOBO

intel i7-8700k (Not overclocked)

16 GB Ram

EVGA GeForce GTX 108ti SC Black Edition

SSD

Trackir

Posted (edited)

@Kenpilot

I can't see any error within the script.

To exclude that something is broken, you can go to the C:\Users\...\Saved Games\DCS.openbeta\Scripts directory and delete the DCS-BIOS folder and Export.lua (don't forget to backup your Export.lua). Than do a clean reinstall of DcsBios latest version https://github.com/DCS-Skunkworks/dcs-bios/releases/tag/latest

Ensure that Socat or DcsBios-Bridge is running and try the CSMP script again.

 

Regards, Vinc

Edited by Vinc_Vega

Regards, Vinc

real life: Royal Bavarian Airforce

online: VJS-GermanKnights.de

[sIGPIC][/sIGPIC]

Posted

Even if there is another switch that needs to be on for the CMSP switches to alter the function and displays, the "physical" switches in the cockpit model should still move with your DCS-BIOS connected switches.

Posted (edited)
11 hours ago, Kenpilot said:

 

#define DCSBIOS_IRQ_SERIAL
#include "DcsBios.h"

/* paste code snippets from the reference documentation here */
DcsBios::Switch3Pos cmspDisp("CMSP_DISP", 2, 3);


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

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

 

I just confirmed this sketch causes the CMSP DISP switch to move on both A-10C modules in cold/dark condition - So just the switch moves.
Test Arduino is clone Uno with ON-OFF-ON switch.  Sketch used is exactly as above - no edits.
Latest DCS update.

EDIT:
Also works on Mega.

There must be something wrong with your setup.

Edited by No1sonuk
Posted

Yes, there is no other switch in the cockpit that prevents the CMSP switches from moving. Like @No1sonuk wrote, they should move even in a cold & dark situation.

Do a clean reinstall, like recommend above, and if that doesn't work, you also may download and make use of the latest DcsBios library for Arduino.

Regards, Vinc

  • Like 1

Regards, Vinc

real life: Royal Bavarian Airforce

online: VJS-GermanKnights.de

[sIGPIC][/sIGPIC]

Posted

Thanks guys. I'm going to do the reinstall like Vinc suggested and see if that does it. I really can't see why else it wouldn't work. I figured it should still work even in a cold and dark cockpit, like No1sonuk said, but just trying to make sure I'm not missing anything. Hopefully the reinstall of DCS Bios will do it. 

Windows 10

ASRock Z370 Extreme4 LGA 1151 (300 Series) MOBO

intel i7-8700k (Not overclocked)

16 GB Ram

EVGA GeForce GTX 108ti SC Black Edition

SSD

Trackir

Posted

It's working!!!!! I think the reinstall did it! You guys rock!! Thank you SO much for your time and expertise!!!! 

  • Like 1
  • Thanks 1

Windows 10

ASRock Z370 Extreme4 LGA 1151 (300 Series) MOBO

intel i7-8700k (Not overclocked)

16 GB Ram

EVGA GeForce GTX 108ti SC Black Edition

SSD

Trackir

  • Recently Browsing   0 members

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