Double comparisons.
This commit is contained in:
parent
bf52352224
commit
066d138e59
|
@ -378,7 +378,7 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
|||
private PumpEnactResult deliverBolus(final DetailedBolusInfo detailedBolusInfo) {
|
||||
// guard against boluses issued multiple times within a minute
|
||||
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()) {
|
||||
return new PumpEnactResult().success(false).enacted(false)
|
||||
.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
|
||||
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");
|
||||
request.bolusHistory = aapsBolus == null ? PumpHistoryRequest.FULL : aapsBolus.date;
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ public class Bolus extends HistoryRecord {
|
|||
|
||||
if (timestamp != bolus.timestamp) 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
|
||||
|
|
|
@ -185,7 +185,7 @@ public class BolusCommand extends BaseCommand {
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -193,7 +193,7 @@ public class BolusCommand extends BaseCommand {
|
|||
SystemClock.sleep(1000);
|
||||
scripter.verifyMenuIsDisplayed(MenuType.BOLUS_ENTER);
|
||||
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 "
|
||||
+ displayedBolus + " -> " + refreshedDisplayedBolus);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue