31 lines
613 B
C++
31 lines
613 B
C++
#include "settings.h"
|
|
#include <EEPROM.h>
|
|
|
|
Settings::Settings() {
|
|
refreshInterval = 1000;
|
|
sensorPin = 26;
|
|
}
|
|
|
|
void Settings::load() {
|
|
EEPROM.begin(sizeof(Settings));
|
|
EEPROM.get(0, *this);
|
|
}
|
|
|
|
void Settings::save() {
|
|
EEPROM.put(0, *this);
|
|
EEPROM.commit();
|
|
}
|
|
|
|
void Settings::setRefreshInterval(unsigned long refreshInterval) {
|
|
this->refreshInterval = refreshInterval;
|
|
save();
|
|
}
|
|
|
|
long Settings::getRefreshInterval() { return refreshInterval; }
|
|
|
|
void Settings::setSensorPin(unsigned int sensorPin) {
|
|
this->sensorPin = sensorPin;
|
|
save();
|
|
}
|
|
|
|
unsigned int Settings::getSensorPin() { return sensorPin; } |