Merge branch 'dev' into newautosens

This commit is contained in:
Milos Kozak 2017-06-19 23:13:29 +02:00
commit c728174858
6 changed files with 26 additions and 3 deletions

View file

@ -1018,7 +1018,7 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
if (profileSwitch != null) { if (profileSwitch != null) {
if (profileSwitch.profileJson != null) { if (profileSwitch.profileJson != null) {
return profileSwitch.getProfileObject(); return profileSwitch.getProfileObject();
} else { } else if (activeProfile.getProfile() != null){
Profile profile = activeProfile.getProfile().getSpecificProfile(profileSwitch.profileName); Profile profile = activeProfile.getProfile().getSpecificProfile(profileSwitch.profileName);
if (profile != null) if (profile != null)
return profile; return profile;

View file

@ -234,6 +234,12 @@ public class LoopPlugin implements PluginBase {
return; return;
} }
if (configBuilder.getProfile() == null) {
log.debug(MainApp.sResources.getString(R.string.noprofileselected));
MainApp.bus().post(new EventLoopSetLastRunGui(MainApp.sResources.getString(R.string.noprofileselected)));
return;
}
// Check if pump info is loaded // Check if pump info is loaded
if (configBuilder.getBaseBasalRate() < 0.01d) return; if (configBuilder.getBaseBasalRate() < 0.01d) return;

View file

@ -135,6 +135,13 @@ public class OpenAPSAMAPlugin implements PluginBase, APSInterface {
Profile profile = MainApp.getConfigBuilder().getProfile(); Profile profile = MainApp.getConfigBuilder().getProfile();
PumpInterface pump = MainApp.getConfigBuilder(); PumpInterface pump = MainApp.getConfigBuilder();
if (profile == null) {
MainApp.bus().post(new EventOpenAPSUpdateResultGui(MainApp.instance().getString(R.string.noprofileselected)));
if (Config.logAPSResult)
log.debug(MainApp.instance().getString(R.string.noprofileselected));
return;
}
if (!isEnabled(PluginBase.APS)) { if (!isEnabled(PluginBase.APS)) {
MainApp.bus().post(new EventOpenAPSUpdateResultGui(MainApp.instance().getString(R.string.openapsma_disabled))); MainApp.bus().post(new EventOpenAPSUpdateResultGui(MainApp.instance().getString(R.string.openapsma_disabled)));
if (Config.logAPSResult) if (Config.logAPSResult)

View file

@ -133,6 +133,13 @@ public class OpenAPSMAPlugin implements PluginBase, APSInterface {
Profile profile = MainApp.getConfigBuilder().getProfile(); Profile profile = MainApp.getConfigBuilder().getProfile();
PumpInterface pump = MainApp.getConfigBuilder(); PumpInterface pump = MainApp.getConfigBuilder();
if (profile == null) {
MainApp.bus().post(new EventOpenAPSUpdateResultGui(MainApp.instance().getString(R.string.noprofileselected)));
if (Config.logAPSResult)
log.debug(MainApp.instance().getString(R.string.noprofileselected));
return;
}
if (!isEnabled(PluginBase.APS)) { if (!isEnabled(PluginBase.APS)) {
MainApp.bus().post(new EventOpenAPSUpdateResultGui(MainApp.instance().getString(R.string.openapsma_disabled))); MainApp.bus().post(new EventOpenAPSUpdateResultGui(MainApp.instance().getString(R.string.openapsma_disabled)));
if (Config.logAPSResult) if (Config.logAPSResult)

View file

@ -1148,12 +1148,12 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
predHours = Math.min(2, predHours); predHours = Math.min(2, predHours);
predHours = Math.max(0, predHours); predHours = Math.max(0, predHours);
hoursToFetch = rangeToDisplay - predHours; hoursToFetch = rangeToDisplay - predHours;
toTime = calendar.getTimeInMillis() + 60000; // little bit more to avoid wrong rounding toTime = calendar.getTimeInMillis() + 100000; // little bit more to avoid wrong rounding - Graphview specific
fromTime = toTime - hoursToFetch * 60 * 60 * 1000L; fromTime = toTime - hoursToFetch * 60 * 60 * 1000L;
endTime = toTime + predHours * 60 * 60 * 1000L; endTime = toTime + predHours * 60 * 60 * 1000L;
} else { } else {
hoursToFetch = rangeToDisplay; hoursToFetch = rangeToDisplay;
toTime = calendar.getTimeInMillis() + 600000; // little bit more to avoid wrong rounding toTime = calendar.getTimeInMillis() + 100000; // little bit more to avoid wrong rounding - Graphview specific
fromTime = toTime - hoursToFetch * 60 * 60 * 1000L; fromTime = toTime - hoursToFetch * 60 * 60 * 1000L;
endTime = toTime; endTime = toTime;
} }

View file

@ -115,6 +115,9 @@ public class PersistentNotificationPlugin implements PluginBase {
String line1 = ctx.getString(R.string.noprofile); String line1 = ctx.getString(R.string.noprofile);
if (MainApp.getConfigBuilder().getActiveProfileInterface() == null || MainApp.getConfigBuilder().getProfile() == null)
return;
String units = MainApp.getConfigBuilder().getProfileUnits(); String units = MainApp.getConfigBuilder().getProfileUnits();