Jump to content

TISL / Radio selector wheel display output


lesthegrngo

Recommended Posts

Gents, I have been trying to make a sketch for the TISL and radio unit selector wheel displays. The selector wheel itself is a rotary encoder, no problem, but the individual single digit displays are causing me some issues. The intention is to use those little OLED modules as they are small enough to fit and allow space for the rotary encoders underneath on the basis that it will be pretty crowded.

 

However no matter how I try it, I cannot get the digits to display properly on the OLED modules. I have successfully modified Middlfarts lovely scrolling altimeter sketch to use with the fuel quantity display, but when I splice in the code for the selector wheel displays, all I can get is it displays a 1 and a zero, which scrolls as you select up and down.

 

This is the sketch as it stands

 

#define DCSBIOS_DEFAULT_SERIAL

#include "DcsBios.h"

#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include "charactersbak.h"

#define SCREEN_WIDTH 64 // OLED display width, in pixels
#define SCREEN_HEIGHT 32 // OLED display height, in pixels
#define OLED_RESET     -1 // Reset pin # (or -1 if sharing Arduino reset pin)

//Comment for barometric pressure
#define ALTIMETER

int updateInterval = 100; //the number of milliseconds between updates

struct scrollDigit {
 int digit; //The digit that is displayed
 int y; // The vertical position of the digit
};

struct disp {
 Adafruit_SSD1306 display;
 int width;
 int numberOfDigits;
 scrollDigit digits[5];
};

#ifdef ALTIMETER
 disp oled = {Adafruit_SSD1306(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET), 24, 1, {{0,0},{0,0},{0,0},{0,0},{0,0}}};
#else
 disp oled = {Adafruit_SSD1306(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET), 16, 4, {{0,0},{0,0},{0,0},{0,0},{0,0}}};
#endif

void setup() {
 if(!oled.display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // Address 0x3C for 128x32
   for(;;); // Don't proceed, loop forever
 }

 DcsBios::setup();
}

void UpdateDisplay()
{
 oled.display.clearDisplay();
 for (int i = 0; i < oled.numberOfDigits; i++)
 {
   printScrollingDigit(oled.digits[i].digit, oled.width, oled.digits[i].y, i + 1, &oled);
 }
 //Clear the area below the the numbers if we are using the small font
 if (oled.width == 16)
 {
   oled.display.fillRect(0, 25, 67, 7, BLACK);
 }
 
 oled.display.display();
}

int YPos()
{
 return (oled.width + 9) * -1;
}

void printScrollingDigit(int digit, int width, int y, int pos, disp *oled)
{
 int x = (width * pos) - width + pos;
#ifdef ALTIMETER
   switch (digit)
   {
     case -1: oled->display.drawBitmap(x, y, c24_Empty, 24, 32, 1); oled->display.drawBitmap(x, y+33, c24_1, 24, 32, 1); break;
     case 1: oled->display.drawBitmap(x, y, c24_1, 24, 32, 1); oled->display.drawBitmap(x, y+33, c24_2, 24, 32, 1); break;
     case 2: oled->display.drawBitmap(x, y, c24_2, 24, 32, 1); oled->display.drawBitmap(x, y+33, c24_3, 24, 32, 1); break;
     case 3: oled->display.drawBitmap(x, y, c24_3, 24, 32, 1); oled->display.drawBitmap(x, y+33, c24_4, 24, 32, 1); break;
     case 4: oled->display.drawBitmap(x, y, c24_4, 24, 32, 1); oled->display.drawBitmap(x, y+33, c24_5, 24, 32, 1); break;
     case 5: oled->display.drawBitmap(x, y, c24_5, 24, 32, 1); oled->display.drawBitmap(x, y+33, c24_6, 24, 32, 1); break;
     case 6: oled->display.drawBitmap(x, y, c24_6, 24, 32, 1); oled->display.drawBitmap(x, y+33, c24_7, 24, 32, 1); break;
     case 7: oled->display.drawBitmap(x, y, c24_7, 24, 32, 1); oled->display.drawBitmap(x, y+33, c24_8, 24, 32, 1); break;
     case 8: oled->display.drawBitmap(x, y, c24_8, 24, 32, 1); oled->display.drawBitmap(x, y+33, c24_9, 24, 32, 1); break;
     case 9: oled->display.drawBitmap(x, y, c24_9, 24, 32, 1); oled->display.drawBitmap(x, y+33, c24_0, 24, 32, 1); break;
     default: oled->display.drawBitmap(x, y, c24_0, 24, 32, 1); oled->display.drawBitmap(x, y+33, c24_1, 24, 32, 1); break;
   }

#endif
}

#ifdef ALTIMETER
 
 
void onTislCode1Change(unsigned int newValue)
 {
   unsigned int mappedValue = newValue / 6553;
   unsigned int y = map(newValue, mappedValue * 6553, mappedValue * 6553 + 6553, 0, YPos());
 
   oled.digits[0].digit = newValue;
   oled.digits[0].y = y;
 }
 
   
 DcsBios::IntegerBuffer tislCode1Buffer(0x1116, 0xffff, 0, onTislCode1Change);
 

#endif

unsigned long time = 0;

void loop() {
 DcsBios::loop();

 time = millis();
 if (time % updateInterval == 0)
 {
   UpdateDisplay();
 }
}

 

I have also used another sketch that works with the altimeter data (someone else's, sorry but I can't remember whose), but again, it only displays a 1 or zero with the radio / TISL data

 

I am clearly misunderstanding what the output is supposed to be, can anyone advise on what I should be doing to show these?

 

Cheers

 

Les

Link to comment
Share on other sites

I niggled away at this and have made some good progress, however I have also highlighted some issues that I will have to be aware of going forward when using OLED displays. As I get most of my help from this forum, it seems only fair to put it here on this forum so that others can use it, and hopefully avoid some issues.

 

First off I have the code working for 128x32 and 128x64 modules (as you can see from the attached pictures - the 128x64 module is the one in my altimeter just for testing)

 

Here is the code for the 128x32 module that displays all four TISL digits

 

#define DCSBIOS_DEFAULT_SERIAL

#include "DcsBios.h"

#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include "charactersbak.h"

#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 32// OLED display height, in pixels
#define OLED_RESET     -1 // Reset pin # (or -1 if sharing Arduino reset pin)

//Comment for barometric pressure
#define TISL

int updateInterval = 100; //the number of milliseconds between updates

struct scrollDigit {
 int digit; //The digit that is displayed
 int y; // The vertical position of the digit
};

struct disp {
 Adafruit_SSD1306 display;
 int width;
 int numberOfDigits;
 scrollDigit digits[4];
};

#ifdef TISL
 disp oled = {Adafruit_SSD1306(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET), 30, 4, {{0,0},{0,0},{0,0},{0,0}}};

#endif

void setup() {
 if(!oled.display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // Address 0x3C for 128x32
   for(;;); // Don't proceed, loop forever
 }

 DcsBios::setup();
}

void UpdateDisplay()
{
 oled.display.clearDisplay();
 for (int i = 0; i < oled.numberOfDigits; i++)
 {
   printScrollingDigit(oled.digits[i].digit, oled.width, oled.digits[i].y, i + 1, &oled);
 }
 
 if (oled.width == 16)
 {
   oled.display.fillRect(0, 25, 67, 7, BLACK);
 }
 
 oled.display.display();
}

int YPos()
{
 return (oled.width + 9) * -1;
}

void printScrollingDigit(int digit, int width, int y, int pos, disp *oled)
{
 int x = (width * pos) - width + pos;
#ifdef TISL
   switch (digit)
   {
     case -1: oled->display.drawBitmap(x, y, c24_Empty, 24, 32, 1); oled->display.drawBitmap(x, y+33, c24_1, 24, 32, 1); break;
     case 1: oled->display.drawBitmap(x, y, c24_1, 24, 32, 1); oled->display.drawBitmap(x, y+33, c24_2, 24, 32, 1); break;
     case 2: oled->display.drawBitmap(x, y, c24_2, 24, 32, 1); oled->display.drawBitmap(x, y+33, c24_3, 24, 32, 1); break;
     case 3: oled->display.drawBitmap(x, y, c24_3, 24, 32, 1); oled->display.drawBitmap(x, y+33, c24_4, 24, 32, 1); break;
     case 4: oled->display.drawBitmap(x, y, c24_4, 24, 32, 1); oled->display.drawBitmap(x, y+33, c24_5, 24, 32, 1); break;
     case 5: oled->display.drawBitmap(x, y, c24_5, 24, 32, 1); oled->display.drawBitmap(x, y+33, c24_6, 24, 32, 1); break;
     case 6: oled->display.drawBitmap(x, y, c24_6, 24, 32, 1); oled->display.drawBitmap(x, y+33, c24_7, 24, 32, 1); break;
     case 7: oled->display.drawBitmap(x, y, c24_7, 24, 32, 1); oled->display.drawBitmap(x, y+33, c24_8, 24, 32, 1); break;
     case 8: oled->display.drawBitmap(x, y, c24_8, 24, 32, 1); oled->display.drawBitmap(x, y+33, c24_9, 24, 32, 1); break;
     case 9: oled->display.drawBitmap(x, y, c24_9, 24, 32, 1); oled->display.drawBitmap(x, y+33, c24_0, 24, 32, 1); break;
     default: oled->display.drawBitmap(x, y, c24_0, 24, 32, 1); oled->display.drawBitmap(x, y+33, c24_1, 24, 32, 1); break;
   }

#endif
}

#ifdef TISL
  
 
void onTislCode1Change(unsigned int newValue)
 {
   unsigned int mappedValue = newValue / 2;
   unsigned int y = map(newValue, mappedValue * 2, mappedValue * 2 + 3, 0, YPos());
 
   oled.digits[0].digit = newValue / 2;
   oled.digits[0].y = y;
 }
 
   
DcsBios::IntegerBuffer tislCode1Buffer(0x1116, 0x1f00, 8, onTislCode1Change);

void onTislCode2Change(unsigned int newValue)
 {
   unsigned int mappedValue = newValue / 2;
   unsigned int y = map(newValue, mappedValue * 2, mappedValue * 2 + 3, 0, YPos());
 
   oled.digits[1].digit = newValue / 2;
   oled.digits[1].y = y;
 }
 
   
DcsBios::IntegerBuffer tislCode2Buffer(0x111a, 0x1f00, 8, onTislCode2Change);

void onTislCode3Change(unsigned int newValue)
 {
   unsigned int mappedValue = newValue / 2;
   unsigned int y = map(newValue, mappedValue * 2, mappedValue * 2 + 3, 0, YPos());
 
   oled.digits[2].digit = newValue / 2;
   oled.digits[2].y = y;
 }
 
   
DcsBios::IntegerBuffer tislCode3Buffer(0x111e, 0x1f00, 8, onTislCode3Change);


void onTislCode4Change(unsigned int newValue)
 {
   unsigned int mappedValue = newValue / 2;
   unsigned int y = map(newValue, mappedValue * 2, mappedValue * 2 + 3, 0, YPos());
 
   oled.digits[3].digit = newValue / 2;
   oled.digits[3].y = y;
 }
 
   
DcsBios::IntegerBuffer tislCode4Buffer(0x1122, 0x1f00, 8, onTislCode4Change);
 

#endif

unsigned long time = 0;

void loop() {
 DcsBios::loop();

 time = millis();
 if (time % updateInterval == 0)
 {
   UpdateDisplay();
 }
}

 

I have to give credit to Middlefart for the base code that I used, essentially I have reverse engineered it for my purposes here.

 

So the issue was that the the numbers being generated were totally different to what I was expecting. In the case of the altimeter, I think the output was a number between 0 and 65535. However in the case of the TISL, depending on which way you choose you get 20 numbers.

 

I used 7 segment displays and LCD displays to get the outputs in a way that I could see. In the case of the integerBuffer, you get outputs of 0, 1, 2, etc all the way up to 19. In the case of stringBuffer it outputs 0, 0.5, 1, 1.5 etc up to 9.5.

 

As result, the original code was essentially converting everything to zeros and 1's, so by correcting the pull down value it allowed me to get the right numbers in the basic displays. From there it was a case of playing with the settings to get the numbers to 'scroll'.

 

After resolving the the output issue the first problem I had was very confusing display behaviour. My intention is to eventually use some 64x32 dot matrix 0.49" OLED modules, one for each digit between the selector wheels, so I was working to get one digit working on one 0.49" OLED. However when I loaded up the sketch, all I got was a truncated digit with just the bottom half showing with some random speckles on the other side of the screen. The resolution is set in the sketch, but for some reason it was not displaying correctly.

 

So I tried the unchanged sketch on one of the 128 x 32 OLED modules I have and suddenly it was displaying to digit correctly, albeit with the speckles remaining on the right hand side. I adjusted the resolution in the sketch to 128 x 32, and bingo, perfectly displayed. I played with the sketch to add the other three digits, and it worked beautifully.

 

Just out of curiosity I adjusted the resolution to 128 x 64 and connected it to the OLED module in my altimeter, and again, perfect.

 

So I reconnected went back to the sketch, adjusted the resolution back to 128 x 32 and reconnected the 128 x 32 module, and suddenly it was corrupted! What I was getting was the characters superimposing (see picture) and some speckles.

 

I realised that the 128 x 32 module I had connected was not the one I had earlier, so I reconnected the other one and it worked perfectly. I have therefore concluded that there are different types of OLED modules, and that by looking at them you cannot tell which is which. Depending on which one you connect it shows different things. The non-working ones appear to be modules that don't support SSD1306, even though they are I2C compatible.

 

So I have concluded that the 0.49" module I have is also not one that supports SSD3106, looking at the order I placed, so I think that I will have to try some different modules.

 

But with all this I also discovered a potential problem that may complicate my design. Assuming that I can get the 0.49" OLED to display properly, if I want to use multiple I2C devices on one Nano, as I did with the CMSM panel and the three LCD modules, I need to be able to assign individual I2C addresses to them. However the 0.49" modules have a static address (0x3c) and do not have the option to change it. The possible option is to use an I2C multiplexer, otherwise I have to resign myself to the use of multiple Nano's.

 

One other point I found was why I could get some Nano's to load the sketch and not others. I have some 'old' Nanos, which are obviously what Arduino IDE calls 'ATmega328P (Old Bootloader), and these can load this sketch, however some newer ones are ATmega168's that will not accept this code. Presumably an onboard memory issue, but now I know about it I can at least deal with it.

 

So success generally with some caveats, hopefully I can find a way around the issues and if I do will post it back here

 

Cheers

 

Les


Edited by lesthegrngo
Link to comment
Share on other sites

  • 3 weeks later...

All, I have continued to make progress on this, with a new bitmap library for the digits and getting the display to work on those little 64 x 32 OLEDS using the U8G2 library, which seems to work better on these

 

Using the test sketch below and the XBM.h library I made, I can individually call out the bitmaps pertaining to the different click wheel positions. So bitmap c24_3 for example will show you the bottom half of the 1 and the top half of the 2

 

Here's the test sketch, if you enter a number on the "u8g2.drawXBM( 0, 0, 64, 32, c24_XX);" line between 0 and 19 in place of the XX you will get the appropriate bitmap

 



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

U8G2_SSD1306_64X32_1F_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);

void setup() {
 u8g2.begin();
 u8g2.clearBuffer();
 u8g2.drawXBM( 0, 0, 64, 32, c24_19);
 u8g2.sendBuffer();
}


void loop()
{


}

 

But (there's always a but, isn't there!) what I need the sketch to do is to look up the 'value' parameter output by the following DCS BIOS command

 

"void onTislCode1Change(unsigned int value)

{

 

DcsBios::IntegerBuffer tislCode1Buffer(0x1116, 0x1f00, 8, onTislCode1Change);"

 

From testing I know that the output is an integer between 0 and 19, so logically if I put the bitmap names in an array like so

 

"unsigned char* aBitmaps[] = { c24_0, c24_1, c24_2, c24_3, c24_4, c24_5, c24_6, c24_7, c24_8, c24_9, c24_10, c24_11, c24_12, c24_13, c24_14, c24_15, c24_16, c24_17, c24_18, c24_19};"

 

in theory I can call up the bitmap from the array using the 'value' output integer created by the DCS BIOS code.

 

So this is what the code looks like, but as you guessed something is wrong and I cannot get it to display anything

 


#define DCSBIOS_DEFAULT_SERIAL

#include <DcsBios.h>
#include <Arduino.h>
#include <U8g2lib.h>
#include <Wire.h>
#include "XBM.h"

U8G2_SSD1306_64X32_1F_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);


void onTislCode1Change(unsigned int value) 
{

DcsBios::IntegerBuffer tislCode1Buffer(0x1116, 0x1f00, 8, onTislCode1Change);

 
unsigned char* aBitmaps[] = { c24_0, c24_1, c24_2, c24_3, c24_4, c24_5, c24_6, c24_7, c24_8, c24_9, c24_10, c24_11, c24_12, c24_13, c24_14, c24_15, c24_16, c24_17, c24_18, c24_19};


unsigned char* bitmap = aBitmaps[value];


u8g2.clearBuffer();
u8g2.drawXBM( 0, 0, 64, 32, bitmap);
u8g2.sendBuffer();
}
void setup() {
 u8g2.begin();

DcsBios::setup();
}


void loop()

{  
 DcsBios::loop();
}

 

It compiles and loads fine, it just doesn't display anything

 

So to test I wrote this sketch, where instead of referencing the DCS BIOS code output, value is set by a static unsigned int line. If you replace the number on that line with a number between 0 and 19, it looks up the correct bitmap in the array and displays it.

 


#define DCSBIOS_DEFAULT_SERIAL

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

#include "XBM.h"

U8G2_SSD1306_64X32_1F_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);

static unsigned int value = 7;

/*void onTislCode1Change(unsigned int value)
{

DcsBios::IntegerBuffer tislCode1Buffer(0x1116, 0x1f00, 8, onTislCode1Change);
*/

void setup() {

unsigned char* aBitmaps[] = { c24_0, c24_1, c24_2, c24_3, c24_4, c24_5, c24_6, c24_7, c24_8, c24_9, c24_10, c24_11, c24_12, c24_13, c24_14, c24_15, c24_16, c24_17, c24_18, c24_19};

unsigned char* bitmap = aBitmaps[value];

 u8g2.begin();
u8g2.clearBuffer();
u8g2.drawXBM( 0, 0, 64, 32, bitmap);
u8g2.sendBuffer();

DcsBios::setup();
}

void loop()

{
 DcsBios::loop();
}

 

So clearly something is wrong with how the DCS BIOS output is being handled. The array function is working fine, but I am unable to get the DCS BIOS output to work with the commands

 

If anyone can shed any light on this I would be very grateful (not to say relieved - this has been flummoxing me for a couple of weeks now)

 

Cheers

 

Les

XBM.h.txt


Edited by lesthegrngo
Link to comment
Share on other sites

I'm happy to report that due to the efforts of a long suffering guy over on the Arduino forum I now have this working. I need to tidy things up and make the definitive sketches and components, but we have another addition to the display sketches so that we can show individual click wheel windows

 

Cheers

 

Les


Edited by lesthegrngo
Link to comment
Share on other sites

  • 2 weeks later...

A quick update on this. As you can see my TISL lower panel is now basically finished, bar three 0.49" OLEDs needed to fill the gaps - they have been on order for a while, I don't think they'll be here any time soon in the current situation but that's fine.

 

The TILS panel is not a replica of the real thing, I've used artistic license to make it fit my cockpit build, but I'm happy with it. The rotary encoders work nicely and the selector wheels are smooth in action so together with the OLEDs showing the half way numerals correctly I achieved what I set out for. It has been the most complicated item I've designed and built so far and in the grand scheme of things probably was not the best use of the time and effort considering how little it adds in game - but I have to confess I am really pleased at how it turned out.

 

Next I need to turn my attention to using a TCA9548A multiplexer to allow me to make a sketch that enables me to control all 6 OLED's from one Nano, as the I2C addresses of these 0.49" OLEDs can't be changed. With any luck, due to the low refresh rate needed for this, I can run the six encoders, two toggle switches and the rotary switch off it too, but suspect I will be pin limited.

 

Hope you like it

 

Cheers

 

Les

20200511_170709.thumb.jpg.c7cf5b907fb714291affa78b7ae40628.jpg


Edited by lesthegrngo
Link to comment
Share on other sites

  • 3 weeks later...

The remaining OLED's and the multiplexer arrived yesterday, and I have fitted the parts in.

 

I had been looking at the sketch before the multiplexer arrived, but of course could not test it until today. I obviously have missed out the callouts somewhere, and so I would like some assistance with this sketch. This is what I have done so far

 

#define DCSBIOS_DEFAULT_SERIAL

#include <DcsBios.h>
#include <Arduino.h>
#include <U8g2lib.h>
#include <Wire.h>
#include "XBM1.h"     //64x32 XBM format

#define TCAADDR 0x70
void tcaselect (uint8_t i) {
 if (i > 7) return;

 Wire.beginTransmission(TCAADDR);
 Wire.write(1 << i);
 Wire.endTransmission();
}


U8G2_SSD1306_64X32_1F_F_HW_I2C u8g2_01(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);
U8G2_SSD1306_64X32_1F_F_HW_I2C u8g2_02(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);
U8G2_SSD1306_64X32_1F_F_HW_I2C u8g2_03(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);
U8G2_SSD1306_64X32_1F_F_HW_I2C u8g2_04(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);
U8G2_SSD1306_64X32_1F_F_HW_I2C u8g2_05(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);
U8G2_SSD1306_64X32_1F_F_HW_I2C u8g2_06(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);


const unsigned char* aBitmaps[] = {  
   c24_0, c24_1, c24_2, c24_3, c24_4, c24_5, c24_6, c24_7, c24_8,
   c24_9, c24_10, c24_11, c24_12, c24_13, c24_14, c24_15, c24_16,
   c24_17, c24_18, c24_19
};

void onTislCode1Change(unsigned int newValue)         
{
   u8g2_01.clearBuffer();
   u8g2_01.drawXBMP( 0, 0, 64, 32, aBitmaps[newValue]); 
   u8g2_01.sendBuffer();
}
DcsBios::IntegerBuffer tislCode1Buffer(0x1116, 0x1f00, 8, onTislCode1Change);

void onTislCode2Change(unsigned int newValue)         
{
   u8g2_02.clearBuffer();
   u8g2_02.drawXBMP( 0, 0, 64, 32, aBitmaps[newValue]); 
   u8g2_02.sendBuffer();
}
DcsBios::IntegerBuffer tislCode2Buffer(0x111a, 0x1f00, 8, onTislCode2Change);

void onTislCode3Change(unsigned int newValue)         
{
   u8g2_03.clearBuffer();
   u8g2_03.drawXBMP( 0, 0, 64, 32, aBitmaps[newValue]); 
   u8g2_03.sendBuffer();
}
DcsBios::IntegerBuffer tislCode3Buffer(0x111e, 0x1f00, 8, onTislCode3Change);

void onTislCode4Change(unsigned int newValue)         
{
   u8g2_04.clearBuffer();
   u8g2_04.drawXBMP( 0, 0, 64, 32, aBitmaps[newValue]); 
   u8g2_04.sendBuffer();
}
DcsBios::IntegerBuffer tislCode4Buffer(0x1122, 0x1f00, 8, onTislCode4Change);


void onTislAlt1000Change(unsigned int newValue)         
{
   u8g2_05.clearBuffer();
   u8g2_05.drawXBMP( 0, 0, 64, 32, aBitmaps[newValue]); 
   u8g2_05.sendBuffer();
}
DcsBios::IntegerBuffer tislAlt1000Buffer(0x1114, 0x0f00, 8, onTislAlt1000Change);


void onTislAlt10000Change(unsigned int newValue)         
{
   u8g2_06.clearBuffer();
   u8g2_06.drawXBMP( 0, 0, 64, 32, aBitmaps[newValue]); 
   u8g2_06.sendBuffer();
}
DcsBios::IntegerBuffer tislAlt10000Buffer(0x1112, 0xf000, 12, onTislAlt10000Change);


void setup()
{

 void DisplayInit(){
   for (int i = 0; i < 7; i++) {
     tcaselect(i);
   }
   u8g2_01.begin();
   u8g2_02.begin();
   u8g2_03.begin();
   u8g2_04.begin();
   u8g2_05.begin();
   u8g2_06.begin();
   
   DcsBios::setup();
}

void loop()
{
   DcsBios::loop();
}

 

 

If anyone can take a look and check the syntax and my callouts I would be very grateful!

 

Cheers

 

Les

Link to comment
Share on other sites

I am very pleased to report that the multiplexing sketch for the OLEDs is done and working beautifully, and with the OLED's installed they look great and are doing exactly what I hoped. The effort involved was way out of proportion to the in game result, but as mentioned before, this is one of those bits of the build that has given me a lot of pleasure.

 

One small minus is that I had to add spacers between two of the PCB's (this unit is only 140mm x 85mm but has a total of six PCB's!) which means that the mounting holes in my dash no longer line up, a bit of a bummer that. Still, mustn't grumble, I just have to find an alternative method.

 

The sketch is also lighter than I expected, which means that I can at least connect the 12 rotary encoder connections to the same nano should I wish to, but if I want to connect the rest of the TISL I will need another nano, or move to a Mega. If I choose the latter, now I have a bit more knowledge of how to use the I2C multiplexers, I could combine it with other displays. I know the left console has a number that I need to make (radios and so forth), and they are all ones that don't require fast refrsh rates, so they are ideal candidates.

 

Now, what's next on the long long list.....?!,

 

Cheers

 

Les

20200531_184018.thumb.jpg.1d5f058d478a11f6bb2738b9bbc6ebc4.jpg

Link to comment
Share on other sites

  • Recently Browsing   0 members

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