re-initialize on time sync Rv2
This commit is contained in:
parent
54e647bbe1
commit
87d24b6e6e
1 changed files with 10 additions and 2 deletions
|
@ -205,8 +205,7 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
|
||||||
MainApp.instance().startActivity(i);
|
MainApp.instance().startActivity(i);
|
||||||
|
|
||||||
//deinitialize pump
|
//deinitialize pump
|
||||||
DanaRPump.reset();
|
mDanaRPump.lastConnection = 0;
|
||||||
mDanaRPump = DanaRPump.getInstance();
|
|
||||||
MainApp.bus().post(new EventDanaRNewStatus());
|
MainApp.bus().post(new EventDanaRNewStatus());
|
||||||
MainApp.bus().post(new EventInitializationChanged());
|
MainApp.bus().post(new EventInitializationChanged());
|
||||||
return;
|
return;
|
||||||
|
@ -219,6 +218,7 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
|
||||||
log.debug("Pump time difference: " + timeDiff + " seconds");
|
log.debug("Pump time difference: " + timeDiff + " seconds");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
mDanaRPump.lastConnection = System.currentTimeMillis();
|
||||||
|
|
||||||
long now = System.currentTimeMillis();
|
long now = System.currentTimeMillis();
|
||||||
if (mDanaRPump.lastSettingsRead + 60 * 60 * 1000L < now || !MainApp.getSpecificPlugin(DanaRv2Plugin.class).isInitialized()) {
|
if (mDanaRPump.lastSettingsRead + 60 * 60 * 1000L < now || !MainApp.getSpecificPlugin(DanaRv2Plugin.class).isInitialized()) {
|
||||||
|
@ -445,6 +445,14 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public PumpEnactResult loadEvents() {
|
public PumpEnactResult loadEvents() {
|
||||||
|
|
||||||
|
if(!MainApp.getSpecificPlugin(DanaRv2Plugin.class).isInitialized()){
|
||||||
|
PumpEnactResult result = new PumpEnactResult().success(false);
|
||||||
|
result.comment = "pump not initialized";
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!isConnected())
|
if (!isConnected())
|
||||||
return new PumpEnactResult().success(false);
|
return new PumpEnactResult().success(false);
|
||||||
SystemClock.sleep(300);
|
SystemClock.sleep(300);
|
||||||
|
|
Loading…
Reference in a new issue