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()) } binding.smbsetbypump.text = it.smbSetByPump?.let { smbSetByPump -> HtmlHelper.fromHtml(smbSetByPump.toHtml()) }
?: "" ?: ""
val constraints = var constraints =
it.constraintsProcessed?.let { constraintsProcessed -> it.constraintsProcessed?.let { constraintsProcessed ->
val allConstraints = Constraint(0.0) val allConstraints = Constraint(0.0)
constraintsProcessed.rateConstraint?.let { rateConstraint -> allConstraints.copyReasons(rateConstraint) } constraintsProcessed.rateConstraint?.let { rateConstraint -> allConstraints.copyReasons(rateConstraint) }
constraintsProcessed.smbConstraint?.let { smbConstraint -> allConstraints.copyReasons(smbConstraint) } constraintsProcessed.smbConstraint?.let { smbConstraint -> allConstraints.copyReasons(smbConstraint) }
allConstraints.getMostLimitedReasons(aapsLogger) allConstraints.getMostLimitedReasons(aapsLogger)
} ?: "" } ?: ""
constraints += loop.closedLoopEnabled?.getReasons(aapsLogger) ?: ""
binding.constraints.text = constraints binding.constraints.text = constraints
binding.swipeRefresh.isRefreshing = false binding.swipeRefresh.isRefreshing = false
} }

View file

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

View file

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