From 375eb466959a765fcd72c61a505a4b6c0aca74e3 Mon Sep 17 00:00:00 2001 From: Johannes Mockenhaupt Date: Sat, 15 Jul 2017 13:34:18 +0200 Subject: [PATCH] ReadStateCommand: properly read TBR %. --- .../ruffyscripter/commands/ReadStateCommand.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/de/jotomo/ruffyscripter/commands/ReadStateCommand.java b/app/src/main/java/de/jotomo/ruffyscripter/commands/ReadStateCommand.java index e4d87a7d9f..7d07079ab3 100644 --- a/app/src/main/java/de/jotomo/ruffyscripter/commands/ReadStateCommand.java +++ b/app/src/main/java/de/jotomo/ruffyscripter/commands/ReadStateCommand.java @@ -4,8 +4,6 @@ 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; import de.jotomo.ruffyscripter.RuffyScripter; @@ -14,8 +12,6 @@ import de.jotomo.ruffyscripter.RuffyScripter; * This command is 'read-only', no buttons are pushed and so no vibrations are caused. */ public class ReadStateCommand implements Command { - private static final Logger log = LoggerFactory.getLogger(ReadStateCommand.class); - @Override public CommandResult execute(RuffyScripter scripter) { try { @@ -26,6 +22,8 @@ public class ReadStateCommand implements Command { Double tbrPercentage = (Double) displayedMenu.getAttribute(MenuAttribute.TBR); if (tbrPercentage != 100) { state.tbrActive = true; + Double displayedTbr = (Double) scripter.currentMenu.getAttribute(MenuAttribute.TBR); + state.tbrPercent = displayedTbr.intValue(); MenuTime durationMenuTime = ((MenuTime) displayedMenu.getAttribute(MenuAttribute.RUNTIME)); state.tbrRemainingDuration = durationMenuTime.getHour() * 60 + durationMenuTime.getMinute(); } @@ -41,4 +39,10 @@ public class ReadStateCommand implements Command { return e.toCommandResult(); } } + + @Override + public String toString() { + return "ReadStateCommand{}"; + } + }