kotlin lints
This commit is contained in:
parent
c6595e0a2a
commit
05556a4b52
3 changed files with 6 additions and 13 deletions
|
@ -702,10 +702,10 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints {
|
||||||
@NonNull @Override
|
@NonNull @Override
|
||||||
public PumpEnactResult setTempBasalAbsolute(double absoluteRate, int durationInMinutes, @NonNull Profile profile, boolean force, @NonNull PumpSync.TemporaryBasalType tbrType) {
|
public PumpEnactResult setTempBasalAbsolute(double absoluteRate, int durationInMinutes, @NonNull Profile profile, boolean force, @NonNull PumpSync.TemporaryBasalType tbrType) {
|
||||||
getAapsLogger().debug(LTag.PUMP, "setTempBasalAbsolute called with a rate of " + absoluteRate + " for " + durationInMinutes + " min.");
|
getAapsLogger().debug(LTag.PUMP, "setTempBasalAbsolute called with a rate of " + absoluteRate + " for " + durationInMinutes + " min.");
|
||||||
int unroundedPercentage = Double.valueOf(absoluteRate / getBaseBasalRate() * 100).intValue();
|
int unRoundedPercentage = (int) (absoluteRate / getBaseBasalRate() * 100);
|
||||||
int roundedPercentage = (int) (Math.round(absoluteRate / getBaseBasalRate() * 10) * 10);
|
int roundedPercentage = (int) (Math.round(absoluteRate / getBaseBasalRate() * 10) * 10);
|
||||||
if (unroundedPercentage != roundedPercentage) {
|
if (unRoundedPercentage != roundedPercentage) {
|
||||||
getAapsLogger().debug(LTag.PUMP, "Rounded requested rate " + unroundedPercentage + "% -> " + roundedPercentage + "%");
|
getAapsLogger().debug(LTag.PUMP, "Rounded requested rate " + unRoundedPercentage + "% -> " + roundedPercentage + "%");
|
||||||
}
|
}
|
||||||
|
|
||||||
return setTempBasalPercent(roundedPercentage, durationInMinutes, tbrType);
|
return setTempBasalPercent(roundedPercentage, durationInMinutes, tbrType);
|
||||||
|
|
|
@ -42,17 +42,13 @@ import info.nightscout.shared.interfaces.ResourceHelper;
|
||||||
import info.nightscout.shared.sharedPreferences.SP;
|
import info.nightscout.shared.sharedPreferences.SP;
|
||||||
import info.nightscout.shared.utils.DateUtil;
|
import info.nightscout.shared.utils.DateUtil;
|
||||||
import info.nightscout.shared.utils.T;
|
import info.nightscout.shared.utils.T;
|
||||||
import io.reactivex.rxjava3.disposables.CompositeDisposable;
|
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
@OpenForTesting
|
@OpenForTesting
|
||||||
public class DanaRv2Plugin extends AbstractDanaRPlugin {
|
public class DanaRv2Plugin extends AbstractDanaRPlugin {
|
||||||
private final CompositeDisposable disposable = new CompositeDisposable();
|
|
||||||
|
|
||||||
private final AAPSLogger aapsLogger;
|
private final AAPSLogger aapsLogger;
|
||||||
private final Context context;
|
private final Context context;
|
||||||
private final ResourceHelper rh;
|
private final ResourceHelper rh;
|
||||||
private final Constraints constraintChecker;
|
|
||||||
private final DetailedBolusInfoStorage detailedBolusInfoStorage;
|
private final DetailedBolusInfoStorage detailedBolusInfoStorage;
|
||||||
private final TemporaryBasalStorage temporaryBasalStorage;
|
private final TemporaryBasalStorage temporaryBasalStorage;
|
||||||
private final FabricPrivacy fabricPrivacy;
|
private final FabricPrivacy fabricPrivacy;
|
||||||
|
@ -233,7 +229,7 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin {
|
||||||
final boolean doLowTemp = absoluteRate < getBaseBasalRate() || absoluteRate < 0.10d;
|
final boolean doLowTemp = absoluteRate < getBaseBasalRate() || absoluteRate < 0.10d;
|
||||||
final boolean doHighTemp = absoluteRate > getBaseBasalRate();
|
final boolean doHighTemp = absoluteRate > getBaseBasalRate();
|
||||||
|
|
||||||
int percentRate = Double.valueOf(absoluteRate / getBaseBasalRate() * 100).intValue();
|
int percentRate = (int) (absoluteRate / getBaseBasalRate() * 100);
|
||||||
// Any basal less than 0.10u/h will be dumped once per hour, not every 4 minutes. So if it's less than .10u/h, set a zero temp.
|
// Any basal less than 0.10u/h will be dumped once per hour, not every 4 minutes. So if it's less than .10u/h, set a zero temp.
|
||||||
if (absoluteRate < 0.10d) percentRate = 0;
|
if (absoluteRate < 0.10d) percentRate = 0;
|
||||||
if (percentRate < 100) percentRate = (int) Round.INSTANCE.ceilTo((double) percentRate, 10d);
|
if (percentRate < 100) percentRate = (int) Round.INSTANCE.ceilTo((double) percentRate, 10d);
|
||||||
|
@ -396,7 +392,7 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin {
|
||||||
if (danaPump.isExtendedInProgress()) {
|
if (danaPump.isExtendedInProgress()) {
|
||||||
sExecutionService.extendedBolusStop();
|
sExecutionService.extendedBolusStop();
|
||||||
result.enacted(true).success(!danaPump.isExtendedInProgress()).isTempCancel(true);
|
result.enacted(true).success(!danaPump.isExtendedInProgress()).isTempCancel(true);
|
||||||
} else {
|
} else {
|
||||||
result.success(true).enacted(false).comment(info.nightscout.core.ui.R.string.ok);
|
result.success(true).enacted(false).comment(info.nightscout.core.ui.R.string.ok);
|
||||||
getAapsLogger().debug(LTag.PUMP, "cancelExtendedBolus: OK");
|
getAapsLogger().debug(LTag.PUMP, "cancelExtendedBolus: OK");
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,13 +38,10 @@ import info.nightscout.rx.logging.LTag;
|
||||||
import info.nightscout.shared.interfaces.ResourceHelper;
|
import info.nightscout.shared.interfaces.ResourceHelper;
|
||||||
import info.nightscout.shared.sharedPreferences.SP;
|
import info.nightscout.shared.sharedPreferences.SP;
|
||||||
import info.nightscout.shared.utils.DateUtil;
|
import info.nightscout.shared.utils.DateUtil;
|
||||||
import io.reactivex.rxjava3.disposables.CompositeDisposable;
|
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
@OpenForTesting
|
@OpenForTesting
|
||||||
public class DanaRPlugin extends AbstractDanaRPlugin {
|
public class DanaRPlugin extends AbstractDanaRPlugin {
|
||||||
private final CompositeDisposable disposable = new CompositeDisposable();
|
|
||||||
|
|
||||||
private final AAPSLogger aapsLogger;
|
private final AAPSLogger aapsLogger;
|
||||||
private final Context context;
|
private final Context context;
|
||||||
private final ResourceHelper rh;
|
private final ResourceHelper rh;
|
||||||
|
@ -218,7 +215,7 @@ public class DanaRPlugin extends AbstractDanaRPlugin {
|
||||||
final boolean doHighTemp = absoluteRate > getBaseBasalRate() && !useExtendedBoluses;
|
final boolean doHighTemp = absoluteRate > getBaseBasalRate() && !useExtendedBoluses;
|
||||||
final boolean doExtendedTemp = absoluteRate > getBaseBasalRate() && useExtendedBoluses;
|
final boolean doExtendedTemp = absoluteRate > getBaseBasalRate() && useExtendedBoluses;
|
||||||
|
|
||||||
int percentRate = Double.valueOf(absoluteRate / getBaseBasalRate() * 100).intValue();
|
int percentRate = (int) (absoluteRate / getBaseBasalRate() * 100);
|
||||||
// Any basal less than 0.10u/h will be dumped once per hour, not every 4 minutes. So if it's less than .10u/h, set a zero temp.
|
// Any basal less than 0.10u/h will be dumped once per hour, not every 4 minutes. So if it's less than .10u/h, set a zero temp.
|
||||||
if (absoluteRate < 0.10d) percentRate = 0;
|
if (absoluteRate < 0.10d) percentRate = 0;
|
||||||
if (percentRate < 100) percentRate = (int) Round.INSTANCE.ceilTo(percentRate, 10d);
|
if (percentRate < 100) percentRate = (int) Round.INSTANCE.ceilTo(percentRate, 10d);
|
||||||
|
|
Loading…
Reference in a new issue