This commit is contained in:
Milos Kozak 2017-01-13 20:31:20 +01:00
commit dcc6acdf31
4 changed files with 23 additions and 8 deletions

View file

@ -36,6 +36,7 @@ public class Constants {
public static final int BOLUSSNOOZE_DIA_ADVISOR = 2; public static final int BOLUSSNOOZE_DIA_ADVISOR = 2;
public static final double AUTOSENS_MAX = 1.2d; public static final double AUTOSENS_MAX = 1.2d;
public static final double AUTOSENS_MIN = 0.7d; public static final double AUTOSENS_MIN = 0.7d;
public static final boolean AUTOSENS_ADJUST_TARGETS = false;
public static final double MIN_5M_CARBIMPACT = 3d; public static final double MIN_5M_CARBIMPACT = 3d;
// Circadian Percentage Profile // Circadian Percentage Profile

View file

@ -177,7 +177,7 @@ public class ObjectivesPlugin implements PluginBase, ConstraintsInterface {
MainApp.sResources.getString(R.string.objectives_6_objective), MainApp.sResources.getString(R.string.objectives_6_objective),
"", "",
new Date(0), new Date(0),
1, 14,
new Date(0))); new Date(0)));
} }

View file

@ -232,7 +232,7 @@ public class DetermineBasalAdapterAMAJS {
mProfile.add("skip_neutral_temps", true); mProfile.add("skip_neutral_temps", true);
mProfile.add("current_basal", pump.getBaseBasalRate()); mProfile.add("current_basal", pump.getBaseBasalRate());
mProfile.add("temptargetSet", tempTargetSet); mProfile.add("temptargetSet", tempTargetSet);
mProfile.add("autosens_adjust_targets", MainApp.getConfigBuilder().isAMAModeEnabled()); mProfile.add("autosens_adjust_targets", Constants.AUTOSENS_ADJUST_TARGETS);
mProfile.add("min_5m_carbimpact", min_5m_carbimpact); mProfile.add("min_5m_carbimpact", min_5m_carbimpact);
mV8rt.add(PARAM_profile, mProfile); mV8rt.add(PARAM_profile, mProfile);

View file

@ -676,6 +676,7 @@ public class OverviewFragment extends Fragment {
highLine = NSProfile.fromMgdlToUnits(OverviewPlugin.bgTargetHigh, units); highLine = NSProfile.fromMgdlToUnits(OverviewPlugin.bgTargetHigh, units);
} }
LineGraphSeries<DataPoint> basalsLineSeries = null;
BarGraphSeries<DataPoint> basalsSeries = null; BarGraphSeries<DataPoint> basalsSeries = null;
LineGraphSeries<DataPoint> seriesLow = null; LineGraphSeries<DataPoint> seriesLow = null;
LineGraphSeries<DataPoint> seriesHigh = null; LineGraphSeries<DataPoint> seriesHigh = null;
@ -717,13 +718,21 @@ public class OverviewFragment extends Fragment {
long now = new Date().getTime(); long now = new Date().getTime();
if (pump.getPumpDescription().isTempBasalCapable) { if (pump.getPumpDescription().isTempBasalCapable) {
List<BarDataPoint> basalArray = new ArrayList<BarDataPoint>(); List<BarDataPoint> basalArray = new ArrayList<BarDataPoint>();
List<DataPoint> basalLineArray = new ArrayList<DataPoint>();
double lastBaseBasal = 0;
for (long time = fromTime; time < now; time += 5 * 60 * 1000L) { for (long time = fromTime; time < now; time += 5 * 60 * 1000L) {
TempBasal tb = MainApp.getConfigBuilder().getTempBasal(new Date(time)); TempBasal tb = MainApp.getConfigBuilder().getTempBasal(new Date(time));
double basebasal = profile.getBasal(NSProfile.secondsFromMidnight(new Date(time)));
Double basal = 0d; Double basal = 0d;
if (tb != null) if (tb != null)
basalArray.add(new BarDataPoint(time, basal = tb.tempBasalConvertedToAbsolute(new Date(time)), true)); basalArray.add(new BarDataPoint(time, basal = tb.tempBasalConvertedToAbsolute(new Date(time)), true));
else else {
basalArray.add(new BarDataPoint(time, basal = profile.getBasal(NSProfile.secondsFromMidnight(new Date(time))), false)); basalArray.add(new BarDataPoint(time, basal = basebasal, false));
}
if (basebasal != lastBaseBasal)
basalLineArray.add(new DataPoint(time, lastBaseBasal));
basalLineArray.add(new DataPoint(time, basebasal));
lastBaseBasal = basebasal;
maxBasalValueFound = Math.max(maxBasalValueFound, basal); maxBasalValueFound = Math.max(maxBasalValueFound, basal);
} }
BarDataPoint[] basal = new BarDataPoint[basalArray.size()]; BarDataPoint[] basal = new BarDataPoint[basalArray.size()];
@ -737,6 +746,12 @@ public class OverviewFragment extends Fragment {
else return Color.CYAN; else return Color.CYAN;
} }
}); });
DataPoint[] basalLine = new DataPoint[basalLineArray.size()];
basalLine = basalLineArray.toArray(basalLine);
bgGraph.addSeries(basalsLineSeries = new LineGraphSeries<DataPoint>(basalLine));
basalsLineSeries.setColor(Color.CYAN);
basalsLineSeries.setDrawDataPoints(false);
basalsLineSeries.setThickness(2);
} }
// set manual x bounds to have nice steps // set manual x bounds to have nice steps
@ -814,8 +829,8 @@ public class OverviewFragment extends Fragment {
// custom paint to make a dotted line // custom paint to make a dotted line
Paint paint = new Paint(); Paint paint = new Paint();
paint.setStyle(Paint.Style.STROKE); paint.setStyle(Paint.Style.STROKE);
paint.setStrokeWidth(1); paint.setStrokeWidth(2);
paint.setPathEffect(new DashPathEffect(new float[]{4, 20}, 0)); paint.setPathEffect(new DashPathEffect(new float[]{10, 20}, 0));
paint.setColor(Color.WHITE); paint.setColor(Color.WHITE);
seriesNow.setCustomPaint(paint); seriesNow.setCustomPaint(paint);
@ -848,12 +863,11 @@ public class OverviewFragment extends Fragment {
// set second scale // set second scale
if (pump.getPumpDescription().isTempBasalCapable) { if (pump.getPumpDescription().isTempBasalCapable) {
bgGraph.getSecondScale().addSeries(basalsSeries); bgGraph.getSecondScale().addSeries(basalsSeries);
bgGraph.getSecondScale().addSeries(basalsLineSeries);
bgGraph.getSecondScale().setMinY(0); bgGraph.getSecondScale().setMinY(0);
bgGraph.getSecondScale().setMaxY(maxBgValue / lowLine * maxBasalValueFound * 1.2d); bgGraph.getSecondScale().setMaxY(maxBgValue / lowLine * maxBasalValueFound * 1.2d);
bgGraph.getGridLabelRenderer().setVerticalLabelsSecondScaleColor(MainApp.instance().getResources().getColor(R.color.background_material_dark)); // same color as backround = hide bgGraph.getGridLabelRenderer().setVerticalLabelsSecondScaleColor(MainApp.instance().getResources().getColor(R.color.background_material_dark)); // same color as backround = hide
} }
} }
//Notifications //Notifications