Jump to content

[DCS-BIOS v0.5.5] IFF Panel possible improvements


GSS Rain

Recommended Posts

Good day Ian. I just wanted to mention some possible improvements for the IFF panel.

 

1) The Audio/Out/Light 3-position switch: When the toggle switch is operated on the hardware panel, the in game switch only moves slightly. The in game switch travels maybe 1/5 of what it should. So instead of seeing the BAT pointed to AUDIO for example, it only leans in that direction slightly. So I'm not sure if that is a DCS World issue or not. Also can't confirm at the moment if the game still sees this as a valid change of not. ( This effect also happens with the HARS Compass panel for the MAG VAR 3-position switch, and also the environmental panel for the Windshield Rain Remove 3 position switch)

 

2) REPLY Indicator Light : The light on the hardware panel only comes on if I use the mouse and press the push to test on the computer screen. If I use the mouse and click the AUDIO switch above, the in game REPLY light comes on, but the hardware panel does not.

 

3) TEST Indicator Light : The light on the hardware panel only comes on if I use the mouse and press the push to test on the computer screen. If I move the toggle switches to M-1, M-2, M-3/A, or M-C, the in game TEST light comes on, but the hardware panel does not.

 

3) The CODE selector dial: This rotary knob only has encoder type as the input option in the control reference document. It would be good if the control reference document also listed Multi-switch position so that you could use a standard 4 position rotary switch.

 

I pasted the code below based on your code for BCD switches.

 


/*
IFF Panel
DCS-BIOS version 0.5.5
Arduino Mega
*/

#define DCSBIOS_IRQ_SERIAL
#include "DcsBios.h"

namespace DcsBios {
   class SwitchMultiPosBCD : PollingInput {
   private:
     const char* msg_;
     const byte* pins_;
     char numberOfPins_;
     char lastState_;
 
     char readState() {
       unsigned char i;
       unsigned char state = 0;
       for (i=0; i<numberOfPins_; i++) {
         unsigned char j = numberOfPins_ - i - 1;
//     state |= (digitalRead(pins_[i]) << j);
       state |= ((digitalRead(pins_[i]) ^ 1) << j); // to invert logic
         
       }
       return state;
     }

     void pollInput() {
       char state = readState();
       if (state != lastState_) {
         char buf[7];
         utoa(state, buf, 10);
         if (tryToSendDcsBiosMessage(msg_, buf))
           lastState_ = state;
       }
     }
   public:
     SwitchMultiPosBCD(const char* msg, const byte* pins, char numberOfPins) : lastState_(0) {
       msg_ = msg;
       pins_ = pins;
       numberOfPins_ = numberOfPins;
       unsigned char i;
       for (i=0; i<numberOfPins; i++) {
         pinMode(pins[i], INPUT_PULLUP);
       }
       lastState_ = readState();
     }
 };
}

// Mode-1 Wheel 1
const byte iffMode1Wheel1Pins[4] = {42, 43, 44, 45};
DcsBios::SwitchMultiPosBCD iffMode1Wheel1("IFF_MODE1_WHEEL1", iffMode1Wheel1Pins, 4);

// Mode-1 Wheel 2
const byte iffMode1Wheel2Pins[4] = {46, 47, 48, 49};
DcsBios::SwitchMultiPosBCD iffMode1Wheel2("IFF_MODE1_WHEEL2", iffMode1Wheel2Pins, 4);

// Mode-3A Wheel 1
const byte iffMode3aWheel1Pins[4] = {50, 51, 52, 53};
DcsBios::SwitchMultiPosBCD iffMode3aWheel1("IFF_MODE3A_WHEEL1", iffMode3aWheel1Pins, 4);

// Mode-3A Wheel 2
const byte iffMode3aWheel2Pins[4] = {5, 4, 3, 2};
DcsBios::SwitchMultiPosBCD iffMode3aWheel2("IFF_MODE3A_WHEEL2", iffMode3aWheel2Pins, 4);

// Mode-3A Wheel 3
const byte iffMode3aWheel3Pins[4] = {9, 8, 7, 6};
DcsBios::SwitchMultiPosBCD iffMode3aWheel3("IFF_MODE3A_WHEEL3", iffMode3aWheel3Pins, 4);

// Mode-3A Wheel 4
const byte iffMode3aWheel4Pins[4] = {13, 12, 11, 10};
DcsBios::SwitchMultiPosBCD iffMode3aWheel4("IFF_MODE3A_WHEEL4", iffMode3aWheel4Pins, 4);

// IFF Master: OFF - STBY - LOW - NORM - EMER
const byte iffMasterPins[5] = {22, 23, 24, 25, 26};
DcsBios::SwitchMultiPos iffMaster("IFF_MASTER", iffMasterPins, 5);

// IFF Out: LIGHT - OFF - AUDIO
DcsBios::Switch3Pos iffOutAudioLight("IFF_OUT_AUDIO_LIGHT", 27, 28);

// Test M-1
DcsBios::Switch3Pos iffTestM1("IFF_TEST_M1", 29, 30);

// Test M-2
DcsBios::Switch3Pos iffTestM2("IFF_TEST_M2", 31, 32);

// Test M-3
DcsBios::Switch3Pos iffTestM3("IFF_TEST_M3", 33, 34);

// Test M-4
DcsBios::Switch3Pos iffTestM4("IFF_TEST_M4", 35, 36);

// RAD Test/Mon
DcsBios::Switch3Pos iffRadtest("IFF_RADTEST", 37, 38);

// IFF On/Out
DcsBios::Switch2Pos iffOnOut("IFF_ON_OUT", 39);

// IFF MIC/IDENT (typo in Referecnce DOC, says RAD Test/Mon in bold on left side of page, but correct name on right side)
DcsBios::Switch3Pos iffMicIdent("IFF_MIC_IDENT", 40, 41);

// REPLY Push to Test
DcsBios::LED iffReplyTest(0x1128, 0x8000, A1);

// TEST Push to Test
DcsBios::LED iffTestTest(0x112a, 0x0040, A0);

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

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

 

Thanks for your hard work.

Link to comment
Share on other sites

  • 1 year later...

IFF Panel

 

1) I try to edit the file DCS-BIOS\lib\A10C.lua

find:
define3PosTumb("IFF_OUT_AUDIO_LIGHT", 43, 3009, 301, "IFF", "IFF Out: LIGHT - OFF - AUDIO")

replace:
defineTumb("IFF_OUT_AUDIO_LIGHT", 43, 3009, 301, 1,{-1, 1}, nil, true,"IFF", "IFF Out: LIGHT - OFF - AUDIO")

 

Enter the game test, it looks normal.

I have not tested other, you can try to modify it.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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