Jump to content

KA-50 Targeting Mode Control Panel - Head-on airborne target button issue


Recommended Posts

Posted

Hi all.

I'm going to fine tuning for final testing (and hopefully start flying...) all my cockpit panels.

As per title, I'm getting an issue with the Head-on airborne target button: the Bort snippet is

DcsBios::Switch2Pos weaponsForwardHemiTargetBtn("WEAPONS_FORWARD_HEMI_TARGET_BTN", PIN);

but testing the button (starting only Socat with no DCS running) I expect to see the msg after pressing and releasing:

WEAPONS_FORWARD_HEMI_TARGET_BTN 1
WEAPONS_FORWARD_HEMI_TARGET_BTN 0

but I get instead only:

1
0

and no sign of life in the cockpit (the virtual button) if I run DCS an press the button.

I checked even the DCSBIOS Ka-50.lua file, but (for my knowledges - very limited) I don't see any issue. And the button as a LED too...

Any suggestion / solution?

Thanks

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

Posted (edited)

What if you used the hex address instead of the signal name in the sketch?

Regards, Vinc

Edited by Vinc_Vega

Regards, Vinc

real life: Royal Bavarian Airforce

online: VJS-GermanKnights.de

[sIGPIC][/sIGPIC]

Posted

Thanks for support.

Do you mean smtg like 

DcsBios::Switch2Pos weaponsForwardHemiTargetBtn(0x1916, PIN)

Instead of

DcsBios::Switch2Pos weaponsForwardHemiTargetBtn("WEAPONS_FORWARD_HEMI_TARGET_BTN", PIN);

?

(I got the hex address from Bort in the Output section, don't know if is it the right stuff....)

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

Posted

Sorry, the hex addresses are for output only. My fault!

Yes, for that function it would be 0x1916.

 

Regards, Vinc

 

Regards, Vinc

real life: Royal Bavarian Airforce

online: VJS-GermanKnights.de

[sIGPIC][/sIGPIC]

Posted (edited)

@Jocman

You could use commands for the switch in "if" statements like

DcsBios::tryToSendDcsBiosMessage("WEAPONS_FORWARD_HEMI_TARGET_BTN", "1");

and

DcsBios::tryToSendDcsBiosMessage("WEAPONS_FORWARD_HEMI_TARGET_BTN", "0");

 

Regards, Vinc

Edited by Vinc_Vega

Regards, Vinc

real life: Royal Bavarian Airforce

online: VJS-GermanKnights.de

[sIGPIC][/sIGPIC]

Posted

Ok I tried; this what I did (hope it's correct):
 

DcsBios::Switch2Pos weaponsForwardHemiTargetBtn(0x1916, 3);

void onWeaponsForwardHemiTargetBtnChange(unsigned int newValue) {
    // your code here
    if (newValue==1){
      DcsBios::tryToSendDcsBiosMessage("WEAPONS_FORWARD_HEMI_TARGET_BTN", "1");
    } else {
      DcsBios::tryToSendDcsBiosMessage("WEAPONS_FORWARD_HEMI_TARGET_BTN", "0");
    }
}
DcsBios::IntegerBuffer weaponsForwardHemiTargetBtnBuffer(0x1916, 0x0100, 8, onWeaponsForwardHemiTargetBtnChange);

I suppose I can mix both the functions, as they should act as separate stuff.

BTW, in the image what i got.

I expected (is that correct?) to get the first message after the status 1 and the second after the status 0, but nothing. And considering I pushed/released the button immediately (as per "normal use") between 1 and 0 i had to wait about 15 seconds....

.screenshot.1.jpg

And obviously, no sign of life running DCS......

 

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

Posted (edited)

@Jocman

No, you don't need those DcsBios snippets for inputs as you can readout the Arduino pin - digitalRead(pin). Than make a decision, if the input is high, tryToSend a 0, else tryToSend 1 with the above commands. Inverse logic is because the switch is closed to ground.

(Unfortunately, I'm not at my laptop over the weekend, so I have to guess and type at my cellphone)

 

Regars, Vinc

Edited by Vinc_Vega

Regards, Vinc

real life: Royal Bavarian Airforce

online: VJS-GermanKnights.de

[sIGPIC][/sIGPIC]

Posted

Ops.....

Well, at the end, I'm not so  into programming, so I expect a lot of mistakes in my coding (and "coding" is really a BIG WORD.....)

BTW (wife allowing.....) I'll try to do some test in the we. Otherwise, next week.

I'll update the situation.

  • Like 1

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

Posted
8 hours ago, Vinc_Vega said:

@Jocman

You could use commands for the switch in "if" statements like

DcsBios::tryToSendDcsBiosMessage("WEAPONS_FORWARD_HEMI_TARGET_BTN", "1");

and

DcsBios::tryToSendDcsBiosMessage("WEAPONS_FORWARD_HEMI_TARGET_BTN", "0");

 

Regards, Vinc

 

Isn't it just :

tryToSendDcsBiosMessage("WEAPONS_FORWARD_HEMI_TARGET_BTN", "1");

Because it's the bottom line function, not the control class which "DcsBios::" defines.

Posted (edited)

@Jocman

Edit: try to update to the latest built of DcsBios, than check again.

Regards, Vinc

Edited by Vinc_Vega

Regards, Vinc

real life: Royal Bavarian Airforce

online: VJS-GermanKnights.de

[sIGPIC][/sIGPIC]

Posted (edited)

@No1sonuk

You are right, we get rid of the "DcsBios::" preposition but have to use the "sendDcsBiosMessage" with a lower case "s".

 

@Jocman

Both versions (a and b) work for me in the cockpit of the Ka-50 version 2:

a) Use of the preformed BORT snippets

Spoiler
#define DCSBIOS_IRQ_SERIAL
#include "DcsBios.h"

/* paste code snippets from the reference documentation here */
DcsBios::Switch2Pos weaponsForwardHemiTargetBtn("WEAPONS_FORWARD_HEMI_TARGET_BTN", 3);

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

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

 

b) Manually sending the switch inputs via Socat

Spoiler
#define DCSBIOS_IRQ_SERIAL
#include "DcsBios.h"

int SwitchPin = 3;  // button connected to digital pin 3
bool old_SwitchValue = 0; // variable to store the old switch position

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

void setup() {
  DcsBios::setup();
  pinMode(SwitchPin, INPUT_PULLUP);    // sets the digital pin 3 as input
}

void loop() {
  DcsBios::loop();
  if ((digitalRead(SwitchPin) == 0) && (old_SwitchValue == 1)) {sendDcsBiosMessage("WEAPONS_FORWARD_HEMI_TARGET_BTN", "1"); old_SwitchValue = 0;}
  if ((digitalRead(SwitchPin) == 1) && (old_SwitchValue == 0)) {sendDcsBiosMessage("WEAPONS_FORWARD_HEMI_TARGET_BTN", "0"); old_SwitchValue = 1;}
}

 

 

image.png

Best Regards, Vinc

Edited by Vinc_Vega

Regards, Vinc

real life: Royal Bavarian Airforce

online: VJS-GermanKnights.de

[sIGPIC][/sIGPIC]

Posted

Ok, I downloaded the nightly and replaced  the previous DCSBIOS version.

And tried.

This is what I get: it works. Yes, but only as IRQ SERIAL mode. In RS_485 mode I get the same issue (only 1 and 0, with no message sent)

#define DCSBIOS_IRQ_SERIAL
#include "DcsBios.h"

/* paste code snippets from the reference documentation here */
DcsBios::Switch2Pos weaponsForwardHemiTargetBtn("WEAPONS_FORWARD_HEMI_TARGET_BTN", 3);

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

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

copy/paste directly from Vinc topic

//#define DCSBIOS_IRQ_SERIAL

#define DCSBIOS_RS485_SLAVE 126   //Nr. massimo: 126

/*
  The Arduino pin that is connected to the
  /RE and DE pins on the RS-485 transceiver.
*/
#define TXENABLE_PIN 2    //PIN RISERVATO PER PROTOCOLLO 487

#include "DcsBios.h"

/* paste code snippets from the reference documentation here */
DcsBios::Switch2Pos weaponsForwardHemiTargetBtn("WEAPONS_FORWARD_HEMI_TARGET_BTN", 3);

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

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

edited to RS_485 mode.

 

Then, I tried again with the "old" DCSBIOS version (DCS Unified 2.9.3) and got the same result: IRQ_SERIAL mode: it works    RS_485 mode: doesn't work

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

Posted

@Jocman

Seems to be an internal DcsBios issue.

try the "manual" solution.

Spoiler
//#define DCSBIOS_IRQ_SERIAL
#define DCSBIOS_RS485_SLAVE 126
#define TXENABLE_PIN 2

#include "DcsBios.h"

int SwitchPin = 3;  // button connected to digital pin 3
bool old_SwitchValue = 0; // variable to store the old switch position

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

void setup() {
  DcsBios::setup();
  pinMode(SwitchPin, INPUT_PULLUP);    // sets the digital pin 3 as input
}

void loop() {
  DcsBios::loop();
  if ((digitalRead(SwitchPin) == 0) && (old_SwitchValue == 1)) {sendDcsBiosMessage("WEAPONS_FORWARD_HEMI_TARGET_BTN", "1"); old_SwitchValue = 0;}
  if ((digitalRead(SwitchPin) == 1) && (old_SwitchValue == 0)) {sendDcsBiosMessage("WEAPONS_FORWARD_HEMI_TARGET_BTN", "0"); old_SwitchValue = 1;}
}

 

 

Regards, Vinc

Regards, Vinc

real life: Royal Bavarian Airforce

online: VJS-GermanKnights.de

[sIGPIC][/sIGPIC]

Posted

I have no RS485 bus for testing at the time. Sorry, I can't help anymore.

Regards, Vinc 

Regards, Vinc

real life: Royal Bavarian Airforce

online: VJS-GermanKnights.de

[sIGPIC][/sIGPIC]

Posted

Of course, i understand, and you supported me really a lot, and i give thank to you for your efforts and time.

Do you think i can pinpoint an issue on github concerning this?

I was thinking from the beginning about a bcsbios internal issue, and someway you confirmed this idea (and i didn't talk about this idea)

 

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

Posted

@Jocman

Yes you can if @No1sonuk not already did. At least someone can walk through the source code and look if there's an issue within the RS485 definitions.

Regards, Vinc 

Regards, Vinc

real life: Royal Bavarian Airforce

online: VJS-GermanKnights.de

[sIGPIC][/sIGPIC]

  • Recently Browsing   0 members

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