Use SystemClock.sleep() instead of Thread.sleep() throughout.

This commit is contained in:
Johannes Mockenhaupt 2017-08-12 13:36:09 +02:00
parent 306a2787d0
commit 2f3d362240
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1
2 changed files with 6 additions and 7 deletions

View file

@ -1,5 +1,7 @@
package de.jotomo.ruffyscripter.commands; package de.jotomo.ruffyscripter.commands;
import android.os.SystemClock;
import org.monkey.d.ruffy.ruffy.driver.display.MenuAttribute; import org.monkey.d.ruffy.ruffy.driver.display.MenuAttribute;
import org.monkey.d.ruffy.ruffy.driver.display.MenuType; import org.monkey.d.ruffy.ruffy.driver.display.MenuType;
import org.monkey.d.ruffy.ruffy.driver.display.menu.MenuTime; import org.monkey.d.ruffy.ruffy.driver.display.menu.MenuTime;
@ -67,7 +69,7 @@ public class SetTbrCommand implements Command {
retries--; retries--;
if(retries==0) if(retries==0)
throw new CommandException().message("not able to find TBR_MENU: stuck in "+scripter.currentMenu); throw new CommandException().message("not able to find TBR_MENU: stuck in "+scripter.currentMenu);
Thread.sleep(500); SystemClock.sleep(500);
if(scripter.currentMenu.getType()== TBR_MENU) if(scripter.currentMenu.getType()== TBR_MENU)
break; break;
} }
@ -82,7 +84,7 @@ public class SetTbrCommand implements Command {
retries--; retries--;
if(retries==0) if(retries==0)
throw new CommandException().message("not able to find TBR_SET: stuck in "+scripter.currentMenu); throw new CommandException().message("not able to find TBR_SET: stuck in "+scripter.currentMenu);
Thread.sleep(500); SystemClock.sleep(500);
if(scripter.currentMenu.getType()== TBR_SET) if(scripter.currentMenu.getType()== TBR_SET)
break; break;
if(scripter.currentMenu.getType()== TBR_DURATION) if(scripter.currentMenu.getType()== TBR_DURATION)
@ -145,7 +147,7 @@ public class SetTbrCommand implements Command {
retries--; retries--;
if (retries == 0) if (retries == 0)
throw new CommandException().message("not able to find TBR_SET: stuck in " + scripter.currentMenu); throw new CommandException().message("not able to find TBR_SET: stuck in " + scripter.currentMenu);
Thread.sleep(500); SystemClock.sleep(500);
if (scripter.currentMenu.getType() == TBR_DURATION) if (scripter.currentMenu.getType() == TBR_DURATION)
break; break;
if (scripter.currentMenu.getType() == TBR_SET) { if (scripter.currentMenu.getType() == TBR_SET) {

View file

@ -209,10 +209,7 @@ public class ComboPlugin implements PluginBase, PumpInterface {
ruffyScripter.stop(); ruffyScripter.stop();
log.debug("ruffy service disconnected"); log.debug("ruffy service disconnected");
if(!keepUnbound) { if(!keepUnbound) {
try { SystemClock.sleep(250);
Thread.sleep(250);
} catch (Exception e) {
}
bindRuffyService(); bindRuffyService();
} }
} }