This commit is contained in:
Milos Kozak 2020-05-15 08:20:24 +02:00
commit 51ab43416a
8 changed files with 49 additions and 8 deletions

View file

@ -757,6 +757,12 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
overview_uploader?.setOnClickListener { activity?.let { OKDialog.show(it, resourceHelper.gs(R.string.uploader), nsDeviceStatus.extendedUploaderStatus) } }
// Sensitivity
if (sp.getBoolean(R.string.key_openapsama_useautosens, false)) {
overview_sensitivity_icon.setImageResource(R.drawable.ic_swap_vert_black_48dp_green)
}else {
overview_sensitivity_icon.setImageResource(R.drawable.ic_x_swap_vert_48px_green)
}
overview_sensitivity?.text =
iobCobCalculatorPlugin.getLastAutosensData("Overview")?.let { autosensData ->
String.format(Locale.ENGLISH, "%.0f%%", autosensData.autosensResult.ratio * 100)

View file

@ -0,0 +1,10 @@
<vector
android:tint="#008585"
android:height="48dp"
android:width="48dp"
android:viewportHeight="24"
android:viewportWidth="24" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M19.375,17.01V10h-2v7.01h-3l4,3.99l4,-3.99H19.375zM12.375,3l-4,3.99h3V14h2V6.99h3L12.375,3z"/>
<path android:fillColor="#FF000000" android:pathData="M5.438,12.733l-2.346,2.346l-0.734,-0.733l2.346,-2.346l-2.346,-2.346l0.734,-0.733l2.346,2.346l2.345,-2.346l0.734,0.733l-2.346,2.346l2.346,2.346l-0.734,0.733z"/>
<path android:fillColor="#FF000000" android:pathData="M8.375,9.654L7.783,9.063l-2.346,2.346L3.092,9.063L2.5,9.654L4.846,12L2.5,14.346l0.592,0.592l2.346,-2.346l2.346,2.346l0.592,-0.592L6.029,12L8.375,9.654z"/>
</vector>

View file

@ -222,6 +222,7 @@
app:layout_constraintTop_toBottomOf="@+id/overview_bg">
<ImageView
android:id="@+id/overview_sensitivity_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"

View file

@ -203,8 +203,8 @@ public class DanaRKoreanPlugin extends AbstractDanaRPlugin {
absoluteRate = constraintChecker.applyBasalConstraints(new Constraint<>(absoluteRate), profile).value();
final boolean doTempOff = getBaseBasalRate() - absoluteRate == 0d;
final boolean doLowTemp = absoluteRate < getBaseBasalRate();
final boolean doTempOff = getBaseBasalRate() - absoluteRate == 0d && absoluteRate >= 0.10d;
final boolean doLowTemp = absoluteRate < getBaseBasalRate() || absoluteRate < 0.10d;
final boolean doHighTemp = absoluteRate > getBaseBasalRate() && !useExtendedBoluses;
final boolean doExtendedTemp = absoluteRate > getBaseBasalRate() && useExtendedBoluses;
@ -234,6 +234,8 @@ public class DanaRKoreanPlugin extends AbstractDanaRPlugin {
if (doLowTemp || doHighTemp) {
Integer percentRate = Double.valueOf(absoluteRate / getBaseBasalRate() * 100).intValue();
// Any basal less than 0.10u/h will be dumped once per hour, not every 4 mins. So if it's less than .10u/h, set a zero temp.
if (absoluteRate < 0.10d) percentRate = 0;
if (percentRate < 100) percentRate = Round.ceilTo((double) percentRate, 10d).intValue();
else percentRate = Round.floorTo((double) percentRate, 10d).intValue();
if (percentRate > getPumpDescription().maxTempPercent) {

View file

@ -230,8 +230,8 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin {
absoluteRate = constraintChecker.applyBasalConstraints(new Constraint<>(absoluteRate), profile).value();
final boolean doTempOff = getBaseBasalRate() - absoluteRate == 0d;
final boolean doLowTemp = absoluteRate < getBaseBasalRate();
final boolean doTempOff = getBaseBasalRate() - absoluteRate == 0d && absoluteRate >= 0.10d;
final boolean doLowTemp = absoluteRate < getBaseBasalRate() || absoluteRate < 0.10d;
final boolean doHighTemp = absoluteRate > getBaseBasalRate();
if (doTempOff) {
@ -251,6 +251,8 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin {
if (doLowTemp || doHighTemp) {
Integer percentRate = Double.valueOf(absoluteRate / getBaseBasalRate() * 100).intValue();
// Any basal less than 0.10u/h will be dumped once per hour, not every 4 mins. So if it's less than .10u/h, set a zero temp.
if (absoluteRate < 0.10d) percentRate = 0;
if (percentRate < 100) percentRate = Round.ceilTo((double) percentRate, 10d).intValue();
else percentRate = Round.floorTo((double) percentRate, 10d).intValue();
if (percentRate > 500) // Special high temp 500/15min

View file

@ -201,8 +201,8 @@ public class DanaRPlugin extends AbstractDanaRPlugin {
absoluteRate = constraintChecker.applyBasalConstraints(new Constraint<>(absoluteRate), profile).value();
final boolean doTempOff = getBaseBasalRate() - absoluteRate == 0d;
final boolean doLowTemp = absoluteRate < getBaseBasalRate();
final boolean doTempOff = getBaseBasalRate() - absoluteRate == 0d && absoluteRate >= 0.10d;
final boolean doLowTemp = absoluteRate < getBaseBasalRate() || absoluteRate < 0.10d;
final boolean doHighTemp = absoluteRate > getBaseBasalRate() && !useExtendedBoluses;
final boolean doExtendedTemp = absoluteRate > getBaseBasalRate() && useExtendedBoluses;
@ -232,6 +232,8 @@ public class DanaRPlugin extends AbstractDanaRPlugin {
if (doLowTemp || doHighTemp) {
Integer percentRate = Double.valueOf(absoluteRate / getBaseBasalRate() * 100).intValue();
// Any basal less than 0.10u/h will be dumped once per hour, not every 4 mins. So if it's less than .10u/h, set a zero temp.
if (absoluteRate < 0.10d) percentRate = 0;
if (percentRate < 100) percentRate = Round.ceilTo((double) percentRate, 10d).intValue();
else percentRate = Round.floorTo((double) percentRate, 10d).intValue();
if (percentRate > getPumpDescription().maxTempPercent) {

View file

@ -8,8 +8,8 @@ import android.os.IBinder
import android.text.format.DateFormat
import androidx.preference.Preference
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.dana.DanaPumpInterface
import info.nightscout.androidaps.dana.DanaPump
import info.nightscout.androidaps.dana.DanaPumpInterface
import info.nightscout.androidaps.danars.events.EventDanaRSDeviceChange
import info.nightscout.androidaps.danars.services.DanaRSService
import info.nightscout.androidaps.data.DetailedBolusInfo
@ -358,7 +358,13 @@ class DanaRSPlugin @Inject constructor(
return result
}
if (doLowTemp || doHighTemp) {
var percentRate = java.lang.Double.valueOf(absoluteAfterConstrain / baseBasalRate * 100).toInt()
var percentRate = 0
// Any basal less than 0.10u/h will be dumped once per hour, not every 4 mins. So if it's less than .10u/h, set a zero temp.
if (absoluteAfterConstrain >= 0.10) {
percentRate = java.lang.Double.valueOf(absoluteAfterConstrain / baseBasalRate * 100).toInt()
} else {
aapsLogger.debug(LTag.PUMP, "setTempBasalAbsolute: Requested basal < 0.10u/h. Setting 0u/h (doLowTemp || doHighTemp)")
}
percentRate = if (percentRate < 100) Round.ceilTo(percentRate.toDouble(), 10.0).toInt() else Round.floorTo(percentRate.toDouble(), 10.0).toInt()
if (percentRate > 500) // Special high temp 500/15min
percentRate = 500

12
icons/x_swap_vert.svg Normal file
View file

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 17.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="24px" height="24px" viewBox="0 0 24 24" enable-background="new 0 0 24 24" xml:space="preserve">
<path d="M19.375,17.01V10h-2v7.01h-3l4,3.99l4-3.99H19.375z M12.375,3l-4,3.99h3V14h2V6.99h3L12.375,3z"/>
<path fill="none" d="M0,0h24v24H0V0z"/>
<polygon points="5.438,12.733 3.092,15.079 2.358,14.346 4.704,12 2.358,9.654 3.092,8.921 5.438,11.267 7.783,8.921 8.517,9.654
6.171,12 8.517,14.346 7.783,15.079 "/>
<path d="M8.375,9.654L7.783,9.063l-2.346,2.346L3.092,9.063L2.5,9.654L4.846,12L2.5,14.346l0.592,0.592l2.346-2.346l2.346,2.346
l0.592-0.592L6.029,12L8.375,9.654z"/>
</svg>

After

Width:  |  Height:  |  Size: 946 B