Don't bother setting a fake TBR if we waited for a TBR to run out.
(cherry picked from commit 3a5ecea)
This commit is contained in:
parent
34f3428d99
commit
e0d77b9b0c
1 changed files with 6 additions and 7 deletions
|
@ -61,10 +61,8 @@ public class SetTbrCommand extends BaseCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
boolean cancellingTbr = percentage == 100;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (checkAndWaitIfExistingTbrIsAboutToEnd(cancellingTbr)) {
|
if (checkAndWaitIfExistingTbrIsAboutToEnd()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,7 +70,7 @@ public class SetTbrCommand extends BaseCommand {
|
||||||
boolean increasingPercentage = inputTbrPercentage();
|
boolean increasingPercentage = inputTbrPercentage();
|
||||||
verifyDisplayedTbrPercentage(increasingPercentage);
|
verifyDisplayedTbrPercentage(increasingPercentage);
|
||||||
|
|
||||||
if (cancellingTbr) {
|
if (percentage == 100) {
|
||||||
cancelTbrAndConfirmCancellationWarning();
|
cancelTbrAndConfirmCancellationWarning();
|
||||||
} else {
|
} else {
|
||||||
// switch to TBR_DURATION menu by pressing menu key
|
// switch to TBR_DURATION menu by pressing menu key
|
||||||
|
@ -116,7 +114,7 @@ public class SetTbrCommand extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @return true if we waited till the TBR ended and cancellation was request so all work is done.
|
* @return true if we waited till the TBR ended and cancellation was request so all work is done.
|
||||||
*/
|
*/
|
||||||
private boolean checkAndWaitIfExistingTbrIsAboutToEnd(boolean cancellingTbr) {
|
private boolean checkAndWaitIfExistingTbrIsAboutToEnd() {
|
||||||
scripter.verifyMenuIsDisplayed(MenuType.MAIN_MENU);
|
scripter.verifyMenuIsDisplayed(MenuType.MAIN_MENU);
|
||||||
long timeout = System.currentTimeMillis() + 65 * 1000;
|
long timeout = System.currentTimeMillis() + 65 * 1000;
|
||||||
PumpState state = scripter.readPumpStateInternal();
|
PumpState state = scripter.readPumpStateInternal();
|
||||||
|
@ -126,8 +124,9 @@ public class SetTbrCommand extends BaseCommand {
|
||||||
scripter.waitForScreenUpdate();
|
scripter.waitForScreenUpdate();
|
||||||
state = scripter.readPumpStateInternal();
|
state = scripter.readPumpStateInternal();
|
||||||
}
|
}
|
||||||
// if we waited above and a cancellation was requested, we already completed the request
|
// if we waited above and a cancellation (fake or hard) was requested,
|
||||||
if (!state.tbrActive && cancellingTbr) {
|
// we already completed the request
|
||||||
|
if (!state.tbrActive && percentage >= 90 && percentage <= 110) {
|
||||||
result.success = true;
|
result.success = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue