Assistance requested for a 64 x 32 OLED sketch

All, I'm looking for some help in defining a simple sketch that takes a variable output by a system, and displaying that as a single character on a 64 x 32 I2C OLED.

The variable being output by the program (in this case an aircraft sim) is a set of numbers going from 0 to 9.5 in 0.5 increments, e.g. 0, 0.5, 1, 1.5 etc.

I have written the following sketch that displays the output on the OLED screen

// Display - https://pmdway.com/collections/oled-displays/products/0-49-64-x-32-white-graphic-oled-i2c
// Guide - https://pmdway.com/blogs/product-guides-for-arduino/tutorial-using-the-0-49-64-x-32-graphic-i2c-oled-display-with-arduino

#define DCSBIOS_DEFAULT_SERIAL

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

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

void onTislCode1Change(char* newValue) {
    /* your code here */
  u8g2.clearBuffer();
  u8g2.setFont(u8g2_font_inb24_mr );
  u8g2.setCursor(0, 24);
  u8g2.print(newValue);
  u8g2.sendBuffer();
}
DcsBios::StringBuffer<3> tislCode1StrBuffer(0x1118, onTislCode1Change);

void setup() {
  u8g2.begin();

DcsBios::setup();
}
// fonts https://github.com/olikraus/u8g2/wiki/fntlistall#4-pixel-height

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

What I really would like to do is have the numbers correspond to specific bitmaps, as the output is supposed to replicate a 20 position click wheel. While 1 equals 1 on the display, 1.5 actually corresponds to the lower half of the 1 numeral at the top, and the top of the number two numeral at the bottom. It doesn't have to scroll, just show those 20 'characters'. It would also allow me to turn the display through 90 degrees to maximise the size of the display

I can do the bitmaps myself (I believe they have to be multiples of 8 wide, do they have to be multiples of 8 tall?) however I can't get my head around the 'if newValue = then....' commands that i believe that you need to do this. I think that the bitmaps can be stored as 1 and 0 matrices on the sketch

So how would this be done?

The intention would be to have the sketch running from a nano, and there are four of these displays required - as they have un-assignable addresses, I would either have to run four Nanos or use a multiplexer, but I'll deal with that later

Let me know what else I need to provide in the way of info

Thanks for looking

Cheers

Les

Hi all, there is a similar post over on the Displays and OLED forum, however that is more the mechanics of the use of bitmaps with an OLED, however part of it is how the particular bitmap is called out.

There is a program that outputs a number. What I really would like to do is have the numbers correspond to specific bitmaps, as the output is supposed to replicate a 20 position click wheel. The output from the program is a number, from 0 incrementing in steps of 0.5 up to 9.5.

As I understand it, I require the 'if' argument to look at the output value, and then assign it to a specific object, in this case a bitmap.

so if the output value is X, I would like it to output bitmap 'Y'

What is the coding required to achieve this, and would the bitmaps be best put into a bitmap.h file?

Thanks

Les

Merged topics

Is the code in the original post complete ?
Does it compile and what is the name of the bitmap it outputs ?

Not used this library myself, but looking at the API....

But can you not use setClipWindow?

If you look at the example on that page you will see it is clipping text. You just need to print the the two digits, one above the other, to get the effect you require. No bitmaps needed.
Using this approach you don’t have to restrict yourself to 0.5 steps either. Although I’d suggest you pass a numeric (floating point or implied fixed point integer) into the function and not a string.

However, if I was doing it with a bitmap I’d define a bitmap for the entire range of numbers as a single long strip. Then use setClipWindow to define the area, and draw the bitmap within the window so the appropriate section displays. The one thing that’s not clear to me though is if it’s possible to use “negative” coordinates that would be needed to achieve this. Unfortunately from the documentation it seems like all coordinates in the library is uint types, which seems to imply positioning things on the negative side of the origin may not be possible. IMHO that’s somewhat of a limiting choice for a graphics library, it should use signed types...

There was a recent thread about scrolling digits individually. Your application is simply two big jumps.

Look at how digits are rendered from a font. The complicated part is calculating the address of the appropriate bitmap in Flash memory.

Then the bitmap is plotted to your display row by row for the full height of the letter.

You just need to do the same thing with top-half and bottom-half. But use the bottom rows from one letter with the top rows of another letter.

Yes, you can make your own bitmap instead of using a standard font. This makes the calculations easier.

David.

UKHeliBob:
Merged topics

Is the code in the original post complete ?
Does it compile and what is the name of the bitmap it outputs ?

Hi there

edited as I think I misinterpreted the question in my first reply

Yes, the code is complete, it compiles fine and the output on the OLED screen is the 0 to 9.5 string in increments of 0.5 units.

Edited partIt does not output a bitmap, it outputs characters which are the numbers pulled from the game. I want the output to be used to reference a particular bitmap that corresponds to what you would see on the screen

That bit works perfectly, however as the need is to show an image of a digit halfway between the two numbers instead of a number and a half, that's where I have the need for the output to call out the bitmap.

Of course, it needs only call the bitmap for the x.5 digits, as the single integer output for the integers would be fine, the problem will be matching the fonts.

That means that there are a total of 20 variables

Cheers for your help

Les

Please start by explaining what DcsBios is and where in the sketch the name of the image file to be displayed is specified

pcbbc:
Not used this library myself, but looking at the API....

But can you not use setClipWindow?

If you look at the example on that page you will see it is clipping text. You just need to print the the two digits, one above the other, to get the effect you require. No bitmaps needed.
Using this approach you don’t have to restrict yourself to 0.5 steps either. Although I’d suggest you pass a numeric (floating point or implied fixed point integer) into the function and not a string.

However, if I was doing it with a bitmap I’d define a bitmap for the entire range of numbers as a single long strip. Then use setClipWindow to define the area, and draw the bitmap within the window so the appropriate section displays. The one thing that’s not clear to me though is if it’s possible to use “negative” coordinates that would be needed to achieve this. Unfortunately from the documentation it seems like all coordinates in the library is uint types, which seems to imply positioning things on the negative side of the origin may not be possible. IMHO that’s somewhat of a limiting choice for a graphics library, it should use signed types...

I can see how that would do what I want, but suspect that for my limited abilities that may actually be a more complicated way.

The other advantage of me learning how to use the 'if' function (assuming that's the correct one) to define an outcome based on an output is that in the rest of my project I can see multiple instances of it. What I am doing is using this to replicate some old analogue technology - you remember the old radios that had a wheel you rotated to select volume or channel and it had detents that held the wheel in a certain place? Well, the cockpit I'm making has plenty of old equipment like that

The other advantage is that I won't be limited to letters if I can use bitmaps. I can devise my own characters or symbols and they would be called out as and when I need.

Anyway, thanks for pointing that out, I certainly won't disregard it as it may be a solution for other parts of the project - there are lots of things still to do

Many thanks for helping!

Les

UKHeliBob:
Please start by explaining what DcsBios is and where in the sketch the name of the image file to be displayed is specified

Sure, no problem

DCS World is a simulation game that allows you to fly various aircraft or helicopters - a quick Google will give you more detail. It is a very very detailed simulation, and I am building a cockpit that replicates the A10C aircraft that will work with the sim.

In most cases with these types of game / sims, you have the option of using your own input devices or commercially made devices (Think joystick and throttles - Thrustmaster Warthog and HOTAS for example) so that you feel like you are more engaged.

However most times you are limited to inputting to the game, but have to rely on the on-screen instruments to represent the data coming out of it - Engine RPM, altitude, airspeed ets.

Then along comes a very clever chap over on the DCS forums who wrote a fantastic bit of software called DCS BIOS that 'listens' to the game, and outputs in the form of integers, strings, and other bits of code information that using arduinos can be used to drive real world instruments. Due to his efforts I have fully working analogue engine gauges, fuel gauges etc using stepper motors, countermeasures and radio displays using LCD displays, CDU using an Arduino Uno and a 5 inch TFT screen....... and the list goes on. I can post pictures if you wish, but if you search for some of my other posts you will see some I have already put up.

But the DCS bios does not output a bitmap, only a series of numbers, depending what it is being replicated. For instance, a gauge output will be a number between 0 and 65535, so any gauge I make I have to adjust the code so that 0 is 0 and 65535 is 100% of the desired range of the gauge.

For things like the countermeasure panel, it will output a string of characters that you then get the LCD to print

For this particular item (called a TISL if you are interested) the output from the BIOS to the Arduino is a number, in this case between 0 and 9.5, in increments of 0.5. the bits of code that calls it out is this

"void onTislCode1Change(char* newValue) {
}
DcsBios::StringBuffer<3> tislCode1StrBuffer(0x1118, onTislCode1Change);"

So the newValue parameter is the one that is being looked at, and if newValue equals say 1.5, I want to be able to tell the OLED to display a bitmap (that I will make myself) that shows the bottom half of the character 1 and the top half of the character 2

It's easy to get wrapped up in all this and forget that other people aren't even aware of it, so I apologise if it was a bit confusing before, and I hope this helps explain!

Cheers

Les

Lesthegringo:
I can see how that would do what I want, but suspect that for my limited abilities that may actually be a more complicated way.

Nope, you way is definitely harder. :wink:

Something like (as I said I haven't used this library, so untried and untested)...

void onTislCode1Change(float value) {
  int intValue = (int)value;
  u8g2.clearBuffer();
  u8g2.setFont(u8g2_font_inb24_mr );
  u8g2.setClipWindow(0, 0, 24, 24);
  u8g2.setCursor(0, 24);
  u8g2.print(intValue);
  u8g2.setCursor(0, 24 - (value - intValue) * 24);
  u8g2.print(intValue+1);
  u8g2.setMaxClipWindow();
  u8g2.sendBuffer();
}

You may need to do some adjustments of the calculations for positioning of the cursor and the clip window.

I also changed the function to take a floating point value. You can easily convert from your string to a float if required.

Yes, you can ise if statements to achieve your goal. However it involves coding each individual case separately. When you have to repeat the same task by repeating code, but with different data each time, you are almost certainly going about it wrong... The correct programming construct to use in such scenarios is an array.

Thanks - let me have a go at that, to clarify do I still have to make a long bitmap that it looks up?

Cheers

Les

Lesthegringo:
Thanks - let me have a go at that, to clarify do I still have to make a long bitmap that it looks up?

No, you only need that if you are going the bitmap route. If you are using the "print with fonts" method as above, you do not need a bitmap.

I accept bitmaps do have some advantages. Ability to include symbols and graduations for example, as you have already mentioned. They also have some disadvantages; storage space for one.

Ok, I tried it, and it displays the digit 1, but there is no reaction to changes in the number so 1 is the only number that appears - so 1 appears no matter what the output is

Changing things to try and reference the newValue char* and then trying to reference it back didn't work, and I have to say that I don't understand what it's trying to do!

The sketch compiles and loads OK but it looks like the changes are not being registered

Cheers

Les

I am still interested in using a set of bitmaps and an 'if' argument for this

Take a look at this .h file, basically if I can reference the bitmap name ( eg c24_19 to show halfway between 9 and zero) when 9.5 is the 'newValue' otutput, I have what I need to do.

It's saved as TISLSCRIPT.h (trimmed due to post character limitations)

static const unsigned char PROGMEM c24_0[] =
{ B00000000, B00001111, B11110000, B00000000,
  B00000000, B00111111, B11111100, B00000000,
  B00000000, B11111111, B11111111, B00000000,
  B00000001, B11111111, B11111111, B10000000,
  B00000011, B11111100, B00111111, B11000000,
  B00000111, B11110000, B00001111, B11100000,
  B00001111, B11000000, B00000111, B11110000,
  B00001111, B10000000, B00000011, B11110000,
  B00011111, B10000000, B00000001, B11111000,
  B00111111, B00000000, B00000000, B11111100,
  B00111111, B00000000, B00000000, B11111100,
  B00111111, B00000000, B00000000, B11111100,
  B01111111, B00000000, B00000000, B11111110,
  B01111111, B00000000, B00000000, B11111110,
  B01111111, B00000000, B00000000, B11111110,
  B01111111, B00000000, B00000000, B11111110,
  B01111111, B00000000, B00000000, B11111110,
  B01111111, B00000000, B00000000, B11111110,
  B01111111, B00000000, B00000000, B11111110,
  B00111111, B00000000, B00000000, B11111100,
  B00111111, B00000000, B00000000, B11111100,
  B00111111, B00000000, B00000000, B11111100,
  B00011111, B10000000, B00000001, B11111000,
  B00001111, B10000000, B00000011, B11110000,
  B00000111, B11000000, B00000111, B11100000,
  B00000111, B11110000, B00001111, B11100000,
  B00000011, B11111100, B00111111, B11000000,
  B00000001, B11111111, B11111111, B10000000,
  B00000000, B11111111, B11111111, B00000000,
  B00000000, B00111111, B11111100, B00000000,
  B00000000, B00001111, B11110000, B00000000,
  B00000000, B00000000, B00000000, B00000000};

static const unsigned char PROGMEM c24_1[] =
{
 B01111111, B00000000, B00000000, B11111110,
  B01111111, B00000000, B00000000, B11111110,
  B01111111, B00000000, B00000000, B11111110,
  B00111111, B00000000, B00000000, B11111100,
  B00111111, B00000000, B00000000, B11111100,
  B00111111, B00000000, B00000000, B11111100,
  B00011111, B10000000, B00000001, B11111000,
  B00001111, B10000000, B00000011, B11110000,
  B00000111, B11000000, B00000111, B11100000,
  B00000111, B11110000, B00001111, B11100000,
  B00000011, B11111100, B00111111, B11000000,
  B00000001, B11111111, B11111111, B10000000,
  B00000000, B11111111, B11111111, B00000000,
  B00000000, B00111111, B11111100, B00000000,
  B00000000, B00001111, B11110000, B00000000,
  B00000000, B00000000, B00000000, B00000000,
  B00000000, B00001111, B11100000, B00000000,
  B00000000, B00011111, B11110000, B00000000,
  B00000000, B00011111, B11110000, B00000000,
  B00000000, B00011111, B11110000, B00000000,
  B00000000, B00011111, B11110000, B00000000,
  B00000000, B00011111, B11110000, B00000000,
  B00000000, B00011111, B11110000, B00000000,
  B00000000, B00011111, B11110000, B00000000,
  B00000000, B00011111, B11110000, B00000000,
  B00000000, B00011111, B11110000, B00000000,
  B00000000, B00011111, B11110000, B00000000,
  B00000000, B00011111, B11110000, B00000000,
  B00000000, B00011111, B11110000, B00000000,
  B00000000, B00011111, B11110000, B00000000,
  B00000000, B00011111, B11110000, B00000000,
  B00000000, B00011111, B11110000, B00000000};


static const unsigned char PROGMEM c24_2[] =
{ B00000000, B00001111, B11100000, B00000000,
  B00000000, B00011111, B11110000, B00000000,
  B00000000, B00011111, B11110000, B00000000,
  B00000000, B00011111, B11110000, B00000000,
  B00000000, B00011111, B11110000, B00000000,
  B00000000, B00011111, B11110000, B00000000,
  B00000000, B00011111, B11110000, B00000000,
  B00000000, B00011111, B11110000, B00000000,
  B00000000, B00011111, B11110000, B00000000,
  B00000000, B00011111, B11110000, B00000000,
  B00000000, B00011111, B11110000, B00000000,
  B00000000, B00011111, B11110000, B00000000,
  B00000000, B00011111, B11110000, B00000000,
  B00000000, B00011111, B11110000, B00000000,
  B00000000, B00011111, B11110000, B00000000,
  B00000000, B00011111, B11110000, B00000000,
  B00000000, B00011111, B11110000, B00000000,
  B00000000, B00011111, B11110000, B00000000,
  B00000000, B00011111, B11110000, B00000000,
  B00000000, B00011111, B11110000, B00000000,
  B00000000, B00011111, B11110000, B00000000,
  B00000000, B00011111, B11110000, B00000000,
  B00000000, B00011111, B11110000, B00000000,
  B00000000, B00011111, B11110000, B00000000,
  B00000000, B00011111, B11110000, B00000000,
  B00000000, B00011111, B11110000, B00000000,
  B00000000, B00011111, B11110000, B00000000,
  B00000000, B00011111, B11110000, B00000000,
  B00000000, B00011111, B11110000, B00000000,
  B00000000, B00011111, B11110000, B00000000,
  B00000000, B00001111, B11100000, B00000000,
  B00000000, B00000000, B00000000, B00000000};

static const unsigned char PROGMEM c24_3[] =
{
 B00000000, B00011111, B11110000, B00000000,
  B00000000, B00011111, B11110000, B00000000,
  B00000000, B00011111, B11110000, B00000000,
  B00000000, B00011111, B11110000, B00000000,
  B00000000, B00011111, B11110000, B00000000,
  B00000000, B00011111, B11110000, B00000000,
  B00000000, B00011111, B11110000, B00000000,
  B00000000, B00011111, B11110000, B00000000,
  B00000000, B00011111, B11110000, B00000000,
  B00000000, B00011111, B11110000, B00000000,
  B00000000, B00011111, B11110000, B00000000,
  B00000000, B00011111, B11110000, B00000000,
  B00000000, B00011111, B11110000, B00000000,
  B00000000, B00011111, B11110000, B00000000,
  B00000000, B00001111, B11100000, B00000000,
  B00000000, B00000000, B00000000, B00000000,
  B00000000, B00111111, B11111000, B00000000,
  B00000000, B11111111, B11111111, B00000000,
  B00000011, B11111111, B11111111, B10000000,
  B00000111, B11111111, B11111111, B11100000,
  B00011111, B11110000, B00011111, B11110000,
  B00111111, B10000000, B00000111, B11111000,
  B01111111, B00000000, B00000001, B11111100,
  B01111111, B00000000, B00000000, B11111110,
  B01111111, B00000000, B00000000, B11111110,
  B00000000, B00000000, B00000000, B11111110,
  B00000000, B00000000, B00000001, B11111100,
  B00000000, B00000000, B00000111, B11111000,
  B00000000, B00000000, B00011111, B11110000,
  B00000000, B00000000, B11111111, B11100000,
  B00000000, B00000001, B11111111, B10000000,
  B00000000, B00000111, B11111111, B00000000};


static const unsigned char PROGMEM c24_4[] =
{ B00000000, B00111111, B11111000, B00000000,
  B00000000, B11111111, B11111111, B00000000,
  B00000011, B11111111, B11111111, B10000000,
  B00000111, B11111111, B11111111, B11100000,
  B00011111, B11110000, B00011111, B11110000,
  B00111111, B10000000, B00000111, B11111000,
  B01111111, B00000000, B00000001, B11111100,
  B01111111, B00000000, B00000000, B11111110,
  B01111111, B00000000, B00000000, B11111110,
  B00000000, B00000000, B00000000, B11111110,
  B00000000, B00000000, B00000001, B11111100,
  B00000000, B00000000, B00000111, B11111000,
  B00000000, B00000000, B00011111, B11110000,
  B00000000, B00000000, B11111111, B11100000,
  B00000000, B00000001, B11111111, B10000000,
  B00000000, B00000111, B11111111, B00000000,
  B00000000, B00111111, B11111100, B00000000,
  B00000000, B11111111, B11110000, B00000000,
  B00000001, B11111111, B11000000, B00000000,
  B00000011, B11111111, B00000000, B00000000,
  B00000111, B11111100, B00000000, B00000000,
  B00001111, B11111000, B00000000, B00000000,
  B00011111, B11110000, B00000000, B00000000,
  B00111111, B11100000, B00000000, B00000000,
  B00111111, B11000000, B00000000, B00000000,
  B01111111, B11000000, B00000000, B00000000,
  B01111111, B11000000, B00000000, B00000000,
  B01111111, B11111111, B11111111, B11111100,
  B01111111, B11111111, B11111111, B11111110,
  B01111111, B11111111, B11111111, B11111110,
  B00111111, B11111111, B11111111, B11111100,
  B00000000, B00000000, B00000000, B00000000};

How do I get the reference name to link up with the output integer?

Cheers

Les

Lesthegringo:
Ok, I tried it, and it displays the digit 1, but there is no reaction to changes in the number so 1 is the only number that appears - so 1 appears no matter what the output is

Then you didn’t convert your char* to a float correctly.
Post your code that does that, or we can’t help.

This is what I tried

// Display - https://pmdway.com/collections/oled-displays/products/0-49-64-x-32-white-graphic-oled-i2c
// Guide - https://pmdway.com/blogs/product-guides-for-arduino/tutorial-using-the-0-49-64-x-32-graphic-i2c-oled-display-with-arduino

#define DCSBIOS_DEFAULT_SERIAL

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

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



void onTislCode1Change (char* value)
{
 float value;
 
  int intValue = (int)value;
  u8g2.clearBuffer();
  u8g2.setFont(u8g2_font_inb24_mr );
  u8g2.setClipWindow(0, 0, 24, 24);
  u8g2.setCursor(0, 24);
  u8g2.print(intValue);
  u8g2.setCursor(0, 24 - (value - intValue) * 24);
  u8g2.print(intValue+1);
  u8g2.setMaxClipWindow();
  u8g2.sendBuffer();
}


DcsBios::StringBuffer<3> tislCode1StrBuffer(0x1118, onTislCode1Change);

void setup() {
  u8g2.begin();

DcsBios::setup();
}
// fonts https://github.com/olikraus/u8g2/wiki/fntlistall#4-pixel-height

void loop()
{
  /*u8g2.clearBuffer();          // clear the internal memory
  u8g2.setFont(u8g2_font_u8glib_4_tf);  // choose a suitable font
  u8g2.drawStr(0, 5, "Hello,");  // write something to the internal memory
  u8g2.drawStr(0, 10, "World...");
  u8g2.drawStr(0, 15, "I'm tiny...");
  u8g2.drawStr(0, 20, "So tiny!");
  u8g2.drawStr(0, 25, "However you can");
  u8g2.drawStr(0, 30, "have six lines");
  u8g2.sendBuffer();          // transfer internal memory to the display
  delay(1000);

  u8g2.clearBuffer();          // clear the internal memory
  u8g2.setFont(u8g2_font_t0_11_tf);  // choose a suitable font
  u8g2.drawStr(0, 10, "Hello,");  // write something to the internal memory
  u8g2.drawStr(0, 20, "World...");
  u8g2.drawStr(0, 30, "I'm tiny...");
  u8g2.sendBuffer();          // transfer internal memory to the display
  delay(1000);

  u8g2.clearBuffer();          // clear the internal memory
  u8g2.setFont(u8g2_font_tenstamps_mf);  // choose a suitable font
  u8g2.drawStr(0, 12, "ABCD");  // write something to the internal memory
  u8g2.drawStr(0, 30, "1234");
  u8g2.sendBuffer();          // transfer internal memory to the display
  delay(1000);

  for (int a = 999; a >= 0; --a)
  {
    u8g2.clearBuffer();          // clear the internal memory
    u8g2.setFont(u8g2_font_inb24_mr );  // choose a suitable font
    u8g2.setCursor(0, 24);
    u8g2.print(a);
    a = a - 47;
    u8g2.sendBuffer();          // transfer internal memory to the display
    delay(100);

    */
  DcsBios::loop();
}

I don't understand why you have to edit a reply in order to add code, but I'm pretty bewildered by a lot of things these days!

Cheers

Les

Hi all, still niggling away at this - and worked out that using quick reply disable the advanced editor!

I wrote the following trial, but can't get it to compile as I get this error at the line "bitmap = c24_19;" (although likely it will be repeated for each instance)

expected primary-expression before '=' token

// Display - https://pmdway.com/collections/oled-displays/products/0-49-64-x-32-white-graphic-oled-i2c
// Guide - https://pmdway.com/blogs/product-guides-for-arduino/tutorial-using-the-0-49-64-x-32-graphic-i2c-oled-display-with-arduino

#define DCSBIOS_DEFAULT_SERIAL

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

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

#define u8g_logo_width 24
#define u8g_logo_height 32
#define bitmap



void onTislCode1Change(unsigned int newValue) 
{
    

DcsBios::IntegerBuffer tislCode1Buffer(0x1116, 0x1f00, 8, onTislCode1Change);
{
if (newValue = 0){
  bitmap = c24_0;
}
if (newValue = 1) {
  bitmap = c24_1;
}
if (newValue = 2) {
  bitmap = c24_2;
}
if (newValue = 3) {
  bitmap = c24_3;
}
if (newValue = 4) {
  bitmap = c24_4;
}
if (newValue = 5) {
  bitmap = c24_5;
}
if (newValue = 6) {
  bitmap = c24_6;
}
if (newValue = 7) {
  bitmap = c24_7;
}
if (newValue = 8) {
  bitmap = c24_8;
}
if (newValue = 9) {
  bitmap = c24_9;
}
if (newValue = 10) {
  bitmap = c24_10;
}
if (newValue = 11) {
  bitmap = c24_11;
}
if (newValue = 12) {
  bitmap = c24_12;
}
if (newValue = 13) {
  bitmap = c24_13;
}
if (newValue = 14) {
  bitmap = c24_14;
}
if (newValue = 15) {
  bitmap = c24_15;
}
if (newValue = 16) {
  bitmap = c24_16;
}
if (newValue = 17) {
  bitmap = c24_17;
}
if (newValue = 18) {
  bitmap = c24_18;
}
if (newValue = 19) {
  bitmap = c24_19;
}

u8g2.clearBuffer();
u8g2.drawXBM( 0, 0, u8g_logo_width, u8g_logo_height, bitmap);
u8g2.sendBuffer();

void setup() {
  u8g2.begin();

DcsBios::setup();
}
// fonts https://github.com/olikraus/u8g2/wiki/fntlistall#4-pixel-height

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

in theory what I am trying to do is simple, just render a particular bitmap if the program returns a certain value. Is it really something problematic? If it is just a case of it being memory hungry or a large file, I intend to use Nanos and am happy to assign one to each case, but I also have a couple of Megas if that is not enough

Cheers!

Les

TISLSCRIPT.h (30.4 KB)

Lesthegringo:
quick reply disable the advanced editor!

But you can turn it on in your profile settings.

jubukraa:
But you can turn it on in your profile settings.

Cool, thanks for the tip!

Cheers

Les

expected primary-expression before '=' token

Where is bitmap declared ?

Why not an array of bitmap names accessed by the value of newValue ?

    u8g2.drawXBM( 0, 0, u8g_logo_width, u8g_logo_height, bitmaps[newValue]);