Hi all
I have a program on a Pro-mini that uses a small 128x32 Oled screen.
There is a lot of text for this screen, so I threw them to the PROGMEM using (as an example):
const char string_0[] PROGMEM = " AIR TANK";
const char string_1[] PROGMEM = " CONTROLLER";
const char string_2[] PROGMEM = " Calibrating Gyro";
const char string_3[] PROGMEM = " No Gyro found";
const char string_4[] PROGMEM = " Set operation mode";
etc etc etc
const char* const string_table[] PROGMEM = {string_0, string_1, string_2, string_3, string_4, string_5, string_6, string_7, string_8, string_9, string_10,
string_11, string_12, string_13, string_14, string_15, string_16, string_17, string_18, string_19, string_20,
string_21, string_22, string_23, string_24, string_25, string_26, string_27, string_28, string_29, string_30,
string_31, string_32, string_33, string_34, string_35, string_36, string_37
};
char buffer[20];
To display the text I use:
void DisplayText() {
strcpy_P(buffer, (char*)pgm_read_word(&(string_table[txt]))); // Retrieves the string
display1.print(buffer);
display1.display();
}
I have 37 of these text lines and it all works fine. But.... my sketch uses 99% of the programming space and only 35% of the dynamic memory.
So I thought, just take them out of PROGMEM and free up some space.... nope
I clearly don't quite understand the process here. I thought PROGMEM allocated that text to the programming memory space. If I remove the PROGMEM command, does it not move to the dynamic memory?
Changing all 37 text commands to the following makes no difference at all to the compiling memory count?
const char string_2[] = " Calibrating Gyro";
Can someone please explain?