Jump to content

DCS-BIOS CDU TFT Issue


Arjan

Recommended Posts

Gave it a go, but something is still preventing the compiling. Strange, it doesn't indicate missing libraries or anything

 

The etror changed after deleting the extra library reference to the following

 

Archiving built core (caching) in: C:\Users\Thomas\AppData\Local\Temp\arduino_cache_82859\core\core_arduino_avr_uno_0c812875ac70eb4a9b385d8fb077f54c.a

Linking everything together...

"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-gcc" -w -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections -mmcu=atmega328p -o "C:\\Users\\Thomas\\AppData\\Local\\Temp\\arduino_build_616991/CDU_USB_sketch_5_inch.ino.elf" "C:\\Users\\Thomas\\AppData\\Local\\Temp\\arduino_build_616991\\sketch\\CDU_USB_sketch_5_inch.ino.cpp.o" "C:\\Users\\Thomas\\AppData\\Local\\Temp\\arduino_build_616991\\libraries\\SPI\\SPI.cpp.o" "C:\\Users\\Thomas\\AppData\\Local\\Temp\\arduino_build_616991\\libraries\\Adafruit_RA8875\\Adafruit_RA8875.cpp.o" "C:\\Users\\Thomas\\AppData\\Local\\Temp\\arduino_build_616991\\libraries\\Adafruit_GFX_Library\\Adafruit_GFX.cpp.o" "C:\\Users\\Thomas\\AppData\\Local\\Temp\\arduino_build_616991\\libraries\\Adafruit_GFX_Library\\Adafruit_SPITFT.cpp.o" "C:\\Users\\Thomas\\AppData\\Local\\Temp\\arduino_build_616991\\libraries\\Adafruit_GFX_Library\\glcdfont.c.o" "C:\\Users\\Thomas\\AppData\\Local\\Temp\\arduino_build_616991\\libraries\\dcs-bios-arduino-library-master\\internal\\Protocol.cpp.o" "C:\\Users\\Thomas\\AppData\\Local\\Temp\\arduino_build_616991/core\\core.a" "-LC:\\Users\\Thomas\\AppData\\Local\\Temp\\arduino_build_616991" -lm

HardwareSerial0.cpp.o (symbol from plugin): In function `Serial':

 

(.text+0x0): multiple definition of `__vector_18'

 

C:\Users\Thomas\AppData\Local\Temp\arduino_build_616991\sketch\CDU_USB_sketch_5_inch.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here

 

collect2.exe: error: ld returned 1 exit status

 

Using library SPI at version 1.0 in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI

Using library Adafruit_RA8875 at version 1.3.4 in folder: C:\Users\Thomas\Documents\Arduino\libraries\Adafruit_RA8875

Using library Adafruit_GFX_Library at version 1.5.6 in folder: C:\Users\Thomas\Documents\Arduino\libraries\Adafruit_GFX_Library

Using library dcs-bios-arduino-library-master at version 0.2.10 in folder: C:\Users\Thomas\Documents\Arduino\libraries\dcs-bios-arduino-library-master

Using library EEPROM at version 2.0 in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\EEPROM

exit status 1

Error compiling for board Arduino/Genuino Uno.

 

I'm not sure what the multiple references does, I wonder whether I have conflicting libraries in my PC?

 

***EDIT***

 

Can you do the sketch without the DCS BIOS references to see if the error is in the DCS part?

 

Les

 

I'm getting the same errors when trying to use dcsbios.h and FTOLED.h (a library for a 1.5 inch OLED screen I have) It seems to be something to do with Serial being defined twice, but I'm not sure how to resolve it. Just posting here to get in the loop, see if we can figure this out.

Link to comment
Share on other sites

Vinc, I played around with your modified one a bit and have achieved partial success. When I //'d the Adafruit_RA8875 library and reinstated the standard RA8875 library, it gave xxx is not a member error, so I looked up the library details and changed a few of them to ones that were acceptable.

 

As a resullt it compiled ok aftet a few changes, and now the green rectangle with the text in is now visible, albeit not full screen. Once DCS-BIOS is connected, you can see parts of the rectangle disappearing as DCS-BIOS is obviously trying to write to the screen

 

I'm going to have another go tonight after I print out some library reference information and see if I can get more progress.

 

Thanks for all your assistance up to now, without which I would be nowhere!

 

Cheers

 

Les

Link to comment
Share on other sites

I've been playing around and replacing a number of parts of this with items I found i the RA8875.h list of members (or at least I think that's what it is!)

 

As a result 'fillscreen' becomes 'clearscreen', 'setTextSize' becomes 'setFontScale'. I also //'d out the 'setrotation' part. I also messed around with colours and font size to test. As result of that, I now have the following sketch which shows a full screen green rectangle with large magenta text for second, then reverts to a blank screen.

 

/*
 Tell DCS-BIOS to use a serial connection and use the default Arduino Serial
 library. This will work on the vast majority of Arduino-compatible boards,
 but you can get corrupted data if you have too many or too slow outputs
 (e.g. when you have multiple character displays), because the receive
 buffer can fill up if the sketch spends too much time updating them.
 
 If you can, use the IRQ Serial connection instead.
*/
#define DCSBIOS_IRQ_SERIAL

#include <SPI.h>
#include <RA8875.h>
//#include "Adafruit_RA8875.h"
#include "DcsBios.h"
#include <Adafruit_GFX.h>

//Arduino DUE,Arduino mega2560,Arduino UNO
#define RA8875_INT 4
#define RA8875_CS 10 
#define RA8875_RST 9

// RA8875 tft = RA8875(RA8875_CS,RA8875_RST);
RA8875 tft = RA8875(RA8875_CS, RA8875_RST);

void printChar(int row, int col, unsigned char c) {
 int16_t x = 13 + col * 19;
 int16_t y = row * 32 + 6;
 //tft.drawChar(x, y, c, RA8875_GREEN, RA8875_BLACK, 3);
}

/* paste code snippets from the reference documentation here */
void onCduLine0Change(char* newValue) {
 for(int i = 0; i < 24; i++){
   printChar(0, i, newValue[i]);
 }
}
DcsBios::StringBuffer<24> cduLine0Buffer(0x11c0, onCduLine0Change);

void onCduLine1Change(char* newValue) {
 for(int i = 0; i < 24; i++){
   printChar(1, i, newValue[i]);
 }
}
DcsBios::StringBuffer<24> cduLine1Buffer(0x11d8, onCduLine1Change);

void onCduLine2Change(char* newValue) {
 for(int i = 0; i < 24; i++){
   printChar(2, i, newValue[i]);
 }
}
DcsBios::StringBuffer<24> cduLine2Buffer(0x11f0, onCduLine2Change);

void onCduLine3Change(char* newValue) {
 for(int i = 0; i < 24; i++){
   printChar(3, i, newValue[i]);
 }
}
DcsBios::StringBuffer<24> cduLine3Buffer(0x1208, onCduLine3Change);

void onCduLine4Change(char* newValue) {
 for(int i = 0; i < 24; i++){
   printChar(4, i, newValue[i]);
 }
}
DcsBios::StringBuffer<24> cduLine4Buffer(0x1220, onCduLine4Change);

void onCduLine5Change(char* newValue) {
 for(int i = 0; i < 24; i++){
   printChar(5, i, newValue[i]);
 }
}
DcsBios::StringBuffer<24> cduLine5Buffer(0x1238, onCduLine5Change);

void onCduLine6Change(char* newValue) {
 for(int i = 0; i < 24; i++){
   printChar(6, i, newValue[i]);
 }
}
DcsBios::StringBuffer<24> cduLine6Buffer(0x1250, onCduLine6Change);

void onCduLine7Change(char* newValue) {
 for(int i = 0; i < 24; i++){
   printChar(7, i, newValue[i]);
 }
}
DcsBios::StringBuffer<24> cduLine7Buffer(0x1268, onCduLine7Change);

void onCduLine8Change(char* newValue) {
 for(int i = 0; i < 24; i++){
   printChar(8, i, newValue[i]);
 }
}
DcsBios::StringBuffer<24> cduLine8Buffer(0x1280, onCduLine8Change);

void onCduLine9Change(char* newValue) {
 for(int i = 0; i < 24; i++){
   printChar(9, i, newValue[i]);
 }
}
DcsBios::StringBuffer<24> cduLine9Buffer(0x1298, onCduLine9Change);

void setup() 
{
 DcsBios::setup();
//Serial.begin(9600);
 //while (!Serial) {;}

 SPI.begin();
 tft.begin(RA8875_800x480);

// set landscape mode
// tft.setRotation(1);
 
// --------------- section can be deleted if it works
// print welcome screen
 tft.clearScreen(RA8875_BLACK); // fast "clear screen"
 tft.drawRoundRect(0, 0, 799, 479, 10, RA8875_GREEN);
 delay(300);
 tft.setTextColor(RA8875_MAGENTA);
 tft.setFontSize(6); 
 tft.setCursor(100, 260);
 tft.print("DCS World: A-10C");
 tft.setCursor(100, 285);
 tft.print("CDU Display Test");
 delay(1500);
 tft.clearScreen(RA8875_BLACK);  
// ---------------------------------------------------
}

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

 

note that I have tried it with the line 'tft.drawChar(x, y, c, RA8875_GREEN, RA8875_BLACK, 3);' //'d out which goes through the startup and does nothing more.

 

I have also tried it with it changed to tft.drawPolygon(x, y, c, RA8875_GREEN, RA8875_BLACK, 3); and when I do that, after the start screen, I see a load of blue lines being drawn art random angles all over the screen, but only with DCS-Bios connected in game.

 

So, that line looks like the key to it, except that nowhere can I find reference to a code that lets it print the characters stipulated later in the line> I've searched for it for RA8875 on the web, but the only two I can find I have and the Adafruit one seems incompatible with this. What command should replace 'drawChar'?

 

Cheers

 

Les

Link to comment
Share on other sites

Hi Les,

 

What command should replace 'drawChar'

 

it's not that easy because all the following code is based on calculations and the result is than printed by the drawChar statement to the display.

 

I therefore replaced the code from void drawChar to the last DcsBios:StringBuffer statement to print all 10 CDU lines, line by line.

That makes everithing a little bit slower but in the end the content from CDU is displayed on the screen.

 

Furthermore I replaced your "clearScreen" commands by "fillScreen" as it won't compile on my PC and gave the text a green color with black background.

 

Except this I let the rest as it was and attache the file to this post.

Hope that it will compile on your PC.

Maybe the row distances have to be adjustet or the text size has to be reduced according your screen resolution.

 

 

EDIT: I forgot the text background color in the file, so try to replace the last statement with this: tft.setTextColor(RA8875_GREEN, RA8875_BLACK); and see if it works

 

 

// --------------------- replacement for the "drawChar" things --------------

// CDU line 1
void onCduLine0Change(char* newValue) {
     tft.setCursor(12,4);
     tft.print(newValue);
}
DcsBios::StringBuffer<24> cduLine0Buffer(0x11c0, onCduLine0Change);

// CDU line 2
void onCduLine1Change(char* newValue) {
     tft.setCursor(12,62);
     tft.print(newValue);
}
DcsBios::StringBuffer<24> cduLine1Buffer(0x11d8, onCduLine1Change);

// CDU line 3
void onCduLine2Change(char* newValue) {
     tft.setCursor(12,110);
     tft.print(newValue);
}
DcsBios::StringBuffer<24> cduLine2Buffer(0x11f0, onCduLine2Change);

// CDU line 4
void onCduLine3Change(char* newValue) {
     tft.setCursor(12,158);
     tft.print(newValue);
}
DcsBios::StringBuffer<24> cduLine3Buffer(0x1208, onCduLine3Change);

// CDU line 5
void onCduLine4Change(char* newValue) {
     tft.setCursor(12,206);
     tft.print(newValue);
}
DcsBios::StringBuffer<24> cduLine4Buffer(0x1220, onCduLine4Change);

// CDU line 6
void onCduLine5Change(char* newValue) {
     tft.setCursor(12,254);
     tft.print(newValue);
}
DcsBios::StringBuffer<24> cduLine5Buffer(0x1238, onCduLine5Change);

// CDU line 7
void onCduLine6Change(char* newValue) {
     tft.setCursor(12,302);
     tft.print(newValue);
}
DcsBios::StringBuffer<24> cduLine6Buffer(0x1250, onCduLine6Change);

// CDU line 8
void onCduLine7Change(char* newValue) {
     tft.setCursor(12,350);
     tft.print(newValue);
}
DcsBios::StringBuffer<24> cduLine7Buffer(0x1268, onCduLine7Change);

// CDU line 9
void onCduLine8Change(char* newValue) {
     tft.setCursor(12,398);
     tft.print(newValue);
}
DcsBios::StringBuffer<24> cduLine8Buffer(0x1280, onCduLine8Change);

// CDU line 10
void onCduLine9Change(char* newValue) {
     tft.setCursor(12,446);
     tft.print(newValue);
}
DcsBios::StringBuffer<24> cduLine9Buffer(0x1298, onCduLine9Change);

// --------------------- end of replacement -------------------------

CDU_DISPLAY_LES_Test03c.rar


Edited by Vinc_Vega

Regards, Vinc

real life: Royal Bavarian Airforce

online: VJS-GermanKnights.de

[sIGPIC][/sIGPIC]

Link to comment
Share on other sites

Vinc, you are a complete star! As you can see, it is being displayed, and just needs to be tinkered with to get the fonts right. For info I used the file in the RAR as is, without the modifier suggested.

 

Today I will play with the sketch to get it all looking nice, and after I will repost it with any corrections.

 

Thanks a million for all your help, I owe you a crate of beer!

 

Cheers

 

Les

20200111_074215.thumb.jpg.8822c5986f0e73860520d2dbd3485b7d.jpg


Edited by lesthegrngo
Link to comment
Share on other sites

Success!

 

Or at least 99% success! I played with the text scale (strangely 'setTextSize' did nothing but 'setTextScale' did), the text spacing and the line positions and got this (first picture). I assume that only integer values are allowed for these. I am very happy with it, and can live with the two minor niggles, which are

 

1 ) the '[ ]' character is being displayed as an 'i' at the beginning of the text strings in lines 5, 7 and 9. I assume that this is due to the characters assigned in the text library

2 ) when you type in characters, they appear corrupted on line 10 until you recycle power to the arduino. As they appear fine in the right MFDC it's a niggle but that's all

 

So after a lot of work by a lot of people especially Vinc, I have a great looking and virtually fully functional CDU complete with 5" screen. I owe it to everyone to detail this completely with all the libraries, parts and sketches so that they can replicate this if they want, so will put that all together and post it. Question is, should it be a separate thread, or post it here?

 

***EDIT*** oh, a 3rd microscopic niggle, again probably due to the text lookup library - the cursor symbol that appears in line 10 on the MFDC is a blinking box whereas the one on the TFT is the tab symbol. I think I can live with that too!

 

***EDIT PART 2***

 

I went back through this thread as it seemed to be that the OP was having issues with the displayed information, and reread the part about the default text library. I have tried to replace the glcdfont.c file in the Adafruit_GFX library with defaulttext file posted on page 1 (renamed as glcdfont.c, original file appended .bak). That seems to have no effect on the text, so I assume that the font is being pulled from a different library

 

I also note that the CDU does not refresh if you exit the flight and restart another, so maybe a line forcing a refresh would be good

 

Cheers

 

Les

20200111_084042.thumb.jpg.0db057249b96a4ce4fa76b860a77241a.jpg

20200111_084048.thumb.jpg.b31fca6d692d3c264d3cf2f0a6c6e711.jpg


Edited by lesthegrngo
Link to comment
Share on other sites

Thanks a million for all your help, I owe you a crate of beer!

 

When I'm for the next time in Budapest, I'll give you a call :-)

 

Success!

 

Congratulations and sorry for the late answer, the weekend has been reserved for family stuff ...

 

***EDIT*** oh, a 3rd microscopic niggle, again probably due to the text lookup library - the cursor symbol that appears in line 10 on the MFDC is a blinking box whereas the one on the TFT is the tab symbol. I think I can live with that too!

 

I think that's to the missing symbols in your font library.

 

***EDIT PART 2***

 

I went back through this thread as it seemed to be that the OP was having issues with the displayed information, and reread the part about the default text library. I have tried to replace the glcdfont.c file in the Adafruit_GFX library with defaulttext file posted on page 1 (renamed as glcdfont.c, original file appended .bak). That seems to have no effect on the text, so I assume that the font is being pulled from a different library

 

I'm not shure if that workaround is the same with your RA8875 driver, but you can try it:

I replaced the original gfxfont.c file with the edited glcdfont.c but added the header from gfxfont.c to it. Simply put the attached files into your Documents\Arduino\libraries\Adafruit_GFX_Library directory (original file to be backed up before that).

 

I also note that the CDU does not refresh if you exit the flight and restart another, so maybe a line forcing a refresh would be good

 

Cheers

 

Les

 

I can not confirme this. Give DCS Bios a little time after loading a new mission to refresh the display (< 10 seconds).

To force a refresh switch to an other CDU Page (OTHER, POSITION, STEER, WAYPT) or use the Page Rocker (P / G) to switch to page 2.

CDU-Fonts.rar


Edited by Vinc_Vega

Regards, Vinc

real life: Royal Bavarian Airforce

online: VJS-GermanKnights.de

[sIGPIC][/sIGPIC]

Link to comment
Share on other sites

  • 4 months later...

An update for you on this, together with a warning - it seems the 5 inch TFT from Buydisplay that I used cannot use different fonts, the font that it comes with is the only one it can use and none can be loaded to it to replace it.

 

As a result, if you are contemplating doing a CDU, don't get one of these displays unless you are happy with the (admittedly minor) text corruption issues

 

Cheers

 

Les

Link to comment
Share on other sites

  • 1 year later...

Wow... its been a long time away from DCS and these forums. But, Im sort of back. not a lot of room to work on projects, but it is what it is. I have tried to follow instructions using DCS bios posted in a video by DutchWarthog:

Its basically the same steps that Arjan the OP posted. I tried all the steps but come up with a white screen. I cannot for the life of me figure it out. I am using an arduino uno and I did change the constructor to be UTFT myGLCD(ILI9486,A2,A1,A3,A4,A0); and even tried it without declaring A0. I replaced the font file as Arjan originally described. Is there something esle in the code that I am over looking that would have to be modified to work with the UNO?

DCS: A10C Warthog JTAC coordinate entry training mission http://www.digitalcombatsimulator.com/en/files/99424/

 

DCS: Blackshark 2 interactive training missions http://forums.eagle.ru/showthread.php?t=84612

Link to comment
Share on other sites

  • Recently Browsing   0 members

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