DiaconnG8: pump log sync bug fix
This commit is contained in:
parent
8b44a24fb7
commit
621d0f3057
2 changed files with 13 additions and 2 deletions
|
@ -104,6 +104,14 @@ class BLECommonService @Inject internal constructor(
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bluetoothGatt?.let {
|
||||||
|
it.disconnect()
|
||||||
|
SystemClock.sleep(200)
|
||||||
|
it.close()
|
||||||
|
SystemClock.sleep(200)
|
||||||
|
bluetoothGatt = null
|
||||||
|
}
|
||||||
|
|
||||||
val device = bluetoothAdapter?.getRemoteDevice(address)
|
val device = bluetoothAdapter?.getRemoteDevice(address)
|
||||||
if (device == null) {
|
if (device == null) {
|
||||||
aapsLogger.error("Device not found. Unable to connect from: $from")
|
aapsLogger.error("Device not found. Unable to connect from: $from")
|
||||||
|
|
|
@ -295,18 +295,21 @@ class DiaconnG8Service : DaggerService() {
|
||||||
if (apsWrappingCount == -1 && apsLastLogNum == 9999) {
|
if (apsWrappingCount == -1 && apsLastLogNum == 9999) {
|
||||||
apsWrappingCount = pumpWrappingCount
|
apsWrappingCount = pumpWrappingCount
|
||||||
apsLastLogNum = if (pumpLastNum - 1 < 0) 0 else pumpLastNum - 2
|
apsLastLogNum = if (pumpLastNum - 1 < 0) 0 else pumpLastNum - 2
|
||||||
|
aapsLogger.debug(LTag.PUMPCOMM, "first install app apsWrappingCount : $apsWrappingCount, apsLastLogNum : $apsLastLogNum")
|
||||||
}
|
}
|
||||||
// if another pump
|
// if another pump
|
||||||
if (pumpSerialNo != diaconnG8Pump.serialNo) {
|
if (pumpSerialNo != diaconnG8Pump.serialNo) {
|
||||||
apsWrappingCount = pumpWrappingCount
|
apsWrappingCount = pumpWrappingCount
|
||||||
apsLastLogNum = if (pumpLastNum - 1 < 0) 0 else pumpLastNum - 2
|
apsLastLogNum = if (pumpLastNum - 1 < 0) 0 else pumpLastNum - 2
|
||||||
sp.putInt(rh.gs(R.string.pumpserialno), diaconnG8Pump.serialNo)
|
sp.putInt(rh.gs(R.string.pumpserialno), diaconnG8Pump.serialNo)
|
||||||
|
aapsLogger.debug(LTag.PUMPCOMM, "Pump serialNo is different apsWrappingCount : $apsWrappingCount, apsLastLogNum : $apsLastLogNum")
|
||||||
}
|
}
|
||||||
// if pump reset
|
// if pump reset
|
||||||
if (apsIncarnationNum != diaconnG8Pump.pumpIncarnationNum) {
|
if (apsIncarnationNum != diaconnG8Pump.pumpIncarnationNum) {
|
||||||
apsWrappingCount = pumpWrappingCount
|
apsWrappingCount = pumpWrappingCount
|
||||||
apsLastLogNum = if (pumpLastNum - 1 < 0) 0 else pumpLastNum - 2
|
apsLastLogNum = if (pumpLastNum - 1 < 0) 0 else pumpLastNum - 2
|
||||||
sp.putInt(R.string.apsIncarnationNo, apsIncarnationNum)
|
sp.putInt(R.string.apsIncarnationNo, diaconnG8Pump.pumpIncarnationNum)
|
||||||
|
aapsLogger.debug(LTag.PUMPCOMM, "Pump incarnationNum is different apsWrappingCount : $apsWrappingCount, apsLastLogNum : $apsLastLogNum")
|
||||||
}
|
}
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "apsWrappingCount : $apsWrappingCount, apsLastLogNum : $apsLastLogNum")
|
aapsLogger.debug(LTag.PUMPCOMM, "apsWrappingCount : $apsWrappingCount, apsLastLogNum : $apsLastLogNum")
|
||||||
|
|
||||||
|
@ -375,7 +378,7 @@ class DiaconnG8Service : DaggerService() {
|
||||||
val end: Int // log sync end number1311
|
val end: Int // log sync end number1311
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "lastLogNum : $lastLogNum, wrappingCount : $wrappingCount , pumpLastNum: $pumpLastNum, pumpWrappingCount : $pumpWrappingCount")
|
aapsLogger.debug(LTag.PUMPCOMM, "lastLogNum : $lastLogNum, wrappingCount : $wrappingCount , pumpLastNum: $pumpLastNum, pumpWrappingCount : $pumpWrappingCount")
|
||||||
|
|
||||||
if (pumpWrappingCount > wrappingCount && lastLogNum < 9999) {
|
if (pumpWrappingCount > wrappingCount) {
|
||||||
start = (lastLogNum + 1)
|
start = (lastLogNum + 1)
|
||||||
end = 10000
|
end = 10000
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue