This commit is contained in:
Milos Kozak 2022-07-10 23:13:14 +02:00
parent 89d2290ed9
commit b025fea343

View file

@ -269,44 +269,20 @@ abstract class PumpPluginAbstract protected constructor(
ret += if (pumpStatusData.lastConnection == 0L) { ret += if (pumpStatusData.lastConnection == 0L) {
"LastConn: never\n" "LastConn: never\n"
} else { } else {
val agoMsec = System.currentTimeMillis() - pumpStatusData.lastConnection val agoMin = ((System.currentTimeMillis() - pumpStatusData.lastConnection) / 60.0 / 1000.0).toInt()
val agoMin = (agoMsec / 60.0 / 1000.0).toInt()
"LastConn: $agoMin min ago\n" "LastConn: $agoMin min ago\n"
} }
if (pumpStatusData.lastBolusTime?.time != 0L) { pumpStatusData.lastBolusTime?.let {
ret += "LastBolus: ${to2Decimal(pumpStatusData.lastBolusAmount!!)}U @${DateFormat.format("HH:mm", pumpStatusData.lastBolusTime)}" if (it.time != 0L) {
ret += "LastBolus: ${to2Decimal(pumpStatusData.lastBolusAmount!!)}U @${DateFormat.format("HH:mm", it)}\n"
} }
val activeTemp = pumpSync.expectedPumpState().temporaryBasal
if (activeTemp != null) {
ret += """
Temp: ${activeTemp.toStringFull(dateUtil)}
""".trimIndent()
} }
val activeExtendedBolus = pumpSync.expectedPumpState().extendedBolus pumpSync.expectedPumpState().temporaryBasal?.let { ret += "Temp: ${it.toStringFull(dateUtil)}\n" }
if (activeExtendedBolus != null) { pumpSync.expectedPumpState().extendedBolus?.let { ret += "Extended: ${it.toStringFull(dateUtil)}\n" }
ret += """ ret += "IOB: ${pumpStatusData.iob}U\n"
Extended: ${activeExtendedBolus.toStringFull(dateUtil)} ret += "Reserv: ${to0Decimal(pumpStatusData.reservoirRemainingUnits)}U\n"
ret += "Batt: ${pumpStatusData.batteryRemaining}\n"
""".trimIndent()
}
// if (!veryShort) {
// ret += "TDD: " + DecimalFormatter.to0Decimal(pumpStatus.dailyTotalUnits) + " / "
// + pumpStatus.maxDailyTotalUnits + " U\n";
// }
ret += """
IOB: ${pumpStatusData.iob}U
""".trimIndent()
ret += """
Reserv: ${to0Decimal(pumpStatusData.reservoirRemainingUnits)}U
""".trimIndent()
ret += """
Batt: ${pumpStatusData.batteryRemaining}
""".trimIndent()
return ret return ret
} }