Juggling with PROGMEM and struct

Hello everyone

Im trying to store an array in a struct which is stored in PROGMEM and while the programm is running it should paste the p1 to pBuff. i already tried this:

enum Function{
  GOTO
};

struct ZeilenText{
  char Text [10];
};

struct ZeilenFunktion{
  Function Funktion;
};

struct Page {
  ZeilenText* ZT;
  ZeilenFunktion* ZF;
};

ZeilenText zT1 [6] PROGMEM  = {"1.1","1.2","1.3","1.4","1.5","1.6"};
ZeilenFunktion zF1 [6] PROGMEM = {GOTO,GOTO,GOTO,GOTO,GOTO,GOTO};

Page p1 PROGMEM = {zT1,zF1};

void setup()
{
  Serial.begin(115200);

  for(uint8_t i = 0; i < 6; i++)
  {
    Serial.println(p1.ZT[i].Text); 
  }
}


void loop()
{


}

but it only spitts out garbage data over serial. so it tried this:

enum Function{
  GOTO
};

struct Page {
  char Text [10][6];
  Function Funktion[6];
};



Page p1 PROGMEM;

p1.Text = {"1.1","1.2","1.3","1.4","1.5","1.6"};
p1.Funktion = {GOTO,GOTO,GOTO,GOTO,GOTO,GOTO};


void setup()
{
}

void loop()
{
}

but this wont even compile.

I want to do it this way and not this way because of the overview when designing menus for a display.

enum Function{
  GOTO
};

struct Page {
  char Text [10][6];
  Function Funktion[6];
};



Page p1 PROGMEM = {{"1.1","1.2","1.3","1.4","1.5","1.6"},{GOTO,GOTO,GOTO,GOTO,GOTO,GOTO}};



void setup()
{
}

void loop()
{
}

because i want to keep a nice overview while designing a menu.

    Serial.println(p1.ZT[i].Text);

You stored the data in PROGMEM, but you are accessing it like it was in SRAM. That hasn’t worked for anyone else, either.

PaulS:

    Serial.println(p1.ZT[i].Text);

You stored the data in PROGMEM, but you are accessing it like it was in SRAM. That hasn’t worked for anyone else, either.

Sorry that code snipped wasn’t correct. I used a Buffer stored in the sram to copy the data from the flash memory into it.

i tired to define the struct Page holding arrays like this:

enum Function{
  GOTO
};

struct ZeilenText{
  char Text [10];
};

struct ZeilenFunktion{
  Function Funktion;
};

ZeilenText zT1 [6] PROGMEM   = {"1.1","1.2","1.3","1.4","1.5","1.6"}; //array of text stored in flash
ZeilenFunktion zF1 [6] PROGMEM = {GOTO,GOTO,GOTO,GOTO,GOTO,GOTO}; // array of userdefined enum stored in flash

struct Page {                // structure which holds an array of six ZeilenText values and an array of six ZeilenFunktion values
  ZeilenText ZT [6];
  ZeilenFunktion ZF [6];
};

Page p1 PROGMEM = {zT1,zF1}; // store both arrays in a page which is also stored in flash

Page pBuff;

void rein()
{
  memcpy_P(&pBuff, &p1, sizeof(Page));
}

void setup()
{
  Serial.begin(115200);
  rein();
  for(uint8_t i = 0; i < 6; i++)
  {
    Serial.println(pBuff.ZT[i].Text); 
  }
}

void loop()
{
}

i get following error message

nokia5110Struct:21: error: invalid conversion from ‘ZeilenText*’ to ‘char’
nokia5110Struct:21: error: invalid conversion from ‘ZeilenFunktion*’ to ‘char’

even though ZeilenFunktion doens’t even use a char variable.

any thoughts?

so i found this thread, and its example works fine but when trying to have an multidimensional array, it wont compile:

const char  zT1 [][5] PROGMEM = {"1.1","1.2"};
const char  zT2 [][5] PROGMEM = {"2.1","2.2"};

const char * const table [][5] PROGMEM = {zT1,zT2};

giving the error message:

nokia5110Struct:7: error: cannot convert 'const char ()[5]' to 'const char const' in initialization nokia5110Struct:7: error: cannot convert 'const char ()[5]' to 'const char const' in initialization

couldn't find a solution for that...