if you don't modify the data, you don't need to copy it in memory, instead you could keep a pointer to the data
here is an example:
const uint8_t aFlashBitmap1[] PROGMEM = {151, 146, 242, 146, 151, 0, 170, 85}; // 8x8 bitmap
const uint8_t aFlashBitmap2[] PROGMEM = {174, 170, 74, 74, 78, 0, 170, 85}; // 8x8 bitmap
const size_t aFlashBitmapSize = sizeof aFlashBitmap1;
const uint8_t * logo;
void dumpData() {
Serial.print("Current LOGO : ");
for (size_t i = 0; i < aFlashBitmapSize; i++) {
Serial.print(pgm_read_byte(logo + i));
Serial.write(' ');
}
Serial.println();
}
void setup() {
Serial.begin(115200); Serial.println();
logo = aFlashBitmap1;
dumpData();
logo = aFlashBitmap2;
dumpData();
}
void loop() {}
the logo pointer will be first pointing at aFlashBitmap1 and then at aFlashBitmap2.
➜ This way you don't have a memory impact besides keeping a few pointers around. It's way more efficient.
you could also have a 2D array indexed by the page number for the pointers, so this way you would just do
tft.drawBitmap(30, 30, logos[brand][0], 64, 64, BLACK, WHITE);
tft.drawBitmap(30, 150, logos[brand][1], 64, 64, BLACK, WHITE);`
and no messing around with the ifs