Merge branch 'dev' of https://github.com/nightscout/AndroidAPS into dev
This commit is contained in:
commit
0a31d79e29
4 changed files with 25 additions and 85 deletions
|
@ -22,7 +22,6 @@ import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin
|
|||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
|
||||
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
||||
import info.nightscout.androidaps.plugins.constraints.objectives.ObjectivesPlugin
|
||||
import info.nightscout.androidaps.queue.Callback
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||
import info.nightscout.androidaps.utils.ToastUtils
|
||||
|
@ -42,7 +41,6 @@ class LoopDialog : DaggerDialogFragment() {
|
|||
@Inject lateinit var resourceHelper: ResourceHelper
|
||||
@Inject lateinit var profileFunction: ProfileFunction
|
||||
@Inject lateinit var loopPlugin: LoopPlugin
|
||||
@Inject lateinit var objectivesPlugin: ObjectivesPlugin
|
||||
@Inject lateinit var activePlugin: ActivePluginProvider
|
||||
@Inject lateinit var constraintChecker: ConstraintChecker
|
||||
@Inject lateinit var commandQueue: CommandQueueProvider
|
||||
|
@ -107,7 +105,7 @@ class LoopDialog : DaggerDialogFragment() {
|
|||
binding.cancel.setOnClickListener { dismiss() }
|
||||
|
||||
refreshDialog = Runnable {
|
||||
scheduleUpdateGUI("refreshDialog")
|
||||
scheduleUpdateGUI()
|
||||
loopHandler.postDelayed(refreshDialog, 15 * 1000L)
|
||||
}
|
||||
loopHandler.postDelayed(refreshDialog, 15 * 1000L)
|
||||
|
@ -122,11 +120,11 @@ class LoopDialog : DaggerDialogFragment() {
|
|||
|
||||
var task: Runnable? = null
|
||||
|
||||
private fun scheduleUpdateGUI(from: String) {
|
||||
private fun scheduleUpdateGUI() {
|
||||
class UpdateRunnable : Runnable {
|
||||
|
||||
override fun run() {
|
||||
updateGUI(from)
|
||||
updateGUI("refreshDialog")
|
||||
task = null
|
||||
}
|
||||
}
|
||||
|
@ -140,8 +138,8 @@ class LoopDialog : DaggerDialogFragment() {
|
|||
if (_binding == null) return
|
||||
aapsLogger.debug("UpdateGUI from $from")
|
||||
val pumpDescription: PumpDescription = activePlugin.activePump.pumpDescription
|
||||
val closedLoopAllowed = objectivesPlugin.isClosedLoopAllowed(Constraint(true))
|
||||
val lgsEnabled = objectivesPlugin.isLgsAllowed(Constraint(true))
|
||||
val closedLoopAllowed = constraintChecker.isClosedLoopAllowed(Constraint(true))
|
||||
val lgsEnabled = constraintChecker.isLgsAllowed(Constraint(true))
|
||||
val apsMode = sp.getString(R.string.key_aps_mode, "open")
|
||||
if (profileFunction.isProfileValid("LoopDialogUpdateGUI")) {
|
||||
if (loopPlugin.isEnabled(PluginType.LOOP)) {
|
||||
|
|
|
@ -165,7 +165,7 @@ class ObjectivesPlugin @Inject constructor(
|
|||
return value
|
||||
}
|
||||
|
||||
fun isLgsAllowed(value: Constraint<Boolean>): Constraint<Boolean> {
|
||||
override fun isLgsAllowed(value: Constraint<Boolean>): Constraint<Boolean> {
|
||||
if (!objectives[MAXBASAL_OBJECTIVE].isStarted)
|
||||
value.set(aapsLogger, false, String.format(resourceHelper.gs(R.string.objectivenotstarted), MAXBASAL_OBJECTIVE + 1), this)
|
||||
return value
|
||||
|
|
|
@ -46,9 +46,9 @@ public class Constants {
|
|||
public static final int defaultEatingSoonTTDuration = 45; // min
|
||||
public static final double defaultEatingSoonTTmgdl = 90d;
|
||||
public static final double defaultEatingSoonTTmmol = 5d;
|
||||
public static final int defaultHypoTTDuration = 30; // min
|
||||
public static final double defaultHypoTTmgdl = 120d;
|
||||
public static final double defaultHypoTTmmol = 6.5d;
|
||||
public static final int defaultHypoTTDuration = 60; // min
|
||||
public static final double defaultHypoTTmgdl = 160d;
|
||||
public static final double defaultHypoTTmmol = 8d;
|
||||
|
||||
public static final double MIN_TT_MGDL = 72d;
|
||||
public static final double MAX_TT_MGDL = 180d;
|
||||
|
|
|
@ -7,78 +7,20 @@ import info.nightscout.androidaps.data.Profile
|
|||
*/
|
||||
interface ConstraintsInterface {
|
||||
|
||||
@JvmDefault
|
||||
fun isLoopInvocationAllowed(value: Constraint<Boolean>): Constraint<Boolean> {
|
||||
return value
|
||||
}
|
||||
|
||||
@JvmDefault
|
||||
fun isClosedLoopAllowed(value: Constraint<Boolean>): Constraint<Boolean> {
|
||||
return value
|
||||
}
|
||||
|
||||
@JvmDefault
|
||||
fun isAutosensModeEnabled(value: Constraint<Boolean>): Constraint<Boolean> {
|
||||
return value
|
||||
}
|
||||
|
||||
@JvmDefault
|
||||
fun isAMAModeEnabled(value: Constraint<Boolean>): Constraint<Boolean> {
|
||||
return value
|
||||
}
|
||||
|
||||
@JvmDefault
|
||||
fun isSMBModeEnabled(value: Constraint<Boolean>): Constraint<Boolean> {
|
||||
return value
|
||||
}
|
||||
|
||||
@JvmDefault
|
||||
fun isUAMEnabled(value: Constraint<Boolean>): Constraint<Boolean> {
|
||||
return value
|
||||
}
|
||||
|
||||
@JvmDefault
|
||||
fun isAdvancedFilteringEnabled(value: Constraint<Boolean>): Constraint<Boolean> {
|
||||
return value
|
||||
}
|
||||
|
||||
@JvmDefault
|
||||
fun isSuperBolusEnabled(value: Constraint<Boolean>): Constraint<Boolean> {
|
||||
return value
|
||||
}
|
||||
|
||||
@JvmDefault
|
||||
fun applyBasalConstraints(absoluteRate: Constraint<Double>, profile: Profile): Constraint<Double> {
|
||||
return absoluteRate
|
||||
}
|
||||
|
||||
@JvmDefault
|
||||
fun applyBasalPercentConstraints(percentRate: Constraint<Int>, profile: Profile): Constraint<Int> {
|
||||
return percentRate
|
||||
}
|
||||
|
||||
@JvmDefault
|
||||
fun applyBolusConstraints(insulin: Constraint<Double>): Constraint<Double> {
|
||||
return insulin
|
||||
}
|
||||
|
||||
@JvmDefault
|
||||
fun applyExtendedBolusConstraints(insulin: Constraint<Double>): Constraint<Double> {
|
||||
return insulin
|
||||
}
|
||||
|
||||
@JvmDefault
|
||||
fun applyCarbsConstraints(carbs: Constraint<Int>): Constraint<Int> {
|
||||
return carbs
|
||||
}
|
||||
|
||||
@JvmDefault
|
||||
fun applyMaxIOBConstraints(maxIob: Constraint<Double>): Constraint<Double> {
|
||||
return maxIob
|
||||
}
|
||||
|
||||
@JvmDefault
|
||||
fun isAutomationEnabled(value: Constraint<Boolean>): Constraint<Boolean> {
|
||||
return value
|
||||
}
|
||||
@JvmDefault fun isLoopInvocationAllowed(value: Constraint<Boolean>): Constraint<Boolean> = value
|
||||
@JvmDefault fun isClosedLoopAllowed(value: Constraint<Boolean>): Constraint<Boolean> = value
|
||||
@JvmDefault fun isLgsAllowed(value: Constraint<Boolean>): Constraint<Boolean> = value
|
||||
@JvmDefault fun isAutosensModeEnabled(value: Constraint<Boolean>): Constraint<Boolean> = value
|
||||
@JvmDefault fun isAMAModeEnabled(value: Constraint<Boolean>): Constraint<Boolean> = value
|
||||
@JvmDefault fun isSMBModeEnabled(value: Constraint<Boolean>): Constraint<Boolean> = value
|
||||
@JvmDefault fun isUAMEnabled(value: Constraint<Boolean>): Constraint<Boolean> = value
|
||||
@JvmDefault fun isAdvancedFilteringEnabled(value: Constraint<Boolean>): Constraint<Boolean> = value
|
||||
@JvmDefault fun isSuperBolusEnabled(value: Constraint<Boolean>): Constraint<Boolean> = value
|
||||
@JvmDefault fun applyBasalConstraints(absoluteRate: Constraint<Double>, profile: Profile): Constraint<Double> = absoluteRate
|
||||
@JvmDefault fun applyBasalPercentConstraints(percentRate: Constraint<Int>, profile: Profile): Constraint<Int> = percentRate
|
||||
@JvmDefault fun applyBolusConstraints(insulin: Constraint<Double>): Constraint<Double> = insulin
|
||||
@JvmDefault fun applyExtendedBolusConstraints(insulin: Constraint<Double>): Constraint<Double> = insulin
|
||||
@JvmDefault fun applyCarbsConstraints(carbs: Constraint<Int>): Constraint<Int> = carbs
|
||||
@JvmDefault fun applyMaxIOBConstraints(maxIob: Constraint<Double>): Constraint<Double> = maxIob
|
||||
@JvmDefault fun isAutomationEnabled(value: Constraint<Boolean>): Constraint<Boolean> = value
|
||||
}
|
Loading…
Reference in a new issue