Rework tbr

This commit is contained in:
swissalpine 2023-11-30 11:44:42 +01:00 committed by GitHub
parent 68720cb2da
commit 9b2441f457
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -327,8 +327,13 @@ class GarminPlugin @Inject constructor(
GlucoseUnit.MGDL -> jo.addProperty("units_hint", "mgdl")
GlucoseUnit.MMOL -> jo.addProperty("units_hint", "mmol")
}
jo.addProperty("iob", loopHub.insulinTotalOnboard)
jo.addProperty("tbr", loopHub.temporaryBasalPercent)
jo.addProperty("iob", loopHub.insulinOnboard + loopHub.insulinBasalOnboard)
loopHub.temporaryBasal.also {
if (!it.isNaN()) {
val temporaryBasalRateInPercent = (it * 100.0).toInt()
jo.addProperty("tbr", temporaryBasalRateInPercent)
}
}
jo.addProperty("cob", loopHub.carbsOnboard)
}
joa.add(jo)