Every time I have to mess with PROGMEM, I end up wanting to smash my computer...
I'm trying to put an array of structures containing strings entirely into FLASH. Here's how I've tried to do it:
struct OilerCircuit
{
const char PROGMEM *Name;
uint8_t Time;
};
const char RaysCircuit1Name[] PROGMEM = " X Front Top Way ";
const char RaysCircuit2Name[] PROGMEM = " X Front Dovetail ";
const char RaysCircuit3Name[] PROGMEM = " X Rear Ways ";
const OilerDriver::OilerCircuit PROGMEM RaysSchedule[3] =
{
{ RaysCircuit1Name, 10 },
{ RaysCircuit2Name, 11 },
{ RaysCircuit3Name, 12 },
};
/***********************************
* getCircuitName
**********************************/
const char *RaysDriver::getCircuitName(uint8_t which)
{
// Read Circuit name from FLASH
return RaysSchedule[which].Name;
}
For reasons I cannot fathom, getCircuitName() always returns NULL. I can read the Time fields with no problems. I can read the strings themselves with no problems. But when I read the Name fields from the array, I always get NULL.
What am I doing wrong?
Regards,
Ray L.