DynamicISF: show on overview
This commit is contained in:
parent
857ab4a4c0
commit
cf7773bda4
4 changed files with 34 additions and 2 deletions
|
@ -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)
|
, '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
|
, 'deliverAt' : deliverAt // The time at which the microbolus should be delivered
|
||||||
, 'sensitivityRatio' : sensitivityRatio // autosens ratio (fraction of normal basal)
|
, 'sensitivityRatio' : sensitivityRatio // autosens ratio (fraction of normal basal)
|
||||||
|
, 'variable_sens' : variable_sens
|
||||||
};
|
};
|
||||||
|
|
||||||
// generate predicted future BGs based on IOB, COB, and current absorption rate
|
// 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 eventualBG = 0.0
|
||||||
private var snoozeBG = 0.0
|
private var snoozeBG = 0.0
|
||||||
|
var variableSens: Double? = null
|
||||||
|
|
||||||
internal constructor(injector: HasAndroidInjector, result: JSONObject) : this(injector) {
|
internal constructor(injector: HasAndroidInjector, result: JSONObject) : this(injector) {
|
||||||
date = dateUtil.now()
|
date = dateUtil.now()
|
||||||
|
@ -50,6 +51,7 @@ class DetermineBasalResultSMB private constructor(injector: HasAndroidInjector)
|
||||||
aapsLogger.error(LTag.APS, "Error parsing 'deliverAt' date: $date", e)
|
aapsLogger.error(LTag.APS, "Error parsing 'deliverAt' date: $date", e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (result.has("variable_sens")) variableSens = result.getDouble("variable_sens");
|
||||||
} catch (e: JSONException) {
|
} catch (e: JSONException) {
|
||||||
aapsLogger.error(LTag.APS, "Error parsing determine-basal result JSON", e)
|
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.shared.logging.AAPSLogger
|
||||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||||
import info.nightscout.androidaps.plugins.aps.loop.events.EventNewOpenLoopNotification
|
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.bus.RxBus
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
||||||
import info.nightscout.androidaps.plugins.constraints.bgQualityCheck.BgQualityCheckPlugin
|
import info.nightscout.androidaps.plugins.constraints.bgQualityCheck.BgQualityCheckPlugin
|
||||||
|
@ -671,6 +672,21 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
|
||||||
binding.infoLayout.apsModeText.visibility = View.GONE
|
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 {
|
} else {
|
||||||
//nsclient
|
//nsclient
|
||||||
binding.infoLayout.apsMode.visibility = View.GONE
|
binding.infoLayout.apsMode.visibility = View.GONE
|
||||||
|
|
|
@ -407,6 +407,19 @@
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
|
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
tools:ignore="HardcodedText" />
|
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>
|
</LinearLayout>
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
Loading…
Reference in a new issue