Fix RS protocol=5 pumps

This commit is contained in:
Milos Kozak 2021-07-08 00:04:18 +02:00
parent fdc71785e2
commit ad98bcec2e
8 changed files with 9 additions and 9 deletions

View file

@ -52,6 +52,6 @@ class MsgStatusBolusExtended(
return (floor(System.currentTimeMillis() / 1000.0) - tempBasalAgoSecs).toLong() * 1000
}
// because there is no fixed timestamp of start allow update of tbr only if tbr start differs more
private fun isWithin3Sec(newStart: Long) = abs(newStart - danaPump.tempBasalStart) < 3000
// because there is no fixed timestamp of start allow update of eb only if tbr start differs more
private fun isWithin3Sec(newStart: Long) = abs(newStart - danaPump.extendedBolusStart) < 3000
}

View file

@ -27,7 +27,7 @@ class DanaRSPacketOptionGetPumpTime(
val sec = byteArrayToInt(getBytes(data, DATA_START + 5, 1))
val time = DateTime(2000 + year, month, day, hour, min, sec)
danaPump.setPumpTime(time.millis)
aapsLogger.debug(LTag.PUMPCOMM, "Pump time " + dateUtil.dateAndTimeString(time.millis))
aapsLogger.debug(LTag.PUMPCOMM, "Pump time " + dateUtil.dateAndTimeAndSecondsString(time.millis))
}
override fun handleMessageNotReceived() {

View file

@ -28,7 +28,7 @@ class DanaRSPacketOptionGetPumpUTCAndTimeZone(
val zoneOffset = getBytes(data, DATA_START + 6, 1)[0].toInt()
val time = DateTime(2000 + year, month, day, hour, min, sec)
danaPump.setPumpTime(time.millis, zoneOffset)
aapsLogger.debug(LTag.PUMPCOMM, "Pump time ${dateUtil.dateAndTimeString(danaPump.getPumpTime())} ZoneOffset: $zoneOffset")
aapsLogger.debug(LTag.PUMPCOMM, "Pump time ${dateUtil.dateAndTimeAndSecondsString(danaPump.getPumpTime())} ZoneOffset: $zoneOffset")
}
override fun handleMessageNotReceived() {

View file

@ -14,7 +14,7 @@ class DanaRSPacketOptionSetPumpTime(
init {
opCode = BleEncryption.DANAR_PACKET__OPCODE_OPTION__SET_PUMP_TIME
aapsLogger.debug(LTag.PUMPCOMM, "Setting pump time " + dateUtil.dateAndTimeString(time))
aapsLogger.debug(LTag.PUMPCOMM, "Setting pump time " + dateUtil.dateAndTimeAndSecondsString(time))
}
override fun getRequestParams(): ByteArray {

View file

@ -16,7 +16,7 @@ class DanaRSPacketOptionSetPumpUTCAndTimeZone(
init {
opCode = BleEncryption.DANAR_PACKET__OPCODE_OPTION__SET_PUMP_UTC_AND_TIME_ZONE
aapsLogger.debug(LTag.PUMPCOMM, "Setting UTC pump time ${dateUtil.dateAndTimeString(time)} ZoneOffset: $zoneOffset")
aapsLogger.debug(LTag.PUMPCOMM, "Setting UTC pump time ${dateUtil.dateAndTimeAndSecondsString(time)} ZoneOffset: $zoneOffset")
}
override fun getRequestParams(): ByteArray {

View file

@ -175,7 +175,7 @@ class DanaRSService : DaggerService() {
sendMessage(DanaRSPacketOptionSetPumpUTCAndTimeZone(injector, dateUtil.now(), offset))
}
danaPump.protocol >= 6 -> { // can set seconds
danaPump.protocol >= 5 -> { // can set seconds
sendMessage(DanaRSPacketOptionSetPumpTime(injector, dateUtil.now()))
}

View file

@ -186,7 +186,7 @@ class BigAPSMainInfoInquireResponsePacket(
// pump time setting 'yyyy-MM-dd'T'HH:mm:ssZ' “2019-07-04T12:30:30+0530”
val time = DateTime(diaconnG8Pump.year, diaconnG8Pump.month, diaconnG8Pump.day, diaconnG8Pump.hour, diaconnG8Pump.minute, diaconnG8Pump.second)
diaconnG8Pump.setPumpTime(time.millis)
aapsLogger.debug(LTag.PUMPCOMM, "Pump time " + dateUtil.dateAndTimeString(time.millis))
aapsLogger.debug(LTag.PUMPCOMM, "Pump time " + dateUtil.dateAndTimeAndSecondsString(time.millis))
// basal pattern from pump
diaconnG8Pump.pumpProfiles = Array(4) { Array(24) { 0.0 } }

View file

@ -183,7 +183,7 @@ class BigMainInfoInquireResponsePacket(
// pump time setting 'yyyy-MM-dd'T'HH:mm:ssZ' “2019-07-04T12:30:30+0530”
val time = DateTime(diaconnG8Pump.year, diaconnG8Pump.month, diaconnG8Pump.day, diaconnG8Pump.hour, diaconnG8Pump.minute, diaconnG8Pump.second)
diaconnG8Pump.setPumpTime(time.millis)
aapsLogger.debug(LTag.PUMPCOMM, "Pump time " + dateUtil.dateAndTimeString(time.millis))
aapsLogger.debug(LTag.PUMPCOMM, "Pump time " + dateUtil.dateAndTimeAndSecondsString(time.millis))
// basal pattern from pump
diaconnG8Pump.pumpProfiles = Array(4) { Array(24) { 0.0 } }