Remove status logging in Ruffy, now done by command.

This commit is contained in:
Johannes Mockenhaupt 2017-07-15 14:21:37 +02:00
parent 8bc4cd255a
commit 2c706e7c22
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1

View file

@ -6,9 +6,7 @@ import android.os.SystemClock;
import org.monkey.d.ruffy.ruffy.driver.IRTHandler;
import org.monkey.d.ruffy.ruffy.driver.IRuffyService;
import org.monkey.d.ruffy.ruffy.driver.display.Menu;
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.menu.MenuTime;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -124,7 +122,9 @@ public class RuffyScripter {
// TODO hackish, to say the least ...
// wait till pump is ready for input
waitForMenuUpdate();
logPumpStatus();
// TODO check pump state; currently most command check their in the MAIN_MENU;
// run ReadStateCommand, which handles possible states ... and then do wait?
// Return an unsuccessful CommandResult and make the caller do something loud with it
log.debug("Cmd execution: connection ready, executing cmd " + cmd);
cmdThread = new Thread(new Runnable() {
@Override
@ -167,28 +167,6 @@ public class RuffyScripter {
}
}
private void logPumpStatus() {
log.debug("Pump status:");
MenuType currentMenuType = currentMenu.getType();
if (currentMenuType == MenuType.MAIN_MENU) {
Double tbrPercentage = (Double) currentMenu.getAttribute(MenuAttribute.TBR);
if (tbrPercentage != 100) {
MenuTime durationMenuTime = ((MenuTime) currentMenu.getAttribute(MenuAttribute.RUNTIME));
long durationRemainging = durationMenuTime.getHour() * 60 + durationMenuTime.getMinute();
log.debug(" TBR active: " + tbrPercentage + "%/" + durationRemainging + "m remaining");
} else {
log.debug(" TBR active: no");
}
} else {
log.warn(" !!! Pump is on unexpected screen " + currentMenuType + " !!!");
log.warn(" Dumping all displayed attributes:");
for (MenuAttribute menuAttribute : currentMenu.attributes()) {
log.warn(" " + menuAttribute + ": " + currentMenu.getAttribute(menuAttribute));
}
}
}
public void ensureConnected() {
// did we get a menu update from the pump in the last 5s? Then we're connected
if (currentMenu != null && menuLastUpdated + 5000 > System.currentTimeMillis()) {