Show SMBs in graph on lower end of target area.
This commit is contained in:
parent
1cb92861b5
commit
b6b86e8f4a
|
@ -16,6 +16,7 @@ import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.data.Iob;
|
import info.nightscout.androidaps.data.Iob;
|
||||||
import info.nightscout.androidaps.interfaces.InsulinInterface;
|
import info.nightscout.androidaps.interfaces.InsulinInterface;
|
||||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||||
|
import info.nightscout.androidaps.plugins.Overview.OverviewPlugin;
|
||||||
import info.nightscout.androidaps.plugins.Overview.graphExtensions.DataPointWithLabelInterface;
|
import info.nightscout.androidaps.plugins.Overview.graphExtensions.DataPointWithLabelInterface;
|
||||||
import info.nightscout.androidaps.plugins.Overview.graphExtensions.PointsWithLabelGraphSeries;
|
import info.nightscout.androidaps.plugins.Overview.graphExtensions.PointsWithLabelGraphSeries;
|
||||||
import info.nightscout.utils.DateUtil;
|
import info.nightscout.utils.DateUtil;
|
||||||
|
@ -121,7 +122,7 @@ public class Treatment implements DataPointWithLabelInterface {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getY() {
|
public double getY() {
|
||||||
return yValue;
|
return isSMB ? OverviewPlugin.getPlugin().determineLowLine() : yValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1015,16 +1015,8 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
double lowLineSetting = SP.getDouble("low_mark", Profile.fromMgdlToUnits(OverviewPlugin.bgTargetLow, units));
|
final double lowLine = OverviewPlugin.getPlugin().determineLowLine(units);
|
||||||
double highLineSetting = SP.getDouble("high_mark", Profile.fromMgdlToUnits(OverviewPlugin.bgTargetHigh, units));
|
final double highLine = OverviewPlugin.getPlugin().determineHighLine(units);
|
||||||
|
|
||||||
if (lowLineSetting < 1)
|
|
||||||
lowLineSetting = Profile.fromMgdlToUnits(76d, units);
|
|
||||||
if (highLineSetting < 1)
|
|
||||||
highLineSetting = Profile.fromMgdlToUnits(180d, units);
|
|
||||||
|
|
||||||
final double lowLine = lowLineSetting;
|
|
||||||
final double highLine = highLineSetting;
|
|
||||||
|
|
||||||
//Start with updating the BG as it is unaffected by loop.
|
//Start with updating the BG as it is unaffected by loop.
|
||||||
// **** BG value ****
|
// **** BG value ****
|
||||||
|
|
|
@ -9,6 +9,7 @@ import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
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.Profile;
|
||||||
import info.nightscout.androidaps.data.QuickWizard;
|
import info.nightscout.androidaps.data.QuickWizard;
|
||||||
import info.nightscout.androidaps.events.EventRefreshOverview;
|
import info.nightscout.androidaps.events.EventRefreshOverview;
|
||||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||||
|
@ -26,7 +27,6 @@ public class OverviewPlugin implements PluginBase {
|
||||||
private static OverviewPlugin overviewPlugin = new OverviewPlugin();
|
private static OverviewPlugin overviewPlugin = new OverviewPlugin();
|
||||||
|
|
||||||
public static OverviewPlugin getPlugin() {
|
public static OverviewPlugin getPlugin() {
|
||||||
|
|
||||||
if (overviewPlugin == null)
|
if (overviewPlugin == null)
|
||||||
overviewPlugin = new OverviewPlugin();
|
overviewPlugin = new OverviewPlugin();
|
||||||
return overviewPlugin;
|
return overviewPlugin;
|
||||||
|
@ -128,4 +128,34 @@ public class OverviewPlugin implements PluginBase {
|
||||||
MainApp.bus().post(new EventRefreshOverview("EventDismissNotification"));
|
MainApp.bus().post(new EventRefreshOverview("EventDismissNotification"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double determineHighLine() {
|
||||||
|
Profile profile = MainApp.getConfigBuilder().getProfile();
|
||||||
|
if (profile == null) {
|
||||||
|
return bgTargetHigh;
|
||||||
|
}
|
||||||
|
return determineHighLine(profile.getUnits());
|
||||||
|
}
|
||||||
|
|
||||||
|
public double determineHighLine(String units) {
|
||||||
|
double highLineSetting = SP.getDouble("high_mark", Profile.fromMgdlToUnits(OverviewPlugin.bgTargetHigh, units));
|
||||||
|
if (highLineSetting < 1)
|
||||||
|
highLineSetting = Profile.fromMgdlToUnits(180d, units);
|
||||||
|
return highLineSetting;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double determineLowLine() {
|
||||||
|
Profile profile = MainApp.getConfigBuilder().getProfile();
|
||||||
|
if (profile == null) {
|
||||||
|
return bgTargetLow;
|
||||||
|
}
|
||||||
|
return determineLowLine(profile.getUnits());
|
||||||
|
}
|
||||||
|
|
||||||
|
public double determineLowLine(String units) {
|
||||||
|
double lowLineSetting = SP.getDouble("low_mark", Profile.fromMgdlToUnits(OverviewPlugin.bgTargetLow, units));
|
||||||
|
if (lowLineSetting < 1)
|
||||||
|
lowLineSetting = Profile.fromMgdlToUnits(76d, units);
|
||||||
|
return lowLineSetting;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue