Jump to content

Cheap solution for CDU Display


robinmli

Recommended Posts

Thanks for the latest release of DCS-BIOS, I was able to get CDU display works with Arduino UNO and a cheap TFT LCD. This is just a proof of concept, no intense test, but the result looks promising. Thought I should document the approach I used.

The hardware used is a Arduino UNO R3, and a 3.95 inch TFT LCD screen. Both are from aliexpress and cost about $10 in total.

DCS-BIOS v0.5.0 and arduino library v0.2.0 are required.

The Arduino display library used is MCUFRIEND_kbv and Adafruit_GFX, detail is here

 

I modified the default font in Adafruit_GFX to get the CDU special characters properly displayed.

 

One small thing: The screen refresh rate feels a bit slow, especially when switch cdu pages. Not sure if that's limited by the hardware or something can be done from the Adafruit display library.

 

I uploaded by sketch file and modifed font to github

20160320_220147_resized.thumb.jpg.2f2082b93db1b734a69bb6f382cbf6e9.jpg


Edited by robinmli
Link to comment
Share on other sites

But i can't find a cheap and compatible lcd screen for arduino due. They are all expensive... :cry:

PC: i7-13700K - MSI RTX 4080 Gaming X Trio - 32GB DDR5 6200 - VPC MongoosT-50CM3 - VKB GF pro - MFG Crosswind - Msi MPG321UR-QD + Acer XB271HU - TrackIR5 - Rift S

Link to comment
Share on other sites

But i can't find a cheap and compatible lcd screen for arduino due. They are all expensive... :cry:

 

 

http://ru.aliexpress.com/item/3-5-inch-TFT-Touch-LCD-Screen-Display-Module-For-Arduino-UNO-R3-HIGH-QUALITY-Free/1854595985.html - excellent work with arduino due

My cockpit A-10C

Строю кокпит A-10C

i7 7700k, 32Gb RAM, SSD NVMe, GTX 1080, Hotas Warthog, HTC Vive.

-----------------

With love from Russia

Link to comment
Share on other sites

 

Are you sure? It says for Arduino UNO and Arduino 2560...

PC: i7-13700K - MSI RTX 4080 Gaming X Trio - 32GB DDR5 6200 - VPC MongoosT-50CM3 - VKB GF pro - MFG Crosswind - Msi MPG321UR-QD + Acer XB271HU - TrackIR5 - Rift S

Link to comment
Share on other sites

  • 4 months later...

This looks like a really big step forward :)

I bookmarked this Thread in case I rebuild my own CDU. (Was my very first project for DCS and I used each option to fail. Learned alot hereby)

 

Thank you for thinking, making and (not least) sharing :)

You are some of my heroes!


Edited by Tekkx

Manual for my version of RS485-Hardware, contact: tekkx@dresi.de

Please do not PM me with DCS-BIOS-related questions. If the answer might also be useful to someone else, it belongs in a public thread where it can be discovered by everyone using the search function. Thank You.

Link to comment
Share on other sites

  • 1 month later...

Thanks to this, I was able to get a cdu working on the first try. Well, minus the upside down lcd :)

20160915_201241_zpsppuu1c01.jpg~original[/url]

 

But even with the Arduino Due it's not the fastest refresh rate. It can even get stuck at half screen, then refresh teh other half in 2-3 seconds.

 

Apparently it is the "clear" command used when switching CDU pages? As explained in here:

 

http://forum.arduino.cc/index.php?topic=196682.0

 

the "clear" function re-draws every pixel separately, all 320x480 of them. I have zero lcd programming knowledge but I would guess that's what happens when you switch pages on the cdu? The current sketch uses the clear command?

 

If I'm right then the lcd would have no problems even on Arduino Uno, if the sketch used a different command to re-draw the screen when changing CDU pages. Can someone take a look at it?

 

Instead of the "clear" command when changing CDU pages, maybe use a "draw 320x480 black rectangle" command?

Save



Save


Edited by hegykc
Link to comment
Share on other sites

If I'm right then the lcd would have no problems even on Arduino Uno, if the sketch used a different command to re-draw the screen when changing CDU pages. Can someone take a look at it?

 

Instead of the "clear" command when changing CDU pages, maybe use a "draw 320x480 black rectangle" command?

 

Yes this can work. I have run into a similar problem at times in gauge programming for FSX where the GDI+ Clear call is very slow. Drawing a black rectangle is a more acceptable method. That said, I have some low level programming knowledge of manipulating pixels if you like. I sent you an email.

Link to comment
Share on other sites

@all not got an email ;):

 

I'm at a very early stage becoming familiar with TFTs.

I would risc a close look at the MCUFRIEND_kbv.h

 

There is at line 28 (inside class MCUFRIEND_kbv)

virtual void fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color);

(and there is also a command to flip the whole screen):)

 

I assume coordinates depend on screen's size (resolution), color should be something between 0 and 65k...

 

How to call this in the *.ino I'll find out if my screen arrives from china :)

Maybe it is documented somewhere.

 

PS: I understand this Forum as a platform where we discuss problems or affords and Share this with each other.


Edited by Tekkx

Manual for my version of RS485-Hardware, contact: tekkx@dresi.de

Please do not PM me with DCS-BIOS-related questions. If the answer might also be useful to someone else, it belongs in a public thread where it can be discovered by everyone using the search function. Thank You.

Link to comment
Share on other sites

Hello, Friends.

A few days ago my 3.5" TFT arrived from buydisplay.com. Hoooray!

 

After the first - very wiggely - steps of a bloody novice like me to bring this thing into life (one issue is ATM I can just upload a sketch if I unplug the shield from the MEGA - very annoying and also dangerous to the TFT) that thing runs now as it should. I am very happy. :)

 

While the next step to convert it to a CDU I encountered the first DCS-related problem: The font (by the courtesy of robinmli - thank You very much for your work) is too small.

The pocket calculator says, a font 20x32 dots (padding included) is ideal at a screen of 480*320 pixels like mine.

 

After the lecture of this tutorial came out that my life is too short (I'm already 50+) to remake the right fitting font by myself.

 

So came three questions to the surface:

- Is there anybody outthere who is willing to provide a fit-sized UTFT-font to us (me)?

- Is there a (short) way for change padding (or size) of an existing font?

- Is there intelligent life on other planets?

 

Any help (even just a directing tap) is very appreciated.


Edited by Tekkx
size of desired font was wrong :(

Manual for my version of RS485-Hardware, contact: tekkx@dresi.de

Please do not PM me with DCS-BIOS-related questions. If the answer might also be useful to someone else, it belongs in a public thread where it can be discovered by everyone using the search function. Thank You.

Link to comment
Share on other sites

Alright, thanks for taking a look at it.

 

So, a font should be created like in the tutorial you provided. So a symbol would be 20 pixels wide and 32 pixels high? So, single string of 32 hexadecimal numbers, for each symbol, made by the instructions from your link?

 

I do a lot of graphical design, I can put that into my graphic program and make those hexadecimal strings no problem.

What are all the symbols the CDU has? Ok that may be a stupid question. Anything other than what's on the keyboard?

 

P.S. Free CDU's for anyone making a contribution, including the original poster of course.


Edited by hegykc
Link to comment
Share on other sites

Windows has a (or had) a font specifically designed for smaller font sizes. I believe for the telnet applications but I have seen it in the font lists before. It may still be widely available elsewhere as well. Wouldn't it be best to just find the font and then extract the closest fit using a font designing program? This would eliminate any additional design time as well.

 

Sent from my LG-D850 using Tapatalk

Link to comment
Share on other sites

What are all the symbols the CDU has? Ok that may be a stupid question. Anything other than what's on the keyboard?

 

.

 

Yea there are quite few chars other then kbd.

Ian listed the location of TGA font file in this post : https://forums.eagle.ru/showpost.php?p=2312247&postcount=9

Contains every single char that CDU can display including the arows, degrees and other special stuff.

Anton.

 

My pit build thread .

Simple and cheap UFC project

Link to comment
Share on other sites

So before I commit, is this what I need to do for each character?

 

CDU%20text_zpshqyjg1vw.jpg~original

 

The image under the pixel matrix is a screenshot straight from in-game CDU. It's a 20x32 pixel matrix, the thickness of the letter is 4 pixels, and the empty space under is also 4 pixel. This looks and matches quite ok. And lastly I supply you with a single string of 64 hex numbers in a text file, for each charachter?

 

Confirm and I will do this for the rest of them...

Save

Link to comment
Share on other sites

Alright, thanks for taking a look at it.

 

So, a font should be created like in the tutorial you provided. So a symbol would be 20 pixels wide and 32 pixels high? So, single string of 32 hexadecimal numbers, for each symbol, made by the instructions from your link?

 

I do a lot of graphical design, I can put that into my graphic program and make those hexadecimal strings no problem.

What are all the symbols the CDU has? Ok that may be a stupid question. Anything other than what's on the keyboard?

 

P.S. Free CDU's for anyone making a contribution, including the original poster of course.

Yes technically that would all make sense. Your math seems to be correct now only the code will show. Best just give it a try with a prototype and see if your assumption is correct.

 

Sent from my SM-G900W8 using Tapatalk

Know and use all the capabilities in your airplane. If you don't, sooner or later, some guy who does use them all will kick your ass.

 

— Dave 'Preacher' Pace, USN.

Link to comment
Share on other sites

On the other hand, looking back at the tft with just the modified font, it looks fine to me? And I'm pretty certain mine is a 480x320:

 

screen_zpsu6mkhd1r.jpg~original

 

Characters seem to be 20x32 to me. It's 1 thickness spacing between characters, and 2 thicknesses spacing between paragraphs. Just like in game graphics. So, why are we re-doing the font? :)

Save


Edited by hegykc
Link to comment
Share on other sites

  • Recently Browsing   0 members

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