2023-01-05 10:45:24 +00:00
|
|
|
//
|
|
|
|
// Created by robtor on 05.01.23.
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef FLOATPUMP_CONFIG_STORE_H
|
|
|
|
#define FLOATPUMP_CONFIG_STORE_H
|
|
|
|
|
|
|
|
#include <chrono>
|
|
|
|
|
|
|
|
namespace floatpump {
|
|
|
|
|
|
|
|
class Config_Store {
|
|
|
|
public:
|
2023-01-05 11:19:36 +00:00
|
|
|
Config_Store();
|
2023-01-06 13:08:38 +00:00
|
|
|
|
2023-01-05 10:45:24 +00:00
|
|
|
void saveToFlash();
|
2023-01-06 13:08:38 +00:00
|
|
|
|
2023-01-05 10:45:24 +00:00
|
|
|
void resetDefaults();
|
2023-01-06 13:08:38 +00:00
|
|
|
|
2023-01-05 10:45:24 +00:00
|
|
|
void loadFromFlash();
|
|
|
|
|
2023-01-06 13:08:38 +00:00
|
|
|
template<class T>
|
2023-01-05 11:19:36 +00:00
|
|
|
class Config_Object {
|
|
|
|
public:
|
|
|
|
Config_Object(T initialValue) : m_data(initialValue) {};
|
|
|
|
|
|
|
|
T getValue() {
|
|
|
|
return m_data;
|
|
|
|
}
|
|
|
|
|
|
|
|
void setValue(T newValue) {
|
|
|
|
m_data = newValue;
|
|
|
|
}
|
|
|
|
|
|
|
|
T *getLink() {
|
|
|
|
return &m_data;
|
|
|
|
}
|
2023-01-06 13:08:38 +00:00
|
|
|
|
2023-01-05 11:19:36 +00:00
|
|
|
private:
|
|
|
|
T m_data;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
Config_Object<bool> testbool = Config_Object<bool>(false);
|
2023-01-05 10:45:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // floatpump
|
|
|
|
|
|
|
|
#endif //FLOATPUMP_CONFIG_STORE_H
|