Glunovo change schedule
This commit is contained in:
parent
56d97861e3
commit
bb7632aa80
1 changed files with 1 additions and 2 deletions
|
@ -25,7 +25,6 @@ import info.nightscout.androidaps.utils.sharedPreferences.SP
|
||||||
import io.reactivex.disposables.CompositeDisposable
|
import io.reactivex.disposables.CompositeDisposable
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Singleton
|
import javax.inject.Singleton
|
||||||
import kotlin.math.min
|
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
class GlunovoPlugin @Inject constructor(
|
class GlunovoPlugin @Inject constructor(
|
||||||
|
@ -64,7 +63,7 @@ class GlunovoPlugin @Inject constructor(
|
||||||
aapsLogger.error("Error while processing data", e)
|
aapsLogger.error("Error while processing data", e)
|
||||||
}
|
}
|
||||||
val lastReadTimestamp = sp.getLong(R.string.key_last_processed_glunovo_timestamp, 0L)
|
val lastReadTimestamp = sp.getLong(R.string.key_last_processed_glunovo_timestamp, 0L)
|
||||||
val differenceToNow = min(INTERVAL, dateUtil.now() - lastReadTimestamp + INTERVAL + T.secs(10).msecs())
|
val differenceToNow = INTERVAL - (dateUtil.now() - lastReadTimestamp) % INTERVAL + T.secs(10).msecs()
|
||||||
loopHandler.postDelayed(refreshLoop, differenceToNow)
|
loopHandler.postDelayed(refreshLoop, differenceToNow)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue