Only update lastDataTime on successful readStatus
This commit is contained in:
parent
9860c7aac3
commit
6ccfb734d7
4 changed files with 8 additions and 9 deletions
|
@ -210,10 +210,7 @@ import kotlin.math.round
|
|||
return result
|
||||
}
|
||||
|
||||
override fun lastDataTime(): Long {
|
||||
return medtrumPump.lastTimeReceivedFromPump
|
||||
}
|
||||
|
||||
override fun lastDataTime(): Long = medtrumPump.lastConnection
|
||||
override val baseBasalRate: Double
|
||||
get() = medtrumPump.baseBasalRate
|
||||
|
||||
|
|
|
@ -140,10 +140,11 @@ class MedtrumPump @Inject constructor(
|
|||
|
||||
val pumpType: PumpType = PumpType.MEDTRUM_NANO // TODO, type based on pumpSN or pump activation/connection
|
||||
|
||||
var lastTimeReceivedFromPump = 0L // Time in seconds!
|
||||
var suspendTime = 0L // Time in seconds!
|
||||
var patchStartTime = 0L // Time in seconds!
|
||||
var patchAge = 0L // Time in seconds!
|
||||
var lastConnection = 0L // Time in ms!
|
||||
var lastTimeReceivedFromPump = 0L // Time in ms! // TODO: Consider removing as is not used?
|
||||
var suspendTime = 0L // Time in ms!
|
||||
var patchStartTime = 0L // Time in ms!
|
||||
var patchAge = 0L // Time in seconds?! // TODO: Not used
|
||||
|
||||
|
||||
var batteryVoltage_A = 0.0
|
||||
|
|
|
@ -87,7 +87,7 @@ class NotificationPacket(val injector: HasAndroidInjector) {
|
|||
|
||||
if (fieldMask and MASK_SUSPEND != 0) {
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Suspend notification received")
|
||||
medtrumPump.suspendTime = data.copyOfRange(offset, offset + 4).toLong()
|
||||
medtrumPump.suspendTime = MedtrumTimeUtil().convertPumpTimeToSystemTimeMillis(data.copyOfRange(offset, offset + 4).toLong())
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Suspend time: ${medtrumPump.suspendTime}")
|
||||
offset += 4
|
||||
}
|
||||
|
|
|
@ -171,6 +171,7 @@ class MedtrumService : DaggerService(), BLECommCallback {
|
|||
aapsLogger.error(LTag.PUMPCOMM, "Failed to sync records")
|
||||
return
|
||||
}
|
||||
if (result) medtrumPump.lastConnection = System.currentTimeMillis()
|
||||
}
|
||||
|
||||
fun setBolus(insulin: Double, t: EventOverviewBolusProgress.Treatment): Boolean {
|
||||
|
|
Loading…
Reference in a new issue