Jump to content

dracosb

Members
  • Posts

    9
  • Joined

  • Last visited

Everything posted by dracosb

  1. Hi Rapti .. You can use a single Nano for ALL the 6 main UFC screens, thats scratch pad and the 5 option displays. You will need a Multiplexer board which allows up to 8 screens from a single I2C connection. Thats the method I used for my UFC project. The code I posted above uses the multiplexer method. Far cheaper than a Nano for each screen AND frees up those USB ports.. have a look at the linked page. It explains the multiplexer very well. https://diyfactory007.blogspot.com/2018/11/tca9548a-i2c-multiplexer-module-with.html You can get the multiplexer for as little as £3.99 on Amazon, although it might be more expensive if you want next day delivery. Hope this helps .. Glenn
  2. Glad you solved it ECV56_Polten. Don't know why I didn't think of that because I used the atoi function when I was doing my RPM code for the F18C IFEI display.
  3. Hi ECV56_Polten... I just tried the Speed displayed to a little 2 inch SPI TFT I have. The code is below. #define DCSBIOS_IRQ_SERIAL #include "SPI.h" #include "Adafruit_GFX.h" #include "Adafruit_ST7789.h" #include "DcsBios.h" #define TFT_DC 9 #define TFT_CS 10 #define TFT_RST 8 #define TFT_MOSI 11 #define TFT_SCLK 13 #define TFT_MISO 12 Adafruit_ST7789 tft = Adafruit_ST7789(TFT_CS, TFT_DC, TFT_MOSI, TFT_SCLK, TFT_RST); #define WHITE 0xFFFF // colors for Adafruit_GFX #define BLACK 0x0000 // colors for Adafruit_GFX unsigned int KMH; unsigned int KNOTS; /* paste code snippets from the reference documentation here */ void onIasEuIntChange(unsigned int newValue) { /* your code here */ KMH = newValue; } DcsBios::IntegerBuffer iasEuIntBuffer(0x042a, 0xffff, 0, onIasEuIntChange); void onIasUsIntChange(unsigned int newValue) { /* your code here */ KNOTS = newValue; } DcsBios::IntegerBuffer iasUsIntBuffer(0x042c, 0xffff, 0, onIasUsIntChange); void setup() { ScreenSetup(); DcsBios::setup(); } void loop() { DisplayScreen(); DcsBios::loop(); } void ScreenSetup(void) { tft.init(240, 320); // Init ST7789 320x240 tft.setRotation(3); tft.fillScreen(BLACK); tft.setTextColor( WHITE, BLACK); } void DisplayScreen(void) { tft.setCursor(15, 30); tft.setTextSize(3); tft.println(" Speed Test"); tft.setCursor(15, 60); tft.print(" KMH : "); tft.print(KMH); tft.setCursor(15, 90); tft.print(" Knots : "); tft.print(KNOTS); } Although the update was a little slow and slighlty different from the HUD speed (in Knots, F18C). I was getting about 6 Knots fast on the knots reading, and as I said a slow update speed of once every few seconds. not sure about the actual KMH as the F18 doesn't show it on the HUD. I tried the above DCS BIOS commands and the variants that use a char* instead of the unsigned int. All worked. Hope this helps you out.
  4. Display Problem Hi ECV56_Polten I currently have 11 Oled screens displaying things for the F18. I found I always had problems trying to directly print the newValue out so after several trys I found a solution that works for me. I'm reasonably new to this as well so there may be better ways to do it. I modified your code .. so give it a try. It might work. #include "DcsBios.h" LiquidCrystal_I2C lcd(0x27, 16, 2); unsigned int Speed; // create global variable visible in all the program void setup() { // put your setup code here, to run once: ScreenSetup(); DcsBios::setup(); } void loop() { DisplayScreen(); DcsBios::loop(); } void onIasEuIntChange(unsigned int newValue) { /* your code here */ Speed = newValue; // copy to the global variable } DcsBios::IntegerBuffer iasEuIntBuffer(0x042a, 0xffff, 0, onIasEuIntChange); void DisplayScreen(void) { lcd.setCursor(0,1); lcd.print(Speed); // print to screen } void ScreenSetup(void){ lcd.init(); lcd.backlight(); lcd.clear(); lcd.setCursor(0,0); lcd.print("kmh"); }
  5. Hi .. Try adding #include "Wire.h" to get the Pots working. I also use a 2 x Megga on F18, (one for UFC and other switches, the other for the lower panels you can see in the pics), and have HUD, AMPCD, LEFT DDI, RIGHT DDI, FORMATION, POSITION and HMD brightness controls mapped. All working perfectly.
  6. Not connectign HI .. I had the same problem of DCS Bios not connecting. I had moved my saved games folder to my other SSD drive (same one DCS is installed on). When I moved my saved games folder back onto the C: drive everything works fine. Hope this helps ...
  7. Hi Les Here's the UFC sketch I made. Not all my own work as I copied some bits from online examples etc to help me figure it out. I've commented as much as I can. I hope it helps. Like I said earlier i'm a complete novice at this so there may well be better more efficient ways of doing the code, but I got it to work. So i'm really pleased with it. UFC_Final.zip
  8. Thanks for the advice Lesthegrngo, my first time posting on here so I messed up a bit lol, although i've been a member for years :music_whistling: My space is pretty limited so I can't make anything bigger than what the pics show.. I'm a complete novice at Arduino and Code but i'll help if I can.
  9. Hi Lesthegrngo I to have been going through trying to get Oleds working on my UFC button box project for the F18C. It's been frustrating learning DCS BIOS and Arduino from scratch. Fun wierdly. Keep plugging away and you'll get there. I decided to use the u8glib library over Adafruit. To me it seems it's got better features and lots of fonts to choose from. Although I did use the Adafuit for testing my multiplexer out. I finally finished getting my box working over the last few days. Thought i'd post a few pics. Still messing around with the fonts for the scratchpad. Looks to me like DCS used a custom font as whenever I typed in GPS data the degree symbol came up as the @ symbol. Think i've sorted it now ...
×
×
  • Create New...