Fix reading pump time.
This commit is contained in:
parent
27922a045e
commit
97a9d65b52
2 changed files with 20 additions and 4 deletions
|
@ -81,15 +81,19 @@ public class PumpState {
|
|||
@Override
|
||||
public String toString() {
|
||||
return "PumpState{" +
|
||||
"menu=" + menu +
|
||||
"timestamp=" + timestamp +
|
||||
", pumpTime=" + pumpTime +
|
||||
", menu='" + menu + '\'' +
|
||||
", suspended=" + suspended +
|
||||
", tbrActive=" + tbrActive +
|
||||
", tbrPercent=" + tbrPercent +
|
||||
", tbrRate=" + tbrRate +
|
||||
", tbrRemainingDuration=" + tbrRemainingDuration +
|
||||
", suspended=" + suspended +
|
||||
", activeAlert=" + activeAlert +
|
||||
", batteryState=" + batteryState +
|
||||
", insulinState=" + insulinState +
|
||||
", activeBasalProfileNumber=" + activeBasalProfileNumber +
|
||||
", unsafeUsageDetected=" + unsafeUsageDetected +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -392,6 +392,15 @@ public class RuffyScripter implements RuffyCommands {
|
|||
|
||||
boolean connected = isConnected();
|
||||
if (connected) {
|
||||
long menuTime = this.menuLastUpdated;
|
||||
waitForScreenUpdate();
|
||||
if (menuTime == this.menuLastUpdated) {
|
||||
log.error("NOT RECEIVING UPDATES YET JOE");
|
||||
}
|
||||
while(currentMenu==null) {
|
||||
log.warn("waiting for currentMenu to become != null");
|
||||
waitForScreenUpdate();
|
||||
}
|
||||
MenuType menuType = getCurrentMenu().getType();
|
||||
if (menuType != MenuType.MAIN_MENU && menuType != MenuType.WARNING_OR_ERROR) {
|
||||
returnToRootMenu();
|
||||
|
@ -500,7 +509,8 @@ public class RuffyScripter implements RuffyCommands {
|
|||
Date date = new Date();
|
||||
date.setHours(time.getHour());
|
||||
date.setMinutes(time.getMinute());
|
||||
state.pumpTime = date.getTime();
|
||||
date.setSeconds(0);
|
||||
state.pumpTime = date.getTime() - date.getTime() % 1000;
|
||||
}
|
||||
} else if (menuType == MenuType.WARNING_OR_ERROR) {
|
||||
state.activeAlert = readWarningOrErrorCode();
|
||||
|
@ -517,10 +527,12 @@ public class RuffyScripter implements RuffyCommands {
|
|||
Date date = new Date();
|
||||
date.setHours(time.getHour());
|
||||
date.setMinutes(time.getMinute());
|
||||
state.pumpTime = date.getTime();
|
||||
date.setSeconds(0);
|
||||
state.pumpTime = date.getTime() - date.getTime() % 1000;
|
||||
}
|
||||
}
|
||||
|
||||
log.debug("State read: " + state);
|
||||
return state;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue