Fixes and cleanups.
This commit is contained in:
parent
2c0975994d
commit
46fdd47ac0
9 changed files with 9 additions and 18 deletions
|
@ -142,10 +142,6 @@ public class ComboFragment extends SubscriberFragment implements View.OnClickLis
|
||||||
} else if (plugin.getPump().lastSuccessfulCmdTime + 30 * 60 * 1000 < System.currentTimeMillis()) {
|
} else if (plugin.getPump().lastSuccessfulCmdTime + 30 * 60 * 1000 < System.currentTimeMillis()) {
|
||||||
lastConnectionView.setText(getString(R.string.combo_no_pump_connection, min));
|
lastConnectionView.setText(getString(R.string.combo_no_pump_connection, min));
|
||||||
lastConnectionView.setTextColor(Color.RED);
|
lastConnectionView.setTextColor(Color.RED);
|
||||||
} else if (plugin.getPump().lastCmdTime > plugin.getPump().lastSuccessfulCmdTime) {
|
|
||||||
String lastFailed = minAgo + "\n" + getString(R.string.combo_connect_attempt_failed);
|
|
||||||
lastConnectionView.setText(lastFailed);
|
|
||||||
lastConnectionView.setTextColor(Color.YELLOW);
|
|
||||||
} else {
|
} else {
|
||||||
lastConnectionView.setText(minAgo);
|
lastConnectionView.setText(minAgo);
|
||||||
lastConnectionView.setTextColor(Color.WHITE);
|
lastConnectionView.setTextColor(Color.WHITE);
|
||||||
|
|
|
@ -631,8 +631,6 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
||||||
* NO history, reservoir level fields are updated, this make be done separately if desired.
|
* NO history, reservoir level fields are updated, this make be done separately if desired.
|
||||||
*/
|
*/
|
||||||
private synchronized CommandResult runCommand(String activity, int retries, CommandExecution commandExecution) {
|
private synchronized CommandResult runCommand(String activity, int retries, CommandExecution commandExecution) {
|
||||||
pump.lastCmdTime = System.currentTimeMillis();
|
|
||||||
|
|
||||||
CommandResult commandResult;
|
CommandResult commandResult;
|
||||||
try {
|
try {
|
||||||
if (activity != null) {
|
if (activity != null) {
|
||||||
|
@ -661,7 +659,7 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
||||||
}
|
}
|
||||||
|
|
||||||
if (commandResult.success) {
|
if (commandResult.success) {
|
||||||
pump.lastSuccessfulCmdTime = pump.lastCmdTime;
|
pump.lastSuccessfulCmdTime = System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
|
|
||||||
pump.lastCmdResult = commandResult;
|
pump.lastCmdResult = commandResult;
|
||||||
|
|
|
@ -12,7 +12,6 @@ import de.jotomo.ruffy.spi.history.PumpHistory;
|
||||||
class ComboPump {
|
class ComboPump {
|
||||||
boolean initialized = false;
|
boolean initialized = false;
|
||||||
volatile long lastSuccessfulCmdTime;
|
volatile long lastSuccessfulCmdTime;
|
||||||
volatile long lastCmdTime;
|
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
volatile CommandResult lastCmdResult;
|
volatile CommandResult lastCmdResult;
|
||||||
|
|
|
@ -678,7 +678,7 @@
|
||||||
<string name="combo_tbr_remaining">%d%% (%d verbleibend)</string>
|
<string name="combo_tbr_remaining">%d%% (%d verbleibend)</string>
|
||||||
<string name="combopump_settings">Accu-Chek Combo settings Einstellungen</string>
|
<string name="combopump_settings">Accu-Chek Combo settings Einstellungen</string>
|
||||||
<string name="combo_connect_attempt_failed">Verbindungsaufbau fehlgeschlagen</string>
|
<string name="combo_connect_attempt_failed">Verbindungsaufbau fehlgeschlagen</string>
|
||||||
<string name="combo_no_pump_connection">Keine Verbindung zur Pumpe seit %s</string>
|
<string name="combo_no_pump_connection">Keine Verbindung zur Pumpe seit %d min</string>
|
||||||
<string name="bolusstopped">Bolusabgabe gestopped</string>
|
<string name="bolusstopped">Bolusabgabe gestopped</string>
|
||||||
<string name="bolusstopping">Bolusabgabe wird abgebrochen</string>
|
<string name="bolusstopping">Bolusabgabe wird abgebrochen</string>
|
||||||
<string name="pump_errors_history">Fehlerprotokol</string>
|
<string name="pump_errors_history">Fehlerprotokol</string>
|
||||||
|
|
|
@ -415,6 +415,7 @@ public class RuffyScripter implements RuffyCommands {
|
||||||
MenuType type = menu.getType();
|
MenuType type = menu.getType();
|
||||||
if (type != MenuType.WARNING_OR_ERROR && type != MenuType.MAIN_MENU) {
|
if (type != MenuType.WARNING_OR_ERROR && type != MenuType.MAIN_MENU) {
|
||||||
try {
|
try {
|
||||||
|
log.debug("Command execution yielded an error, returning to main menu");
|
||||||
returnToRootMenu();
|
returnToRootMenu();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.warn("Error returning to main menu, when trying to recover from command failure", e);
|
log.warn("Error returning to main menu, when trying to recover from command failure", e);
|
||||||
|
@ -617,17 +618,17 @@ public class RuffyScripter implements RuffyCommands {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void navigateToMenu(MenuType desiredMenu) {
|
public void navigateToMenu(MenuType desiredMenu) {
|
||||||
int moviesLeft = 20;
|
int retries = 20;
|
||||||
while (getCurrentMenu().getType() != desiredMenu) {
|
while (getCurrentMenu().getType() != desiredMenu) {
|
||||||
moviesLeft--;
|
|
||||||
MenuType currentMenuType = getCurrentMenu().getType();
|
MenuType currentMenuType = getCurrentMenu().getType();
|
||||||
log.debug("Navigating to menu " + desiredMenu + ", current menu: " + currentMenuType);
|
log.debug("Navigating to menu " + desiredMenu + ", current menu: " + currentMenuType);
|
||||||
if (moviesLeft == 0) {
|
retries--;
|
||||||
|
if (retries == 0) {
|
||||||
throw new CommandException("Menu not found searching for " + desiredMenu
|
throw new CommandException("Menu not found searching for " + desiredMenu
|
||||||
+ ". Check menu settings on your pump to ensure it's not hidden.");
|
+ ". Check menu settings on your pump to ensure it's not hidden.");
|
||||||
}
|
}
|
||||||
pressMenuKey();
|
pressMenuKey();
|
||||||
waitForScreenUpdate();
|
SystemClock.sleep(200);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -158,7 +158,6 @@ public class BolusCommand extends BaseCommand {
|
||||||
scripter.navigateToMenu(MenuType.BOLUS_MENU);
|
scripter.navigateToMenu(MenuType.BOLUS_MENU);
|
||||||
scripter.verifyMenuIsDisplayed(MenuType.BOLUS_MENU);
|
scripter.verifyMenuIsDisplayed(MenuType.BOLUS_MENU);
|
||||||
scripter.pressCheckKey();
|
scripter.pressCheckKey();
|
||||||
scripter.waitForScreenUpdate();
|
|
||||||
scripter.verifyMenuIsDisplayed(MenuType.BOLUS_ENTER);
|
scripter.verifyMenuIsDisplayed(MenuType.BOLUS_ENTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,6 @@ public class SetTbrCommand extends BaseCommand {
|
||||||
// switch to TBR_DURATION menu by pressing menu key
|
// switch to TBR_DURATION menu by pressing menu key
|
||||||
scripter.verifyMenuIsDisplayed(MenuType.TBR_SET);
|
scripter.verifyMenuIsDisplayed(MenuType.TBR_SET);
|
||||||
scripter.pressMenuKey();
|
scripter.pressMenuKey();
|
||||||
scripter.waitForScreenUpdate();
|
|
||||||
scripter.verifyMenuIsDisplayed(MenuType.TBR_DURATION);
|
scripter.verifyMenuIsDisplayed(MenuType.TBR_DURATION);
|
||||||
|
|
||||||
boolean increasingDuration = inputTbrDuration();
|
boolean increasingDuration = inputTbrDuration();
|
||||||
|
@ -88,7 +87,6 @@ public class SetTbrCommand extends BaseCommand {
|
||||||
scripter.navigateToMenu(MenuType.TBR_MENU);
|
scripter.navigateToMenu(MenuType.TBR_MENU);
|
||||||
scripter.verifyMenuIsDisplayed(MenuType.TBR_MENU);
|
scripter.verifyMenuIsDisplayed(MenuType.TBR_MENU);
|
||||||
scripter.pressCheckKey();
|
scripter.pressCheckKey();
|
||||||
scripter.waitForScreenUpdate();
|
|
||||||
scripter.verifyMenuIsDisplayed(MenuType.TBR_SET);
|
scripter.verifyMenuIsDisplayed(MenuType.TBR_SET);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ public class BolusActivity extends ViewSelectorActivity {
|
||||||
if (editCarbs != null){
|
if (editCarbs != null){
|
||||||
def = SafeParse.stringToDouble(editCarbs.editText.getText().toString());
|
def = SafeParse.stringToDouble(editCarbs.editText.getText().toString());
|
||||||
}
|
}
|
||||||
editCarbs = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 0d, 150d, 1d, new DecimalFormat("0"), false);
|
editCarbs = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 0d, 150d, 5d, new DecimalFormat("0"), false);
|
||||||
setLabelToPlusMinusView(view, "carbs");
|
setLabelToPlusMinusView(view, "carbs");
|
||||||
container.addView(view);
|
container.addView(view);
|
||||||
return view;
|
return view;
|
||||||
|
|
|
@ -96,7 +96,7 @@ public class TempTargetActivity extends ViewSelectorActivity {
|
||||||
if (lowRange != null){
|
if (lowRange != null){
|
||||||
def = SafeParse.stringToDouble(lowRange.editText.getText().toString());
|
def = SafeParse.stringToDouble(lowRange.editText.getText().toString());
|
||||||
}
|
}
|
||||||
lowRange = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 72d, 180d, 1d, new DecimalFormat("0"), false);
|
lowRange = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 72d, 180d, 10d, new DecimalFormat("0"), false);
|
||||||
} else {
|
} else {
|
||||||
double def = 5.5;
|
double def = 5.5;
|
||||||
if (lowRange != null){
|
if (lowRange != null){
|
||||||
|
|
Loading…
Reference in a new issue