Loosen time diff allowance
This commit is contained in:
parent
3ce566ca7c
commit
c0f1fcda0f
1 changed files with 4 additions and 9 deletions
|
@ -768,17 +768,12 @@ class MedtrumService : DaggerService(), BLECommCallback {
|
||||||
// Succes!
|
// Succes!
|
||||||
responseHandled = true
|
responseHandled = true
|
||||||
responseSuccess = true
|
responseSuccess = true
|
||||||
val currTime = dateUtil.nowWithoutMilliseconds()
|
val currTime = dateUtil.now()
|
||||||
if (abs(medtrumPump.lastTimeReceivedFromPump - currTime) <= T.secs(5).msecs()) { // Allow 5 sec deviation
|
aapsLogger.debug(LTag.PUMPCOMM, "GetTimeState.onIndication systemTime: $currTime, pumpTime: ${medtrumPump.lastTimeReceivedFromPump}")
|
||||||
|
if (abs(medtrumPump.lastTimeReceivedFromPump - currTime) <= T.secs(10).msecs()) { // Allow 10 sec deviation
|
||||||
toState(SynchronizeState())
|
toState(SynchronizeState())
|
||||||
} else {
|
} else {
|
||||||
aapsLogger.debug(
|
aapsLogger.warn(LTag.PUMPCOMM, "GetTimeState.onIndication time difference too big, setting time")
|
||||||
LTag.PUMPCOMM,
|
|
||||||
"GetTimeState.onIndication need to set time. systemTime: $currTime PumpTime: ${medtrumPump.lastTimeReceivedFromPump} Pump Time to system time: " + timeUtil
|
|
||||||
.convertPumpTimeToSystemTimeMillis(
|
|
||||||
medtrumPump.lastTimeReceivedFromPump
|
|
||||||
)
|
|
||||||
)
|
|
||||||
toState(SetTimeState())
|
toState(SetTimeState())
|
||||||
}
|
}
|
||||||
} else if (mPacket?.failed == true) {
|
} else if (mPacket?.failed == true) {
|
||||||
|
|
Loading…
Reference in a new issue