Crappy hack to deal with applying the first profile switch.
This commit is contained in:
parent
1e3f6dd192
commit
832138398f
1 changed files with 11 additions and 6 deletions
|
@ -2,6 +2,7 @@ package info.nightscout.androidaps.queue;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.os.SystemClock;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
import android.text.Spanned;
|
import android.text.Spanned;
|
||||||
|
@ -289,13 +290,17 @@ public class CommandQueue {
|
||||||
|
|
||||||
// Check that there is a valid profileSwitch NOW
|
// Check that there is a valid profileSwitch NOW
|
||||||
if (MainApp.getConfigBuilder().getProfileSwitchFromHistory(System.currentTimeMillis())==null) {
|
if (MainApp.getConfigBuilder().getProfileSwitchFromHistory(System.currentTimeMillis())==null) {
|
||||||
Notification noProfileSwitchNotif = new Notification(Notification.PROFILE_SWITCH_MISSING, MainApp.sResources.getString(R.string.profileswitch_ismissing), Notification.NORMAL);
|
// wait for DatabaseHelper.scheduleProfiSwitch() to do the profile switch // TODO clean this crap up
|
||||||
MainApp.bus().post(new EventNewNotification(noProfileSwitchNotif));
|
SystemClock.sleep(5000);
|
||||||
if (callback != null) {
|
if (MainApp.getConfigBuilder().getProfileSwitchFromHistory(System.currentTimeMillis())==null) {
|
||||||
PumpEnactResult result = new PumpEnactResult().success(false).enacted(false).comment("Refuse to send profile to pump! No ProfileSwitch!");
|
Notification noProfileSwitchNotif = new Notification(Notification.PROFILE_SWITCH_MISSING, MainApp.sResources.getString(R.string.profileswitch_ismissing), Notification.NORMAL);
|
||||||
callback.result(result).run();
|
MainApp.bus().post(new EventNewNotification(noProfileSwitchNotif));
|
||||||
|
if (callback != null) {
|
||||||
|
PumpEnactResult result = new PumpEnactResult().success(false).enacted(false).comment("Refuse to send profile to pump! No ProfileSwitch!");
|
||||||
|
callback.result(result).run();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compare with pump limits
|
// Compare with pump limits
|
||||||
|
|
Loading…
Reference in a new issue