Jump to content

DCS-BIOS Discussion Thread


FSFIan

Recommended Posts

If I might make a suggestion regarding the motor you are using, before you go to much further you really should verify whether that motor will be fast enough to keep up to the cockpit altimeter when you are in a dive. From past experimenting I was unable to get that motor to turn fast enough.

 

Thankd warhog for answering, and my stepper choise is due to your expertise :)

 

the motor that i ll use for real is the M35SP-11NK from mitsumi and it is fast


Edited by kadda

With respect

_________________

Kadda

_________________

My works

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

Link to comment
Share on other sites

Hello every one, i ve finnished yesterday adding the instruments for l-39, but i ve one question to ask,

 

When i ve compared for ex the ka50 lua file in bios lib i ve found that for ex IAS gauge it like that

«defineFloat("IAS", arg num, {0,1},...."»

For the l-39 in the output value {0,...,...,...,...,1}

 

So my noob question of the day is, have i to put all the intermediat output values or just the 0 and the 1?

 

Thank you for the futur answer(s), my altimeter is working fine thanks to IAN and Warhog, ian i ve modifyied the mainpanel init.lua so now value from dcs on land is «0» :)

 

Cheers

With respect

_________________

Kadda

_________________

My works

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

Link to comment
Share on other sites

Hello every one, i ve finnished yesterday adding the instruments for l-39, but i ve one question to ask,

 

When i ve compared for ex the ka50 lua file in bios lib i ve found that for ex IAS gauge it like that

«defineFloat("IAS", arg num, {0,1},...."»

For the l-39 in the output value {0,...,...,...,...,1}

 

So my noob question of the day is, have i to put all the intermediat output values or just the 0 and the 1?

 

Thank you for the futur answer(s), my altimeter is working fine thanks to IAN and Warhog, ian i ve modifyied the mainpanel init.lua so now value from dcs on land is «0» :)

 

Cheers

With respect

_________________

Kadda

_________________

My works

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

Link to comment
Share on other sites

When i ve compared for ex the ka50 lua file in bios lib i ve found that for ex IAS gauge it like that

«defineFloat("IAS", arg num, {0,1},...."»

For the l-39 in the output value {0,...,...,...,...,1}

 

So my noob question of the day is, have i to put all the intermediat output values or just the 0 and the 1?

 

Just {0, 1}, since the defineFloat parameter only ever accesses limits[1] and limits[2]. A quick look at the Util.lua file would have told you that.

 

Use {-1, 1} if the cockpit argument can go negative, {0, 1} otherwise.

 

i ve modifyied the mainpanel init.lua so now value from dcs on land is «0»

 

...and now your altimeter in the virtual cockpit is slightly off. You should not modify any file that comes with DCS. Interpretation of the value should be handled in the Arduino sketch.

Link to comment
Share on other sites

Ian;3024127']Just {0' date=' 1}, since the defineFloat parameter only ever accesses limits[1'] and limits[2]. A quick look at the Util.lua file would have told you that.

 

Use {-1, 1} if the cockpit argument can go negative, {0, 1} otherwise.

 

 

 

...and now your altimeter in the virtual cockpit is slightly off. You should not modify any file that comes with DCS. Interpretation of the value should be handled in the Arduino sketch.

 

Good morning guys and thank you very much IAN for answering, i ll correct my l-39 file and send you a link by pm of dcs-bios for verification this afternoon.

With respect

_________________

Kadda

_________________

My works

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

Link to comment
Share on other sites

  • 2 weeks later...

DCS bios question

 

I have a working master caution led from the library example but as soon as I insert my own code to write to osram displays it stops working. I dont even make any calls to my own functions and it still doesnt work but if I go back to the dcs bios library mcled example it works again. How can it not wortk if I dont even make any calls to any functions except the mcled?

p.s. pin 42 is the led on my custom board.

 

#define DCSBIOS_IRQ_SERIAL
#include "DcsBios.h"
#include <SPI.h>

/* Declare a Master Caution Reset button on pin 10 */
DcsBios::Switch2Pos masterCautionBtn("UFC_MASTER_CAUTION", 10);
/* Make the LED connected to pin 13 into a Master Caution Light */
DcsBios::LED mcLed(0x1012, 0x0800, 42);

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

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


//write character to osram serial display
void dcsBios_tste_write_char(char myValue[],int load_value,char* mycompValue){
   for(int i=0; i<8;i++){
   digitalWrite(load_value, HIGH);
   digitalWrite(load_value, LOW);
   SPI.transfer(myValue[i]);
   digitalWrite(load_value, HIGH);
   my_comparator_func(mycompValue++);
  // write_master_array(_L);
   delayMicroseconds(1);}
 }
//write to jammer osram display
 void dcsBios_tste_write_slave_char(char myValue[],int load_value,char* mycompValue){
   for(int i=0; i<8;i++){
   digitalWrite(load_value, HIGH);
   digitalWrite(load_value, LOW);
   SPI.transfer(myValue[i]);
   digitalWrite(load_value, HIGH);
   my_comparator_slave_func(mycompValue++);
  // write_master_array(_L);
   delayMicroseconds(1);}
 }
const int RESET = 44;
const int master_LOAD  = 46;
const int slave_LOAD  = 28;
char *myPtr;
//character ascii library
char _num[10]=       {0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,};
char load_digit[8] = {0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7};
char _excl[7] =      {0x04,0x04,0x04,0x04,0x04,0x00,0x04};
char _quote [7] =    {0x0A,0x0A,0x00,0x00,0x00,0x00,0x00};
char _pound [7] =    {0x0A,0x0A,0x1F,0x0A,0x0F,0x0A,0x0A};
char _dollar[7] =    {0x04,0x0F,0x14,0x0E,0x05,0x1E,0x04};
char _percent[7]=    {0x18,0x19,0x02,0x04,0x08,0x13,0x03};
char _ampersand[7]=  {0x18,0x19,0x02,0x04,0x08,0x13,0x03};
char _singlequote[7]={0x0C,0x0C,0x08,0x04,0x00,0x00,0x00};
char l_brack[7] =    {0x02,0x04,0x04,0x04,0x04,0x04,0x02};
char r_brack[7] =    {0x08,0x04,0x04,0x04,0x04,0x04,0x08};
char asterick[7] =   {0x00,0x0A,0x04,0x1F,0x04,0x0A,0x00};
char _plus[7]   =    {0x00,0x04,0x04,0x1F,0x04,0x04,0x00};
char _comma[7]  =    {0x00,0x00,0x00,0x18,0x18,0x08,0x10};
char _minus[7]  =    {0x00,0x00,0x00,0x1F,0x00,0x00,0x00};
char _period[7] =    {0x00,0x00,0x00,0x00,0x00,0x0C,0x0C};
char _fwdslsh[7] =   {0x00,0x01,0x02,0x04,0x08,0x10,0x00};

char _0[7]      =    {0x0E,0x11,0x13,0x15,0x19,0x11,0x0E};
char _1[7]      =    {0x04,0x0C,0x04,0x04,0x04,0x04,0x0E};
char _2[7]      =    {0x0E,0x11,0x01,0x06,0x08,0x10,0x1F};
char _3[7]      =    {0x0E,0x11,0x01,0x0E,0x01,0x11,0x0E};
char _4[7]      =    {0x02,0x06,0x0A,0x12,0x1F,0x02,0x02};
char _5[7]      =    {0x1F,0x10,0x1E,0x01,0x01,0x01,0x1E};
char _6[7]      =    {0x06,0x08,0x10,0x1E,0x11,0x11,0x0E};
char _7[7]      =    {0x1F,0x01,0x02,0x04,0x08,0x08,0x08};
char _8[7]      =    {0x0E,0x11,0x11,0x0E,0x11,0x11,0x0E};
char _9[7]      =    {0x0E,0x11,0x11,0x0F,0x01,0x02,0x0C};
char _colon[7]  =    {0x00,0x0C,0x0C,0x00,0x0C,0x0C,0x00};
char _semi [7]  =    {0x0C,0x0C,0x00,0x0C,0x0C,0x04,0x08};
char _less[7]   =    {0x01,0x02,0x04,0x08,0x04,0x02,0x01};
char _equal[7]   =    {0x00,0x00,0x1F,0x00,0x1F,0x00,0x00};
char _greater[7]=    {0x10,0x08,0x04,0x02,0x04,0x08,0x10};
char _question [7] = {0x0E,0x11,0x01,0x02,0x04,0x00,0x04};
char _at [7]    =    {0x0A,0x00,0x0E,0x12,0x12,0x12,0x0D};

char _A[7]      = {0x0E,0x11,0x11,0x1F,0x11,0x11,0x11};
char _B[7]      = {0x1E,0x11,0x11,0x1E,0x11,0x11,0x1E};
char _C[7]      = {0x0E,0x11,0x10,0x10,0x10,0x11,0x0E};
char _D[7]      = {0x1E,0x11,0x11,0x11,0x11,0x11,0x1E};
char _E[7]      = {0x1F,0x10,0x10,0x1E,0x10,0x10,0x1F};
char _F[7]      = {0x1F,0x10,0x10,0x1E,0x10,0x10,0x10};
char _G[7]      = {0x0E,0x11,0x10,0x10,0x13,0x11,0x0E};
char _H[7]      = {0x11,0x11,0x11,0x1F,0x11,0x11,0x11};
char _I[7]      = {0x07,0x04,0x04,0x04,0x04,0x04,0x07};
char _J[7]      = {0x01,0x01,0x01,0x01,0x01,0x11,0x0E};
char _K[7]      = {0x11,0x12,0x14,0x18,0x14,0x12,0x11};
char _L[7]      = {0x10,0x10,0x10,0x10,0x10,0x10,0x1F};
char _M[7]      = {0x11,0x1B,0x15,0x15,0x11,0x11,0x11};
char _N[7]      = {0x11,0x11,0x19,0x15,0x13,0x11,0x11};
char _O[7]      = {0x0E,0x11,0x11,0x11,0x11,0x11,0x0E};
char _P[7]      = {0x1E,0x11,0x11,0x1E,0x10,0x10,0x10};
char _Q [7]      = {0x0E,0x11,0x11,0x11,0x15,0x12,0x0D};
char _R[7]      = {0x1E,0x11,0x11,0x1E,0x14,0x12,0x11};
char _S[7]      = {0x0E,0x11,0x10,0x0E,0x01,0x11,0x0E};
char _T[7]      = {0x0F,0x04,0x04,0x04,0x04,0x04,0x04};
char _U[7]      = {0x11,0x11,0x11,0x11,0x11,0x11,0x0E};
char _V[7]      = {0x11,0x11,0x11,0x0A,0x0A,0x04,0x04};
char _W[7]      = {0x11,0x11,0x11,0x15,0x15,0x1B,0x11};
char _X[7]      = {0x11,0x11,0x0A,0x04,0x0A,0x11,0x11};
char _Y[7]      = {0x11,0x11,0x11,0x0A,0x0A,0x04,0x04};
char _Z[7]      = {0x1F,0x01,0x02,0x04,0x08,0x10,0x1F};
char _lbrack[7] = {0x07,0x04,0x04,0x04,0x04,0x04,0x07};
char _bkslsh[7] = {0x00,0x10,0x08,0x04,0x02,0x01,0x00};
char _rbrack[7] = {0x1C,0x04,0x04,0x04,0x04,0x04,0x1C};
char _pyramid[7]= {0x04,0x0A,0x11,0x00,0x00,0x00,0x00};
char _underln[7]= {0x00,0x00,0x00,0x00,0x00,0x00,0x1F};
char _l_apos [7]= {0x0C,0x0C,0x04,0x08,0x00,0x00,0x00};
char _a[7]      = {0x00,0x00,0x0E,0x12,0x12,0x12,0x0D};
char _b[7]      = {0x10,0x10,0x10,0x16,0x19,0x11,0x1E};
char _c[7]      = {0x00,0x00,0x0E,0x10,0x10,0x11,0x0E};
char _d[7]      = {0x01,0x01,0x01,0x0D,0x13,0x11,0x0F};
char _e[7]      = {0x00,0x00,0x0E,0x11,0x0E,0x10,0x0E};
char _f[7]      = {0x04,0x0A,0x08,0x1C,0x08,0x08,0x08};
char _g[7]      = {0x00,0x00,0x0F,0x11,0x0F,0x01,0x06};
char _h[7]      = {0x10,0x10,0x16,0x19,0x11,0x11,0x11};
char _i[7]      = {0x00,0x04,0x00,0x0C,0x04,0x04,0x0E};
char _j[7]      = {0x02,0x00,0x06,0x02,0x02,0x12,0x0C};
char _k[7]      = {0x10,0x01,0x12,0x14,0x18,0x14,0x12};
char _l[7]      = {0x0C,0x04,0x04,0x04,0x04,0x04,0x0E};
char _m[7]      = {0x00,0x00,0x0A,0x15,0x11,0x11,0x11};
char _n[7]      = {0x00,0x00,0x16,0x19,0x11,0x11,0x11};
char _o[7]      = {0x00,0x00,0x0E,0x11,0x11,0x11,0x0E};
char _p[7]      = {0x00,0x00,0x1E,0x11,0x19,0x16,0x10};
char _q[7]      = {0x00,0x00,0x0F,0x11,0x13,0x0D,0x01};
char _r[7]      = {0x00,0x00,0x0B,0x0C,0x08,0x08,0x08};
char _s[7]      = {0x00,0x00,0x0E,0x10,0x0E,0x01,0x1E};
char _t[7]      = {0x08,0x08,0x1C,0x08,0x08,0x0A,0x04};
char _u[7]      = {0x00,0x00,0x11,0x11,0x11,0x13,0x0D};
char _v[7]      = {0x00,0x00,0x11,0x11,0x11,0x0A,0x04};
char _w[7]      = {0x00,0x00,0x11,0x11,0x15,0x15,0x0A};
char _x[7]      = {0x00,0x00,0x11,0x0A,0x04,0x0A,0x11};
char _y[7]      = {0x00,0x00,0x11,0x0A,0x04,0x04,0x08};
char _z[7]      = {0x00,0x00,0x1F,0x02,0x04,0x08,0x1F};
char _l_brace[7]= {0x02,0x04,0x04,0x08,0x04,0x04,0x02};
char _bar [7]   = {0x04,0x04,0x04,0x00,0x04,0x04,0x04};
char _r_brace[7] = {0x08,0x04,0x04,0x02,0x04,0x04,0x08};
char _tilde[7]  = {0x00,0x00,0x08,0x05,0x02,0x00,0x00};
char _fill [7]  = {0x0A, 0x15,0x0A,0x15,0x0A,0x15,0x0A};
char _arrow[7]  = {0x04,0x0E,0x15,0x04,0x04,0x04,0x04};
char _blank[7]  = {0x00,0x00,0x00,0x00,0x00,0x00,0x00};

void write_char(char myValue,char load_value){
   digitalWrite(load_value, HIGH);
   digitalWrite(load_value, LOW);
   SPI.transfer(myValue);
   digitalWrite(load_value, HIGH);
   delayMicroseconds(1);
 }


void write_master_array(char myArray[]){
   // SPI.begin();
   myPtr = myArray;
   for(int x = 0;x<7;x++){
       write_char(*myPtr++,master_LOAD);
          }
   //  SPI.end();
}

 void write_slave_array(char myArray[]){
   // SPI.begin();
   myPtr = myArray;
   for(int x = 0;x<7;x++){
         write_char(*myPtr++,slave_LOAD); 
          }
   //  SPI.end();
}
//compare ascii number to library 
void my_comparator_func(char* myValue){
 switch (*myValue) {

   case 0x21:
     write_master_array(_excl);
     break;

     case 0x22:
     write_master_array(_quote);
     break;

     case 0x23:
     write_master_array(_pound);
     break;

     case 0x24:
     write_master_array(_dollar);
     break;

     case 0x25:
     write_master_array(_percent);
     break;

     case 0x26:
     write_master_array(_ampersand);
     break;

     case 0x27:
     write_master_array(_0);
     break;

     case 0x28:
     write_master_array(l_brack);
     break;

     case 0x29:
     write_master_array(r_brack);
     break;

     case 0x2A:
     write_master_array(asterick);
     break;

     case 0x2B:
     write_master_array(_plus);
     break;

     case 0x2C:
     write_master_array(_l_apos);
     break;

     case 0x2D:
     write_master_array(_minus);
     break;

     case 0x2E:
     write_master_array(_period);
     break;

     case 0x2F:
     write_master_array(_fwdslsh);
     break;

     case 0x30:
     write_master_array(_0);
     break;

     
     case 0x31:
     write_master_array(_1);
     break;

     case 0x32:
     write_master_array(_2);
     break;

     case 0x33:
     write_master_array(_3);
     break;

     case 0x34:
     write_master_array(_4);
     break;

     case 0x35:
     write_master_array(_5);
     break;

     case 0x36:
     write_master_array(_6);
     break;

     case 0x37:
     write_master_array(_7);
     break;

     case 0x38:
     write_master_array(_8);
     break;

     case 0x39:
     write_master_array(_9);
     break;

     case 0x3A:
     write_master_array(_colon);
     break;

     case 0x3B:
     write_master_array(_semi);
     break;

     case 0x3C:
     write_master_array(_less);
     break;

     case 0x3D:
     write_master_array(_equal);
     break;

     case 0x3E:
     write_master_array(_greater);
     break;

     case 0x3F:
     write_master_array(_question);
     break;

     case 0x40:
     write_master_array(_at);
     break;

     case 0x41:
     write_master_array(_A);
     break;

     case 0x42:
     write_master_array(_B);
     break;

     case 0x43:
     write_master_array(_C);
     break;

     case 0x44:
     write_master_array(_D);
     break;

     case 0x45:
     write_master_array(_E);
     break;

     case 0x46:
     write_master_array(_F);
     break;

     case 0x47:
     write_master_array(_G);
     break;

     case 0x48:
     write_master_array(_H);
     break;

     case 0x49:
     write_master_array(_I);
     break;

     case 0x4A:
     write_master_array(_J);
     break;

     case 0x4B:
     write_master_array(_K);
     break;

     case 0x4C:
     write_master_array(_L);
     break;

     case 0x4D:
     write_master_array(_M);
     break;

     case 0x4E:
     write_master_array(_N);
     break;

     case 0x4F:
     write_master_array(_O);
     break;

     case 0x50:
     write_master_array(_P);
     break;

     case 0x51:
     write_master_array(_Q);
     break;

     case 0x52:
     write_master_array(_R);
     break;

     case 0x53:
     write_master_array(_S);
     break;

     case 0x54:
     write_master_array(_T);
     break;

     case 0x55:
     write_master_array(_U);
     break;

     case 0x56:
     write_master_array(_V);
     break;

     case 0x57:
     write_master_array(_W);
     break;

     case 0x58:
     write_master_array(_X);
     break;

     case 0x59:
     write_master_array(_Y);
     break;

     case 0x5A:
     write_master_array(_Z);
     break;

     case 0x5B:
     write_master_array(l_brack);
     break;

     case 0x5C:
     write_master_array(_bkslsh);
     break;

     case 0x5D:
     write_master_array(r_brack);
     break;

     case 0x5E:
     write_master_array(_pyramid);
     break;

     case 0x5F:
     write_master_array(_underln);
     break;

     case 0x60:
     write_master_array(_l_apos);
     break;

     case 0x61:
     write_master_array(_a);
     break;

     case 0x62:
     write_master_array(_b);
     break;

     case 0x63:
     write_master_array(_c);
     break;

     case 0x64:
     write_master_array(_d);
     break;

     case 0x65:
     write_master_array(_e);
     break;

     case 0x66:
     write_master_array(_f);
     break;

     case 0x67:
     write_master_array(_g);
     break;

     case 0x68:
     write_master_array(_h);
     break;

     case 0x69:
     write_master_array(_i);
     break;

     case 0x6A:
     write_master_array(_j);
     break;

     case 0x6B:
     write_master_array(_k);
     break;

     case 0x6C:
     write_master_array(_l);
     break;

     case 0x6D:
     write_master_array(_m);
     break;

     case 0x6E:
     write_master_array(_n);
     break;

     case 0x6F:
     write_master_array(_o);
     break;

     case 0x70:
     write_master_array(_p);
     break;

     case 0x71:
     write_master_array(_q);
     break;

     case 0x72:
     write_master_array(_r);
     break;

     case 0x73:
     write_master_array(_s);
     break;

     case 0x74:
     write_master_array(_t);
     break;

     case 0x75:
     write_master_array(_u);
     break;

     case 0x76:
     write_master_array(_v);
     break;

     case 0x77:
     write_master_array(_w);
     break;

     case 0x78:
     write_master_array(_x);
     break;

     case 0x79:
     write_master_array(_y);
     break;

     case 0x7A:
     write_master_array(_z);
     break;

     case 0x7B:
     write_master_array(_l_brace);
     break;

     case 0x7C:
     write_master_array(_bar);
     break;

     case 0x7D:
     write_master_array(_r_brace);
     break;

     case 0x7E:
     write_master_array(_tilde);
     break;

     case 0x7F:
     write_master_array(_arrow);
     break;
     
     default: 
     write_master_array(_blank);
     break;
 }
    

 }

 void dcsBios_load_digit(char load_digit,char* myValue){
   digitalWrite(master_LOAD, HIGH);
   digitalWrite(master_LOAD, LOW);
   SPI.transfer(load_digit);
   digitalWrite(master_LOAD, HIGH);
   delayMicroseconds(1);
      my_comparator_func(*myValue);
      load_digit++;
   }



 void my_comparator_slave_func(char* myValue){
 switch (*myValue) {

   case 0x21:
     write_slave_array(_excl);
     break;

     case 0x22:
     write_slave_array(_quote);
     break;

     case 0x23:
     write_slave_array(_pound);
     break;

     case 0x24:
     write_slave_array(_dollar);
     break;

     case 0x25:
     write_master_array(_percent);
     break;

     case 0x26:
     write_master_array(_ampersand);
     break;

     case 0x27:
     write_master_array(_0);
     break;

     case 0x28:
     write_master_array(l_brack);
     break;

     case 0x29:
     write_master_array(r_brack);
     break;

     case 0x2A:
     write_master_array(asterick);
     break;

     case 0x2B:
     write_master_array(_plus);
     break;

     case 0x2C:
     write_master_array(_l_apos);
     break;

     case 0x2D:
     write_master_array(_minus);
     break;

     case 0x2E:
     write_master_array(_period);
     break;

     case 0x2F:
     write_master_array(_fwdslsh);
     break;

     case 0x30:
     write_slave_array(_0);
     break;

     
     case 0x31:
     write_slave_array(_1);
     break;

     case 0x32:
     write_slave_array(_2);
     break;

     case 0x33:
     write_slave_array(_3);
     break;

     case 0x34:
     write_slave_array(_4);
     break;

     case 0x35:
     write_slave_array(_5);
     break;

     case 0x36:
     write_slave_array(_6);
     break;

     case 0x37:
     write_slave_array(_7);
     break;

     case 0x38:
     write_slave_array(_8);
     break;

     case 0x39:
     write_slave_array(_9);
     break;

     case 0x3A:
     write_master_array(_colon);
     break;

     case 0x3B:
     write_master_array(_semi);
     break;

     case 0x3C:
     write_master_array(_less);
     break;

     case 0x3D:
     write_master_array(_equal);
     break;

     case 0x3E:
     write_master_array(_greater);
     break;

     case 0x3F:
     write_master_array(_question);
     break;

     case 0x40:
     write_master_array(_at);
     break;

     case 0x41:
    write_slave_array(_A);
     break;

     case 0x42:
     write_slave_array(_B);
     break;

     case 0x43:
     write_slave_array(_C);
     break;

     case 0x44:
     write_slave_array(_D);
     break;

     case 0x45:
     write_slave_array(_E);
     break;

     case 0x46:
     write_slave_array(_F);
     break;

     case 0x47:
     write_slave_array(_G);
     break;

     case 0x48:
     write_slave_array(_H);
     break;

     case 0x49:
     write_slave_array(_I);
     break;

     case 0x4A:
     write_slave_array(_J);
     break;

     case 0x4B:
     write_slave_array(_K);
     break;

     case 0x4C:
     write_slave_array(_L);
     break;

     case 0x4D:
     write_slave_array(_M);
     break;

     case 0x4E:
     write_slave_array(_N);
     break;

     case 0x4F:
     write_slave_array(_O);
     break;

     case 0x50:
     write_slave_array(_P);
     break;

     case 0x51:
     write_slave_array(_Q);
     break;

     case 0x52:
     write_slave_array(_R);
     break;

     case 0x53:
     write_slave_array(_S);
     break;

     case 0x54:
     write_slave_array(_T);
     break;

     case 0x55:
     write_slave_array(_U);
     break;

     case 0x56:
     write_slave_array(_V);
     break;

     case 0x57:
    write_slave_array(_W);
     break;

     case 0x58:
     write_slave_array(_X);
     break;

     case 0x59:
     write_slave_array(_Y);
     break;

     case 0x5A:
     write_slave_array(_Z);
     break;

     case 0x5B:
     write_slave_array(l_brack);
     break;

     case 0x5C:
     write_slave_array(_bkslsh);
     break;

     case 0x5D:
     write_slave_array(r_brack);
     break;

     case 0x5E:
     write_slave_array(_pyramid);
     break;

     case 0x5F:
     write_slave_array(_underln);
     break;

     case 0x60:
     write_slave_array(_l_apos);
     break;

     case 0x61:
     write_slave_array(_a);
     break;

     case 0x62:
     write_slave_array(_b);
     break;

     case 0x63:
     write_slave_array(_c);
     break;

     case 0x64:
     write_slave_array(_d);
     break;

     case 0x65:
     write_slave_array(_e);
     break;

     case 0x66:
     write_slave_array(_f);
     break;

     case 0x67:
     write_slave_array(_g);
     break;

     case 0x68:
     write_slave_array(_h);
     break;

     case 0x69:
     write_slave_array(_i);
     break;

     case 0x6A:
     write_slave_array(_j);
     break;

     case 0x6B:
     write_slave_array(_k);
     break;

     case 0x6C:
     write_slave_array(_l);
     break;

     case 0x6D:
     write_slave_array(_m);
     break;

     case 0x6E:
     write_slave_array(_n);
     break;

     case 0x6F:
     write_slave_array(_o);
     break;

     case 0x70:
     write_slave_array(_p);
     break;

     case 0x71:
     write_slave_array(_q);
     break;

     case 0x72:
     write_slave_array(_r);
     break;

     case 0x73:
     write_slave_array(_s);
     break;

     case 0x74:
     write_slave_array(_t);
     break;

     case 0x75:
     write_slave_array(_u);
     break;

     case 0x76:
     write_slave_array(_v);
     break;

     case 0x77:
     write_slave_array(_w);
     break;

     case 0x78:
     write_slave_array(_x);
     break;

     case 0x79:
     write_slave_array(_y);
     break;

     case 0x7A:
     write_slave_array(_z);
     break;

     case 0x7B:
     write_slave_array(_l_brace);
     break;

     case 0x7C:
     write_slave_array(_bar);
     break;

     case 0x7D:
     write_slave_array(_r_brace);
     break;

     case 0x7E:
     write_slave_array(_tilde);
     break;

     case 0x7F:
     write_slave_array(_arrow);
     break;
     
     default: 
     write_slave_array(_blank);
     break;
 }
 }
    

  


Edited by cBass
Link to comment
Share on other sites

I have a working master caution led from the library example but as soon as I insert my own code to write to osram displays it stops working. I dont even make any calls to my own functions and it still doesnt work but if I go back to the dcs bios library mcled example it works again. How can it not wortk if I dont even make any calls to any functions except the mcled?

p.s. pin 42 is the led on my custom board.

 

The code you posted works fine on my Mega 2560 board. (I only tested the LED output and did not bother to hook up a button.)

 

PS: When posting code, use

 tags instead of 
tags. That way, the indentation will be preserved and smilies will be disabled, so one can copy and paste without having to fix up the places where "8)" was replaced by a smiley.
Link to comment
Share on other sites

Thank's for testing Ian. I must still have a hardware issue somewhere.

 

What ascii bytes representing special characters especially the diamond (lozenge?) between chaff and flare does DCS use ?

 

What diamond character on which display are you referring to? Can you post a screenshot?

 

The underlined character between the amount of flares and chaff on the CMSC, which indicates the position of the Master CMS Mode Select, is either ' ', 'x', 's', 'm', or 'a'.

Link to comment
Share on other sites

The diamond or lozenge appears every time you deploy chaff or flare. Usually there is a lower case letter that is underlined where the diamond appears signifying the mode your in ie. standby ,manual ect.(I don't know the ascii for that symbol either?) This underlined letter disappears when chaff or flare is discharged and replaced by the diamond.

To test I just do instant action (starts you in the air) then nellis weapons practice then change to manual mode and hit key seven to kick out flare. Dont know how to or if you can with WoW?


Edited by cBass
Link to comment
Share on other sites

Arduino Nano. Buy several from Chinese sellers on eBay. They are $2.50 approx.:thumbup:

Regards

John W

aka WarHog.

 

My Cockpit Build Pictures...



John Wall

 

My Arduino Sketches ... https://drive.google.com/drive/folders/1-Dc0Wd9C5l3uY-cPj1iQD3iAEHY6EuHg?usp=sharing

 

 

WIN 10 Pro, i8-8700k @ 5.0ghz, ASUS Maximus x Code, 16GB Corsair Dominator Platinum Ram,



AIO Water Cooler, M.2 512GB NVMe,

500gb SSD, EVGA GTX 1080 ti (11gb), Sony 65” 4K Display

VPC MongoosT-50, TM Warthog Throttle, TRK IR 5.0, Slaw Viper Pedals

Link to comment
Share on other sites

Hello,

I would like to create a library for the Gazelle.

 

I take a look at the developper guide but i have my first problem. I don't have information in the interactive control reference, so no name off the module. I tried with the A10 and also no information??

 

Have I to launch someting to connect DCS to the interactive control reference?

 

Thanks for your help.

Link to comment
Share on other sites

Hello,

I would like to create a library for the Gazelle.

 

I take a look at the developper guide but i have my first problem. I don't have information in the interactive control reference, so no name off the module. I tried with the A10 and also no information??

 

Have I to launch someting to connect DCS to the interactive control reference?

 

Thanks for your help.

 

Hello, did you followed tye steps copiyng the files in the saved games/.../script folder?

Did you enabled the interactive control that is in tht folder?

What about your export file?

With respect

_________________

Kadda

_________________

My works

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

Link to comment
Share on other sites

Hello,

I follow your step by step vidéo to activate the extention in google chrome.

My dcs bios folder is not in my saved games folder but my export.lua have been patched.

Maybe my firewall??

 

My panel work fine with DCS BIOS

 

Back home i will trie again.

 

Any other idea??

 

Thanks

Link to comment
Share on other sites

Hello,

I make it again and always nothing.

DCS BIOS is in the script folder in my saved game folder.

I enable the interactive control reference in chrome pointing to de Doc folder located in the script folder

I launch DCS jump in the Gazelle, open the APP interactive control reference and nothing :(, same with the A-10.

 

693685Capture1.png

 

186120Capture2.png

 

My firewall and antivirus are off.

 

Here is my export.lua

gHost = "127.0.0.1"
gPort = 9089
gExportInterval = 0.067
gExportLowTickInterval = 1
gEveryFrameArguments = {[540]="%0.1f", [541]="%0.1f", [542]="%0.1f", [730]="%0.1f", [731]="%0.1f", [732]="%0.1f", [76]="%.4f", [77]="%.4f", [78]="%.4f", [80]="%.4f", [84]="%.4f", [85]="%.4f", [70]="%.4f", [73]="%.4f", [82]="%.4f", [83]="%.4f", [13]="%.4f", [14]="%.4f", [48]="%.4f", [12]="%.4f", [4]="%.4f", [55]="%0.1f", [17]="%.4f", [18]="%.4f", [24]="%.4f", [23]="%.4f", [25]="%0.1f", [19]="%0.1f", [26]="%0.1f", [20]="%.4f", [21]="%.4f", [27]="%.4f", [63]="%.4f", [64]="%.4f", [65]="%0.1f", [715]="%.4f", [40]="%0.1f", [32]="%0.1f", [46]="%0.1f", [34]="%.4f", [36]="%.4f", [47]="%.4f", [41]="%.4f", [33]="%.4f", [35]="%.4f", [662]="%0.1f", [663]="%0.1f", [665]="%0.1f", [664]="%0.1f", [215]="%0.1f", [216]="%0.1f", [217]="%0.1f", [404]="%0.1f", [372]="%0.1f", [373]="%0.1f", [374]="%0.1f", [654]="%1d", [659]="%0.1f", [660]="%0.1f", [661]="%0.1f", [737]="%0.1f", [653]="%.4f", [88]="%.4f", [89]="%.4f", [647]="%.4f", [648]="%.4f", [606]="%0.1f", [608]="%0.1f", [610]="%0.1f", [612]="%0.1f", [614]="%0.1f", [616]="%0.1f", [618]="%0.1f", [619]="%0.1f", [620]="%0.1f", [274]="%.4f", [604]="%.4f", [600]="%0.1f", [281]="%.4f", [289]="%1d", [480]="%0.1f", [481]="%0.1f", [482]="%0.1f", [483]="%0.1f", [484]="%0.1f", [485]="%0.1f", [486]="%0.1f", [487]="%0.1f", [488]="%0.1f", [489]="%0.1f", [490]="%0.1f", [491]="%0.1f", [492]="%0.1f", [493]="%0.1f", [494]="%0.1f", [495]="%0.1f", [496]="%0.1f", [497]="%0.1f", [498]="%0.1f", [499]="%0.1f", [500]="%0.1f", [501]="%0.1f", [502]="%0.1f", [503]="%0.1f", [504]="%0.1f", [505]="%0.1f", [506]="%0.1f", [507]="%0.1f", [508]="%0.1f", [509]="%0.1f", [510]="%0.1f", [511]="%0.1f", [512]="%0.1f", [513]="%0.1f", [514]="%0.1f", [515]="%0.1f", [516]="%0.1f", [517]="%0.1f", [518]="%0.1f", [519]="%0.1f", [520]="%0.1f", [521]="%0.1f", [522]="%0.1f", [523]="%0.1f", [524]="%0.1f", [525]="%0.1f", [526]="%0.1f", [527]="%0.1f", [260]="%0.1f", [269]="%.4f", [129]="%1d", [185]="%1d", [186]="%1d", [187]="%1d", [188]="%1d", [191]="%0.1f", [798]="%0.1f", [799]="%0.1f", [178]="%0.1f", [179]="%0.1f", [181]="%0.1f", [182]="%0.1f"}
gArguments = {[22]="%.3f", [101]="%.1f", [102]="%1d", [103]="%1d", [104]="%1d", [105]="%1d", [300]="%.1f", [301]="%.1f", [302]="%.1f", [303]="%.1f", [304]="%.1f", [305]="%.1f", [306]="%.1f", [307]="%.1f", [308]="%.1f", [309]="%.1f", [310]="%.1f", [311]="%.1f", [312]="%.1f", [313]="%.1f", [314]="%.1f", [315]="%.1f", [316]="%.1f", [317]="%.1f", [318]="%.1f", [319]="%.1f", [320]="%1d", [321]="%1d", [322]="%1d", [323]="%1d", [324]="%1d", [325]="%0.1f", [326]="%.1f", [327]="%.1f", [328]="%.1f", [329]="%.1f", [330]="%.1f", [331]="%.1f", [332]="%.1f", [333]="%.1f", [334]="%.1f", [335]="%.1f", [336]="%.1f", [337]="%.1f", [338]="%.1f", [339]="%.1f", [340]="%.1f", [341]="%.1f", [342]="%.1f", [343]="%.1f", [344]="%.1f", [345]="%.1f", [346]="%1d", [347]="%1d", [348]="%1d", [349]="%1d", [350]="%1d", [351]="%0.1f", [385]="%.1f", [386]="%.1f", [387]="%.1f", [388]="%.1f", [389]="%.1f", [390]="%.1f", [391]="%.1f", [392]="%.1f", [393]="%.1f", [395]="%.1f", [396]="%.1f", [394]="%.1f", [397]="%.1f", [398]="%.1f", [399]="%.1f", [400]="%.1f", [401]="%.1f", [402]="%.1f", [405]="%1d", [406]="%1d", [407]="%1d", [408]="%1d", [409]="%1d", [531]="%.1f", [532]="%.1f", [533]="%.1f", [403]="%.1f", [365]="%.1f", [366]="%.1f", [369]="%.1f", [370]="%.1f", [371]="%.1f", [367]="%.3f", [368]="%.3f", [716]="%1d", [655]="%0.1f", [651]="%.1f", [375]="%0.1f", [376]="%0.1f", [377]="%0.1f", [378]="%1d", [379]="%0.1f", [380]="%1d", [381]="%1d", [382]="%1d", [383]="%1d", [384]="%0.1f", [645]="%0.1f", [646]="%.1f", [605]="%.1f", [607]="%.1f", [609]="%.1f", [611]="%.1f", [613]="%.1f", [615]="%.1f", [617]="%.1f", [621]="%1d", [711]="%.1f", [622]="%0.1f", [623]="%1d", [624]="%.3f", [626]="%.3f", [636]="%0.2f", [638]="%0.2f", [640]="%0.2f", [642]="%0.2f", [644]="%1d", [628]="%.1f", [630]="%.1f", [632]="%.1f", [634]="%.1f", [410]="%.1f", [411]="%.1f", [412]="%.1f", [413]="%.1f", [414]="%.1f", [415]="%.1f", [416]="%.1f", [417]="%.1f", [418]="%.1f", [419]="%.1f", [420]="%.1f", [421]="%.1f", [422]="%.1f", [423]="%.1f", [425]="%.1f", [426]="%.1f", [427]="%.1f", [428]="%.1f", [429]="%.1f", [430]="%.1f", [431]="%.1f", [432]="%.1f", [433]="%.1f", [434]="%.1f", [435]="%.1f", [436]="%.1f", [437]="%.1f", [438]="%.1f", [439]="%.1f", [440]="%.1f", [441]="%.1f", [442]="%.1f", [443]="%.1f", [444]="%.1f", [445]="%.1f", [446]="%.1f", [447]="%.1f", [448]="%.1f", [449]="%.1f", [450]="%.1f", [451]="%.1f", [452]="%.1f", [453]="%.1f", [454]="%.1f", [455]="%.1f", [456]="%.1f", [457]="%.1f", [458]="%.1f", [459]="%.1f", [460]="%.1f", [461]="%.1f", [462]="%.1f", [466]="%.1f", [467]="%.1f", [468]="%.1f", [470]="%.1f", [471]="%.1f", [424]="%1d", [463]="%1d", [469]="%1d", [472]="%1d", [241]="%1d", [242]="%1d", [243]="%1d", [244]="%1d", [245]="%1d", [246]="%1d", [601]="%1d", [602]="%1d", [603]="%1d", [712]="%0.2f", [352]="%.1f", [353]="%.1f", [354]="%.1f", [355]="%.1f", [356]="%1d", [357]="%.1f", [358]="%1d", [359]="%.3f", [360]="%0.1f", [361]="%0.1f", [362]="%0.1f", [363]="%0.1f", [364]="%0.1f", [275]="%.1f", [276]="%1d", [277]="%.3f", [278]="%1d", [279]="%1d", [280]="%1d", [282]="%1d", [283]="%1d", [284]="%.3f", [287]="%1d", [288]="%.3f", [290]="%.3f", [291]="%1d", [292]="%.3f", [293]="%.3f", [294]="%1d", [295]="%1d", [296]="%.3f", [297]="%.3f", [258]="%0.2f", [259]="%.1f", [261]="%.3f", [262]="%0.1f", [266]="%1d", [247]="%1d", [248]="%0.1f", [250]="%0.1f", [249]="%.3f", [251]="%0.1f", [252]="%0.1f", [270]="%1d", [273]="%1d", [272]="%1d", [271]="%.3f", [267]="%.1f", [268]="%.3f", [473]="%0.1f", [474]="%1d", [475]="%0.1f", [476]="%1d", [477]="%1d", [106]="%1d", [107]="%1d", [108]="%1d", [109]="%1d", [110]="%1d", [111]="%1d", [112]="%1d", [113]="%1d", [114]="%1d", [115]="%.1f", [117]="%1d", [118]="%1d", [119]="%1d", [120]="%1d", [121]="%1d", [116]="%.3f", [122]="%1d", [123]="%1d", [124]="%1d", [125]="%1d", [126]="%1d", [127]="%.1f", [132]="%1d", [131]="%.1f", [130]="%1d", [137]="%0.3f", [138]="%0.1f", [135]="%0.1f", [133]="%.3f", [136]="%.1f", [134]="%1d", [139]="%0.2f", [140]="%0.2f", [141]="%0.2f", [142]="%0.2f", [151]="%0.3f", [153]="%0.2f", [154]="%0.2f", [155]="%0.2f", [156]="%0.2f", [152]="%0.1f", [149]="%0.1f", [147]="%.3f", [150]="%.1f", [148]="%1d", [189]="%1d", [190]="%.1f", [192]="%.3f", [197]="%.1f", [196]="%1d", [193]="%.3f", [195]="%.3f", [194]="%0.1f", [198]="%.1f", [161]="%0.2f", [162]="%0.1f", [163]="%0.2f", [164]="%0.2f", [165]="%0.2f", [166]="%0.2f", [167]="%0.1f", [168]="%0.1f", [169]="%1d", [170]="%1d", [171]="%.3f", [172]="%.1f", [173]="%.1f", [735]="%.1f", [734]="%1d", [779]="%1d", [778]="%1d", [780]="%1d", [781]="%0.1f", [782]="%0.1f", [783]="%0.1f", [784]="%1d", [772]="%1d", [199]="%0.1f", [200]="%0.1f", [201]="%1d", [202]="%1d", [203]="%1d", [204]="%1d", [205]="%1d", [206]="%1d", [207]="%1d", [208]="%1d", [209]="%0.2f", [210]="%0.2f", [211]="%0.2f", [212]="%0.2f", [213]="%0.2f", [214]="%0.2f", [174]="%1d", [175]="%1d", [176]="%0.1f", [177]="%1d", [180]="%1d", [183]="%1d", [184]="%1d", [221]="%.3f", [222]="%1d", [223]="%.3f", [224]="%1d", [225]="%.3f", [226]="%1d", [227]="%.3f", [228]="%1d", [229]="%.3f", [230]="%1d", [231]="%.3f", [232]="%1d", [233]="%.3f", [234]="%1d", [235]="%.3f", [236]="%1d", [237]="%1d", [238]="%.3f", [239]="%0.1f", [240]="%.1f", [704]="%.3f", [705]="%.3f", [718]="%1d", [722]="%.1f", [733]="%1d"}

function ProcessHighImportance(mainPanelDevice)
-- Send Altimeter Values	
SendData(2051, string.format("%0.4f;%0.4f;%0.5f", mainPanelDevice:get_argument_value(52), mainPanelDevice:get_argument_value(53), mainPanelDevice:get_argument_value(51)))
SendData(2059, string.format("%0.2f;%0.2f;%0.2f;%0.3f", mainPanelDevice:get_argument_value(56), mainPanelDevice:get_argument_value(57), mainPanelDevice:get_argument_value(58), mainPanelDevice:get_argument_value(59)))		
-- Calcuate HSI Value
SendData(2029, string.format("%0.2f;%0.2f;%0.4f", mainPanelDevice:get_argument_value(29), mainPanelDevice:get_argument_value(30), mainPanelDevice:get_argument_value(31)))
-- Calculate Total Fuel
SendData(2090, string.format("%0.2f;%0.2f;%0.5f", mainPanelDevice:get_argument_value(90), mainPanelDevice:get_argument_value(91), mainPanelDevice:get_argument_value(92)))
end

function ProcessLowImportance(mainPanelDevice)
-- Get Radio Frequencies
local lUHFRadio = GetDevice(54)
SendData(2000, string.format("%7.3f", lUHFRadio:get_frequency()/1000000))
-- ILS Frequency
--SendData(2251, string.format("%0.1f;%0.1f", mainPanelDevice:get_argument_value(251), mainPanelDevice:get_argument_value(252)))
-- TACAN Channel
SendData(2263, string.format("%0.2f;%0.2f;%0.2f", mainPanelDevice:get_argument_value(263), mainPanelDevice:get_argument_value(264), mainPanelDevice:get_argument_value(265)))
end

--  os.setlocale("ISO-8559-1", "numeric")

-- Simulation id
gSimID = string.format("%08x*",os.time())

-- State data for export
gPacketSize = 0
gSendStrings = {}
gLastData = {}

-- Frame counter for non important data
gTickCount = 0

-- DCS Export Functions
function LuaExportStart()
-- Works once just before mission start.

   -- 2) Setup udp sockets to talk to helios
   package.path  = package.path..";.\\LuaSocket\\?.lua"
   package.cpath = package.cpath..";.\\LuaSocket\\?.dll"
  
   socket = require("socket")
   
   c = socket.udp()
c:setsockname("*", 0)
c:setoption('broadcast', true)
   c:settimeout(.001) -- set the timeout for reading the socket 
end

function LuaExportBeforeNextFrame()
ProcessInput()
end

function LuaExportAfterNextFrame()	
end

function LuaExportStop()
-- Works once just after mission stop.
   c:close()
end

function ProcessInput()
   local lInput = c:receive()
   local lCommand, lCommandArgs, lDevice, lArgument, lLastValue
   
   if lInput then

       lCommand = string.sub(lInput,1,1)
       
	if lCommand == "R" then
		ResetChangeValues()
	end

	if (lCommand == "C") then
		lCommandArgs = StrSplit(string.sub(lInput,2),",")
		lDevice = GetDevice(lCommandArgs[1])
		if type(lDevice) == "table" then
			lDevice:performClickableAction(lCommandArgs[2],lCommandArgs[3])	
		end
	end
   end 
end

function LuaExportActivityNextEvent(t)
t = t + gExportInterval

gTickCount = gTickCount + 1

local lDevice = GetDevice(0)
if type(lDevice) == "table" then
	lDevice:update_arguments()

	ProcessArguments(lDevice, gEveryFrameArguments)
	ProcessHighImportance(lDevice)

	if gTickCount >= gExportLowTickInterval then
		ProcessArguments(lDevice, gArguments)
		ProcessLowImportance(lDevice)
		gTickCount = 0
	end

	FlushData()
end

return t
end

-- Helper Functions
function StrSplit(str, delim, maxNb)
   -- Eliminate bad cases...
   if string.find(str, delim) == nil then
       return { str }
   end
   if maxNb == nil or maxNb < 1 then
       maxNb = 0    -- No limit
   end
   local result = {}
   local pat = "(.-)" .. delim .. "()"
   local nb = 0
   local lastPos
   for part, pos in string.gfind(str, pat) do
       nb = nb + 1
       result[nb] = part
       lastPos = pos
       if nb == maxNb then break end
   end
   -- Handle the last field
   if nb ~= maxNb then
       result[nb + 1] = string.sub(str, lastPos)
   end
   return result
end

function round(num, idp)
 local mult = 10^(idp or 0)
 return math.floor(num * mult + 0.5) / mult
end

-- Status Gathering Functions
function ProcessArguments(device, arguments)
local lArgument , lFormat , lArgumentValue
	
for lArgument, lFormat in pairs(arguments) do 
	lArgumentValue = string.format(lFormat,device:get_argument_value(lArgument))
	SendData(lArgument, lArgumentValue)
end
end



-- Network Functions
function SendData(id, value)	
if string.len(value) > 3 and value == string.sub("-0.00000000",1, string.len(value)) then
	value = value:sub(2)
end

if gLastData[id] == nil or gLastData[id] ~= value then
	local data =  id .. "=" .. value
	local dataLen = string.len(data)

	if dataLen + gPacketSize > 576 then
		FlushData()
	end

	table.insert(gSendStrings, data)
	gLastData[id] = value	
	gPacketSize = gPacketSize + dataLen + 1
end	
end

function FlushData()
if #gSendStrings > 0 then
	local packet = gSimID .. table.concat(gSendStrings, ":") .. "\n"
	socket.try(c:sendto(packet, gHost, gPort))
	gSendStrings = {}
	gPacketSize = 0
end
end

function ResetChangeValues()
gLastData = {}
gTickCount = 10
end


 local dcsSr=require('lfs');dofile(dcsSr.writedir()..[[scripts\DCS-SimpleRadioStandalone.lua]])


local Tacviewlfs=require('lfs');dofile(Tacviewlfs.writedir()..'Scripts/TacviewExportDCS.lua')

dofile(lfs.writedir()..[[scripts\DCS-BIOS\BIOS.lua]])

 

:helpsmilie:

Link to comment
Share on other sites

Ruahatu: I have no idea why it does not work on your system. The same code works here with current versions of DCS: World. I do not have Helios or TacView installed, but I don't see how that would make any difference.

 

If you post your dcs.log I'll see if I spot any error messages that might be related.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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