Merge branch 'dev' into omnipod_eros_dev_upstream_merge

This commit is contained in:
Bart Sopers 2020-11-13 14:50:55 +01:00
commit 728b666834
3 changed files with 6 additions and 3 deletions

View file

@ -62,7 +62,7 @@ class TddCalculator @Inject constructor(
val midnight = MidnightTime.calc(t)
val tdd = result[midnight] ?: TDD(midnight, 0.0, 0.0, 0.0)
val tbr = getTempBasalFromHistory(t)
val profile = profileFunction.getProfile(t) ?: continue
val profile = profileFunction.getProfile(t, this) ?: continue
val absoluteRate = tbr?.tempBasalConvertedToAbsolute(t, profile) ?: profile.getBasal(t)
tdd.basal += absoluteRate / 60.0 * 5.0

View file

@ -13,5 +13,6 @@ interface ProfileFunction {
fun getProfile(): Profile?
fun getUnits(): String
fun getProfile(time: Long): Profile?
fun getProfile(time: Long, activeTreatments: TreatmentsInterface): Profile?
fun prepareProfileSwitch(profileStore: ProfileStore, profileName: String, duration: Int, percentage: Int, timeShift: Int, date: Long): ProfileSwitch
}

View file

@ -11,6 +11,7 @@ import info.nightscout.androidaps.db.Source
import info.nightscout.androidaps.interfaces.ProfileStore
import info.nightscout.androidaps.interfaces.ActivePluginProvider
import info.nightscout.androidaps.interfaces.ProfileFunction
import info.nightscout.androidaps.interfaces.TreatmentsInterface
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.FabricPrivacy
@ -70,8 +71,9 @@ class ProfileFunctionImplementation @Inject constructor(
override fun getProfile(): Profile? =
getProfile(System.currentTimeMillis())
override fun getProfile(time: Long): Profile? {
val activeTreatments = activePlugin.activeTreatments
override fun getProfile(time: Long): Profile? = getProfile(time, activePlugin.activeTreatments)
override fun getProfile(time: Long, activeTreatments: TreatmentsInterface): Profile? {
val activeProfile = activePlugin.activeProfileInterface
//log.debug("Profile for: " + new Date(time).toLocaleString() + " : " + getProfileName(time));