Jump to content

F16 DED with SSD1322 and DCS BIOS


wiggles5289

Recommended Posts

I'm having trouble getting the sketch to compile. I am using the ESP32 and SSD1322. It is all the code from above except I changed the display (probably also incorrectly coded). The error message is: (I am a coding dummy.) (ESPServo.h is installed and same result when added to the sketch.)

 

Spoiler

In file included from c:\Users\A321c\OneDrive\Documents\Arduino\libraries\DCS-BIOS_FP-Fork\src/internal/Servos.h:6,
                 from c:\Users\A321c\OneDrive\Documents\Arduino\libraries\DCS-BIOS_FP-Fork\src/DcsBios.h:126,
                 from C:\Users\A321c\AppData\Local\Temp\.arduinoIDE-unsaved2024225-24136-hqzzce.ibti\sketch_mar25a\sketch_mar25a.ino:9:
C:\Users\A321c\AppData\Local\Arduino15\libraries\Servo\src/Servo.h:77:2: error: #error "This library only supports boards with an AVR, SAM, SAMD, NRF52 or STM32F4 processor."
 #error "This library only supports boards with an AVR, SAM, SAMD, NRF52 or STM32F4 processor."
  ^~~~~
C:\Users\A321c\AppData\Local\Temp\.arduinoIDE-unsaved2024225-24136-hqzzce.ibti\sketch_mar25a\sketch_mar25a.ino:12:10: fatal error: ESP32servo: No such file or directory
 #include <ESP32servo>
          ^~~~~~~~~~~~
compilation terminated.
exit status 1

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_DEFAULT_SERIAL
#include "analogWrite.h"  //to use the ESP32 chip with DcsBios   https://www.arduino.cc/reference/en/libraries/esp32-analogwrite/
#include "DcsBios.h"
#include <SPI.h>
#include <U8g2lib.h>
 
U8G2_SSD1322_NHD_256X64_F_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ PA2, /* dc=*/ PA1, /* reset=*/ PA0); // Enable U8G2_16BIT in u8g2.h
//U8G2_SH1122_256X64_F_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 5, /* dc=*/ 21, /* reset=*/ 22);        // 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
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);
}
// ----------------------------------------------------------------------------------------
//            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
  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 (see: if lineX.length > 25)
  return lineX;                                           // function returns the manipulated line
}

 


Edited by Enabler

GD ViperWorks - YouTube

F-16CM Block 50 Replica Sim Pit Construction

Link to comment
Share on other sites

  • 2 weeks later...

@Enabler Sorry for the late reply,

some changes in the Skunkworks fork do that the code no longer compiles if a separate analogWrite library is in use for ESP32 chipsets.

Just delete the #include "analogWrite.h" line and add the following line below the #define DCSBIOS_DEFAULT_SERIAL entry

#define DCSBIOS_DISABLE_SERVO

 

Regards, Vinc


Edited by Vinc_Vega

Regards, Vinc

real life: Royal Bavarian Airforce

online: VJS-GermanKnights.de

[sIGPIC][/sIGPIC]

Link to comment
Share on other sites

  • Recently Browsing   0 members

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