Warn on large time offsets RS
This commit is contained in:
parent
9c0665124d
commit
1b047bba69
|
@ -19,6 +19,7 @@ import info.nightscout.androidaps.MainApp;
|
|||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.data.Profile;
|
||||
import info.nightscout.androidaps.data.PumpEnactResult;
|
||||
import info.nightscout.androidaps.plugins.Overview.Dialogs.ErrorHelperActivity;
|
||||
import info.nightscout.androidaps.plugins.PumpDanaRS.comm.DanaRS_Packet_Option_Get_User_Option;
|
||||
import info.nightscout.androidaps.plugins.Treatments.Treatment;
|
||||
import info.nightscout.androidaps.events.EventAppExit;
|
||||
|
@ -155,6 +156,15 @@ public class DanaRSService extends Service {
|
|||
waitForWholeMinute(); // Dana can set only whole minute
|
||||
// add 10sec to be sure we are over minute (will be cutted off anyway)
|
||||
bleComm.sendMessage(new DanaRS_Packet_Option_Set_Pump_Time(new Date(DateUtil.now() + T.secs(10).msecs())));
|
||||
if (Math.abs(timeDiff) > 60*60*1.5) {
|
||||
//If time-diff is very large, warn user until we can synchronize history readings properly
|
||||
Intent i = new Intent(MainApp.instance(), ErrorHelperActivity.class);
|
||||
i.putExtra("soundid", R.raw.error);
|
||||
i.putExtra("status", MainApp.gs(R.string.largetimediff));
|
||||
i.putExtra("title", MainApp.gs(R.string.largetimedifftitle));
|
||||
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
MainApp.instance().startActivity(i);
|
||||
}
|
||||
bleComm.sendMessage(new DanaRS_Packet_Option_Get_Pump_Time());
|
||||
timeDiff = (danaRPump.pumpTime.getTime() - System.currentTimeMillis()) / 1000L;
|
||||
log.debug("Pump time difference: " + timeDiff + " seconds");
|
||||
|
|
Loading…
Reference in a new issue