show disabled closed reasons

This commit is contained in:
Milos Kozak 2022-09-16 22:08:36 +02:00
parent 867302dd29
commit 8d0d8d3866
3 changed files with 6 additions and 3 deletions

View file

@ -130,13 +130,14 @@ class LoopFragment : DaggerFragment(), MenuProvider {
binding.smbsetbypump.text = it.smbSetByPump?.let { smbSetByPump -> HtmlHelper.fromHtml(smbSetByPump.toHtml()) }
?: ""
val constraints =
var constraints =
it.constraintsProcessed?.let { constraintsProcessed ->
val allConstraints = Constraint(0.0)
constraintsProcessed.rateConstraint?.let { rateConstraint -> allConstraints.copyReasons(rateConstraint) }
constraintsProcessed.smbConstraint?.let { smbConstraint -> allConstraints.copyReasons(smbConstraint) }
allConstraints.getMostLimitedReasons(aapsLogger)
} ?: ""
constraints += loop.closedLoopEnabled?.getReasons(aapsLogger) ?: ""
binding.constraints.text = constraints
binding.swipeRefresh.isRefreshing = false
}

View file

@ -105,6 +105,7 @@ class LoopPlugin @Inject constructor(
private var carbsSuggestionsSuspendedUntil: Long = 0
private var prevCarbsreq = 0
override var lastRun: LastRun? = null
override var closedLoopEnabled: Constraint<Boolean>? = null
override fun onStart() {
createNotificationChannel()
@ -294,8 +295,8 @@ class LoopPlugin @Inject constructor(
rxBus.send(EventLoopSetLastRunGui(rh.gs(R.string.pumpsuspended)))
return
}
val closedLoopEnabled = constraintChecker.isClosedLoopAllowed()
if (closedLoopEnabled.value()) {
closedLoopEnabled = constraintChecker.isClosedLoopAllowed()
if (closedLoopEnabled?.value() == true) {
if (allowNotification) {
if (resultAfterConstraints.isCarbsRequired
&& resultAfterConstraints.carbsReq >= sp.getInt(

View file

@ -22,6 +22,7 @@ interface Loop {
}
var lastRun: LastRun?
var closedLoopEnabled: Constraint<Boolean>?
val isSuspended: Boolean
val isLGS: Boolean
val isSuperBolus: Boolean