Merge branch 'dev' into csv2-staging
* dev: fix disconnecting pump format output date to be displayed on iDevices correctly BolusWizard use 0 for insulin correction if in range LocalProfile TimeListEdit min, max remove string with no default translation Rv2,RS fix loading events initialize lastCommandTime too after BT reset allow to read status after every command
This commit is contained in:
commit
bd0ae23e30
20 changed files with 67 additions and 45 deletions
|
@ -38,7 +38,7 @@ public interface PumpInterface {
|
||||||
PumpEnactResult deliverTreatment(DetailedBolusInfo detailedBolusInfo);
|
PumpEnactResult deliverTreatment(DetailedBolusInfo detailedBolusInfo);
|
||||||
void stopBolusDelivering();
|
void stopBolusDelivering();
|
||||||
PumpEnactResult setTempBasalAbsolute(Double absoluteRate, Integer durationInMinutes, boolean enforceNew);
|
PumpEnactResult setTempBasalAbsolute(Double absoluteRate, Integer durationInMinutes, boolean enforceNew);
|
||||||
PumpEnactResult setTempBasalPercent(Integer percent, Integer durationInMinutes);
|
PumpEnactResult setTempBasalPercent(Integer percent, Integer durationInMinutes, boolean enforceNew);
|
||||||
PumpEnactResult setExtendedBolus(Double insulin, Integer durationInMinutes);
|
PumpEnactResult setExtendedBolus(Double insulin, Integer durationInMinutes);
|
||||||
//some pumps might set a very short temp close to 100% as cancelling a temp can be noisy
|
//some pumps might set a very short temp close to 100% as cancelling a temp can be noisy
|
||||||
//when the cancel request is requested by the user (forced), the pump should always do a real cancel
|
//when the cancel request is requested by the user (forced), the pump should always do a real cancel
|
||||||
|
|
|
@ -155,7 +155,7 @@ public class NewTempBasalDialog extends DialogFragment implements View.OnClickLi
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (setAsPercent) {
|
if (setAsPercent) {
|
||||||
ConfigBuilderPlugin.getCommandQueue().tempBasalPercent(finalBasalPercent, finalDurationInMinutes, callback);
|
ConfigBuilderPlugin.getCommandQueue().tempBasalPercent(finalBasalPercent, finalDurationInMinutes, true, callback);
|
||||||
} else {
|
} else {
|
||||||
ConfigBuilderPlugin.getCommandQueue().tempBasalAbsolute(finalBasal, finalDurationInMinutes, true, callback);
|
ConfigBuilderPlugin.getCommandQueue().tempBasalAbsolute(finalBasal, finalDurationInMinutes, true, callback);
|
||||||
}
|
}
|
||||||
|
|
|
@ -344,7 +344,7 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
|
||||||
activeloop.superBolusTo(System.currentTimeMillis() + 2 * 60L * 60 * 1000);
|
activeloop.superBolusTo(System.currentTimeMillis() + 2 * 60L * 60 * 1000);
|
||||||
MainApp.bus().post(new EventRefreshOverview("WizardDialog"));
|
MainApp.bus().post(new EventRefreshOverview("WizardDialog"));
|
||||||
}
|
}
|
||||||
ConfigBuilderPlugin.getCommandQueue().tempBasalAbsolute(0d, 120, true, new Callback() {
|
ConfigBuilderPlugin.getCommandQueue().tempBasalPercent(0, 120, true, new Callback() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
|
|
|
@ -79,6 +79,7 @@ import info.nightscout.androidaps.events.EventTempBasalChange;
|
||||||
import info.nightscout.androidaps.events.EventTempTargetChange;
|
import info.nightscout.androidaps.events.EventTempTargetChange;
|
||||||
import info.nightscout.androidaps.events.EventTreatmentChange;
|
import info.nightscout.androidaps.events.EventTreatmentChange;
|
||||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||||
|
import info.nightscout.androidaps.interfaces.PumpDescription;
|
||||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||||
import info.nightscout.androidaps.plugins.Careportal.CareportalFragment;
|
import info.nightscout.androidaps.plugins.Careportal.CareportalFragment;
|
||||||
import info.nightscout.androidaps.plugins.Careportal.Dialogs.NewNSTreatmentDialog;
|
import info.nightscout.androidaps.plugins.Careportal.Dialogs.NewNSTreatmentDialog;
|
||||||
|
@ -331,6 +332,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
||||||
super.onCreateContextMenu(menu, v, menuInfo);
|
super.onCreateContextMenu(menu, v, menuInfo);
|
||||||
if (v == apsModeView) {
|
if (v == apsModeView) {
|
||||||
final LoopPlugin activeloop = ConfigBuilderPlugin.getActiveLoop();
|
final LoopPlugin activeloop = ConfigBuilderPlugin.getActiveLoop();
|
||||||
|
final PumpDescription pumpDescription = ConfigBuilderPlugin.getActivePump().getPumpDescription();
|
||||||
if (activeloop == null)
|
if (activeloop == null)
|
||||||
return;
|
return;
|
||||||
menu.setHeaderTitle(MainApp.sResources.getString(R.string.loop));
|
menu.setHeaderTitle(MainApp.sResources.getString(R.string.loop));
|
||||||
|
@ -341,7 +343,8 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
||||||
menu.add(MainApp.sResources.getString(R.string.suspendloopfor2h));
|
menu.add(MainApp.sResources.getString(R.string.suspendloopfor2h));
|
||||||
menu.add(MainApp.sResources.getString(R.string.suspendloopfor3h));
|
menu.add(MainApp.sResources.getString(R.string.suspendloopfor3h));
|
||||||
menu.add(MainApp.sResources.getString(R.string.suspendloopfor10h));
|
menu.add(MainApp.sResources.getString(R.string.suspendloopfor10h));
|
||||||
menu.add(MainApp.sResources.getString(R.string.disconnectpumpfor30m));
|
if (pumpDescription.tempDurationStep <= 30)
|
||||||
|
menu.add(MainApp.sResources.getString(R.string.disconnectpumpfor30m));
|
||||||
menu.add(MainApp.sResources.getString(R.string.disconnectpumpfor1h));
|
menu.add(MainApp.sResources.getString(R.string.disconnectpumpfor1h));
|
||||||
menu.add(MainApp.sResources.getString(R.string.disconnectpumpfor2h));
|
menu.add(MainApp.sResources.getString(R.string.disconnectpumpfor2h));
|
||||||
menu.add(MainApp.sResources.getString(R.string.disconnectpumpfor3h));
|
menu.add(MainApp.sResources.getString(R.string.disconnectpumpfor3h));
|
||||||
|
@ -480,7 +483,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
||||||
} else if (item.getTitle().equals(MainApp.sResources.getString(R.string.disconnectpumpfor30m))) {
|
} else if (item.getTitle().equals(MainApp.sResources.getString(R.string.disconnectpumpfor30m))) {
|
||||||
activeloop.disconnectTo(System.currentTimeMillis() + 30L * 60 * 1000);
|
activeloop.disconnectTo(System.currentTimeMillis() + 30L * 60 * 1000);
|
||||||
updateGUI("suspendmenu");
|
updateGUI("suspendmenu");
|
||||||
ConfigBuilderPlugin.getCommandQueue().tempBasalAbsolute(0d, 30, true, new Callback() {
|
ConfigBuilderPlugin.getCommandQueue().tempBasalPercent(0, 30, true, new Callback() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
|
@ -493,7 +496,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
||||||
} else if (item.getTitle().equals(MainApp.sResources.getString(R.string.disconnectpumpfor1h))) {
|
} else if (item.getTitle().equals(MainApp.sResources.getString(R.string.disconnectpumpfor1h))) {
|
||||||
activeloop.disconnectTo(System.currentTimeMillis() + 1 * 60L * 60 * 1000);
|
activeloop.disconnectTo(System.currentTimeMillis() + 1 * 60L * 60 * 1000);
|
||||||
updateGUI("suspendmenu");
|
updateGUI("suspendmenu");
|
||||||
ConfigBuilderPlugin.getCommandQueue().tempBasalAbsolute(0d, 60, true, new Callback() {
|
ConfigBuilderPlugin.getCommandQueue().tempBasalPercent(0, 60, true, new Callback() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
|
@ -506,7 +509,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
||||||
} else if (item.getTitle().equals(MainApp.sResources.getString(R.string.disconnectpumpfor2h))) {
|
} else if (item.getTitle().equals(MainApp.sResources.getString(R.string.disconnectpumpfor2h))) {
|
||||||
activeloop.disconnectTo(System.currentTimeMillis() + 2 * 60L * 60 * 1000);
|
activeloop.disconnectTo(System.currentTimeMillis() + 2 * 60L * 60 * 1000);
|
||||||
updateGUI("suspendmenu");
|
updateGUI("suspendmenu");
|
||||||
ConfigBuilderPlugin.getCommandQueue().tempBasalAbsolute(0d, 2 * 60, true, new Callback() {
|
ConfigBuilderPlugin.getCommandQueue().tempBasalPercent(0, 2 * 60, true, new Callback() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
|
@ -519,7 +522,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
||||||
} else if (item.getTitle().equals(MainApp.sResources.getString(R.string.disconnectpumpfor3h))) {
|
} else if (item.getTitle().equals(MainApp.sResources.getString(R.string.disconnectpumpfor3h))) {
|
||||||
activeloop.disconnectTo(System.currentTimeMillis() + 3 * 60L * 60 * 1000);
|
activeloop.disconnectTo(System.currentTimeMillis() + 3 * 60L * 60 * 1000);
|
||||||
updateGUI("suspendmenu");
|
updateGUI("suspendmenu");
|
||||||
ConfigBuilderPlugin.getCommandQueue().tempBasalAbsolute(0d, 3 * 60, true, new Callback() {
|
ConfigBuilderPlugin.getCommandQueue().tempBasalPercent(0, 3 * 60, true, new Callback() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
|
|
|
@ -23,6 +23,7 @@ import java.text.DecimalFormat;
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.events.EventInitializationChanged;
|
import info.nightscout.androidaps.events.EventInitializationChanged;
|
||||||
|
import info.nightscout.androidaps.interfaces.PumpDescription;
|
||||||
import info.nightscout.androidaps.plugins.Careportal.CareportalFragment;
|
import info.nightscout.androidaps.plugins.Careportal.CareportalFragment;
|
||||||
import info.nightscout.androidaps.plugins.Careportal.Dialogs.NewNSTreatmentDialog;
|
import info.nightscout.androidaps.plugins.Careportal.Dialogs.NewNSTreatmentDialog;
|
||||||
import info.nightscout.androidaps.plugins.Careportal.OptionsToShow;
|
import info.nightscout.androidaps.plugins.Careportal.OptionsToShow;
|
||||||
|
@ -84,15 +85,17 @@ public class LocalProfileFragment extends SubscriberFragment {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
PumpDescription pumpDescription = ConfigBuilderPlugin.getActivePump().getPumpDescription();
|
||||||
|
|
||||||
View layout = inflater.inflate(R.layout.localprofile_fragment, container, false);
|
View layout = inflater.inflate(R.layout.localprofile_fragment, container, false);
|
||||||
diaView = (NumberPicker) layout.findViewById(R.id.localprofile_dia);
|
diaView = (NumberPicker) layout.findViewById(R.id.localprofile_dia);
|
||||||
diaView.setParams(localProfilePlugin.dia, 2d, 48d, 0.1d, new DecimalFormat("0.0"), false, textWatch);
|
diaView.setParams(localProfilePlugin.dia, 2d, 48d, 0.1d, new DecimalFormat("0.0"), false, textWatch);
|
||||||
mgdlView = (RadioButton) layout.findViewById(R.id.localprofile_mgdl);
|
mgdlView = (RadioButton) layout.findViewById(R.id.localprofile_mgdl);
|
||||||
mmolView = (RadioButton) layout.findViewById(R.id.localprofile_mmol);
|
mmolView = (RadioButton) layout.findViewById(R.id.localprofile_mmol);
|
||||||
icView = new TimeListEdit(getContext(), layout, R.id.localprofile_ic, MainApp.sResources.getString(R.string.nsprofileview_ic_label) + ":", getPlugin().ic, null, 0.1d, new DecimalFormat("0.0"), save);
|
icView = new TimeListEdit(getContext(), layout, R.id.localprofile_ic, MainApp.sResources.getString(R.string.nsprofileview_ic_label) + ":", getPlugin().ic, null, 0.5, 50d, 0.1d, new DecimalFormat("0.0"), save);
|
||||||
isfView = new TimeListEdit(getContext(), layout, R.id.localprofile_isf, MainApp.sResources.getString(R.string.nsprofileview_isf_label) + ":", getPlugin().isf, null, 0.1d, new DecimalFormat("0.0"), save);
|
isfView = new TimeListEdit(getContext(), layout, R.id.localprofile_isf, MainApp.sResources.getString(R.string.nsprofileview_isf_label) + ":", getPlugin().isf, null, 0.5, 500d, 0.1d, new DecimalFormat("0.0"), save);
|
||||||
basalView = new TimeListEdit(getContext(), layout, R.id.localprofile_basal, MainApp.sResources.getString(R.string.nsprofileview_basal_label) + ": " + getSumLabel(), getPlugin().basal, null, 0.01d, new DecimalFormat("0.00"), save);
|
basalView = new TimeListEdit(getContext(), layout, R.id.localprofile_basal, MainApp.sResources.getString(R.string.nsprofileview_basal_label) + ": " + getSumLabel(), getPlugin().basal, null, pumpDescription.basalMinimumRate, 10, 0.01d, new DecimalFormat("0.00"), save);
|
||||||
targetView = new TimeListEdit(getContext(), layout, R.id.localprofile_target, MainApp.sResources.getString(R.string.nsprofileview_target_label) + ":", getPlugin().targetLow, getPlugin().targetHigh, 0.1d, new DecimalFormat("0.0"), save);
|
targetView = new TimeListEdit(getContext(), layout, R.id.localprofile_target, MainApp.sResources.getString(R.string.nsprofileview_target_label) + ":", getPlugin().targetLow, getPlugin().targetHigh, 3d, 200, 0.1d, new DecimalFormat("0.0"), save);
|
||||||
profileswitchButton = (Button) layout.findViewById(R.id.localprofile_profileswitch);
|
profileswitchButton = (Button) layout.findViewById(R.id.localprofile_profileswitch);
|
||||||
|
|
||||||
if (!ConfigBuilderPlugin.getActivePump().getPumpDescription().isTempBasalCapable) {
|
if (!ConfigBuilderPlugin.getActivePump().getPumpDescription().isTempBasalCapable) {
|
||||||
|
|
|
@ -434,7 +434,7 @@ public class DanaRPlugin implements PluginBase, PumpInterface, DanaRInterface, C
|
||||||
// Convert duration from minutes to hours
|
// Convert duration from minutes to hours
|
||||||
if (Config.logPumpActions)
|
if (Config.logPumpActions)
|
||||||
log.debug("setTempBasalAbsolute: Setting temp basal " + percentRate + "% for " + durationInMinutes + " mins (doLowTemp || doHighTemp)");
|
log.debug("setTempBasalAbsolute: Setting temp basal " + percentRate + "% for " + durationInMinutes + " mins (doLowTemp || doHighTemp)");
|
||||||
return setTempBasalPercent(percentRate, durationInMinutes);
|
return setTempBasalPercent(percentRate, durationInMinutes, false);
|
||||||
}
|
}
|
||||||
if (doExtendedTemp) {
|
if (doExtendedTemp) {
|
||||||
// Check if some temp is already in progress
|
// Check if some temp is already in progress
|
||||||
|
@ -499,7 +499,7 @@ public class DanaRPlugin implements PluginBase, PumpInterface, DanaRInterface, C
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PumpEnactResult setTempBasalPercent(Integer percent, Integer durationInMinutes) {
|
public PumpEnactResult setTempBasalPercent(Integer percent, Integer durationInMinutes, boolean enforceNew) {
|
||||||
PumpEnactResult result = new PumpEnactResult();
|
PumpEnactResult result = new PumpEnactResult();
|
||||||
ConfigBuilderPlugin configBuilderPlugin = MainApp.getConfigBuilder();
|
ConfigBuilderPlugin configBuilderPlugin = MainApp.getConfigBuilder();
|
||||||
percent = configBuilderPlugin.applyBasalConstraints(percent);
|
percent = configBuilderPlugin.applyBasalConstraints(percent);
|
||||||
|
@ -514,7 +514,7 @@ public class DanaRPlugin implements PluginBase, PumpInterface, DanaRInterface, C
|
||||||
if (percent > getPumpDescription().maxTempPercent)
|
if (percent > getPumpDescription().maxTempPercent)
|
||||||
percent = getPumpDescription().maxTempPercent;
|
percent = getPumpDescription().maxTempPercent;
|
||||||
TemporaryBasal runningTB = MainApp.getConfigBuilder().getRealTempBasalFromHistory(System.currentTimeMillis());
|
TemporaryBasal runningTB = MainApp.getConfigBuilder().getRealTempBasalFromHistory(System.currentTimeMillis());
|
||||||
if (runningTB != null && runningTB.percentRate == percent) {
|
if (runningTB != null && runningTB.percentRate == percent && !enforceNew) {
|
||||||
result.enacted = false;
|
result.enacted = false;
|
||||||
result.success = true;
|
result.success = true;
|
||||||
result.isTempCancel = false;
|
result.isTempCancel = false;
|
||||||
|
|
|
@ -436,7 +436,7 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, DanaRInterf
|
||||||
// Convert duration from minutes to hours
|
// Convert duration from minutes to hours
|
||||||
if (Config.logPumpActions)
|
if (Config.logPumpActions)
|
||||||
log.debug("setTempBasalAbsolute: Setting temp basal " + percentRate + "% for " + durationInMinutes + " mins (doLowTemp || doHighTemp)");
|
log.debug("setTempBasalAbsolute: Setting temp basal " + percentRate + "% for " + durationInMinutes + " mins (doLowTemp || doHighTemp)");
|
||||||
return setTempBasalPercent(percentRate, durationInMinutes);
|
return setTempBasalPercent(percentRate, durationInMinutes, false);
|
||||||
}
|
}
|
||||||
if (doExtendedTemp) {
|
if (doExtendedTemp) {
|
||||||
// Check if some temp is already in progress
|
// Check if some temp is already in progress
|
||||||
|
@ -501,7 +501,7 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, DanaRInterf
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PumpEnactResult setTempBasalPercent(Integer percent, Integer durationInMinutes) {
|
public PumpEnactResult setTempBasalPercent(Integer percent, Integer durationInMinutes, boolean enforceNew) {
|
||||||
PumpEnactResult result = new PumpEnactResult();
|
PumpEnactResult result = new PumpEnactResult();
|
||||||
ConfigBuilderPlugin configBuilderPlugin = MainApp.getConfigBuilder();
|
ConfigBuilderPlugin configBuilderPlugin = MainApp.getConfigBuilder();
|
||||||
percent = configBuilderPlugin.applyBasalConstraints(percent);
|
percent = configBuilderPlugin.applyBasalConstraints(percent);
|
||||||
|
@ -516,7 +516,7 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, DanaRInterf
|
||||||
if (percent > getPumpDescription().maxTempPercent)
|
if (percent > getPumpDescription().maxTempPercent)
|
||||||
percent = getPumpDescription().maxTempPercent;
|
percent = getPumpDescription().maxTempPercent;
|
||||||
TemporaryBasal runningTB = MainApp.getConfigBuilder().getRealTempBasalFromHistory(System.currentTimeMillis());
|
TemporaryBasal runningTB = MainApp.getConfigBuilder().getRealTempBasalFromHistory(System.currentTimeMillis());
|
||||||
if (runningTB != null && runningTB.percentRate == percent) {
|
if (runningTB != null && runningTB.percentRate == percent && enforceNew) {
|
||||||
result.enacted = false;
|
result.enacted = false;
|
||||||
result.success = true;
|
result.success = true;
|
||||||
result.isTempCancel = false;
|
result.isTempCancel = false;
|
||||||
|
|
|
@ -580,7 +580,7 @@ public class DanaRSPlugin implements PluginBase, PumpInterface, DanaRInterface,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized PumpEnactResult setTempBasalPercent(Integer percent, Integer durationInMinutes) {
|
public synchronized PumpEnactResult setTempBasalPercent(Integer percent, Integer durationInMinutes, boolean enforceNew) {
|
||||||
PumpEnactResult result = new PumpEnactResult();
|
PumpEnactResult result = new PumpEnactResult();
|
||||||
ConfigBuilderPlugin configBuilderPlugin = MainApp.getConfigBuilder();
|
ConfigBuilderPlugin configBuilderPlugin = MainApp.getConfigBuilder();
|
||||||
percent = configBuilderPlugin.applyBasalConstraints(percent);
|
percent = configBuilderPlugin.applyBasalConstraints(percent);
|
||||||
|
@ -595,7 +595,7 @@ public class DanaRSPlugin implements PluginBase, PumpInterface, DanaRInterface,
|
||||||
if (percent > getPumpDescription().maxTempPercent)
|
if (percent > getPumpDescription().maxTempPercent)
|
||||||
percent = getPumpDescription().maxTempPercent;
|
percent = getPumpDescription().maxTempPercent;
|
||||||
TemporaryBasal runningTB = MainApp.getConfigBuilder().getTempBasalFromHistory(System.currentTimeMillis());
|
TemporaryBasal runningTB = MainApp.getConfigBuilder().getTempBasalFromHistory(System.currentTimeMillis());
|
||||||
if (runningTB != null && runningTB.percentRate == percent) {
|
if (runningTB != null && runningTB.percentRate == percent && !enforceNew) {
|
||||||
result.enacted = false;
|
result.enacted = false;
|
||||||
result.success = true;
|
result.success = true;
|
||||||
result.isTempCancel = false;
|
result.isTempCancel = false;
|
||||||
|
|
|
@ -185,7 +185,10 @@ public class DanaRSService extends Service {
|
||||||
while (!msg.done && bleComm.isConnected()) {
|
while (!msg.done && bleComm.isConnected()) {
|
||||||
SystemClock.sleep(100);
|
SystemClock.sleep(100);
|
||||||
}
|
}
|
||||||
lastHistoryFetched = DanaRS_Packet_APS_History_Events.lastEventTimeLoaded - 45 * 60 * 1000L; // always load last 45 min
|
if (DanaRS_Packet_APS_History_Events.lastEventTimeLoaded != 0)
|
||||||
|
lastHistoryFetched = DanaRS_Packet_APS_History_Events.lastEventTimeLoaded - 45 * 60 * 1000L; // always load last 45 min
|
||||||
|
else
|
||||||
|
lastHistoryFetched = 0;
|
||||||
log.debug("Events loaded");
|
log.debug("Events loaded");
|
||||||
return new PumpEnactResult().success(true);
|
return new PumpEnactResult().success(true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -437,7 +437,7 @@ public class DanaRv2Plugin implements PluginBase, PumpInterface, DanaRInterface,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PumpEnactResult setTempBasalPercent(Integer percent, Integer durationInMinutes) {
|
public PumpEnactResult setTempBasalPercent(Integer percent, Integer durationInMinutes, boolean enforceNew) {
|
||||||
PumpEnactResult result = new PumpEnactResult();
|
PumpEnactResult result = new PumpEnactResult();
|
||||||
ConfigBuilderPlugin configBuilderPlugin = MainApp.getConfigBuilder();
|
ConfigBuilderPlugin configBuilderPlugin = MainApp.getConfigBuilder();
|
||||||
percent = configBuilderPlugin.applyBasalConstraints(percent);
|
percent = configBuilderPlugin.applyBasalConstraints(percent);
|
||||||
|
@ -452,7 +452,7 @@ public class DanaRv2Plugin implements PluginBase, PumpInterface, DanaRInterface,
|
||||||
if (percent > getPumpDescription().maxTempPercent)
|
if (percent > getPumpDescription().maxTempPercent)
|
||||||
percent = getPumpDescription().maxTempPercent;
|
percent = getPumpDescription().maxTempPercent;
|
||||||
TemporaryBasal runningTB = MainApp.getConfigBuilder().getRealTempBasalFromHistory(System.currentTimeMillis());
|
TemporaryBasal runningTB = MainApp.getConfigBuilder().getRealTempBasalFromHistory(System.currentTimeMillis());
|
||||||
if (runningTB != null && runningTB.percentRate == percent) {
|
if (runningTB != null && runningTB.percentRate == percent && !enforceNew) {
|
||||||
result.enacted = false;
|
result.enacted = false;
|
||||||
result.success = true;
|
result.success = true;
|
||||||
result.isTempCancel = false;
|
result.isTempCancel = false;
|
||||||
|
|
|
@ -527,7 +527,10 @@ public class DanaRv2ExecutionService extends Service {
|
||||||
waitMsec(100);
|
waitMsec(100);
|
||||||
}
|
}
|
||||||
waitMsec(200);
|
waitMsec(200);
|
||||||
lastHistoryFetched = MsgHistoryEvents_v2.lastEventTimeLoaded - 45 * 60 * 1000L; //always load last 45 min;
|
if (MsgHistoryEvents_v2.lastEventTimeLoaded != 0)
|
||||||
|
lastHistoryFetched = MsgHistoryEvents_v2.lastEventTimeLoaded - 45 * 60 * 1000L; //always load last 45 min;
|
||||||
|
else
|
||||||
|
lastHistoryFetched = 0;
|
||||||
return new PumpEnactResult().success(true);
|
return new PumpEnactResult().success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -204,7 +204,7 @@ public class MDIPlugin implements PluginBase, PumpInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PumpEnactResult setTempBasalPercent(Integer percent, Integer durationInMinutes) {
|
public PumpEnactResult setTempBasalPercent(Integer percent, Integer durationInMinutes, boolean enforceNew) {
|
||||||
PumpEnactResult result = new PumpEnactResult();
|
PumpEnactResult result = new PumpEnactResult();
|
||||||
result.success = false;
|
result.success = false;
|
||||||
result.comment = MainApp.instance().getString(R.string.pumperror);
|
result.comment = MainApp.instance().getString(R.string.pumperror);
|
||||||
|
|
|
@ -304,7 +304,7 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PumpEnactResult setTempBasalPercent(Integer percent, Integer durationInMinutes) {
|
public PumpEnactResult setTempBasalPercent(Integer percent, Integer durationInMinutes, boolean enforceNew) {
|
||||||
TreatmentsInterface treatmentsInterface = MainApp.getConfigBuilder();
|
TreatmentsInterface treatmentsInterface = MainApp.getConfigBuilder();
|
||||||
PumpEnactResult result = new PumpEnactResult();
|
PumpEnactResult result = new PumpEnactResult();
|
||||||
if (MainApp.getConfigBuilder().isTempBasalInProgress()) {
|
if (MainApp.getConfigBuilder().isTempBasalInProgress()) {
|
||||||
|
|
|
@ -203,7 +203,7 @@ public class CommandQueue {
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns true if command is queued
|
// returns true if command is queued
|
||||||
public boolean tempBasalPercent(int percent, int durationInMinutes, Callback callback) {
|
public boolean tempBasalPercent(int percent, int durationInMinutes, boolean enforceNew, Callback callback) {
|
||||||
if (isRunning(Command.CommandType.TEMPBASAL)) {
|
if (isRunning(Command.CommandType.TEMPBASAL)) {
|
||||||
if (callback != null)
|
if (callback != null)
|
||||||
callback.result(executingNowError()).run();
|
callback.result(executingNowError()).run();
|
||||||
|
@ -216,7 +216,7 @@ public class CommandQueue {
|
||||||
Integer percentAfterConstraints = MainApp.getConfigBuilder().applyBasalConstraints(percent);
|
Integer percentAfterConstraints = MainApp.getConfigBuilder().applyBasalConstraints(percent);
|
||||||
|
|
||||||
// add new command to queue
|
// add new command to queue
|
||||||
add(new CommandTempBasalPercent(percentAfterConstraints, durationInMinutes, callback));
|
add(new CommandTempBasalPercent(percentAfterConstraints, durationInMinutes, enforceNew, callback));
|
||||||
|
|
||||||
notifyAboutNewCommand();
|
notifyAboutNewCommand();
|
||||||
|
|
||||||
|
@ -326,14 +326,14 @@ public class CommandQueue {
|
||||||
|
|
||||||
// returns true if command is queued
|
// returns true if command is queued
|
||||||
public boolean readStatus(String reason, Callback callback) {
|
public boolean readStatus(String reason, Callback callback) {
|
||||||
if (isRunning(Command.CommandType.READSTATUS)) {
|
//if (isRunning(Command.CommandType.READSTATUS)) {
|
||||||
if (callback != null)
|
// if (callback != null)
|
||||||
callback.result(executingNowError()).run();
|
// callback.result(executingNowError()).run();
|
||||||
return false;
|
// return false;
|
||||||
}
|
//}
|
||||||
|
|
||||||
// remove all unfinished
|
// remove all unfinished
|
||||||
removeAll(Command.CommandType.READSTATUS);
|
//removeAll(Command.CommandType.READSTATUS);
|
||||||
|
|
||||||
// add new command to queue
|
// add new command to queue
|
||||||
add(new CommandReadStatus(reason, callback));
|
add(new CommandReadStatus(reason, callback));
|
||||||
|
|
|
@ -79,7 +79,7 @@ public class QueueThread extends Thread {
|
||||||
mBluetoothAdapter.enable();
|
mBluetoothAdapter.enable();
|
||||||
SystemClock.sleep(1000);
|
SystemClock.sleep(1000);
|
||||||
//start over again once after watchdog barked
|
//start over again once after watchdog barked
|
||||||
connectionStartTime = System.currentTimeMillis();
|
connectionStartTime = lastCommandTime = System.currentTimeMillis();
|
||||||
} else {
|
} else {
|
||||||
queue.clear();
|
queue.clear();
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -18,17 +18,19 @@ public class CommandTempBasalPercent extends Command {
|
||||||
|
|
||||||
int durationInMinutes;
|
int durationInMinutes;
|
||||||
int percent;
|
int percent;
|
||||||
|
boolean enforceNew;
|
||||||
|
|
||||||
public CommandTempBasalPercent(int percent, int durationInMinutes, Callback callback) {
|
public CommandTempBasalPercent(int percent, int durationInMinutes, boolean enforceNew, Callback callback) {
|
||||||
commandType = CommandType.TEMPBASAL;
|
commandType = CommandType.TEMPBASAL;
|
||||||
this.percent = percent;
|
this.percent = percent;
|
||||||
this.durationInMinutes = durationInMinutes;
|
this.durationInMinutes = durationInMinutes;
|
||||||
|
this.enforceNew = enforceNew;
|
||||||
this.callback = callback;
|
this.callback = callback;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
PumpEnactResult r = ConfigBuilderPlugin.getActivePump().setTempBasalPercent(percent, durationInMinutes);
|
PumpEnactResult r = ConfigBuilderPlugin.getActivePump().setTempBasalPercent(percent, durationInMinutes, enforceNew);
|
||||||
if (Config.logCongigBuilderActions)
|
if (Config.logCongigBuilderActions)
|
||||||
log.debug("setTempBasalPercent percent: " + percent + " durationInMinutes: " + durationInMinutes + " success: " + r.success + " enacted: " + r.enacted);
|
log.debug("setTempBasalPercent percent: " + percent + " durationInMinutes: " + durationInMinutes + " success: " + r.success + " enacted: " + r.enacted);
|
||||||
if (callback != null)
|
if (callback != null)
|
||||||
|
|
|
@ -71,7 +71,9 @@ public class BolusWizard {
|
||||||
targetBGLow = Profile.fromMgdlToUnits(tempTarget.low, specificProfile.getUnits());
|
targetBGLow = Profile.fromMgdlToUnits(tempTarget.low, specificProfile.getUnits());
|
||||||
targetBGHigh = Profile.fromMgdlToUnits(tempTarget.high, specificProfile.getUnits());
|
targetBGHigh = Profile.fromMgdlToUnits(tempTarget.high, specificProfile.getUnits());
|
||||||
}
|
}
|
||||||
if (bg <= targetBGLow) {
|
if (bg >= targetBGLow && bg <= targetBGHigh) {
|
||||||
|
bgDiff = 0d;
|
||||||
|
} else if (bg <= targetBGLow) {
|
||||||
bgDiff = bg - targetBGLow;
|
bgDiff = bg - targetBGLow;
|
||||||
} else {
|
} else {
|
||||||
bgDiff = bg - targetBGHigh;
|
bgDiff = bg - targetBGHigh;
|
||||||
|
|
|
@ -27,6 +27,8 @@ public class DateUtil {
|
||||||
/**
|
/**
|
||||||
* The date format in iso.
|
* The date format in iso.
|
||||||
*/
|
*/
|
||||||
|
private static String FORMAT_DATE_ISO_OUT = "yyyy-MM-dd'T'HH:mm:ss'Z'";
|
||||||
|
|
||||||
private static String FORMAT_DATE_ISO = "yyyy-MM-dd'T'HH:mm:ssZ";
|
private static String FORMAT_DATE_ISO = "yyyy-MM-dd'T'HH:mm:ssZ";
|
||||||
private static String FORMAT_DATE_ISO_MSEC = "yyyy-MM-dd'T'HH:mm:ss.SSSZ";
|
private static String FORMAT_DATE_ISO_MSEC = "yyyy-MM-dd'T'HH:mm:ss.SSSZ";
|
||||||
private static String FORMAT_DATE_ISO_MSEC_UTC = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'";
|
private static String FORMAT_DATE_ISO_MSEC_UTC = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'";
|
||||||
|
@ -79,7 +81,7 @@ public class DateUtil {
|
||||||
* @return the iso-formatted date string
|
* @return the iso-formatted date string
|
||||||
*/
|
*/
|
||||||
public static String toISOString(Date date, String format, TimeZone tz) {
|
public static String toISOString(Date date, String format, TimeZone tz) {
|
||||||
if (format == null) format = FORMAT_DATE_ISO;
|
if (format == null) format = FORMAT_DATE_ISO_OUT;
|
||||||
if (tz == null) tz = TimeZone.getDefault();
|
if (tz == null) tz = TimeZone.getDefault();
|
||||||
DateFormat f = new SimpleDateFormat(format, Locale.getDefault());
|
DateFormat f = new SimpleDateFormat(format, Locale.getDefault());
|
||||||
f.setTimeZone(tz);
|
f.setTimeZone(tz);
|
||||||
|
@ -87,11 +89,11 @@ public class DateUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String toISOString(Date date) {
|
public static String toISOString(Date date) {
|
||||||
return toISOString(date, FORMAT_DATE_ISO, TimeZone.getTimeZone("UTC"));
|
return toISOString(date, FORMAT_DATE_ISO_OUT, TimeZone.getTimeZone("UTC"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String toISOString(long date) {
|
public static String toISOString(long date) {
|
||||||
return toISOString(new Date(date), FORMAT_DATE_ISO, TimeZone.getTimeZone("UTC"));
|
return toISOString(new Date(date), FORMAT_DATE_ISO_OUT, TimeZone.getTimeZone("UTC"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Date toDate(Integer seconds) {
|
public static Date toDate(Integer seconds) {
|
||||||
|
|
|
@ -52,6 +52,8 @@ public class TimeListEdit {
|
||||||
private JSONArray data1;
|
private JSONArray data1;
|
||||||
private JSONArray data2;
|
private JSONArray data2;
|
||||||
private double step;
|
private double step;
|
||||||
|
private double min;
|
||||||
|
private double max;
|
||||||
private NumberFormat formatter;
|
private NumberFormat formatter;
|
||||||
private Runnable save;
|
private Runnable save;
|
||||||
private LinearLayout layout;
|
private LinearLayout layout;
|
||||||
|
@ -59,7 +61,7 @@ public class TimeListEdit {
|
||||||
private int inflatedUntil = -1;
|
private int inflatedUntil = -1;
|
||||||
|
|
||||||
|
|
||||||
public TimeListEdit(Context context, View view, int resLayoutId, String label, JSONArray data1, JSONArray data2, double step, NumberFormat formatter, Runnable save) {
|
public TimeListEdit(Context context, View view, int resLayoutId, String label, JSONArray data1, JSONArray data2, double min, double max, double step, NumberFormat formatter, Runnable save) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.view = view;
|
this.view = view;
|
||||||
this.resLayoutId = resLayoutId;
|
this.resLayoutId = resLayoutId;
|
||||||
|
@ -67,6 +69,8 @@ public class TimeListEdit {
|
||||||
this.data1 = data1;
|
this.data1 = data1;
|
||||||
this.data2 = data2;
|
this.data2 = data2;
|
||||||
this.step = step;
|
this.step = step;
|
||||||
|
this.min = min;
|
||||||
|
this.max = max;
|
||||||
this.formatter = formatter;
|
this.formatter = formatter;
|
||||||
this.save = save;
|
this.save = save;
|
||||||
buildView();
|
buildView();
|
||||||
|
@ -239,8 +243,8 @@ public class TimeListEdit {
|
||||||
if (i == 0) next = ONEHOURINSECONDS;
|
if (i == 0) next = ONEHOURINSECONDS;
|
||||||
fillSpinner(timeSpinner, secondFromMidnight(i), previous, next);
|
fillSpinner(timeSpinner, secondFromMidnight(i), previous, next);
|
||||||
|
|
||||||
editText1.setParams(value1(i), 0.1d, 100d, step, formatter, false);
|
editText1.setParams(value1(i), min, max, step, formatter, false);
|
||||||
editText2.setParams(value2(i), 0.1d, 100d, step, formatter, false);
|
editText2.setParams(value2(i), min, max, step, formatter, false);
|
||||||
|
|
||||||
if (data2 == null) {
|
if (data2 == null) {
|
||||||
editText2.setVisibility(View.GONE);
|
editText2.setVisibility(View.GONE);
|
||||||
|
|
|
@ -674,4 +674,4 @@
|
||||||
<string name="localalertsettings_title">Τοπικές Ειδοποιήσεις</string>
|
<string name="localalertsettings_title">Τοπικές Ειδοποιήσεις</string>
|
||||||
<string name="enable_missed_bg_readings_alert">Ειδοποίησε αν δεν ληφθούν δεδομένα μετρήσεων BG</string>
|
<string name="enable_missed_bg_readings_alert">Ειδοποίησε αν δεν ληφθούν δεδομένα μετρήσεων BG</string>
|
||||||
<string name="btwatchdog_summary">Απενεργοποιεί το bluetooth του τηλεφώνου για ένα δευτερόλεπτο αν δεν είναι δυνατή η σύνδεση με την αντλία.Αυτό μπορεί να βοηθήσει σε ορισμένα τηλέφωνα όπου το bluetooth παγώνει</string>
|
<string name="btwatchdog_summary">Απενεργοποιεί το bluetooth του τηλεφώνου για ένα δευτερόλεπτο αν δεν είναι δυνατή η σύνδεση με την αντλία.Αυτό μπορεί να βοηθήσει σε ορισμένα τηλέφωνα όπου το bluetooth παγώνει</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Reference in a new issue