Wear wizard: add TT config option.

This commit is contained in:
Johannes Mockenhaupt 2018-05-08 13:23:54 +02:00
parent 3f1469b211
commit ce6e53e9c6
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1
3 changed files with 11 additions and 1 deletions

View file

@ -196,6 +196,7 @@ public class ActionStringHandler {
}
boolean useBG = SP.getBoolean(R.string.key_wearwizard_bg, true);
boolean useTT = SP.getBoolean(R.string.key_wearwizard_tt, false);
boolean useBolusIOB = SP.getBoolean(R.string.key_wearwizard_bolusiob, true);
boolean useBasalIOB = SP.getBoolean(R.string.key_wearwizard_basaliob, true);
boolean useCOB = SP.getBoolean(R.string.key_wearwizard_cob, true);
@ -223,7 +224,9 @@ public class ActionStringHandler {
DecimalFormat format = new DecimalFormat("0.00");
DecimalFormat formatInt = new DecimalFormat("0");
BolusWizard bolusWizard = new BolusWizard();
bolusWizard.doCalc(profile, null, carbsAfterConstraints, useCOB?cobInfo.displayCob:0d, useBG ? bgReading.valueToUnits(profile.getUnits()) : 0d, 0d, percentage, useBolusIOB, useBasalIOB, false, useTrend);
bolusWizard.doCalc(profile, useTT ? TreatmentsPlugin.getPlugin().getTempTargetFromHistory() : null,
carbsAfterConstraints, useCOB?cobInfo.displayCob:0d, useBG ? bgReading.valueToUnits(profile.getUnits()) : 0d,
0d, percentage, useBolusIOB, useBasalIOB, false, useTrend);
Double insulinAfterConstraints = MainApp.getConstraintChecker().applyBolusConstraints(new Constraint<>(bolusWizard.calculatedTotalInsulin)).value();
if (insulinAfterConstraints - bolusWizard.calculatedTotalInsulin != 0) {

View file

@ -1037,6 +1037,7 @@
<string name="ns_autobackfill_title">Autobackfill BG</string>
<string name="wear_wizard_settings">Wizard Settings</string>
<string translatable="false" name="key_wearwizard_bg">wearwizard_bg</string>
<string translatable="false" name="key_wearwizard_tt">wearwizard_tt</string>
<string translatable="false" name="key_wearwizard_trend">wearwizard_trend</string>
<string translatable="false" name="key_wearwizard_cob">wearwizard_cob</string>
<string translatable="false" name="key_wearwizard_bolusiob">wearwizard_bolusiob</string>

View file

@ -25,6 +25,12 @@
android:defaultValue="true"
android:dependency="wearcontrol"/>
<CheckBoxPreference
android:key="@string/key_wearwizard_tt"
android:title="@string/treatments_wizard_tt_label"
android:defaultValue="false"
android:dependency="wearcontrol"/>
<CheckBoxPreference
android:key="@string/key_wearwizard_trend"
android:title="@string/treatments_wizard_bgtrend_label"