1
0
mirror of https://github.com/thooge/esp32-nmea2000-obp60.git synced 2025-12-15 23:13:07 +01:00

optimize memory usage for config data, allow 4s timeout for setConfig

This commit is contained in:
andreas
2022-03-11 14:50:48 +01:00
parent 6741222574
commit 4557e6c0bb
6 changed files with 40 additions and 17 deletions

View File

@@ -7,11 +7,28 @@ class GwConfigHandler;
class GwConfigInterface{
private:
String name;
String initialValue;
const char * initialValue;
String value;
bool secret=false;
String changedValue;
bool hasChangedValue=false;
void updateValue(String value,bool cmpDefault=false){
hasChangedValue=false;
if (cmpDefault){
if (value != initialValue) {
changedValue=value;
hasChangedValue=true;
}
}
else{
if (value != this->value) {
changedValue=value;
hasChangedValue=true;
}
}
}
public:
GwConfigInterface(const String &name, const String initialValue, bool secret=false){
GwConfigInterface(const String &name, const char * initialValue, bool secret=false){
this->name=name;
this->initialValue=initialValue;
this->value=initialValue;