reset next action state after command run
This commit is contained in:
10
Nuki.cpp
10
Nuki.cpp
@@ -42,19 +42,21 @@ void Nuki::update()
|
|||||||
|
|
||||||
unsigned long ts = millis();
|
unsigned long ts = millis();
|
||||||
|
|
||||||
if(_lastLockStateUpdateTs == 0 || _lastLockStateUpdateTs + 60000 < ts)
|
if(_nextLockStateUpdateTs == 0 || ts >= _nextLockStateUpdateTs)
|
||||||
{
|
{
|
||||||
_lastLockStateUpdateTs = ts;
|
_nextLockStateUpdateTs = ts + 60000;
|
||||||
updateKeyTurnerState();
|
updateKeyTurnerState();
|
||||||
}
|
}
|
||||||
if(_lastBatteryReportTs == 0 || _lastBatteryReportTs + 600000 < ts)
|
if(_nextBatteryReportTs == 0 || ts > _nextBatteryReportTs)
|
||||||
{
|
{
|
||||||
_lastBatteryReportTs = ts;
|
_nextBatteryReportTs = ts + 60000 * 30;
|
||||||
updateBatteryState();
|
updateBatteryState();
|
||||||
}
|
}
|
||||||
if(_nextLockAction != (LockAction)0xff)
|
if(_nextLockAction != (LockAction)0xff)
|
||||||
{
|
{
|
||||||
_nukiBle.lockAction(_nextLockAction, 0, 0);
|
_nukiBle.lockAction(_nextLockAction, 0, 0);
|
||||||
|
_nextLockAction = (LockAction)0xff;
|
||||||
|
_nextLockStateUpdateTs = ts + 11000;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
4
Nuki.h
4
Nuki.h
@@ -31,7 +31,7 @@ private:
|
|||||||
BatteryReport _lastBatteryReport;
|
BatteryReport _lastBatteryReport;
|
||||||
|
|
||||||
bool _paired = false;
|
bool _paired = false;
|
||||||
unsigned long _lastLockStateUpdateTs = 0;
|
unsigned long _nextLockStateUpdateTs = 0;
|
||||||
unsigned long _lastBatteryReportTs = 0;
|
unsigned long _nextBatteryReportTs = 0;
|
||||||
LockAction _nextLockAction = (LockAction)0xff;
|
LockAction _nextLockAction = (LockAction)0xff;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user