Fix data comes from another pump after activation
This commit is contained in:
parent
6a6af81ef7
commit
850f72924b
|
@ -75,6 +75,10 @@ class ActivatePacket(injector: HasAndroidInjector, private val basalProfile: Byt
|
|||
val dailyMaxInsulin: Int = round(medtrumPump.desiredDailyMaxInsulin / 0.05).toInt()
|
||||
val currentTDD: Double = tddCalculator.calculateToday()?.totalAmount?.div(0.05) ?: 0.0
|
||||
|
||||
// Update the pump in the database, technically this is not a new pump only new patch, but still TBR's etc need to be cannceled
|
||||
// Do it here, to make sure TBR's are cancelled by AAPS before new information comes in from the pump
|
||||
pumpSync.connectNewPump()
|
||||
|
||||
return byteArrayOf(opCode) + autoSuspendEnable + autoSuspendTime + patchExpiration + alarmSetting + lowSuspend + predictiveLowSuspend + predictiveLowSuspendRange + hourlyMaxInsulin.toByteArray(
|
||||
2
|
||||
) + dailyMaxInsulin.toByteArray(2) + currentTDD.toInt().toByteArray(2) + 1.toByte() + basalProfile
|
||||
|
@ -98,8 +102,6 @@ class ActivatePacket(injector: HasAndroidInjector, private val basalProfile: Byt
|
|||
medtrumPump.currentSequenceNumber = basalSequence // We are activated, set the new seq nr
|
||||
medtrumPump.syncedSequenceNumber = basalSequence // We are activated, reset the synced seq nr ()
|
||||
|
||||
// Update the pump in the database, technically this is not a new pump only new patch, but still TBR's etc need to be cannceled
|
||||
pumpSync.connectNewPump()
|
||||
// Sync canula change
|
||||
pumpSync.insertTherapyEventIfNewWithTimestamp(
|
||||
timestamp = System.currentTimeMillis(),
|
||||
|
|
Loading…
Reference in a new issue