Double comparisons.
This commit is contained in:
parent
bf52352224
commit
066d138e59
3 changed files with 5 additions and 5 deletions
|
@ -378,7 +378,7 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
||||||
private PumpEnactResult deliverBolus(final DetailedBolusInfo detailedBolusInfo) {
|
private PumpEnactResult deliverBolus(final DetailedBolusInfo detailedBolusInfo) {
|
||||||
// guard against boluses issued multiple times within a minute
|
// guard against boluses issued multiple times within a minute
|
||||||
if (lastRequestedBolus != null
|
if (lastRequestedBolus != null
|
||||||
&& Math.abs(lastRequestedBolus.amount - detailedBolusInfo.insulin) < 0.05
|
&& Math.abs(lastRequestedBolus.amount - detailedBolusInfo.insulin) < 0.01
|
||||||
&& lastRequestedBolus.timestamp + 60 * 1000 > System.currentTimeMillis()) {
|
&& lastRequestedBolus.timestamp + 60 * 1000 > System.currentTimeMillis()) {
|
||||||
return new PumpEnactResult().success(false).enacted(false)
|
return new PumpEnactResult().success(false).enacted(false)
|
||||||
.comment(MainApp.sResources.getString(R.string.bolus_frequency_exceeded));
|
.comment(MainApp.sResources.getString(R.string.bolus_frequency_exceeded));
|
||||||
|
@ -825,7 +825,7 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
||||||
}
|
}
|
||||||
|
|
||||||
// there's a pump bolus AAPS doesn't know, or we only know one within the same minute but different amount
|
// there's a pump bolus AAPS doesn't know, or we only know one within the same minute but different amount
|
||||||
if (pumpBolus != null && (aapsBolus == null || Math.abs(aapsBolus.insulin - pumpBolus.amount) >= 0.05)) {
|
if (pumpBolus != null && (aapsBolus == null || Math.abs(aapsBolus.insulin - pumpBolus.amount) >= 0.01)) {
|
||||||
log.debug("Last bolus on pump is unknown, refreshing bolus history");
|
log.debug("Last bolus on pump is unknown, refreshing bolus history");
|
||||||
request.bolusHistory = aapsBolus == null ? PumpHistoryRequest.FULL : aapsBolus.date;
|
request.bolusHistory = aapsBolus == null ? PumpHistoryRequest.FULL : aapsBolus.date;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ public class Bolus extends HistoryRecord {
|
||||||
|
|
||||||
if (timestamp != bolus.timestamp) return false;
|
if (timestamp != bolus.timestamp) return false;
|
||||||
if (isValid != bolus.isValid) return false;
|
if (isValid != bolus.isValid) return false;
|
||||||
return Math.abs(bolus.amount - amount) <= 0.05;
|
return Math.abs(bolus.amount - amount) <= 0.01;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -185,7 +185,7 @@ public class BolusCommand extends BaseCommand {
|
||||||
}
|
}
|
||||||
|
|
||||||
log.debug("Final bolus: " + displayedBolus);
|
log.debug("Final bolus: " + displayedBolus);
|
||||||
if (Math.abs(displayedBolus - bolus) > 0.05) {
|
if (Math.abs(displayedBolus - bolus) > 0.01) {
|
||||||
throw new CommandException("Failed to set correct bolus. Expected: " + bolus + ", actual: " + displayedBolus);
|
throw new CommandException("Failed to set correct bolus. Expected: " + bolus + ", actual: " + displayedBolus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -193,7 +193,7 @@ public class BolusCommand extends BaseCommand {
|
||||||
SystemClock.sleep(1000);
|
SystemClock.sleep(1000);
|
||||||
scripter.verifyMenuIsDisplayed(MenuType.BOLUS_ENTER);
|
scripter.verifyMenuIsDisplayed(MenuType.BOLUS_ENTER);
|
||||||
double refreshedDisplayedBolus = scripter.readBlinkingValue(Double.class, MenuAttribute.BOLUS);
|
double refreshedDisplayedBolus = scripter.readBlinkingValue(Double.class, MenuAttribute.BOLUS);
|
||||||
if (Math.abs(displayedBolus - refreshedDisplayedBolus) > 0.05) {
|
if (Math.abs(displayedBolus - refreshedDisplayedBolus) > 0.01) {
|
||||||
throw new CommandException("Failed to set bolus: bolus changed after input stopped from "
|
throw new CommandException("Failed to set bolus: bolus changed after input stopped from "
|
||||||
+ displayedBolus + " -> " + refreshedDisplayedBolus);
|
+ displayedBolus + " -> " + refreshedDisplayedBolus);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue