Remove combo hacks outside of combo plugin.

This commit is contained in:
Johannes Mockenhaupt 2017-10-17 12:20:48 +02:00
parent 357c84e2e2
commit 5131b8b62f
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1
8 changed files with 24 additions and 36 deletions

View file

@ -152,7 +152,7 @@ public class PreferencesActivity extends PreferenceActivity implements SharedPre
}
}
if (Config.COMBO) {
ComboPlugin comboPlugin = (ComboPlugin) MainApp.getSpecificPlugin(ComboPlugin.class);
ComboPlugin comboPlugin = MainApp.getSpecificPlugin(ComboPlugin.class);
if (comboPlugin.isEnabled(PluginBase.PUMP)) {
addPreferencesFromResource(R.xml.pref_combo);
}

View file

@ -252,11 +252,6 @@ public class TemporaryBasal implements Interval {
return Math.round(msecs / 60f / 1000);
}
public int getPlannedRemainingSeconds() {
Float remainingMin = (end() - System.currentTimeMillis()) / 1000f;
return remainingMin.intValue();
}
public int getPlannedRemainingMinutes() {
float remainingMin = (end() - System.currentTimeMillis()) / 1000f / 60;
return (remainingMin < 0) ? 0 : Math.round(remainingMin);
@ -285,8 +280,6 @@ public class TemporaryBasal implements Interval {
", isAbsolute=" + isAbsolute +
", isFakeExtended=" + isFakeExtended +
", netExtendedRate=" + netExtendedRate +
", minutesRemaining=" + getPlannedRemainingMinutes() +
", secondsRemaining=" + getPlannedRemainingSeconds() +
'}';
}

View file

@ -582,10 +582,7 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
result.comment = "Temp basal set correctly";
result.success = true;
if (Config.logCongigBuilderActions)
log.debug("applyAPSRequest: Temp basal set correctly "
+ "(no pump request needed, pump is still running requested rate of "
+ request.rate + " for "
+ (int) getTempBasalRemainingMinutesFromHistory() + " more minutes)");
log.debug("applyAPSRequest: Temp basal set correctly");
} else {
if (Config.logCongigBuilderActions)
log.debug("applyAPSRequest: setTempBasalAbsolute()");

View file

@ -266,7 +266,7 @@ public class LoopPlugin implements PluginBase {
return;
}
// check rate for constraints
// check rate for constrais
final APSResult resultAfterConstraints = result.clone();
resultAfterConstraints.rate = constraintsInterface.applyBasalConstraints(resultAfterConstraints.rate);

View file

@ -5,7 +5,6 @@ import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.IBinder;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import com.squareup.otto.Subscribe;
@ -67,7 +66,6 @@ public class DanaRPlugin implements PluginBase, PumpInterface, DanaRInterface, C
private static DanaRExecutionService sExecutionService;
@NonNull
private static DanaRPump pump = DanaRPump.getInstance();
private static boolean useExtendedBoluses = false;
@ -761,17 +759,21 @@ public class DanaRPlugin implements PluginBase, PumpInterface, DanaRInterface, C
return true;
}
@SuppressWarnings("PointlessBooleanExpression")
@Override
public Double applyBasalConstraints(Double absoluteRate) {
double origAbsoluteRate = absoluteRate;
if (pump != null) {
if (absoluteRate > pump.maxBasal) {
absoluteRate = pump.maxBasal;
if (Config.logConstraintsChanges && origAbsoluteRate != Constants.basalAbsoluteOnlyForCheckLimit)
log.debug("Limiting rate " + origAbsoluteRate + "U/h by pump constraint to " + absoluteRate + "U/h");
}
}
return absoluteRate;
}
@SuppressWarnings("PointlessBooleanExpression")
@Override
public Integer applyBasalConstraints(Integer percentRate) {
Integer origPercentRate = percentRate;
@ -783,14 +785,17 @@ public class DanaRPlugin implements PluginBase, PumpInterface, DanaRInterface, C
return percentRate;
}
@SuppressWarnings("PointlessBooleanExpression")
@Override
public Double applyBolusConstraints(Double insulin) {
double origInsulin = insulin;
if (pump != null) {
if (insulin > pump.maxBolus) {
insulin = pump.maxBolus;
if (Config.logConstraintsChanges && origInsulin != Constants.bolusOnlyForCheckLimit)
log.debug("Limiting bolus " + origInsulin + "U by pump constraint to " + insulin + "U");
}
}
return insulin;
}

View file

@ -283,9 +283,7 @@ public class TreatmentsPlugin implements PluginBase, TreatmentsInterface {
@Override
public boolean isTempBasalInProgress() {
TemporaryBasal tempBasalFromHistory = getTempBasalFromHistory(System.currentTimeMillis());
log.debug("activeTempbasal: " + tempBasalFromHistory);
return tempBasalFromHistory != null && tempBasalFromHistory.getPlannedRemainingSeconds() > 60;
return getTempBasalFromHistory(System.currentTimeMillis()) != null;
}
@Override

View file

@ -441,7 +441,7 @@ public class ActionStringHandler {
ret += "OPEN LOOP\n";
}
final APSInterface aps = MainApp.getConfigBuilder().getActiveAPS();
ret += "APS: " + ((aps == null) ? R.string.noapsselected : ((PluginBase) aps).getName());
ret += "APS: " + ((aps == null) ? "NO APS SELECTED!" : ((PluginBase) aps).getName());
if (activeloop.lastRun != null) {
if (activeloop.lastRun.lastAPSRun != null)
ret += "\nLast Run: " + DateUtil.timeString(activeloop.lastRun.lastAPSRun);

View file

@ -751,23 +751,18 @@
<string name="connectiontimedout">Connection timed out</string>
<string name="bolusstopping">Stopping bolus delivery</string>
<string name="bolusstopped">Bolus delivery stopped</string>
<string name="key_combo_enable_experimental_features">combo_enable_experimental_features</string>
<string name="key_combo_enable_experimental_features" translatable="false">combo_enable_experimental_features</string>
<string name="combo_enable_experimental_features">Enable experimental features</string>
<string name="combo_enable_experimental_features_summary">Unlocks experimental features which are in development and might be broken entirely.</string>
<string name="key_combo_enable_experimental_split_bolus">combo_experimental_split_bolus</string>
<string name="key_combo_enable_experimental_split_bolus" translatable="false">combo_experimental_split_bolus</string>
<string name="combo_enable_experimental_split_bolus">Experimental split bolus feature</string>
<string name="combo_enable_experimental_split_bolus_summary">Splits boluses into 2 U parts and waits around 45s after each to slow down bolus delivery (only active with non-experimental bolus).</string>
<string name="key_combo_experimental_skip_tbr_changes_below_delta">combo_experimental_reject_tbr_changes_below_delta</string>
<string name="key_combo_experimental_skip_tbr_changes_below_delta" translatable="false">combo_experimental_reject_tbr_changes_below_delta</string>
<string name="combo_experimental_skip_tbr_changes_below_delta">Skip TBR changes below threshold (%).</string>
<string name="combo_experimental_skip_tbr_changes_below_delta_summary">Don\'t set a TBR if the difference between the new and a running TBR is below this threshold in percent. Specifying 0 disables this option.</string>
<string name="key_combo_disable_alerts">combo_disable_alerts</string>
<string name="key_combo_disable_alerts" translatable="false">combo_disable_alerts</string>
<string name="combo_disable_alerts">Disable alerts</string>
<string name="combo_disable_alerts_summary">Ignore all errors encountered while communicating with the pump. Alerts raised by the pump (including those caused by AAPS) will still be raised.</string>
<string name="bolusprogramming">Programming pump for bolusing</string>
<string name="key_wizard_include_bg">wizard_include_bg</string>
<string name="key_wizard_include_cob">wizard_include_cob</string>
<string name="key_wizard_include_trend_bg">wizard_include_trend_bg</string>
<string name="key_wizard_include_bolus_iob">wizard_include_bolus_iob</string>
<string name="key_wizard_include_basal_iob">wizard_include_basal_iob</string>
</resources>