Revert "Handle edge case of setting basal rate in range 0.00 - 0.05."

This reverts commit 2054e76cde.
This commit is contained in:
Johannes Mockenhaupt 2017-12-20 18:03:21 +01:00
parent 3880c5ff61
commit 7c04f528cc
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1
4 changed files with 5 additions and 19 deletions

View file

@ -39,8 +39,6 @@ Limitations:
pump solely through AAPS.
Checking history, reservoir level etc on the pump causes no issues but should be avoided
when the Bluetooth icon is displayed on the display, indicating that AAPS is communicating with the pump.
- Setting basal rates where U/h exceeds 10 are currently not supported. Values between 0.01 to 0.04 are rounded
to 0.05, values above have a granularity of 0.05 and values above 1.00 have a granularity of 0.10.
Setup:
- Configure pump using 360 config software.

View file

@ -81,10 +81,6 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
pumpDescription.isSetBasalProfileCapable = true;
// this applies to range >= 0.05 U/h && < 1.00 U/h,
// above 1.00 U/h step size is 0.05,
// above 10 U/h, step size is 0.1,
// the smallest non-zero amount is 0.05 U/h, so 0.00 U/h jumps to 0.05 U/h during input
pumpDescription.basalStep = 0.01d;
pumpDescription.basalMinimumRate = 0.0d;

View file

@ -283,7 +283,7 @@ public class RuffyScripter implements RuffyCommands {
// the disconnected and then return the command as failed (the caller
// can retry if needed).
log.debug("Connection unusable (ruffy connection: " + ruffyService.isConnected() + ", "
+ "time since last menu update: " + (System.currentTimeMillis() - menuLastUpdated) + " ms), "
+ "time since last menu update: " + (System.currentTimeMillis() - menuLastUpdated) + " ms, "
+ "aborting command and attempting reconnect ...");
cmdThread.interrupt();
activeCmd.getResult().success = false;

View file

@ -30,7 +30,6 @@ public class SetBasalProfileCommand extends BaseCommand {
scripter.verifyMenuIsDisplayed(MenuType.BASAL_1_MENU);
scripter.pressCheckKey();
Double requestedTotal = 0d;
// summary screen is shown; press menu to page through hours, wraps around to summary;
scripter.verifyMenuIsDisplayed(MenuType.BASAL_TOTAL);
for (int i = 0; i < 24; i++) {
@ -44,11 +43,6 @@ public class SetBasalProfileCommand extends BaseCommand {
scripter.verifyMenuIsDisplayed(MenuType.BASAL_SET);
double requestedRate = basalProfile.hourlyRates[i];
if (requestedRate > 0 && requestedRate < 0.05) {
log.debug("rounding requested rate of " + requestedRate + " to supported value 0.05");
requestedRate = 0.05;
}
requestedTotal += requestedRate;
long change = inputBasalRate(requestedRate);
if (change != 0) {
verifyDisplayedRate(requestedRate, change);
@ -63,6 +57,10 @@ public class SetBasalProfileCommand extends BaseCommand {
// check total basal total on pump matches requested total
Double pumpTotal = (Double) scripter.getCurrentMenu().getAttribute(MenuAttribute.BASAL_TOTAL);
Double requestedTotal = 0d;
for (int i = 0; i < 24; i++) {
requestedTotal += basalProfile.hourlyRates[i];
}
if (Math.abs(pumpTotal - requestedTotal) > 0.001) {
throw new CommandException("Basal total of " + pumpTotal + " differs from requested total of " + requestedTotal);
}
@ -77,17 +75,11 @@ public class SetBasalProfileCommand extends BaseCommand {
private long inputBasalRate(double requestedRate) {
double currentRate = scripter.readBlinkingValue(Double.class, MenuAttribute.BASAL_RATE);
log.debug("Current rate: " + currentRate + ", requested: " + requestedRate);
// the pump changes steps size from 0.01 to 0.05 when crossing 1.00 U
long steps = stepsToOne(currentRate) - stepsToOne(requestedRate);
if (steps == 0) {
return 0;
}
// edge case: 0.00 to 0.05 (or back) is one step, not 5.
if (currentRate == 0 && requestedRate > 0) steps -= 4;
else if (currentRate > 0 && requestedRate == 0) steps += 4;
log.debug("Pressing " + (steps > 0 ? "up" : "down") + " " + Math.abs(steps) + " times");
for (int i = 0; i < Math.abs(steps); i++) {
scripter.verifyMenuIsDisplayed(MenuType.BASAL_SET);