Rename RuffyScripter.waitScreen -> waitForScreenUpdate.

This commit is contained in:
Johannes Mockenhaupt 2017-08-12 14:15:23 +02:00
parent fc5b4cd93b
commit 5a1d2d495d
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1
3 changed files with 16 additions and 16 deletions

View file

@ -440,7 +440,7 @@ public class RuffyScripter {
log.debug("Releasing back key"); log.debug("Releasing back key");
} }
public boolean waitScreen(long timeout) public boolean waitForScreenUpdate(long timeout)
{ {
synchronized (screenlock) { synchronized (screenlock) {
try { try {
@ -472,7 +472,7 @@ public class RuffyScripter {
} }
else else
pressMenuKey(); pressMenuKey();
waitScreen(250); waitForScreenUpdate(250);
} }
return currentMenu != null && currentMenu.getType()==screen; return currentMenu != null && currentMenu.getType()==screen;
} }
@ -486,7 +486,7 @@ public class RuffyScripter {
long start = System.currentTimeMillis(); long start = System.currentTimeMillis();
pressKey(key,2000); pressKey(key,2000);
while((currentMenu == null || currentMenu.getType()!=targetType) && start+timeout>System.currentTimeMillis()) { while((currentMenu == null || currentMenu.getType()!=targetType) && start+timeout>System.currentTimeMillis()) {
waitScreen(100); waitForScreenUpdate(100);
} }
return currentMenu!=null && currentMenu.getType()==targetType; return currentMenu!=null && currentMenu.getType()==targetType;
} }

View file

@ -85,7 +85,7 @@ public class GetBasalCommand implements Command {
// } else { // } else {
// retries--; // retries--;
// scripter.pressMenuKey(); // scripter.pressMenuKey();
// scripter.waitScreen(250); // scripter.waitForScreenUpdate(250);
// } // }
// } else { // } else {
// updateState(ERROR, 30); // updateState(ERROR, 30);

View file

@ -90,7 +90,7 @@ public class SetTbrCommand implements Command {
if(scripter.currentMenu.getType()== TBR_DURATION) if(scripter.currentMenu.getType()== TBR_DURATION)
{ {
scripter.pressMenuKey(); scripter.pressMenuKey();
scripter.waitScreen(1000); scripter.waitForScreenUpdate(1000);
} }
} }
@ -111,19 +111,19 @@ public class SetTbrCommand implements Command {
int steps = (requestedPercentage - actualPercentage) / 10; int steps = (requestedPercentage - actualPercentage) / 10;
log.debug("Adjusting basal(" + requestedPercentage + "/" + actualPercentage + ") with " + steps + " steps and " + retries + " retries left"); log.debug("Adjusting basal(" + requestedPercentage + "/" + actualPercentage + ") with " + steps + " steps and " + retries + " retries left");
scripter.step(steps, (steps < 0 ? RuffyScripter.Key.DOWN : RuffyScripter.Key.UP), 500); scripter.step(steps, (steps < 0 ? RuffyScripter.Key.DOWN : RuffyScripter.Key.UP), 500);
scripter.waitScreen(1000); scripter.waitForScreenUpdate(1000);
} }
} }
else else
currentPercentage=-100; currentPercentage=-100;
scripter.waitScreen(1000); scripter.waitForScreenUpdate(1000);
} }
if(currentPercentage<0 ||retries < 0) if(currentPercentage<0 ||retries < 0)
throw new CommandException().message("unable to set basalrate"); throw new CommandException().message("unable to set basalrate");
log.debug("4. checking basal in "+scripter.currentMenu); log.debug("4. checking basal in "+scripter.currentMenu);
scripter.waitScreen(1000); scripter.waitForScreenUpdate(1000);
currentPercentage= -1000; currentPercentage= -1000;
retries=10; retries=10;
while(currentPercentage<0 && retries>=0) { while(currentPercentage<0 && retries>=0) {
@ -134,7 +134,7 @@ public class SetTbrCommand implements Command {
currentPercentage = ((Double) percentageObj).doubleValue(); currentPercentage = ((Double) percentageObj).doubleValue();
} }
else else
scripter.waitScreen(1000); scripter.waitForScreenUpdate(1000);
} }
if(retries<0 ||currentPercentage!=percentage) if(retries<0 ||currentPercentage!=percentage)
@ -152,7 +152,7 @@ public class SetTbrCommand implements Command {
break; break;
if (scripter.currentMenu.getType() == TBR_SET) { if (scripter.currentMenu.getType() == TBR_SET) {
scripter.pressMenuKey(); scripter.pressMenuKey();
scripter.waitScreen(1000); scripter.waitForScreenUpdate(1000);
} }
} }
@ -177,16 +177,16 @@ public class SetTbrCommand implements Command {
steps--; steps--;
log.debug("Adjusting duration(" + requestedDuration + "/" + actualDuration + ") with " + steps + " steps and " + retries + " retries left"); log.debug("Adjusting duration(" + requestedDuration + "/" + actualDuration + ") with " + steps + " steps and " + retries + " retries left");
scripter.step(steps, (steps > 0 ? RuffyScripter.Key.UP : RuffyScripter.Key.DOWN), 500); scripter.step(steps, (steps > 0 ? RuffyScripter.Key.UP : RuffyScripter.Key.DOWN), 500);
scripter.waitScreen(1000); scripter.waitForScreenUpdate(1000);
} }
} }
scripter.waitScreen(1000); scripter.waitForScreenUpdate(1000);
} }
if (currentDuration < 0 || retries < 0) if (currentDuration < 0 || retries < 0)
throw new CommandException().message("unable to set duration, requested:" + duration + ", displayed on pump: " + currentDuration); throw new CommandException().message("unable to set duration, requested:" + duration + ", displayed on pump: " + currentDuration);
log.debug("7. checking time in " + scripter.currentMenu); log.debug("7. checking time in " + scripter.currentMenu);
scripter.waitScreen(1000); scripter.waitForScreenUpdate(1000);
currentDuration = -1000; currentDuration = -1000;
retries = 10; retries = 10;
while (currentDuration < 0 && retries >= 0) { while (currentDuration < 0 && retries >= 0) {
@ -198,7 +198,7 @@ public class SetTbrCommand implements Command {
currentDuration = (time.getHour() * 60) + time.getMinute(); currentDuration = (time.getHour() * 60) + time.getMinute();
} }
else else
scripter.waitScreen(1000); scripter.waitForScreenUpdate(1000);
} }
if (retries < 0 || currentDuration != duration) if (retries < 0 || currentDuration != duration)
throw new CommandException().message("wrong time!"); throw new CommandException().message("wrong time!");
@ -210,7 +210,7 @@ public class SetTbrCommand implements Command {
{ {
retries--; retries--;
scripter.pressCheckKey(); scripter.pressCheckKey();
scripter.waitScreen(1000); scripter.waitForScreenUpdate(1000);
} }
if(retries<0 || scripter.currentMenu.getType()==TBR_DURATION ||scripter.currentMenu.getType()==TBR_SET) if(retries<0 || scripter.currentMenu.getType()==TBR_DURATION ||scripter.currentMenu.getType()==TBR_SET)
throw new CommandException().message("failed setting basal!"); throw new CommandException().message("failed setting basal!");
@ -225,7 +225,7 @@ public class SetTbrCommand implements Command {
scripter.pressCheckKey(); scripter.pressCheckKey();
retries++; retries++;
canceledError = true; canceledError = true;
scripter.waitScreen(1000); scripter.waitForScreenUpdate(1000);
} }
else { else {
retries--; retries--;