Merge pull request #706 from jotomo/smb-on-graph
Show SMBs in graph on lower end of target area.
This commit is contained in:
commit
6457c3c54a
|
@ -16,6 +16,7 @@ import info.nightscout.androidaps.R;
|
|||
import info.nightscout.androidaps.data.Iob;
|
||||
import info.nightscout.androidaps.interfaces.InsulinInterface;
|
||||
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.PointsWithLabelGraphSeries;
|
||||
import info.nightscout.utils.DateUtil;
|
||||
|
@ -121,7 +122,7 @@ public class Treatment implements DataPointWithLabelInterface {
|
|||
|
||||
@Override
|
||||
public double getY() {
|
||||
return yValue;
|
||||
return isSMB ? OverviewPlugin.getPlugin().determineLowLine() : yValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1015,16 +1015,8 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
return;
|
||||
}
|
||||
|
||||
double lowLineSetting = SP.getDouble("low_mark", Profile.fromMgdlToUnits(OverviewPlugin.bgTargetLow, units));
|
||||
double highLineSetting = SP.getDouble("high_mark", Profile.fromMgdlToUnits(OverviewPlugin.bgTargetHigh, 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;
|
||||
final double lowLine = OverviewPlugin.getPlugin().determineLowLine(units);
|
||||
final double highLine = OverviewPlugin.getPlugin().determineHighLine(units);
|
||||
|
||||
//Start with updating the BG as it is unaffected by loop.
|
||||
// **** BG value ****
|
||||
|
|
|
@ -9,6 +9,7 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.data.Profile;
|
||||
import info.nightscout.androidaps.data.QuickWizard;
|
||||
import info.nightscout.androidaps.events.EventRefreshOverview;
|
||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||
|
@ -26,7 +27,6 @@ public class OverviewPlugin implements PluginBase {
|
|||
private static OverviewPlugin overviewPlugin = new OverviewPlugin();
|
||||
|
||||
public static OverviewPlugin getPlugin() {
|
||||
|
||||
if (overviewPlugin == null)
|
||||
overviewPlugin = new OverviewPlugin();
|
||||
return overviewPlugin;
|
||||
|
@ -128,4 +128,34 @@ public class OverviewPlugin implements PluginBase {
|
|||
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