fix requesting cancel temp
This commit is contained in:
parent
4c312366c2
commit
3bceeb368a
2 changed files with 7 additions and 6 deletions
|
@ -374,7 +374,7 @@ public class ConfigBuilderFragment extends Fragment implements PluginBase, PumpI
|
||||||
request.rate = applyBasalConstraints(request.rate);
|
request.rate = applyBasalConstraints(request.rate);
|
||||||
PumpEnactResult result;
|
PumpEnactResult result;
|
||||||
|
|
||||||
if (Math.abs(request.rate - getBaseBasalRate()) < 0.1) {
|
if ((request.rate == 0 && request.duration == 0) || Math.abs(request.rate - getBaseBasalRate()) < 0.1) {
|
||||||
if (isTempBasalInProgress()) {
|
if (isTempBasalInProgress()) {
|
||||||
result = cancelTempBasal();
|
result = cancelTempBasal();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -17,17 +17,18 @@ import android.widget.TextView;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.text.DecimalFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import info.nightscout.androidaps.Config;
|
import info.nightscout.androidaps.Config;
|
||||||
import info.nightscout.androidaps.Constants;
|
import info.nightscout.androidaps.Constants;
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
|
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||||
import info.nightscout.androidaps.db.DatabaseHelper;
|
import info.nightscout.androidaps.db.DatabaseHelper;
|
||||||
import info.nightscout.androidaps.interfaces.APSInterface;
|
import info.nightscout.androidaps.interfaces.APSInterface;
|
||||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
|
||||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
|
||||||
import info.nightscout.androidaps.plugins.Loop.APSResult;
|
import info.nightscout.androidaps.plugins.Loop.APSResult;
|
||||||
|
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||||
import info.nightscout.client.data.NSProfile;
|
import info.nightscout.client.data.NSProfile;
|
||||||
import info.nightscout.utils.DecimalFormatter;
|
import info.nightscout.utils.DecimalFormatter;
|
||||||
import info.nightscout.utils.SafeParse;
|
import info.nightscout.utils.SafeParse;
|
||||||
|
@ -282,8 +283,8 @@ public class LowSuspendFragment extends Fragment implements View.OnClickListener
|
||||||
}
|
}
|
||||||
} else if (isTempBasalInProgress && tempBasalRate == 0d) {
|
} else if (isTempBasalInProgress && tempBasalRate == 0d) {
|
||||||
request.changeRequested = true;
|
request.changeRequested = true;
|
||||||
request.rate = baseBasalRate;
|
request.rate = 0;
|
||||||
request.duration = 30;
|
request.duration = 0;
|
||||||
request.reason = MainApp.instance().getString(R.string.lowsuspend_cancelmessage);
|
request.reason = MainApp.instance().getString(R.string.lowsuspend_cancelmessage);
|
||||||
} else {
|
} else {
|
||||||
request.changeRequested = false;
|
request.changeRequested = false;
|
||||||
|
@ -309,7 +310,7 @@ public class LowSuspendFragment extends Fragment implements View.OnClickListener
|
||||||
if (lastRun != null) {
|
if (lastRun != null) {
|
||||||
glucoseStatusView.setText(lastRun.lastGlucoseStatus.toSpanned());
|
glucoseStatusView.setText(lastRun.lastGlucoseStatus.toSpanned());
|
||||||
minBgView.setText(DecimalFormatter.to1Decimal(lastRun.lastMinBg) + " mgdl");
|
minBgView.setText(DecimalFormatter.to1Decimal(lastRun.lastMinBg) + " mgdl");
|
||||||
resultView.setText(Html.fromHtml("<b>" + getString(R.string.lowsuspend_low) + "</b>: " + lastRun.lastLow + "<br><b>" + getString(R.string.lowsuspend_lowprojected) + "</b>: " + lastRun.lastLowProjected));
|
resultView.setText(Html.fromHtml("<b>" + getString(R.string.lowsuspend_low) + "</b>: " + lastRun.lastLow + "<br></b>" + getString(R.string.lowsuspend_lowprojected) + "</b>: " + lastRun.lastLowProjected));
|
||||||
requestView.setText(lastRun.lastAPSResult.toSpanned());
|
requestView.setText(lastRun.lastAPSResult.toSpanned());
|
||||||
lastRunView.setText(lastRun.lastAPSRun.toLocaleString());
|
lastRunView.setText(lastRun.lastAPSRun.toLocaleString());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue