Do not allow select DynISF without objective started
This commit is contained in:
parent
8070cac850
commit
b5e00f9c1d
4 changed files with 13 additions and 5 deletions
|
@ -6,6 +6,7 @@ import app.aaps.core.interfaces.aps.DetermineBasalAdapter
|
||||||
import app.aaps.core.interfaces.bgQualityCheck.BgQualityCheck
|
import app.aaps.core.interfaces.bgQualityCheck.BgQualityCheck
|
||||||
import app.aaps.core.interfaces.constraints.Constraint
|
import app.aaps.core.interfaces.constraints.Constraint
|
||||||
import app.aaps.core.interfaces.constraints.ConstraintsChecker
|
import app.aaps.core.interfaces.constraints.ConstraintsChecker
|
||||||
|
import app.aaps.core.interfaces.constraints.Objectives
|
||||||
import app.aaps.core.interfaces.iob.GlucoseStatusProvider
|
import app.aaps.core.interfaces.iob.GlucoseStatusProvider
|
||||||
import app.aaps.core.interfaces.iob.IobCobCalculator
|
import app.aaps.core.interfaces.iob.IobCobCalculator
|
||||||
import app.aaps.core.interfaces.logging.AAPSLogger
|
import app.aaps.core.interfaces.logging.AAPSLogger
|
||||||
|
@ -50,7 +51,8 @@ class OpenAPSSMBDynamicISFPlugin @Inject constructor(
|
||||||
glucoseStatusProvider: GlucoseStatusProvider,
|
glucoseStatusProvider: GlucoseStatusProvider,
|
||||||
bgQualityCheck: BgQualityCheck,
|
bgQualityCheck: BgQualityCheck,
|
||||||
tddCalculator: TddCalculator,
|
tddCalculator: TddCalculator,
|
||||||
private val uiInteraction: UiInteraction
|
private val uiInteraction: UiInteraction,
|
||||||
|
private val objectives: Objectives
|
||||||
) : OpenAPSSMBPlugin(
|
) : OpenAPSSMBPlugin(
|
||||||
injector,
|
injector,
|
||||||
aapsLogger,
|
aapsLogger,
|
||||||
|
@ -80,6 +82,9 @@ class OpenAPSSMBDynamicISFPlugin @Inject constructor(
|
||||||
.setDefault(false)
|
.setDefault(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun specialEnableCondition(): Boolean =
|
||||||
|
objectives.isStarted(Objectives.DYN_ISF_OBJECTIVE)
|
||||||
|
|
||||||
// If there is no TDD data fallback to SMB as ISF calculation may be really off
|
// If there is no TDD data fallback to SMB as ISF calculation may be really off
|
||||||
override fun provideDetermineBasalAdapter(): DetermineBasalAdapter =
|
override fun provideDetermineBasalAdapter(): DetermineBasalAdapter =
|
||||||
if (tdd1D == null || tdd7D == null || tddLast4H == null || tddLast8to4H == null || tddLast24H == null || !dynIsfEnabled.value()) {
|
if (tdd1D == null || tdd7D == null || tddLast4H == null || tddLast8to4H == null || tddLast24H == null || !dynIsfEnabled.value()) {
|
||||||
|
|
|
@ -2,11 +2,13 @@ package app.aaps.plugins.constraints.di
|
||||||
|
|
||||||
import app.aaps.core.interfaces.bgQualityCheck.BgQualityCheck
|
import app.aaps.core.interfaces.bgQualityCheck.BgQualityCheck
|
||||||
import app.aaps.core.interfaces.constraints.ConstraintsChecker
|
import app.aaps.core.interfaces.constraints.ConstraintsChecker
|
||||||
|
import app.aaps.core.interfaces.constraints.Objectives
|
||||||
import app.aaps.core.interfaces.versionChecker.VersionCheckerUtils
|
import app.aaps.core.interfaces.versionChecker.VersionCheckerUtils
|
||||||
import dagger.Binds
|
import dagger.Binds
|
||||||
import dagger.Module
|
import dagger.Module
|
||||||
import app.aaps.plugins.constraints.ConstraintsCheckerImpl
|
import app.aaps.plugins.constraints.ConstraintsCheckerImpl
|
||||||
import app.aaps.plugins.constraints.bgQualityCheck.BgQualityCheckPlugin
|
import app.aaps.plugins.constraints.bgQualityCheck.BgQualityCheckPlugin
|
||||||
|
import app.aaps.plugins.constraints.objectives.ObjectivesPlugin
|
||||||
import app.aaps.plugins.constraints.versionChecker.VersionCheckerUtilsImpl
|
import app.aaps.plugins.constraints.versionChecker.VersionCheckerUtilsImpl
|
||||||
|
|
||||||
@Module(
|
@Module(
|
||||||
|
@ -25,5 +27,6 @@ abstract class PluginsConstraintsModule {
|
||||||
@Binds fun bindVersionCheckerUtils(versionCheckerUtils: VersionCheckerUtilsImpl): VersionCheckerUtils
|
@Binds fun bindVersionCheckerUtils(versionCheckerUtils: VersionCheckerUtilsImpl): VersionCheckerUtils
|
||||||
@Binds fun bindBgQualityCheck(bgQualityCheck: BgQualityCheckPlugin): BgQualityCheck
|
@Binds fun bindBgQualityCheck(bgQualityCheck: BgQualityCheckPlugin): BgQualityCheck
|
||||||
@Binds fun bindsConstraintChecker(constraintsCheckerImpl: ConstraintsCheckerImpl): ConstraintsChecker
|
@Binds fun bindsConstraintChecker(constraintsCheckerImpl: ConstraintsCheckerImpl): ConstraintsChecker
|
||||||
|
@Binds fun bindsObjectives(objectivesPlugin: ObjectivesPlugin): Objectives
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -58,11 +58,9 @@ class ObjectivesPlugin @Inject constructor(
|
||||||
|
|
||||||
var objectives: MutableList<Objective> = ArrayList()
|
var objectives: MutableList<Objective> = ArrayList()
|
||||||
|
|
||||||
public override fun onStart() {
|
init {
|
||||||
super.onStart()
|
|
||||||
setupObjectives()
|
setupObjectives()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun specialEnableCondition(): Boolean =
|
override fun specialEnableCondition(): Boolean =
|
||||||
activePlugin.activePump.pumpDescription.isTempBasalCapable
|
activePlugin.activePump.pumpDescription.isTempBasalCapable
|
||||||
|
|
||||||
|
|
|
@ -138,6 +138,7 @@ class ConstraintsCheckerImplTest : TestBaseWithProfile() {
|
||||||
insightDbHelper = InsightDbHelper(insightDatabaseDao)
|
insightDbHelper = InsightDbHelper(insightDatabaseDao)
|
||||||
danaPump = DanaPump(aapsLogger, sp, dateUtil, instantiator, decimalFormatter)
|
danaPump = DanaPump(aapsLogger, sp, dateUtil, instantiator, decimalFormatter)
|
||||||
objectivesPlugin = ObjectivesPlugin(injector, aapsLogger, rh, activePlugin, sp, config)
|
objectivesPlugin = ObjectivesPlugin(injector, aapsLogger, rh, activePlugin, sp, config)
|
||||||
|
objectivesPlugin.onStart()
|
||||||
comboPlugin = ComboPlugin(injector, aapsLogger, rxBus, rh, profileFunction, sp, commandQueue, pumpSync, dateUtil, ruffyScripter, uiInteraction)
|
comboPlugin = ComboPlugin(injector, aapsLogger, rxBus, rh, profileFunction, sp, commandQueue, pumpSync, dateUtil, ruffyScripter, uiInteraction)
|
||||||
danaRPlugin = DanaRPlugin(
|
danaRPlugin = DanaRPlugin(
|
||||||
injector, aapsLogger, aapsSchedulers, rxBus, context, rh, constraintChecker, activePlugin, sp, commandQueue, danaPump, dateUtil, fabricPrivacy, pumpSync,
|
injector, aapsLogger, aapsSchedulers, rxBus, context, rh, constraintChecker, activePlugin, sp, commandQueue, danaPump, dateUtil, fabricPrivacy, pumpSync,
|
||||||
|
@ -189,7 +190,8 @@ class ConstraintsCheckerImplTest : TestBaseWithProfile() {
|
||||||
glucoseStatusProvider,
|
glucoseStatusProvider,
|
||||||
bgQualityCheck,
|
bgQualityCheck,
|
||||||
tddCalculator,
|
tddCalculator,
|
||||||
uiInteraction
|
uiInteraction,
|
||||||
|
objectivesPlugin
|
||||||
)
|
)
|
||||||
openAPSAMAPlugin =
|
openAPSAMAPlugin =
|
||||||
OpenAPSAMAPlugin(
|
OpenAPSAMAPlugin(
|
||||||
|
|
Loading…
Reference in a new issue