Sending a Bitmap or Start Screen to a Display

Now that my project is working pretty well, I would like to add some icons to the display and replace the start screen.
To replace the start screen, Digole documents say that you send ‘SSS’ + lower byte of data length + higher byte of data length + data. For 128 * 64 / 8 bits = 1024 so the string would be ‘SSS’ + ‘\x00’ + ‘\x04’ + data

The Digole site has a tool that turns a simple picture into
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, etc…

How do i send that string as the data the display expects? Can i assign those values to an array and loop through?

That’s how I maintain character sets within my display classes. I have an array of numeric arrays. Each sub-array defines the character. Read the sub-array by its index in the main array (ie. its Ascii code) and add each value to the I2C send string using .tochar().

You can use the same principle for storing the bit patterns of your graphic a byte at a time.

// sending a Start Screen to Digole OLED. There is a utility on their site to generate the bitmap. thanks smittytone.

local newscreen = array(1024);

newscreen = [0x00,0x00,0x00,0x00,0x00, … ,0xC0,0x00,0x00,0xA0,0x00,0x00 ];

i2c.write(i2cDis,“SSS” + “\x00” + “\x04” ); // setup sequence - Send Start Screen + lsb + msb

for (local i = 0 ; i < 1024; i++) {
i2c.write(i2cDis, newscreen[i].tochar());

}

If you want to make it a bit more efficient you could do something like this:

const NEWSCREEN = "\\x00\\x00\\x00\\x00\\x00...\\xA0\\x00" i2c.write(i2cDis,"SSS\\x00\\x04" + NEWSCREEN); //Send Start Screen, lsb, msb, data

Though if their tool doesn’t spit out the data in this format it is a bit of a headache. The plus side is that since NEWSCREEN is a CONST it requires 0 memory.