DynamicISF: show on overview
This commit is contained in:
parent
857ab4a4c0
commit
cf7773bda4
|
@ -458,6 +458,7 @@ var determine_basal = function determine_basal(glucose_status, currenttemp, iob_
|
|||
, 'reservoir' : reservoir_data // The expected reservoir volume at which to deliver the microbolus (the reservoir volume from right before the last pumphistory run)
|
||||
, 'deliverAt' : deliverAt // The time at which the microbolus should be delivered
|
||||
, 'sensitivityRatio' : sensitivityRatio // autosens ratio (fraction of normal basal)
|
||||
, 'variable_sens' : variable_sens
|
||||
};
|
||||
|
||||
// generate predicted future BGs based on IOB, COB, and current absorption rate
|
||||
|
|
|
@ -10,6 +10,7 @@ class DetermineBasalResultSMB private constructor(injector: HasAndroidInjector)
|
|||
|
||||
private var eventualBG = 0.0
|
||||
private var snoozeBG = 0.0
|
||||
var variableSens: Double? = null
|
||||
|
||||
internal constructor(injector: HasAndroidInjector, result: JSONObject) : this(injector) {
|
||||
date = dateUtil.now()
|
||||
|
@ -50,6 +51,7 @@ class DetermineBasalResultSMB private constructor(injector: HasAndroidInjector)
|
|||
aapsLogger.error(LTag.APS, "Error parsing 'deliverAt' date: $date", e)
|
||||
}
|
||||
}
|
||||
if (result.has("variable_sens")) variableSens = result.getDouble("variable_sens");
|
||||
} catch (e: JSONException) {
|
||||
aapsLogger.error(LTag.APS, "Error parsing determine-basal result JSON", e)
|
||||
}
|
||||
|
|
|
@ -48,6 +48,7 @@ import info.nightscout.androidaps.interfaces.*
|
|||
import info.nightscout.shared.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.plugins.aps.loop.events.EventNewOpenLoopNotification
|
||||
import info.nightscout.androidaps.plugins.aps.openAPSSMB.DetermineBasalResultSMB
|
||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
||||
import info.nightscout.androidaps.plugins.constraints.bgQualityCheck.BgQualityCheckPlugin
|
||||
|
@ -603,7 +604,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
|
|||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
binding.infoLayout.apsMode.stateDescription = rh.gs(stringRes)
|
||||
} else {
|
||||
binding.infoLayout.apsMode.contentDescription = rh.gs(R.string.apsmode_title) + " " + rh.gs(stringRes)
|
||||
binding.infoLayout.apsMode.contentDescription = rh.gs(R.string.apsmode_title) + " " + rh.gs(stringRes)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -671,6 +672,21 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
|
|||
binding.infoLayout.apsModeText.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
// Show variable sensitivity
|
||||
val request = loop.lastRun?.request
|
||||
if (request is DetermineBasalResultSMB) {
|
||||
val isfMgdl = profileFunction.getProfile()?.getIsfMgdl()
|
||||
val variableSens = request.variableSens
|
||||
if (variableSens != isfMgdl && variableSens != null && isfMgdl != null) {
|
||||
binding.infoLayout.variableSensitivity.text =
|
||||
String.format(
|
||||
Locale.getDefault(), "%1$.1f→%2$.1f",
|
||||
Profile.toUnits(isfMgdl, isfMgdl * Constants.MGDL_TO_MMOLL, profileFunction.getUnits()),
|
||||
Profile.toUnits(variableSens, variableSens * Constants.MGDL_TO_MMOLL, profileFunction.getUnits())
|
||||
)
|
||||
binding.infoLayout.variableSensitivity.visibility = View.VISIBLE
|
||||
} else binding.infoLayout.variableSensitivity.visibility = View.GONE
|
||||
} else binding.infoLayout.variableSensitivity.visibility = View.GONE
|
||||
} else {
|
||||
//nsclient
|
||||
binding.infoLayout.apsMode.visibility = View.GONE
|
||||
|
@ -774,7 +790,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
|
|||
|
||||
val outDate = (if (!overviewData.isActualBg) rh.gs(R.string.a11y_bg_outdated) else "")
|
||||
binding.infoLayout.bg.contentDescription =
|
||||
rh.gs(R.string.a11y_blood_glucose) + " " + binding.infoLayout.bg.text.toString() + " " + overviewData.lastBgDescription + " " + outDate
|
||||
rh.gs(R.string.a11y_blood_glucose) + " " + binding.infoLayout.bg.text.toString() + " " + overviewData.lastBgDescription + " " + outDate
|
||||
|
||||
binding.infoLayout.timeAgo.text = dateUtil.minAgo(rh, overviewData.lastBg?.timestamp)
|
||||
binding.infoLayout.timeAgo.contentDescription = dateUtil.minAgoLong(rh, overviewData.lastBg?.timestamp)
|
||||
|
|
|
@ -407,6 +407,19 @@
|
|||
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
|
||||
android:textStyle="bold"
|
||||
tools:ignore="HardcodedText" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/variable_sensitivity"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="-9dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:paddingBottom="3dp"
|
||||
android:text="n/a"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
|
||||
android:textStyle="bold"
|
||||
android:visibility="visible"
|
||||
tools:ignore="HardcodedText" />
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
Loading…
Reference in a new issue