I've been playing with an ESP8266 NodeMCU for some time, I bought an ILI9341 2.8" display and connected to the ESP (without touchscreen).
It receives data like temperature, humidity, pressure from a DIY weather station (powered with solar panel) through TCP.
Everything is working very good so now I would like to include also weather forecast of my area.
I'm using a local weather forecast provider that send weather data through a JSON file.
I can parse the JSON file and extract data, among all those data there is also a reference to a bitmap representing a kind of weather "state" (cloudy, sunny etc.).
Those bitmaps are 18 bitmaps, 72x68 pixels...I can't use a SD card to store all those bitmaps so I would like to "store" them in the flash memory with the PROGMEM attribute.
I used GIMP to convert each of them into a C array in a ".c" file.
The resulting file contains this:
/* GIMP RGB C-Source image dump (sereno.c) */
#define SERENO_WIDTH (72)
#define SERENO_HEIGHT (68)
#define SERENO_BYTES_PER_PIXEL (2) /* 2:RGB16, 3:RGB, 4:RGBA */
#define SERENO_PIXEL_DATA ((unsigned char*) SERENO_pixel_data)
const PROGMEM unsigned char SERENO_pixel_data[72 * 68 * 2 + 1] =
("\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000............."
"
where I added "PROGMEM" but when I compile I get the following error:
sketch\sereno.c:7:15: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'unsigned'
const PROGMEM unsigned char SERENO_pixel_data[72 * 68 * 2 + 1] =
if I delete PROGMEM and add "static" at the beginning of the line, the bitmap is loaded but with just a few of them the memory runs out of space.
To display the bitmap I'm using Adafruit GFX library and "drawRGBBitmap".
How can I do to save all the bitmaps to flash memory?
Thank you, regards.
Roberto