Optimize programming TBR and bolus.
This commit is contained in:
parent
2d8b3a7cb8
commit
01def4c9b3
3 changed files with 7 additions and 9 deletions
|
@ -723,7 +723,7 @@ public class RuffyScripter implements RuffyCommands {
|
||||||
private void pressKey(final byte key) {
|
private void pressKey(final byte key) {
|
||||||
try {
|
try {
|
||||||
ruffyService.rtSendKey(key, true);
|
ruffyService.rtSendKey(key, true);
|
||||||
SystemClock.sleep(200);
|
SystemClock.sleep(150);
|
||||||
ruffyService.rtSendKey(Key.NO_KEY, true);
|
ruffyService.rtSendKey(Key.NO_KEY, true);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new CommandException().exception(e).message("Error while pressing buttons");
|
throw new CommandException().exception(e).message("Error while pressing buttons");
|
||||||
|
|
|
@ -227,17 +227,14 @@ public class BolusCommand extends BaseCommand {
|
||||||
for (int i = 0; i < steps; i++) {
|
for (int i = 0; i < steps; i++) {
|
||||||
scripter.verifyMenuIsDisplayed(MenuType.BOLUS_ENTER);
|
scripter.verifyMenuIsDisplayed(MenuType.BOLUS_ENTER);
|
||||||
scripter.pressUpKey();
|
scripter.pressUpKey();
|
||||||
SystemClock.sleep(100);
|
SystemClock.sleep(50);
|
||||||
}
|
}
|
||||||
// Give the pump time to finish any scrolling that might still be going on, can take
|
|
||||||
// up to 1100ms. Plus some extra time to be sure
|
|
||||||
SystemClock.sleep(2000);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void verifyDisplayedBolusAmount() {
|
private void verifyDisplayedBolusAmount() {
|
||||||
scripter.verifyMenuIsDisplayed(MenuType.BOLUS_ENTER);
|
scripter.verifyMenuIsDisplayed(MenuType.BOLUS_ENTER);
|
||||||
|
|
||||||
// wait up to 5s for any scrolling to finish
|
// wait up to 10s for any scrolling to finish
|
||||||
double displayedBolus = scripter.readBlinkingValue(Double.class, MenuAttribute.BOLUS);
|
double displayedBolus = scripter.readBlinkingValue(Double.class, MenuAttribute.BOLUS);
|
||||||
long timeout = System.currentTimeMillis() + 10 * 1000;
|
long timeout = System.currentTimeMillis() + 10 * 1000;
|
||||||
while (timeout > System.currentTimeMillis() && bolus - displayedBolus > 0.05) {
|
while (timeout > System.currentTimeMillis() && bolus - displayedBolus > 0.05) {
|
||||||
|
|
|
@ -117,9 +117,10 @@ public class SetTbrCommand extends BaseCommand {
|
||||||
for (int i = 0; i < Math.abs(percentageSteps); i++) {
|
for (int i = 0; i < Math.abs(percentageSteps); i++) {
|
||||||
scripter.verifyMenuIsDisplayed(MenuType.TBR_SET);
|
scripter.verifyMenuIsDisplayed(MenuType.TBR_SET);
|
||||||
log.debug("Push #" + (i + 1));
|
log.debug("Push #" + (i + 1));
|
||||||
|
log.debug("Push #" + (i + 1) + "/" + Math.abs(percentageSteps));
|
||||||
if (increasePercentage) scripter.pressUpKey();
|
if (increasePercentage) scripter.pressUpKey();
|
||||||
else scripter.pressDownKey();
|
else scripter.pressDownKey();
|
||||||
SystemClock.sleep(100);
|
SystemClock.sleep(50);
|
||||||
}
|
}
|
||||||
return increasePercentage;
|
return increasePercentage;
|
||||||
}
|
}
|
||||||
|
@ -163,10 +164,10 @@ public class SetTbrCommand extends BaseCommand {
|
||||||
log.debug("Pressing " + (increaseDuration ? "up" : "down") + " " + durationSteps + " times");
|
log.debug("Pressing " + (increaseDuration ? "up" : "down") + " " + durationSteps + " times");
|
||||||
for (int i = 0; i < Math.abs(durationSteps); i++) {
|
for (int i = 0; i < Math.abs(durationSteps); i++) {
|
||||||
scripter.verifyMenuIsDisplayed(MenuType.TBR_DURATION);
|
scripter.verifyMenuIsDisplayed(MenuType.TBR_DURATION);
|
||||||
log.debug("Push #" + (i + 1) + "/" + durationSteps);
|
log.debug("Push #" + (i + 1) + "/" + Math.abs(durationSteps));
|
||||||
if (increaseDuration) scripter.pressUpKey();
|
if (increaseDuration) scripter.pressUpKey();
|
||||||
else scripter.pressDownKey();
|
else scripter.pressDownKey();
|
||||||
SystemClock.sleep(100);
|
SystemClock.sleep(50);
|
||||||
}
|
}
|
||||||
return increaseDuration;
|
return increaseDuration;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue