remove sensitivity dependencies
This commit is contained in:
parent
7f90807033
commit
28b9d178e7
|
@ -17,9 +17,9 @@ import info.nightscout.androidaps.plugins.general.overview.OverviewMenus
|
|||
import info.nightscout.androidaps.plugins.general.overview.events.EventUpdateOverviewGraph
|
||||
import info.nightscout.androidaps.plugins.general.overview.graphData.GraphData
|
||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventIobCalculationProgress
|
||||
import info.nightscout.androidaps.workflow.CalculationWorkflow
|
||||
import info.nightscout.core.activities.NoSplashAppCompatActivity
|
||||
import info.nightscout.core.utils.fabric.FabricPrivacy
|
||||
import info.nightscout.core.workflow.CalculationWorkflow
|
||||
import info.nightscout.interfaces.Config
|
||||
import info.nightscout.interfaces.plugin.ActivePlugin
|
||||
import info.nightscout.interfaces.profile.DefaultValueHelper
|
||||
|
|
|
@ -2,9 +2,9 @@ package info.nightscout.androidaps.activities
|
|||
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin
|
||||
import info.nightscout.androidaps.workflow.CalculationWorkflow
|
||||
import info.nightscout.core.graph.OverviewData
|
||||
import info.nightscout.core.utils.fabric.FabricPrivacy
|
||||
import info.nightscout.core.workflow.CalculationWorkflow
|
||||
import info.nightscout.database.impl.AppRepository
|
||||
import info.nightscout.implementation.overview.OverviewDataImpl
|
||||
import info.nightscout.interfaces.plugin.ActivePlugin
|
||||
|
|
|
@ -13,7 +13,9 @@ import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
|
|||
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctionImpl
|
||||
import info.nightscout.androidaps.plugins.general.maintenance.ImportExportPrefsImpl
|
||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin
|
||||
import info.nightscout.androidaps.workflow.CalculationWorkflowImpl
|
||||
import info.nightscout.core.utils.fabric.FabricPrivacy
|
||||
import info.nightscout.core.workflow.CalculationWorkflow
|
||||
import info.nightscout.database.impl.AppRepository
|
||||
import info.nightscout.implementation.constraints.ConstraintsImpl
|
||||
import info.nightscout.interfaces.Config
|
||||
|
@ -107,6 +109,7 @@ open class AppModule {
|
|||
@Binds fun bindSmsCommunicatorInterface(smsCommunicatorPlugin: SmsCommunicatorPlugin): SmsCommunicator
|
||||
@Binds fun bindDataSyncSelectorInterface(dataSyncSelectorImplementation: DataSyncSelectorImplementation): DataSyncSelector
|
||||
@Binds fun bindActivityNamesInterface(activityNames: ActivityNamesImpl): ActivityNames
|
||||
@Binds fun bindCalculationWorkflowInterface(calculationWorkflow: CalculationWorkflowImpl): CalculationWorkflow
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@ import info.nightscout.androidaps.annotations.OpenForTesting
|
|||
import info.nightscout.androidaps.extensions.convertedToAbsolute
|
||||
import info.nightscout.androidaps.extensions.iobCalc
|
||||
import info.nightscout.androidaps.extensions.toTemporaryBasal
|
||||
import info.nightscout.androidaps.workflow.CalculationWorkflow
|
||||
import info.nightscout.core.graph.OverviewData
|
||||
import info.nightscout.core.iob.combine
|
||||
import info.nightscout.core.iob.copy
|
||||
|
@ -15,6 +14,7 @@ import info.nightscout.core.iob.determineBasalJson
|
|||
import info.nightscout.core.iob.plus
|
||||
import info.nightscout.core.iob.round
|
||||
import info.nightscout.core.utils.fabric.FabricPrivacy
|
||||
import info.nightscout.core.workflow.CalculationWorkflow
|
||||
import info.nightscout.database.entities.Bolus
|
||||
import info.nightscout.database.entities.ExtendedBolus
|
||||
import info.nightscout.database.entities.TemporaryBasal
|
||||
|
|
|
@ -10,10 +10,10 @@ import info.nightscout.androidaps.R
|
|||
import info.nightscout.androidaps.extensions.target
|
||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.data.AutosensDataObject
|
||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventIobCalculationProgress
|
||||
import info.nightscout.androidaps.workflow.CalculationWorkflow
|
||||
import info.nightscout.core.events.EventNewNotification
|
||||
import info.nightscout.core.utils.fabric.FabricPrivacy
|
||||
import info.nightscout.core.utils.receivers.DataWorkerStorage
|
||||
import info.nightscout.core.workflow.CalculationWorkflow
|
||||
import info.nightscout.database.impl.AppRepository
|
||||
import info.nightscout.database.impl.ValueWrapper
|
||||
import info.nightscout.interfaces.Config
|
||||
|
@ -31,8 +31,6 @@ import info.nightscout.rx.events.Event
|
|||
import info.nightscout.rx.events.EventAutosensCalculationFinished
|
||||
import info.nightscout.rx.logging.AAPSLogger
|
||||
import info.nightscout.rx.logging.LTag
|
||||
import info.nightscout.sensitivity.SensitivityAAPSPlugin
|
||||
import info.nightscout.sensitivity.SensitivityWeightedAveragePlugin
|
||||
import info.nightscout.shared.interfaces.ResourceHelper
|
||||
import info.nightscout.shared.sharedPreferences.SP
|
||||
import info.nightscout.shared.utils.DateUtil
|
||||
|
@ -56,8 +54,6 @@ class IobCobOref1Worker(
|
|||
@Inject lateinit var rh: ResourceHelper
|
||||
@Inject lateinit var profileFunction: ProfileFunction
|
||||
@Inject lateinit var context: Context
|
||||
@Inject lateinit var sensitivityAAPSPlugin: SensitivityAAPSPlugin
|
||||
@Inject lateinit var sensitivityWeightedAveragePlugin: SensitivityWeightedAveragePlugin
|
||||
@Inject lateinit var activePlugin: ActivePlugin
|
||||
@Inject lateinit var config: Config
|
||||
@Inject lateinit var profiler: Profiler
|
||||
|
@ -202,7 +198,7 @@ class IobCobOref1Worker(
|
|||
val recentCarbTreatments = repository.getCarbsDataFromTimeToTimeExpanded(bgTime - T.mins(5).msecs(), bgTime, true).blockingGet()
|
||||
for (recentCarbTreatment in recentCarbTreatments) {
|
||||
autosensData.carbsFromBolus += recentCarbTreatment.amount
|
||||
val isAAPSOrWeighted = sensitivityAAPSPlugin.isEnabled() || sensitivityWeightedAveragePlugin.isEnabled()
|
||||
val isAAPSOrWeighted = activePlugin.activeSensitivity.isMinCarbsAbsorptionDynamic
|
||||
autosensData.activeCarbsList.add(fromCarbs(recentCarbTreatment, isAAPSOrWeighted, profileFunction, aapsLogger, dateUtil, sp))
|
||||
autosensData.pastSensitivity += "[" + DecimalFormatter.to0Decimal(recentCarbTreatment.amount) + "g]"
|
||||
}
|
||||
|
@ -227,7 +223,7 @@ class IobCobOref1Worker(
|
|||
autosensData.type = previous.type
|
||||
autosensData.uam = previous.uam
|
||||
}
|
||||
val isAAPSOrWeighted = sensitivityAAPSPlugin.isEnabled() || sensitivityWeightedAveragePlugin.isEnabled()
|
||||
val isAAPSOrWeighted = activePlugin.activeSensitivity.isMinCarbsAbsorptionDynamic
|
||||
autosensData.removeOldCarbs(bgTime, isAAPSOrWeighted)
|
||||
autosensData.cob += autosensData.carbsFromBolus
|
||||
autosensData.mealCarbs += autosensData.carbsFromBolus
|
||||
|
|
|
@ -9,10 +9,10 @@ import dagger.android.HasAndroidInjector
|
|||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.data.AutosensDataObject
|
||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventIobCalculationProgress
|
||||
import info.nightscout.androidaps.workflow.CalculationWorkflow
|
||||
import info.nightscout.core.events.EventNewNotification
|
||||
import info.nightscout.core.utils.fabric.FabricPrivacy
|
||||
import info.nightscout.core.utils.receivers.DataWorkerStorage
|
||||
import info.nightscout.core.workflow.CalculationWorkflow
|
||||
import info.nightscout.database.impl.AppRepository
|
||||
import info.nightscout.interfaces.Config
|
||||
import info.nightscout.interfaces.Constants
|
||||
|
@ -29,8 +29,6 @@ import info.nightscout.rx.events.Event
|
|||
import info.nightscout.rx.events.EventAutosensCalculationFinished
|
||||
import info.nightscout.rx.logging.AAPSLogger
|
||||
import info.nightscout.rx.logging.LTag
|
||||
import info.nightscout.sensitivity.SensitivityAAPSPlugin
|
||||
import info.nightscout.sensitivity.SensitivityWeightedAveragePlugin
|
||||
import info.nightscout.shared.interfaces.ResourceHelper
|
||||
import info.nightscout.shared.sharedPreferences.SP
|
||||
import info.nightscout.shared.utils.DateUtil
|
||||
|
@ -52,8 +50,6 @@ class IobCobOrefWorker @Inject internal constructor(
|
|||
@Inject lateinit var rh: ResourceHelper
|
||||
@Inject lateinit var profileFunction: ProfileFunction
|
||||
@Inject lateinit var context: Context
|
||||
@Inject lateinit var sensitivityAAPSPlugin: SensitivityAAPSPlugin
|
||||
@Inject lateinit var sensitivityWeightedAveragePlugin: SensitivityWeightedAveragePlugin
|
||||
@Inject lateinit var activePlugin: ActivePlugin
|
||||
@Inject lateinit var config: Config
|
||||
@Inject lateinit var profiler: Profiler
|
||||
|
@ -197,7 +193,7 @@ class IobCobOrefWorker @Inject internal constructor(
|
|||
val recentCarbTreatments = repository.getCarbsDataFromTimeToTimeExpanded(bgTime - T.mins(5).msecs(), bgTime, true).blockingGet()
|
||||
for (recentCarbTreatment in recentCarbTreatments) {
|
||||
autosensData.carbsFromBolus += recentCarbTreatment.amount
|
||||
val isAAPSOrWeighted = sensitivityAAPSPlugin.isEnabled() || sensitivityWeightedAveragePlugin.isEnabled()
|
||||
val isAAPSOrWeighted = activePlugin.activeSensitivity.isMinCarbsAbsorptionDynamic
|
||||
autosensData.activeCarbsList.add(fromCarbs(recentCarbTreatment, isAAPSOrWeighted, profileFunction, aapsLogger, dateUtil, sp))
|
||||
autosensData.pastSensitivity += "[" + DecimalFormatter.to0Decimal(recentCarbTreatment.amount) + "g]"
|
||||
}
|
||||
|
@ -206,7 +202,7 @@ class IobCobOrefWorker @Inject internal constructor(
|
|||
if (previous != null && previous.cob > 0) {
|
||||
// calculate sum of min carb impact from all active treatments
|
||||
var totalMinCarbsImpact = 0.0
|
||||
if (sensitivityAAPSPlugin.isEnabled() || sensitivityWeightedAveragePlugin.isEnabled()) {
|
||||
if (activePlugin.activeSensitivity.isMinCarbsAbsorptionDynamic) {
|
||||
//when the impact depends on a max time, sum them up as smaller carb sizes make them smaller
|
||||
for (ii in autosensData.activeCarbsList.indices) {
|
||||
val c = autosensData.activeCarbsList[ii]
|
||||
|
@ -227,7 +223,7 @@ class IobCobOrefWorker @Inject internal constructor(
|
|||
autosensData.deductAbsorbedCarbs()
|
||||
autosensData.usedMinCarbsImpact = totalMinCarbsImpact
|
||||
}
|
||||
val isAAPSOrWeighted = sensitivityAAPSPlugin.isEnabled() || sensitivityWeightedAveragePlugin.isEnabled()
|
||||
val isAAPSOrWeighted = activePlugin.activeSensitivity.isMinCarbsAbsorptionDynamic
|
||||
autosensData.removeOldCarbs(bgTime, isAAPSOrWeighted)
|
||||
autosensData.cob += autosensData.carbsFromBolus
|
||||
autosensData.deviation = deviation
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package info.nightscout.androidaps.plugins.iob.iobCobCalculator.events
|
||||
|
||||
import info.nightscout.androidaps.workflow.CalculationWorkflow
|
||||
import info.nightscout.core.workflow.CalculationWorkflow
|
||||
import info.nightscout.rx.events.Event
|
||||
|
||||
class EventIobCalculationProgress(val pass: CalculationWorkflow.ProgressData, val progressPct: Int, val cause: Event?) : Event()
|
|
@ -16,6 +16,9 @@ import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobOrefWorker
|
|||
import info.nightscout.core.graph.OverviewData
|
||||
import info.nightscout.core.utils.fabric.FabricPrivacy
|
||||
import info.nightscout.core.utils.receivers.DataWorkerStorage
|
||||
import info.nightscout.core.workflow.CalculationWorkflow
|
||||
import info.nightscout.core.workflow.CalculationWorkflow.Companion.JOB
|
||||
import info.nightscout.core.workflow.CalculationWorkflow.Companion.MAIN_CALCULATION
|
||||
import info.nightscout.interfaces.iob.IobCobCalculator
|
||||
import info.nightscout.interfaces.plugin.ActivePlugin
|
||||
import info.nightscout.rx.AapsSchedulers
|
||||
|
@ -28,7 +31,6 @@ import info.nightscout.rx.events.EventPreferenceChange
|
|||
import info.nightscout.rx.events.EventTherapyEventChange
|
||||
import info.nightscout.rx.logging.AAPSLogger
|
||||
import info.nightscout.rx.logging.LTag
|
||||
import info.nightscout.sensitivity.SensitivityOref1Plugin
|
||||
import info.nightscout.shared.interfaces.ResourceHelper
|
||||
import info.nightscout.shared.utils.DateUtil
|
||||
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
||||
|
@ -37,7 +39,7 @@ import javax.inject.Inject
|
|||
import javax.inject.Singleton
|
||||
|
||||
@Singleton
|
||||
class CalculationWorkflow @Inject constructor(
|
||||
class CalculationWorkflowImpl @Inject constructor(
|
||||
aapsSchedulers: AapsSchedulers,
|
||||
rh: ResourceHelper,
|
||||
rxBus: RxBus,
|
||||
|
@ -46,17 +48,9 @@ class CalculationWorkflow @Inject constructor(
|
|||
private val aapsLogger: AAPSLogger,
|
||||
private val fabricPrivacy: FabricPrivacy,
|
||||
private val dateUtil: DateUtil,
|
||||
private val sensitivityOref1Plugin: SensitivityOref1Plugin,
|
||||
private val dataWorkerStorage: DataWorkerStorage,
|
||||
private val activePlugin: ActivePlugin
|
||||
) {
|
||||
|
||||
companion object {
|
||||
|
||||
const val MAIN_CALCULATION = "calculation"
|
||||
const val HISTORY_CALCULATION = "history_calculation"
|
||||
const val JOB = "job"
|
||||
}
|
||||
) : CalculationWorkflow {
|
||||
|
||||
private var disposable: CompositeDisposable = CompositeDisposable()
|
||||
|
||||
|
@ -65,26 +59,10 @@ class CalculationWorkflow @Inject constructor(
|
|||
private val overviewData: OverviewData
|
||||
get() = (iobCobCalculator as IobCobCalculatorPlugin).overviewData
|
||||
|
||||
enum class ProgressData(private val pass: Int, val percentOfTotal: Int) {
|
||||
PREPARE_BASAL_DATA(0, 5),
|
||||
PREPARE_TEMPORARY_TARGET_DATA(1, 5),
|
||||
PREPARE_TREATMENTS_DATA(2, 5),
|
||||
IOB_COB_OREF(3, 74),
|
||||
PREPARE_IOB_AUTOSENS_DATA(4, 10),
|
||||
DRAW(5, 1);
|
||||
|
||||
fun finalPercent(progress: Int): Int {
|
||||
var total = 0
|
||||
for (i in values()) if (i.pass < pass) total += i.percentOfTotal
|
||||
total += (percentOfTotal.toDouble() * progress / 100.0).toInt()
|
||||
return total
|
||||
}
|
||||
}
|
||||
|
||||
init {
|
||||
// Verify definition
|
||||
var sumPercent = 0
|
||||
for (pass in ProgressData.values()) sumPercent += pass.percentOfTotal
|
||||
for (pass in CalculationWorkflow.ProgressData.values()) sumPercent += pass.percentOfTotal
|
||||
require(sumPercent == 100)
|
||||
|
||||
disposable += rxBus
|
||||
|
@ -131,7 +109,7 @@ class CalculationWorkflow @Inject constructor(
|
|||
|
||||
}
|
||||
|
||||
fun stopCalculation(job: String, from: String) {
|
||||
override fun stopCalculation(job: String, from: String) {
|
||||
aapsLogger.debug(LTag.AUTOSENS, "Stopping calculation thread: $from")
|
||||
WorkManager.getInstance(context).cancelUniqueWork(job)
|
||||
val workStatus = WorkManager.getInstance(context).getWorkInfosForUniqueWork(job).get()
|
||||
|
@ -140,7 +118,7 @@ class CalculationWorkflow @Inject constructor(
|
|||
aapsLogger.debug(LTag.AUTOSENS, "Calculation thread stopped: $from")
|
||||
}
|
||||
|
||||
fun runCalculation(
|
||||
override fun runCalculation(
|
||||
job: String,
|
||||
iobCobCalculator: IobCobCalculator,
|
||||
overviewData: OverviewData,
|
||||
|
@ -195,7 +173,7 @@ class CalculationWorkflow @Inject constructor(
|
|||
.build()
|
||||
)
|
||||
.then(
|
||||
if (sensitivityOref1Plugin.isEnabled())
|
||||
if (activePlugin.activeSensitivity.isOref1)
|
||||
OneTimeWorkRequest.Builder(IobCobOref1Worker::class.java)
|
||||
.setInputData(dataWorkerStorage.storeInputData(IobCobOref1Worker.IobCobOref1WorkerData(injector, iobCobCalculator, from, end, limitDataToOldestAvailable, cause)))
|
||||
.build()
|
|
@ -13,6 +13,7 @@ import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventIobCa
|
|||
import info.nightscout.core.graph.OverviewData
|
||||
import info.nightscout.core.graph.data.ScaledDataPoint
|
||||
import info.nightscout.core.utils.receivers.DataWorkerStorage
|
||||
import info.nightscout.core.workflow.CalculationWorkflow
|
||||
import info.nightscout.interfaces.iob.IobCobCalculator
|
||||
import info.nightscout.interfaces.profile.ProfileFunction
|
||||
import info.nightscout.rx.bus.RxBus
|
||||
|
|
|
@ -23,6 +23,7 @@ import info.nightscout.core.graph.data.ScaledDataPoint
|
|||
import info.nightscout.core.iob.combine
|
||||
import info.nightscout.core.iob.copy
|
||||
import info.nightscout.core.utils.receivers.DataWorkerStorage
|
||||
import info.nightscout.core.workflow.CalculationWorkflow
|
||||
import info.nightscout.database.impl.AppRepository
|
||||
import info.nightscout.database.impl.ValueWrapper
|
||||
import info.nightscout.interfaces.aps.AutosensResult
|
||||
|
|
|
@ -12,6 +12,7 @@ import info.nightscout.androidaps.extensions.target
|
|||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventIobCalculationProgress
|
||||
import info.nightscout.core.graph.OverviewData
|
||||
import info.nightscout.core.utils.receivers.DataWorkerStorage
|
||||
import info.nightscout.core.workflow.CalculationWorkflow
|
||||
import info.nightscout.database.impl.AppRepository
|
||||
import info.nightscout.database.impl.ValueWrapper
|
||||
import info.nightscout.interfaces.aps.Loop
|
||||
|
|
|
@ -15,6 +15,7 @@ import info.nightscout.core.graph.data.ExtendedBolusDataPoint
|
|||
import info.nightscout.core.graph.data.PointsWithLabelGraphSeries
|
||||
import info.nightscout.core.graph.data.TherapyEventDataPoint
|
||||
import info.nightscout.core.utils.receivers.DataWorkerStorage
|
||||
import info.nightscout.core.workflow.CalculationWorkflow
|
||||
import info.nightscout.database.entities.Bolus
|
||||
import info.nightscout.database.entities.TherapyEvent
|
||||
import info.nightscout.database.impl.AppRepository
|
||||
|
|
|
@ -7,6 +7,7 @@ import dagger.android.HasAndroidInjector
|
|||
import info.nightscout.androidaps.plugins.general.overview.OverviewPlugin
|
||||
import info.nightscout.androidaps.plugins.general.overview.events.EventUpdateOverviewGraph
|
||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventIobCalculationProgress
|
||||
import info.nightscout.core.workflow.CalculationWorkflow
|
||||
import info.nightscout.rx.bus.RxBus
|
||||
import javax.inject.Inject
|
||||
|
||||
|
|
|
@ -32,6 +32,8 @@ class AbstractSensitivityPluginTest : TestBase() {
|
|||
get() = Sensitivity.SensitivityType.UNKNOWN
|
||||
|
||||
override fun maxAbsorptionHours(): Double = 8.0
|
||||
override val isMinCarbsAbsorptionDynamic: Boolean = true
|
||||
override val isOref1: Boolean = true
|
||||
|
||||
override fun configuration(): JSONObject = JSONObject()
|
||||
|
||||
|
|
|
@ -14,12 +14,12 @@ apply from: "${project.rootDir}/core/core-main/test_dependencies.gradle"
|
|||
apply from: "${project.rootDir}/core/core-main/jacoco_global.gradle"
|
||||
|
||||
dependencies {
|
||||
implementation project(':graphview')
|
||||
implementation project(':app-wear-shared:rx')
|
||||
implementation project(':app-wear-shared:shared')
|
||||
implementation project(':database:entities')
|
||||
implementation project(':database:impl')
|
||||
implementation project(':interfaces')
|
||||
implementation project(':core:graph')
|
||||
implementation project(':core:ui')
|
||||
implementation project(':core:utils')
|
||||
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
package info.nightscout.core.workflow
|
||||
|
||||
import info.nightscout.core.graph.OverviewData
|
||||
import info.nightscout.interfaces.iob.IobCobCalculator
|
||||
import info.nightscout.rx.events.Event
|
||||
|
||||
interface CalculationWorkflow {
|
||||
companion object {
|
||||
|
||||
const val MAIN_CALCULATION = "calculation"
|
||||
const val HISTORY_CALCULATION = "history_calculation"
|
||||
const val JOB = "job"
|
||||
}
|
||||
|
||||
enum class ProgressData(private val pass: Int, val percentOfTotal: Int) {
|
||||
PREPARE_BASAL_DATA(0, 5),
|
||||
PREPARE_TEMPORARY_TARGET_DATA(1, 5),
|
||||
PREPARE_TREATMENTS_DATA(2, 5),
|
||||
IOB_COB_OREF(3, 74),
|
||||
PREPARE_IOB_AUTOSENS_DATA(4, 10),
|
||||
DRAW(5, 1);
|
||||
|
||||
fun finalPercent(progress: Int): Int {
|
||||
var total = 0
|
||||
for (i in values()) if (i.pass < pass) total += i.percentOfTotal
|
||||
total += (percentOfTotal.toDouble() * progress / 100.0).toInt()
|
||||
return total
|
||||
}
|
||||
}
|
||||
|
||||
fun stopCalculation(job: String, from: String)
|
||||
fun runCalculation(
|
||||
job: String,
|
||||
iobCobCalculator: IobCobCalculator,
|
||||
overviewData: OverviewData,
|
||||
from: String,
|
||||
end: Long,
|
||||
bgDataReload: Boolean,
|
||||
limitDataToOldestAvailable: Boolean,
|
||||
cause: Event?,
|
||||
runLoop: Boolean
|
||||
)
|
||||
}
|
|
@ -21,6 +21,8 @@ interface Sensitivity : ConfigExportImport {
|
|||
fun detectSensitivity(ads: AutosensDataStore, fromTime: Long, toTime: Long): AutosensResult
|
||||
fun maxAbsorptionHours(): Double
|
||||
|
||||
val isMinCarbsAbsorptionDynamic: Boolean
|
||||
val isOref1: Boolean
|
||||
companion object {
|
||||
|
||||
const val MIN_HOURS = 1.0
|
||||
|
|
|
@ -140,6 +140,8 @@ class SensitivityAAPSPlugin @Inject constructor(
|
|||
}
|
||||
|
||||
override fun maxAbsorptionHours(): Double = sp.getDouble(R.string.key_absorption_maxtime, Constants.DEFAULT_MAX_ABSORPTION_TIME)
|
||||
override val isMinCarbsAbsorptionDynamic: Boolean = true
|
||||
override val isOref1: Boolean = false
|
||||
|
||||
override val id: SensitivityType
|
||||
get() = SensitivityType.SENSITIVITY_AAPS
|
||||
|
|
|
@ -205,6 +205,8 @@ class SensitivityOref1Plugin @Inject constructor(
|
|||
}
|
||||
|
||||
override fun maxAbsorptionHours(): Double = sp.getDouble(R.string.key_absorption_cutoff, Constants.DEFAULT_MAX_ABSORPTION_TIME)
|
||||
override val isMinCarbsAbsorptionDynamic: Boolean = false
|
||||
override val isOref1: Boolean = true
|
||||
|
||||
override fun configuration(): JSONObject {
|
||||
val c = JSONObject()
|
||||
|
|
|
@ -160,6 +160,8 @@ class SensitivityWeightedAveragePlugin @Inject constructor(
|
|||
}
|
||||
|
||||
override fun maxAbsorptionHours(): Double = sp.getDouble(R.string.key_absorption_maxtime, Constants.DEFAULT_MAX_ABSORPTION_TIME)
|
||||
override val isMinCarbsAbsorptionDynamic: Boolean = true
|
||||
override val isOref1: Boolean = false
|
||||
|
||||
override val id: SensitivityType
|
||||
get() = SensitivityType.SENSITIVITY_WEIGHTED
|
||||
|
|
Loading…
Reference in a new issue