I get Exception 29 soon after placing some data into a class array

I suspect there is something I am doing wrong with memory allocation somehow… pointers/ by reference stuff?

I have a class which defines a public function and a struct:

struct RSLight {
  // design time values
  char type;   // L = monochrome light   
  int pin;   // raw pin number 
  bool pwd; // use analogWrite if true
  
  // values that change at runtime
  byte RGB[3]; // RGB values 
  long RGBgoal[3]; // target brightness
  int brip; // brighness percentage
  int brigoal; // target brightness
};

class RemoteSign {
  private:
    static WiFiServer _rsserver;  
  public:
    RemoteSign();
    void begin();
    void setCH(String CH);
    RSLight rslights[];
    void setChannelData(int ch, char type, int pin, bool pwd);
};

The class declares an array:

RSLight rslights[5];

and the function tries to place the data into the array using the first int parameter as the index into the array:

void RemoteSign::setChannelData(int ch, char type, int pin, bool pwd) {
   Serial.println("starting setChannel");
   rslights[ch].type = type;
   rslights[ch].pin = pin;
   rslights[ch].pwd = pwd;
   yield;
   Serial.println("ending setchannel");
 }

From my setup() function I call the setChannelData function:

 RemoteSign rs;  
 rs.setCH("{CH}1\21M\21D\r{CH}2\21M\21D\r{CH}3\21M\21D\r{CH}4\21M\r"); // \21 is octal for 17 decimal (DC1)

 rs.setChannelData(1,'M',4,true);

Very soon after that code executes I get an exception:

starting setChannel
ending setchannel
before begin
after begin

Exception (29):
epc1=0x40100750 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000

ctx: cont 
sp: 3ffffdd0 end: 3fffffd0 offset: 01a0

>>>stack>>>
3fffff70:  3ffe8a20 3ffee918 3ffee960 4020364c  
3fffff80:  3ffe89e8 8956a8c0 3ffee960 40203670  
3fffff90:  3ffe89e4 3ffee918 3ffee960 40202c34  
3fffffa0:  00000000 00000000 00000001 40203add  
3fffffb0:  3fffdad0 00000000 3ffeea18 40203b4e  
3fffffc0:  feefeffe feefeffe 3ffe85f0 4010074d  
<<<stack<<<

 ets Jan  8 2013,rst cause:2, boot mode:(1,6)


 ets Jan  8 2013,rst cause:4, boot mode:(1,6)

wdt reset

Excpetion 29 is
StoreProhibitedCause A store referenced a page mapped with an attribute that does not permit stores

My suspicion is that when SetChannelData assigns the passed data to the parts of the array, it is doing that incorrectly and messing up memory. The call to the very similar setCH works just fine, but it stores a String and is not part of array of struct RSLights.

I have read that when an array is passed as a parameter, it gets passed as pointers, but I am not passing an array, rather 4 separate parameters, so I don’t believe I need to dereference them right?

Just a guess: Do you need to typedef that struct declaration to use it that way?

I stumbled upon the problem....

in my class I defined a public array rslights

and I also declared such an array in the cpp file!

removing the spurious definition from the class got rid of the exceptions...

I do wonder why the compiler never caught the duplicate definition though....

And now i am looking at a different post regarding a problem i had looked at before. (including some answers to questions that came up before)