DCS-BIOS: pas d'INPUT vers cockpit DCS [RESOLU]
-
Topic author - Nouvelle Recrue
- Messages : 181
- Inscription : 07 juin 2004
DCS-BIOS: pas d'INPUT vers cockpit DCS [RESOLU]
#1Petit message qui pourrait aider d'autres: je poste après résolution et surtout après avoir cherché pendant des heures une solution sur tous les forums de la Terre.
Symptômes:
- output depuis cockpit DCS vers matériel (afficheur 7 segments, LED) fonctionnent sans problème.
- input depuis matériel vers cockpit DCS ne fonctionnent pas.
Vérifications:
- console DOS reçoit les infos de DCS.
- console DOS affiche mes commandes issues du matériel (potentiomètres, encodeurs rotatifs, poussoirs).
- firewall comporte une règle autorisant les connections de SOCAT.exe.
- version de socat.exe est courante.
+ (enfin) vérifications du logs DCS-BIOS (C:\Users\"Utilisateur"\Saved Games\DCS.openbeta\Logs\) : log DCS-BIOS est vierge.
+ vérification du log DCS (même répertoire) : ah? :
2020-01-02 15:20:29.683 ERROR VFS: VFS_open_write: CreateFile(C:\Users\"Utilisateur"\Saved Games\DCS.openbeta\Logs\DCS-BIOS.log): The process cannot access the file because it is being used by another process.
Retour en arrière: j'ai précédemment galéré pour faire fonctionner mon DCS-BIOS car j'avais essayé d'installer un .msi de la dernière version (0.10) qui n'a jamais fonctionné chez moi. J'ai donc procédé à une "installation" par copie d'une version antérieure, puis mise en conformité de l'arborescence avec l'aide précieuse de Hombre.
==> SOLUTION: désinstaller le .msi DCS-BIOS depuis le menu de désinstallation programmes de Windows.
Tout fonctionne maintenant. Quelques heures de perdues... Mais pour une fois, je n'ai appelé personne au secours!
Symptômes:
- output depuis cockpit DCS vers matériel (afficheur 7 segments, LED) fonctionnent sans problème.
- input depuis matériel vers cockpit DCS ne fonctionnent pas.
Vérifications:
- console DOS reçoit les infos de DCS.
- console DOS affiche mes commandes issues du matériel (potentiomètres, encodeurs rotatifs, poussoirs).
- firewall comporte une règle autorisant les connections de SOCAT.exe.
- version de socat.exe est courante.
+ (enfin) vérifications du logs DCS-BIOS (C:\Users\"Utilisateur"\Saved Games\DCS.openbeta\Logs\) : log DCS-BIOS est vierge.
+ vérification du log DCS (même répertoire) : ah? :
2020-01-02 15:20:29.683 ERROR VFS: VFS_open_write: CreateFile(C:\Users\"Utilisateur"\Saved Games\DCS.openbeta\Logs\DCS-BIOS.log): The process cannot access the file because it is being used by another process.
Retour en arrière: j'ai précédemment galéré pour faire fonctionner mon DCS-BIOS car j'avais essayé d'installer un .msi de la dernière version (0.10) qui n'a jamais fonctionné chez moi. J'ai donc procédé à une "installation" par copie d'une version antérieure, puis mise en conformité de l'arborescence avec l'aide précieuse de Hombre.
==> SOLUTION: désinstaller le .msi DCS-BIOS depuis le menu de désinstallation programmes de Windows.
Tout fonctionne maintenant. Quelques heures de perdues... Mais pour une fois, je n'ai appelé personne au secours!
Re: DCS-BIOS: pas d'INPUT vers cockpit DCS [RESOLU]
#2Je pense, l'avantage des forums c'est de pouvoir partager les connaissances tout en ce faisant plaisir à montrer ses compétences.
On vit trop dans l'individualisme au lieu de partager
Re: DCS-BIOS: pas d'INPUT vers cockpit DCS [RESOLU]
#3Bonjour,
je decouvre ton sujet et je suis preneur des infos sur ton dcs--bios vers afficheur segment7
J'essaye de faire la meme chose, mais l'affichage se fait en hexadecimale et je ne trouve pas de solution pour convertir en quelques choses de lisible
je serais preneur de ton code pour m'appuyer dessus et comprendre ce qui se passe
Merci pour tes infos
je decouvre ton sujet et je suis preneur des infos sur ton dcs--bios vers afficheur segment7
J'essaye de faire la meme chose, mais l'affichage se fait en hexadecimale et je ne trouve pas de solution pour convertir en quelques choses de lisible
je serais preneur de ton code pour m'appuyer dessus et comprendre ce qui se passe
Merci pour tes infos
-
Topic author - Nouvelle Recrue
- Messages : 181
- Inscription : 07 juin 2004
Re: DCS-BIOS: pas d'INPUT vers cockpit DCS [RESOLU]
#5Actuellement, j en suis la dans mon code arduino
2 problemes
A - les infos de mes variables ont en hexadecimale
B - mon 2eme groupe d'afficheur segment7 n'est pas pris en compte
2 problemes
A - les infos de mes variables ont en hexadecimale
B - mon 2eme groupe d'afficheur segment7 n'est pas pris en compte
#define DCSBIOS_IRQ_SERIAL
#include <LedControl.h>
#include <DcsBios.h>
//pin 51 is connected to the DataIn
//pin 52 is connected to the CLK
//pin 53 is connected to LOAD / CS
//pin 48 is connected to the DataIn
//pin 49 is connected to the CLK
//pin 50 is connected to LOAD / CS
LedControl lc1=LedControl(51,52,53,4); //This creates an instance of a single controller named "lc1" for the first 4 Segment7 display
LedControl lc2=LedControl(48,49,50,4); //This creates an instance of a single controller named "lc2" for the last 4 Segment7 display
// GENERAL REF NOTE BELOW
unsigned long delaytime=250;
/*
The sequence of pins used above are in the following order... LedControl(DIN,CLK,LOAD,# OF IC's)
pin X is connected to the DataIn
pin X is connected to the CLK
pin X is connected to LOAD
the last number...(1) is for how many MAX7219 we have daisy chained. (8 STATED, HOWEVER 4 ACTUALLY PRESENT)
*/
/*
void onUhfFrequencyChange(char* newValue) {
lc1.setChar(0,7,newValue[0],false);
lc1.setChar(0,6,newValue[1],false);
lc1.setChar(0,5,newValue[2],true);
lc1.setChar(0,4,newValue[3],false);
lc1.setChar(0,3,newValue[4],false);
lc1.setChar(0,2,newValue[5],false);
lc1.setChar(0,1,newValue[6],false);
}
DcsBios::StringBuffer<7> uhfFrequencyBuffer(0x1180, onUhfFrequencyChange);
*/
int convertGaugeToInt (float newValue, float maxValue) { //Converts the value in to a single gigit between 0-9
return round(newValue/65535*maxValue);
}
void onAltitudeValueChange(unsigned int newValuealthex) {
unsigned int newValuealt;
newValuealt = ( newValuealthex, 10);
int altunit;
int altdeci;
int altcenti;
int altmilli;
int altdecmilli;
altunit=newValuealt%10000;
newValuealt=newValuealt/10;
altdeci=newValuealt%1000;
newValuealt=newValuealt/10;
altcenti=newValuealt%100;
newValuealt=newValuealt/10;
altmilli=newValuealt%10;
newValuealt=newValuealt/10;
altdecmilli=newValuealt;
lc1.setDigit(0,7,(byte)altunit,false);
lc1.setDigit(0,6,(byte)altdeci,false);
lc1.setDigit(0,5,(byte)altcenti,false);
lc1.setDigit(0,4,(byte)altmilli,false);
lc1.setDigit(0,3,(byte)altdecmilli,false);
}
DcsBios::IntegerBuffer altitudeValueBuffer(0x42a0, 0xffff, 0, onAltitudeValueChange);
/////////////////////////////////////////////////////////////////////////////////
void onCompassHeadingValueChange(unsigned int newValuehdg) {
int hdgunit;
int hdgdeci;
int hdgcenti;
hdgunit=newValuehdg%100;
hdgdeci=newValuehdg%10;
hdgcenti=newValuehdg;
lc1.setDigit(1,7,(byte)hdgunit,false);
lc1.setDigit(1,6,(byte)hdgdeci,false);
lc1.setDigit(1,5,(byte)hdgcenti,false);
}
DcsBios::IntegerBuffer compassHeadingValueBuffer(0x42a6, 0xffff, 0, onCompassHeadingValueChange);
/////////////////////////////////////////////////////////////////////////////////
void onAirspeedValueChange(unsigned int newValuevit) {
int vitunit;
int vitdeci;
int vitcenti;
int vitmilli;
vitunit=newValuevit%1000;
vitdeci=newValuevit%100;
vitcenti=newValuevit%10;
vitcenti=newValuevit;
lc1.setDigit(1,3,(byte)vitunit,true);
lc1.setDigit(1,2,(byte)vitdeci,false);
lc1.setDigit(1,1,(byte)vitcenti,false);
lc1.setDigit(1,0,(byte)vitmilli,false);
}
DcsBios::IntegerBuffer airspeedValueBuffer(0x429e, 0xffff, 0, onAirspeedValueChange);
/////////////////////////////////////////////////////////////////////////////////
void onCoolantTemperatureValueChange(unsigned int newValuetemp1) {
int temp1unit;
int temp1deci;
int temp1centi;
boolean negative;
if(newValuetemp1<0) { negative=true; newValuetemp1=newValuetemp1*-1; }
temp1unit=newValuetemp1%100;
temp1deci=newValuetemp1%10;
temp1centi=newValuetemp1;
if(negative) {lc1.setChar(2,4,'-',false);}else{lc1.setChar(2,4,' ',false); }
lc1.setDigit(2,7,(byte)temp1unit,false);
lc1.setDigit(2,6,(byte)temp1deci,false);
lc1.setDigit(2,5,(byte)temp1centi,false);
}
DcsBios::IntegerBuffer coolantTemperatureValueBuffer(0x429a, 0xffff, 0, onCoolantTemperatureValueChange);
/////////////////////////////////////////////////////////////////////////////////
void onOilTemperatureValueChange(unsigned int newValuetemp2) {
int temp2unit;
int temp2deci;
int temp2centi;
boolean negative;
if(newValuetemp2<0) { negative=true; newValuetemp2=newValuetemp2*-1; }
temp2unit=newValuetemp2%100;
temp2deci=newValuetemp2%10;
temp2centi=newValuetemp2;
if(negative) {lc1.setChar(2,0,'-',false);}else{lc1.setChar(2,0,' ',false); }
lc1.setDigit(2,3,(byte)temp2unit,false);
lc1.setDigit(2,2,(byte)temp2deci,false);
lc1.setDigit(2,1,(byte)temp2centi,false);
}
DcsBios::IntegerBuffer oilTemperatureValueBuffer(0x4298, 0xffff, 0, onOilTemperatureValueChange);
/////////////////////////////////////////////////////////////////////////////////
void onFuelLevelValueChange(unsigned int newValueFuel) {
int fuelunit;
int fueldeci;
int fuelcenti;
int fuelmilli;
fuelunit=newValueFuel%1000;
fueldeci=newValueFuel%100;
fuelcenti=newValueFuel%10;
fuelmilli=newValueFuel;
lc1.setDigit(3,7,(byte)fuelunit,false);
lc1.setDigit(3,6,(byte)fueldeci,false);
lc1.setDigit(3,5,(byte)fuelcenti,false);
lc1.setDigit(3,4,(byte)fuelmilli,false);
}
DcsBios::IntegerBuffer fuelLevelValueBuffer(0x4292, 0xffff, 0, onFuelLevelValueChange);
/////////////////////////////////////////////////////////////////////////////////
void onTachometerValueChange(unsigned int newValueTach) {
int tachunit;
int tachdeci;
boolean negative;
if(newValueTach < -100 || newValueTach > 100)return;
if(newValueTach<0) {negative=true; newValueTach=newValueTach*-1; }
tachunit=newValueTach%10;
tachdeci=newValueTach;
if(negative) {lc1.setChar(3,0,'-',false);}else{lc1.setChar(3,0,' ',false);}
lc1.setDigit(3,3,(byte)tachunit,false);
lc1.setDigit(3,2,(byte)tachdeci,false);
}
DcsBios::IntegerBuffer tachometerValueBuffer(0x42a2, 0xffff, 0, onTachometerValueChange);
/////////////////////////////////////////////////////////////////////////////////
//Loading LED on event
DcsBios::LED lgDown(0x4204, 0x0800, 2);//Green Led for landing gear down
DcsBios::LED lgUp(0x4204, 0x0400, 4);//Red Led for landing gear up
/////////////////////////////////////////////////////////////////////////////////
void setup() {
DcsBios::setup();
// MAX7219 INITIALISATION
//This initializes the MAX7219 and gets it ready for use:
//FIRST - 8 DIGIT 7 SEGMENT DISPLAY - MAX7219 INITIALISATION
lc1.shutdown(0,false); //turn on the display
lc1.setIntensity(0,8);//set the brightness
lc1.clearDisplay(0); //clear the display
lc1.setChar(0,7,'H',false);
lc1.setChar(0,6,'e',false);
lc1.setChar(0,5,'l',false);
lc1.setChar(0,4,'l',false);
lc1.setChar(0,3,'o',false);
lc1.setChar(0,2,'1',true);
delay(550);
lc1.clearDisplay(0); //clear the display
//SECOND - 8 DIGIT 7 SEGMENT DISPLAY - MAX7219 INITIALISATION
lc1.shutdown(1,false); //turn on the display
lc1.setIntensity(1,8);//set the brightness
lc1.clearDisplay(1); //clear the display
lc1.setChar(1,7,'H',false);
lc1.setChar(1,6,'e',false);
lc1.setChar(1,5,'l',false);
lc1.setChar(1,4,'l',false);
lc1.setChar(1,3,'o',false);
lc1.setChar(1,2,'2',true);
delay(550);
lc1.clearDisplay(1); //clear the display
//THIRD - 8 DIGIT 7 SEGMENT DISPLAY - MAX7219 INITIALISATION
lc1.shutdown(2,false); //turn on the display
lc1.setIntensity(2,8);//set the brightness
lc1.clearDisplay(2); //clear the display
lc1.setChar(2,7,'H',false);
lc1.setChar(2,6,'e',false);
lc1.setChar(2,5,'l',false);
lc1.setChar(2,4,'l',false);
lc1.setChar(2,3,'o',false);
lc1.setChar(2,2,'3',true);
delay(550);
lc1.clearDisplay(2); //clear the display
//FOURTH - 8 DIGIT 7 SEGMENT DISPLAY - MAX7219 INITIALISATION
lc1.shutdown(3,false); //turn on the display
lc1.setIntensity(3,8);//set the brightness
lc1.clearDisplay(3); //clear the display
lc1.setChar(3,7,'H',false);
lc1.setChar(3,6,'e',false);
lc1.setChar(3,5,'l',false);
lc1.setChar(3,4,'l',false);
lc1.setChar(3,3,'o',false);
lc1.setChar(3,2,'4',true);
delay(550);
lc1.clearDisplay(3); //clear the display
}
void loop() {
DcsBios::loop();
}
Re: DCS-BIOS: pas d'INPUT vers cockpit DCS [RESOLU]
#6Bonjour,
Après maints essais a tatonner, j'ai finis par trouver la solution a mon problème d'affichage
Désormais, j'arrive a afficher les valeurs Altitudes compas vitesse sur 2 afficheurs Segment7 Max7219
Me reste a faire fonctionner un nouvelle série d'afficheur pour les températures moteur le vario. Mais j'ai l'impression qu'il faut des Pin spécifique sur mon arduino mega 2560 pour le faire marcher
Sinon voici le code arduino que j'utilise. Attention toutes fois pour l'altitude et la vitesse il y a un decallage avec le cadrant Ingame, je pense qu'il y a un multiplicateur a joindre a la valeur
newValuealt et newValuevit pour correspondre exactement (du genre *1.015). je vais me pencher dessus
#define DCSBIOS_IRQ_SERIAL
#include <DcsBios.h>
#include <LedControl.h>
unsigned long delaytime=250;
//pin 51 is connected to the DataIn
//pin 52 is connected to the CLK
//pin 53 is connected to LOAD / CS
//pin 44 is connected to the DataIn
//pin 42 is connected to the CLK
//pin 43 is connected to LOAD / CS
LedControl lc1=LedControl(51,52,53,4); //This creates an instance of a single controller named "lc1" for the first 4 Segment7 display
LedControl lc2=LedControl(44,42,43,4); //This creates an instance of a single controller named "lc2" for the last 4 Segment7 display
// GENERAL REF NOTE BELOW
/*
The sequence of pins used above are in the following order... LedControl(DIN,CLK,LOAD,# OF IC's)
pin X is connected to the DataIn
pin X is connected to the CLK
pin X is connected to LOAD
the last number...(1) is for how many MAX7219 we have daisy chained. (8 STATED, HOWEVER 4 ACTUALLY PRESENT)
*/
/*
void onUhfFrequencyChange(char* newValue) {
lc1.setChar(0,7,newValue[0],false);
lc1.setChar(0,6,newValue[1],false);
lc1.setChar(0,5,newValue[2],true);
lc1.setChar(0,4,newValue[3],false);
lc1.setChar(0,3,newValue[4],false);
lc1.setChar(0,2,newValue[5],false);
lc1.setChar(0,1,newValue[6],false);
}
DcsBios::StringBuffer<7> uhfFrequencyBuffer(0x1180, onUhfFrequencyChange);
*/
void onAltitudeValueChange(unsigned int newValuealt) {
/*unsigned int newValuealt;*/
/*newValuealt = ( newValuealt, DEC);*/
/*
if (newValuealt=0) { lc1.setChar(0,0,0,false);}
if (newValuealt < 0 || newValuealt > 20000) {
*/
int altunit;
int altdeci;
int altcenti;
int altmilli;
int altdecmilli;
altunit=newValuealt%10;
newValuealt=newValuealt/10;
altdeci=newValuealt%10;
newValuealt=newValuealt/10;
altcenti=newValuealt%10;
newValuealt=newValuealt/10;
altmilli=newValuealt%10;
newValuealt=newValuealt/10;
altdecmilli=newValuealt;
lc1.setDigit(0,4,altdecmilli,false);
lc1.setDigit(0,3,altmilli,false);
lc1.setDigit(0,2,altcenti,false);
lc1.setDigit(0,1,altdeci,false);
lc1.setDigit(0,0,altunit,false);
/*
lc1.setDigit(0,7,newValuealt[0],false);
lc1.setDigit(0,6,newValuealt[1],false);
lc1.setDigit(0,5,newValuealt[2],false);
lc1.setDigit(0,4,newValuealt[3],false);
lc1.setDigit(0,3,newValuealt[4],false);
lc1.setDigit(0,2,newValuealt[5],false);
lc1.setDigit(0,4,newValuealt[6],false);*/
}
DcsBios::IntegerBuffer altitudeValueBuffer(0x42a0, 0xffff, 0, onAltitudeValueChange);
/////////////////////////////////////////////////////////////////////////////////
void onCompassHeadingValueChange(unsigned int newValuehdg) {
int hdgunit;
int hdgdeci;
int hdgcenti;
hdgunit=newValuehdg%10;
newValuehdg=newValuehdg/10;
hdgdeci=newValuehdg%10;
newValuehdg=newValuehdg/10;
hdgcenti=newValuehdg;
lc1.setDigit(1,7,hdgcenti,false);
lc1.setDigit(1,6,hdgdeci,false);
lc1.setDigit(1,5,hdgunit,true);
}
DcsBios::IntegerBuffer compassHeadingValueBuffer(0x42a6, 0xffff, 0, onCompassHeadingValueChange);
/////////////////////////////////////////////////////////////////////////////////
void onAirspeedValueChange(unsigned int newValuevit) {
int vitunit;
int vitdeci;
int vitcenti;
int vitmilli;
vitunit=newValuevit%10;
newValuevit=newValuevit/10;
vitdeci=newValuevit%10;
newValuevit=newValuevit/10;
vitcenti=newValuevit%10;
newValuevit=newValuevit/10;
vitmilli=newValuevit;
lc1.setDigit(1,3,vitmilli,false);
lc1.setDigit(1,2,vitcenti,false);
lc1.setDigit(1,1,vitdeci,false);
lc1.setDigit(1,0,vitunit,false);
}
DcsBios::IntegerBuffer airspeedValueBuffer(0x429e, 0xffff, 0, onAirspeedValueChange);
/////////////////////////////////////////////////////////////////////////////////
void onCoolantTemperatureValueChange(unsigned int newValuetemp1) {
int temp1unit;
int temp1deci;
int temp1centi;
boolean negative;
if(newValuetemp1<0) { negative=true; newValuetemp1=newValuetemp1*-1; }
temp1unit=newValuetemp1%10;
newValuetemp=newValuetemp/10;
temp1deci=newValuetemp1%10;
newValuetemp=newValuetemp/10;
temp1centi=newValuetemp1;
if(negative) {lc1.setChar(2,7,'-',false);}else{lc1.setChar(2,7,' ',false); }
lc1.setDigit(2,4,temp1unit,false);
lc1.setDigit(2,5,temp1deci,false);
lc1.setDigit(2,6,temp1centi,false);
}
DcsBios::IntegerBuffer coolantTemperatureValueBuffer(0x429a, 0xffff, 0, onCoolantTemperatureValueChange);
/////////////////////////////////////////////////////////////////////////////////
void onOilTemperatureValueChange(unsigned int newValuetemp2) {
int temp2unit;
int temp2deci;
int temp2centi;
boolean negative;
if(newValuetemp2<0) { negative=true; newValuetemp2=newValuetemp2*-1; }
temp2unit=newValuetemp2%10;
newValuetemp2=newValuetemp2/10;
temp2deci=newValuetemp2%10;
newValuetemp2=newValuetemp2/10;
temp2centi=newValuetemp2;
if(negative) {lc1.setChar(2,3,'-',false);}else{lc1.setChar(2,3,' ',false); }
lc1.setDigit(2,0,temp2unit,false);
lc1.setDigit(2,1,temp2deci,false);
lc1.setDigit(2,2,temp2centi,false);
}
DcsBios::IntegerBuffer oilTemperatureValueBuffer(0x4298, 0xffff, 0, onOilTemperatureValueChange);
/////////////////////////////////////////////////////////////////////////////////
void onFuelLevelValueChange(unsigned int newValueFuel) {
int fuelunit;
int fueldeci;
int fuelcenti;
int fuelmilli;
fuelunit=newValueFuel%1000;
newValueFuel=newValueFuel/10;
fueldeci=newValueFuel%100;
newValueFuel=newValueFuel/10;
fuelcenti=newValueFuel%10;
newValueFuel=newValueFuel/10;
fuelmilli=newValueFuel;
lc1.setDigit(3,4,fuelunit,false);
lc1.setDigit(3,5,fueldeci,false);
lc1.setDigit(3,6,fuelcenti,false);
lc1.setDigit(3,7,fuelmilli,false);
}
DcsBios::IntegerBuffer fuelLevelValueBuffer(0x4292, 0xffff, 0, onFuelLevelValueChange);
/////////////////////////////////////////////////////////////////////////////////
void onTachometerValueChange(unsigned int newValueTach) {
int tachunit;
int tachdeci;
boolean negative;
if(newValueTach < -100 || newValueTach > 100)return;
if(newValueTach<0) {negative=true; newValueTach=newValueTach*-1; }
tachunit=newValueTach%10;
newValueTach=newValueTach/10;
tachdeci=newValueTach;
if(negative) {lc1.setChar(3,3,'-',false);}else{lc1.setChar(3,3,' ',false);}
lc1.setDigit(3,0,(byte)tachunit,false);
lc1.setDigit(3,1,(byte)tachdeci,false);
}
DcsBios::IntegerBuffer tachometerValueBuffer(0x42a2, 0xffff, 0, onTachometerValueChange);
/////////////////////////////////////////////////////////////////////////////////
//Loading LED on event
DcsBios::LED lgDown(0x4204, 0x0800, 2);//Green Led for landing gear down
DcsBios::LED lgUp(0x4204, 0x0400, 4);//Red Led for landing gear up
/////////////////////////////////////////////////////////////////////////////////
void setup() {
DcsBios::setup();
// MAX7219 INITIALISATION
//This initializes the MAX7219 and gets it ready for use:
//FIRST - 8 DIGIT 7 SEGMENT DISPLAY - MAX7219 INITIALISATION
lc1.shutdown(0,false); //turn on the display
lc1.setIntensity(0,8);//set the brightness
lc1.clearDisplay(0); //clear the display
lc1.setChar(0,7,'H',false);
lc1.setChar(0,6,'e',false);
lc1.setChar(0,5,'l',false);
lc1.setChar(0,4,'l',false);
lc1.setChar(0,3,'o',false);
lc1.setChar(0,2,'1',true);
delay(2000);
lc1.clearDisplay(0); //clear the display
//SECOND - 8 DIGIT 7 SEGMENT DISPLAY - MAX7219 INITIALISATION
lc1.shutdown(1,false); //turn on the display
lc1.setIntensity(1,8);//set the brightness
lc1.clearDisplay(1); //clear the display
lc1.setChar(1,7,'H',false);
lc1.setChar(1,6,'e',false);
lc1.setChar(1,5,'l',false);
lc1.setChar(1,4,'l',false);
lc1.setChar(1,3,'o',false);
lc1.setChar(1,2,'2',true);
delay(2000);
lc1.clearDisplay(1); //clear the display
//THIRD - 8 DIGIT 7 SEGMENT DISPLAY - MAX7219 INITIALISATION
lc2.shutdown(2,false); //turn on the display
lc2.setIntensity(2,8);//set the brightness
lc2.clearDisplay(2); //clear the display
lc2.setChar(2,7,'H',false);
lc2.setChar(2,6,'e',false);
lc2.setChar(2,5,'l',false);
lc2.setChar(2,4,'l',false);
lc2.setChar(2,3,'o',false);
lc2.setChar(2,2,'3',true);
delay(2000);
lc2.clearDisplay(2); //clear the display
//FOURTH - 8 DIGIT 7 SEGMENT DISPLAY - MAX7219 INITIALISATION
lc1.shutdown(3,false); //turn on the display
lc1.setIntensity(3,8);//set the brightness
lc1.clearDisplay(3); //clear the display
lc1.setChar(3,7,'H',false);
lc1.setChar(3,6,'e',false);
lc1.setChar(3,5,'l',false);
lc1.setChar(3,4,'l',false);
lc1.setChar(3,3,'o',false);
lc1.setChar(3,2,'4',true);
delay(2000);
lc1.clearDisplay(3); //clear the display
}
void loop() {
DcsBios::loop();
}
Après maints essais a tatonner, j'ai finis par trouver la solution a mon problème d'affichage
Désormais, j'arrive a afficher les valeurs Altitudes compas vitesse sur 2 afficheurs Segment7 Max7219
Me reste a faire fonctionner un nouvelle série d'afficheur pour les températures moteur le vario. Mais j'ai l'impression qu'il faut des Pin spécifique sur mon arduino mega 2560 pour le faire marcher
Sinon voici le code arduino que j'utilise. Attention toutes fois pour l'altitude et la vitesse il y a un decallage avec le cadrant Ingame, je pense qu'il y a un multiplicateur a joindre a la valeur
newValuealt et newValuevit pour correspondre exactement (du genre *1.015). je vais me pencher dessus
#define DCSBIOS_IRQ_SERIAL
#include <DcsBios.h>
#include <LedControl.h>
unsigned long delaytime=250;
//pin 51 is connected to the DataIn
//pin 52 is connected to the CLK
//pin 53 is connected to LOAD / CS
//pin 44 is connected to the DataIn
//pin 42 is connected to the CLK
//pin 43 is connected to LOAD / CS
LedControl lc1=LedControl(51,52,53,4); //This creates an instance of a single controller named "lc1" for the first 4 Segment7 display
LedControl lc2=LedControl(44,42,43,4); //This creates an instance of a single controller named "lc2" for the last 4 Segment7 display
// GENERAL REF NOTE BELOW
/*
The sequence of pins used above are in the following order... LedControl(DIN,CLK,LOAD,# OF IC's)
pin X is connected to the DataIn
pin X is connected to the CLK
pin X is connected to LOAD
the last number...(1) is for how many MAX7219 we have daisy chained. (8 STATED, HOWEVER 4 ACTUALLY PRESENT)
*/
/*
void onUhfFrequencyChange(char* newValue) {
lc1.setChar(0,7,newValue[0],false);
lc1.setChar(0,6,newValue[1],false);
lc1.setChar(0,5,newValue[2],true);
lc1.setChar(0,4,newValue[3],false);
lc1.setChar(0,3,newValue[4],false);
lc1.setChar(0,2,newValue[5],false);
lc1.setChar(0,1,newValue[6],false);
}
DcsBios::StringBuffer<7> uhfFrequencyBuffer(0x1180, onUhfFrequencyChange);
*/
void onAltitudeValueChange(unsigned int newValuealt) {
/*unsigned int newValuealt;*/
/*newValuealt = ( newValuealt, DEC);*/
/*
if (newValuealt=0) { lc1.setChar(0,0,0,false);}
if (newValuealt < 0 || newValuealt > 20000) {
*/
int altunit;
int altdeci;
int altcenti;
int altmilli;
int altdecmilli;
altunit=newValuealt%10;
newValuealt=newValuealt/10;
altdeci=newValuealt%10;
newValuealt=newValuealt/10;
altcenti=newValuealt%10;
newValuealt=newValuealt/10;
altmilli=newValuealt%10;
newValuealt=newValuealt/10;
altdecmilli=newValuealt;
lc1.setDigit(0,4,altdecmilli,false);
lc1.setDigit(0,3,altmilli,false);
lc1.setDigit(0,2,altcenti,false);
lc1.setDigit(0,1,altdeci,false);
lc1.setDigit(0,0,altunit,false);
/*
lc1.setDigit(0,7,newValuealt[0],false);
lc1.setDigit(0,6,newValuealt[1],false);
lc1.setDigit(0,5,newValuealt[2],false);
lc1.setDigit(0,4,newValuealt[3],false);
lc1.setDigit(0,3,newValuealt[4],false);
lc1.setDigit(0,2,newValuealt[5],false);
lc1.setDigit(0,4,newValuealt[6],false);*/
}
DcsBios::IntegerBuffer altitudeValueBuffer(0x42a0, 0xffff, 0, onAltitudeValueChange);
/////////////////////////////////////////////////////////////////////////////////
void onCompassHeadingValueChange(unsigned int newValuehdg) {
int hdgunit;
int hdgdeci;
int hdgcenti;
hdgunit=newValuehdg%10;
newValuehdg=newValuehdg/10;
hdgdeci=newValuehdg%10;
newValuehdg=newValuehdg/10;
hdgcenti=newValuehdg;
lc1.setDigit(1,7,hdgcenti,false);
lc1.setDigit(1,6,hdgdeci,false);
lc1.setDigit(1,5,hdgunit,true);
}
DcsBios::IntegerBuffer compassHeadingValueBuffer(0x42a6, 0xffff, 0, onCompassHeadingValueChange);
/////////////////////////////////////////////////////////////////////////////////
void onAirspeedValueChange(unsigned int newValuevit) {
int vitunit;
int vitdeci;
int vitcenti;
int vitmilli;
vitunit=newValuevit%10;
newValuevit=newValuevit/10;
vitdeci=newValuevit%10;
newValuevit=newValuevit/10;
vitcenti=newValuevit%10;
newValuevit=newValuevit/10;
vitmilli=newValuevit;
lc1.setDigit(1,3,vitmilli,false);
lc1.setDigit(1,2,vitcenti,false);
lc1.setDigit(1,1,vitdeci,false);
lc1.setDigit(1,0,vitunit,false);
}
DcsBios::IntegerBuffer airspeedValueBuffer(0x429e, 0xffff, 0, onAirspeedValueChange);
/////////////////////////////////////////////////////////////////////////////////
void onCoolantTemperatureValueChange(unsigned int newValuetemp1) {
int temp1unit;
int temp1deci;
int temp1centi;
boolean negative;
if(newValuetemp1<0) { negative=true; newValuetemp1=newValuetemp1*-1; }
temp1unit=newValuetemp1%10;
newValuetemp=newValuetemp/10;
temp1deci=newValuetemp1%10;
newValuetemp=newValuetemp/10;
temp1centi=newValuetemp1;
if(negative) {lc1.setChar(2,7,'-',false);}else{lc1.setChar(2,7,' ',false); }
lc1.setDigit(2,4,temp1unit,false);
lc1.setDigit(2,5,temp1deci,false);
lc1.setDigit(2,6,temp1centi,false);
}
DcsBios::IntegerBuffer coolantTemperatureValueBuffer(0x429a, 0xffff, 0, onCoolantTemperatureValueChange);
/////////////////////////////////////////////////////////////////////////////////
void onOilTemperatureValueChange(unsigned int newValuetemp2) {
int temp2unit;
int temp2deci;
int temp2centi;
boolean negative;
if(newValuetemp2<0) { negative=true; newValuetemp2=newValuetemp2*-1; }
temp2unit=newValuetemp2%10;
newValuetemp2=newValuetemp2/10;
temp2deci=newValuetemp2%10;
newValuetemp2=newValuetemp2/10;
temp2centi=newValuetemp2;
if(negative) {lc1.setChar(2,3,'-',false);}else{lc1.setChar(2,3,' ',false); }
lc1.setDigit(2,0,temp2unit,false);
lc1.setDigit(2,1,temp2deci,false);
lc1.setDigit(2,2,temp2centi,false);
}
DcsBios::IntegerBuffer oilTemperatureValueBuffer(0x4298, 0xffff, 0, onOilTemperatureValueChange);
/////////////////////////////////////////////////////////////////////////////////
void onFuelLevelValueChange(unsigned int newValueFuel) {
int fuelunit;
int fueldeci;
int fuelcenti;
int fuelmilli;
fuelunit=newValueFuel%1000;
newValueFuel=newValueFuel/10;
fueldeci=newValueFuel%100;
newValueFuel=newValueFuel/10;
fuelcenti=newValueFuel%10;
newValueFuel=newValueFuel/10;
fuelmilli=newValueFuel;
lc1.setDigit(3,4,fuelunit,false);
lc1.setDigit(3,5,fueldeci,false);
lc1.setDigit(3,6,fuelcenti,false);
lc1.setDigit(3,7,fuelmilli,false);
}
DcsBios::IntegerBuffer fuelLevelValueBuffer(0x4292, 0xffff, 0, onFuelLevelValueChange);
/////////////////////////////////////////////////////////////////////////////////
void onTachometerValueChange(unsigned int newValueTach) {
int tachunit;
int tachdeci;
boolean negative;
if(newValueTach < -100 || newValueTach > 100)return;
if(newValueTach<0) {negative=true; newValueTach=newValueTach*-1; }
tachunit=newValueTach%10;
newValueTach=newValueTach/10;
tachdeci=newValueTach;
if(negative) {lc1.setChar(3,3,'-',false);}else{lc1.setChar(3,3,' ',false);}
lc1.setDigit(3,0,(byte)tachunit,false);
lc1.setDigit(3,1,(byte)tachdeci,false);
}
DcsBios::IntegerBuffer tachometerValueBuffer(0x42a2, 0xffff, 0, onTachometerValueChange);
/////////////////////////////////////////////////////////////////////////////////
//Loading LED on event
DcsBios::LED lgDown(0x4204, 0x0800, 2);//Green Led for landing gear down
DcsBios::LED lgUp(0x4204, 0x0400, 4);//Red Led for landing gear up
/////////////////////////////////////////////////////////////////////////////////
void setup() {
DcsBios::setup();
// MAX7219 INITIALISATION
//This initializes the MAX7219 and gets it ready for use:
//FIRST - 8 DIGIT 7 SEGMENT DISPLAY - MAX7219 INITIALISATION
lc1.shutdown(0,false); //turn on the display
lc1.setIntensity(0,8);//set the brightness
lc1.clearDisplay(0); //clear the display
lc1.setChar(0,7,'H',false);
lc1.setChar(0,6,'e',false);
lc1.setChar(0,5,'l',false);
lc1.setChar(0,4,'l',false);
lc1.setChar(0,3,'o',false);
lc1.setChar(0,2,'1',true);
delay(2000);
lc1.clearDisplay(0); //clear the display
//SECOND - 8 DIGIT 7 SEGMENT DISPLAY - MAX7219 INITIALISATION
lc1.shutdown(1,false); //turn on the display
lc1.setIntensity(1,8);//set the brightness
lc1.clearDisplay(1); //clear the display
lc1.setChar(1,7,'H',false);
lc1.setChar(1,6,'e',false);
lc1.setChar(1,5,'l',false);
lc1.setChar(1,4,'l',false);
lc1.setChar(1,3,'o',false);
lc1.setChar(1,2,'2',true);
delay(2000);
lc1.clearDisplay(1); //clear the display
//THIRD - 8 DIGIT 7 SEGMENT DISPLAY - MAX7219 INITIALISATION
lc2.shutdown(2,false); //turn on the display
lc2.setIntensity(2,8);//set the brightness
lc2.clearDisplay(2); //clear the display
lc2.setChar(2,7,'H',false);
lc2.setChar(2,6,'e',false);
lc2.setChar(2,5,'l',false);
lc2.setChar(2,4,'l',false);
lc2.setChar(2,3,'o',false);
lc2.setChar(2,2,'3',true);
delay(2000);
lc2.clearDisplay(2); //clear the display
//FOURTH - 8 DIGIT 7 SEGMENT DISPLAY - MAX7219 INITIALISATION
lc1.shutdown(3,false); //turn on the display
lc1.setIntensity(3,8);//set the brightness
lc1.clearDisplay(3); //clear the display
lc1.setChar(3,7,'H',false);
lc1.setChar(3,6,'e',false);
lc1.setChar(3,5,'l',false);
lc1.setChar(3,4,'l',false);
lc1.setChar(3,3,'o',false);
lc1.setChar(3,2,'4',true);
delay(2000);
lc1.clearDisplay(3); //clear the display
}
void loop() {
DcsBios::loop();
}
Re: DCS-BIOS: pas d'INPUT vers cockpit DCS [RESOLU]
#7Apres verifification, il faut multiplier les valeurs newValuealt*1.30067 et newValuevit*1.3306451 pour obtenir des valeursquasi identique aux quadrants de mon Bf109F4
A voir si c'est valabe pour les autres avions ou si ce multiplicateur est a modifier
A voir si c'est valabe pour les autres avions ou si ce multiplicateur est a modifier
-
Topic author - Nouvelle Recrue
- Messages : 181
- Inscription : 07 juin 2004
Re: DCS-BIOS: pas d'INPUT vers cockpit DCS [RESOLU]
#8Ecoute, à priori tu en sais plus que moi!!
Méf aux coefficients que tu appliques car tu vas peut-être transformer de façon erronée de l'IAS en TAS ou vice versa...
Si c'est just une conversion d'unité alors ça devrait gazer!
Mais encore une fois je pense que tu maitrise plus que moi :D
Méf aux coefficients que tu appliques car tu vas peut-être transformer de façon erronée de l'IAS en TAS ou vice versa...
Si c'est just une conversion d'unité alors ça devrait gazer!
Mais encore une fois je pense que tu maitrise plus que moi :D