optimize reading autosense data
This commit is contained in:
parent
bf3d15f9be
commit
f1499d1886
1 changed files with 4 additions and 3 deletions
|
@ -1091,15 +1091,16 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
|
||||||
|
|
||||||
private fun updateSensitivity() {
|
private fun updateSensitivity() {
|
||||||
_binding ?: return
|
_binding ?: return
|
||||||
if (constraintChecker.isAutosensModeEnabled().value() || !(config.NSCLIENT && overviewData.lastAutosensData(iobCobCalculator) == null)) {
|
val lastAutosensData = overviewData.lastAutosensData(iobCobCalculator)
|
||||||
|
if (constraintChecker.isAutosensModeEnabled().value() || !(config.NSCLIENT && lastAutosensData == null)) {
|
||||||
binding.infoLayout.sensitivityIcon.setImageResource(info.nightscout.core.main.R.drawable.ic_swap_vert_black_48dp_green)
|
binding.infoLayout.sensitivityIcon.setImageResource(info.nightscout.core.main.R.drawable.ic_swap_vert_black_48dp_green)
|
||||||
} else {
|
} else {
|
||||||
binding.infoLayout.sensitivityIcon.setImageResource(info.nightscout.core.main.R.drawable.ic_x_swap_vert)
|
binding.infoLayout.sensitivityIcon.setImageResource(info.nightscout.core.main.R.drawable.ic_x_swap_vert)
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.infoLayout.sensitivity.text =
|
binding.infoLayout.sensitivity.text =
|
||||||
overviewData.lastAutosensData(iobCobCalculator)?.let { autosensData ->
|
lastAutosensData?.let {
|
||||||
String.format(Locale.ENGLISH, "%.0f%%", autosensData.autosensResult.ratio * 100)
|
String.format(Locale.ENGLISH, "%.0f%%", it.autosensResult.ratio * 100)
|
||||||
} ?: ""
|
} ?: ""
|
||||||
// Show variable sensitivity
|
// Show variable sensitivity
|
||||||
val profile = profileFunction.getProfile()
|
val profile = profileFunction.getProfile()
|
||||||
|
|
Loading…
Reference in a new issue