Jump to content

F16 DED with SSD1322 and DCS BIOS


wiggles5289
 Share

Recommended Posts

I have been struggling to get DCS BIOS and the u8g2 library to work.

 

Any time I put a drawStr.() line in a void onDisplayChange or whatever it is, it doesn't draw anything but in a corner it looks like its showing the first line of the DED in one character spot with insane tearing from high FPS. Display works fine and is configured correctly when using the Hello World examples from the u8g2 library.

 

A sample of my code is below:

/*
  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_DEFAULT_SERIAL

#include "DcsBios.h"
#include <Arduino.h>
#include <U8g2lib.h>

#ifdef U8X8_HAVE_HW_SPI
#include <SPI.h>
#endif
#ifdef U8X8_HAVE_HW_I2C
#include <Wire.h>
#endif

U8G2_SSD1322_NHD_256X64_F_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);  // Enable U8G2_16BIT in u8g2.h


void onDedLine1Change(char* newValue) {
  u8g2.clearBuffer();          // clear the internal memory
  u8g2.setFont(u8g2_font_ncenB12_tr); // choose a suitable font
  u8g2.drawStr(2,12,newValue);  // write something to the internal memory
  u8g2.sendBuffer();          // transfer internal memory to the display
}
DcsBios::StringBuffer<25> dedLine1Buffer(0x44fc, onDedLine1Change);

void onDedLine2Change(char* newValue) {
  u8g2.clearBuffer();          // clear the internal memory
  u8g2.setFont(u8g2_font_ncenB12_tr); // choose a suitable font
  u8g2.drawStr(2,25,newValue);  // write something to the internal memory
  u8g2.sendBuffer();          // transfer internal memory to the display
}
DcsBios::StringBuffer<25> dedLine2Buffer(0x4516, onDedLine2Change);

void onDedLine3Change(char* newValue) {
  u8g2.clearBuffer();          // clear the internal memory
  u8g2.setFont(u8g2_font_ncenB12_tr); // choose a suitable font
  u8g2.drawStr(2,38,newValue);  // write something to the internal memory
  u8g2.sendBuffer();          // transfer internal memory to the display
}
DcsBios::StringBuffer<25> dedLine3Buffer(0x4530, onDedLine3Change);

void onDedLine4Change(char* newValue) {
  u8g2.clearBuffer();          // clear the internal memory
  u8g2.setFont(u8g2_font_ncenB12_tr); // choose a suitable font
  u8g2.drawStr(2,51,newValue);  // write something to the internal memory
  u8g2.sendBuffer();          // transfer internal memory to the display
}
DcsBios::StringBuffer<25> dedLine4Buffer(0x454a, onDedLine4Change);

void onDedLine5Change(char* newValue) {
  u8g2.clearBuffer();          // clear the internal memory
  u8g2.setFont(u8g2_font_ncenB12_tr); // choose a suitable font
  u8g2.drawStr(2,64,newValue);  // write something to the internal memory
  u8g2.sendBuffer();          // transfer internal memory to the display
}
DcsBios::StringBuffer<25> dedLine5Buffer(0x4564, onDedLine5Change);

void setup() {
  DcsBios::setup();  
  u8g2.begin();
  
}

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

 

Link to comment
Share on other sites

  • 4 weeks later...
  • 2 weeks later...
#define DCSBIOS_DEFAULT_SERIAL

#include "DcsBios.h"
#include <Arduino.h>
#include <U8g2lib.h>

#ifdef U8X8_HAVE_HW_SPI
#include <SPI.h>
#endif
#ifdef U8X8_HAVE_HW_I2C
#include <Wire.h>
#endif

U8G2_SSD1322_NHD_256X64_1_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 5, /* dc=*/ 3, /* reset=*/ 4);
char* line1;
char* line2;
char* line3;
char* line4;
char* line5;


void onDedLine1Change(char* newValue) {
  line1 = newValue;
}
DcsBios::StringBuffer<25> dedLine1Buffer(0x44fc, onDedLine1Change);

void onDedLine2Change(char* newValue) {
  line2 = newValue;
}
DcsBios::StringBuffer<25> dedLine2Buffer(0x4516, onDedLine2Change);

void onDedLine3Change(char* newValue) {
  line3 = newValue;
}
DcsBios::StringBuffer<25> dedLine3Buffer(0x4530, onDedLine3Change);

void onDedLine4Change(char* newValue) {
  line4 = newValue;
}
DcsBios::StringBuffer<25> dedLine4Buffer(0x454a, onDedLine4Change);

void onDedLine5Change(char* newValue) {
  line5 = (newValue);
}
DcsBios::StringBuffer<25> dedLine5Buffer(0x4564, onDedLine5Change);

void setup() {
  DcsBios::setup();
  u8g2.begin();
  u8g2.clearBuffer();
  u8g2.setFont(u8g2_font_t0_12_tf);
}

void loop() {
  u8g2.firstPage();
  do {
    u8g2.drawStr(0, 10, line1);
    u8g2.drawStr(0, 20, line2);
    u8g2.drawStr(0, 30, line3);
    u8g2.drawStr(0, 40, line4);
    u8g2.drawStr(0, 50, line5);
  } while ( u8g2.nextPage() );
  u8g2.updateDisplay();
  DcsBios::loop();
}

 

this sketch is slow and needs to be tweaked ... 


Edited by JohnnyChicago
  • Like 1

Pentium 4 3400 , 1 Gb Corsair , ATI X800XT

Samsung 22" TFT Wide Screen @1680 x 1050

240 GB HD Sata Raid , Soundblaster Audigy 2

Enermax , Zalman , Saitek X-52 , TrackIR 4

Link to comment
Share on other sites

  • 4 weeks later...

@JohnnyChicago It worked! I just modified that code to IRQ instead of Default serial and it worked smoothly. Just need to tweak the fonts and position of text to use the full display.
 

//F-16 DED for DCS BIOS using 256x64 ER-OLED032-1G from BuyDisplay.com

#define DCSBIOS_IRQ_SERIAL

#include "DcsBios.h"
#include <Arduino.h>
#include <U8g2lib.h>

#ifdef U8X8_HAVE_HW_SPI
#include <SPI.h>
#endif
#ifdef U8X8_HAVE_HW_I2C
#include <Wire.h>
#endif

U8G2_SSD1322_NHD_256X64_1_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 5, /* dc=*/ 3, /* reset=*/ 4);
char* line1;
char* line2;
char* line3;
char* line4;
char* line5;


void onDedLine1Change(char* newValue) {
  line1 = newValue;
}
DcsBios::StringBuffer<25> dedLine1Buffer(0x44fc, onDedLine1Change);

void onDedLine2Change(char* newValue) {
  line2 = newValue;
}
DcsBios::StringBuffer<25> dedLine2Buffer(0x4516, onDedLine2Change);

void onDedLine3Change(char* newValue) {
  line3 = newValue;
}
DcsBios::StringBuffer<25> dedLine3Buffer(0x4530, onDedLine3Change);

void onDedLine4Change(char* newValue) {
  line4 = newValue;
}
DcsBios::StringBuffer<25> dedLine4Buffer(0x454a, onDedLine4Change);

void onDedLine5Change(char* newValue) {
  line5 = (newValue);
}
DcsBios::StringBuffer<25> dedLine5Buffer(0x4564, onDedLine5Change);

void setup() {
  DcsBios::setup();
  u8g2.begin();
  u8g2.clearBuffer();
  u8g2.setFont(u8g2_font_t0_12_tf);
}

void loop() {
  u8g2.firstPage();
  do {
    u8g2.drawStr(0, 10, line1);
    u8g2.drawStr(0, 20, line2);
    u8g2.drawStr(0, 30, line3);
    u8g2.drawStr(0, 40, line4);
    u8g2.drawStr(0, 50, line5);
  } while ( u8g2.nextPage() );
  u8g2.updateDisplay();
  DcsBios::loop();
}

 

 

  • Like 1
Link to comment
Share on other sites

Cool .. thanks 

I also read on Discord FP .


Edited by JohnnyChicago

Pentium 4 3400 , 1 Gb Corsair , ATI X800XT

Samsung 22" TFT Wide Screen @1680 x 1050

240 GB HD Sata Raid , Soundblaster Audigy 2

Enermax , Zalman , Saitek X-52 , TrackIR 4

Link to comment
Share on other sites

  • 1 month later...
Posted (edited)

Hi,

I managed to get my DED working in a way as described above, tweaked a bit with the font and changed some minor things.

It was working fine under DCS World 2.5 Beta.

  

Then I updated my DCS to 2.7 and suddenly it isn't working anymore.

The first thing I already noticed is the address change in DCS-BIOS, for instance first line was 0x44fc and now it seems to be 0x4500.

However, if that was the only problem I would be out of the woods quickly.

Even after changing this value nothing appears on my display...I reconnected the Arduino back to my old DCS system and it keeps working (with 0x44fc).

I have the feeling DCS-BIOS isn't giving me the data back (the Webpage of DCS-Bios is reporting the values dough) or the data has another data-format which can't be used as written in the script. I don't have a clue to be honest.

 

Any other persons having the same issue after updating?

 

Thanks in advance

 

Werner


Edited by eaglewen
Link to comment
Share on other sites

Hi,

 

I copied the code above and changed to my own font and hurray it works again....I needed to change to the new addresses though to make it work (check your DCS-BIOS for these new addresses).

 

Just to let you know 🙂

 

Werner

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...
Am 12.6.2021 um 20:32 schrieb eaglewen:

Hi Chroustall,

 

In attachment the font I use on my DED. The ° and the up/down arrows are fixed in this font.

I'm using the DEDFont16px.c in my ino file.

 

Seeya

Werner

DEDfont16px.c 3 kB · 10 Downloads DEDFont16px.fon 5 kB · 13 Downloads DEDFont16px.bdf 23 kB · 11 Downloads

How do you change your code for using the DEDfont16px.c ?

Link to comment
Share on other sites

  • 2 weeks later...
  • 4 weeks later...
On 6/27/2021 at 7:58 AM, Its_Maverick said:

Im following this thread.. 

 

Can anyone link me all the hardware required for making the DED?

 

You guys are doing one hell of a good job 😁

Check out Uri_Ba’s blog post on how to build the DED: https://pit.uriba.org/uriba/ded-box-real-gets/ For DCS BIOS you will need a 5V to 3V3 logic converter(hint: Adafruit) if you use the model screen I did.

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...
On 4/15/2021 at 2:14 PM, wiggles5289 said:

@JohnnyChicago It worked! I just modified that code to IRQ instead of Default serial and it worked smoothly. Just need to tweak the fonts and position of text to use the full display.
 

//F-16 DED for DCS BIOS using 256x64 ER-OLED032-1G from BuyDisplay.com

#define DCSBIOS_IRQ_SERIAL

#include "DcsBios.h"
#include <Arduino.h>
#include <U8g2lib.h>

#ifdef U8X8_HAVE_HW_SPI
#include <SPI.h>
#endif
#ifdef U8X8_HAVE_HW_I2C
#include <Wire.h>
#endif

U8G2_SSD1322_NHD_256X64_1_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 5, /* dc=*/ 3, /* reset=*/ 4);
char* line1;
char* line2;
char* line3;
char* line4;
char* line5;


void onDedLine1Change(char* newValue) {
  line1 = newValue;
}
DcsBios::StringBuffer<25> dedLine1Buffer(0x44fc, onDedLine1Change);

void onDedLine2Change(char* newValue) {
  line2 = newValue;
}
DcsBios::StringBuffer<25> dedLine2Buffer(0x4516, onDedLine2Change);

void onDedLine3Change(char* newValue) {
  line3 = newValue;
}
DcsBios::StringBuffer<25> dedLine3Buffer(0x4530, onDedLine3Change);

void onDedLine4Change(char* newValue) {
  line4 = newValue;
}
DcsBios::StringBuffer<25> dedLine4Buffer(0x454a, onDedLine4Change);

void onDedLine5Change(char* newValue) {
  line5 = (newValue);
}
DcsBios::StringBuffer<25> dedLine5Buffer(0x4564, onDedLine5Change);

void setup() {
  DcsBios::setup();
  u8g2.begin();
  u8g2.clearBuffer();
  u8g2.setFont(u8g2_font_t0_12_tf);
}

void loop() {
  u8g2.firstPage();
  do {
    u8g2.drawStr(0, 10, line1);
    u8g2.drawStr(0, 20, line2);
    u8g2.drawStr(0, 30, line3);
    u8g2.drawStr(0, 40, line4);
    u8g2.drawStr(0, 50, line5);
  } while ( u8g2.nextPage() );
  u8g2.updateDisplay();
  DcsBios::loop();
}

 

 

I'm trying this on a mega2560 but just getting a blank screen, everything works with the test code from buydisplay web site, just wondering if anyone had any idea to why I get nothing on screen, dcs is running with f-16 sat hot start and dcsbios is reporting data coming in from the ded, I'm stumped

Link to comment
Share on other sites

9 hours ago, Auntystatic said:

I'm trying this on a mega2560 but just getting a blank screen, everything works with the test code from buydisplay web site, just wondering if anyone had any idea to why I get nothing on screen, dcs is running with f-16 sat hot start and dcsbios is reporting data coming in from the ded, I'm stumped

If its being silly, try changing lineX = "test Text 123" and see if that at least prints.

Link to comment
Share on other sites

thank you for your help but that didn't work either, but I did spot in your code that  the "newValue" in line 5 has brackets around it and none of the other lines do as seen below, so I added brackets to the other 4 lines and it is now working, thanks again

 

void onDedLine4Change(char* newValue) {
  line4 = newValue;
}
DcsBios::StringBuffer<25> dedLine4Buffer(0x454a, onDedLine4Change);

void onDedLine5Change(char* newValue) {
  line5 = (newValue);
Link to comment
Share on other sites

20 hours ago, Auntystatic said:

thank you for your help but that didn't work either, but I did spot in your code that  the "newValue" in line 5 has brackets around it and none of the other lines do as seen below, so I added brackets to the other 4 lines and it is now working, thanks again

 

void onDedLine4Change(char* newValue) {
  line4 = newValue;
}
DcsBios::StringBuffer<25> dedLine4Buffer(0x454a, onDedLine4Change);

void onDedLine5Change(char* newValue) {
  line5 = (newValue);

Hello

I have Arduino due with   SSD1322 screen and I just upload the code but It doesn't show anything ! Could you please help me about this ? How I am going to make it work ?

Link to comment
Share on other sites

this is my working code, I've not used the due so you will have to find the mosi and sck pins from the due pinout chart, hope it helps you, all I need to do now is find an F-16 font that works

 

//F-16 DED for DCS BIOS using 256x64 ER-OLED032-1G from BuyDisplay.com

#define DCSBIOS_IRQ_SERIAL

#include "DcsBios.h"
#include <Arduino.h>
#include <U8g2lib.h>
#include <SPI.h>

U8G2_SSD1322_NHD_256X64_1_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);  // Enable U8G2_16BIT in u8g2.h
//U8G2_SSD1322_NHD_256X64_1_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 5, /* dc=*/ 3, /* reset=*/ 4);
char* line1;
char* line2;
char* line3;
char* line4;
char* line5;


void onDedLine1Change(char* newValue) {
  line1 = (newValue);
}
DcsBios::StringBuffer<25> dedLine1Buffer(0x44fc, onDedLine1Change);

void onDedLine2Change(char* newValue) {
  line2 = (newValue);
}
DcsBios::StringBuffer<25> dedLine2Buffer(0x4516, onDedLine2Change);

void onDedLine3Change(char* newValue) {
  line3 = (newValue);
}
DcsBios::StringBuffer<25> dedLine3Buffer(0x4530, onDedLine3Change);

void onDedLine4Change(char* newValue) {
  line4 = (newValue);
}
DcsBios::StringBuffer<25> dedLine4Buffer(0x454a, onDedLine4Change);

void onDedLine5Change(char* newValue) {
  line5 = (newValue);
}
DcsBios::StringBuffer<25> dedLine5Buffer(0x4564, onDedLine5Change);

void setup() {
  DcsBios::setup();
  u8g2.begin();
  u8g2.clearBuffer();
  u8g2.setFont(u8g2_font_t0_12_tf);
}

void loop() {
  u8g2.firstPage();
  do {
    u8g2.drawStr(0, 10, line1);
    u8g2.drawStr(0, 20, line2);
    u8g2.drawStr(0, 30, line3);
    u8g2.drawStr(0, 40, line4);
    u8g2.drawStr(0, 50, line5);
  } while ( u8g2.nextPage() );
  u8g2.updateDisplay();
  DcsBios::loop();
}

 


Edited by Auntystatic
  • Like 1
Link to comment
Share on other sites

On 8/20/2021 at 2:56 AM, Auntystatic said:

this is my working code, I've not used the due so you will have to find the mosi and sck pins from the due pinout chart, hope it helps you, all I need to do now is find an F-16 font that works

 

//F-16 DED for DCS BIOS using 256x64 ER-OLED032-1G from BuyDisplay.com

#define DCSBIOS_IRQ_SERIAL

#include "DcsBios.h"
#include <Arduino.h>
#include <U8g2lib.h>
#include <SPI.h>

U8G2_SSD1322_NHD_256X64_1_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);  // Enable U8G2_16BIT in u8g2.h
//U8G2_SSD1322_NHD_256X64_1_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 5, /* dc=*/ 3, /* reset=*/ 4);
char* line1;
char* line2;
char* line3;
char* line4;
char* line5;


void onDedLine1Change(char* newValue) {
  line1 = (newValue);
}
DcsBios::StringBuffer<25> dedLine1Buffer(0x44fc, onDedLine1Change);

void onDedLine2Change(char* newValue) {
  line2 = (newValue);
}
DcsBios::StringBuffer<25> dedLine2Buffer(0x4516, onDedLine2Change);

void onDedLine3Change(char* newValue) {
  line3 = (newValue);
}
DcsBios::StringBuffer<25> dedLine3Buffer(0x4530, onDedLine3Change);

void onDedLine4Change(char* newValue) {
  line4 = (newValue);
}
DcsBios::StringBuffer<25> dedLine4Buffer(0x454a, onDedLine4Change);

void onDedLine5Change(char* newValue) {
  line5 = (newValue);
}
DcsBios::StringBuffer<25> dedLine5Buffer(0x4564, onDedLine5Change);

void setup() {
  DcsBios::setup();
  u8g2.begin();
  u8g2.clearBuffer();
  u8g2.setFont(u8g2_font_t0_12_tf);
}

void loop() {
  u8g2.firstPage();
  do {
    u8g2.drawStr(0, 10, line1);
    u8g2.drawStr(0, 20, line2);
    u8g2.drawStr(0, 30, line3);
    u8g2.drawStr(0, 40, line4);
    u8g2.drawStr(0, 50, line5);
  } while ( u8g2.nextPage() );
  u8g2.updateDisplay();
  DcsBios::loop();
}

 

 

Thanks for sharing. Using an Uno and the .32" oled, what else did you need to physically wire it up. Shoudln't need the level converter mentioned earlier as the uno supplies 3.3v correct? 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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