

questerymj01
-
Posts
4 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by questerymj01
-
-
引用2024/12/10 AM7点33分,Vinc_Vega说:
Finally my SSD1322 display arrived from Aliexpress. Nine days from China to Germany, normal shipping, that`s great!
Display arrived the factory style, configured for the 80xx parallel bus.
Like already written here in the posts, to convert it into 4 wire SPI configuration, resistors R5 and R6 had to be swapped.
As this is at zero Ohm, R6 carefully may be snipped off the board and jumper R5 could be bridged by a solder blob.
Connection to the LOLIN ESP32 S2 Mini has been done as already proposed:
OLED -> LOLIN S2 Mini 1 -> GND 2 -> 3.3V 4 -> 7 CLK hardware SPI 5 -> 11 MOSI hardware SPI 14 -> 6 DC 15 -> 8 RST (may be changed to any digital pin) 16 -> 12 CS hardware SPI
The display is quick responsive to the F-16 DED with hardware SPI and the driver must read:
U8G2_SSD1322_NHD_256X64_F_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 12, /* dc=*/ 6, /* reset=*/ 8);
I think that this display may replace that in my CMSP panel, so I did a quick sketch and custome fonts for the A-10C that already looks great.
Please find below the adapted F-16 DED sketch for the S2 Mini and SSD1322 display.
//F-16 DED for DCS BIOS using 256x64 SSD1322 OLED connected to a LOLIN ESP32 S2 Mini, //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_DEFAULT_SERIAL // for ESP32 and other chipsets #define DCSBIOS_DISABLE_SERVO // for ESP32 chipsets #include "DcsBios.h" #include <SPI.h> #include <U8g2lib.h> /* SSD1322 OLED -> LOLIN S2 Mini connections 1 -> GND 2 -> 3.3V 4 -> 7 CLK hardware SPI 5 -> 11 MOSI hardware SPI 14 -> 6 DC 15 -> 8 RST (may be changed to any digital pin) 16 -> 12 CS hardware SPI upload in the Arduino IDE: "Tools" -> Board: -> esp32 -> LOLIN S2 Mini */ U8G2_SSD1322_NHD_256X64_F_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 12, /* dc=*/ 6, /* reset=*/ 8); // display driver for the hardware SPI // ---------------------------------------------------------------------------------------- // Declaration of the variables // ---------------------------------------------------------------------------------------- String(line1), (line2), (line3), (line4), (line5); // create a string object for each line to manipulate the content of the DED lines byte brightness = 255; // brightness from 0 to 255 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.setContrast(brightness); u8g2.setFont(u8g2_font_DEDFontNewInv); } // ---------------------------------------------------------------------------------------- // LOOP Section - Try to keep empty !!! // ---------------------------------------------------------------------------------------- void loop() { DcsBios::loop(); u8g2.firstPage(); do { u8g2.clearBuffer(); 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
Thanks for reply Vinc! I just follow this post and use the exactly same pin define and code you posted, the comtroller is esp32 s2 mini too.
Do you use any special driver for your esp32 s2 mini? I can't fugure out other reason...
引用2小时前,scuba82说:Not 1:1 related to you issue but maybe worth to mention:
The ESP32-S2 and S3 boards seem to suffer from Bug related to serial communication. E.g: https://github.com/espressif/arduino-esp32/issues/10323
When sending and receiving data over it's native USB serial interface the USB connection will stall.
We've run into that issue while using a ESP32-S2 as a F/A18-C UFC controller. (sending and receiving data)
Since you're only receiving DCS-BIOS data in your DED project you shouldn't be affected.
Yes I only receive data from dcs-bios in DED, I just wonder other people (include Vinc) successful on HW SPI mode on esp32 s2 mini, I wish I can do it too
-
Thank you Vinc! It's the esp32 s2 mini (purple pcb) I keep struggling with. I bought 2 and they have the same problem.
I had study about this and can successful upload it. I think the upload is successful, because when I change the code from SW SPI to HW SPI it appear different.I bought these from one supplier in ali and can't make sure if they are fault, just can't made the HW SPI to work.
-
Sorry to bothering here again about the same question.
I'd bought another SSD1322(16pin) to test again. The situation is the same:
1.I use the same pin setting and code from vinc for ESP32 S2 mini and SSD1322.
2.The HW SPI mode just never work (black), the SW SPI mode work but EXTREMELY SLOW. I guess the code and pin is correct but some other thing wrong.
The result this time is same as before. I guess I must have some problem on ESP32 or driver, could anyone successful make it work give me some more detail about using it?like the drive you use, the setting in arduino IDE for board, etc...Thanks in advanced.
F16 DED with SSD1322 and DCS BIOS
in Home Cockpits
Posted
Thanks Vinc, I had try to include these URL and upload again, still not work...:(
I guess I should pass this one and back to mega2560 SW mode, I got bad luck with s2 mini but I will keep looking at this thread for more information. Thank you again!