Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By Laercio Mendonça
#76513 Good evening, I'm having some trouble finding documentation on how to use Progmem for Array Structs.

What I want is to assemble an array with all the phrases and words on my system, and create a function to get this data and display it on the screen or debug. What am I doing wrong?

Here is an example of what I did:

#define PROGMEM ICACHE_RODATA_ATTR

struct StructLang {
const char * BR;
const char * US;
};

const StructLang Lang[] PROGMEM = {
{("Inicialização do Sistema"), ("System initialization Started!") },
{("Inicialização do Sistema Concluída"), ("System initialization Done!") },
{("Sempre"), ("Allways") },
{("Erros"), ("Errors") },
{("Info"), ("Info") },
{("Debug"), ("Debug") },
{("Verbose"), ("Verbose") },
{("Auto"), ("Auto") },
{("Manual"), ("Manual") },
{("Alimentação"), ("Feeder") }
};

void LangMSG(byte LangID) {
if (System.Lang == PT_BR) DebugSerial.println( FPSTR(Lang[LangID].BR) );
if (System.Lang == EN_US) DebugSerial.println( FPSTR(Lang[LangID].US) );
}


What I realized and that my Array Lang is occupying data of the Global Memory ....
I'm also not sure if the modeling I've adopted is ideal.

What I want is to offer a multi-language framework for debug, web manager and Touch Nextion Screen.