Jump to content

Recommended Posts

Posted

Yes my display arrived with R6+R8, so I changed it to R5+R8.

the picture is from after the swap 🙂 

ASUS ROG STRIX Z490 F-GAMING | i7-10700K | RTX3090 TUF OC | 32GB DDR4 3200Mhz | Windows 10 64bit | Acer Predator X34P | TrackIR 5 | TM Warthog | TM T.Flight Rudder Pedals

A-10C | A-10C II | F/A-18C | F-16C | FC3 | PG | Syria | SC

Home made F-16C simulator
Forum Thread: DCS World forum - The Viper Project - Home Cockpits Instagram: 1583142 copia.jpg The Viper Project YouTube youtube-icon-512x512-874lspju.png The Viper Project - Youtube channel

Posted

Hello guys, it's been a week that I'm going crazy on my SSD132 led. arduino doesn't accept gfx library and u8g2 library for my display.
can you send me the library and the working arduino command. thanks a lot

Posted (edited)

Failure description doesn't make sense to me. You can either use the u8g2 or the old u8g library.

Your Setup loop is empty and does not initialize any display.

Furthermore this loop has to be closed by "}".

Why don't use the sketch from the above linked post?


Regards, Vinc

Edited by Vinc_Vega

Regards, Vinc

real life: Royal Bavarian Airforce

online: VJS-GermanKnights.de

[sIGPIC][/sIGPIC]

Posted
1 minute ago, uncino said:

But can your sketch be with arduino uno or mega?

No, it's written for ESP32 microcontrollers.

If you want the sketch for Uno or Mega, you have to go back a few more pages of that post.

Regards, Vinc 

Regards, Vinc

real life: Royal Bavarian Airforce

online: VJS-GermanKnights.de

[sIGPIC][/sIGPIC]

Posted
Just now, uncino said:

can you point it out to me?

Something like that, but you have to use the old u8g library.

 

Regards, Vinc 

Regards, Vinc

real life: Royal Bavarian Airforce

online: VJS-GermanKnights.de

[sIGPIC][/sIGPIC]

Posted
On 9/6/2022 at 8:13 PM, wiggles5289 said:

After pulling my hair out for about 2 hours as to why my original code wasn't working, I figured out that I had wrong pointer data for each line.

//F-16 DED for DCS BIOS using 256x64 ER-OLED032-1G from BuyDisplay.com
//Final code by JohnnyChicago,a whole lotta font cred to Fusion's wife, and Wiggles5289 on the DCS Forums
//Updated for DCS 2.7 on 06SEP2022

#define DCSBIOS_IRQ_SERIAL

#include "DcsBios.h"
#include <Arduino.h>
#include <U8g2lib.h>
#include <U8glib.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=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
char* line1;
char* line2;
char* line3;
char* line4;
char* line5;

const u8g_fntpgm_uint8_t DEDfont16px[1148] U8G_FONT_SECTION("DEDfont16px") =
  "_\0\3\3\4\4\4\5\5\10\16\0\376\12\376\12\377\1\212\3\1\4_ \5\0\10\61!\14\224\32"
  "q$\207\212H,\222\0\42\10\66y\61DL\2#\22\227\31q\224$\222\213\222D$\221\134\224$"
  "\22\0$\20\326\371\260\204\62\212\210\252\225$\241\11E\0%\24\270\10q\206\22\231D\22\232Hu\31"
  "E\324$\302\11\0&\21\227\31qf\22\221D\66\223JL\22\221h\42'\6\62{\61\14(\15\264"
  "\372\260$\42\211H\67\221L\0)\15\264\372\60d\42\231H\27\221D\4*\20\310\10\61~\60\205h"
  "s\300\214\24:<\20+\12V\71\261\204\42\223P\4,\10C\373\60,\24\0-\6\26Y\61\14."
  "\6#\33\61\14/\16\246\11\61\325\204\62\241L(\23\12\1\60\16\226\32q(\42JS\245B\222P"
  "\0\61\11\225\31\361D\207\230>\62\14\226\31q(\42\222P\246\243\1\63\17\226\31q(\42\222P\64"
  "%\221$\24\0\64\20\227\31q\244*\42\211H\242$\71J%\0\65\15\226\31\61\16A\305\252P&"
  "!\1\66\15\226\31\261fj\25\21'\11\5\0\67\15\226\31\61\214\62\241L(\23\252\1\70\20\226\31"
  "q(\42REB\221\224H\22\12\0\71\15\226\31q(\42N\222\232\332\10\0:\10s\33\61\354 "
  "\3;\12\223\373\60\354 \13\5\0<\11\226\31\61e\272\352\0=\7\66I\61\314\6>\11\226\31\61"
  "\244\272\351\10\77\16\226\31q(\42\222LQ\16\23\212\0@\17\230\30q,B&\213\204\42!\331\1"
  "\7A\14\226\31\261d\24\21\323a\304$B\14\226\31\61*\42\246\213\210\351\2C\15\226\31q(\42"
  "FM$\11\5\0D\14\226\31\61H\22%\276HH\0E\14\226\31\61\16A\305\212P\321\0F\14"
  "\226\31\61\16A\305\212P#\0G\14\226\31q(\42F\225\22IRH\13\226\31\61D\234\16#N"
  "\2I\11\224\32\61(\42}!J\13\226\31\61\365H\42I(\0K\15\226\31\61D,ZH\22\235"
  "H\2L\11\226\31\61\204\372\321\0M\20\227\31\61d\264J%B\211P\42\64\66\1N\15\227\31\61"
  "d\264\222\205b\252\261\11O\13\226\31q(\42~\222P\0P\14\226\31\61*\42\246\213P#\0Q"
  "\14\266\371p(\42~\222\20\245\2R\14\226\31\61*\42\246\213&&\1S\14\226\31q(\42\252V"
  "\222\204\2T\11\226\31\61LB\375\4U\12\226\31\61D\374IB\1V\13\226\31\61D\374$\241\211"
  "\0W\21\227\31\61d\134\42\224\10%\242I\42\222H\0X\17\226\31\61D$\211$&\224E\224\230"
  "\4Y\14\226\31\61D\234$\64\241&\0Z\12\226\31\61\214j:\12\15[\11\304\352\60L\372'\2"
  "\134\27\230\30\61d\22ID%\42\71L\42*\21\221D&\221ID\0]\11\304\352\60H\372'\3"
  "^\11\66\231\261d\24\221\0_\7\30\350\60\16\1`\10\64\232\61F\62\1a\16\267\31\361\242\263\312"
  "\35\303\245\66\215\1b\14\226\31\61\204\302\212\210\247\13\0c\14v\31q(\42\242&\11\5\0d\12"
  "\226\31\61UN<I\12e\14v\31q(\42\322a(\245\0f\14\226\31\261(B\65\213P\33\0"
  "g\14\246\351pN<I\212\302\13\0h\13\226\31\61\204\302\212\210O\2i\13\246\31\261\204r\10Q"
  "O\6j\12\325\351\360\224i\372\315\2k\15\226\31\61\204J,\22\222D\211$l\11\226\31\61\210\372"
  "\311\0m\21w\31\61,\222\10%B\211P\42\224\10M\0n\11v\31\61*\42>\11o\11Cm"
  "qR$)\0p\14\246\351\60*\42\236.BE\0q\12\246\351pN<I\212\32r\13v\31\61"
  "D\24\233P#\0s\12v\31q\216R\252\360\2t\13\226\31q\204\62\213PW\2u\11v\31\61"
  "D|\222\24v\13v\31\61D<Ih\42\0w\21w\31\61d\224\10%B\211P\42\232$\22\0"
  "x\15v\31\61D$\11MF\21\221\4y\24\247\350pD\22\221D$\21ID\22\221\210*\24\321"
  "\0z\11v\31\61\214\62\35\15{\14\265\371\360D\62%E\65E\1|\7\302\353\60>\14}\15\265"
  "\372\60\204\62E%\65%\31\0~\12\70xqf\23\311l\2\0\0\0\4\377\377\0";


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

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

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

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

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

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

void loop() {
  u8g2.firstPage();
  do {
    u8g2.drawStr(30, 12.8, line1);
    u8g2.drawStr(30, 25.6, line2);
    u8g2.drawStr(30, 38.4, line3);
    u8g2.drawStr(30, 51.2, line4);
    u8g2.drawStr(30, 64, line5);
  } while ( u8g2.nextPage() );
  u8g2.updateDisplay();
  DcsBios::loop(); 
}

Updated code to be added to first post.

Hello everyone.
This is my first post on the forum.

I'm having some difficulty configuring my SSD1322 Display with the Arduino NANO V3.

https://pt.aliexpress.com/item/1005007129367204.html?spm=a2g0o.productlist.main.5.547ee817EWOm5l&algo_pvid=fb87fba0-c6db-4f9c-9e66-e832426348ae&algo_exp_id=fb87fba0-c6db-4f9c-9e66-e832426348ae-2&pdp_npi=4%40dis!BRL!82.08!72.20!!!12.88!11.33!%402101e07217333237509542405e1146!12000043381748551!sea!BR!4160920486!X&curPageLogUid=wnhq6UaiyoEq&utparam-url=scene%3Asearch|query_from%3A

I've read and reread all the comments in this topic and the most I could manage were the few characters shown in the figure below.

 

Yes, re-solder a small jumper from “R6” to “R5”.

 

I'm using the code mentioned above and the pinout is this.

OLED    ARDUINO
1    GND
2    3.3 V
4    D13
5    D11
14    D9
15    D8
16    D10

I think I've exhausted everything I could do on my own.

Could you help me?

Thank you in advance for your collaboration.

Captura de tela 2024-12-04 120646.png

Captura de tela 2024-12-04 120703.png

On 9/6/2022 at 8:13 PM, wiggles5289 said:

After pulling my hair out for about 2 hours as to why my original code wasn't working, I figured out that I had wrong pointer data for each line.

//F-16 DED for DCS BIOS using 256x64 ER-OLED032-1G from BuyDisplay.com
//Final code by JohnnyChicago,a whole lotta font cred to Fusion's wife, and Wiggles5289 on the DCS Forums
//Updated for DCS 2.7 on 06SEP2022

#define DCSBIOS_IRQ_SERIAL

#include "DcsBios.h"
#include <Arduino.h>
#include <U8g2lib.h>
#include <U8glib.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=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
char* line1;
char* line2;
char* line3;
char* line4;
char* line5;

const u8g_fntpgm_uint8_t DEDfont16px[1148] U8G_FONT_SECTION("DEDfont16px") =
  "_\0\3\3\4\4\4\5\5\10\16\0\376\12\376\12\377\1\212\3\1\4_ \5\0\10\61!\14\224\32"
  "q$\207\212H,\222\0\42\10\66y\61DL\2#\22\227\31q\224$\222\213\222D$\221\134\224$"
  "\22\0$\20\326\371\260\204\62\212\210\252\225$\241\11E\0%\24\270\10q\206\22\231D\22\232Hu\31"
  "E\324$\302\11\0&\21\227\31qf\22\221D\66\223JL\22\221h\42'\6\62{\61\14(\15\264"
  "\372\260$\42\211H\67\221L\0)\15\264\372\60d\42\231H\27\221D\4*\20\310\10\61~\60\205h"
  "s\300\214\24:<\20+\12V\71\261\204\42\223P\4,\10C\373\60,\24\0-\6\26Y\61\14."
  "\6#\33\61\14/\16\246\11\61\325\204\62\241L(\23\12\1\60\16\226\32q(\42JS\245B\222P"
  "\0\61\11\225\31\361D\207\230>\62\14\226\31q(\42\222P\246\243\1\63\17\226\31q(\42\222P\64"
  "%\221$\24\0\64\20\227\31q\244*\42\211H\242$\71J%\0\65\15\226\31\61\16A\305\252P&"
  "!\1\66\15\226\31\261fj\25\21'\11\5\0\67\15\226\31\61\214\62\241L(\23\252\1\70\20\226\31"
  "q(\42REB\221\224H\22\12\0\71\15\226\31q(\42N\222\232\332\10\0:\10s\33\61\354 "
  "\3;\12\223\373\60\354 \13\5\0<\11\226\31\61e\272\352\0=\7\66I\61\314\6>\11\226\31\61"
  "\244\272\351\10\77\16\226\31q(\42\222LQ\16\23\212\0@\17\230\30q,B&\213\204\42!\331\1"
  "\7A\14\226\31\261d\24\21\323a\304$B\14\226\31\61*\42\246\213\210\351\2C\15\226\31q(\42"
  "FM$\11\5\0D\14\226\31\61H\22%\276HH\0E\14\226\31\61\16A\305\212P\321\0F\14"
  "\226\31\61\16A\305\212P#\0G\14\226\31q(\42F\225\22IRH\13\226\31\61D\234\16#N"
  "\2I\11\224\32\61(\42}!J\13\226\31\61\365H\42I(\0K\15\226\31\61D,ZH\22\235"
  "H\2L\11\226\31\61\204\372\321\0M\20\227\31\61d\264J%B\211P\42\64\66\1N\15\227\31\61"
  "d\264\222\205b\252\261\11O\13\226\31q(\42~\222P\0P\14\226\31\61*\42\246\213P#\0Q"
  "\14\266\371p(\42~\222\20\245\2R\14\226\31\61*\42\246\213&&\1S\14\226\31q(\42\252V"
  "\222\204\2T\11\226\31\61LB\375\4U\12\226\31\61D\374IB\1V\13\226\31\61D\374$\241\211"
  "\0W\21\227\31\61d\134\42\224\10%\242I\42\222H\0X\17\226\31\61D$\211$&\224E\224\230"
  "\4Y\14\226\31\61D\234$\64\241&\0Z\12\226\31\61\214j:\12\15[\11\304\352\60L\372'\2"
  "\134\27\230\30\61d\22ID%\42\71L\42*\21\221D&\221ID\0]\11\304\352\60H\372'\3"
  "^\11\66\231\261d\24\221\0_\7\30\350\60\16\1`\10\64\232\61F\62\1a\16\267\31\361\242\263\312"
  "\35\303\245\66\215\1b\14\226\31\61\204\302\212\210\247\13\0c\14v\31q(\42\242&\11\5\0d\12"
  "\226\31\61UN<I\12e\14v\31q(\42\322a(\245\0f\14\226\31\261(B\65\213P\33\0"
  "g\14\246\351pN<I\212\302\13\0h\13\226\31\61\204\302\212\210O\2i\13\246\31\261\204r\10Q"
  "O\6j\12\325\351\360\224i\372\315\2k\15\226\31\61\204J,\22\222D\211$l\11\226\31\61\210\372"
  "\311\0m\21w\31\61,\222\10%B\211P\42\224\10M\0n\11v\31\61*\42>\11o\11Cm"
  "qR$)\0p\14\246\351\60*\42\236.BE\0q\12\246\351pN<I\212\32r\13v\31\61"
  "D\24\233P#\0s\12v\31q\216R\252\360\2t\13\226\31q\204\62\213PW\2u\11v\31\61"
  "D|\222\24v\13v\31\61D<Ih\42\0w\21w\31\61d\224\10%B\211P\42\232$\22\0"
  "x\15v\31\61D$\11MF\21\221\4y\24\247\350pD\22\221D$\21ID\22\221\210*\24\321"
  "\0z\11v\31\61\214\62\35\15{\14\265\371\360D\62%E\65E\1|\7\302\353\60>\14}\15\265"
  "\372\60\204\62E%\65%\31\0~\12\70xqf\23\311l\2\0\0\0\4\377\377\0";


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

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

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

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

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

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

void loop() {
  u8g2.firstPage();
  do {
    u8g2.drawStr(30, 12.8, line1);
    u8g2.drawStr(30, 25.6, line2);
    u8g2.drawStr(30, 38.4, line3);
    u8g2.drawStr(30, 51.2, line4);
    u8g2.drawStr(30, 64, line5);
  } while ( u8g2.nextPage() );
  u8g2.updateDisplay();
  DcsBios::loop(); 
}

Updated code to be added to first post.

Hello everyone.
This is my first post on the forum.

I'm having some difficulty configuring my SSD1322 Display with the Arduino NANO V3.

https://pt.aliexpress.com/item/1005007129367204.html?spm=a2g0o.productlist.main.5.547ee817EWOm5l&algo_pvid=fb87fba0-c6db-4f9c-9e66-e832426348ae&algo_exp_id=fb87fba0-c6db-4f9c-9e66-e832426348ae-2&pdp_npi=4%40dis!BRL!82.08!72.20!!!12.88!11.33!%402101e07217333237509542405e1146!12000043381748551!sea!BR!4160920486!X&curPageLogUid=wnhq6UaiyoEq&utparam-url=scene%3Asearch|query_from%3A

I've read and reread all the comments in this topic and the most I could manage were the few characters shown in the figure below.

 

Yes, re-solder a small jumper from “R6” to “R5”.

 

I'm using the code mentioned above and the pinout is this.

OLED    ARDUINO
1    GND
2    3.3 V
4    D13
5    D11
14    D9
15    D8
16    D10

I think I've exhausted everything I could do on my own.

Could you help me?

Thank you in advance for your collaboration.

Posted
2 hours ago, CR77 said:

Hello everyone.
This is my first post on the forum.

I'm having some difficulty configuring my SSD1322 Display with the Arduino NANO V3.

https://pt.aliexpress.com/item/1005007129367204.html?spm=a2g0o.productlist.main.5.547ee817EWOm5l&algo_pvid=fb87fba0-c6db-4f9c-9e66-e832426348ae&algo_exp_id=fb87fba0-c6db-4f9c-9e66-e832426348ae-2&pdp_npi=4%40dis!BRL!82.08!72.20!!!12.88!11.33!%402101e07217333237509542405e1146!12000043381748551!sea!BR!4160920486!X&curPageLogUid=wnhq6UaiyoEq&utparam-url=scene%3Asearch|query_from%3A

I've read and reread all the comments in this topic and the most I could manage were the few characters shown in the figure below.

 

Yes, re-solder a small jumper from “R6” to “R5”.

 

I'm using the code mentioned above and the pinout is this.

OLED    ARDUINO
1    GND
2    3.3 V
4    D13
5    D11
14    D9
15    D8
16    D10

I think I've exhausted everything I could do on my own.

Could you help me?

Thank you in advance for your collaboration.

Captura de tela 2024-12-04 120646.png

Captura de tela 2024-12-04 120703.png

Hello everyone.
This is my first post on the forum.

I'm having some difficulty configuring my SSD1322 Display with the Arduino NANO V3.

https://pt.aliexpress.com/item/1005007129367204.html?spm=a2g0o.productlist.main.5.547ee817EWOm5l&algo_pvid=fb87fba0-c6db-4f9c-9e66-e832426348ae&algo_exp_id=fb87fba0-c6db-4f9c-9e66-e832426348ae-2&pdp_npi=4%40dis!BRL!82.08!72.20!!!12.88!11.33!%402101e07217333237509542405e1146!12000043381748551!sea!BR!4160920486!X&curPageLogUid=wnhq6UaiyoEq&utparam-url=scene%3Asearch|query_from%3A

I've read and reread all the comments in this topic and the most I could manage were the few characters shown in the figure below.

 

Yes, re-solder a small jumper from “R6” to “R5”.

 

I'm using the code mentioned above and the pinout is this.

OLED    ARDUINO
1    GND
2    3.3 V
4    D13
5    D11
14    D9
15    D8
16    D10

I think I've exhausted everything I could do on my own.

Could you help me?

Thank you in advance for your collaboration.

I'm at the same point too.

Posted

Sorry, I can't help anymore without the proper hardware. Ssd1322 displays are still on their way.

Regards, Vinc 

Regards, Vinc

real life: Royal Bavarian Airforce

online: VJS-GermanKnights.de

[sIGPIC][/sIGPIC]

Posted (edited)
On 12/2/2024 at 9:41 PM, uncino said:

But can your sketch be with arduino uno or mega?

Here is a sketch, adapted to MEGA2560. Response is good if using the hardware SPI pins.

Any regulary UNO has not enough memory to store the sketch.

Pinout for the MEGA2560 hardware SPI driver:

MOSI: 51  (SDA) hardware SPI

SCK: 52 (SCL) hardware SPI

SS/CS: 53 hardware SPI

DC = 6 (may be changed to any digital pin)

RST = 8 (may be changed to any digital pin)

U8G2_SSD1322_NHD_256X64_F_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 53, /* dc=*/ 6, /* reset=*/ 8);

I adapted the sketch for a MEGA2560, you have to adjust your own display driver (see above)

Hint: you won't see anything on your display after successful upload, else commenting the “String(line1) ; String(line2); …” line and un-commenting the “String(line1) = …” to “String(line5) = …" section.

Spoiler
//F-16 DED for DCS BIOS using 256x64 ER-OLED032-1G from BuyDisplay.com
//Final code by JohnnyChicago,a whole lotta font cred to Fusion's wife, and Wiggles5289 on the DCS Forums
// adapted by Vinc_Vega to work exclusively with the u8g2 library, new font with inverted chars added,
// inverted chars are original ASCII code byte + 100, interprete steering bits (bytes 26 - 29 of each DED line) and plot inverted chars,
// unfortunately at the time not all inverted chars are covered by the steering bits (mostly the inverted asterics (*) is missing and therefore is displayed always inveted)

#define DCSBIOS_IRQ_SERIAL  // for ordinary Arduino chipsets
//#define DCSBIOS_DEFAULT_SERIAL // for ESP32 and other chipsets
//#define DCSBIOS_DISABLE_SERVO
#include "DcsBios.h"
#include <SPI.h>
#include <U8g2lib.h>

/*
for the MEGA 2560 use the following pinout:
MOSI: 51  (SDA) hardware SPI
MISO: 50 hardware SPI
SCK: 52 (SCL) hardware SPI
SS/CS: 53 hardware SPI
DC = 6 (may be changed to any digital pin)
RST = 8 (may be changed to any digital pin)
*/

// U8G2_SH1122_256X64_F_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 53, /* dc=*/ 6, /* reset=*/ 8); // driver for SH1122 displays
U8G2_SSD1322_NHD_256X64_F_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 53, /* dc=*/ 6, /* reset=*/ 8);	// driver for SSD1322 displays

// ----------------------------------------------------------------------------------------
//            Declaration of the variables
// ----------------------------------------------------------------------------------------

String(line1); String(line2); String(line3); String(line4); String(line5);  // create a string object for each line to manipulate the content
/*
// DED lines each have 25 chars plus max 4 additional steering bytes (26 to 29), see below example
//              "12345678901234567890123456789"
String(line1) = "          LIST           "; //(25)
String(line2) = "1DEST 2BNGO 3VIP  RINTG  A"; //(28)
String(line3) = "4NAV  5MAN  6INS  EDLNK  A"; //(28)
String(line4) = "7CMDS 8MODE 9VRP  0MISC  A"; //(28)
String(line5) = "                         "; //(25)
*/


const byte x = 28;         // cursor x is always 28 (first char of a line to print) for a 256x64 display
const byte y = 13;         // cursor y is according to the line number: y = (line number * y) -1) -> first line print at y = 12

// ----------------------------------------------------------------------------------------
//            costume F-16 DED font including inversed chars for the u8g2 library
// ----------------------------------------------------------------------------------------
/*
  Fontname: DEDFontNewInv_01
  Copyright: Vinc_Vega
  Glyphs: 142/195
  BBX Build Mode: 0
*/
const uint8_t u8g2_font_DEDFontNewInv[1755] U8G2_FONT_SECTION("u8g2_font_DEDFontNewInv") = 
  "\216\0\3\4\4\4\3\5\5\10\14\0\377\11\376\11\0\1h\2\315\6\276 \5\0\334\30!\7\222\207"
  "\30L\4\42\14E\255\30\42$\42AB!\0#\17\226\205\70A\261\230\4\305\213IP,\0$\5"
  "\0\334\30%\17\226\205\30c!A$br!\12\11\33&\20\226\205XC%\242b##E!&"
  "#\1'\10B\256\30$\42\0(\12\224\206X\42Er\33\22)\14\224\206\30BcB\62\225\10\1"
  "*\20\270|\30\17$%Q\310\252\221D)y(+\13f\215X\202BL\202B\0,\10B\207\30"
  "$\42\0-\6&\235\30\14.\6\42\207\30\4/\12v\215\270\201br\14\5\60\15\226\205Xb$"
  "Bt\22!\23\2\61\12\224\206XA\42CrA\62\14\226\205\70$H\202\42*\202\14\63\15\226\205"
  "\30\214bb\243D($\0\64\14\226\205\30\42\362\13\233\240\24\0\65\14\226\205\30\216%\206D($"
  "\0\66\15\226\205\70$\210%HD($\0\67\13\226\205\30\214br\224\10\0\70\16\226\205\70$H"
  "($BD($\0\71\16\226\205\70$HD(\205\42%$\0:\7b\227\30\204\4;\11\202\207"
  "\30\204$\42\0<\11\226\205\230br\225\3=\10f\215\30\354\240\14>\12\226\205\30\242r\223#\0"
  "\77\17\226\205\70$HbCc\342`\202B\0@\20\226\205\70$g\202%#!#!($\0A"
  "\15\226\205Xb$HD\17AD\2B\15\226\205\30%H'%BD-\0C\14\226\205\70$H"
  "\204\62\241\220\0D\13\226\205\30E%\362_T\0E\13\226\205\30\216DD\202\202\14F\13\226\205\30"
  "\216DD\202\62\2G\14\226\205\70$H\204\42\225P\12H\13\226\205\30B\224\36\202h\22I\11\226"
  "\205\30L\202rbJ\13\226\205\30L\202r\42\32\3K\17\226\205\30B$(DcD%\42E\2"
  "L\11\226\205\30\202\362\221\1M\13\226\205\30\201C\17At\22N\15\226\205\30aD%%$\225\250"
  "\5O\13\226\205\70$HtB!\1P\14\226\205\30%HD-\202\22\1Q\13\226\205\70$H\264"
  " \221\12R\15\226\205\30%HD'%\62\21\11S\15\226\205\70$\210E\205\202($\0T\12\226"
  "\205\30L\202\362\11\0U\13\226\205\30B\364\11\205\4\0V\16\226\205\30Bt\22\11\12\242&\4\0"
  "W\13\226\205\30Btz\10\32\14X\21\226\205\30BD\42AAdbDQ\204\210\4Y\16\226\205"
  "\30BD\42AAd\202r\2Z\11\226\205\30\214brd[\10\224\206\30JrB\134\7\222\207\30"
  "\17\3]\10\224\206\30HrR^\14U\246XaC!!\42c\1_\6\26\205\30\6`\10B\257"
  "\30$\42\0a\15\226\205Xb$\346\20M\310\204\0o\7\63\265\30$\4{\14\226\205X\202\362d"
  "B&\4\0|\7\222\207\30\17\3}\14\226\205Xb$F\202\362\4\0~\13F\225\70b$\42d"
  "\42\0\204\10\270|\30\377\320\0\205\13\270|\30K\366\344d\264\0\206\20\270|\30IACA$\42"
  "#\42\17\37\14\207\26\270|\30*\42$\42\303#\42$\42$\42\303#\42$\42\12\210\5\0\334\30"
  "\211\22\270|\30i%!\322\202\352\24&\42\22R\226\0\212\23\270|\30k\244CGe!BaB"
  "\42\303c!\11\213\14\270|\30JF'&\17\37\20\214\14\270|\30LeDv:\63R\215\14\270"
  "|\30JfGv\42+b\216\20\270|\30\17$%Q\310\252\221D)y(\217\16\270|\30\17L"
  "F\304\302DF\17\4\220\13\270|\30\77\30\31\235\230\60\221\13\270|\30\37\226\205\37\36\6\222\11\270"
  "|\30\177\70\62Z\223\14\270|\30\17'Fu\62y\70\224\15\270|\30K\205C\362O\203E\13\225"
  "\15\270|\30,FeF\66\25\22*\226\20\270|\30\212\303BBF\243\242C\306\302\11\227\15\270|"
  "\30\311\302F\325\216d\36T\230\22\270|\30IACACACA\303\302E\226\24\231\15\270|\30"
  "\311\222L\207\215d\36T\232\16\270|\30\212\303B\246\303Br\36T\233\14\270|\30\311\302Fu\262"
  "\324\0\234\17\270|\30\212\303B\222\7\207\344<\250\0\235\16\270|\30\212\303Br\36\65\32\35T\236"
  "\15\270|\30\17DF\17GF\17\14\237\16\270|\30\17DF\17GF'&\14\240\12\270|\30M"
  "u\272S\2\241\15\270|\30\17\312\302\17\303\302\17\2\242\12\270|\30Iw\252S\3\243\17\270|\30"
  "\212\303BBedENF\13\244\23\270|\30\212\303\42CFbA\42\221D\42\11\17*\245\16\270"
  "|\30K\205\303Br\226$S\2\246\16\270|\30\251\303BR'\311YT\1\247\16\270|\30\212\303"
  "B\222l\222<\250\0\250\24\270|\30\251\244CACACACACA\243\242\12\251\14\270|\30"
  "\311\222\14)Y\26N\252\14\270|\30\311\222\14)\331\324\0\253\21\270|\30\212\303B\222\214\302\204\302"
  "\204$\217&\254\14\270|\30I\362Y\222\374\224\0\255\14\270|\30\311\302Dv\42\26N\256\14\270|"
  "\30\311\302Dv\42$c\257\22\270|\30I\222\302D\7\311\12I\207\302\204\204\22\260\12\270|\30I"
  "\366\263p\2\261\15\270|\30)$B\222%\311\77%\262\24\270|\30)C\262\5\211\5\11\205\11\205"
  "\11\311i$\1\263\14\270|\30\212\303B\362\237\7\25\264\16\270|\30\251\303Br\26\35\262\324\0\265"
  "\17\270|\30\212\303B\362)L\224\360(\1\266\17\270|\30\251\303Br\235\24\64$S\2\267\17\270"
  "|\30\212\303B\246\244FF\302\203\12\270\13\270|\30\311\302D\366i\1\271\13\270|\30I\362\377y"
  "P\1\272\16\270|\30I\362O#\42\204\204E\13\273\14\270|\30I\362\237%I!I\274\22\270|"
  "\30I\62\215\210\20\26\25\222\210\14\311\224\0\275\16\270|\30I\62\215\210\20\26\331i\1\276\14\270|"
  "\30\311\302Fu\62\26N\277\13\270|\30\212\224\354\221P\1\300\11\270|\30K\366\247\5\301\14\270|"
  "\30\212\204Fv\42$T\302\20\270|\30,f%!DA##\17\17\13\303\10\270|\30\177hN"
  "\304\14\270|\30KF'&\17\37\16\305\15\270|\30K\205\303\17\313\203E\13\323\13\270|\30i%"
  "!e\17\77\337\14\270|\30K\366D<X\264\0\340\11\270|\30K\366\247\5\341\14\270|\30K\205"
  "\303D\366\264\0\342\16\270|\30\37\210\12CD\2\213\36\26\0\0\0\4\377\377\0";


// ----------------------------------------------------------------------------------------
//            DCS.BIOS stuff here
// ----------------------------------------------------------------------------------------
void onDedLine1Change(char* newValue) {
  line1 = newValue;
}
DcsBios::StringBuffer<29> dedLine1Buffer(0x450a, onDedLine1Change);

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

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

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

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

// ----------------------------------------------------------------------------------------
//            SETUP Section
// ----------------------------------------------------------------------------------------
void setup() {
	DcsBios::setup();
  delay(100); // time to setup the display
  u8g2.begin();
  u8g2.clear();
  u8g2.setFont(u8g2_font_DEDFontNewInv);
//  u8g2.setContrast(255);  // brightness from 0 to 255
}
// ----------------------------------------------------------------------------------------
//            LOOP Section - Try to keep empty !!!
// ----------------------------------------------------------------------------------------
void loop() {
  DcsBios::loop();
// not all lines are refreshed at the same time, so it sometimes results in missing lines while DED manipulation
// therefore, the page buffer method is used to print all lines at once;
// if using the framebuffer, use -> clearBuffer() to only clear the buffer, clear() clears both buffer and screen which looks blinky
  u8g2.firstPage();
  do {
    u8g2.setCursor(x, y-1);
    u8g2.print(invertChars(line1));
    u8g2.setCursor(x, (2 * y) -1);
    u8g2.print(invertChars(line2));
    u8g2.setCursor(x, (3 * y) -1);
    u8g2.print(invertChars(line3));
    u8g2.setCursor(x, (4 * y) -1);
    u8g2.print(invertChars(line4));
    u8g2.setCursor(x, (5 * y) -1);
    u8g2.print(invertChars(line5));
  } while (u8g2.nextPage());
  u8g2.updateDisplay();
}

// ----------------------------------------------------------------------------------------
//            Supporting functions
// ----------------------------------------------------------------------------------------

String invertChars(String lineX) {                        // create a function, applied on each DED line and returning the manipulated string
  if (lineX.length() > 25) {                              // look for steering bits only if a line has more than 25 chars
    for (int j = 0; j < 4; j++) {                         // go through each of the 4 bytes
      for (int i = 0; i < 8; i++) {                       // go through each of the 8 bits per byte
        if (bitRead(lineX[25 + j], i) == 1) {             // start at char number 26 [string index is 25 !!!]; if steering bit equals 1 we found a to be inverted char
            int inverted = byte(lineX.charAt(j * 8 + i)); // read the byte value of the char from the string object into a local variable
            lineX.setCharAt(j * 8 + i, inverted + 100);   // replace the char by it's inverted version (byte of the char + 100 in the manipulated font)
        }
      }
    }
    lineX.remove(25, 4);                                  // remove the steering bytes from the string (chars 26 to 29) ...
  }														  // ... line is cut to 25 chars, so it passes the next loop without further manipulation (if > 25) 
  return lineX;                                           // function returns the manipulated line
}

 

Edit: Code adapted for questioned SSD1322 displays
Edited by Vinc_Vega

Regards, Vinc

real life: Royal Bavarian Airforce

online: VJS-GermanKnights.de

[sIGPIC][/sIGPIC]

Posted
10 hours ago, Vinc_Vega said:

Here is a sketch, adapted to MEGA2560. Response is good if using the hardware SPI pins.

Any regulary UNO has not enough memory to store the sketch.

Pinout for the MEGA2560 hardware SPI driver:

MOSI: 51  (SDA) hardware SPI

SCK: 52 (SCL) hardware SPI

SS/CS: 53 hardware SPI

DC = 6 (may be changed to any digital pin)

RST = 8 (may be changed to any digital pin)

U8G2_SSD1322_NHD_256X64_F_4W_HW_SPI(U8G2_R0, /* cs=*/ 53, /* dc=*/ 6, /* reset=*/ 8);

I adapted the sketch for a MEGA2560, you have to adjust your own display driver (see above)

Hint: you won't see anything on your display after successful upload, else commenting the “String(line1) ; String(line2); …” line and un-commenting the “String(line1) = …” to “String(line5) = …" section.

  Hide contents
//F-16 DED for DCS BIOS using 256x64 ER-OLED032-1G from BuyDisplay.com
//Final code by JohnnyChicago,a whole lotta font cred to Fusion's wife, and Wiggles5289 on the DCS Forums
// adapted by Vinc_Vega to work exclusively with the u8g2 library, new font with inverted chars added,
// inverted chars are original ASCII code byte + 100, interprete steering bits (bytes 26 - 29 of each DED line) and plot inverted chars,
// unfortunately at the time not all inverted chars are covered by the steering bits (mostly the inverted asterics (*) is missing and therefore is displayed always inveted)

#define DCSBIOS_IRQ_SERIAL  // for ordinary Arduino chipsets
//#define DCSBIOS_DEFAULT_SERIAL // for ESP32 and other chipsets
//#define DCSBIOS_DISABLE_SERVO
#include "DcsBios.h"
#include <SPI.h>
#include <U8g2lib.h>

/*
for the MEGA 2560 use the following pinout:
MOSI: 51  (SDA) hardware SPI
MISO: 50 hardware SPI
SCK: 52 (SCL) hardware SPI
SS/CS: 53 hardware SPI
DC = 6 (may be changed to any digital pin)
RST = 8 (may be changed to any digital pin)
*/

U8G2_SH1122_256X64_F_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 53, /* dc=*/ 6, /* reset=*/ 8);				// Enable U8G2_16BIT in u8g2.h

// ----------------------------------------------------------------------------------------
//            Declaration of the variables
// ----------------------------------------------------------------------------------------

String(line1); String(line2); String(line3); String(line4); String(line5);  // create a string object for each line to manipulate the content
/*
// DED lines each have 25 chars plus max 4 additional steering bytes (26 to 29), see below example
//              "12345678901234567890123456789"
String(line1) = "          LIST           "; //(25)
String(line2) = "1DEST 2BNGO 3VIP  RINTG  A"; //(28)
String(line3) = "4NAV  5MAN  6INS  EDLNK  A"; //(28)
String(line4) = "7CMDS 8MODE 9VRP  0MISC  A"; //(28)
String(line5) = "                         "; //(25)
*/


const byte x = 28;         // cursor x is always 28 (first char of a line to print) for a 256x64 display
const byte y = 13;         // cursor y is according to the line number: y = (line number * y) -1) -> first line print at y = 12

// ----------------------------------------------------------------------------------------
//            costume F-16 DED font including inversed chars for the u8g2 library
// ----------------------------------------------------------------------------------------
/*
  Fontname: DEDFontNewInv_01
  Copyright: Vinc_Vega
  Glyphs: 142/195
  BBX Build Mode: 0
*/
const uint8_t u8g2_font_DEDFontNewInv[1755] U8G2_FONT_SECTION("u8g2_font_DEDFontNewInv") = 
  "\216\0\3\4\4\4\3\5\5\10\14\0\377\11\376\11\0\1h\2\315\6\276 \5\0\334\30!\7\222\207"
  "\30L\4\42\14E\255\30\42$\42AB!\0#\17\226\205\70A\261\230\4\305\213IP,\0$\5"
  "\0\334\30%\17\226\205\30c!A$br!\12\11\33&\20\226\205XC%\242b##E!&"
  "#\1'\10B\256\30$\42\0(\12\224\206X\42Er\33\22)\14\224\206\30BcB\62\225\10\1"
  "*\20\270|\30\17$%Q\310\252\221D)y(+\13f\215X\202BL\202B\0,\10B\207\30"
  "$\42\0-\6&\235\30\14.\6\42\207\30\4/\12v\215\270\201br\14\5\60\15\226\205Xb$"
  "Bt\22!\23\2\61\12\224\206XA\42CrA\62\14\226\205\70$H\202\42*\202\14\63\15\226\205"
  "\30\214bb\243D($\0\64\14\226\205\30\42\362\13\233\240\24\0\65\14\226\205\30\216%\206D($"
  "\0\66\15\226\205\70$\210%HD($\0\67\13\226\205\30\214br\224\10\0\70\16\226\205\70$H"
  "($BD($\0\71\16\226\205\70$HD(\205\42%$\0:\7b\227\30\204\4;\11\202\207"
  "\30\204$\42\0<\11\226\205\230br\225\3=\10f\215\30\354\240\14>\12\226\205\30\242r\223#\0"
  "\77\17\226\205\70$HbCc\342`\202B\0@\20\226\205\70$g\202%#!#!($\0A"
  "\15\226\205Xb$HD\17AD\2B\15\226\205\30%H'%BD-\0C\14\226\205\70$H"
  "\204\62\241\220\0D\13\226\205\30E%\362_T\0E\13\226\205\30\216DD\202\202\14F\13\226\205\30"
  "\216DD\202\62\2G\14\226\205\70$H\204\42\225P\12H\13\226\205\30B\224\36\202h\22I\11\226"
  "\205\30L\202rbJ\13\226\205\30L\202r\42\32\3K\17\226\205\30B$(DcD%\42E\2"
  "L\11\226\205\30\202\362\221\1M\13\226\205\30\201C\17At\22N\15\226\205\30aD%%$\225\250"
  "\5O\13\226\205\70$HtB!\1P\14\226\205\30%HD-\202\22\1Q\13\226\205\70$H\264"
  " \221\12R\15\226\205\30%HD'%\62\21\11S\15\226\205\70$\210E\205\202($\0T\12\226"
  "\205\30L\202\362\11\0U\13\226\205\30B\364\11\205\4\0V\16\226\205\30Bt\22\11\12\242&\4\0"
  "W\13\226\205\30Btz\10\32\14X\21\226\205\30BD\42AAdbDQ\204\210\4Y\16\226\205"
  "\30BD\42AAd\202r\2Z\11\226\205\30\214brd[\10\224\206\30JrB\134\7\222\207\30"
  "\17\3]\10\224\206\30HrR^\14U\246XaC!!\42c\1_\6\26\205\30\6`\10B\257"
  "\30$\42\0a\15\226\205Xb$\346\20M\310\204\0o\7\63\265\30$\4{\14\226\205X\202\362d"
  "B&\4\0|\7\222\207\30\17\3}\14\226\205Xb$F\202\362\4\0~\13F\225\70b$\42d"
  "\42\0\204\10\270|\30\377\320\0\205\13\270|\30K\366\344d\264\0\206\20\270|\30IACA$\42"
  "#\42\17\37\14\207\26\270|\30*\42$\42\303#\42$\42$\42\303#\42$\42\12\210\5\0\334\30"
  "\211\22\270|\30i%!\322\202\352\24&\42\22R\226\0\212\23\270|\30k\244CGe!BaB"
  "\42\303c!\11\213\14\270|\30JF'&\17\37\20\214\14\270|\30LeDv:\63R\215\14\270"
  "|\30JfGv\42+b\216\20\270|\30\17$%Q\310\252\221D)y(\217\16\270|\30\17L"
  "F\304\302DF\17\4\220\13\270|\30\77\30\31\235\230\60\221\13\270|\30\37\226\205\37\36\6\222\11\270"
  "|\30\177\70\62Z\223\14\270|\30\17'Fu\62y\70\224\15\270|\30K\205C\362O\203E\13\225"
  "\15\270|\30,FeF\66\25\22*\226\20\270|\30\212\303BBF\243\242C\306\302\11\227\15\270|"
  "\30\311\302F\325\216d\36T\230\22\270|\30IACACACA\303\302E\226\24\231\15\270|\30"
  "\311\222L\207\215d\36T\232\16\270|\30\212\303B\246\303Br\36T\233\14\270|\30\311\302Fu\262"
  "\324\0\234\17\270|\30\212\303B\222\7\207\344<\250\0\235\16\270|\30\212\303Br\36\65\32\35T\236"
  "\15\270|\30\17DF\17GF\17\14\237\16\270|\30\17DF\17GF'&\14\240\12\270|\30M"
  "u\272S\2\241\15\270|\30\17\312\302\17\303\302\17\2\242\12\270|\30Iw\252S\3\243\17\270|\30"
  "\212\303BBedENF\13\244\23\270|\30\212\303\42CFbA\42\221D\42\11\17*\245\16\270"
  "|\30K\205\303Br\226$S\2\246\16\270|\30\251\303BR'\311YT\1\247\16\270|\30\212\303"
  "B\222l\222<\250\0\250\24\270|\30\251\244CACACACACA\243\242\12\251\14\270|\30"
  "\311\222\14)Y\26N\252\14\270|\30\311\222\14)\331\324\0\253\21\270|\30\212\303B\222\214\302\204\302"
  "\204$\217&\254\14\270|\30I\362Y\222\374\224\0\255\14\270|\30\311\302Dv\42\26N\256\14\270|"
  "\30\311\302Dv\42$c\257\22\270|\30I\222\302D\7\311\12I\207\302\204\204\22\260\12\270|\30I"
  "\366\263p\2\261\15\270|\30)$B\222%\311\77%\262\24\270|\30)C\262\5\211\5\11\205\11\205"
  "\11\311i$\1\263\14\270|\30\212\303B\362\237\7\25\264\16\270|\30\251\303Br\26\35\262\324\0\265"
  "\17\270|\30\212\303B\362)L\224\360(\1\266\17\270|\30\251\303Br\235\24\64$S\2\267\17\270"
  "|\30\212\303B\246\244FF\302\203\12\270\13\270|\30\311\302D\366i\1\271\13\270|\30I\362\377y"
  "P\1\272\16\270|\30I\362O#\42\204\204E\13\273\14\270|\30I\362\237%I!I\274\22\270|"
  "\30I\62\215\210\20\26\25\222\210\14\311\224\0\275\16\270|\30I\62\215\210\20\26\331i\1\276\14\270|"
  "\30\311\302Fu\62\26N\277\13\270|\30\212\224\354\221P\1\300\11\270|\30K\366\247\5\301\14\270|"
  "\30\212\204Fv\42$T\302\20\270|\30,f%!DA##\17\17\13\303\10\270|\30\177hN"
  "\304\14\270|\30KF'&\17\37\16\305\15\270|\30K\205\303\17\313\203E\13\323\13\270|\30i%"
  "!e\17\77\337\14\270|\30K\366D<X\264\0\340\11\270|\30K\366\247\5\341\14\270|\30K\205"
  "\303D\366\264\0\342\16\270|\30\37\210\12CD\2\213\36\26\0\0\0\4\377\377\0";


// ----------------------------------------------------------------------------------------
//            DCS.BIOS stuff here
// ----------------------------------------------------------------------------------------
void onDedLine1Change(char* newValue) {
  line1 = newValue;
}
DcsBios::StringBuffer<29> dedLine1Buffer(0x450a, onDedLine1Change);

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

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

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

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

// ----------------------------------------------------------------------------------------
//            SETUP Section
// ----------------------------------------------------------------------------------------
void setup() {
	DcsBios::setup();
  delay(100); // time to setup the display
  u8g2.begin();
  u8g2.clear();
  u8g2.setFont(u8g2_font_DEDFontNewInv);
//  u8g2.setContrast(255);  // brightness from 0 to 255
}
// ----------------------------------------------------------------------------------------
//            LOOP Section - Try to keep empty !!!
// ----------------------------------------------------------------------------------------
void loop() {
  DcsBios::loop();
// not all lines are refreshed at the same time, so it sometimes results in missing lines while DED manipulation
// therefore, the page buffer method is used to print all lines at once;
// if using the framebuffer, use -> clearBuffer() to only clear the buffer, clear() clears both buffer and screen which looks blinky
  u8g2.firstPage();
  do {
    u8g2.setCursor(x, y-1);
    u8g2.print(invertChars(line1));
    u8g2.setCursor(x, (2 * y) -1);
    u8g2.print(invertChars(line2));
    u8g2.setCursor(x, (3 * y) -1);
    u8g2.print(invertChars(line3));
    u8g2.setCursor(x, (4 * y) -1);
    u8g2.print(invertChars(line4));
    u8g2.setCursor(x, (5 * y) -1);
    u8g2.print(invertChars(line5));
  } while (u8g2.nextPage());
  u8g2.updateDisplay();
}

// ----------------------------------------------------------------------------------------
//            Supporting functions
// ----------------------------------------------------------------------------------------

String invertChars(String lineX) {                        // create a function, applied on each DED line and returning the manipulated string
  if (lineX.length() > 25) {                              // look for steering bits only if a line has more than 25 chars
    for (int j = 0; j < 4; j++) {                         // go through each of the 4 bytes
      for (int i = 0; i < 8; i++) {                       // go through each of the 8 bits per byte
        if (bitRead(lineX[25 + j], i) == 1) {             // start at char number 26 [string index is 25 !!!]; if steering bit equals 1 we found a to be inverted char
            int inverted = byte(lineX.charAt(j * 8 + i)); // read the byte value of the char from the string object into a local variable
            lineX.setCharAt(j * 8 + i, inverted + 100);   // replace the char by it's inverted version (byte of the char + 100 in the manipulated font)
        }
      }
    }
    lineX.remove(25, 4);                                  // remove the steering bytes from the string (chars 26 to 29) ...
  }														  // ... line is cut to 25 chars, so it passes the next loop without further manipulation (if > 25) 
  return lineX;                                           // function returns the manipulated line
}

 

Regards, Vinc

explain to me better what I have to do here:

Pinout for the MEGA2560 hardware SPI driver:

MOSI: 51  (SDA) hardware SPI

SCK: 52 (SCL) hardware SPI

SS/CS: 53 hardware SPI

DC = 6 (may be changed to any digital pin)

RST = 8 (may be changed to any digital pin)

Posted (edited)

Hi @uncino

sorry, that I can't reply while at work.

But fortunately you made it, probably by reading all the hints here in the postings 🙂

Congratulations!

I believe that you don't connected pin 3 and pins 6 to 13 of the display to the chip. Pin 5 DIN equals MOSI or SDA from the above post. Pin 4 CLK is the same like SCK / SCL from above.  Pins 16 CS, 15 RES and 14 D/C are simple to know. Pin 1 goes to GND and pin 2 pulls +5V. Do not use the 3.3V output of the Mega, as the level signals anyways are at 5 Volt.

 

Best regards, Vinc

Edited by Vinc_Vega

Regards, Vinc

real life: Royal Bavarian Airforce

online: VJS-GermanKnights.de

[sIGPIC][/sIGPIC]

Posted
12 hours ago, uncino said:

Obrigadooooooo. funciona

imagem.jpeg

Good evening.

I'm glad you achieved it!


I tested an Arduino MEGA here following what you did and the result is still the same as what I did on the Nano. Fewer housings as in my previous post.

Could you describe the connections you made on the Mega and the Arduino code you used?

Thank you for your kindness.

Posted
8 hours ago, CR77 said:

Good evening.

I'm glad you achieved it!


I tested an Arduino MEGA here following what you did and the result is still the same as what I did on the Nano. Fewer housings as in my previous post.

Could you describe the connections you made on the Mega and the Arduino code you used?

Thank you for your kindness.

Ok then the codes are these:
16 ssd1322 to 53 mega
5 ssd1322 to 51 mega
4 ssd1322 to 52 mega
15 ssd1322. to 8. mega
14 ssd1322 to. 6 mega.

also in the string you have to change:

U8G2_SH1122_256X64_F_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 53, /* dc=*/ 6, /* reset=*/ 8);
U8G2_SSD1322_256X64_F_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 53, /* dc=*/ 6, /* reset=*/ 8);

Let me know if it works

Posted

 

5 hours ago, uncino said:

Ok then the codes are these:
16 ssd1322 to 53 mega
5 ssd1322 to 51 mega
4 ssd1322 to 52 mega
15 ssd1322. to 8. mega
14 ssd1322 to. 6 mega.

also in the string you have to change:

U8G2_SH1122_256X64_F_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 53, /* dc=*/ 6, /* reset=*/ 8);
U8G2_SSD1322_256X64_F_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 53, /* dc=*/ 6, /* reset=*/ 8);

Let me know if it works

I tried to make the adaptations you suggested, but I got the error below.


PS. I'm using the code that Vinc_Vega adapted for you.

On 12/4/2024 at 6:36 PM, Vinc_Vega said:
 

Captura de tela 2024-12-06 124416.png

Posted
49 minutes ago, CR77 said:

 

I tried to make the adaptations you suggested, but I got the error below.


PS. I'm using the code that Vinc_Vega adapted for you.

Captura de tela 2024-12-06 124416.png

you have to delete this string:

Schermata 2024-12-06 alle 17.37.14.png

Posted (edited)

@CR77 

The proposed line already is excluded from compilation (see double slashes infont of the line "//").

Just use the right declaration for the display driver. Look for the included "_NHD_".

U8G2_SSD1322_NHD_256X64_F_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 53, /* dc=*/ 6, /* reset=*/ 8);

 

Regards, Vinc

 

Edit: I adpted the code in the above post for the questioned SSD1322 displays

Edited by Vinc_Vega

Regards, Vinc

real life: Royal Bavarian Airforce

online: VJS-GermanKnights.de

[sIGPIC][/sIGPIC]

  • Recently Browsing   0 members

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