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.