Hi
Yes, I did get that working by using an EEPROM location.
It been awhile, (i've been retired for over a year now) but near as I can tell from looking at (many versions) of the source code, it went something like this:
#include <EEPROM.h>
// in setup() include the following
//EEPROM.write(500,whateverv_value); // only executed once to write the value permanently. //comment out after one execution
max_msg = EEPROM.read(500); // read every time the program starts to get the stored value
I don't remember why I used location 500
I had a pretty bad source code version control system back then consisting of many dated folders.
I believe this code was functional.
Perhaps you could check out the EEPROM library... I've also seen references to EEPROM.get & EEPROM.put. Not sure why I used read & write.
I hope this helps.
-Brad