mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-26 22:22:16 +03:00
Добавляем насроку для таймера для включения режима сохранения значения счетчика
This commit is contained in:
@@ -9,6 +9,7 @@ class Timer : public IoTItem {
|
||||
bool _unfin = false;
|
||||
bool _ticker = false;
|
||||
bool _repeat = false;
|
||||
bool _needSave = false;
|
||||
|
||||
public:
|
||||
Timer(String parameters): IoTItem(parameters) {
|
||||
@@ -19,12 +20,13 @@ class Timer : public IoTItem {
|
||||
jsonRead(parameters, "repeat", _repeat);
|
||||
if (_repeat) _repeat = valDtmp; // если в параметрах просят повторить, то запоминаем настроечное значение отчета
|
||||
_unfin = !value.valD;
|
||||
jsonRead(parameters, "needSave", _needSave); // нужно сохранять счетчик в постоянную память
|
||||
}
|
||||
|
||||
void doByInterval() {
|
||||
if (!_unfin && value.valD) {
|
||||
value.valD--;
|
||||
needSave = true;
|
||||
if (_needSave) needSave = true;
|
||||
if (value.valD == 0) {
|
||||
regEvent(value.valD, "Time's up");
|
||||
if (_repeat) value.valD = _repeat;
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
"int": 1,
|
||||
"countDown": 15,
|
||||
"ticker": 0,
|
||||
"repeat": 0
|
||||
"repeat": 0,
|
||||
"needSave": 0
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user