re-initialize after time-sync
This commit is contained in:
parent
02eceef134
commit
54e647bbe1
1 changed files with 9 additions and 2 deletions
|
@ -153,8 +153,7 @@ public class DanaRSService extends Service {
|
||||||
MainApp.instance().startActivity(i);
|
MainApp.instance().startActivity(i);
|
||||||
|
|
||||||
//deinitialize pump
|
//deinitialize pump
|
||||||
DanaRPump.reset();
|
danaRPump.lastConnection = 0;
|
||||||
danaRPump = DanaRPump.getInstance();
|
|
||||||
MainApp.bus().post(new EventDanaRNewStatus());
|
MainApp.bus().post(new EventDanaRNewStatus());
|
||||||
MainApp.bus().post(new EventInitializationChanged());
|
MainApp.bus().post(new EventInitializationChanged());
|
||||||
return;
|
return;
|
||||||
|
@ -167,6 +166,7 @@ public class DanaRSService extends Service {
|
||||||
log.debug("Pump time difference: " + timeDiff + " seconds");
|
log.debug("Pump time difference: " + timeDiff + " seconds");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
danaRPump.lastConnection = System.currentTimeMillis();
|
||||||
|
|
||||||
long now = System.currentTimeMillis();
|
long now = System.currentTimeMillis();
|
||||||
if (danaRPump.lastSettingsRead + 60 * 60 * 1000L < now || !MainApp.getSpecificPlugin(DanaRSPlugin.class).isInitialized()) {
|
if (danaRPump.lastSettingsRead + 60 * 60 * 1000L < now || !MainApp.getSpecificPlugin(DanaRSPlugin.class).isInitialized()) {
|
||||||
|
@ -203,6 +203,13 @@ public class DanaRSService extends Service {
|
||||||
}
|
}
|
||||||
|
|
||||||
public PumpEnactResult loadEvents() {
|
public PumpEnactResult loadEvents() {
|
||||||
|
|
||||||
|
if(!MainApp.getSpecificPlugin(DanaRSPlugin.class).isInitialized()){
|
||||||
|
PumpEnactResult result = new PumpEnactResult().success(false);
|
||||||
|
result.comment = "pump not initialized";
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
DanaRS_Packet_APS_History_Events msg;
|
DanaRS_Packet_APS_History_Events msg;
|
||||||
if (lastHistoryFetched == 0) {
|
if (lastHistoryFetched == 0) {
|
||||||
msg = new DanaRS_Packet_APS_History_Events(0);
|
msg = new DanaRS_Packet_APS_History_Events(0);
|
||||||
|
|
Loading…
Reference in a new issue