Jump to content

Recommended Posts

Posted

Hi all. I am in the process of building F16 simpit. I have been able to understand the simple panel scripts, but seem to have issues with UHF radio. Is there an example  script for the F16 UHF radio.

Thanks

  • 2 weeks later...
Posted

Sorry for the late REPLY

using DCS WORLD

using DCS-BIOS(virtual cockpit and com showing connected)

2 7 seg dispalys

ELEGOO MEGA2560

 

i am using the script from the A10C from my simpit.co.uk as an example, trying to use the UHF and UHF PRESET display using the F16 C  control reference for the radio.

Displays showing as script after uploading 

but cannot get feedback from aircraft when changing man freq or preset on dcs f16 

Attached script and photo of display after upload

hope this helps

20210423_000716.jpg

20210423_002250.jpg

dcs_a10c_radio_cluster_final_msp.ino

Posted
On 4/23/2021 at 12:24 AM, alzubair said:

Sorry for the late REPLY

using DCS WORLD

using DCS-BIOS(virtual cockpit and com showing connected)

2 7 seg dispalys

ELEGOO MEGA2560

 

i am using the script from the A10C from my simpit.co.uk as an example, trying to use the UHF and UHF PRESET display using the F16 C  control reference for the radio.

Displays showing as script after uploading 

but cannot get feedback from aircraft when changing man freq or preset on dcs f16 

Attached script and photo of display after upload

hope this helps

20210423_000716.jpg

20210423_002250.jpg

dcs_a10c_radio_cluster_final_msp.ino 7.38 kB · 5 downloads

 

Okay all is good. solved 

  • 4 years later...
Posted

 

Hello, I am trying to make a f16 uhf radio screen but I couldn't figure out the code part. Can you share how you solved the problem? Thank you very much in advance.

Posted (edited)

Hi there,

you may try this snippet for lc2

void onUhfFreqDispChange(char* newValue) {
	lc2.setChar(0,0,newValue[0],false);  // digit 1
	lc2.setChar(0,1,newValue[1],false);  // digit 2
	lc2.setChar(0,2,newValue[2],true);  // digit 3 with dot
	lc2.setChar(0,3,newValue[4],false);  // digit 4
	lc2.setChar(0,4,newValue[5],false);  // digit 5
	lc2.setChar(0,5,newValue[6],false);  // digit 6
}
DcsBios::StringBuffer<7> uhfFreqDispBuffer(0x45b2, onUhfFreqDispChange);

Depending on the order of your LEDs, you may swap the digits (newValue[0] to [6]).

Element 4 of the string (newValue[3]) is a dot and not a number, additionally the "true" on digit 3 than may be shifted to digit 4.

 

As the radio display code seems to be similar to that of the A-10, you also may adapt that of my OLED displays.

For the F16 you use the "UHF Manual Frequency Display" and "UHF CHAN Display" code snippets.

Spoiler
/*
  DCS World: A-10C II
  sketch for the UHF radio frequency and PRESET channel displays,
  workarounds to switch off the frequency displays necessary,
  chipset Arduino Mega 2560
  displays in use
  + 2.08" OLED SPI at 256x64 px for the frequency
  + 0.96" OLED I2C at 128x64 px for the PRESET channel
  09/2024   by Vinc_Vega
*/
#define DCSBIOS_IRQ_SERIAL
#include "DcsBios.h"

#include <Arduino.h>
#include <U8g2lib.h>
#include <SPI.h>
#include <Wire.h>

// ---------- Supporting Variables ----------
String UHFfrequency = "000.000"; int posX1 = 23; int posY1 = 55;
String UHFpreset = "00"; int posX2 = 30; int posY2 = 55;

// ---------- constructor for the display ----------
U8G2_SH1122_256X64_F_4W_HW_SPI u8g2_1(U8G2_R0, /* cs=*/ 53, /* dc=*/ 48, /* reset=*/ 49); // UHF frequency -> 2.08 inch SPI OLED @ 256x64 px
U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2_2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE); // UHF preset channel -> 0.96 inch I2C OLED @ 128x64 px

// ---------- manipulated Font -> DSEG14 Classic ----------
/*
  Fontname DSEG14 Classic 32pt
  Font edited by Vinc_Vega
  Glyphs 13/85
  BBX Build Mode 0
*/
const uint8_t u8g2_font_DSEG14_32[832] U8G2_FONT_SECTION("u8g2_font_DSEG14_32") = 
  "\15\0\5\5\5\6\6\4\7\35+\2\0+\0+\0\2\363\0\0\3#*\300{%q<\252r\215"
  " T!\10C\230\302\61\221 \24\202\10\1\11B!\210\20\220\60\20b\14\1\11\3!\306\20\220@"
  "\14B\20\1\11\304 \4\21\220P\10\42\24\1\21EH\4\62\210\200\14d\20\1\31\10\31\302A\20"
  "\62\204\203 E\10C\20\12b\202\60\4\241\34*PEHB\20\222 \210%,B\10I\10B\22"
  "\12\25\250\303\4a\10BA\212\20\206 \24\204\14\341 \10\31\302A\220A\4d \203\10\310@D"
  "\21\22\201\204B\20\241\10H \6!\210\200\4b\20\202\10H\30\10\61\206\200\204\201\20c\10H\20"
  "\12A\204\200\4\241\20D\10\310<\302\24\206\20\204*\4\343*\325\0\0.\13\245\20\63\31\206\360\204"
  "!\0\60s{%q<\252r\215 T!\10C\230\302\61\21(\4\4\12\1yC@\336\20\20G"
  "\4\304\21\1iE@X!\20F\14\204\21\3a\3A\330@\20&\24\204\11\345\250\305\25\266p\213"
  "z\230\200!E`\10\31\30B\6\206\14\202!\203`\210(\30\22\212\206\4\302!\201pH\30\36\22"
  "\206\207\4\1\42A\200\310<\302\24\206\20\204*\4\343*\325\0\0\61\64\353\244u\234\202\64\34\202\10"
  "\201 B \306\20\210\61\4B\20\201\20D B\21\22\201\14d\34\344 F\61\12\201\206$P\1"
  "\15\207\374\377\320\220\202\0\0\62\63y\65q\34\252q\215*\4c\12C%\377\77;\264$\10ly"
  "\311\7Jp\5;\252$Z\314\202\22\225\250\203\35\254p\205\17\300\251T\343\32\325\0\0\63\63y\65"
  "q\34\252q\215\252L\37\200\302\25\354\250\222h\61\13JT\242\16v\260\302\25>\0\223\267\274$\10"
  "v\250\344\377'\246\60\204*\4\341\32\325\0\0\64%\373$u\34\202\33\204\241\36\23\375\177\363\250E"
  "HF\22\4\261\204\245$#\11\2\36.\371\377\341!\7\1\0\65\60y%q<\252q\205 Ta"
  "\10\223 *\371\377\352`\205\220\274\345%\37\270\242;\330\301\22\225\250\245J\262\243+\372@\230J\65"
  "\256Q\5\0\66\61{%q<\252r\215 Tc\10\23!.\371\377\356\200\205\220\214\244,a\21B"
  "HF\22\212zL\364\377\315#La\10A\250B\60\256R\15\0\67\61\327\64{\34\252p\205jL"
  "\37`B\25\350h\222d\21\13ILb\16t\240B\25>\70\23T\201\216&I\26\261\220\304$\346"
  "@\7*TA\2\70\64{%q<\252r\215 T!\10C\230\302\61\321\377\67\217Z\204d$A"
  "\20KX\204\20\222\221\204\242\36\23\375\177\363\10S\30B\20\252\20\214\253T\3\0\71\60{%q<"
  "\252r\215 T!\10C\230\302\61\321\377\67\217Z\204d$A\20KXJ\62\222 \340\341\222\377\37"
  "\231\302\60\252\20\214\253T\3\0A.;%u<\252r\215 T!\10C\230\302\61\321\377\67\217Z"
  "\204d$A\20KX\204\20\222\221\204\242\36\23\375\177\363\250C\10n\20\0\0\0\0\4\377\377\0";

// ---------- DCS Bios Snippets here ----------
// print the UHF frequency to display #1 (256x64)
void onUhfFrequencyChange(char* newValue) {
  UHFfrequency = newValue;
  printFrequency();
}
DcsBios::StringBuffer<7> uhfFrequencyBuffer(0x1180, onUhfFrequencyChange);

// print the UHF preset to display #2 (128x64)
void onUhfPresetChange(char* newValue) {
  UHFpreset = newValue;
  printPreset();
}
DcsBios::StringBuffer<2> uhfPresetBuffer(0x1188, onUhfPresetChange);

// ---------- Setup Section ----------
void setup() {
  DcsBios::setup();

// initiate frequency display (#1)
  u8g2_1.begin();
  delay(100); // wait a moment
  u8g2_1.clearBuffer();					// clear the internal memory
  u8g2_1.setFont(u8g2_font_DSEG14_32);	// choose a suitable font
  printFrequency();

// initiate preset display (#2)
  u8g2_2.begin();
  delay(100);
  u8g2_2.clearBuffer();					// clear the internal memory
  u8g2_2.setFont(u8g2_font_DSEG14_32);	// choose a suitable font
  printPreset();
}

// ---------- Loop Section (try to keep empty) ----------
void loop() {
  DcsBios::loop();
}

// ---------- Supporting Functions ----------
void printFrequency() {
  u8g2_1.clearBuffer();
  if (byte(UHFfrequency.charAt(0)) == 46) // read the byte value of the first character, 46 = SPACE
  {
    u8g2_1.clearDisplay();  // blank the display in case of an empty string
    u8g2_1.sendBuffer();
  }
  else
  {
    u8g2_1.setCursor(posX1, posY1);
    u8g2_1.print(UHFfrequency);
    u8g2_1.sendBuffer();
  }
}

void printPreset() {
  u8g2_2.clearBuffer();
  u8g2_2.setCursor(posX2, posY2);
  u8g2_2.print(UHFpreset);
  u8g2_2.sendBuffer();
}

 

Regards, Vinc

Edited by Vinc_Vega
typo correction
  • Like 1
  • Thanks 1

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...