Move config options to preferences.
(cherry picked from commit 24657ed)
This commit is contained in:
parent
21a37c9247
commit
17dd6df527
|
@ -11,7 +11,8 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
import info.nightscout.androidaps.Config;
|
import info.nightscout.androidaps.R;
|
||||||
|
import info.nightscout.utils.SP;
|
||||||
|
|
||||||
public class BolusCommand extends BaseCommand {
|
public class BolusCommand extends BaseCommand {
|
||||||
private static final Logger log = LoggerFactory.getLogger(BolusCommand.class);
|
private static final Logger log = LoggerFactory.getLogger(BolusCommand.class);
|
||||||
|
@ -98,7 +99,7 @@ public class BolusCommand extends BaseCommand {
|
||||||
}
|
}
|
||||||
log.debug("Bolus record in history confirms delivered bolus");
|
log.debug("Bolus record in history confirms delivered bolus");
|
||||||
|
|
||||||
if (Config.comboExperimentalFeatures) {
|
if(SP.getBoolean(R.string.key_combo_enable_experimental_features, false)) {
|
||||||
// returning to main menu using the 'back' key should not cause a vibration
|
// returning to main menu using the 'back' key should not cause a vibration
|
||||||
// TODO this is too brute-force; at least check for WARNING_OR_ERROR menu type
|
// TODO this is too brute-force; at least check for WARNING_OR_ERROR menu type
|
||||||
do {
|
do {
|
||||||
|
|
|
@ -47,16 +47,4 @@ public class Config {
|
||||||
public static final boolean logDanaBTComm = true;
|
public static final boolean logDanaBTComm = true;
|
||||||
public static final boolean logDanaMessageDetail = true;
|
public static final boolean logDanaMessageDetail = true;
|
||||||
public static final boolean logDanaSerialEngine = true;
|
public static final boolean logDanaSerialEngine = true;
|
||||||
|
|
||||||
// Combo specific
|
|
||||||
// TODO try turning this into preferences
|
|
||||||
public static final boolean comboExperimentalFeatures = true;
|
|
||||||
|
|
||||||
/** enable the UNFINISHED and currently BROKEN bolus cammand that reports progress and can be cancelled */
|
|
||||||
public static final boolean comboExperimentalBolus = false && comboExperimentalFeatures;
|
|
||||||
|
|
||||||
/** Very quick hack to split up bolus into 2 U parts, spaced roughly 45s apart.
|
|
||||||
* If there's an error during bolusing, no record is created in AAPS.
|
|
||||||
* Don't combine with experimental bolus! */
|
|
||||||
public static final boolean comboExperimentalSplitBoluses = false && comboExperimentalFeatures && !comboExperimentalBolus;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,6 @@ import de.jotomo.ruffyscripter.commands.CommandResult;
|
||||||
import de.jotomo.ruffyscripter.commands.GetPumpStateCommand;
|
import de.jotomo.ruffyscripter.commands.GetPumpStateCommand;
|
||||||
import de.jotomo.ruffyscripter.commands.SetTbrCommand;
|
import de.jotomo.ruffyscripter.commands.SetTbrCommand;
|
||||||
import info.nightscout.androidaps.BuildConfig;
|
import info.nightscout.androidaps.BuildConfig;
|
||||||
import info.nightscout.androidaps.Config;
|
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.data.DetailedBolusInfo;
|
import info.nightscout.androidaps.data.DetailedBolusInfo;
|
||||||
|
@ -390,7 +389,7 @@ public class ComboPlugin implements PluginBase, PumpInterface {
|
||||||
if (detailedBolusInfo.insulin > 0 || detailedBolusInfo.carbs > 0) {
|
if (detailedBolusInfo.insulin > 0 || detailedBolusInfo.carbs > 0) {
|
||||||
if (detailedBolusInfo.insulin > 0) {
|
if (detailedBolusInfo.insulin > 0) {
|
||||||
// bolus needed, ask pump to deliver it
|
// bolus needed, ask pump to deliver it
|
||||||
if (!Config.comboExperimentalSplitBoluses) {
|
if (!SP.getBoolean(R.string.key_combo_enable_experimental_split_bolus, false)) {
|
||||||
return deliverBolus(detailedBolusInfo);
|
return deliverBolus(detailedBolusInfo);
|
||||||
} else {
|
} else {
|
||||||
// split up bolus into 2 U parts
|
// split up bolus into 2 U parts
|
||||||
|
@ -457,7 +456,7 @@ public class ComboPlugin implements PluginBase, PumpInterface {
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
private PumpEnactResult deliverBolus(DetailedBolusInfo detailedBolusInfo) {
|
private PumpEnactResult deliverBolus(DetailedBolusInfo detailedBolusInfo) {
|
||||||
runningBolusCommand = Config.comboExperimentalBolus
|
runningBolusCommand = SP.getBoolean(R.string.key_combo_enable_experimental_bolus, false)
|
||||||
? new CancellableBolusCommand(detailedBolusInfo.insulin, bolusProgressReportCallback)
|
? new CancellableBolusCommand(detailedBolusInfo.insulin, bolusProgressReportCallback)
|
||||||
: new BolusCommand(detailedBolusInfo.insulin);
|
: new BolusCommand(detailedBolusInfo.insulin);
|
||||||
CommandResult bolusCmdResult = runCommand(runningBolusCommand);
|
CommandResult bolusCmdResult = runCommand(runningBolusCommand);
|
||||||
|
|
|
@ -712,5 +712,11 @@
|
||||||
<string name="key_wizard_include_basal_iob">wizard_include_basal_iob</string>
|
<string name="key_wizard_include_basal_iob">wizard_include_basal_iob</string>
|
||||||
<string name="bolusstopping">Stopping bolus delivery</string>
|
<string name="bolusstopping">Stopping bolus delivery</string>
|
||||||
<string name="bolusstopped">Bolus delivery stopped</string>
|
<string name="bolusstopped">Bolus delivery stopped</string>
|
||||||
|
<string name="key_combo_enable_experimental_features">combo_enable_experimental_features</string>
|
||||||
|
<string name="combo_enable_experimental_features">Enable experimental features</string>
|
||||||
|
<string name="key_combo_enable_experimental_bolus">combo_enable_experimental_bolus</string>
|
||||||
|
<string name="combo_enable_experimental_bolus">Experimental bolus</string>
|
||||||
|
<string name="key_combo_enable_experimental_split_bolus">combo_experimental_split_bolus</string>
|
||||||
|
<string name="combo_enable_experimental_split_bolus">Experimental split bolus feature</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,21 @@
|
||||||
android:key="combopump"
|
android:key="combopump"
|
||||||
android:title="@string/combopump_settings">
|
android:title="@string/combopump_settings">
|
||||||
|
|
||||||
|
<SwitchPreference
|
||||||
|
android:defaultValue="false"
|
||||||
|
android:key="@string/key_combo_enable_experimental_features"
|
||||||
|
android:title="@string/combo_enable_experimental_features" />
|
||||||
|
<SwitchPreference
|
||||||
|
android:dependency="@string/key_combo_enable_experimental_features"
|
||||||
|
android:defaultValue="false"
|
||||||
|
android:key="@string/key_combo_enable_experimental_bolus"
|
||||||
|
android:title="@string/combo_enable_experimental_bolus" />
|
||||||
|
<SwitchPreference
|
||||||
|
android:dependency="@string/key_combo_enable_experimental_features"
|
||||||
|
android:defaultValue="false"
|
||||||
|
android:key="@string/key_combo_enable_experimental_split_bolus"
|
||||||
|
android:title="@string/combo_enable_experimental_split_bolus" />
|
||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
Loading…
Reference in a new issue