Merge pull request #2643 from Mackwe/Dana_tiny_basals
Tiny basals fix for Dana pumps
This commit is contained in:
commit
ffe0942ed2
4 changed files with 20 additions and 8 deletions
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue