0

Lots of Web/Http based libraries on Arduino come with their own predefined web content, e.g

static const char serverIndex[] PROGMEM =
    R"(<html><body>....</body></html>)";

Aside from modifying the library is there a way to intervene on the variable content directly in the program sketch?

Regards,

Luigi
  • 376
  • 3
  • 16

1 Answers1

0

You can change static class properties like any other, but you cannot change data that is stored in PROGMEM. That's why this variable is also delcared as const.

PROGMEM data is stored in flash memory and is part of the sketch binary file.

A possible solution would be to use SPIFFS but that would require a change in the libraries code.

Another solution would be to write your own derived class: see Are static variables in a base class shared by all derived classes?

But that's a lot of clutter so IMHO it's easier to just change to original class.

BMelis
  • 384
  • 3
  • 16
  • I meant at compilation time, like overwrite the declaration/definition itself so that it takes mine. – Luigi Sep 08 '17 at 06:23
  • It's not possible to have two definitions of the same variable name (yours and theirs) at compile time. Since arduino libraries are generally open source you might like to take the library source and modify it to your needs. – Andy Brown Sep 08 '17 at 09:42