I took your JPEG and used the online converter at the UTFT website
This produced a C file like this:
// Generated by : ImageConverter 565 Online
// Generated from : bigicon100 x100.jpg
// Time generated : Mon, 02 Oct 17 20:06:07 +0200 (Server timezone: CET)
// Image Size : 100x100 pixels
// Memory usage : 20000 bytes
#if defined(__AVR__)
#include <avr/pgmspace.h>
#elif defined(__PIC32MX__)
#define PROGMEM
#elif defined(__arm__)
#define PROGMEM
#endif
const unsigned short bigicon100_x100[10000] PROGMEM = {
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, // 0x0010 (16) pixels
0xFFFF, 0xFFFE, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFE, 0xFFFE, 0xFFFF, 0xFFFF, 0xF7FF, 0xF7FF, 0xF7FF, // 0x0020 (32) pixels
...
and had to declare and use it like this:
extern const unsigned short bigicon100_x100[];
...
x = logox, y = logoy, w = 100, h = 100;
tft.setAddrWindow(x, y, x - 1 + w, y - 1 + h);
// 4th argument MUST be used for little-endian
// the UTFT utility rearranges the hi, lo to the default
tft.pushColors((uint8_t*)bigicon100_x100, w * h, 1, 0);
...
i.e. absolutely no problem with a 20000 byte array.
Note that I cast it to (uint8_t*) even though it is actually uint16_t[]
I initially thought that your 4-part icon would have been 4 horizontal rectangles. One below the previous layer. I could have just concatenated your arrays into one big array.
Since you use 4 square tiles, it was not possible to use your data. Hence going to the online converter.
Looking at your Touch code:
- you call ts.getPoint() in a single place. that is GOOD
- you use the ADC values throughout the rest of your logic. that is BAD
I strongly suggest that you convert p.x, p.y to the pixel coordinates with the map() function.
Please change ALL of your code to use logical pixel_x and pixel_y
This will make your button position and detection far easier to maintain.
When you have done that, I will show you how to use your Uno and Mega shield in a convenient way. i.e. about 5 lines of code.
David.