Warn on long time diffs on Rv2
This commit is contained in:
parent
1b047bba69
commit
11b8587768
1 changed files with 11 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
|||
package info.nightscout.androidaps.plugins.PumpDanaRv2.services;
|
||||
|
||||
import android.bluetooth.BluetoothDevice;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.os.Binder;
|
||||
import android.os.SystemClock;
|
||||
|
@ -18,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.PumpDanaR.comm.MsgSettingUserOptions;
|
||||
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSetUserOptions;
|
||||
import info.nightscout.androidaps.plugins.Treatments.Treatment;
|
||||
|
@ -210,6 +212,15 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
|
|||
waitForWholeMinute(); // Dana can set only whole minute
|
||||
// add 10sec to be sure we are over minute (will be cutted off anyway)
|
||||
mSerialIOThread.sendMessage(new MsgSetTime(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);
|
||||
}
|
||||
mSerialIOThread.sendMessage(new MsgSettingPumpTime());
|
||||
timeDiff = (mDanaRPump.pumpTime.getTime() - System.currentTimeMillis()) / 1000L;
|
||||
log.debug("Pump time difference: " + timeDiff + " seconds");
|
||||
|
|
Loading…
Reference in a new issue